diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/EntitySilverfish.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntitySilverfish.java | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java index 0e9abd63..88a90661 100644 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import net.minecraft.util.org.apache.commons.lang3.tuple.ImmutablePair; + import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit public class EntitySilverfish extends EntityMonster { @@ -11,14 +13,14 @@ public class EntitySilverfish extends EntityMonster { this.a(0.3F, 0.7F); } - protected void az() { - super.az(); + protected void aD() { + super.aD(); this.getAttributeInstance(GenericAttributes.a).setValue(8.0D); this.getAttributeInstance(GenericAttributes.d).setValue(0.6000000238418579D); this.getAttributeInstance(GenericAttributes.e).setValue(1.0D); } - protected boolean e_() { + protected boolean g_() { return false; } @@ -28,15 +30,15 @@ public class EntitySilverfish extends EntityMonster { return this.world.findNearbyVulnerablePlayer(this, d0); } - protected String r() { + protected String t() { return "mob.silverfish.say"; } - protected String aO() { + protected String aT() { return "mob.silverfish.hit"; } - protected String aP() { + protected String aU() { return "mob.silverfish.kill"; } @@ -59,21 +61,21 @@ public class EntitySilverfish extends EntityMonster { } } - protected void a(int i, int j, int k, int l) { + protected void a(int i, int j, int k, Block block) { this.makeSound("mob.silverfish.step", 0.15F, 1.0F); } - protected int getLootId() { - return 0; + protected Item getLoot() { + return Item.d(0); } - public void l_() { + public void h() { this.aN = this.yaw; - super.l_(); + super.h(); } - protected void bl() { - super.bl(); + protected void bq() { + super.bq(); if (!this.world.isStatic) { int i; int j; @@ -88,36 +90,25 @@ public class EntitySilverfish extends EntityMonster { k = MathHelper.floor(this.locZ); boolean flag = false; - for (l = 0; !flag && l <= 5 && l >= -5; l = l <= 0 ? 1 - l : 0 - l) { - for (int i1 = 0; !flag && i1 <= 10 && i1 >= -10; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) { + for (int i1 = 0; !flag && i1 <= 5 && i1 >= -5; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) { + for (l = 0; !flag && l <= 10 && l >= -10; l = l <= 0 ? 1 - l : 0 - l) { for (int j1 = 0; !flag && j1 <= 10 && j1 >= -10; j1 = j1 <= 0 ? 1 - j1 : 0 - j1) { - int k1 = this.world.getTypeId(i + i1, j + l, k + j1); - - if (k1 == Block.MONSTER_EGGS.id) { + if (this.world.getType(i + l, j + i1, k + j1) == Blocks.MONSTER_EGGS) { // CraftBukkit start - if (CraftEventFactory.callEntityChangeBlockEvent(this, i + i1, j + l, k + j1, 0, 0).isCancelled()) { + if (CraftEventFactory.callEntityChangeBlockEvent(this, i + l, j + i1, k + j1, Blocks.AIR, 0).isCancelled()) { continue; } // CraftBukkit end - if (!this.world.getGameRules().getBoolean("mobGriefing")) { - int l1 = this.world.getData(i + i1, j + l, k + j1); - Block block = Block.STONE; - - if (l1 == 1) { - block = Block.COBBLESTONE; - } - - if (l1 == 2) { - block = Block.SMOOTH_BRICK; - } + int k1 = this.world.getData(i + l, j + i1, k + j1); + ImmutablePair immutablepair = BlockMonsterEggs.b(k1); - this.world.setTypeIdAndData(i + i1, j + l, k + j1, block.id, 0, 3); + this.world.setTypeAndData(i + l, j + i1, k + j1, (Block) immutablepair.getLeft(), ((Integer) immutablepair.getRight()).intValue(), 3); } else { - this.world.setAir(i + i1, j + l, k + j1, false); + this.world.setAir(i + l, j + i1, k + j1, false); } - Block.MONSTER_EGGS.postBreak(this.world, i + i1, j + l, k + j1, 0); + Blocks.MONSTER_EGGS.postBreak(this.world, i + l, j + i1, k + j1, 0); if (this.random.nextBoolean()) { flag = true; break; @@ -129,37 +120,38 @@ public class EntitySilverfish extends EntityMonster { } } - if (this.target == null && !this.bM()) { + if (this.target == null && !this.bQ()) { i = MathHelper.floor(this.locX); j = MathHelper.floor(this.locY + 0.5D); k = MathHelper.floor(this.locZ); - int i2 = this.random.nextInt(6); + int l1 = this.random.nextInt(6); + Block block = this.world.getType(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]); - l = this.world.getTypeId(i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2]); - if (BlockMonsterEggs.d(l)) { + l = this.world.getData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]); + if (BlockMonsterEggs.a(block)) { // CraftBukkit start - if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l)).isCancelled()) { + if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, Block.b(BlockMonsterEggs.e(l))).isCancelled()) { return; } // CraftBukkit end - this.world.setTypeIdAndData(i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l), 3); - this.q(); + this.world.setTypeAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, BlockMonsterEggs.a(block, l), 3); + this.s(); this.die(); } else { - this.bK(); + this.bO(); } - } else if (this.target != null && !this.bM()) { + } else if (this.target != null && !this.bQ()) { this.target = null; } } } public float a(int i, int j, int k) { - return this.world.getTypeId(i, j - 1, k) == Block.STONE.id ? 10.0F : super.a(i, j, k); + return this.world.getType(i, j - 1, k) == Blocks.STONE ? 10.0F : super.a(i, j, k); } - protected boolean i_() { + protected boolean j_() { return true; } |