001 002 import java.util.HashSet; 003 import java.util.LinkedList; 004 import java.util.List; 005 import java.util.Random; 006 import java.util.Set; 007 import net.minecraft.server.MinecraftServer; 008 009 public class fy extends hl 010 implements ep { 011 012 public lp a; 013 public MinecraftServer b; 014 public md c; 015 public double d; 016 public double e; 017 public List f = new LinkedList(); 018 public Set ak = new HashSet(); 019 public double al; 020 private int bD = -99999999; 021 private int bE = 60; 022 private jl[] bF = {null, null, null, null, null}; 023 private int bG = 0; 024 public boolean am; 025 // hMod: Player storage 026 private Player player; 027 // hMod: for the inventory move hook 028 private Inventory lastOpenedInventory; 029 030 public fy(MinecraftServer paramMinecraftServer, fv paramfv, String paramString, md parammd) { 031 super(paramfv); 032 033 int i = paramfv.m; 034 int j = paramfv.o; 035 int k = paramfv.n; 036 037 if (!paramfv.q.e) { 038 i += W.nextInt(20) - 10; 039 k = paramfv.e(i, j); 040 j += W.nextInt(20) - 10; 041 } 042 c(i + 0.5D, k, j + 0.5D, 0.0F, 0.0F); 043 044 b = paramMinecraftServer; 045 S = 0.0F; 046 parammd.a = this; 047 aw = paramString; 048 c = parammd; 049 H = 0.0F; 050 // hMod: So we don't conflict with runecraft 051 this.c = new Digging(paramfv, this); 052 053 // hMod: Store player 054 player = etc.getDataSource().getPlayer(paramString); 055 player.setUser(this); 056 } 057 058 /** 059 * Returns the player 060 * 061 * @return player 062 */ 063 public Player getPlayer() { 064 return player; 065 } 066 067 /** 068 * Reloads the player 069 */ 070 public void reloadPlayer() { 071 player = etc.getDataSource().getPlayer(aw); 072 player.setUser(this); 073 } 074 075 public void l() { 076 // hMod: Make sure this gets cast correctly, or mutant puppies will spawn and eat your items. 077 ap.a((ep) this); 078 } 079 080 public jl[] I() { 081 return bF; 082 } 083 084 public void b_() { 085 bE -= 1; 086 ap.a(); 087 088 for (int i = 0; i < 5; i++) { 089 jl localjl = a(i); 090 if (localjl != bF[i]) { 091 b.k.a(this, new v(g, i, localjl)); 092 bF[i] = localjl; 093 } 094 } 095 } 096 097 public jl a(int paramInt) { 098 if (paramInt == 0) { 099 return an.e(); 100 } 101 return an.b[(paramInt - 1)]; 102 } 103 104 public void f(fe paramfe) { 105 // hMod: drops inventory on death. 106 if (etc.getInstance().isHealthEnabled()) { 107 an.h(); 108 } 109 } 110 111 public boolean a(fe paramfe, int paramInt) { 112 if (bE > 0) { 113 return false; 114 } 115 116 if (!b.n) { 117 if ((paramfe instanceof hl)) { 118 return false; 119 } 120 if ((paramfe instanceof fc)) { 121 fc localfc = (fc) paramfe; 122 if ((localfc.b instanceof hl)) { 123 return false; 124 } 125 } 126 } 127 return super.a(paramfe, paramInt); 128 } 129 130 public void d(int paramInt) { 131 super.d(paramInt); 132 } 133 134 public void n() { 135 super.b_(); 136 137 mr localObject1 = null; 138 139 double d1 = 0.0D; 140 mr localObject2; 141 for (int i = 0; i < f.size(); i++) { 142 localObject2 = (mr) f.get(i); 143 double d2 = ((mr) localObject2).a(this); 144 if ((i == 0) || (d2 < d1)) { 145 localObject1 = localObject2; 146 d1 = ((mr) localObject2).a(this); 147 } 148 } 149 150 if (localObject1 != null) { 151 int i = 0; 152 153 if (d1 < 1024.0D) { 154 i = 1; 155 } 156 if (a.b() < 2) { 157 i = 1; 158 } 159 160 if (i != 0) { 161 f.remove(localObject1); 162 a.b(new er(localObject1.a * 16, 0, localObject1.b * 16, 16, 128, 16, b.e)); 163 List list = b.e.d(localObject1.a * 16, 0, localObject1.b * 16, localObject1.a * 16 + 16, 128, localObject1.b * 16 + 16); 164 for (int j = 0; j < ((List) list).size(); j++) { 165 a((bm) ((List) list).get(j));// TODO : Complex block stuff. Move to a(bg)? 166 } 167 } 168 } 169 170 // hMod: Update the health 171 if (this.ba != this.bE) { 172 //updates your health when it is changed. 173 if (!etc.getInstance().isHealthEnabled()) { 174 this.aZ = 20; 175 this.bi = false; 176 } else { 177 if ((Boolean) etc.getLoader().callHook(PluginLoader.Hook.HEALTH_CHANGE, getPlayer(), bD, aZ)) { 178 aZ = bD; 179 } else { 180 a.b(new fj(aZ)); 181 } 182 } 183 bD = aZ; 184 } 185 } 186 187 private void a(bm parambm) { 188 if (parambm != null) { 189 // hMod: Let plugins know we're showing a sign 190 if (parambm instanceof lv) { 191 Sign sign = new Sign((lv) parambm); 192 etc.getLoader().callHook(PluginLoader.Hook.SIGN_SHOW, getPlayer(), sign); 193 } 194 kx localkx = parambm.g(); 195 if (localkx != null) { 196 a.b(localkx); 197 } 198 } 199 } 200 201 public void o() { 202 s = (this.t = this.u = 0.0D); 203 bA = false; 204 super.o(); 205 } 206 207 public void c(fe paramfe, int paramInt) { 208 if (!paramfe.G) { 209 if ((paramfe instanceof ic)) { 210 b.k.a(paramfe, new dq(paramfe.g, g)); 211 } 212 if ((paramfe instanceof fc)) { 213 b.k.a(paramfe, new dq(paramfe.g, g)); 214 } 215 } 216 super.c(paramfe, paramInt); 217 ap.a(); 218 } 219 220 public void K() { 221 if (!au) { 222 av = -1; 223 au = true; 224 b.k.a(this, new z(this, 1)); 225 } 226 } 227 228 public float w() { 229 return 1.62F; 230 } 231 232 public void e(fe paramfe) { 233 super.e(paramfe); 234 a.b(new ab(this, k)); 235 a.a(p, q, r, v, w); 236 } 237 238 protected void a(double paramDouble, boolean paramBoolean) { 239 } 240 241 public void b(double paramDouble, boolean paramBoolean) { 242 super.a(paramDouble, paramBoolean); 243 } 244 245 private void U() { 246 bG = (bG % 100 + 1); 247 } 248 // TODO : fix workbenches 249 public void a(int paramInt1, int paramInt2, int paramInt3) { 250 U(); 251 a.b(new jh(bG, 1, "Crafting", 9)); 252 ap = new jg(an, l, paramInt1, paramInt2, paramInt3); 253 ap.f = bG; 254 // hMod: Make sure this gets cast correctly, or mutant puppies will spawn and eat your items. 255 ap.a((ep) this); 256 } 257 258 public void a(mn parammn) { 259 // hMod: Check if we can open this 260 Inventory inv = null; 261 String name = parammn.b(); 262 if (parammn instanceof kc) { 263 inv = new Chest((kc) parammn); 264 if ((Boolean) etc.getLoader().callHook(PluginLoader.Hook.OPEN_INVENTORY, getPlayer(), inv)) { 265 return; 266 } 267 } else if (parammn instanceof ay) { 268 inv = new DoubleChest((ay) parammn); 269 if ((Boolean) etc.getLoader().callHook(PluginLoader.Hook.OPEN_INVENTORY, getPlayer(), inv)) { 270 return; 271 } 272 } 273 274 if (inv != null) { 275 name = inv.getName(); 276 } 277 this.lastOpenedInventory = inv; 278 U(); 279 a.b(new jh(bG, 0, name, parammn.h_())); 280 ap = new cf(an, parammn); 281 ap.f = bG; 282 // hMod: Make sure this gets cast correctly, or mutant puppies will spawn and eat your items. 283 ap.a((ep) this); 284 } 285 286 public void a(ez paramez) { 287 // hMod: Check if we can open this 288 Inventory inv = new Furnace(paramez); 289 String name = paramez.b(); 290 if ((Boolean) etc.getLoader().callHook(PluginLoader.Hook.OPEN_INVENTORY, getPlayer(), inv)) { 291 return; 292 } 293 294 if (inv != null) { 295 name = inv.getName(); 296 } 297 this.lastOpenedInventory = inv; 298 U(); 299 a.b(new jh(bG, 2, name, paramez.h_())); 300 ap = new bq(an, paramez); 301 ap.f = bG; 302 // hMod: Make sure this gets cast correctly, or mutant puppies will spawn and eat your items. 303 ap.a((ep) this); 304 } 305 /* 306 * new type of inventory ? 307 * TODO: fix dispensers 308 */ 309 310 public void a(bf parambf) { 311 U(); 312 a.b(new jh(bG, 3, parambf.b(), parambf.h_())); 313 ap = new ew(an, parambf); 314 ap.f = bG; 315 // hMod: Make sure this gets cast correctly, or mutant puppies will spawn and eat your items. 316 ap.a((ep) this); 317 } 318 319 public void a(ei paramei, int paramInt, jl paramjl) { 320 if ((paramei.a(paramInt) instanceof mp)) { 321 return; 322 } 323 324 if (am) { 325 return; 326 } 327 328 a.b(new in(paramei.f, paramInt, paramjl)); 329 } 330 331 public void a(ei paramei, List paramList) { 332 a.b(new kn(paramei.f, paramList)); 333 a.b(new in(-1, -1, an.i())); 334 } 335 336 public void a(ei paramei, int paramInt1, int paramInt2) { 337 a.b(new p(paramei.f, paramInt1, paramInt2)); 338 } 339 340 public void a(jl paramjl) { 341 } 342 343 public void L() { 344 a.b(new h(ap.f)); 345 N(); 346 } 347 348 public void M() { 349 if (am) { 350 return; 351 } 352 a.b(new in(-1, -1, an.i())); 353 } 354 355 public void N() { 356 // hMod: Make sure this gets cast correctly, or mutant puppies will spawn and eat your items. 357 ap.a((ep) this); 358 ap = ao; 359 } 360 // hMod: for inventory move hook 361 362 public Inventory getLastOpenedInventory() { 363 return this.lastOpenedInventory; 364 } 365 }