summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/Block.java18
-rw-r--r--src/main/java/net/minecraft/server/BlockButton.java44
-rw-r--r--src/main/java/net/minecraft/server/BlockCommand.java21
-rw-r--r--src/main/java/net/minecraft/server/BlockCrops.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockDoor.java10
-rw-r--r--src/main/java/net/minecraft/server/BlockDragonEgg.java47
-rw-r--r--src/main/java/net/minecraft/server/BlockFire.java16
-rw-r--r--src/main/java/net/minecraft/server/BlockIce.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockLeaves.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockLever.java58
-rw-r--r--src/main/java/net/minecraft/server/BlockMushroom.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockNetherWart.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockPiston.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockPortal.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlate.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockPumpkin.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneOre.java12
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneTorch.java10
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneWire.java48
-rw-r--r--src/main/java/net/minecraft/server/BlockSand.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockSkull.java16
-rw-r--r--src/main/java/net/minecraft/server/BlockSnow.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockSoil.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockStem.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockTNT.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockTrapdoor.java21
-rw-r--r--src/main/java/net/minecraft/server/BlockTripwire.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockTripwireHook.java22
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java57
-rw-r--r--src/main/java/net/minecraft/server/ChunkProviderServer.java16
-rw-r--r--src/main/java/net/minecraft/server/ChunkRegionLoader.java12
-rw-r--r--src/main/java/net/minecraft/server/Container.java73
-rw-r--r--src/main/java/net/minecraft/server/ContainerAnvil.java30
-rw-r--r--src/main/java/net/minecraft/server/ContainerBeacon.java14
-rw-r--r--src/main/java/net/minecraft/server/ContainerBrewingStand.java13
-rw-r--r--src/main/java/net/minecraft/server/ContainerChest.java16
-rw-r--r--src/main/java/net/minecraft/server/ContainerDispenser.java6
-rw-r--r--src/main/java/net/minecraft/server/ContainerEnchantTable.java19
-rw-r--r--src/main/java/net/minecraft/server/ContainerFurnace.java13
-rw-r--r--src/main/java/net/minecraft/server/ContainerMerchant.java12
-rw-r--r--src/main/java/net/minecraft/server/ContainerPlayer.java10
-rw-r--r--src/main/java/net/minecraft/server/ContainerWorkbench.java8
-rw-r--r--src/main/java/net/minecraft/server/ControllerMove.java2
-rw-r--r--src/main/java/net/minecraft/server/CraftingManager.java47
-rw-r--r--src/main/java/net/minecraft/server/CrashReport.java151
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServer.java11
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java4
-rw-r--r--src/main/java/net/minecraft/server/Enchantment.java10
-rw-r--r--src/main/java/net/minecraft/server/Entity.java457
-rw-r--r--src/main/java/net/minecraft/server/EntityAgeable.java22
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java37
-rw-r--r--src/main/java/net/minecraft/server/EntityBlaze.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityBoat.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityChicken.java18
-rw-r--r--src/main/java/net/minecraft/server/EntityCow.java22
-rw-r--r--src/main/java/net/minecraft/server/EntityCreature.java28
-rw-r--r--src/main/java/net/minecraft/server/EntityCreeper.java18
-rw-r--r--src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java7
-rw-r--r--src/main/java/net/minecraft/server/EntityEgg.java7
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderCrystal.java30
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderDragon.java138
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderPearl.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderman.java32
-rw-r--r--src/main/java/net/minecraft/server/EntityExperienceOrb.java26
-rw-r--r--src/main/java/net/minecraft/server/EntityFireball.java48
-rw-r--r--src/main/java/net/minecraft/server/EntityFishingHook.java24
-rw-r--r--src/main/java/net/minecraft/server/EntityGhast.java20
-rw-r--r--src/main/java/net/minecraft/server/EntityHanging.java72
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java404
-rw-r--r--src/main/java/net/minecraft/server/EntityIronGolem.java28
-rw-r--r--src/main/java/net/minecraft/server/EntityItem.java87
-rw-r--r--src/main/java/net/minecraft/server/EntityLightning.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityLiving.java472
-rw-r--r--src/main/java/net/minecraft/server/EntityMagmaCube.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecart.java141
-rw-r--r--src/main/java/net/minecraft/server/EntityMonster.java20
-rw-r--r--src/main/java/net/minecraft/server/EntityMushroomCow.java14
-rw-r--r--src/main/java/net/minecraft/server/EntityOcelot.java36
-rw-r--r--src/main/java/net/minecraft/server/EntityPig.java28
-rw-r--r--src/main/java/net/minecraft/server/EntityPigZombie.java54
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java135
-rw-r--r--src/main/java/net/minecraft/server/EntityPotion.java32
-rw-r--r--src/main/java/net/minecraft/server/EntityProjectile.java47
-rw-r--r--src/main/java/net/minecraft/server/EntitySheep.java77
-rw-r--r--src/main/java/net/minecraft/server/EntitySilverfish.java28
-rw-r--r--src/main/java/net/minecraft/server/EntitySkeleton.java89
-rw-r--r--src/main/java/net/minecraft/server/EntitySlime.java41
-rw-r--r--src/main/java/net/minecraft/server/EntitySnowman.java4
-rw-r--r--src/main/java/net/minecraft/server/EntitySpider.java14
-rw-r--r--src/main/java/net/minecraft/server/EntitySquid.java56
-rw-r--r--src/main/java/net/minecraft/server/EntityTracker.java23
-rw-r--r--src/main/java/net/minecraft/server/EntityTrackerEntry.java38
-rw-r--r--src/main/java/net/minecraft/server/EntityWitch.java26
-rw-r--r--src/main/java/net/minecraft/server/EntityWither.java84
-rw-r--r--src/main/java/net/minecraft/server/EntityWitherSkull.java2
-rw-r--r--src/main/java/net/minecraft/server/EntityWolf.java74
-rw-r--r--src/main/java/net/minecraft/server/EntityZombie.java60
-rw-r--r--src/main/java/net/minecraft/server/Explosion.java8
-rw-r--r--src/main/java/net/minecraft/server/FoodMetaData.java2
-rw-r--r--src/main/java/net/minecraft/server/IInventory.java2
-rw-r--r--src/main/java/net/minecraft/server/InventoryCraftResult.java2
-rw-r--r--src/main/java/net/minecraft/server/InventoryCrafting.java2
-rw-r--r--src/main/java/net/minecraft/server/InventoryEnderChest.java4
-rw-r--r--src/main/java/net/minecraft/server/InventoryLargeChest.java8
-rw-r--r--src/main/java/net/minecraft/server/InventoryMerchant.java2
-rw-r--r--src/main/java/net/minecraft/server/InventorySubcontainer.java11
-rw-r--r--src/main/java/net/minecraft/server/ItemBed.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java8
-rw-r--r--src/main/java/net/minecraft/server/ItemBoat.java38
-rw-r--r--src/main/java/net/minecraft/server/ItemDoor.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemDye.java16
-rw-r--r--src/main/java/net/minecraft/server/ItemFishingRod.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemFood.java28
-rw-r--r--src/main/java/net/minecraft/server/ItemHoe.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemInWorldManager.java7
-rw-r--r--src/main/java/net/minecraft/server/ItemMonsterEgg.java8
-rw-r--r--src/main/java/net/minecraft/server/ItemReed.java7
-rw-r--r--src/main/java/net/minecraft/server/ItemSkull.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemStep.java2
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java67
-rw-r--r--src/main/java/net/minecraft/server/MobEffectList.java8
-rw-r--r--src/main/java/net/minecraft/server/NBTTagCompound.java13
-rw-r--r--src/main/java/net/minecraft/server/NetLoginHandler.java6
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java73
-rw-r--r--src/main/java/net/minecraft/server/NetworkManager.java36
-rw-r--r--src/main/java/net/minecraft/server/Packet51MapChunk.java39
-rw-r--r--src/main/java/net/minecraft/server/Packet56MapChunkBulk.java35
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java6
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java2
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreed.java14
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalEatTile.java6
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java14
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalSelector.java18
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalTarget.java8
-rw-r--r--src/main/java/net/minecraft/server/PlayerInstance.java16
-rw-r--r--src/main/java/net/minecraft/server/PlayerInventory.java33
-rw-r--r--src/main/java/net/minecraft/server/PlayerManager.java12
-rw-r--r--src/main/java/net/minecraft/server/PortalTravelAgent.java319
-rw-r--r--src/main/java/net/minecraft/server/RecipesMapClone.java8
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java54
-rw-r--r--src/main/java/net/minecraft/server/SpawnerCreature.java14
-rw-r--r--src/main/java/net/minecraft/server/TileEntity.java12
-rw-r--r--src/main/java/net/minecraft/server/TileEntityBeacon.java12
-rw-r--r--src/main/java/net/minecraft/server/TileEntityBrewingStand.java6
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java70
-rw-r--r--src/main/java/net/minecraft/server/TileEntityCommand.java2
-rw-r--r--src/main/java/net/minecraft/server/TileEntityDispenser.java2
-rw-r--r--src/main/java/net/minecraft/server/TileEntityFurnace.java2
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java13
-rw-r--r--src/main/java/net/minecraft/server/TileEntityPiston.java4
-rw-r--r--src/main/java/net/minecraft/server/TileEntitySign.java2
-rw-r--r--src/main/java/net/minecraft/server/Village.java9
-rw-r--r--src/main/java/net/minecraft/server/VillageSiege.java4
-rw-r--r--src/main/java/net/minecraft/server/World.java407
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTrees.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldManager.java4
-rw-r--r--src/main/java/net/minecraft/server/WorldMap.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java106
158 files changed, 3212 insertions, 2524 deletions
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 6893134e..f29eace6 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -377,14 +377,14 @@ public class Block {
int l1 = this.getDropType(l, world.random, i1);
if (l1 > 0) {
- this.a(world, i, j, k, new ItemStack(l1, 1, this.getDropData(l)));
+ this.b(world, i, j, k, new ItemStack(l1, 1, this.getDropData(l)));
}
}
}
}
}
- protected void a(World world, int i, int j, int k, ItemStack itemstack) {
+ protected void b(World world, int i, int j, int k, ItemStack itemstack) {
if (!world.isStatic && world.getGameRules().getBoolean("doTileDrops")) {
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
@@ -540,7 +540,9 @@ public class Block {
public void b(World world, int i, int j, int k, Entity entity) {}
- public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {}
+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
+ return i1;
+ }
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
@@ -595,7 +597,7 @@ public class Block {
ItemStack itemstack = this.f_(l);
if (itemstack != null) {
- this.a(world, i, j, k, itemstack);
+ this.b(world, i, j, k, itemstack);
}
} else {
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
@@ -628,6 +630,8 @@ public class Block {
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {}
+ public void postPlace(World world, int i, int j, int k, int l) {}
+
public Block b(String s) {
this.name = "tile." + s;
return this;
@@ -669,7 +673,7 @@ public class Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
- public void g(World world, int i, int j, int k, int l) {}
+ public void h(World world, int i, int j, int k, int l) {}
public void f(World world, int i, int j, int k) {}
@@ -677,6 +681,10 @@ public class Block {
return true;
}
+ public boolean a(Explosion explosion) {
+ return true;
+ }
+
static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
Item.byId[LOG.id] = (new ItemMultiTexture(LOG.id - 256, LOG, BlockLog.a)).b("log");
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java
index 59fa1b51..908b1ede 100644
--- a/src/main/java/net/minecraft/server/BlockButton.java
+++ b/src/main/java/net/minecraft/server/BlockButton.java
@@ -33,35 +33,35 @@ public class BlockButton extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 2 && world.s(i, j, k + 1) ? true : (l == 3 && world.s(i, j, k - 1) ? true : (l == 4 && world.s(i + 1, j, k) ? true : l == 5 && world.s(i - 1, j, k)));
+ return l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.s(i - 1, j, k) ? true : (world.s(i + 1, j, k) ? true : (world.s(i, j, k - 1) ? true : world.s(i, j, k + 1)));
+ return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : world.t(i, j, k + 1)));
}
- public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
- int i1 = world.getData(i, j, k);
- int j1 = i1 & 8;
-
- i1 &= 7;
- if (l == 2 && world.s(i, j, k + 1)) {
- i1 = 4;
- } else if (l == 3 && world.s(i, j, k - 1)) {
- i1 = 3;
- } else if (l == 4 && world.s(i + 1, j, k)) {
- i1 = 2;
- } else if (l == 5 && world.s(i - 1, j, k)) {
- i1 = 1;
+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
+ int j1 = world.getData(i, j, k);
+ int k1 = j1 & 8;
+
+ j1 &= 7;
+ if (l == 2 && world.t(i, j, k + 1)) {
+ j1 = 4;
+ } else if (l == 3 && world.t(i, j, k - 1)) {
+ j1 = 3;
+ } else if (l == 4 && world.t(i + 1, j, k)) {
+ j1 = 2;
+ } else if (l == 5 && world.t(i - 1, j, k)) {
+ j1 = 1;
} else {
- i1 = this.l(world, i, j, k);
+ j1 = this.l(world, i, j, k);
}
- world.setData(i, j, k, i1 + j1);
+ return j1 + k1;
}
private int l(World world, int i, int j, int k) {
- return world.s(i - 1, j, k) ? 1 : (world.s(i + 1, j, k) ? 2 : (world.s(i, j, k - 1) ? 3 : (world.s(i, j, k + 1) ? 4 : 1)));
+ return world.t(i - 1, j, k) ? 1 : (world.t(i + 1, j, k) ? 2 : (world.t(i, j, k - 1) ? 3 : (world.t(i, j, k + 1) ? 4 : 1)));
}
public void doPhysics(World world, int i, int j, int k, int l) {
@@ -69,19 +69,19 @@ public class BlockButton extends Block {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.s(i - 1, j, k) && i1 == 1) {
+ if (!world.t(i - 1, j, k) && i1 == 1) {
flag = true;
}
- if (!world.s(i + 1, j, k) && i1 == 2) {
+ if (!world.t(i + 1, j, k) && i1 == 2) {
flag = true;
}
- if (!world.s(i, j, k - 1) && i1 == 3) {
+ if (!world.t(i, j, k - 1) && i1 == 3) {
flag = true;
}
- if (!world.s(i, j, k + 1) && i1 == 4) {
+ if (!world.t(i, j, k + 1) && i1 == 4) {
flag = true;
}
diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java
index c43ba944..34f50ca4 100644
--- a/src/main/java/net/minecraft/server/BlockCommand.java
+++ b/src/main/java/net/minecraft/server/BlockCommand.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Random;
+
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockCommand extends BlockContainer {
@@ -28,19 +30,26 @@ public class BlockCommand extends BlockContainer {
// CraftBukkit end
if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
- TileEntity tileentity = world.getTileEntity(i, j, k);
-
- if (tileentity != null && tileentity instanceof TileEntityCommand) {
- ((TileEntityCommand) tileentity).a(world);
- }
-
world.setRawData(i, j, k, i1 | 1);
+ world.a(i, j, k, this.id, this.r_());
} else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
world.setRawData(i, j, k, i1 & -2);
}
}
}
+ public void b(World world, int i, int j, int k, Random random) {
+ TileEntity tileentity = world.getTileEntity(i, j, k);
+
+ if (tileentity != null && tileentity instanceof TileEntityCommand) {
+ ((TileEntityCommand) tileentity).a(world);
+ }
+ }
+
+ public int r_() {
+ return 1;
+ }
+
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
TileEntityCommand tileentitycommand = (TileEntityCommand) world.getTileEntity(i, j, k);
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
index ca45aded..a2ce8f94 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -110,7 +110,7 @@ public class BlockCrops extends BlockFlower {
for (int k1 = 0; k1 < j1; ++k1) {
if (world.random.nextInt(15) <= l) {
- this.a(world, i, j, k, new ItemStack(this.h(), 1, 0));
+ this.b(world, i, j, k, new ItemStack(this.h(), 1, 0));
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java
index d87582d6..946fa36a 100644
--- a/src/main/java/net/minecraft/server/BlockDoor.java
+++ b/src/main/java/net/minecraft/server/BlockDoor.java
@@ -159,7 +159,7 @@ public class BlockDoor extends Block {
flag = true;
}
- if (!world.t(i, j - 1, k)) {
+ if (!world.v(i, j - 1, k)) {
world.setTypeId(i, j, k, 0);
flag = true;
if (world.getTypeId(i, j + 1, k) == this.id) {
@@ -210,7 +210,7 @@ public class BlockDoor extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return j >= 255 ? false : world.t(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
+ return j >= 255 ? false : world.v(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
public int q_() {
@@ -235,4 +235,10 @@ public class BlockDoor extends Block {
return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0);
}
+
+ public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
+ if (entityhuman.abilities.canInstantlyBuild && (l & 8) != 0 && world.getTypeId(i, j - 1, k) == this.id) {
+ world.setTypeId(i, j - 1, k, 0);
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
index 2b4257c9..5deafecd 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -56,30 +56,31 @@ public class BlockDragonEgg extends Block {
private void n(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
- if (!world.isStatic) {
- for (int l = 0; l < 1000; ++l) {
- int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
- int j1 = j + world.random.nextInt(8) - world.random.nextInt(8);
- int k1 = k + world.random.nextInt(16) - world.random.nextInt(16);
-
- if (world.getTypeId(i1, j1, k1) == 0) {
- // CraftBukkit start
- org.bukkit.block.Block from = world.getWorld().getBlockAt(i, j, k);
- org.bukkit.block.Block to = world.getWorld().getBlockAt(i1, j1, k1);
- BlockFromToEvent event = new BlockFromToEvent(from, to);
- org.bukkit.Bukkit.getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
- return;
- }
+ for (int l = 0; l < 1000; ++l) {
+ int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
+ int j1 = j + world.random.nextInt(8) - world.random.nextInt(8);
+ int k1 = k + world.random.nextInt(16) - world.random.nextInt(16);
+
+ if (world.getTypeId(i1, j1, k1) == 0) {
+ // CraftBukkit start
+ org.bukkit.block.Block from = world.getWorld().getBlockAt(i, j, k);
+ org.bukkit.block.Block to = world.getWorld().getBlockAt(i1, j1, k1);
+ BlockFromToEvent event = new BlockFromToEvent(from, to);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
- i1 = event.getToBlock().getX();
- j1 = event.getToBlock().getY();
- k1 = event.getToBlock().getZ();
- // CraftBukkit end
+ i1 = event.getToBlock().getX();
+ j1 = event.getToBlock().getY();
+ k1 = event.getToBlock().getZ();
+ // CraftBukkit end
+ if (!world.isStatic) {
world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k));
world.setTypeId(i, j, k, 0);
+ } else {
short short1 = 128;
for (int l1 = 0; l1 < short1; ++l1) {
@@ -93,16 +94,16 @@ public class BlockDragonEgg extends Block {
world.addParticle("portal", d1, d2, d3, (double) f, (double) f1, (double) f2);
}
-
- return;
}
+
+ return;
}
}
}
}
public int r_() {
- return 3;
+ return 5;
}
public boolean c() {
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index 41954799..6d249f13 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -77,7 +77,7 @@ public class BlockFire extends Block {
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
- if (!flag && world.M() && (world.B(i, j, k) || world.B(i - 1, j, k) || world.B(i + 1, j, k) || world.B(i, j, k - 1) || world.B(i, j, k + 1))) {
+ if (!flag && world.N() && (world.D(i, j, k) || world.D(i - 1, j, k) || world.D(i + 1, j, k) || world.D(i, j, k - 1) || world.D(i, j, k + 1))) {
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
} else {
int l = world.getData(i, j, k);
@@ -88,13 +88,13 @@ public class BlockFire extends Block {
world.a(i, j, k, this.id, this.r_() + random.nextInt(10));
if (!flag && !this.l(world, i, j, k)) {
- if (!world.t(i, j - 1, k) || l > 3) {
+ if (!world.v(i, j - 1, k) || l > 3) {
world.setTypeId(i, j, k, 0);
}
} else if (!flag && !this.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
} else {
- boolean flag1 = world.C(i, j, k);
+ boolean flag1 = world.E(i, j, k);
byte b0 = 0;
if (flag1) {
@@ -135,7 +135,7 @@ public class BlockFire extends Block {
j2 /= 2;
}
- if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.M() || !world.B(i1, k1, j1)) && !world.B(i1 - 1, k1, k) && !world.B(i1 + 1, k1, j1) && !world.B(i1, k1, j1 - 1) && !world.B(i1, k1, j1 + 1)) {
+ if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.N() || !world.D(i1, k1, j1)) && !world.D(i1 - 1, k1, k) && !world.D(i1 + 1, k1, j1) && !world.D(i1, k1, j1 - 1) && !world.D(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) {
@@ -197,7 +197,7 @@ public class BlockFire extends Block {
}
// CraftBukkit end
- if (random.nextInt(i1 + 10) < 5 && !world.B(i, j, k)) {
+ if (random.nextInt(i1 + 10) < 5 && !world.D(i, j, k)) {
int k1 = i1 + random.nextInt(5) / 4;
if (k1 > 15) {
@@ -251,18 +251,18 @@ public class BlockFire extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.t(i, j - 1, k) || this.l(world, i, j, k);
+ return world.v(i, j - 1, k) || this.l(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (!world.t(i, j - 1, k) && !this.l(world, i, j, k)) {
+ if (!world.v(i, j - 1, k) && !this.l(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone
}
}
public void onPlace(World world, int i, int j, int k) {
if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.i_(world, i, j, k)) {
- if (!world.t(i, j - 1, k) && !this.l(world, i, j, k)) {
+ if (!world.v(i, j - 1, k) && !this.l(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
} else {
world.a(i, j, k, this.id, this.r_() + world.random.nextInt(10));
diff --git a/src/main/java/net/minecraft/server/BlockIce.java b/src/main/java/net/minecraft/server/BlockIce.java
index b6097938..b7215376 100644
--- a/src/main/java/net/minecraft/server/BlockIce.java
+++ b/src/main/java/net/minecraft/server/BlockIce.java
@@ -18,7 +18,7 @@ public class BlockIce extends BlockHalfTransparant {
ItemStack itemstack = this.f_(l);
if (itemstack != null) {
- this.a(world, i, j, k, itemstack);
+ this.b(world, i, j, k, itemstack);
}
} else {
if (world.worldProvider.e) {
diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java
index a2bd362f..cea559f3 100644
--- a/src/main/java/net/minecraft/server/BlockLeaves.java
+++ b/src/main/java/net/minecraft/server/BlockLeaves.java
@@ -153,19 +153,19 @@ public class BlockLeaves extends BlockTransparant {
if (world.random.nextInt(b0) == 0) {
int j1 = this.getDropType(l, world.random, i1);
- this.a(world, i, j, k, new ItemStack(j1, 1, this.getDropData(l)));
+ this.b(world, i, j, k, new ItemStack(j1, 1, this.getDropData(l)));
}
if ((l & 3) == 0 && world.random.nextInt(200) == 0) {
- this.a(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
+ this.b(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
}
}
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- if (!world.isStatic && entityhuman.bP() != null && entityhuman.bP().id == Item.SHEARS.id) {
+ if (!world.isStatic && entityhuman.bT() != null && entityhuman.bT().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
- this.a(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
+ this.b(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
} else {
super.a(world, entityhuman, i, j, k, l);
}
diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java
index 13a61688..5b290f60 100644
--- a/src/main/java/net/minecraft/server/BlockLever.java
+++ b/src/main/java/net/minecraft/server/BlockLever.java
@@ -26,49 +26,43 @@ public class BlockLever extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 0 && world.s(i, j + 1, k) ? true : (l == 1 && world.t(i, j - 1, k) ? true : (l == 2 && world.s(i, j, k + 1) ? true : (l == 3 && world.s(i, j, k - 1) ? true : (l == 4 && world.s(i + 1, j, k) ? true : l == 5 && world.s(i - 1, j, k)))));
+ return l == 0 && world.t(i, j + 1, k) ? true : (l == 1 && world.v(i, j - 1, k) ? true : (l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)))));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.s(i - 1, j, k) ? true : (world.s(i + 1, j, k) ? true : (world.s(i, j, k - 1) ? true : (world.s(i, j, k + 1) ? true : (world.t(i, j - 1, k) ? true : world.s(i, j + 1, k)))));
+ return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : (world.t(i, j, k + 1) ? true : (world.v(i, j - 1, k) ? true : world.t(i, j + 1, k)))));
}
- public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
- int i1 = world.getData(i, j, k);
+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
int j1 = i1 & 8;
+ int k1 = i1 & 7;
- i1 &= 7;
- i1 = -1;
- if (l == 0 && world.s(i, j + 1, k)) {
- i1 = world.random.nextBoolean() ? 0 : 7;
+ k1 = -1;
+ if (l == 0 && world.t(i, j + 1, k)) {
+ k1 = world.random.nextBoolean() ? 0 : 7;
}
- if (l == 1 && world.t(i, j - 1, k)) {
- i1 = 5 + world.random.nextInt(2);
+ if (l == 1 && world.v(i, j - 1, k)) {
+ k1 = 5 + world.random.nextInt(2);
}
- if (l == 2 && world.s(i, j, k + 1)) {
- i1 = 4;
+ if (l == 2 && world.t(i, j, k + 1)) {
+ k1 = 4;
}
- if (l == 3 && world.s(i, j, k - 1)) {
- i1 = 3;
+ if (l == 3 && world.t(i, j, k - 1)) {
+ k1 = 3;
}
- if (l == 4 && world.s(i + 1, j, k)) {
- i1 = 2;
+ if (l == 4 && world.t(i + 1, j, k)) {
+ k1 = 2;
}
- if (l == 5 && world.s(i - 1, j, k)) {
- i1 = 1;
+ if (l == 5 && world.t(i - 1, j, k)) {
+ k1 = 1;
}
- if (i1 == -1) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
- } else {
- world.setData(i, j, k, i1 + j1);
- }
+ return k1 + j1;
}
public static int d(int i) {
@@ -101,35 +95,35 @@ public class BlockLever extends Block {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.s(i - 1, j, k) && i1 == 1) {
+ if (!world.t(i - 1, j, k) && i1 == 1) {
flag = true;
}
- if (!world.s(i + 1, j, k) && i1 == 2) {
+ if (!world.t(i + 1, j, k) && i1 == 2) {
flag = true;
}
- if (!world.s(i, j, k - 1) && i1 == 3) {
+ if (!world.t(i, j, k - 1) && i1 == 3) {
flag = true;
}
- if (!world.s(i, j, k + 1) && i1 == 4) {
+ if (!world.t(i, j, k + 1) && i1 == 4) {
flag = true;
}
- if (!world.t(i, j - 1, k) && i1 == 5) {
+ if (!world.v(i, j - 1, k) && i1 == 5) {
flag = true;
}
- if (!world.t(i, j - 1, k) && i1 == 6) {
+ if (!world.v(i, j - 1, k) && i1 == 6) {
flag = true;
}
- if (!world.s(i, j + 1, k) && i1 == 0) {
+ if (!world.t(i, j + 1, k) && i1 == 0) {
flag = true;
}
- if (!world.s(i, j + 1, k) && i1 == 7) {
+ if (!world.t(i, j + 1, k) && i1 == 7) {
flag = true;
}
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
index a9df9501..bfc48d49 100644
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java
@@ -89,7 +89,7 @@ public class BlockMushroom extends BlockFlower {
if (j >= 0 && j < 256) {
int l = world.getTypeId(i, j - 1, k);
- return l == Block.MYCEL.id || world.k(i, j, k) < 13 && this.d_(l);
+ return l == Block.MYCEL.id || world.l(i, j, k) < 13 && this.d_(l);
} else {
return false;
}
diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java
index 514abd29..22b8d191 100644
--- a/src/main/java/net/minecraft/server/BlockNetherWart.java
+++ b/src/main/java/net/minecraft/server/BlockNetherWart.java
@@ -51,7 +51,7 @@ public class BlockNetherWart extends BlockFlower {
}
for (int k1 = 0; k1 < j1; ++k1) {
- this.a(world, i, j, k, new ItemStack(Item.NETHER_STALK));
+ this.b(world, i, j, k, new ItemStack(Item.NETHER_STALK));
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index ed73f32b..3e5465b6 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -68,7 +68,7 @@ public class BlockPiston extends Block {
if (flag && !f(l)) {
// CraftBukkit start
- int length = h(world, i, j, k, i1);
+ int length = i(world, i, j, k, i1);
if (length >= 0) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonExtendEvent event = new BlockPistonExtendEvent(block, length, CraftBlock.notchToBlockFace(i1));
@@ -109,7 +109,7 @@ public class BlockPiston extends Block {
}
if (l == 0) {
- if (this.i(world, i, j, k, i1)) {
+ if (this.j(world, i, j, k, i1)) {
world.setData(i, j, k, i1 | 8);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
} else {
@@ -268,7 +268,7 @@ public class BlockPiston extends Block {
}
// CraftBukkit - boolean -> int return
- private static int h(World world, int i, int j, int k, int l) {
+ private static int i(World world, int i, int j, int k, int l) {
int i1 = i + Facing.b[l];
int j1 = j + Facing.c[l];
int k1 = k + Facing.d[l];
@@ -305,7 +305,7 @@ public class BlockPiston extends Block {
}
}
- private boolean i(World world, int i, int j, int k, int l) {
+ private boolean j(World world, int i, int j, int k, int l) {
int i1 = i + Facing.b[l];
int j1 = j + Facing.c[l];
int k1 = k + Facing.d[l];
diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java
index 7e519f66..29d13083 100644
--- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -19,15 +19,15 @@ public class BlockPortal extends BlockHalfTransparant {
if (world.worldProvider.d() && random.nextInt(2000) < world.difficulty) {
int l;
- for (l = j; !world.t(i, l, k) && l > 0; --l) {
+ for (l = j; !world.v(i, l, k) && l > 0; --l) {
;
}
- if (l > 0 && !world.s(i, l + 1, k)) {
+ if (l > 0 && !world.t(i, l + 1, k)) {
Entity entity = ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
if (entity != null) {
- entity.an = entity.ab();
+ entity.portalCooldown = entity.ab();
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java
index 1d43560c..e4dc8754 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlate.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java
@@ -44,13 +44,13 @@ public class BlockPressurePlate extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.t(i, j - 1, k) || BlockFence.c(world.getTypeId(i, j - 1, k));
+ return world.v(i, j - 1, k) || BlockFence.c(world.getTypeId(i, j - 1, k));
}
public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false;
- if (!world.t(i, j - 1, k) && !BlockFence.c(world.getTypeId(i, j - 1, k))) {
+ if (!world.v(i, j - 1, k) && !BlockFence.c(world.getTypeId(i, j - 1, k))) {
flag = true;
}
diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java
index 0abaa467..2b71464a 100644
--- a/src/main/java/net/minecraft/server/BlockPumpkin.java
+++ b/src/main/java/net/minecraft/server/BlockPumpkin.java
@@ -101,7 +101,7 @@ public class BlockPumpkin extends BlockDirectional {
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
- return (l == 0 || Block.byId[l].material.isReplaceable()) && world.t(i, j - 1, k);
+ return (l == 0 || Block.byId[l].material.isReplaceable()) && world.v(i, j - 1, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneOre.java b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
index cedc3365..2bb94366 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneOre.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
@@ -105,27 +105,27 @@ public class BlockRedstoneOre extends Block {
double d2 = (double) ((float) j + random.nextFloat());
double d3 = (double) ((float) k + random.nextFloat());
- if (l == 0 && !world.r(i, j + 1, k)) {
+ if (l == 0 && !world.s(i, j + 1, k)) {
d2 = (double) (j + 1) + d0;
}
- if (l == 1 && !world.r(i, j - 1, k)) {
+ if (l == 1 && !world.s(i, j - 1, k)) {
d2 = (double) (j + 0) - d0;
}
- if (l == 2 && !world.r(i, j, k + 1)) {
+ if (l == 2 && !world.s(i, j, k + 1)) {
d3 = (double) (k + 1) + d0;
}
- if (l == 3 && !world.r(i, j, k - 1)) {
+ if (l == 3 && !world.s(i, j, k - 1)) {
d3 = (double) (k + 0) - d0;
}
- if (l == 4 && !world.r(i + 1, j, k)) {
+ if (l == 4 && !world.s(i + 1, j, k)) {
d1 = (double) (i + 1) + d0;
}
- if (l == 5 && !world.r(i - 1, j, k)) {
+ if (l == 5 && !world.s(i - 1, j, k)) {
d1 = (double) (i + 0) - d0;
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index e3056277..4240ade9 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -2,7 +2,6 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
@@ -23,15 +22,16 @@ public class BlockRedstoneTorch extends BlockTorch {
b.put(world, new ArrayList());
}
+ List list = (List) b.get(world);
+
if (flag) {
- ((List) b.get(world)).add(new RedstoneUpdateInfo(i, j, k, world.getTime()));
+ list.add(new RedstoneUpdateInfo(i, j, k, world.getTime()));
}
int l = 0;
- Iterator iterator = ((List) b.get(world)).iterator();
- while (iterator.hasNext()) {
- RedstoneUpdateInfo redstoneupdateinfo = (RedstoneUpdateInfo) iterator.next();
+ for (int i1 = 0; i1 < list.size(); ++i1) {
+ RedstoneUpdateInfo redstoneupdateinfo = (RedstoneUpdateInfo) list.get(i1);
if (redstoneupdateinfo.a == i && redstoneupdateinfo.b == j && redstoneupdateinfo.c == k) {
++l;
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index d3a4bc4a..0f821b9b 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -2,7 +2,6 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Random;
import java.util.Set;
@@ -39,7 +38,7 @@ public class BlockRedstoneWire extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.t(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
+ return world.v(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
}
private void l(World world, int i, int j, int k) {
@@ -47,10 +46,9 @@ public class BlockRedstoneWire extends Block {
ArrayList arraylist = new ArrayList(this.b);
this.b.clear();
- Iterator iterator = arraylist.iterator();
- while (iterator.hasNext()) {
- ChunkPosition chunkposition = (ChunkPosition) iterator.next();
+ for (int l = 0; l < arraylist.size(); ++l) {
+ ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this.id);
}
@@ -94,11 +92,11 @@ public class BlockRedstoneWire extends Block {
l1 = this.getPower(world, j2, j, k2, l1);
}
- if (world.s(j2, j, k2) && !world.s(i, j + 1, k)) {
+ if (world.t(j2, j, k2) && !world.t(i, j + 1, k)) {
if (j2 != l || j + 1 != i1 || k2 != j1) {
l1 = this.getPower(world, j2, j + 1, k2, l1);
}
- } else if (!world.s(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
+ } else if (!world.t(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
l1 = this.getPower(world, j2, j - 1, k2, l1);
}
}
@@ -146,7 +144,7 @@ public class BlockRedstoneWire extends Block {
++k2;
}
- if (world.s(j2, j, k2)) {
+ if (world.t(j2, j, k2)) {
l2 += 2;
}
@@ -208,25 +206,25 @@ public class BlockRedstoneWire extends Block {
this.n(world, i + 1, j, k);
this.n(world, i, j, k - 1);
this.n(world, i, j, k + 1);
- if (world.s(i - 1, j, k)) {
+ if (world.t(i - 1, j, k)) {
this.n(world, i - 1, j + 1, k);
} else {
this.n(world, i - 1, j - 1, k);
}
- if (world.s(i + 1, j, k)) {
+ if (world.t(i + 1, j, k)) {
this.n(world, i + 1, j + 1, k);
} else {
this.n(world, i + 1, j - 1, k);
}
- if (world.s(i, j, k - 1)) {
+ if (world.t(i, j, k - 1)) {
this.n(world, i, j + 1, k - 1);
} else {
this.n(world, i, j - 1, k - 1);
}
- if (world.s(i, j, k + 1)) {
+ if (world.t(i, j, k + 1)) {
this.n(world, i, j + 1, k + 1);
} else {
this.n(world, i, j - 1, k + 1);
@@ -248,25 +246,25 @@ public class BlockRedstoneWire extends Block {
this.n(world, i + 1, j, k);
this.n(world, i, j, k - 1);
this.n(world, i, j, k + 1);
- if (world.s(i - 1, j, k)) {
+ if (world.t(i - 1, j, k)) {
this.n(world, i - 1, j + 1, k);
} else {
this.n(world, i - 1, j - 1, k);
}
- if (world.s(i + 1, j, k)) {
+ if (world.t(i + 1, j, k)) {
this.n(world, i + 1, j + 1, k);
} else {
this.n(world, i + 1, j - 1, k);
}
- if (world.s(i, j, k - 1)) {
+ if (world.t(i, j, k - 1)) {
this.n(world, i, j + 1, k - 1);
} else {
this.n(world, i, j - 1, k - 1);
}
- if (world.s(i, j, k + 1)) {
+ if (world.t(i, j, k + 1)) {
this.n(world, i, j + 1, k + 1);
} else {
this.n(world, i, j - 1, k + 1);
@@ -317,25 +315,25 @@ public class BlockRedstoneWire extends Block {
} else if (l == 1) {
return true;
} else {
- boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.s(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
- boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.s(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
- boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.s(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
- boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.s(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
+ boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
+ boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
+ boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
+ boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
- if (!iblockaccess.s(i, j + 1, k)) {
- if (iblockaccess.s(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
+ if (!iblockaccess.t(i, j + 1, k)) {
+ if (iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
flag = true;
}
- if (iblockaccess.s(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
+ if (iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
flag1 = true;
}
- if (iblockaccess.s(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
+ if (iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
flag2 = true;
}
- if (iblockaccess.s(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
+ if (iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
flag3 = true;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSand.java b/src/main/java/net/minecraft/server/BlockSand.java
index 2738f081..44c11484 100644
--- a/src/main/java/net/minecraft/server/BlockSand.java
+++ b/src/main/java/net/minecraft/server/BlockSand.java
@@ -57,7 +57,7 @@ public class BlockSand extends Block {
protected void a(EntityFallingBlock entityfallingblock) {}
public int r_() {
- return 3;
+ return 5;
}
public static boolean canFall(World world, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/BlockSkull.java b/src/main/java/net/minecraft/server/BlockSkull.java
index d6cdd23a..968bd941 100644
--- a/src/main/java/net/minecraft/server/BlockSkull.java
+++ b/src/main/java/net/minecraft/server/BlockSkull.java
@@ -71,7 +71,7 @@ public class BlockSkull extends BlockContainer {
public int getDropData(World world, int i, int j, int k) {
TileEntity tileentity = world.getTileEntity(i, j, k);
- return tileentity != null && tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).a() : super.getDropData(world, i, j, k);
+ return tileentity != null && tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).getSkullType() : super.getDropData(world, i, j, k);
}
public int getDropData(int i) {
@@ -94,7 +94,15 @@ public class BlockSkull extends BlockContainer {
if (!world.isStatic) {
/* CraftBukkit start - don't special code dropping the item
if ((i1 & 8) == 0) {
- this.a(world, i, j, k, new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k)));
+ ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k));
+ TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k);
+
+ if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) {
+ itemstack.setTag(new NBTTagCompound());
+ itemstack.getTag().setString("SkullOwner", tileentityskull.getExtraType());
+ }
+
+ this.b(world, i, j, k, itemstack);
}
// CraftBukkit end */
@@ -107,7 +115,7 @@ public class BlockSkull extends BlockContainer {
}
public void a(World world, int i, int j, int k, TileEntitySkull tileentityskull) {
- if (tileentityskull.a() == 1 && j >= 2) {
+ if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty > 0) {
int l = Block.SOUL_SAND.id;
int i1;
@@ -195,7 +203,7 @@ public class BlockSkull extends BlockContainer {
} else {
TileEntity tileentity = world.getTileEntity(i, j, k);
- return tileentity != null && tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).a() == l : false;
+ return tileentity != null && tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).getSkullType() == l : false;
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSnow.java b/src/main/java/net/minecraft/server/BlockSnow.java
index 2e11d2f9..eacb1485 100644
--- a/src/main/java/net/minecraft/server/BlockSnow.java
+++ b/src/main/java/net/minecraft/server/BlockSnow.java
@@ -56,7 +56,7 @@ public class BlockSnow extends Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
int i1 = Item.SNOW_BALL.id;
- this.a(world, i, j, k, new ItemStack(i1, 1, 0));
+ this.b(world, i, j, k, new ItemStack(i1, 1, 0));
world.setTypeId(i, j, k, 0);
entityhuman.a(StatisticList.C[this.id], 1);
}
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
index bdffd555..a245359d 100644
--- a/src/main/java/net/minecraft/server/BlockSoil.java
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
@@ -31,7 +31,7 @@ public class BlockSoil extends Block {
}
public void b(World world, int i, int j, int k, Random random) {
- if (!this.n(world, i, j, k) && !world.B(i, j + 1, k)) {
+ if (!this.n(world, i, j, k) && !world.D(i, j + 1, k)) {
int l = world.getData(i, j, k);
if (l > 0) {
@@ -71,7 +71,7 @@ public class BlockSoil extends Block {
for (int i1 = k - b0; i1 <= k + b0; ++i1) {
int j1 = world.getTypeId(l, j + 1, i1);
- if (j1 == Block.CROPS.id || j1 == Block.MELON_STEM.id || j1 == Block.PUMPKIN_STEM.id) {
+ if (j1 == Block.CROPS.id || j1 == Block.MELON_STEM.id || j1 == Block.PUMPKIN_STEM.id || j1 == Block.POTATOES.id || j1 == Block.CARROTS.id) {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
index 50c3760d..ff1b89fa 100644
--- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -161,7 +161,7 @@ public class BlockStem extends BlockFlower {
for (int j1 = 0; j1 < 3; ++j1) {
if (world.random.nextInt(15) <= l) {
- this.a(world, i, j, k, new ItemStack(item));
+ this.b(world, i, j, k, new ItemStack(item));
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
index 8b6a2907..20906744 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -53,7 +53,7 @@ public class BlockTNT extends Block {
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
- if (entityhuman.bP() != null && entityhuman.bP().id == Item.FLINT_AND_STEEL.id) {
+ if (entityhuman.bT() != null && entityhuman.bT().id == Item.FLINT_AND_STEEL.id) {
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
return true;
@@ -72,4 +72,8 @@ public class BlockTNT extends Block {
}
}
}
+
+ public boolean a(Explosion explosion) {
+ return false;
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockTrapdoor.java b/src/main/java/net/minecraft/server/BlockTrapdoor.java
index 7c5719af..7739df08 100644
--- a/src/main/java/net/minecraft/server/BlockTrapdoor.java
+++ b/src/main/java/net/minecraft/server/BlockTrapdoor.java
@@ -152,33 +152,30 @@ public class BlockTrapdoor extends Block {
return super.a(world, i, j, k, vec3d, vec3d1);
}
- public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
- int i1 = 0;
+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
+ int j1 = 0;
if (l == 2) {
- i1 = 0;
+ j1 = 0;
}
if (l == 3) {
- i1 = 1;
+ j1 = 1;
}
if (l == 4) {
- i1 = 2;
+ j1 = 2;
}
if (l == 5) {
- i1 = 3;
+ j1 = 3;
}
- int j1 = Block.TRAP_DOOR.id;
-
if (l != 1 && l != 0 && f1 > 0.5F) {
- i1 |= 8;
+ j1 |= 8;
}
- world.setTypeIdAndData(i, j, k, j1, i1);
- doPhysics(world, i, j, k, Block.REDSTONE_WIRE.id); // CraftBukkit
+ return j1;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
@@ -217,7 +214,7 @@ public class BlockTrapdoor extends Block {
} else {
Block block = Block.byId[i];
- return block != null && block.material.k() && block.b() || block == Block.GLOWSTONE;
+ return block != null && block.material.k() && block.b() || block == Block.GLOWSTONE || block instanceof BlockStepAbstract || block instanceof BlockStairs;
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTripwire.java b/src/main/java/net/minecraft/server/BlockTripwire.java
index 3a4b7e42..191526a5 100644
--- a/src/main/java/net/minecraft/server/BlockTripwire.java
+++ b/src/main/java/net/minecraft/server/BlockTripwire.java
@@ -41,7 +41,7 @@ public class BlockTripwire extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
boolean flag = (i1 & 2) == 2;
- boolean flag1 = !world.t(i, j - 1, k);
+ boolean flag1 = !world.v(i, j - 1, k);
if (flag != flag1) {
this.c(world, i, j, k, i1, 0);
@@ -64,7 +64,7 @@ public class BlockTripwire extends Block {
}
public void onPlace(World world, int i, int j, int k) {
- int l = world.t(i, j - 1, k) ? 0 : 2;
+ int l = world.v(i, j - 1, k) ? 0 : 2;
world.setData(i, j, k, l);
this.d(world, i, j, k, l);
@@ -76,7 +76,7 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (!world.isStatic) {
- if (entityhuman.bP() != null && entityhuman.bP().id == Item.SHEARS.id) {
+ if (entityhuman.bT() != null && entityhuman.bT().id == Item.SHEARS.id) {
world.setData(i, j, k, l | 8);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTripwireHook.java b/src/main/java/net/minecraft/server/BlockTripwireHook.java
index 0fe164d6..e18bf43b 100644
--- a/src/main/java/net/minecraft/server/BlockTripwireHook.java
+++ b/src/main/java/net/minecraft/server/BlockTripwireHook.java
@@ -33,14 +33,14 @@ public class BlockTripwireHook extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 2 && world.s(i, j, k + 1) ? true : (l == 3 && world.s(i, j, k - 1) ? true : (l == 4 && world.s(i + 1, j, k) ? true : l == 5 && world.s(i - 1, j, k)));
+ return l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.s(i - 1, j, k) ? true : (world.s(i + 1, j, k) ? true : (world.s(i, j, k - 1) ? true : world.s(i, j, k + 1)));
+ return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : world.t(i, j, k + 1)));
}
- public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
byte b0 = 0;
if (l == 2 && world.b(i, j, k + 1, true)) {
@@ -59,7 +59,11 @@ public class BlockTripwireHook extends Block {
b0 = 3;
}
- this.a(world, i, j, k, this.id, b0, false, -1, 0);
+ return b0;
+ }
+
+ public void postPlace(World world, int i, int j, int k, int l) {
+ this.a(world, i, j, k, this.id, l, false, -1, 0);
}
public void doPhysics(World world, int i, int j, int k, int l) {
@@ -69,19 +73,19 @@ public class BlockTripwireHook extends Block {
int j1 = i1 & 3;
boolean flag = false;
- if (!world.s(i - 1, j, k) && j1 == 3) {
+ if (!world.t(i - 1, j, k) && j1 == 3) {
flag = true;
}
- if (!world.s(i + 1, j, k) && j1 == 1) {
+ if (!world.t(i + 1, j, k) && j1 == 1) {
flag = true;
}
- if (!world.s(i, j, k - 1) && j1 == 0) {
+ if (!world.t(i, j, k - 1) && j1 == 0) {
flag = true;
}
- if (!world.s(i, j, k + 1) && j1 == 2) {
+ if (!world.t(i, j, k + 1) && j1 == 2) {
flag = true;
}
@@ -99,7 +103,7 @@ public class BlockTripwireHook extends Block {
boolean flag2 = (i1 & 8) == 8;
boolean flag3 = l == Block.TRIPWIRE_SOURCE.id;
boolean flag4 = false;
- boolean flag5 = !world.t(i, j - 1, k);
+ boolean flag5 = !world.v(i, j - 1, k);
int i2 = Direction.a[l1];
int j2 = Direction.b[l1];
int k2 = 0;
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 612d6f01..62c71090 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -159,7 +159,7 @@ public class Chunk {
if (chunksection != null) {
chunksection.c(j, i1 & 15, k, l);
- this.world.n((this.x << 4) + j, i1, (this.z << 4) + k);
+ this.world.o((this.x << 4) + j, i1, (this.z << 4) + k);
}
}
@@ -277,7 +277,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 15);
- this.world.n((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
} else {
@@ -285,7 +285,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 0);
- this.world.n((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
}
@@ -395,7 +395,7 @@ public class Chunk {
int k2 = this.z * 16 + k;
if (l1 != 0 && !this.world.isStatic) {
- Block.byId[l1].g(this.world, j2, j, k2, i2);
+ Block.byId[l1].h(this.world, j2, j, k2, i2);
}
chunksection.a(i, j & 15, k, l);
@@ -403,7 +403,7 @@ public class Chunk {
if (!this.world.isStatic) {
Block.byId[l1].remove(this.world, j2, j, k2, l1, i2);
} else if (Block.byId[l1] instanceof BlockContainer && l1 != l) {
- this.world.q(j2, j, k2);
+ this.world.r(j2, j, k2);
}
}
@@ -659,13 +659,9 @@ public class Chunk {
public void addEntities() {
this.d = true;
this.world.a(this.tileEntities.values());
- List[] alist = this.entitySlices;
- int i = alist.length;
- for (int j = 0; j < i; ++j) {
- List list = alist[j];
-
- this.world.a(list);
+ for (int i = 0; i < this.entitySlices.length; ++i) {
+ this.world.a(this.entitySlices[i]);
}
}
@@ -679,12 +675,9 @@ public class Chunk {
this.world.a(tileentity);
}
- List[] alist = this.entitySlices;
- int i = alist.length;
-
- for (int j = 0; j < i; ++j) {
+ for (int i = 0; i < this.entitySlices.length; ++i) {
// CraftBukkit start
- java.util.Iterator<Object> iter = this.entitySlices[j].iterator();
+ java.util.Iterator<Object> iter = this.entitySlices[i].iterator();
while (iter.hasNext()) {
Entity entity = (Entity) iter.next();
int cx = Location.locToBlock(entity.locX) >> 4;
@@ -698,9 +691,7 @@ public class Chunk {
}
// CraftBukkit end
- List list = alist[j];
-
- this.world.b(list);
+ this.world.b(this.entitySlices[i]);
}
}
@@ -722,18 +713,17 @@ public class Chunk {
for (int k = i; k <= j; ++k) {
List list1 = this.entitySlices[k];
- Iterator iterator = list1.iterator();
- while (iterator.hasNext()) {
- Entity entity1 = (Entity) iterator.next();
+ for (int l = 0; l < list1.size(); ++l) {
+ Entity entity1 = (Entity) list1.get(l);
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
list.add(entity1);
Entity[] aentity = entity1.ao();
if (aentity != null) {
- for (int l = 0; l < aentity.length; ++l) {
- entity1 = aentity[l];
+ for (int i1 = 0; i1 < aentity.length; ++i1) {
+ entity1 = aentity[i1];
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
list.add(entity1);
}
@@ -762,10 +752,9 @@ public class Chunk {
for (int k = i; k <= j; ++k) {
List list1 = this.entitySlices[k];
- Iterator iterator = list1.iterator();
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
+ for (int l = 0; l < list1.size(); ++l) {
+ Entity entity = (Entity) list1.get(l);
if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity))) {
list.add(entity);
@@ -916,30 +905,30 @@ public class Chunk {
if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].a(k, k1, l) == 0) {
if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) {
- this.world.x(i1, l1 - 1, j1);
+ this.world.z(i1, l1 - 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) {
- this.world.x(i1, l1 + 1, j1);
+ this.world.z(i1, l1 + 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) {
- this.world.x(i1 - 1, l1, j1);
+ this.world.z(i1 - 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) {
- this.world.x(i1 + 1, l1, j1);
+ this.world.z(i1 + 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) {
- this.world.x(i1, l1, j1 - 1);
+ this.world.z(i1, l1, j1 - 1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) {
- this.world.x(i1, l1, j1 + 1);
+ this.world.z(i1, l1, j1 + 1);
}
- this.world.x(i1, l1, j1);
+ this.world.z(i1, l1, j1);
}
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 4cdf364c..f0f4e1e4 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -92,7 +92,17 @@ public class ChunkProviderServer implements IChunkProvider {
if (this.chunkProvider == null) {
chunk = this.emptyChunk;
} else {
- chunk = this.chunkProvider.getOrCreateChunk(i, j);
+ try {
+ chunk = this.chunkProvider.getOrCreateChunk(i, j);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception generating new chunk");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated");
+
+ crashreportsystemdetails.a("Location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
+ crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j)));
+ crashreportsystemdetails.a("Generator", this.chunkProvider.getName());
+ throw new ReportedException(crashreport);
+ }
}
newChunk = true; // CraftBukkit
}
@@ -218,10 +228,12 @@ public class ChunkProviderServer implements IChunkProvider {
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
int i = 0;
- Iterator iterator = this.chunks.values().iterator(); // CraftBukkit
+ // CraftBukkit start
+ Iterator iterator = this.chunks.values().iterator();
while (iterator.hasNext()) {
Chunk chunk = (Chunk) iterator.next();
+ // CraftBukkit end
if (flag) {
this.saveChunkNOP(chunk);
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 69632491..21ade175 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -29,13 +29,9 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
synchronized (this.c) {
if (this.b.contains(chunkcoordintpair)) {
- Iterator iterator = this.a.iterator();
-
- while (iterator.hasNext()) {
- PendingChunkToSave pendingchunktosave = (PendingChunkToSave) iterator.next();
-
- if (pendingchunktosave.a.equals(chunkcoordintpair)) {
- nbttagcompound = pendingchunktosave.b;
+ for (int k = 0; k < this.a.size(); ++k) {
+ if (((PendingChunkToSave) this.a.get(k)).a.equals(chunkcoordintpair)) {
+ nbttagcompound = ((PendingChunkToSave) this.a.get(k)).b;
break;
}
}
@@ -79,7 +75,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void a(World world, Chunk chunk) {
// CraftBukkit start - "handle" exception
try {
- world.C();
+ world.D();
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
}
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
index 6aed2de4..8bc961aa 100644
--- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java
@@ -2,7 +2,6 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -13,10 +12,10 @@ import org.bukkit.inventory.InventoryView;
public abstract class Container {
- public List a = new ArrayList();
public List b = new ArrayList();
+ public List c = new ArrayList();
public int windowId = 0;
- private short e = 0;
+ private short a = 0;
protected List listeners = new ArrayList();
private Set f = new HashSet();
@@ -35,9 +34,9 @@ public abstract class Container {
public Container() {}
protected Slot a(Slot slot) {
- slot.g = this.b.size();
- this.b.add(slot);
- this.a.add(null);
+ slot.g = this.c.size();
+ this.c.add(slot);
+ this.b.add(null);
return slot;
}
@@ -53,31 +52,25 @@ public abstract class Container {
public List a() {
ArrayList arraylist = new ArrayList();
- Iterator iterator = this.b.iterator();
- while (iterator.hasNext()) {
- Slot slot = (Slot) iterator.next();
-
- arraylist.add(slot.getItem());
+ for (int i = 0; i < this.c.size(); ++i) {
+ arraylist.add(((Slot) this.c.get(i)).getItem());
}
return arraylist;
}
public void b() {
- for (int i = 0; i < this.b.size(); ++i) {
- ItemStack itemstack = ((Slot) this.b.get(i)).getItem();
- ItemStack itemstack1 = (ItemStack) this.a.get(i);
+ for (int i = 0; i < this.c.size(); ++i) {
+ ItemStack itemstack = ((Slot) this.c.get(i)).getItem();
+ ItemStack itemstack1 = (ItemStack) this.b.get(i);
if (!ItemStack.matches(itemstack1, itemstack)) {
itemstack1 = itemstack == null ? null : itemstack.cloneItemStack();
- this.a.set(i, itemstack1);
- Iterator iterator = this.listeners.iterator();
-
- while (iterator.hasNext()) {
- ICrafting icrafting = (ICrafting) iterator.next();
+ this.b.set(i, itemstack1);
- icrafting.a(this, i, itemstack1);
+ for (int j = 0; j < this.listeners.size(); ++j) {
+ ((ICrafting) this.listeners.get(j)).a(this, i, itemstack1);
}
}
}
@@ -88,27 +81,23 @@ public abstract class Container {
}
public Slot a(IInventory iinventory, int i) {
- Iterator iterator = this.b.iterator();
-
- Slot slot;
+ for (int j = 0; j < this.c.size(); ++j) {
+ Slot slot = (Slot) this.c.get(j);
- do {
- if (!iterator.hasNext()) {
- return null;
+ if (slot.a(iinventory, i)) {
+ return slot;
}
+ }
- slot = (Slot) iterator.next();
- } while (!slot.a(iinventory, i));
-
- return slot;
+ return null;
}
public Slot getSlot(int i) {
- return (Slot) this.b.get(i);
+ return (Slot) this.c.get(i);
}
public ItemStack b(EntityHuman entityhuman, int i) {
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
return slot != null ? slot.getItem() : null;
}
@@ -143,7 +132,7 @@ public abstract class Container {
}
}
} else if (k == 1) {
- slot = (Slot) this.b.get(i);
+ slot = (Slot) this.c.get(i);
if (slot != null && slot.a(entityhuman)) {
itemstack1 = this.b(entityhuman, i);
if (itemstack1 != null) {
@@ -160,7 +149,7 @@ public abstract class Container {
return null;
}
- slot = (Slot) this.b.get(i);
+ slot = (Slot) this.c.get(i);
if (slot != null) {
itemstack1 = slot.getItem();
ItemStack itemstack3 = playerinventory.getCarried();
@@ -235,7 +224,7 @@ public abstract class Container {
}
}
} else if (k == 2 && j >= 0 && j < 9) {
- slot = (Slot) this.b.get(i);
+ slot = (Slot) this.c.get(i);
if (slot.a(entityhuman)) {
itemstack1 = playerinventory.getItem(j);
boolean flag = itemstack1 == null || slot.inventory == playerinventory && slot.isAllowed(itemstack1);
@@ -264,8 +253,8 @@ public abstract class Container {
slot.set(itemstack1);
}
}
- } else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i > 0) {
- slot = (Slot) this.b.get(i);
+ } else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i >= 0) {
+ slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
itemstack1 = slot.getItem().cloneItemStack();
itemstack1.count = itemstack1.getMaxStackSize();
@@ -280,7 +269,7 @@ public abstract class Container {
this.clickItem(i, j, 1, entityhuman);
}
- public void a(EntityHuman entityhuman) {
+ public void b(EntityHuman entityhuman) {
PlayerInventory playerinventory = entityhuman.inventory;
if (playerinventory.getCarried() != null) {
@@ -297,7 +286,7 @@ public abstract class Container {
this.getSlot(i).set(itemstack);
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
return !this.f.contains(entityhuman);
}
@@ -309,7 +298,7 @@ public abstract class Container {
}
}
- public abstract boolean c(EntityHuman entityhuman);
+ public abstract boolean a(EntityHuman entityhuman);
protected boolean a(ItemStack itemstack, int i, int j, boolean flag) {
boolean flag1 = false;
@@ -324,7 +313,7 @@ public abstract class Container {
if (itemstack.isStackable()) {
while (itemstack.count > 0 && (!flag && k < j || flag && k >= i)) {
- slot = (Slot) this.b.get(k);
+ slot = (Slot) this.c.get(k);
itemstack1 = slot.getItem();
if (itemstack1 != null && itemstack1.id == itemstack.id && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
int l = itemstack1.count + itemstack.count;
@@ -358,7 +347,7 @@ public abstract class Container {
}
while (!flag && k < j || flag && k >= i) {
- slot = (Slot) this.b.get(k);
+ slot = (Slot) this.c.get(k);
itemstack1 = slot.getItem();
if (itemstack1 == null) {
slot.set(itemstack.cloneItemStack());
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index 508f753b..eabc7b14 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -17,7 +17,7 @@ public class ContainerAnvil extends Container {
private int i;
private int j;
private int k;
- public int e = 0;
+ public int a = 0;
private int l = 0;
private String m;
private final EntityHuman n;
@@ -60,14 +60,14 @@ public class ContainerAnvil extends Container {
public void d() {
ItemStack itemstack = this.g.getItem(0);
- this.e = 0;
+ this.a = 0;
int i = 0;
byte b0 = 0;
int j = 0;
if (itemstack == null) {
this.f.setItem(0, (ItemStack) null);
- this.e = 0;
+ this.a = 0;
} else {
ItemStack itemstack1 = itemstack.cloneItemStack();
ItemStack itemstack2 = this.g.getItem(1);
@@ -87,7 +87,7 @@ public class ContainerAnvil extends Container {
l = Math.min(itemstack1.i(), itemstack1.k() / 4);
if (l <= 0) {
this.f.setItem(0, (ItemStack) null);
- this.e = 0;
+ this.a = 0;
return;
}
@@ -102,7 +102,7 @@ public class ContainerAnvil extends Container {
} else {
if (itemstack1.id != itemstack2.id || !itemstack1.f()) {
this.f.setItem(0, (ItemStack) null);
- this.e = 0;
+ this.a = 0;
return;
}
@@ -240,17 +240,17 @@ public class ContainerAnvil extends Container {
}
}
- this.e = k + i;
+ this.a = k + i;
if (i <= 0) {
itemstack1 = null;
}
- if (j == i && j > 0 && this.e >= 40) {
+ if (j == i && j > 0 && this.a >= 40) {
//System.out.println("Naming an item only, cost too high; giving discount to cap cost to 39 levels"); // CraftBukkit -remove debug
- this.e = 39;
+ this.a = 39;
}
- if (this.e >= 40 && !this.n.abilities.canInstantlyBuild) {
+ if (this.a >= 40 && !this.n.abilities.canInstantlyBuild) {
itemstack1 = null;
}
@@ -261,7 +261,7 @@ public class ContainerAnvil extends Container {
}
if (itemstack1.s()) {
- i1 -= 5;
+ i1 -= 9;
}
if (i1 < 0) {
@@ -280,11 +280,11 @@ public class ContainerAnvil extends Container {
public void addSlotListener(ICrafting icrafting) {
super.addSlotListener(icrafting);
- icrafting.setContainerData(this, 0, this.e);
+ icrafting.setContainerData(this, 0, this.a);
}
- public void a(EntityHuman entityhuman) {
- super.a(entityhuman);
+ public void b(EntityHuman entityhuman) {
+ super.b(entityhuman);
if (!this.h.isStatic) {
for (int i = 0; i < this.g.getSize(); ++i) {
ItemStack itemstack = this.g.splitWithoutUpdate(i);
@@ -296,14 +296,14 @@ public class ContainerAnvil extends Container {
}
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.h.getTypeId(this.i, this.j, this.k) != Block.ANVIL.id ? false : entityhuman.e((double) this.i + 0.5D, (double) this.j + 0.5D, (double) this.k + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
diff --git a/src/main/java/net/minecraft/server/ContainerBeacon.java b/src/main/java/net/minecraft/server/ContainerBeacon.java
index 95bb5fcc..e0751630 100644
--- a/src/main/java/net/minecraft/server/ContainerBeacon.java
+++ b/src/main/java/net/minecraft/server/ContainerBeacon.java
@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerBeacon extends Container {
- private TileEntityBeacon e;
+ private TileEntityBeacon a;
private final SlotBeacon f;
private int g;
private int h;
@@ -20,7 +20,7 @@ public class ContainerBeacon extends Container {
public ContainerBeacon(PlayerInventory playerinventory, TileEntityBeacon tileentitybeacon) {
player = playerinventory; // CraftBukkit
- this.e = tileentitybeacon;
+ this.a = tileentitybeacon;
this.a(this.f = new SlotBeacon(this, tileentitybeacon, 0, 136, 110));
byte b0 = 36;
short short1 = 137;
@@ -54,17 +54,17 @@ public class ContainerBeacon extends Container {
}
public TileEntityBeacon d() {
- return this.e;
+ return this.a;
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.e.a(entityhuman);
+ return this.a.a_(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
@@ -114,7 +114,7 @@ public class ContainerBeacon extends Container {
return bukkitEntity;
}
- CraftInventory inventory = new CraftInventoryBeacon(this.e);
+ CraftInventory inventory = new CraftInventoryBeacon(this.a);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
diff --git a/src/main/java/net/minecraft/server/ContainerBrewingStand.java b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
index 0854fdb0..3bfa8027 100644
--- a/src/main/java/net/minecraft/server/ContainerBrewingStand.java
+++ b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
@@ -1,7 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
-
// CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
@@ -45,10 +43,9 @@ public class ContainerBrewingStand extends Container {
public void b() {
super.b();
- Iterator iterator = this.listeners.iterator();
- while (iterator.hasNext()) {
- ICrafting icrafting = (ICrafting) iterator.next();
+ for (int i = 0; i < this.listeners.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.listeners.get(i);
if (this.g != this.brewingStand.x_()) {
icrafting.setContainerData(this, 0, this.brewingStand.x_());
@@ -58,14 +55,14 @@ public class ContainerBrewingStand extends Container {
this.g = this.brewingStand.x_();
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.brewingStand.a(entityhuman);
+ return this.brewingStand.a_(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
diff --git a/src/main/java/net/minecraft/server/ContainerChest.java b/src/main/java/net/minecraft/server/ContainerChest.java
index c0e70ead..b36d9325 100644
--- a/src/main/java/net/minecraft/server/ContainerChest.java
+++ b/src/main/java/net/minecraft/server/ContainerChest.java
@@ -62,21 +62,21 @@ public class ContainerChest extends Container {
}
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.container.a(entityhuman);
+ return this.container.a_(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if (i < this.f * 9) {
- if (!this.a(itemstack1, this.f * 9, this.b.size(), true)) {
+ if (!this.a(itemstack1, this.f * 9, this.c.size(), true)) {
return null;
}
} else if (!this.a(itemstack1, 0, this.f * 9, false)) {
@@ -93,8 +93,12 @@ public class ContainerChest extends Container {
return itemstack;
}
- public void a(EntityHuman entityhuman) {
- super.a(entityhuman);
+ public void b(EntityHuman entityhuman) {
+ super.b(entityhuman);
this.container.f();
}
+
+ public IInventory d() {
+ return this.container;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ContainerDispenser.java b/src/main/java/net/minecraft/server/ContainerDispenser.java
index 04025026..f4c093b0 100644
--- a/src/main/java/net/minecraft/server/ContainerDispenser.java
+++ b/src/main/java/net/minecraft/server/ContainerDispenser.java
@@ -40,14 +40,14 @@ public class ContainerDispenser extends Container {
}
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.items.a(entityhuman);
+ return this.items.a_(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
index ded13548..bb5f1079 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
@@ -65,10 +65,9 @@ public class ContainerEnchantTable extends Container {
public void b() {
super.b();
- Iterator iterator = this.listeners.iterator();
- while (iterator.hasNext()) {
- ICrafting icrafting = (ICrafting) iterator.next();
+ for (int i = 0; i < this.listeners.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.listeners.get(i);
icrafting.setContainerData(this, 0, this.costs[0]);
icrafting.setContainerData(this, 1, this.costs[1]);
@@ -191,8 +190,8 @@ public class ContainerEnchantTable extends Container {
}
}
- public void a(EntityHuman entityhuman) {
- super.a(entityhuman);
+ public void b(EntityHuman entityhuman) {
+ super.b(entityhuman);
if (!this.world.isStatic) {
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(0);
@@ -202,14 +201,14 @@ public class ContainerEnchantTable extends Container {
}
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.world.getTypeId(this.x, this.y, this.z) != Block.ENCHANTMENT_TABLE.id ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
@@ -220,15 +219,15 @@ public class ContainerEnchantTable extends Container {
return null;
}
} else {
- if (((Slot) this.b.get(0)).d() || !((Slot) this.b.get(0)).isAllowed(itemstack1)) {
+ if (((Slot) this.c.get(0)).d() || !((Slot) this.c.get(0)).isAllowed(itemstack1)) {
return null;
}
if (itemstack1.hasTag() && itemstack1.count == 1) {
- ((Slot) this.b.get(0)).set(itemstack1.cloneItemStack());
+ ((Slot) this.c.get(0)).set(itemstack1.cloneItemStack());
itemstack1.count = 0;
} else if (itemstack1.count >= 1) {
- ((Slot) this.b.get(0)).set(new ItemStack(itemstack1.id, 1, itemstack1.getData()));
+ ((Slot) this.c.get(0)).set(new ItemStack(itemstack1.id, 1, itemstack1.getData()));
--itemstack1.count;
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerFurnace.java b/src/main/java/net/minecraft/server/ContainerFurnace.java
index 5952c3b3..d8f497b1 100644
--- a/src/main/java/net/minecraft/server/ContainerFurnace.java
+++ b/src/main/java/net/minecraft/server/ContainerFurnace.java
@@ -1,7 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
-
// CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
@@ -58,10 +56,9 @@ public class ContainerFurnace extends Container {
public void b() {
super.b();
- Iterator iterator = this.listeners.iterator();
- while (iterator.hasNext()) {
- ICrafting icrafting = (ICrafting) iterator.next();
+ for (int i = 0; i < this.listeners.size(); ++i) {
+ ICrafting icrafting = (ICrafting) this.listeners.get(i);
if (this.f != this.furnace.cookTime) {
icrafting.setContainerData(this, 0, this.furnace.cookTime);
@@ -81,14 +78,14 @@ public class ContainerFurnace extends Container {
this.h = this.furnace.ticksForCurrentFuel;
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.furnace.a(entityhuman);
+ return this.furnace.a_(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
diff --git a/src/main/java/net/minecraft/server/ContainerMerchant.java b/src/main/java/net/minecraft/server/ContainerMerchant.java
index 925718ff..0b97cf8b 100644
--- a/src/main/java/net/minecraft/server/ContainerMerchant.java
+++ b/src/main/java/net/minecraft/server/ContainerMerchant.java
@@ -64,13 +64,13 @@ public class ContainerMerchant extends Container {
this.f.c(i);
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return this.merchant.m_() == entityhuman;
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
@@ -110,10 +110,10 @@ public class ContainerMerchant extends Container {
return itemstack;
}
- public void a(EntityHuman entityhuman) {
- super.a(entityhuman);
- this.merchant.a_((EntityHuman) null);
- super.a(entityhuman);
+ public void b(EntityHuman entityhuman) {
+ super.b(entityhuman);
+ this.merchant.b_((EntityHuman) null);
+ super.b(entityhuman);
if (!this.g.isStatic) {
ItemStack itemstack = this.f.splitWithoutUpdate(0);
diff --git a/src/main/java/net/minecraft/server/ContainerPlayer.java b/src/main/java/net/minecraft/server/ContainerPlayer.java
index 707cccb4..51661ad5 100644
--- a/src/main/java/net/minecraft/server/ContainerPlayer.java
+++ b/src/main/java/net/minecraft/server/ContainerPlayer.java
@@ -65,8 +65,8 @@ public class ContainerPlayer extends Container {
// CraftBukkit end
}
- public void a(EntityHuman entityhuman) {
- super.a(entityhuman);
+ public void b(EntityHuman entityhuman) {
+ super.b(entityhuman);
for (int i = 0; i < 4; ++i) {
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
@@ -79,13 +79,13 @@ public class ContainerPlayer extends Container {
this.resultInventory.setItem(0, (ItemStack) null);
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return true;
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
@@ -105,7 +105,7 @@ public class ContainerPlayer extends Container {
if (!this.a(itemstack1, 9, 45, false)) {
return null;
}
- } else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.b.get(5 + ((ItemArmor) itemstack.getItem()).a)).d()) {
+ } else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.c.get(5 + ((ItemArmor) itemstack.getItem()).a)).d()) {
int j = 5 + ((ItemArmor) itemstack.getItem()).a;
if (!this.a(itemstack1, j, j + 1, false)) {
diff --git a/src/main/java/net/minecraft/server/ContainerWorkbench.java b/src/main/java/net/minecraft/server/ContainerWorkbench.java
index 42f91a9d..7c32df51 100644
--- a/src/main/java/net/minecraft/server/ContainerWorkbench.java
+++ b/src/main/java/net/minecraft/server/ContainerWorkbench.java
@@ -67,8 +67,8 @@ public class ContainerWorkbench extends Container {
// CraftBukkit end
}
- public void a(EntityHuman entityhuman) {
- super.a(entityhuman);
+ public void b(EntityHuman entityhuman) {
+ super.b(entityhuman);
if (!this.g.isStatic) {
for (int i = 0; i < 9; ++i) {
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
@@ -80,14 +80,14 @@ public class ContainerWorkbench extends Container {
}
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.g.getTypeId(this.h, this.i, this.j) != Block.WORKBENCH.id ? false : entityhuman.e((double) this.h + 0.5D, (double) this.i + 0.5D, (double) this.j + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.b.get(i);
+ Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java
index 1fad9432..4fbaaffb 100644
--- a/src/main/java/net/minecraft/server/ControllerMove.java
+++ b/src/main/java/net/minecraft/server/ControllerMove.java
@@ -47,7 +47,7 @@ public class ControllerMove {
float f = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
- this.a.e(this.e * this.a.by());
+ this.a.e(this.e * this.a.bB());
if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) {
this.a.getControllerJump().a();
}
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index aa89ce1b..8867b56f 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -3,7 +3,6 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
@@ -142,16 +141,12 @@ public class CraftingManager {
int i = 0;
int j = 0;
int k = 0;
- int l;
if (aobject[i] instanceof String[]) {
String[] astring = (String[]) ((String[]) aobject[i++]);
- String[] astring1 = astring;
- l = astring.length;
-
- for (int i1 = 0; i1 < l; ++i1) {
- String s1 = astring1[i1];
+ for (int l = 0; l < astring.length; ++l) {
+ String s1 = astring[l];
++k;
j = s1.length();
@@ -186,13 +181,13 @@ public class CraftingManager {
ItemStack[] aitemstack = new ItemStack[j * k];
- for (l = 0; l < j * k; ++l) {
- char c0 = s.charAt(l);
+ for (int i1 = 0; i1 < j * k; ++i1) {
+ char c0 = s.charAt(i1);
if (hashmap.containsKey(Character.valueOf(c0))) {
- aitemstack[l] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
+ aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
} else {
- aitemstack[l] = null;
+ aitemstack[i1] = null;
}
}
@@ -229,7 +224,9 @@ public class CraftingManager {
ItemStack itemstack = null;
ItemStack itemstack1 = null;
- for (int j = 0; j < inventorycrafting.getSize(); ++j) {
+ int j;
+
+ for (j = 0; j < inventorycrafting.getSize(); ++j) {
ItemStack itemstack2 = inventorycrafting.getItem(j);
if (itemstack2 != null) {
@@ -267,23 +264,19 @@ public class CraftingManager {
return result;
// CraftBukkit end
} else {
- Iterator iterator = this.recipes.iterator();
-
- IRecipe irecipe;
-
- do {
- if (!iterator.hasNext()) {
- return null;
+ for (j = 0; j < this.recipes.size(); ++j) {
+ IRecipe irecipe = (IRecipe) this.recipes.get(j);
+
+ if (irecipe.a(inventorycrafting, world)) {
+ // CraftBukkit start - INVENTORY_PRE_CRAFT event
+ inventorycrafting.currentRecipe = irecipe;
+ ItemStack result = irecipe.a(inventorycrafting);
+ return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
+ // CraftBukkit end
}
+ }
- irecipe = (IRecipe) iterator.next();
- } while (!irecipe.a(inventorycrafting, world));
-
- // CraftBukkit start - INVENTORY_PRE_CRAFT event
- inventorycrafting.currentRecipe = irecipe;
- ItemStack result = irecipe.a(inventorycrafting);
- return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
- // CraftBukkit end
+ return null;
}
}
diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java
index b5da924c..9b50bb2f 100644
--- a/src/main/java/net/minecraft/server/CrashReport.java
+++ b/src/main/java/net/minecraft/server/CrashReport.java
@@ -6,11 +6,10 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
+import java.util.List;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -19,40 +18,29 @@ public class CrashReport {
private final String a;
private final Throwable b;
- private final Map c = new LinkedHashMap();
- private File d = null;
+ private final CrashReportSystemDetails c = new CrashReportSystemDetails(this, "System Details");
+ private final List d = new ArrayList();
+ private File e = null;
+ private boolean f = true;
+ private StackTraceElement[] g = new StackTraceElement[0];
public CrashReport(String s, Throwable throwable) {
this.a = s;
this.b = throwable;
- this.g();
+ this.h();
}
- private void g() {
- this.a("Minecraft Version", (Callable) (new CrashReportVersion(this)));
- this.a("Operating System", (Callable) (new CrashReportOperatingSystem(this)));
- this.a("Java Version", (Callable) (new CrashReportJavaVersion(this)));
- this.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
- this.a("Memory", (Callable) (new CrashReportMemory(this)));
- this.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
- this.a("AABB Pool Size", (Callable) (new CrashReportAABBPoolSize(this)));
- this.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
- }
-
- public void a(String s, Callable callable) {
- try {
- this.a(s, callable.call());
- } catch (Throwable throwable) {
- this.a(s, throwable);
- }
- }
-
- public void a(String s, Object object) {
- this.c.put(s, object == null ? "null" : object.toString());
- }
-
- public void a(String s, Throwable throwable) {
- this.a(s, ("~ERROR~ " + throwable.getClass().getSimpleName() + ": " + throwable.getMessage()));
+ private void h() {
+ this.c.a("Minecraft Version", (Callable) (new CrashReportVersion(this)));
+ this.c.a("Operating System", (Callable) (new CrashReportOperatingSystem(this)));
+ this.c.a("Java Version", (Callable) (new CrashReportJavaVersion(this)));
+ this.c.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
+ this.c.a("Memory", (Callable) (new CrashReportMemory(this)));
+ this.c.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
+ this.c.a("AABB Pool Size", (Callable) (new CrashReportAABBPoolSize(this)));
+ this.c.a("Suspicious classes", (Callable) (new CrashReportSuspiciousClasses(this)));
+ this.c.a("IntCache", (Callable) (new CrashReportIntCacheSize(this)));
+ this.c.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
}
public String a() {
@@ -64,20 +52,32 @@ public class CrashReport {
}
public void a(StringBuilder stringbuilder) {
- boolean flag = true;
+ if (this.g != null && this.g.length > 0) {
+ stringbuilder.append("-- Head --\n");
+ stringbuilder.append("Stacktrace:\n");
+ StackTraceElement[] astacktraceelement = this.g;
+ int i = astacktraceelement.length;
- for (Iterator iterator = this.c.entrySet().iterator(); iterator.hasNext(); flag = false) {
- Entry entry = (Entry) iterator.next();
+ for (int j = 0; j < i; ++j) {
+ StackTraceElement stacktraceelement = astacktraceelement[j];
- if (!flag) {
+ stringbuilder.append("\t").append("at ").append(stacktraceelement.toString());
stringbuilder.append("\n");
}
- stringbuilder.append("- ");
- stringbuilder.append((String) entry.getKey());
- stringbuilder.append(": ");
- stringbuilder.append((String) entry.getValue());
+ stringbuilder.append("\n");
}
+
+ Iterator iterator = this.d.iterator();
+
+ while (iterator.hasNext()) {
+ CrashReportSystemDetails crashreportsystemdetails = (CrashReportSystemDetails) iterator.next();
+
+ crashreportsystemdetails.a(stringbuilder);
+ stringbuilder.append("\n\n");
+ }
+
+ this.c.a(stringbuilder);
}
public String d() {
@@ -112,7 +112,7 @@ public class CrashReport {
stringbuilder.append("---- Minecraft Crash Report ----\n");
stringbuilder.append("// ");
- stringbuilder.append(h());
+ stringbuilder.append(i());
stringbuilder.append("\n\n");
stringbuilder.append("Time: ");
stringbuilder.append((new SimpleDateFormat()).format(new Date()));
@@ -121,15 +121,19 @@ public class CrashReport {
stringbuilder.append(this.a);
stringbuilder.append("\n\n");
stringbuilder.append(this.d());
- stringbuilder.append("\n");
- stringbuilder.append("Relevant Details:");
- stringbuilder.append("\n");
+ stringbuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
+
+ for (int i = 0; i < 87; ++i) {
+ stringbuilder.append("-");
+ }
+
+ stringbuilder.append("\n\n");
this.a(stringbuilder);
return stringbuilder.toString();
}
public boolean a(File file1) {
- if (this.d != null) {
+ if (this.e != null) {
return false;
} else {
if (file1.getParentFile() != null) {
@@ -141,7 +145,7 @@ public class CrashReport {
filewriter.write(this.e());
filewriter.close();
- this.d = file1;
+ this.e = file1;
return true;
} catch (Throwable throwable) {
Logger.getLogger("Minecraft").log(Level.SEVERE, "Could not save crash report to " + file1, throwable);
@@ -150,8 +154,49 @@ public class CrashReport {
}
}
- private static String h() {
- String[] astring = new String[] { "Who set us up the TNT?", "Everything\'s going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I\'m sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don\'t be sad. I\'ll do better next time, I promise!", "Don\'t be sad, have a hug! <3", "I just don\'t know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn\'t worry myself about that.", "I bet Cylons wouldn\'t have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I\'m Minecraft, and I\'m a crashaholic.", "Ooh. Shiny.", "This doesn\'t make any sense!", "Why is it breaking :("};
+ public CrashReportSystemDetails g() {
+ return this.c;
+ }
+
+ public CrashReportSystemDetails a(String s) {
+ return this.a(s, 1);
+ }
+
+ public CrashReportSystemDetails a(String s, int i) {
+ CrashReportSystemDetails crashreportsystemdetails = new CrashReportSystemDetails(this, s);
+
+ if (this.f) {
+ int j = crashreportsystemdetails.a(i);
+ StackTraceElement[] astacktraceelement = this.b.getStackTrace();
+ StackTraceElement stacktraceelement = null;
+ StackTraceElement stacktraceelement1 = null;
+
+ if (astacktraceelement != null && astacktraceelement.length - j < astacktraceelement.length) {
+ stacktraceelement = astacktraceelement[astacktraceelement.length - j];
+ if (astacktraceelement.length + 1 - j < astacktraceelement.length) {
+ stacktraceelement1 = astacktraceelement[astacktraceelement.length + 1 - j];
+ }
+ }
+
+ this.f = crashreportsystemdetails.a(stacktraceelement, stacktraceelement1);
+ if (j > 0 && !this.d.isEmpty()) {
+ CrashReportSystemDetails crashreportsystemdetails1 = (CrashReportSystemDetails) this.d.get(this.d.size() - 1);
+
+ crashreportsystemdetails1.b(j);
+ } else if (astacktraceelement != null && astacktraceelement.length >= j) {
+ this.g = new StackTraceElement[astacktraceelement.length - j];
+ System.arraycopy(astacktraceelement, 0, this.g, 0, this.g.length);
+ } else {
+ this.f = false;
+ }
+ }
+
+ this.d.add(crashreportsystemdetails);
+ return crashreportsystemdetails;
+ }
+
+ private static String i() {
+ String[] astring = new String[] { "Who set us up the TNT?", "Everything\'s going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I\'m sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don\'t be sad. I\'ll do better next time, I promise!", "Don\'t be sad, have a hug! <3", "I just don\'t know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn\'t worry myself about that.", "I bet Cylons wouldn\'t have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I\'m Minecraft, and I\'m a crashaholic.", "Ooh. Shiny.", "This doesn\'t make any sense!", "Why is it breaking :(", "Don\'t do that.", "Ouch. That hurt :(", "You\'re mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!"};
try {
return astring[(int) (System.nanoTime() % (long) astring.length)];
@@ -159,4 +204,16 @@ public class CrashReport {
return "Witty comment unavailable :(";
}
}
+
+ public static CrashReport a(Throwable throwable, String s) {
+ CrashReport crashreport;
+
+ if (throwable instanceof ReportedException) {
+ crashreport = ((ReportedException) throwable).a();
+ } else {
+ crashreport = new CrashReport(s, throwable);
+ }
+
+ return crashreport;
+ }
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 4bf7f9c8..1311fcb1 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -47,7 +47,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end
- log.info("Starting minecraft server version 1.4.2");
+ log.info("Starting minecraft server version 1.4.4");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
@@ -67,6 +67,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
this.setTexturePack(this.propertyManager.getString("texture-pack", ""));
this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
+ if (this.propertyManager.getInt("difficulty", 1) < 0) {
+ this.propertyManager.a("difficulty", Integer.valueOf(0));
+ } else if (this.propertyManager.getInt("difficulty", 1) > 3) {
+ this.propertyManager.a("difficulty", Integer.valueOf(3));
+ }
+
this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
@@ -203,7 +209,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public CrashReport b(CrashReport crashreport) {
crashreport = super.b(crashreport);
- crashreport.a("Type", (Callable) (new CrashReportType(this)));
+ crashreport.g().a("Is Modded", (Callable) (new CrashReportModded(this)));
+ crashreport.g().a("Type", (Callable) (new CrashReportType(this)));
return crashreport;
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
index a73c93db..311265fc 100644
--- a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
@@ -27,9 +27,9 @@ public class DedicatedServerConnectionThread extends Thread {
public DedicatedServerConnectionThread(ServerConnection serverconnection, InetAddress inetaddress, int i) throws IOException { // CraftBukkit - added throws
super("Listen thread");
this.f = serverconnection;
- this.g = inetaddress;
this.h = i;
this.e = new ServerSocket(i, 0, inetaddress);
+ this.g = inetaddress == null ? this.e.getInetAddress() : inetaddress;
this.e.setPerformancePreferences(0, 2, 1);
}
@@ -44,7 +44,7 @@ public class DedicatedServerConnectionThread extends Thread {
netloginhandler.c();
} catch (Exception exception) {
netloginhandler.disconnect("Internal server error");
- a.log(Level.WARNING, "Failed to handle packet: " + exception, exception);
+ a.log(Level.WARNING, "Failed to handle packet for " + netloginhandler.getName() + ": " + exception, exception);
}
if (netloginhandler.c) {
diff --git a/src/main/java/net/minecraft/server/Enchantment.java b/src/main/java/net/minecraft/server/Enchantment.java
index a5a03f41..293c3876 100644
--- a/src/main/java/net/minecraft/server/Enchantment.java
+++ b/src/main/java/net/minecraft/server/Enchantment.java
@@ -79,4 +79,14 @@ public abstract class Enchantment {
this.name = s;
return this;
}
+
+ public String a() {
+ return "enchantment." + this.name;
+ }
+
+ public String c(int i) {
+ String s = LocaleI18n.get(this.a());
+
+ return s + " " + LocaleI18n.get("enchantment.level." + i);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a99392ef..50d4834c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1,8 +1,8 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
import java.util.Random;
+import java.util.concurrent.Callable;
// CraftBukkit start
import java.util.UUID;
@@ -90,11 +90,12 @@ public abstract class Entity {
public int ak;
public boolean al;
public boolean am;
- public int an;
+ public int portalCooldown;
protected boolean ao;
private int h;
public int dimension;
protected int aq;
+ private boolean invulnerable;
public EnumEntitySize ar;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public boolean valid = false; // CraftBukkit
@@ -132,6 +133,7 @@ public abstract class Entity {
this.datawatcher = new DataWatcher();
this.ah = false;
this.aq = 0;
+ this.invulnerable = false;
this.ar = EnumEntitySize.SIZE_2;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
@@ -244,14 +246,15 @@ public abstract class Entity {
int i;
if (!this.world.isStatic && this.world instanceof WorldServer) {
+ this.world.methodProfiler.a("portal");
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
i = this.z();
if (this.ao) {
- if (minecraftserver.getAllowNether()) {
+ if (true || minecraftserver.getAllowNether()) { // CraftBukkit
if (this.vehicle == null && this.h++ >= i) {
this.h = i;
- this.an = this.ab();
+ this.portalCooldown = this.ab();
byte b0;
if (this.world.worldProvider.dimension == -1) {
@@ -275,59 +278,26 @@ public abstract class Entity {
}
}
- if (this.an > 0) {
- --this.an;
+ if (this.portalCooldown > 0) {
+ --this.portalCooldown;
}
- }
- int j;
+ this.world.methodProfiler.b();
+ }
if (this.isSprinting() && !this.H()) {
- int k = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.locX);
i = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
- j = MathHelper.floor(this.locZ);
- int l = this.world.getTypeId(k, i, j);
+ int k = MathHelper.floor(this.locZ);
+ int l = this.world.getTypeId(j, i, k);
if (l > 0) {
- this.world.addParticle("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
+ this.world.addParticle("tilecrack_" + l + "_" + this.world.getData(j, i, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
}
}
- if (this.I()) {
- if (!this.ad && !this.justCreated) {
- float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
-
- if (f > 1.0F) {
- f = 1.0F;
- }
-
- this.world.makeSound(this, "liquid.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
- float f1 = (float) MathHelper.floor(this.boundingBox.b);
-
- float f2;
- float f3;
-
- for (j = 0; (float) j < 1.0F + this.width * 20.0F; ++j) {
- f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- this.world.addParticle("bubble", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
- }
-
- for (j = 0; (float) j < 1.0F + this.width * 20.0F; ++j) {
- f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- this.world.addParticle("splash", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY, this.motZ);
- }
- }
-
- this.fallDistance = 0.0F;
- this.ad = true;
- this.fireTicks = 0;
- } else {
- this.ad = false;
- }
-
+ this.I();
if (this.world.isStatic) {
this.fireTicks = 0;
} else if (this.fireTicks > 0) {
@@ -517,10 +487,8 @@ public abstract class Entity {
List list = this.world.getCubes(this, this.boundingBox.a(d0, d1, d2));
- AxisAlignedBB axisalignedbb1;
-
- for (Iterator iterator = list.iterator(); iterator.hasNext(); d1 = axisalignedbb1.b(this.boundingBox, d1)) {
- axisalignedbb1 = (AxisAlignedBB) iterator.next();
+ for (int i = 0; i < list.size(); ++i) {
+ d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1);
}
this.boundingBox.d(0.0D, d1, 0.0D);
@@ -532,11 +500,10 @@ public abstract class Entity {
boolean flag1 = this.onGround || d7 != d1 && d7 < 0.0D;
- AxisAlignedBB axisalignedbb2;
- Iterator iterator1;
+ int j;
- for (iterator1 = list.iterator(); iterator1.hasNext(); d0 = axisalignedbb2.a(this.boundingBox, d0)) {
- axisalignedbb2 = (AxisAlignedBB) iterator1.next();
+ for (j = 0; j < list.size(); ++j) {
+ d0 = ((AxisAlignedBB) list.get(j)).a(this.boundingBox, d0);
}
this.boundingBox.d(d0, 0.0D, 0.0D);
@@ -546,8 +513,8 @@ public abstract class Entity {
d0 = 0.0D;
}
- for (iterator1 = list.iterator(); iterator1.hasNext(); d2 = axisalignedbb2.c(this.boundingBox, d2)) {
- axisalignedbb2 = (AxisAlignedBB) iterator1.next();
+ for (j = 0; j < list.size(); ++j) {
+ d2 = ((AxisAlignedBB) list.get(j)).c(this.boundingBox, d2);
}
this.boundingBox.d(0.0D, 0.0D, d2);
@@ -560,6 +527,7 @@ public abstract class Entity {
double d10;
double d11;
double d12;
+ int k;
if (this.X > 0.0F && flag1 && (flag || this.W < 0.05F) && (d6 != d0 || d8 != d2)) {
d10 = d0;
@@ -568,16 +536,13 @@ public abstract class Entity {
d0 = d6;
d1 = (double) this.X;
d2 = d8;
- AxisAlignedBB axisalignedbb3 = this.boundingBox.clone();
+ AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
this.boundingBox.c(axisalignedbb);
list = this.world.getCubes(this, this.boundingBox.a(d6, d1, d8));
- Iterator iterator2;
- AxisAlignedBB axisalignedbb4;
-
- for (iterator2 = list.iterator(); iterator2.hasNext(); d1 = axisalignedbb4.b(this.boundingBox, d1)) {
- axisalignedbb4 = (AxisAlignedBB) iterator2.next();
+ for (k = 0; k < list.size(); ++k) {
+ d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
}
this.boundingBox.d(0.0D, d1, 0.0D);
@@ -587,8 +552,8 @@ public abstract class Entity {
d0 = 0.0D;
}
- for (iterator2 = list.iterator(); iterator2.hasNext(); d0 = axisalignedbb4.a(this.boundingBox, d0)) {
- axisalignedbb4 = (AxisAlignedBB) iterator2.next();
+ for (k = 0; k < list.size(); ++k) {
+ d0 = ((AxisAlignedBB) list.get(k)).a(this.boundingBox, d0);
}
this.boundingBox.d(d0, 0.0D, 0.0D);
@@ -598,8 +563,8 @@ public abstract class Entity {
d0 = 0.0D;
}
- for (iterator2 = list.iterator(); iterator2.hasNext(); d2 = axisalignedbb4.c(this.boundingBox, d2)) {
- axisalignedbb4 = (AxisAlignedBB) iterator2.next();
+ for (k = 0; k < list.size(); ++k) {
+ d2 = ((AxisAlignedBB) list.get(k)).c(this.boundingBox, d2);
}
this.boundingBox.d(0.0D, 0.0D, d2);
@@ -616,8 +581,8 @@ public abstract class Entity {
} else {
d1 = (double) (-this.X);
- for (iterator2 = list.iterator(); iterator2.hasNext(); d1 = axisalignedbb4.b(this.boundingBox, d1)) {
- axisalignedbb4 = (AxisAlignedBB) iterator2.next();
+ for (k = 0; k < list.size(); ++k) {
+ d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
}
this.boundingBox.d(0.0D, d1, 0.0D);
@@ -627,7 +592,7 @@ public abstract class Entity {
d0 = d10;
d1 = d11;
d2 = d12;
- this.boundingBox.c(axisalignedbb3);
+ this.boundingBox.c(axisalignedbb1);
} else {
double d13 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
@@ -684,22 +649,27 @@ public abstract class Entity {
// CraftBukkit end
if (this.f_() && !flag && this.vehicle == null) {
- int i = MathHelper.floor(this.locX);
- int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
- int k = MathHelper.floor(this.locZ);
- int l = this.world.getTypeId(i, j, k);
+ int l = MathHelper.floor(this.locX);
+
+ k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
+ int i1 = MathHelper.floor(this.locZ);
+ int j1 = this.world.getTypeId(l, k, i1);
+
+ if (j1 == 0) {
+ int k1 = this.world.e(l, k - 1, i1);
- if (l == 0 && this.world.getTypeId(i, j - 1, k) == Block.FENCE.id) {
- l = this.world.getTypeId(i, j - 1, k);
+ if (k1 == 11 || k1 == 32 || k1 == 21) {
+ j1 = this.world.getTypeId(l, k - 1, i1);
+ }
}
- if (l != Block.LADDER.id) {
+ if (j1 != Block.LADDER.id) {
d11 = 0.0D;
}
this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D);
this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D);
- if (this.R > (float) this.c && l > 0) {
+ if (this.R > (float) this.c && j1 > 0) {
this.c = (int) this.R + 1;
if (this.H()) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.35F;
@@ -708,11 +678,11 @@ public abstract class Entity {
f = 1.0F;
}
- this.world.makeSound(this, "liquid.swim", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ this.makeSound("liquid.swim", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
}
- this.a(i, j, k, l);
- Block.byId[l].b(this.world, i, j, k, this);
+ this.a(l, k, i1, j1);
+ Block.byId[j1].b(this.world, l, k, i1, this);
}
}
@@ -741,7 +711,7 @@ public abstract class Entity {
}
if (flag2 && this.fireTicks > 0) {
- this.world.makeSound(this, "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ this.makeSound("random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
this.fireTicks = -this.maxFireTicks;
}
@@ -777,12 +747,16 @@ public abstract class Entity {
if (this.world.getTypeId(i, j + 1, k) == Block.SNOW.id) {
stepsound = Block.SNOW.stepSound;
- this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
+ this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
} else if (!Block.byId[l].material.isLiquid()) {
- this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
+ this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
}
}
+ protected void makeSound(String s, float f, float f1) {
+ this.world.makeSound(this, s, f, f1);
+ }
+
protected boolean f_() {
return true;
}
@@ -833,7 +807,7 @@ public abstract class Entity {
}
public boolean G() {
- return this.ad || this.world.B(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ return this.ad || this.world.D(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) || this.world.D(MathHelper.floor(this.locX), MathHelper.floor(this.locY + (double) this.length), MathHelper.floor(this.locZ));
}
public boolean H() {
@@ -841,7 +815,42 @@ public abstract class Entity {
}
public boolean I() {
- return this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D, 0.001D, 0.001D), Material.WATER, this);
+ if (this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D, 0.001D, 0.001D), Material.WATER, this)) {
+ if (!this.ad && !this.justCreated) {
+ float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
+
+ if (f > 1.0F) {
+ f = 1.0F;
+ }
+
+ this.makeSound("liquid.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ float f1 = (float) MathHelper.floor(this.boundingBox.b);
+
+ int i;
+ float f2;
+ float f3;
+
+ for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
+ f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
+ f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
+ this.world.addParticle("bubble", this.locX + (double) f2, (double) (f1 + 1.0F), this.locZ + (double) f3, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
+ }
+
+ for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
+ f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
+ f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
+ this.world.addParticle("splash", this.locX + (double) f2, (double) (f1 + 1.0F), this.locZ + (double) f3, this.motX, this.motY, this.motZ);
+ }
+ }
+
+ this.fallDistance = 0.0F;
+ this.ad = true;
+ this.fireTicks = 0;
+ } else {
+ this.ad = false;
+ }
+
+ return this.ad;
}
public boolean a(Material material) {
@@ -897,7 +906,7 @@ public abstract class Entity {
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
int k = MathHelper.floor(this.locY - (double) this.height + d0);
- return this.world.o(i, k, j);
+ return this.world.p(i, k, j);
} else {
return 0.0F;
}
@@ -977,7 +986,7 @@ public abstract class Entity {
return d0 * d0 + d1 * d1 + d2 * d2;
}
- public void b_(EntityHuman entityhuman) {}
+ public void c_(EntityHuman entityhuman) {}
public void collide(Entity entity) {
if (entity.passenger != this && entity.vehicle != this) {
@@ -1019,8 +1028,12 @@ public abstract class Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.K();
- return false;
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ this.K();
+ return false;
+ }
}
public boolean L() {
@@ -1046,83 +1059,55 @@ public abstract class Entity {
}
public void d(NBTTagCompound nbttagcompound) {
- nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.W, this.locZ}));
- nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
+ try {
+ nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.W, this.locZ}));
+ nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
+
+ // CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
+ // TODO: make sure this is the best way to address this.
+ if (Float.isNaN(this.yaw)) {
+ this.yaw = 0;
+ }
- // CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
- // TODO: make sure this is the best way to address this.
- if (Float.isNaN(this.yaw)) {
- this.yaw = 0;
- }
+ if (Float.isNaN(this.pitch)) {
+ this.pitch = 0;
+ }
+ // CraftBukkit end
- if (Float.isNaN(this.pitch)) {
- this.pitch = 0;
- }
- // CraftBukkit end
+ nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
+ nbttagcompound.setFloat("FallDistance", this.fallDistance);
+ nbttagcompound.setShort("Fire", (short) this.fireTicks);
+ nbttagcompound.setShort("Air", (short) this.getAirTicks());
+ nbttagcompound.setBoolean("OnGround", this.onGround);
+ nbttagcompound.setInt("Dimension", this.dimension);
+ nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
+ nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
+ // CraftBukkit start
+ nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
+ nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
+ nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
+ nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
+ // CraftBukkit end
+ this.b(nbttagcompound);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being saved");
- nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
- nbttagcompound.setFloat("FallDistance", this.fallDistance);
- nbttagcompound.setShort("Fire", (short) this.fireTicks);
- nbttagcompound.setShort("Air", (short) this.getAirTicks());
- nbttagcompound.setBoolean("OnGround", this.onGround);
- nbttagcompound.setInt("Dimension", this.dimension);
- // CraftBukkit start
- nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
- nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
- nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
- nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
- // CraftBukkit end
- this.b(nbttagcompound);
+ this.a(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
+ }
}
public void e(NBTTagCompound nbttagcompound) {
- NBTTagList nbttaglist = nbttagcompound.getList("Pos");
- NBTTagList nbttaglist1 = nbttagcompound.getList("Motion");
- NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation");
-
- this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data;
- this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data;
- this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
- /* CraftBukkit start - moved section down
- if (Math.abs(this.motX) > 10.0D) {
- this.motX = 0.0D;
- }
-
- if (Math.abs(this.motY) > 10.0D) {
- this.motY = 0.0D;
- }
-
- if (Math.abs(this.motZ) > 10.0D) {
- this.motZ = 0.0D;
- }
- // CraftBukkit end */
-
- this.lastX = this.T = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
- this.lastY = this.U = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
- this.lastZ = this.V = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
- this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
- this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
- this.fallDistance = nbttagcompound.getFloat("FallDistance");
- this.fireTicks = nbttagcompound.getShort("Fire");
- this.setAirTicks(nbttagcompound.getShort("Air"));
- this.onGround = nbttagcompound.getBoolean("OnGround");
- this.dimension = nbttagcompound.getInt("Dimension");
- this.setPosition(this.locX, this.locY, this.locZ);
-
- // CraftBukkit start
- long least = nbttagcompound.getLong("UUIDLeast");
- long most = nbttagcompound.getLong("UUIDMost");
-
- if (least != 0L && most != 0L) {
- this.uniqueId = new UUID(most, least);
- }
- // CraftBukkit end
-
- this.b(this.yaw, this.pitch);
- this.a(nbttagcompound);
-
- // CraftBukkit start - exempt Vehicles from notch's sanity check
- if (!(this.getBukkitEntity() instanceof Vehicle)) {
+ try {
+ NBTTagList nbttaglist = nbttagcompound.getList("Pos");
+ NBTTagList nbttaglist1 = nbttagcompound.getList("Motion");
+ NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation");
+
+ this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data;
+ this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data;
+ this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
+ /* CraftBukkit start - moved section down
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
@@ -1134,32 +1119,80 @@ public abstract class Entity {
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
- }
- // CraftBukkit end
+ // CraftBukkit end */
+
+ this.lastX = this.T = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
+ this.lastY = this.U = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
+ this.lastZ = this.V = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
+ this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
+ this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
+ this.fallDistance = nbttagcompound.getFloat("FallDistance");
+ this.fireTicks = nbttagcompound.getShort("Fire");
+ this.setAirTicks(nbttagcompound.getShort("Air"));
+ this.onGround = nbttagcompound.getBoolean("OnGround");
+ this.dimension = nbttagcompound.getInt("Dimension");
+ this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
+ this.portalCooldown = nbttagcompound.getInt("PortalCooldown");
+ this.setPosition(this.locX, this.locY, this.locZ);
+
+ // CraftBukkit start
+ long least = nbttagcompound.getLong("UUIDLeast");
+ long most = nbttagcompound.getLong("UUIDMost");
- // CraftBukkit start - reset world
- if (this instanceof EntityPlayer) {
- Server server = Bukkit.getServer();
- org.bukkit.World bworld = null;
+ if (least != 0L && most != 0L) {
+ this.uniqueId = new UUID(most, least);
+ }
+ // CraftBukkit end
- // TODO: Remove World related checks, replaced with WorldUID.
- String worldName = nbttagcompound.getString("World");
+ this.b(this.yaw, this.pitch);
+ this.a(nbttagcompound);
- if (nbttagcompound.hasKey("WorldUUIDMost") && nbttagcompound.hasKey("WorldUUIDLeast")) {
- UUID uid = new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast"));
- bworld = server.getWorld(uid);
- } else {
- bworld = server.getWorld(worldName);
+ // CraftBukkit start - exempt Vehicles from notch's sanity check
+ if (!(this.getBukkitEntity() instanceof Vehicle)) {
+ if (Math.abs(this.motX) > 10.0D) {
+ this.motX = 0.0D;
+ }
+
+ if (Math.abs(this.motY) > 10.0D) {
+ this.motY = 0.0D;
+ }
+
+ if (Math.abs(this.motZ) > 10.0D) {
+ this.motZ = 0.0D;
+ }
}
+ // CraftBukkit end
+
+ // CraftBukkit start - reset world
+ if (this instanceof EntityPlayer) {
+ Server server = Bukkit.getServer();
+ org.bukkit.World bworld = null;
+
+ // TODO: Remove World related checks, replaced with WorldUID.
+ String worldName = nbttagcompound.getString("World");
+
+ if (nbttagcompound.hasKey("WorldUUIDMost") && nbttagcompound.hasKey("WorldUUIDLeast")) {
+ UUID uid = new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast"));
+ bworld = server.getWorld(uid);
+ } else {
+ bworld = server.getWorld(worldName);
+ }
+
+ if (bworld == null) {
+ EntityPlayer entityPlayer = (EntityPlayer) this;
+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
+ }
- if (bworld == null) {
- EntityPlayer entityPlayer = (EntityPlayer) this;
- bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
+ this.spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
}
+ // CraftBukkit end
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
- this.spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
+ this.a(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
}
- // CraftBukkit end
}
protected final String Q() {
@@ -1227,7 +1260,7 @@ public abstract class Entity {
int k = MathHelper.floor(this.locY + (double) this.getHeadHeight() + (double) f1);
int l = MathHelper.floor(this.locZ + (double) f2);
- if (this.world.s(j, k, l)) {
+ if (this.world.t(j, k, l)) {
return true;
}
}
@@ -1235,7 +1268,7 @@ public abstract class Entity {
return false;
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return false;
}
@@ -1300,7 +1333,7 @@ public abstract class Entity {
}
public void V() {
- if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bS()) {
+ if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bW()) {
this.passenger.T = this.T;
this.passenger.U = this.U + this.X() + this.passenger.W();
this.passenger.V = this.V;
@@ -1403,12 +1436,12 @@ public abstract class Entity {
AxisAlignedBB axisalignedbb = this.boundingBox.c(d3, 1.0D, d4);
if (this.world.a(axisalignedbb).isEmpty()) {
- if (this.world.t(i, (int) this.locY, j)) {
+ if (this.world.v(i, (int) this.locY, j)) {
this.setPositionRotation(this.locX + d3, this.locY + 1.0D, this.locZ + d4, this.yaw, this.pitch);
return;
}
- if (this.world.t(i, (int) this.locY - 1, j) || this.world.getMaterial(i, (int) this.locY - 1, j) == Material.WATER) {
+ if (this.world.v(i, (int) this.locY - 1, j) || this.world.getMaterial(i, (int) this.locY - 1, j) == Material.WATER) {
d0 = this.locX + d3;
d1 = this.locY + 1.0D;
d2 = this.locZ + d4;
@@ -1430,8 +1463,8 @@ public abstract class Entity {
}
public void aa() {
- if (this.an > 0) {
- this.an = this.ab();
+ if (this.portalCooldown > 0) {
+ this.portalCooldown = this.ab();
} else {
double d0 = this.lastX - this.locX;
double d1 = this.lastZ - this.locZ;
@@ -1445,7 +1478,7 @@ public abstract class Entity {
}
public int ab() {
- return 500;
+ return 900;
}
public ItemStack[] getEquipment() {
@@ -1559,15 +1592,18 @@ public abstract class Entity {
double d3 = d0 - (double) i;
double d4 = d1 - (double) j;
double d5 = d2 - (double) k;
+ List list = this.world.a(this.boundingBox);
- if (this.world.s(i, j, k)) {
- boolean flag = !this.world.s(i - 1, j, k);
- boolean flag1 = !this.world.s(i + 1, j, k);
- boolean flag2 = !this.world.s(i, j - 1, k);
- boolean flag3 = !this.world.s(i, j + 1, k);
- boolean flag4 = !this.world.s(i, j, k - 1);
- boolean flag5 = !this.world.s(i, j, k + 1);
- byte b0 = -1;
+ if (list.isEmpty() && !this.world.u(i, j, k)) {
+ return false;
+ } else {
+ boolean flag = !this.world.u(i - 1, j, k);
+ boolean flag1 = !this.world.u(i + 1, j, k);
+ boolean flag2 = !this.world.u(i, j - 1, k);
+ boolean flag3 = !this.world.u(i, j + 1, k);
+ boolean flag4 = !this.world.u(i, j, k - 1);
+ boolean flag5 = !this.world.u(i, j, k + 1);
+ byte b0 = 3;
double d6 = 9999.0D;
if (flag && d3 < d6) {
@@ -1580,11 +1616,6 @@ public abstract class Entity {
b0 = 1;
}
- if (flag2 && d4 < d6) {
- d6 = d4;
- b0 = 2;
- }
-
if (flag3 && 1.0D - d4 < d6) {
d6 = 1.0D - d4;
b0 = 3;
@@ -1627,8 +1658,6 @@ public abstract class Entity {
}
return true;
- } else {
- return false;
}
}
@@ -1663,11 +1692,19 @@ public abstract class Entity {
return true;
}
+ public boolean j(Entity entity) {
+ return false;
+ }
+
public String toString() {
return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] { this.getClass().getSimpleName(), this.getLocalizedName(), Integer.valueOf(this.id), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)});
}
- public void j(Entity entity) {
+ public boolean isInvulnerable() {
+ return this.invulnerable;
+ }
+
+ public void k(Entity entity) {
this.setPositionRotation(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
}
@@ -1676,12 +1713,13 @@ public abstract class Entity {
entity.d(nbttagcompound);
this.e(nbttagcompound);
- this.an = entity.an;
+ this.portalCooldown = entity.portalCooldown;
this.aq = entity.aq;
}
public void b(int i) {
if (false && !this.world.isStatic && !this.dead) { // CraftBukkit - disable entity portal support for now.
+ this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer();
int j = this.dimension;
WorldServer worldserver = minecraftserver.getWorldServer(j);
@@ -1690,7 +1728,9 @@ public abstract class Entity {
this.dimension = i;
this.world.kill(this);
this.dead = false;
+ this.world.methodProfiler.a("reposition");
minecraftserver.getServerConfigurationManager().a(this, j, worldserver, worldserver1);
+ this.world.methodProfiler.c("reloading");
Entity entity = EntityTypes.createEntityByName(EntityTypes.b(this), worldserver1);
if (entity != null) {
@@ -1699,8 +1739,10 @@ public abstract class Entity {
}
this.dead = true;
+ this.world.methodProfiler.b();
worldserver.i();
worldserver1.i();
+ this.world.methodProfiler.b();
}
}
@@ -1719,4 +1761,13 @@ public abstract class Entity {
public boolean au() {
return false;
}
+
+ public void a(CrashReportSystemDetails crashreportsystemdetails) {
+ crashreportsystemdetails.a("Entity Type", (Callable) (new CrashReportEntityType(this)));
+ crashreportsystemdetails.a("Entity ID", Integer.valueOf(this.id));
+ crashreportsystemdetails.a("Name", this.getLocalizedName());
+ crashreportsystemdetails.a("Exact location", String.format("%.2f, %.2f, %.2f", new Object[] { Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)}));
+ crashreportsystemdetails.a("Block location", CrashReportSystemDetails.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)));
+ crashreportsystemdetails.a("Momentum", String.format("%.2f, %.2f, %.2f", new Object[] { Double.valueOf(this.motX), Double.valueOf(this.motY), Double.valueOf(this.motZ)}));
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index f7421b32..e861d3b7 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -7,6 +7,28 @@ public abstract class EntityAgeable extends EntityCreature {
super(world);
}
+ public abstract EntityAgeable createChild(EntityAgeable entityageable);
+
+ public boolean a(EntityHuman entityhuman) {
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
+
+ if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id && !this.world.isStatic) {
+ Class oclass = EntityTypes.a(itemstack.getData());
+
+ if (oclass != null && oclass.isAssignableFrom(this.getClass())) {
+ EntityAgeable entityageable = this.createChild(this);
+
+ if (entityageable != null) {
+ entityageable.setAge(-24000);
+ entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
+ this.world.addEntity(entityageable);
+ }
+ }
+ }
+
+ return super.a(entityhuman);
+ }
+
protected void a() {
super.a();
this.datawatcher.a(12, new Integer(0));
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index af0bcd58..8963e1c3 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -167,12 +166,12 @@ public class EntityArrow extends Entity implements IProjectile {
Entity entity = null;
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
- Iterator iterator = list.iterator();
+ int l;
float f1;
- while (iterator.hasNext()) {
- Entity entity1 = (Entity) iterator.next();
+ for (l = 0; l < list.size(); ++l) {
+ Entity entity1 = (Entity) list.get(l);
if (entity1.L() && (entity1 != this.shooter || this.as >= 5)) {
f1 = 0.3F;
@@ -204,10 +203,10 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit end
if (movingobjectposition.entity != null) {
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
- int l = MathHelper.f((double) f2 * this.damage);
+ int i1 = MathHelper.f((double) f2 * this.damage);
if (this.d()) {
- l += this.random.nextInt(l / 2 + 2);
+ i1 += this.random.nextInt(i1 / 2 + 2);
}
DamageSource damagesource = null;
@@ -219,7 +218,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
// CraftBukkit start - moved damage call
- if (movingobjectposition.entity.damageEntity(damagesource, l)) {
+ if (movingobjectposition.entity.damageEntity(damagesource, i1)) {
if (this.isBurning() && (!(movingobjectposition.entity instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player.
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
@@ -230,9 +229,14 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit end
}
- // if (movingobjectposition.entity.damageEntity(damagesource, l)) { // CraftBukkit - moved up
+ // if (movingobjectposition.entity.damageEntity(damagesource, i1)) { // CraftBukkit - moved up
if (movingobjectposition.entity instanceof EntityLiving) {
- ++((EntityLiving) movingobjectposition.entity).bk;
+ if (!this.world.isStatic) {
+ EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
+
+ entityliving.r(entityliving.bJ() + 1);
+ }
+
if (this.au > 0) {
float f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -242,7 +246,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
- this.world.makeSound(this, "random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
+ this.makeSound("random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.die();
} else {
this.motX *= -0.10000000149011612D;
@@ -265,16 +269,19 @@ public class EntityArrow extends Entity implements IProjectile {
this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D;
- this.world.makeSound(this, "random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
+ this.makeSound("random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.shake = 7;
this.e(false);
+ if (this.g != 0) {
+ Block.byId[this.g].a(this.world, this.d, this.e, this.f, this);
+ }
}
}
if (this.d()) {
- for (int i1 = 0; i1 < 4; ++i1) {
- this.world.addParticle("crit", this.locX + this.motX * (double) i1 / 4.0D, this.locY + this.motY * (double) i1 / 4.0D, this.locZ + this.motZ * (double) i1 / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
+ for (l = 0; l < 4; ++l) {
+ this.world.addParticle("crit", this.locX + this.motX * (double) l / 4.0D, this.locY + this.motY * (double) l / 4.0D, this.locZ + this.motZ * (double) l / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
}
}
@@ -355,7 +362,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
- public void b_(EntityHuman entityhuman) {
+ public void c_(EntityHuman entityhuman) {
if (!this.world.isStatic && this.inGround && this.shake <= 0) {
// CraftBukkit start
ItemStack itemstack = new ItemStack(Item.ARROW);
@@ -378,7 +385,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
if (flag) {
- this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ this.makeSound("random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, 1);
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
index 883f52cd..ac7a779e 100644
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -22,15 +22,15 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.a(16, new Byte((byte) 0));
}
- protected String aW() {
+ protected String aY() {
return "mob.blaze.breathe";
}
- protected String aX() {
+ protected String aZ() {
return "mob.blaze.hit";
}
- protected String aY() {
+ protected String ba() {
return "mob.blaze.death";
}
@@ -73,7 +73,7 @@ public class EntityBlaze extends EntityMonster {
protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
- this.l(entity);
+ this.m(entity);
} else if (f < 30.0F) {
double d0 = entity.locX - this.locX;
double d1 = entity.boundingBox.b + (double) (entity.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index 128db798..8fce5597 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -93,7 +92,9 @@ public class EntityBoat extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (!this.world.isStatic && !this.dead) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else if (!this.world.isStatic && !this.dead) {
// CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
@@ -356,12 +357,11 @@ public class EntityBoat extends Entity {
if (!this.world.isStatic) {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+ int l;
if (list != null && !list.isEmpty()) {
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
+ for (l = 0; l < list.size(); ++l) {
+ Entity entity = (Entity) list.get(l);
if (entity != this.passenger && entity.M() && entity instanceof EntityBoat) {
entity.collide(this);
@@ -369,7 +369,7 @@ public class EntityBoat extends Entity {
}
}
- for (int l = 0; l < 4; ++l) {
+ for (l = 0; l < 4; ++l) {
int i1 = MathHelper.floor(this.locX + ((double) (l % 2) - 0.5D) * 0.8D);
int j1 = MathHelper.floor(this.locZ + ((double) (l / 2) - 0.5D) * 0.8D);
@@ -408,7 +408,7 @@ public class EntityBoat extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
} else {
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index 75c5c3cf..2390261b 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -27,7 +27,7 @@ public class EntityChicken extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -59,7 +59,7 @@ public class EntityChicken extends EntityAnimal {
this.e += this.i * 2.0F;
if (!this.isBaby() && !this.world.isStatic && --this.j <= 0) {
- this.world.makeSound(this, "mob.chicken.plop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.makeSound("mob.chicken.plop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.b(Item.EGG.id, 1);
this.j = this.random.nextInt(6000) + 6000;
}
@@ -67,20 +67,20 @@ public class EntityChicken extends EntityAnimal {
protected void a(float f) {}
- protected String aW() {
+ protected String aY() {
return "mob.chicken.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.chicken.hurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.chicken.hurt";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.chicken.step", 0.15F, 1.0F);
+ this.makeSound("mob.chicken.step", 0.15F, 1.0F);
}
protected int getLootId() {
@@ -106,11 +106,15 @@ public class EntityChicken extends EntityAnimal {
// CraftBukkit end
}
- public EntityAnimal createChild(EntityAnimal entityanimal) {
+ public EntityChicken b(EntityAgeable entityageable) {
return new EntityChicken(this.world);
}
public boolean c(ItemStack itemstack) {
return itemstack != null && itemstack.getItem() instanceof ItemSeeds;
}
+
+ public EntityAgeable createChild(EntityAgeable entityageable) {
+ return this.b(entityageable);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index c6246d88..cc512b1b 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -22,7 +22,7 @@ public class EntityCow extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -30,23 +30,23 @@ public class EntityCow extends EntityAnimal {
return 10;
}
- protected String aW() {
+ protected String aY() {
return "mob.cow.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.cow.hurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.cow.hurt";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.cow.step", 0.15F, 1.0F);
+ this.makeSound("mob.cow.step", 0.15F, 1.0F);
}
- protected float aV() {
+ protected float aX() {
return 0.4F;
}
@@ -75,7 +75,7 @@ public class EntityCow extends EntityAnimal {
// CraftBukkit end
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
@@ -96,11 +96,15 @@ public class EntityCow extends EntityAnimal {
return true;
} else {
- return super.c(entityhuman);
+ return super.a(entityhuman);
}
}
- public EntityAnimal createChild(EntityAnimal entityanimal) {
+ public EntityCow b(EntityAgeable entityageable) {
return new EntityCow(this.world);
}
+
+ public EntityAgeable createChild(EntityAgeable entityageable) {
+ return this.b(entityageable);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index 6c63f9c1..95ec5835 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -20,7 +20,7 @@ public abstract class EntityCreature extends EntityLiving {
return false;
}
- protected void bk() {
+ protected void bn() {
this.world.methodProfiler.a("ai");
if (this.c > 0) {
--this.c;
@@ -52,7 +52,7 @@ public abstract class EntityCreature extends EntityLiving {
} else if (this.target.isAlive()) {
float f1 = this.target.d((Entity) this);
- if (this.m(this.target)) {
+ if (this.n(this.target)) {
this.a(this.target, f1);
}
} else {
@@ -73,7 +73,7 @@ public abstract class EntityCreature extends EntityLiving {
this.world.methodProfiler.b();
if (!this.b && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
- } else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bC < 100) {
+ } else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bA < 100) {
this.i();
}
@@ -97,7 +97,7 @@ public abstract class EntityCreature extends EntityLiving {
}
}
- this.bG = false;
+ this.bE = false;
if (vec3d != null) {
double d1 = vec3d.c - this.locX;
double d2 = vec3d.e - this.locZ;
@@ -106,7 +106,7 @@ public abstract class EntityCreature extends EntityLiving {
float f2 = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = MathHelper.g(f2 - this.yaw);
- this.bE = this.bI;
+ this.bC = this.bG;
if (f3 > 30.0F) {
f3 = 30.0F;
}
@@ -123,12 +123,12 @@ public abstract class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
- this.bD = -MathHelper.sin(f3) * this.bE * 1.0F;
- this.bE = MathHelper.cos(f3) * this.bE * 1.0F;
+ this.bB = -MathHelper.sin(f3) * this.bC * 1.0F;
+ this.bC = MathHelper.cos(f3) * this.bC * 1.0F;
}
if (d3 > 0.0D) {
- this.bG = true;
+ this.bE = true;
}
}
@@ -137,16 +137,16 @@ public abstract class EntityCreature extends EntityLiving {
}
if (this.positionChanged && !this.k()) {
- this.bG = true;
+ this.bE = true;
}
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
- this.bG = true;
+ this.bE = true;
}
this.world.methodProfiler.b();
} else {
- super.bk();
+ super.bn();
this.pathEntity = null;
}
}
@@ -215,10 +215,10 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity;
}
- public float by() {
- float f = super.by();
+ public float bB() {
+ float f = super.bB();
- if (this.c > 0 && !this.bb()) {
+ if (this.c > 0 && !this.be()) {
f *= 2.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 025438e9..ab778b40 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -27,12 +27,12 @@ public class EntityCreeper extends EntityMonster {
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
public int as() {
- return this.aF() == null ? 3 : 3 + (this.health - 1);
+ return this.aG() == null ? 3 : 3 + (this.health - 1);
}
protected void a(float f) {
@@ -81,7 +81,7 @@ public class EntityCreeper extends EntityMonster {
int i = this.o();
if (i > 0 && this.fuseTicks == 0) {
- this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
+ this.makeSound("random.fuse", 1.0F, 0.5F);
}
this.fuseTicks += i;
@@ -112,19 +112,21 @@ public class EntityCreeper extends EntityMonster {
super.j_();
}
- protected String aX() {
+ protected String aZ() {
return "mob.creeper.say";
}
- protected String aY() {
+ protected String ba() {
return "mob.creeper.death";
}
public void die(DamageSource damagesource) {
// CraftBukkit start - rearranged the method (super call to end, drop to dropDeathLoot)
if (damagesource.getEntity() instanceof EntitySkeleton) {
- // this.b(Item.RECORD_1.id + this.random.nextInt(10), 1); // CraftBukkit
- this.record = Item.RECORD_1.id + this.random.nextInt(10);
+ int i = Item.RECORD_1.id + this.random.nextInt(Item.RECORD_12.id - Item.RECORD_1.id + 1);
+
+ // this.b(i, 1); // CraftBukkit
+ this.record = i;
}
super.die(damagesource);
@@ -159,7 +161,7 @@ public class EntityCreeper extends EntityMonster {
}
// CraftBukkit end
- public boolean l(Entity entity) {
+ public boolean m(Entity entity) {
return true;
}
diff --git a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
index 5cbdf721..940da7e9 100644
--- a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
+++ b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
@@ -18,13 +18,12 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
}
public String getLocalizedDeathMessage(EntityHuman entityhuman) {
- // CraftBukkit start
- String source = (this.owner == null) ? "Herobrine" : this.owner.getLocalizedName();
- return LocaleI18n.get("death." + this.translationIndex, new Object[] { entityhuman.name, source});
+ return LocaleI18n.get("death." + this.translationIndex, new Object[] { entityhuman.name, this.owner == null ? this.r.getLocalizedName() : this.owner.getLocalizedName()});
}
+ // CraftBukkit start
public Entity getProximateDamageSource() {
return super.getEntity();
- // CraftBukkit end
}
+ // CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java
index 7d73cc62..ed8f271f 100644
--- a/src/main/java/net/minecraft/server/EntityEgg.java
+++ b/src/main/java/net/minecraft/server/EntityEgg.java
@@ -23,7 +23,7 @@ public class EntityEgg extends EntityProjectile {
protected void a(MovingObjectPosition movingobjectposition) {
if (movingobjectposition.entity != null) {
- movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
+ movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0);
}
// CraftBukkit start
@@ -35,8 +35,9 @@ public class EntityEgg extends EntityProjectile {
EntityType hatchingType = EntityType.CHICKEN;
- if (this.shooter instanceof EntityPlayer) {
- Player player = (this.shooter == null) ? null : (Player) this.shooter.getBukkitEntity();
+ Entity shooter = this.getShooter();
+ if (shooter instanceof EntityPlayer) {
+ Player player = (shooter == null) ? null : (Player) shooter.getBukkitEntity();
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
this.world.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
index 410fc289..f3395b44 100644
--- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java
+++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
@@ -46,22 +46,26 @@ public class EntityEnderCrystal extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (!this.dead && !this.world.isStatic) {
- // CraftBukkit start - All non-living entities need this
- if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) {
- return false;
- }
- // CraftBukkit end
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ if (!this.dead && !this.world.isStatic) {
+ // CraftBukkit start - All non-living entities need this
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) {
+ return false;
+ }
+ // CraftBukkit end
- this.b = 0;
- if (this.b <= 0) {
- this.die();
- if (!this.world.isStatic) {
- this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F, true); // CraftBukkit - (Entity) null -> this
+ this.b = 0;
+ if (this.b <= 0) {
+ this.die();
+ if (!this.world.isStatic) {
+ this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F, true); // CraftBukkit - (Entity) null -> this
+ }
}
}
- }
- return true;
+ return true;
+ }
}
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 75547e9c..066ee78c 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -25,20 +25,20 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
public EntityComplexPart h;
public EntityComplexPart i;
public EntityComplexPart j;
+ public EntityComplexPart bI;
+ public EntityComplexPart bJ;
public EntityComplexPart bK;
- public EntityComplexPart bL;
- public EntityComplexPart bM;
- public float bN = 0.0F;
- public float bO = 0.0F;
- public boolean bP = false;
- public boolean bQ = false;
- private Entity bT;
- public int bR = 0;
- public EntityEnderCrystal bS = null;
+ public float bL = 0.0F;
+ public float bM = 0.0F;
+ public boolean bN = false;
+ public boolean bO = false;
+ private Entity bR;
+ public int bP = 0;
+ public EntityEnderCrystal bQ = null;
public EntityEnderDragon(World world) {
super(world);
- this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bM = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
+ this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bI = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bJ = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
this.setHealth(this.getMaxHealth());
this.texture = "/mob/enderdragon/ender.png";
this.a(16.0F, 8.0F);
@@ -84,14 +84,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
if (!this.world.isStatic) {
this.datawatcher.watch(16, Integer.valueOf(this.health));
} else {
- f = MathHelper.cos(this.bO * 3.1415927F * 2.0F);
- f1 = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
+ f = MathHelper.cos(this.bM * 3.1415927F * 2.0F);
+ f1 = MathHelper.cos(this.bL * 3.1415927F * 2.0F);
if (f1 <= -0.3F && f >= -0.3F) {
this.world.b(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F);
}
}
- this.bN = this.bO;
+ this.bL = this.bM;
float f2;
if (this.health <= 0) {
@@ -103,10 +103,10 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.h();
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motY);
- if (this.bQ) {
- this.bO += f * 0.5F;
+ if (this.bO) {
+ this.bM += f * 0.5F;
} else {
- this.bO += f;
+ this.bM += f;
}
this.yaw = MathHelper.g(this.yaw);
@@ -130,14 +130,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
float f3;
if (this.world.isStatic) {
- if (this.bu > 0) {
- d0 = this.locX + (this.bv - this.locX) / (double) this.bu;
- d1 = this.locY + (this.bw - this.locY) / (double) this.bu;
- d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu;
- d3 = MathHelper.g(this.by - (double) this.yaw);
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.bu);
- this.pitch = (float) ((double) this.pitch + (this.bz - (double) this.pitch) / (double) this.bu);
- --this.bu;
+ if (this.bs > 0) {
+ d0 = this.locX + (this.bt - this.locX) / (double) this.bs;
+ d1 = this.locY + (this.bu - this.locY) / (double) this.bs;
+ d2 = this.locZ + (this.bv - this.locZ) / (double) this.bs;
+ d3 = MathHelper.g(this.bw - (double) this.yaw);
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.bs);
+ this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bs);
+ --this.bs;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
}
@@ -146,9 +146,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d1 = this.b - this.locY;
d2 = this.c - this.locZ;
d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (this.bT != null) {
- this.a = this.bT.locX;
- this.c = this.bT.locZ;
+ if (this.bR != null) {
+ this.a = this.bR.locX;
+ this.c = this.bR.locZ;
double d4 = this.a - this.locX;
double d5 = this.c - this.locZ;
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
@@ -158,13 +158,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d7 = 10.0D;
}
- this.b = this.bT.boundingBox.b + d7;
+ this.b = this.bR.boundingBox.b + d7;
} else {
this.a += this.random.nextGaussian() * 2.0D;
this.c += this.random.nextGaussian() * 2.0D;
}
- if (this.bP || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
+ if (this.bN || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
this.i();
}
@@ -199,7 +199,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
f4 = 0.0F;
}
- this.bF *= 0.8F;
+ this.bD *= 0.8F;
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
@@ -207,13 +207,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d10 = 40.0D;
}
- this.bF = (float) ((double) this.bF + d9 * (0.699999988079071D / d10 / (double) f5));
- this.yaw += this.bF * 0.1F;
+ this.bD = (float) ((double) this.bD + d9 * (0.699999988079071D / d10 / (double) f5));
+ this.yaw += this.bD * 0.1F;
float f6 = (float) (2.0D / (d10 + 1.0D));
float f7 = 0.06F;
this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6)));
- if (this.bQ) {
+ if (this.bO) {
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
} else {
this.move(this.motX, this.motY, this.motZ);
@@ -232,13 +232,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.g.width = this.g.length = 3.0F;
this.i.width = this.i.length = 2.0F;
this.j.width = this.j.length = 2.0F;
- this.bK.width = this.bK.length = 2.0F;
+ this.bI.width = this.bI.length = 2.0F;
this.h.length = 3.0F;
this.h.width = 5.0F;
- this.bL.length = 2.0F;
- this.bL.width = 4.0F;
- this.bM.length = 3.0F;
- this.bM.width = 4.0F;
+ this.bJ.length = 2.0F;
+ this.bJ.width = 4.0F;
+ this.bK.length = 3.0F;
+ this.bK.width = 4.0F;
f1 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
f2 = MathHelper.cos(f1);
float f9 = -MathHelper.sin(f1);
@@ -248,21 +248,21 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.h.j_();
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
- this.bL.j_();
- this.bL.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
- this.bM.j_();
- this.bM.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
+ this.bJ.j_();
+ this.bJ.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
+ this.bK.j_();
+ this.bK.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
if (!this.world.isStatic && this.hurtTicks == 0) {
- this.a(this.world.getEntities(this, this.bL.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
- this.a(this.world.getEntities(this, this.bM.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
+ this.a(this.world.getEntities(this, this.bJ.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
+ this.a(this.world.getEntities(this, this.bK.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D)));
}
double[] adouble = this.a(5, 1.0F);
double[] adouble1 = this.a(0, 1.0F);
- f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
- float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
+ f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bD * 0.01F);
+ float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bD * 0.01F);
this.g.j_();
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F);
@@ -279,7 +279,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
if (j == 2) {
- entitycomplexpart = this.bK;
+ entitycomplexpart = this.bI;
}
double[] adouble2 = this.a(12 + j * 2, 1.0F);
@@ -294,19 +294,19 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
if (!this.world.isStatic) {
- this.bQ = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
+ this.bO = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
}
}
}
private void h() {
- if (this.bS != null) {
- if (this.bS.dead) {
+ if (this.bQ != null) {
+ if (this.bQ.dead) {
if (!this.world.isStatic) {
this.a(this.g, DamageSource.EXPLOSION, 10);
}
- this.bS = null;
+ this.bQ = null;
} else if (this.ticksLived % 10 == 0 && this.health < this.getMaxHealth()) {
// CraftBukkit start
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
@@ -336,7 +336,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
- this.bS = entityendercrystal;
+ this.bQ = entityendercrystal;
}
}
@@ -359,10 +359,8 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
private void b(List list) {
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity = (Entity) list.get(i);
if (entity instanceof EntityLiving) {
// CraftBukkit start - throw damage events when the dragon attacks
@@ -384,9 +382,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
private void i() {
- this.bP = false;
+ this.bN = false;
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
- this.bT = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
+ this.bR = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
} else {
boolean flag = false;
@@ -403,7 +401,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
} while (!flag);
- this.bT = null;
+ this.bR = null;
}
}
@@ -484,7 +482,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.a = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.b = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
- this.bT = null;
+ this.bR = null;
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
this.dealDamage(damagesource, i);
}
@@ -500,9 +498,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return super.damageEntity(damagesource, i);
}
- protected void aO() {
- ++this.bR;
- if (this.bR >= 180 && this.bR <= 200) {
+ protected void aP() {
+ ++this.bP;
+ if (this.bP >= 180 && this.bP <= 200) {
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
@@ -514,7 +512,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
int j;
if (!this.world.isStatic) {
- if (this.bR > 150 && this.bR % 5 == 0) {
+ if (this.bP > 150 && this.bP % 5 == 0) {
i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
while (i > 0) {
@@ -524,14 +522,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
- if (this.bR == 1) {
+ if (this.bP == 1) {
this.world.e(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
}
this.move(0.0D, 0.10000000149011612D, 0.0D);
this.aw = this.yaw += 20.0F;
- if (this.bR == 200 && !this.world.isStatic) {
+ if (this.bP == 200 && !this.world.isStatic) {
i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
while (i > 0) {
@@ -611,7 +609,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
BlockEnderPortal.a = false;
}
- protected void bh() {}
+ protected void bk() {}
public Entity[] ao() {
return this.children;
@@ -625,15 +623,15 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return this.world;
}
- protected String aW() {
+ protected String aY() {
return "mob.enderdragon.growl";
}
- protected String aX() {
+ protected String aZ() {
return "mob.enderdragon.hit";
}
- protected float aV() {
+ protected float aX() {
return 5.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index cc897ac1..e173f625 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -18,7 +18,7 @@ public class EntityEnderPearl extends EntityProjectile {
protected void a(MovingObjectPosition movingobjectposition) {
if (movingobjectposition.entity != null) {
- movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
+ movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0);
}
for (int i = 0; i < 32; ++i) {
@@ -26,8 +26,8 @@ public class EntityEnderPearl extends EntityProjectile {
}
if (!this.world.isStatic) {
- if (this.shooter != null && this.shooter instanceof EntityPlayer) {
- EntityPlayer entityplayer = (EntityPlayer) this.shooter;
+ if (this.getShooter() != null && this.getShooter() instanceof EntityPlayer) {
+ EntityPlayer entityplayer = (EntityPlayer) this.getShooter();
if (!entityplayer.netServerHandler.disconnected && entityplayer.world == this.world) {
// CraftBukkit start
@@ -41,7 +41,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (!teleEvent.isCancelled() && !entityplayer.netServerHandler.disconnected) {
entityplayer.netServerHandler.teleport(teleEvent.getTo());
- this.shooter.fallDistance = 0.0F;
+ this.getShooter().fallDistance = 0.0F;
EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), player, EntityDamageByEntityEvent.DamageCause.FALL, 5);
Bukkit.getPluginManager().callEvent(damageEvent);
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 7e522cae..dc0e7a6f 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -15,7 +15,7 @@ public class EntityEnderman extends EntityMonster {
public EntityEnderman(World world) {
super(world);
this.texture = "/mob/enderman.png";
- this.bI = 0.2F;
+ this.bG = 0.2F;
this.a(0.6F, 2.9F);
this.X = 1.0F;
}
@@ -78,7 +78,7 @@ public class EntityEnderman extends EntityMonster {
vec3d1 = vec3d1.a();
double d1 = vec3d.b(vec3d1);
- return d1 > 1.0D - 0.025D / d0 ? entityhuman.m(this) : false;
+ return d1 > 1.0D - 0.025D / d0 ? entityhuman.n(this) : false;
}
}
@@ -87,7 +87,7 @@ public class EntityEnderman extends EntityMonster {
this.damageEntity(DamageSource.DROWN, 1);
}
- this.bI = this.target != null ? 6.5F : 0.3F;
+ this.bG = this.target != null ? 6.5F : 0.3F;
int i;
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
@@ -135,10 +135,10 @@ public class EntityEnderman extends EntityMonster {
this.world.addParticle("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D);
}
- if (this.world.t() && !this.world.isStatic) {
+ if (this.world.u() && !this.world.isStatic) {
float f = this.c(1.0F);
- if (f > 0.5F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.world.k(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
this.target = null;
this.f(false);
this.m();
@@ -151,7 +151,7 @@ public class EntityEnderman extends EntityMonster {
this.m();
}
- this.bG = false;
+ this.bE = false;
if (this.target != null) {
this.a(this.target, 100.0F, 100.0F);
}
@@ -159,14 +159,14 @@ public class EntityEnderman extends EntityMonster {
if (!this.world.isStatic && this.isAlive()) {
if (this.target != null) {
if (this.target instanceof EntityHuman && this.d((EntityHuman) this.target)) {
- this.bD = this.bE = 0.0F;
- this.bI = 0.0F;
+ this.bB = this.bC = 0.0F;
+ this.bG = 0.0F;
if (this.target.e((Entity) this) < 16.0D) {
this.m();
}
this.e = 0;
- } else if (this.target.e((Entity) this) > 256.0D && this.e++ >= 30 && this.o(this.target)) {
+ } else if (this.target.e((Entity) this) > 256.0D && this.e++ >= 30 && this.p(this.target)) {
this.e = 0;
}
} else {
@@ -186,7 +186,7 @@ public class EntityEnderman extends EntityMonster {
return this.j(d0, d1, d2);
}
- protected boolean o(Entity entity) {
+ protected boolean p(Entity entity) {
Vec3D vec3d = this.world.getVec3DPool().create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
vec3d = vec3d.a();
@@ -262,20 +262,20 @@ public class EntityEnderman extends EntityMonster {
}
this.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
- this.world.makeSound(this, "mob.endermen.portal", 1.0F, 1.0F);
+ this.makeSound("mob.endermen.portal", 1.0F, 1.0F);
return true;
}
}
- protected String aW() {
+ protected String aY() {
return this.q() ? "mob.endermen.scream" : "mob.endermen.idle";
}
- protected String aX() {
+ protected String aZ() {
return "mob.endermen.hit";
}
- protected String aY() {
+ protected String ba() {
return "mob.endermen.death";
}
@@ -317,7 +317,9 @@ public class EntityEnderman extends EntityMonster {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (damagesource instanceof EntityDamageSourceIndirect) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
if (this.m()) {
return true;
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 235cac9a..a733b6a8 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -53,7 +53,7 @@ public class EntityExperienceOrb extends Entity {
this.motY = 0.20000000298023224D;
this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
- this.world.makeSound(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
+ this.makeSound("random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
}
this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
@@ -123,13 +123,17 @@ public class EntityExperienceOrb extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.K();
- this.d -= i;
- if (this.d <= 0) {
- this.die();
- }
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ this.K();
+ this.d -= i;
+ if (this.d <= 0) {
+ this.die();
+ }
- return false;
+ return false;
+ }
}
public void b(NBTTagCompound nbttagcompound) {
@@ -144,11 +148,11 @@ public class EntityExperienceOrb extends Entity {
this.value = nbttagcompound.getShort("Value");
}
- public void b_(EntityHuman entityhuman) {
+ public void c_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
- if (this.c == 0 && entityhuman.bU == 0) {
- entityhuman.bU = 2;
- this.world.makeSound(this, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
+ if (this.c == 0 && entityhuman.bR == 0) {
+ entityhuman.bR = 2;
+ this.makeSound("random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
entityhuman.receive(this, 1);
entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value to event.getAmount()
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index b3209a39..c016f925 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit
@@ -105,10 +104,9 @@ public abstract class EntityFireball extends Entity {
Entity entity = null;
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- Entity entity1 = (Entity) iterator.next();
+ for (int j = 0; j < list.size(); ++j) {
+ Entity entity1 = (Entity) list.get(j);
if (entity1.L() && (!entity1.i(this.shooter) || this.as >= 25)) {
float f = 0.3F;
@@ -169,7 +167,7 @@ public abstract class EntityFireball extends Entity {
float f2 = this.c();
if (this.H()) {
- for (int j = 0; j < 4; ++j) {
+ for (int k = 0; k < 4; ++k) {
float f3 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
@@ -230,26 +228,30 @@ public abstract class EntityFireball extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.K();
- if (damagesource.getEntity() != null) {
- Vec3D vec3d = damagesource.getEntity().Z();
-
- if (vec3d != null) {
- this.motX = vec3d.c;
- this.motY = vec3d.d;
- this.motZ = vec3d.e;
- this.dirX = this.motX * 0.1D;
- this.dirY = this.motY * 0.1D;
- this.dirZ = this.motZ * 0.1D;
- }
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ this.K();
+ if (damagesource.getEntity() != null) {
+ Vec3D vec3d = damagesource.getEntity().Z();
+
+ if (vec3d != null) {
+ this.motX = vec3d.c;
+ this.motY = vec3d.d;
+ this.motZ = vec3d.e;
+ this.dirX = this.motX * 0.1D;
+ this.dirY = this.motY * 0.1D;
+ this.dirZ = this.motZ * 0.1D;
+ }
- if (damagesource.getEntity() instanceof EntityLiving) {
- this.shooter = (EntityLiving) damagesource.getEntity();
- }
+ if (damagesource.getEntity() instanceof EntityLiving) {
+ this.shooter = (EntityLiving) damagesource.getEntity();
+ }
- return true;
- } else {
- return false;
+ return true;
+ } else {
+ return false;
+ }
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index a67c5c7d..bce96a1f 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -93,7 +92,7 @@ public class EntityFishingHook extends Entity {
this.b(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
- ItemStack itemstack = this.owner.bP();
+ ItemStack itemstack = this.owner.bT();
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
this.die();
@@ -152,12 +151,11 @@ public class EntityFishingHook extends Entity {
Entity entity = null;
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
double d4 = 0.0D;
- Iterator iterator = list.iterator();
double d5;
- while (iterator.hasNext()) {
- Entity entity1 = (Entity) iterator.next();
+ for (int j = 0; j < list.size(); ++j) {
+ Entity entity1 = (Entity) list.get(j);
if (entity1.L() && (entity1 != this.owner || this.j >= 5)) {
float f = 0.3F;
@@ -221,9 +219,9 @@ public class EntityFishingHook extends Entity {
byte b0 = 5;
double d6 = 0.0D;
- for (int j = 0; j < b0; ++j) {
- double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (j + 0) / (double) b0 - 0.125D + 0.125D;
- double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (j + 1) / (double) b0 - 0.125D + 0.125D;
+ for (int k = 0; k < b0; ++k) {
+ double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 0) / (double) b0 - 0.125D + 0.125D;
+ double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 1) / (double) b0 - 0.125D + 0.125D;
AxisAlignedBB axisalignedbb1 = AxisAlignedBB.a().a(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f);
if (this.world.b(axisalignedbb1, Material.WATER)) {
@@ -237,27 +235,27 @@ public class EntityFishingHook extends Entity {
} else {
short short1 = 500;
- if (this.world.B(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
+ if (this.world.D(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
short1 = 300;
}
if (this.random.nextInt(short1) == 0) {
this.as = this.random.nextInt(30) + 10;
this.motY -= 0.20000000298023224D;
- this.world.makeSound(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ this.makeSound("random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
float f3 = (float) MathHelper.floor(this.boundingBox.b);
float f4;
- int k;
+ int l;
float f5;
- for (k = 0; (float) k < 1.0F + this.width * 20.0F; ++k) {
+ for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.addParticle("bubble", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
}
- for (k = 0; (float) k < 1.0F + this.width * 20.0F; ++k) {
+ for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.addParticle("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ);
diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java
index 8ec253fe..031ebb0e 100644
--- a/src/main/java/net/minecraft/server/EntityGhast.java
+++ b/src/main/java/net/minecraft/server/EntityGhast.java
@@ -26,7 +26,9 @@ public class EntityGhast extends EntityFlying implements IMonster {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if ("fireball".equals(damagesource.l()) && damagesource.getEntity() instanceof EntityHuman) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else if ("fireball".equals(damagesource.l()) && damagesource.getEntity() instanceof EntityHuman) {
super.damageEntity(damagesource, 1000);
((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.y);
return true;
@@ -51,12 +53,12 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
}
- protected void bk() {
+ protected void bn() {
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
- this.bh();
+ this.bk();
this.f = this.g;
double d0 = this.c - this.locX;
double d1 = this.d - this.locY;
@@ -128,7 +130,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d7 = this.target.locZ - this.locZ;
this.aw = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
- if (this.m(this.target)) {
+ if (this.n(this.target)) {
if (this.g == 10) {
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
@@ -182,15 +184,15 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true;
}
- protected String aW() {
+ protected String aY() {
return "mob.ghast.moan";
}
- protected String aX() {
+ protected String aZ() {
return "mob.ghast.scream";
}
- protected String aY() {
+ protected String ba() {
return "mob.ghast.death";
}
@@ -219,7 +221,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
// CraftBukkit end
}
- protected float aV() {
+ protected float aX() {
return 10.0F;
}
@@ -227,7 +229,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
}
- public int bs() {
+ public int bv() {
return 1;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java
index e40857e4..8cc80b97 100644
--- a/src/main/java/net/minecraft/server/EntityHanging.java
+++ b/src/main/java/net/minecraft/server/EntityHanging.java
@@ -203,50 +203,58 @@ public abstract class EntityHanging extends Entity {
return true;
}
+ public boolean j(Entity entity) {
+ return entity instanceof EntityHuman ? this.damageEntity(DamageSource.playerAttack((EntityHuman) entity), 0) : false;
+ }
+
public boolean damageEntity(DamageSource damagesource, int i) {
- if (!this.dead && !this.world.isStatic) {
- // CraftBukkit start
- HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
- PaintingBreakEvent paintingEvent = null;
- if (damagesource.getEntity() != null) {
- event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ if (!this.dead && !this.world.isStatic) {
+ // CraftBukkit start
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
+ PaintingBreakEvent paintingEvent = null;
+ if (damagesource.getEntity() != null) {
+ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
- if (this instanceof EntityPainting) {
- // Fire old painting event until it can be removed
- paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
+ if (this instanceof EntityPainting) {
+ // Fire old painting event until it can be removed
+ paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
+ }
+ } else if (damagesource == DamageSource.EXPLOSION || damagesource == DamageSource.EXPLOSION2) {
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
}
- } else if (damagesource == DamageSource.EXPLOSION || damagesource == DamageSource.EXPLOSION2) {
- event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
- }
- this.world.getServer().getPluginManager().callEvent(event);
+ this.world.getServer().getPluginManager().callEvent(event);
- if (paintingEvent != null) {
- paintingEvent.setCancelled(event.isCancelled());
- this.world.getServer().getPluginManager().callEvent(paintingEvent);
- }
+ if (paintingEvent != null) {
+ paintingEvent.setCancelled(event.isCancelled());
+ this.world.getServer().getPluginManager().callEvent(paintingEvent);
+ }
- if (dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
- return true;
- }
- // CraftBukkit end
+ if (dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
+ return true;
+ }
+ // CraftBukkit end
- this.die();
- this.K();
- EntityHuman entityhuman = null;
+ this.die();
+ this.K();
+ EntityHuman entityhuman = null;
- if (damagesource.getEntity() instanceof EntityHuman) {
- entityhuman = (EntityHuman) damagesource.getEntity();
- }
+ if (damagesource.getEntity() instanceof EntityHuman) {
+ entityhuman = (EntityHuman) damagesource.getEntity();
+ }
- if (entityhuman != null && entityhuman.abilities.canInstantlyBuild) {
- return true;
+ if (entityhuman != null && entityhuman.abilities.canInstantlyBuild) {
+ return true;
+ }
+
+ this.h();
}
- this.h();
+ return true;
}
-
- return true;
}
public void move(double d0, double d1, double d2) {
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 9665716c..47de470a 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -20,19 +20,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public Container defaultContainer;
public Container activeContainer;
protected FoodMetaData foodData = new FoodMetaData();
- protected int bO = 0;
- public byte bP = 0;
- public int bQ = 0;
- public float bR;
- public float bS;
+ protected int bM = 0;
+ public byte bN = 0;
+ public float bO;
+ public float bP;
public String name;
- public int bU = 0;
+ public int bR = 0;
+ public double bS;
+ public double bT;
+ public double bU;
public double bV;
public double bW;
public double bX;
- public double bY;
- public double bZ;
- public double ca;
// CraftBukkit start
public boolean sleeping; // protected -> public
public boolean fauxSleeping;
@@ -43,10 +42,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
- public ChunkCoordinates cc;
+ public ChunkCoordinates bZ;
public int sleepTicks; // CraftBukkit - private -> public
- public float cd;
- public float ce;
+ public float ca;
+ public float cb;
private ChunkCoordinates c;
private boolean d;
private ChunkCoordinates e;
@@ -57,8 +56,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public float exp;
private ItemStack f;
private int g;
- protected float cj = 0.1F;
- protected float ck = 0.02F;
+ protected float cg = 0.1F;
+ protected float ch = 0.02F;
private int h = 0;
public EntityFishingHook hookedFish = null;
@@ -84,21 +83,22 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
super.a();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
this.datawatcher.a(17, Byte.valueOf((byte) 0));
+ this.datawatcher.a(18, Integer.valueOf(0));
}
- public boolean bI() {
+ public boolean bM() {
return this.f != null;
}
- public void bK() {
+ public void bO() {
if (this.f != null) {
this.f.b(this.world, this, this.g);
}
- this.bL();
+ this.bP();
}
- public void bL() {
+ public void bP() {
this.f = null;
this.g = 0;
if (!this.world.isStatic) {
@@ -106,8 +106,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public boolean be() {
- return this.bI() && Item.byId[this.f.id].d_(this.f) == EnumAnimation.d;
+ public boolean bh() {
+ return this.bM() && Item.byId[this.f.id].d_(this.f) == EnumAnimation.d;
}
public void j_() {
@@ -123,12 +123,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.n();
}
} else {
- this.bL();
+ this.bP();
}
}
- if (this.bU > 0) {
- --this.bU;
+ if (this.bR > 0) {
+ --this.bR;
}
if (this.isSleeping()) {
@@ -140,7 +140,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (!this.world.isStatic) {
if (!this.j()) {
this.a(true, true, false);
- } else if (this.world.t()) {
+ } else if (this.world.u()) {
this.a(false, true, true);
}
}
@@ -152,7 +152,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
super.j_();
- if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.c(this)) {
+ if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.a(this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
}
@@ -161,41 +161,41 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.extinguish();
}
- this.bV = this.bY;
- this.bW = this.bZ;
- this.bX = this.ca;
- double d0 = this.locX - this.bY;
- double d1 = this.locY - this.bZ;
- double d2 = this.locZ - this.ca;
+ this.bS = this.bV;
+ this.bT = this.bW;
+ this.bU = this.bX;
+ double d0 = this.locX - this.bV;
+ double d1 = this.locY - this.bW;
+ double d2 = this.locZ - this.bX;
double d3 = 10.0D;
if (d0 > d3) {
- this.bV = this.bY = this.locX;
+ this.bS = this.bV = this.locX;
}
if (d2 > d3) {
- this.bX = this.ca = this.locZ;
+ this.bU = this.bX = this.locZ;
}
if (d1 > d3) {
- this.bW = this.bZ = this.locY;
+ this.bT = this.bW = this.locY;
}
if (d0 < -d3) {
- this.bV = this.bY = this.locX;
+ this.bS = this.bV = this.locX;
}
if (d2 < -d3) {
- this.bX = this.ca = this.locZ;
+ this.bU = this.bX = this.locZ;
}
if (d1 < -d3) {
- this.bW = this.bZ = this.locY;
+ this.bT = this.bW = this.locY;
}
- this.bY += d0 * 0.25D;
- this.ca += d2 * 0.25D;
- this.bZ += d1 * 0.25D;
+ this.bV += d0 * 0.25D;
+ this.bX += d2 * 0.25D;
+ this.bW += d1 * 0.25D;
this.a(StatisticList.k, 1);
if (this.vehicle == null) {
this.e = null;
@@ -214,9 +214,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return 10;
}
+ protected void makeSound(String s, float f, float f1) {
+ this.world.a(this, s, f, f1);
+ }
+
protected void c(ItemStack itemstack, int i) {
if (itemstack.n() == EnumAnimation.c) {
- this.world.makeSound(this, "random.drink", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ this.makeSound("random.drink", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
}
if (itemstack.n() == EnumAnimation.b) {
@@ -233,7 +237,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
}
- this.world.makeSound(this, "random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.makeSound("random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
@@ -250,11 +254,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- this.bL();
+ this.bP();
}
}
- protected boolean bd() {
+ protected boolean bg() {
return this.getHealth() <= 0 || this.isSleeping();
}
@@ -271,8 +275,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
float f1 = this.pitch;
super.U();
- this.bR = this.bS;
- this.bS = 0.0F;
+ this.bO = this.bP;
+ this.bP = 0.0F;
this.k(this.locX - d0, this.locY - d1, this.locZ - d2);
if (this.vehicle instanceof EntityPig) {
this.pitch = f1;
@@ -281,13 +285,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- protected void bk() {
- this.bl();
+ protected void bn() {
+ this.bo();
}
public void c() {
- if (this.bO > 0) {
- --this.bO;
+ if (this.bM > 0) {
+ --this.bM;
}
if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 * 12 == 0) {
@@ -296,13 +300,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
this.inventory.j();
- this.bR = this.bS;
+ this.bO = this.bP;
super.c();
this.aM = this.abilities.b();
- this.aN = this.ck;
+ this.aN = this.ch;
if (this.isSprinting()) {
this.aM = (float) ((double) this.aM + (double) this.abilities.b() * 0.3D);
- this.aN = (float) ((double) this.aN + (double) this.ck * 0.3D);
+ this.aN = (float) ((double) this.aN + (double) this.ch * 0.3D);
}
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -321,27 +325,39 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f1 = 0.0F;
}
- this.bS += (f - this.bS) * 0.4F;
+ this.bP += (f - this.bP) * 0.4F;
this.ba += (f1 - this.ba) * 0.8F;
if (this.getHealth() > 0) {
- List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
+ List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.5D, 1.0D));
if (list != null) {
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity = (Entity) list.get(i);
if (!entity.dead) {
- this.q(entity);
+ this.r(entity);
}
}
}
}
}
- private void q(Entity entity) {
- entity.b_(this);
+ private void r(Entity entity) {
+ entity.c_(this);
+ }
+
+ public int getScore() {
+ return this.datawatcher.getInt(18);
+ }
+
+ public void setScore(int i) {
+ this.datawatcher.watch(18, Integer.valueOf(i));
+ }
+
+ public void addScore(int i) {
+ int j = this.getScore();
+
+ this.datawatcher.watch(18, Integer.valueOf(j + i));
}
public void die(DamageSource damagesource) {
@@ -369,7 +385,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public void c(Entity entity, int i) {
- this.bQ += i;
+ this.addScore(i);
if (entity instanceof EntityHuman) {
this.a(StatisticList.A, 1);
} else {
@@ -377,7 +393,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public EntityItem bN() {
+ public EntityItem bR() {
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
}
@@ -479,8 +495,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.exp = nbttagcompound.getFloat("XpP");
this.expLevel = nbttagcompound.getInt("XpLevel");
this.expTotal = nbttagcompound.getInt("XpTotal");
+ this.setScore(nbttagcompound.getInt("Score"));
if (this.sleeping) {
- this.cc = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ this.bZ = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
@@ -513,6 +530,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
nbttagcompound.setFloat("XpP", this.exp);
nbttagcompound.setInt("XpLevel", this.expLevel);
nbttagcompound.setInt("XpTotal", this.expTotal);
+ nbttagcompound.setInt("Score", this.getScore());
if (this.c != null) {
nbttagcompound.setInt("SpawnX", this.c.x);
nbttagcompound.setInt("SpawnY", this.c.y);
@@ -543,10 +561,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
return false;
} else {
- this.bC = 0;
+ this.bA = 0;
if (this.getHealth() <= 0) {
return false;
} else {
@@ -646,11 +666,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.inventory.g(i);
}
- public int aU() {
+ public int aW() {
return this.inventory.k();
}
- public float bO() {
+ public float bS() {
int i = 0;
ItemStack[] aitemstack = this.inventory.armor;
int j = aitemstack.length;
@@ -667,8 +687,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
protected void d(DamageSource damagesource, int i) {
- if (!this.invulnerable) {
- if (!damagesource.ignoresArmor() && this.be()) {
+ if (!this.isInvulnerable()) {
+ if (!damagesource.ignoresArmor() && this.bh()) {
i = 1 + i >> 1;
}
@@ -693,11 +713,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void d(ItemStack itemstack) {}
- public boolean o(Entity entity) {
- if (entity.c(this)) {
+ public boolean p(Entity entity) {
+ if (entity.a(this)) {
return true;
} else {
- ItemStack itemstack = this.bP();
+ ItemStack itemstack = this.bT();
if (itemstack != null && entity instanceof EntityLiving) {
if (this.abilities.canInstantlyBuild) {
@@ -707,7 +727,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (itemstack.a((EntityLiving) entity)) {
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
- this.bQ();
+ this.bU();
}
return true;
@@ -718,11 +738,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public ItemStack bP() {
+ public ItemStack bT() {
return this.inventory.getItemInHand();
}
- public void bQ() {
+ public void bU() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
@@ -732,98 +752,108 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void attack(Entity entity) {
if (entity.aq()) {
- int i = this.inventory.a(entity);
-
- if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
- i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
- }
-
- if (this.hasEffect(MobEffectList.WEAKNESS)) {
- i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
- }
-
- int j = 0;
- int k = 0;
+ if (!entity.j(this)) {
+ int i = this.inventory.a(entity);
- if (entity instanceof EntityLiving) {
- k = EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
- j += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
- }
+ if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
+ i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
+ }
- if (this.isSprinting()) {
- ++j;
- }
+ if (this.hasEffect(MobEffectList.WEAKNESS)) {
+ i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
+ }
- if (i > 0 || k > 0) {
- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.g_() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
+ int j = 0;
+ int k = 0;
- if (flag) {
- i += this.random.nextInt(i / 2 + 2);
+ if (entity instanceof EntityLiving) {
+ k = EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
+ j += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
}
- i += k;
- boolean flag1 = entity.damageEntity(DamageSource.playerAttack(this), i);
-
- // CraftBukkit start - Return when the damage fails so that the item will not lose durability
- if (!flag1) {
- return;
+ if (this.isSprinting()) {
+ ++j;
}
- // CraftBukkit end
-
- if (flag1) {
- if (j > 0) {
- entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
- this.motX *= 0.6D;
- this.motZ *= 0.6D;
- this.setSprinting(false);
- }
+
+ if (i > 0 || k > 0) {
+ boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.g_() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag) {
- this.b(entity);
+ i += this.random.nextInt(i / 2 + 2);
}
- if (k > 0) {
- this.c(entity);
+ i += k;
+ boolean flag1 = false;
+ int l = EnchantmentManager.getFireAspectEnchantmentLevel(this);
+
+ if (entity instanceof EntityLiving && l > 0 && !entity.isBurning()) {
+ flag1 = true;
+ entity.setOnFire(1);
}
- if (i >= 18) {
- this.a((Statistic) AchievementList.E);
+ boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), i);
+
+ // CraftBukkit start - Return when the damage fails so that the item will not lose durability
+ if (!flag2) {
+ return;
}
+ // CraftBukkit end
+
+ if (flag2) {
+ if (j > 0) {
+ entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
+ this.motX *= 0.6D;
+ this.motZ *= 0.6D;
+ this.setSprinting(false);
+ }
- this.k(entity);
- }
+ if (flag) {
+ this.b(entity);
+ }
- ItemStack itemstack = this.bP();
+ if (k > 0) {
+ this.c(entity);
+ }
- if (itemstack != null && entity instanceof EntityLiving) {
- itemstack.a((EntityLiving) entity, this);
- // CraftBukkit - bypass infinite items; <= 0 -> == 0
- if (itemstack.count == 0) {
- this.bQ();
- }
- }
+ if (i >= 18) {
+ this.a((Statistic) AchievementList.E);
+ }
- if (entity instanceof EntityLiving) {
- if (entity.isAlive()) {
- this.a((EntityLiving) entity, true);
+ this.l(entity);
}
- this.a(StatisticList.w, i);
- int l = EnchantmentManager.getFireAspectEnchantmentLevel(this, (EntityLiving) entity);
+ ItemStack itemstack = this.bT();
- if (l > 0 && flag1) {
- // CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item
- EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4);
- org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+ if (itemstack != null && entity instanceof EntityLiving) {
+ itemstack.a((EntityLiving) entity, this);
+ // CraftBukkit - bypass infinite items; <= 0 -> == 0
+ if (itemstack.count == 0) {
+ this.bU();
+ }
+ }
- if (!combustEvent.isCancelled()) {
- entity.setOnFire(combustEvent.getDuration());
+ if (entity instanceof EntityLiving) {
+ if (entity.isAlive()) {
+ this.a((EntityLiving) entity, true);
+ }
+
+ this.a(StatisticList.w, i);
+ if (l > 0 && flag2) {
+ // CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ entity.setOnFire(combustEvent.getDuration());
+ }
+ // CraftBukkit end
+ } else if (flag1) {
+ entity.extinguish();
}
- // CraftBukkit end
}
- }
- this.j(0.3F);
+ this.j(0.3F);
+ }
}
}
}
@@ -834,9 +864,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void die() {
super.die();
- this.defaultContainer.a(this);
+ this.defaultContainer.b(this);
if (this.activeContainer != null) {
- this.activeContainer.a(this);
+ this.activeContainer.b(this);
}
}
@@ -844,7 +874,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return !this.sleeping && super.inBlock();
}
- public boolean bS() {
+ public boolean bW() {
return false;
}
@@ -858,7 +888,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return EnumBedResult.NOT_POSSIBLE_HERE;
}
- if (this.world.t()) {
+ if (this.world.u()) {
return EnumBedResult.NOT_POSSIBLE_NOW;
}
@@ -914,7 +944,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f = 0.9F;
}
- this.u(i1);
+ this.x(i1);
this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
} else {
this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
@@ -922,7 +952,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.sleeping = true;
this.sleepTicks = 0;
- this.cc = new ChunkCoordinates(i, j, k);
+ this.bZ = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
@@ -931,32 +961,32 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return EnumBedResult.OK;
}
- private void u(int i) {
- this.cd = 0.0F;
- this.ce = 0.0F;
+ private void x(int i) {
+ this.ca = 0.0F;
+ this.cb = 0.0F;
switch (i) {
case 0:
- this.ce = -1.8F;
+ this.cb = -1.8F;
break;
case 1:
- this.cd = 1.8F;
+ this.ca = 1.8F;
break;
case 2:
- this.ce = 1.8F;
+ this.cb = 1.8F;
break;
case 3:
- this.cd = -1.8F;
+ this.ca = -1.8F;
}
}
public void a(boolean flag, boolean flag1, boolean flag2) {
this.a(0.6F, 1.8F);
this.e_();
- ChunkCoordinates chunkcoordinates = this.cc;
- ChunkCoordinates chunkcoordinates1 = this.cc;
+ ChunkCoordinates chunkcoordinates = this.bZ;
+ ChunkCoordinates chunkcoordinates1 = this.bZ;
if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false);
@@ -996,27 +1026,32 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (flag2) {
- this.setRespawnPosition(this.cc, false);
+ this.setRespawnPosition(this.bZ, false);
}
}
private boolean j() {
- return this.world.getTypeId(this.cc.x, this.cc.y, this.cc.z) == Block.BED.id;
+ return this.world.getTypeId(this.bZ.x, this.bZ.y, this.bZ.z) == Block.BED.id;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) {
- IChunkProvider ichunkprovider = world.H();
+ IChunkProvider ichunkprovider = world.I();
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z + 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z + 3 >> 4);
- if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) != Block.BED.id) {
- return flag && world.isEmpty(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) && world.isEmpty(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z) ? chunkcoordinates : null;
- } else {
+ if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
ChunkCoordinates chunkcoordinates1 = BlockBed.b(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
return chunkcoordinates1;
+ } else {
+ Material material = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
+ Material material1 = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z);
+ boolean flag1 = !material.isBuildable() && !material.isLiquid();
+ boolean flag2 = !material1.isBuildable() && !material1.isLiquid();
+
+ return flag && flag1 && flag2 ? chunkcoordinates : null;
}
}
@@ -1065,8 +1100,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(Statistic statistic, int i) {}
- protected void bf() {
- super.bf();
+ protected void bi() {
+ super.bi();
this.a(StatisticList.u, 1);
if (this.isSprinting()) {
this.j(0.8F);
@@ -1171,16 +1206,22 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
+ public void am() {
+ if (!this.abilities.isFlying) {
+ super.am();
+ }
+ }
+
public ItemStack q(int i) {
return this.inventory.f(i);
}
- protected void bB() {}
+ protected void bE() {}
- protected void bC() {}
+ protected void bF() {}
public void giveExp(int i) {
- this.bQ += i;
+ this.addScore(i);
int j = Integer.MAX_VALUE - this.expTotal;
if (i > j) {
@@ -1204,7 +1245,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (i > 0 && this.expLevel % 5 == 0 && (float) this.h < (float) this.ticksLived - 100.0F) {
float f = this.expLevel > 30 ? 1.0F : (float) this.expLevel / 30.0F;
- this.world.makeSound(this, "random.levelup", f * 0.75F, 1.0F);
+ this.makeSound("random.levelup", f * 0.75F, 1.0F);
this.h = this.ticksLived;
}
}
@@ -1229,7 +1270,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
}
- public boolean ca() {
+ public boolean ce() {
return this.getHealth() > 0 && this.getHealth() < this.getMaxHealth();
}
@@ -1249,13 +1290,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} else {
int l = this.world.getTypeId(i, j, k);
- if (l > 0 && this.bP() != null) {
+ if (l > 0) {
Block block = Block.byId[l];
- ItemStack itemstack = this.bP();
- if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
+ if (block.material.q()) {
return true;
}
+
+ if (this.bT() != null) {
+ ItemStack itemstack = this.bT();
+
+ if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
+ return true;
+ }
+ }
}
return false;
@@ -1292,14 +1340,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expLevel = entityhuman.expLevel;
this.expTotal = entityhuman.expTotal;
this.exp = entityhuman.exp;
- this.bQ = entityhuman.bQ;
+ this.setScore(entityhuman.getScore());
this.aq = entityhuman.aq;
} else if (this.world.getGameRules().getBoolean("keepInventory")) {
this.inventory.b(entityhuman.inventory);
this.expLevel = entityhuman.expLevel;
this.expTotal = entityhuman.expTotal;
this.exp = entityhuman.exp;
- this.bQ = entityhuman.bQ;
+ this.setScore(entityhuman.getScore());
}
this.enderChest = entityhuman.enderChest;
@@ -1333,7 +1381,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
}
- public ItemStack bA() {
+ public ItemStack bD() {
return this.inventory.getItemInHand();
}
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
index d0d2357d..5b6ab93d 100644
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
@@ -32,16 +32,16 @@ public class EntityIronGolem extends EntityGolem {
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
- protected void bj() {
+ protected void bm() {
if (--this.e <= 0) {
this.e = 70 + this.random.nextInt(50);
this.d = this.world.villages.getClosestVillage(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32);
if (this.d == null) {
- this.aK();
+ this.aL();
} else {
ChunkCoordinates chunkcoordinates = this.d.getCenter();
@@ -49,7 +49,7 @@ public class EntityIronGolem extends EntityGolem {
}
}
- super.bj();
+ super.bm();
}
public int getMaxHealth() {
@@ -60,12 +60,12 @@ public class EntityIronGolem extends EntityGolem {
return i;
}
- protected void n(Entity entity) {
- if (entity instanceof IMonster && this.aA().nextInt(20) == 0) {
+ protected void o(Entity entity) {
+ if (entity instanceof IMonster && this.aB().nextInt(20) == 0) {
this.b((EntityLiving) entity);
}
- super.n(entity);
+ super.o(entity);
}
public void c() {
@@ -85,7 +85,7 @@ public class EntityIronGolem extends EntityGolem {
int l = this.world.getTypeId(i, j, k);
if (l > 0) {
- this.world.addParticle("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D);
+ this.world.addParticle("tilecrack_" + l + "_" + this.world.getData(i, j, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D);
}
}
}
@@ -104,7 +104,7 @@ public class EntityIronGolem extends EntityGolem {
this.setPlayerCreated(nbttagcompound.getBoolean("PlayerCreated"));
}
- public boolean l(Entity entity) {
+ public boolean m(Entity entity) {
this.f = 10;
this.world.broadcastEntityEffect(this, (byte) 4);
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), 7 + this.random.nextInt(15));
@@ -113,7 +113,7 @@ public class EntityIronGolem extends EntityGolem {
entity.motY += 0.4000000059604645D;
}
- this.world.makeSound(this, "mob.irongolem.throw", 1.0F, 1.0F);
+ this.makeSound("mob.irongolem.throw", 1.0F, 1.0F);
return flag;
}
@@ -126,20 +126,20 @@ public class EntityIronGolem extends EntityGolem {
this.world.broadcastEntityEffect(this, (byte) 11);
}
- protected String aW() {
+ protected String aY() {
return "none";
}
- protected String aX() {
+ protected String aZ() {
return "mob.irongolem.hit";
}
- protected String aY() {
+ protected String ba() {
return "mob.irongolem.death";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.irongolem.walk", 1.0F, 1.0F);
+ this.makeSound("mob.irongolem.walk", 1.0F, 1.0F);
}
protected void dropDeathLoot(boolean flag, int i) {
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index cecd16d8..93f93863 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -59,7 +59,7 @@ public class EntityItem extends Entity {
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
- this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
+ this.Y = this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
this.move(this.motX, this.motY, this.motZ);
boolean flag = (int) this.lastX != (int) this.locX || (int) this.lastY != (int) this.locY || (int) this.lastZ != (int) this.locZ;
@@ -68,17 +68,11 @@ public class EntityItem extends Entity {
this.motY = 0.20000000298023224D;
this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
- this.world.makeSound(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
+ this.makeSound("random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
}
if (!this.world.isStatic) {
- Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
-
- while (iterator.hasNext()) {
- EntityItem entityitem = (EntityItem) iterator.next();
-
- this.a(entityitem);
- }
+ this.d();
}
}
@@ -112,32 +106,42 @@ public class EntityItem extends Entity {
}
}
+ private void d() {
+ Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
+
+ while (iterator.hasNext()) {
+ EntityItem entityitem = (EntityItem) iterator.next();
+
+ this.a(entityitem);
+ }
+ }
+
public boolean a(EntityItem entityitem) {
if (entityitem == this) {
return false;
} else if (entityitem.isAlive() && this.isAlive()) {
if (entityitem.itemStack.getItem() != this.itemStack.getItem()) {
return false;
- } else if (!entityitem.itemStack.hasTag() && !this.itemStack.hasTag()) {
- if (entityitem.itemStack.getItem().l() && entityitem.itemStack.getData() != this.itemStack.getData()) {
- return false;
- } else if (entityitem.itemStack.count < this.itemStack.count) {
- return entityitem.a(this);
- } else if (entityitem.itemStack.count + this.itemStack.count > entityitem.itemStack.getMaxStackSize()) {
- return false;
- // CraftBukkit start - don't merge items with enchantments
- } else if (entityitem.itemStack.hasEnchantments() || this.itemStack.hasEnchantments()) {
- return false;
- // CraftBukkit end
- } else {
- entityitem.itemStack.count += this.itemStack.count;
- entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
- entityitem.age = Math.min(entityitem.age, this.age);
- this.die();
- return true;
- }
- } else {
+ } else if (entityitem.itemStack.hasTag() ^ this.itemStack.hasTag()) {
+ return false;
+ } else if (entityitem.itemStack.hasTag() && !entityitem.itemStack.getTag().equals(this.itemStack.getTag())) {
+ return false;
+ } else if (entityitem.itemStack.getItem().l() && entityitem.itemStack.getData() != this.itemStack.getData()) {
+ return false;
+ } else if (entityitem.itemStack.count < this.itemStack.count) {
+ return entityitem.a(this);
+ } else if (entityitem.itemStack.count + this.itemStack.count > entityitem.itemStack.getMaxStackSize()) {
return false;
+ // CraftBukkit start - don't merge items with enchantments
+ } else if (entityitem.itemStack.hasEnchantments() || this.itemStack.hasEnchantments()) {
+ return false;
+ // CraftBukkit end
+ } else {
+ entityitem.itemStack.count += this.itemStack.count;
+ entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
+ entityitem.age = Math.min(entityitem.age, this.age);
+ this.die();
+ return true;
}
} else {
return false;
@@ -157,13 +161,17 @@ public class EntityItem extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.K();
- this.e -= i;
- if (this.e <= 0) {
- this.die();
- }
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ this.K();
+ this.e -= i;
+ if (this.e <= 0) {
+ this.die();
+ }
- return false;
+ return false;
+ }
}
public void b(NBTTagCompound nbttagcompound) {
@@ -185,7 +193,7 @@ public class EntityItem extends Entity {
}
}
- public void b_(EntityHuman entityhuman) {
+ public void c_(EntityHuman entityhuman) {
if ((!this.world.isStatic) && (this.itemStack != null)) { // CraftBukkit - nullcheck
int i = this.itemStack.count;
@@ -225,7 +233,7 @@ public class EntityItem extends Entity {
entityhuman.a((Statistic) AchievementList.z);
}
- this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ this.makeSound("random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, i);
if (this.itemStack.count <= 0) {
this.die();
@@ -242,4 +250,11 @@ public class EntityItem extends Entity {
public boolean aq() {
return false;
}
+
+ public void b(int i) {
+ super.b(i);
+ if (!this.world.isStatic) {
+ this.d();
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
index e386fbe6..a8d10050 100644
--- a/src/main/java/net/minecraft/server/EntityLightning.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
import org.bukkit.event.block.BlockIgniteEvent; // CraftBukkit
@@ -35,7 +34,7 @@ public class EntityLightning extends EntityWeather {
this.c = this.random.nextInt(3) + 1;
// CraftBukkit
- if (!isEffect && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
+ if (!isEffect && !world.isStatic && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
int i = MathHelper.floor(d0);
int j = MathHelper.floor(d1);
int k = MathHelper.floor(d2);
@@ -86,7 +85,7 @@ public class EntityLightning extends EntityWeather {
this.lifeTicks = 1;
this.a = this.random.nextLong();
// CraftBukkit
- if (!this.isEffect && this.world.areChunksLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) {
+ if (!this.isEffect && !this.world.isStatic && this.world.areChunksLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
@@ -105,15 +104,12 @@ public class EntityLightning extends EntityWeather {
}
}
- if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit
+ if (!this.world.isStatic && this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit
double d0 = 3.0D;
- // CraftBukkit start - switch to array copy of list to avoid CMEs
- Object[] array = this.world.getEntities(this, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0)).toArray();
- Iterator iterator = com.google.common.collect.Iterators.forArray(array);
- // CraftBukkit end
+ List list = this.world.getEntities(this, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
+ for (int l = 0; l < list.size(); ++l) {
+ Entity entity = (Entity) list.get(l);
entity.a(this);
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index d6a4c169..362e3b39 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -66,7 +66,6 @@ public abstract class EntityLiving extends Entity {
private int f = 0;
private EntityLiving g = null;
public int bk = 0;
- public int bl = 0;
public HashMap effects = new HashMap(); // CraftBukkit - protected -> public
public boolean updateEffects = true; // CraftBukkit - private -> public
private int i;
@@ -77,37 +76,36 @@ public abstract class EntityLiving extends Entity {
private Navigation navigation;
protected final PathfinderGoalSelector goalSelector;
protected final PathfinderGoalSelector targetSelector;
- private EntityLiving bO;
- private EntitySenses bP;
- private float bQ;
- private ChunkCoordinates bR = new ChunkCoordinates(0, 0, 0);
- private float bS = -1.0F;
+ private EntityLiving bM;
+ private EntitySenses bN;
+ private float bO;
+ private ChunkCoordinates bP = new ChunkCoordinates(0, 0, 0);
+ private float bQ = -1.0F;
private ItemStack[] equipment = new ItemStack[5];
protected float[] dropChances = new float[5];
- private ItemStack[] bU = new ItemStack[5];
- public boolean bq = false;
- public int br = 0;
+ private ItemStack[] bS = new ItemStack[5];
+ public boolean bp = false;
+ public int bq = 0;
protected boolean canPickUpLoot = false;
private boolean persistent = false;
- protected boolean invulnerable = false;
- protected int bu;
+ protected int bs;
+ protected double bt;
+ protected double bu;
protected double bv;
protected double bw;
protected double bx;
- protected double by;
- protected double bz;
- float bA = 0.0F;
+ float by = 0.0F;
public int lastDamage = 0; // CraftBukkit - protected -> public
- protected int bC = 0;
+ protected int bA = 0;
+ protected float bB;
+ protected float bC;
protected float bD;
- protected float bE;
- protected float bF;
- protected boolean bG = false;
- protected float bH = 0.0F;
- protected float bI = 0.7F;
- private int bW = 0;
- private Entity bX;
- protected int bJ = 0;
+ protected boolean bE = false;
+ protected float bF = 0.0F;
+ protected float bG = 0.7F;
+ private int bU = 0;
+ private Entity bV;
+ protected int bH = 0;
public int expToDrop = 0; // CraftBukkit
public int maxAirTicks = 300; // CraftBukkit
@@ -121,7 +119,7 @@ public abstract class EntityLiving extends Entity {
this.jumpController = new ControllerJump(this);
this.senses = new EntityAIBodyControl(this);
this.navigation = new Navigation(this, world, 16.0F);
- this.bP = new EntitySenses(this);
+ this.bN = new EntitySenses(this);
this.av = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
this.au = (float) Math.random() * 12398.0F;
@@ -151,73 +149,81 @@ public abstract class EntityLiving extends Entity {
return this.navigation;
}
- public EntitySenses az() {
- return this.bP;
+ public EntitySenses aA() {
+ return this.bN;
}
- public Random aA() {
+ public Random aB() {
return this.random;
}
- public EntityLiving aB() {
+ public EntityLiving aC() {
return this.lastDamager;
}
- public EntityLiving aC() {
+ public EntityLiving aD() {
return this.g;
}
- public void k(Entity entity) {
+ public void l(Entity entity) {
if (entity instanceof EntityLiving) {
this.g = (EntityLiving) entity;
}
}
- public int aD() {
- return this.bC;
+ public int aE() {
+ return this.bA;
}
public float ap() {
return this.ay;
}
- public float aE() {
- return this.bQ;
+ public float aF() {
+ return this.bO;
}
public void e(float f) {
- this.bQ = f;
+ this.bO = f;
this.f(f);
}
- public boolean l(Entity entity) {
- this.k(entity);
+ public boolean m(Entity entity) {
+ this.l(entity);
return false;
}
- public EntityLiving aF() {
- return this.bO;
+ public EntityLiving aG() {
+ return this.bM;
}
public void b(EntityLiving entityliving) {
- this.bO = entityliving;
+ this.bM = entityliving;
}
public boolean a(Class oclass) {
return EntityCreeper.class != oclass && EntityGhast.class != oclass;
}
- public void aG() {}
+ public void aH() {}
protected void a(double d0, boolean flag) {
+ if (!this.H()) {
+ this.I();
+ }
+
if (flag && this.fallDistance > 0.0F) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
int k = MathHelper.floor(this.locZ);
int l = this.world.getTypeId(i, j, k);
- if (l == 0 && this.world.getTypeId(i, j - 1, k) == Block.FENCE.id) {
- l = this.world.getTypeId(i, j - 1, k);
+ if (l == 0) {
+ int i1 = this.world.e(i, j - 1, k);
+
+ if (i1 == 11 || i1 == 32 || i1 == 21) {
+ l = this.world.getTypeId(i, j - 1, k);
+ }
}
if (l > 0) {
@@ -228,33 +234,33 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag);
}
- public boolean aH() {
+ public boolean aI() {
return this.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
public boolean e(int i, int j, int k) {
- return this.bS == -1.0F ? true : this.bR.e(i, j, k) < this.bS * this.bS;
+ return this.bQ == -1.0F ? true : this.bP.e(i, j, k) < this.bQ * this.bQ;
}
public void b(int i, int j, int k, int l) {
- this.bR.b(i, j, k);
- this.bS = (float) l;
+ this.bP.b(i, j, k);
+ this.bQ = (float) l;
}
- public ChunkCoordinates aI() {
- return this.bR;
+ public ChunkCoordinates aJ() {
+ return this.bP;
}
- public float aJ() {
- return this.bS;
+ public float aK() {
+ return this.bQ;
}
- public void aK() {
- this.bS = -1.0F;
+ public void aL() {
+ this.bQ = -1.0F;
}
- public boolean aL() {
- return this.bS != -1.0F;
+ public boolean aM() {
+ return this.bQ != -1.0F;
}
public void c(EntityLiving entityliving) {
@@ -265,9 +271,10 @@ public abstract class EntityLiving extends Entity {
protected void a() {
this.datawatcher.a(8, Integer.valueOf(this.i));
this.datawatcher.a(9, Byte.valueOf((byte) 0));
+ this.datawatcher.a(10, Byte.valueOf((byte) 0));
}
- public boolean m(Entity entity) {
+ public boolean n(Entity entity) {
return this.world.a(this.world.getVec3DPool().create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), this.world.getVec3DPool().create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
}
@@ -283,15 +290,15 @@ public abstract class EntityLiving extends Entity {
return this.length * 0.85F;
}
- public int aM() {
+ public int aN() {
return 80;
}
- public void aN() {
- String s = this.aW();
+ public void aO() {
+ String s = this.aY();
if (s != null) {
- this.world.makeSound(this, s, this.aV(), this.h());
+ this.makeSound(s, this.aX(), this.aV());
}
}
@@ -300,8 +307,8 @@ public abstract class EntityLiving extends Entity {
super.y();
this.world.methodProfiler.a("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.aT++) {
- this.aT = -this.aM();
- this.aN();
+ this.aT = -this.aN();
+ this.aO();
}
// CraftBukkit start
@@ -320,7 +327,7 @@ public abstract class EntityLiving extends Entity {
this.extinguish();
}
- if (this.isAlive() && this.a(Material.WATER) && !this.ba() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) {
+ if (this.isAlive() && this.a(Material.WATER) && !this.bc() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) {
this.setAirTicks(this.g(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
@@ -367,7 +374,7 @@ public abstract class EntityLiving extends Entity {
}
if (this.health <= 0) {
- this.aO();
+ this.aP();
}
if (this.lastDamageByPlayerTime > 0) {
@@ -390,7 +397,7 @@ public abstract class EntityLiving extends Entity {
}
}
- this.bu();
+ this.bx();
this.aD = this.aC;
this.ax = this.aw;
this.az = this.ay;
@@ -411,19 +418,20 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
- protected void aO() {
+ protected void aP() {
++this.deathTicks;
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
int i;
// CraftBukkit start - update getExpReward() above if the removed if() changes!
- i = expToDrop;
+ i = this.expToDrop;
while (i > 0) {
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
}
+ this.expToDrop = 0;
// CraftBukkit end
this.die();
@@ -452,7 +460,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
- public void aQ() {
+ public void aR() {
for (int i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
@@ -473,24 +481,27 @@ public abstract class EntityLiving extends Entity {
public void j_() {
super.j_();
if (!this.world.isStatic) {
- for (int i = 0; i < 5; ++i) {
+ int i;
+
+ for (i = 0; i < 5; ++i) {
ItemStack itemstack = this.getEquipment(i);
- if (!ItemStack.matches(itemstack, this.bU[i])) {
- ((WorldServer) this.world).getTracker().a(this, new Packet5EntityEquipment(this.id, i, itemstack));
- this.bU[i] = itemstack == null ? null : itemstack.cloneItemStack();
+ if (!ItemStack.matches(itemstack, this.bS[i])) {
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, i, itemstack)));
+ this.bS[i] = itemstack == null ? null : itemstack.cloneItemStack();
}
}
- }
- if (this.bk > 0) {
- if (this.bl <= 0) {
- this.bl = 60;
- }
+ i = this.bJ();
+ if (i > 0) {
+ if (this.bk <= 0) {
+ this.bk = 20 * (30 - i);
+ }
- --this.bl;
- if (this.bl <= 0) {
--this.bk;
+ if (this.bk <= 0) {
+ this.r(i - 1);
+ }
}
}
@@ -521,7 +532,7 @@ public abstract class EntityLiving extends Entity {
this.aB += (f3 - this.aB) * 0.3F;
this.world.methodProfiler.a("headTurn");
- if (this.bb()) {
+ if (this.be()) {
this.senses.a();
} else {
float f4 = MathHelper.g(f1 - this.aw);
@@ -624,10 +635,12 @@ public abstract class EntityLiving extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (this.world.isStatic) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else if (this.world.isStatic) {
return false;
} else {
- this.bC = 0;
+ this.bA = 0;
if (this.health <= 0) {
return false;
} else if (damagesource.k() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
@@ -711,12 +724,12 @@ public abstract class EntityLiving extends Entity {
if (this.health <= 0) {
if (flag) {
- this.world.makeSound(this, this.aY(), this.aV(), this.h());
+ this.makeSound(this.ba(), this.aX(), this.aV());
}
this.die(damagesource);
} else if (flag) {
- this.world.makeSound(this, this.aX(), this.aV(), this.h());
+ this.makeSound(this.aZ(), this.aX(), this.aV());
}
return true;
@@ -724,11 +737,11 @@ public abstract class EntityLiving extends Entity {
}
}
- private float h() {
+ protected float aV() {
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
- public int aU() {
+ public int aW() {
int i = 0;
ItemStack[] aitemstack = this.getEquipment();
int j = aitemstack.length;
@@ -750,7 +763,7 @@ public abstract class EntityLiving extends Entity {
protected int b(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor()) {
- int j = 25 - this.aU();
+ int j = 25 - this.aW();
int k = i * j + this.aS;
this.k(i);
@@ -775,26 +788,26 @@ public abstract class EntityLiving extends Entity {
}
protected void d(DamageSource damagesource, int i) {
- if (!this.invulnerable) {
+ if (!this.isInvulnerable()) {
i = this.b(damagesource, i);
i = this.c(damagesource, i);
this.health -= i;
}
}
- protected float aV() {
+ protected float aX() {
return 1.0F;
}
- protected String aW() {
+ protected String aY() {
return null;
}
- protected String aX() {
+ protected String aZ() {
return "damage.hit";
}
- protected String aY() {
+ protected String ba() {
return "damage.hit";
}
@@ -907,9 +920,9 @@ public abstract class EntityLiving extends Entity {
i = event.getDamage();
if (i > 4) {
- this.world.makeSound(this, "damage.fallbig", 1.0F, 1.0F);
+ this.makeSound("damage.fallbig", 1.0F, 1.0F);
} else {
- this.world.makeSound(this, "damage.fallsmall", 1.0F, 1.0F);
+ this.makeSound("damage.fallsmall", 1.0F, 1.0F);
}
this.getBukkitEntity().setLastDamageCause(event);
@@ -922,7 +935,7 @@ public abstract class EntityLiving extends Entity {
if (j > 0) {
StepSound stepsound = Block.byId[j].stepSound;
- this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F);
+ this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F);
}
}
}
@@ -932,7 +945,7 @@ public abstract class EntityLiving extends Entity {
if (this.H() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
- this.a(f, f1, this.bb() ? 0.04F : 0.02F);
+ this.a(f, f1, this.be() ? 0.04F : 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
@@ -968,8 +981,8 @@ public abstract class EntityLiving extends Entity {
float f4;
if (this.onGround) {
- if (this.bb()) {
- f4 = this.aE();
+ if (this.be()) {
+ f4 = this.aF();
} else {
f4 = this.aM;
}
@@ -1026,7 +1039,16 @@ public abstract class EntityLiving extends Entity {
this.motY = 0.2D;
}
- this.motY -= 0.08D;
+ if (this.world.isStatic && (!this.world.isLoaded((int) this.locX, 0, (int) this.locZ) || !this.world.getChunkAtWorldCoords((int) this.locX, (int) this.locZ).d)) {
+ if (this.locY > 0.0D) {
+ this.motY = -0.1D;
+ } else {
+ this.motY = 0.0D;
+ }
+ } else {
+ this.motY -= 0.08D;
+ }
+
this.motY *= 0.9800000190734863D;
this.motX *= (double) f2;
this.motZ *= (double) f2;
@@ -1055,11 +1077,9 @@ public abstract class EntityLiving extends Entity {
}
public void b(NBTTagCompound nbttagcompound) {
- // CraftBukkit start
if (this.health < -32768) {
this.health = -32768;
}
- // CraftBukkit end
nbttagcompound.setShort("Health", (short) this.health);
nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
@@ -1067,7 +1087,6 @@ public abstract class EntityLiving extends Entity {
nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
nbttagcompound.setBoolean("CanPickUpLoot", this.canPickUpLoot);
nbttagcompound.setBoolean("PersistenceRequired", this.persistent);
- nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.equipment.length; ++i) {
@@ -1116,7 +1135,6 @@ public abstract class EntityLiving extends Entity {
this.attackTicks = nbttagcompound.getShort("AttackTime");
this.canPickUpLoot = nbttagcompound.getBoolean("CanPickUpLoot");
this.persistent = nbttagcompound.getBoolean("PersistenceRequired");
- this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
NBTTagList nbttaglist;
int i;
@@ -1152,32 +1170,32 @@ public abstract class EntityLiving extends Entity {
return !this.dead && this.health > 0;
}
- public boolean ba() {
+ public boolean bc() {
return false;
}
public void f(float f) {
- this.bE = f;
+ this.bC = f;
}
public void e(boolean flag) {
- this.bG = flag;
+ this.bE = flag;
}
public void c() {
- if (this.bW > 0) {
- --this.bW;
+ if (this.bU > 0) {
+ --this.bU;
}
- if (this.bu > 0) {
- double d0 = this.locX + (this.bv - this.locX) / (double) this.bu;
- double d1 = this.locY + (this.bw - this.locY) / (double) this.bu;
- double d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu;
- double d3 = MathHelper.g(this.by - (double) this.yaw);
+ if (this.bs > 0) {
+ double d0 = this.locX + (this.bt - this.locX) / (double) this.bs;
+ double d1 = this.locY + (this.bu - this.locY) / (double) this.bs;
+ double d2 = this.locZ + (this.bv - this.locZ) / (double) this.bs;
+ double d3 = MathHelper.g(this.bw - (double) this.yaw);
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.bu);
- this.pitch = (float) ((double) this.pitch + (this.bz - (double) this.pitch) / (double) this.bu);
- --this.bu;
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.bs);
+ this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bs);
+ --this.bs;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
}
@@ -1195,19 +1213,19 @@ public abstract class EntityLiving extends Entity {
}
this.world.methodProfiler.a("ai");
- if (this.bd()) {
- this.bG = false;
+ if (this.bg()) {
+ this.bE = false;
+ this.bB = 0.0F;
+ this.bC = 0.0F;
this.bD = 0.0F;
- this.bE = 0.0F;
- this.bF = 0.0F;
- } else if (this.bc()) {
- if (this.bb()) {
+ } else if (this.bf()) {
+ if (this.be()) {
this.world.methodProfiler.a("newAi");
- this.bi();
+ this.bl();
this.world.methodProfiler.b();
} else {
this.world.methodProfiler.a("oldAi");
- this.bk();
+ this.bn();
this.world.methodProfiler.b();
this.ay = this.yaw;
}
@@ -1215,54 +1233,40 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
- if (this.bG) {
+ if (this.bE) {
if (!this.H() && !this.J()) {
- if (this.onGround && this.bW == 0) {
- this.bf();
- this.bW = 10;
+ if (this.onGround && this.bU == 0) {
+ this.bi();
+ this.bU = 10;
}
} else {
this.motY += 0.03999999910593033D;
}
} else {
- this.bW = 0;
+ this.bU = 0;
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("travel");
- this.bD *= 0.98F;
- this.bE *= 0.98F;
- this.bF *= 0.9F;
+ this.bB *= 0.98F;
+ this.bC *= 0.98F;
+ this.bD *= 0.9F;
float f = this.aM;
- this.aM *= this.by();
- this.e(this.bD, this.bE);
+ this.aM *= this.bB();
+ this.e(this.bB, this.bC);
this.aM = f;
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
- List list;
- Iterator iterator;
-
if (!this.world.isStatic) {
- list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- if (list != null && !list.isEmpty()) {
- iterator = list.iterator();
-
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
-
- if (entity.M()) {
- this.n(entity);
- }
- }
- }
+ this.bd();
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("looting");
- if (!this.world.isStatic && this.canPickUpLoot && this.world.getGameRules().getBoolean("mobGriefing")) {
- list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
- iterator = list.iterator();
+ if (!this.world.isStatic && this.canPickUpLoot && !this.bb && this.world.getGameRules().getBoolean("mobGriefing")) {
+ List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
+ Iterator iterator = list.iterator();
while (iterator.hasNext()) {
EntityItem entityitem = (EntityItem) iterator.next();
@@ -1326,27 +1330,41 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
}
- protected void n(Entity entity) {
+ protected void bd() {
+ List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ if (list != null && !list.isEmpty()) {
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity = (Entity) list.get(i);
+
+ if (entity.M()) {
+ this.o(entity);
+ }
+ }
+ }
+ }
+
+ protected void o(Entity entity) {
entity.collide(this);
}
- protected boolean bb() {
+ protected boolean be() {
return false;
}
- protected boolean bc() {
+ protected boolean bf() {
return !this.world.isStatic;
}
- protected boolean bd() {
+ protected boolean bg() {
return this.health <= 0;
}
- public boolean be() {
+ public boolean bh() {
return false;
}
- protected void bf() {
+ protected void bi() {
this.motY = 0.41999998688697815D;
if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
@@ -1362,11 +1380,11 @@ public abstract class EntityLiving extends Entity {
this.am = true;
}
- protected boolean bg() {
+ protected boolean bj() {
return true;
}
- protected void bh() {
+ protected void bk() {
if (!this.persistent) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
@@ -1376,26 +1394,26 @@ public abstract class EntityLiving extends Entity {
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (this.bg() && d3 > 16384.0D) {
+ if (this.bj() && d3 > 16384.0D) {
this.die();
}
- if (this.bC > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.bg()) {
+ if (this.bA > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.bj()) {
this.die();
} else if (d3 < 1024.0D) {
- this.bC = 0;
+ this.bA = 0;
}
}
}
}
- protected void bi() {
- ++this.bC;
+ protected void bl() {
+ ++this.bA;
this.world.methodProfiler.a("checkDespawn");
- this.bh();
+ this.bk();
this.world.methodProfiler.b();
this.world.methodProfiler.a("sensing");
- this.bP.a();
+ this.bN.a();
this.world.methodProfiler.b();
this.world.methodProfiler.a("targetSelector");
this.targetSelector.a();
@@ -1407,7 +1425,7 @@ public abstract class EntityLiving extends Entity {
this.navigation.e();
this.world.methodProfiler.b();
this.world.methodProfiler.a("mob tick");
- this.bj();
+ this.bm();
this.world.methodProfiler.b();
this.world.methodProfiler.a("controls");
this.world.methodProfiler.a("move");
@@ -1420,65 +1438,65 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
}
- protected void bj() {}
+ protected void bm() {}
- protected void bk() {
- ++this.bC;
- this.bh();
- this.bD = 0.0F;
- this.bE = 0.0F;
+ protected void bn() {
+ ++this.bA;
+ this.bk();
+ this.bB = 0.0F;
+ this.bC = 0.0F;
float f = 8.0F;
if (this.random.nextFloat() < 0.02F) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, (double) f);
if (entityhuman != null) {
- this.bX = entityhuman;
- this.bJ = 10 + this.random.nextInt(20);
+ this.bV = entityhuman;
+ this.bH = 10 + this.random.nextInt(20);
} else {
- this.bF = (this.random.nextFloat() - 0.5F) * 20.0F;
+ this.bD = (this.random.nextFloat() - 0.5F) * 20.0F;
}
}
- if (this.bX != null) {
- this.a(this.bX, 10.0F, (float) this.bm());
- if (this.bJ-- <= 0 || this.bX.dead || this.bX.e((Entity) this) > (double) (f * f)) {
- this.bX = null;
+ if (this.bV != null) {
+ this.a(this.bV, 10.0F, (float) this.bp());
+ if (this.bH-- <= 0 || this.bV.dead || this.bV.e((Entity) this) > (double) (f * f)) {
+ this.bV = null;
}
} else {
if (this.random.nextFloat() < 0.05F) {
- this.bF = (this.random.nextFloat() - 0.5F) * 20.0F;
+ this.bD = (this.random.nextFloat() - 0.5F) * 20.0F;
}
- this.yaw += this.bF;
- this.pitch = this.bH;
+ this.yaw += this.bD;
+ this.pitch = this.bF;
}
boolean flag = this.H();
boolean flag1 = this.J();
if (flag || flag1) {
- this.bG = this.random.nextFloat() < 0.8F;
+ this.bE = this.random.nextFloat() < 0.8F;
}
}
- protected void bl() {
- int i = this.i();
+ protected void bo() {
+ int i = this.h();
- if (this.bq) {
- ++this.br;
- if (this.br >= i) {
- this.br = 0;
- this.bq = false;
+ if (this.bp) {
+ ++this.bq;
+ if (this.bq >= i) {
+ this.bq = 0;
+ this.bp = false;
}
} else {
- this.br = 0;
+ this.bq = 0;
}
- this.aP = (float) this.br / (float) i;
+ this.aP = (float) this.bq / (float) i;
}
- public int bm() {
+ public int bp() {
return 40;
}
@@ -1563,7 +1581,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public int bs() {
+ public int bv() {
return 4;
}
@@ -1571,16 +1589,20 @@ public abstract class EntityLiving extends Entity {
return false;
}
- protected void bu() {
+ protected void bx() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
Integer integer = (Integer) iterator.next();
MobEffect mobeffect = (MobEffect) this.effects.get(integer);
- if (!mobeffect.tick(this) && !this.world.isStatic) {
- iterator.remove();
- this.c(mobeffect);
+ if (!mobeffect.tick(this)) {
+ if (!this.world.isStatic) {
+ iterator.remove();
+ this.c(mobeffect);
+ }
+ } else if (mobeffect.getDuration() % 600 == 0) {
+ this.b(mobeffect);
}
}
@@ -1629,7 +1651,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public void bv() {
+ public void by() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@@ -1683,7 +1705,7 @@ public abstract class EntityLiving extends Entity {
return true;
}
- public boolean bx() {
+ public boolean bA() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -1707,7 +1729,7 @@ public abstract class EntityLiving extends Entity {
this.updateEffects = true;
}
- public float by() {
+ public float bB() {
float f = 1.0F;
if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
@@ -1734,7 +1756,7 @@ public abstract class EntityLiving extends Entity {
}
public void a(ItemStack itemstack) {
- this.world.makeSound(this, "random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F);
+ this.makeSound("random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F);
for (int i = 0; i < 5; ++i) {
Vec3D vec3d = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
@@ -1751,7 +1773,7 @@ public abstract class EntityLiving extends Entity {
}
public int as() {
- if (this.aF() == null) {
+ if (this.aG() == null) {
return 3;
} else {
int i = (int) ((float) this.health - (float) this.getMaxHealth() * 0.33F);
@@ -1765,7 +1787,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public ItemStack bA() {
+ public ItemStack bD() {
return this.equipment[0];
}
@@ -1811,7 +1833,7 @@ public abstract class EntityLiving extends Entity {
}
}
- protected void bB() {
+ protected void bE() {
if (this.random.nextFloat() < d[this.world.difficulty]) {
int i = this.random.nextInt(2);
float f = this.world.difficulty == 3 ? 0.1F : 0.25F;
@@ -1851,15 +1873,15 @@ public abstract class EntityLiving extends Entity {
EntityTracker entitytracker = ((WorldServer) this.world).getTracker();
if (entity instanceof EntityItem) {
- entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
+ entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
}
if (entity instanceof EntityArrow) {
- entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
+ entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
}
if (entity instanceof EntityExperienceOrb) {
- entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
+ entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
}
}
}
@@ -1947,9 +1969,9 @@ public abstract class EntityLiving extends Entity {
}
}
- protected void bC() {
- if (this.bA() != null && this.random.nextFloat() < b[this.world.difficulty]) {
- EnchantmentManager.a(this.random, this.bA(), 5);
+ protected void bF() {
+ if (this.bD() != null && this.random.nextFloat() < b[this.world.difficulty]) {
+ EnchantmentManager.a(this.random, this.bD(), 5);
}
for (int i = 0; i < 4; ++i) {
@@ -1961,23 +1983,31 @@ public abstract class EntityLiving extends Entity {
}
}
- public void bD() {}
+ public void bG() {}
- private int i() {
+ private int h() {
return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6);
}
- public void bE() {
- if (!this.bq || this.br >= this.i() / 2 || this.br < 0) {
- this.br = -1;
- this.bq = true;
+ public void bH() {
+ if (!this.bp || this.bq >= this.h() / 2 || this.bq < 0) {
+ this.bq = -1;
+ this.bp = true;
if (this.world instanceof WorldServer) {
- ((WorldServer) this.world).getTracker().a(this, new Packet18ArmAnimation(this, 1));
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet18ArmAnimation(this, 1)));
}
}
}
- public boolean bF() {
+ public boolean bI() {
return false;
}
+
+ public final int bJ() {
+ return this.datawatcher.getByte(10);
+ }
+
+ public final void r(int i) {
+ this.datawatcher.watch(10, Byte.valueOf((byte) i));
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java
index 5229383e..cacde68a 100644
--- a/src/main/java/net/minecraft/server/EntityMagmaCube.java
+++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java
@@ -13,7 +13,7 @@ public class EntityMagmaCube extends EntitySlime {
return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- public int aU() {
+ public int aW() {
return this.getSize() * 3;
}
@@ -66,7 +66,7 @@ public class EntityMagmaCube extends EntitySlime {
this.b *= 0.9F;
}
- protected void bf() {
+ protected void bi() {
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
this.am = true;
}
@@ -81,11 +81,11 @@ public class EntityMagmaCube extends EntitySlime {
return super.m() + 2;
}
- protected String aX() {
+ protected String aZ() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String aY() {
+ protected String ba() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java
index 044c91a4..54c3584a 100644
--- a/src/main/java/net/minecraft/server/EntityMinecart.java
+++ b/src/main/java/net/minecraft/server/EntityMinecart.java
@@ -95,7 +95,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
public AxisAlignedBB g(Entity entity) {
- return entity.boundingBox;
+ return entity.M() ? entity.boundingBox : null;
}
public AxisAlignedBB E() {
@@ -125,86 +125,90 @@ public class EntityMinecart extends Entity implements IInventory {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (!this.world.isStatic && !this.dead) {
- // CraftBukkit start
- Vehicle vehicle = (Vehicle) this.getBukkitEntity();
- org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
-
- VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
- this.world.getServer().getPluginManager().callEvent(event);
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ if (!this.world.isStatic && !this.dead) {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
- if (event.isCancelled()) {
- return true;
- }
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
+ this.world.getServer().getPluginManager().callEvent(event);
- i = event.getDamage();
- // CraftBukkit end
+ if (event.isCancelled()) {
+ return true;
+ }
- this.i(-this.k());
- this.h(10);
- this.K();
- this.setDamage(this.getDamage() + i * 10);
- if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
- this.setDamage(100);
- }
+ i = event.getDamage();
+ // CraftBukkit end
- if (this.getDamage() > 40) {
- if (this.passenger != null) {
- this.passenger.mount(this);
+ this.i(-this.k());
+ this.h(10);
+ this.K();
+ this.setDamage(this.getDamage() + i * 10);
+ if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
+ this.setDamage(100);
}
- // CraftBukkit start
- VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
- this.world.getServer().getPluginManager().callEvent(destroyEvent);
+ if (this.getDamage() > 40) {
+ if (this.passenger != null) {
+ this.passenger.mount(this);
+ }
- if (destroyEvent.isCancelled()) {
- this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
- return true;
- }
- // CraftBukkit end
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
- this.die();
- this.a(Item.MINECART.id, 1, 0.0F);
- if (this.type == 1) {
- EntityMinecart entityminecart = this;
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
- for (int j = 0; j < entityminecart.getSize(); ++j) {
- ItemStack itemstack = entityminecart.getItem(j);
+ this.die();
+ this.a(Item.MINECART.id, 1, 0.0F);
+ if (this.type == 1) {
+ EntityMinecart entityminecart = this;
- if (itemstack != null) {
- float f = this.random.nextFloat() * 0.8F + 0.1F;
- float f1 = this.random.nextFloat() * 0.8F + 0.1F;
- float f2 = this.random.nextFloat() * 0.8F + 0.1F;
+ for (int j = 0; j < entityminecart.getSize(); ++j) {
+ ItemStack itemstack = entityminecart.getItem(j);
- while (itemstack.count > 0) {
- int k = this.random.nextInt(21) + 10;
+ if (itemstack != null) {
+ float f = this.random.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.random.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.random.nextFloat() * 0.8F + 0.1F;
- if (k > itemstack.count) {
- k = itemstack.count;
- }
+ while (itemstack.count > 0) {
+ int k = this.random.nextInt(21) + 10;
- itemstack.count -= k;
- // CraftBukkit - include enchantments in the new itemstack
- EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, k, itemstack.getData(), itemstack.getEnchantments()));
- float f3 = 0.05F;
+ if (k > itemstack.count) {
+ k = itemstack.count;
+ }
- entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
- entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
- entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
- this.world.addEntity(entityitem);
+ itemstack.count -= k;
+ // CraftBukkit - include enchantments in the new itemstack
+ EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, k, itemstack.getData(), itemstack.getEnchantments()));
+ float f3 = 0.05F;
+
+ entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
+ entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
+ entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
+ this.world.addEntity(entityitem);
+ }
}
}
- }
- this.a(Block.CHEST.id, 1, 0.0F);
- } else if (this.type == 2) {
- this.a(Block.FURNACE.id, 1, 0.0F);
+ this.a(Block.CHEST.id, 1, 0.0F);
+ } else if (this.type == 2) {
+ this.a(Block.FURNACE.id, 1, 0.0F);
+ }
}
- }
- return true;
- } else {
- return true;
+ return true;
+ } else {
+ return true;
+ }
}
}
@@ -322,6 +326,7 @@ public class EntityMinecart extends Entity implements IInventory {
int l = this.world.getTypeId(i, j, k);
if (BlockMinecartTrack.d(l)) {
+ this.fallDistance = 0.0F;
Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
int i1 = this.world.getData(i, j, k);
@@ -536,15 +541,15 @@ public class EntityMinecart extends Entity implements IInventory {
this.motX += this.motX / d21 * d22;
this.motZ += this.motZ / d21 * d22;
} else if (i1 == 1) {
- if (this.world.s(i - 1, j, k)) {
+ if (this.world.t(i - 1, j, k)) {
this.motX = 0.02D;
- } else if (this.world.s(i + 1, j, k)) {
+ } else if (this.world.t(i + 1, j, k)) {
this.motX = -0.02D;
}
} else if (i1 == 0) {
- if (this.world.s(i, j, k - 1)) {
+ if (this.world.t(i, j, k - 1)) {
this.motZ = 0.02D;
- } else if (this.world.s(i, j, k + 1)) {
+ } else if (this.world.t(i, j, k + 1)) {
this.motZ = -0.02D;
}
}
@@ -904,7 +909,7 @@ public class EntityMinecart extends Entity implements IInventory {
public void update() {}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (this.type == 0) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
@@ -935,7 +940,7 @@ public class EntityMinecart extends Entity implements IInventory {
return true;
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return this.dead ? false : entityhuman.e(this) <= 64.0D;
}
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index 58f78047..5b9337c8 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -10,11 +10,11 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public void c() {
- this.bl();
+ this.bo();
float f = this.c(1.0F);
if (f > 0.5F) {
- this.bC += 2;
+ this.bA += 2;
}
super.c();
@@ -30,11 +30,13 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
- return entityhuman != null && this.m(entityhuman) ? entityhuman : null;
+ return entityhuman != null && this.n(entityhuman) ? entityhuman : null;
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (super.damageEntity(damagesource, i)) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else if (super.damageEntity(damagesource, i)) {
Entity entity = damagesource.getEntity();
if (this.passenger != entity && this.vehicle != entity) {
@@ -65,7 +67,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
- public boolean l(Entity entity) {
+ public boolean m(Entity entity) {
int i = this.c(entity);
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
@@ -92,7 +94,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
this.motZ *= 0.6D;
}
- int k = EnchantmentManager.getFireAspectEnchantmentLevel(this, (EntityLiving) entity);
+ int k = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (k > 0) {
entity.setOnFire(k * 4);
@@ -105,12 +107,12 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
- this.l(entity);
+ this.m(entity);
}
}
public float a(int i, int j, int k) {
- return 0.5F - this.world.o(i, j, k);
+ return 0.5F - this.world.p(i, j, k);
}
protected boolean i_() {
@@ -123,7 +125,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} else {
int l = this.world.getLightLevel(i, j, k);
- if (this.world.L()) {
+ if (this.world.M()) {
int i1 = this.world.j;
this.world.j = 10;
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index bfcea8c3..a9f69783 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -10,7 +10,7 @@ public class EntityMushroomCow extends EntityCow {
this.a(0.9F, 1.3F);
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
@@ -52,11 +52,19 @@ public class EntityMushroomCow extends EntityCow {
return true;
} else {
- return super.c(entityhuman);
+ return super.a(entityhuman);
}
}
- public EntityAnimal createChild(EntityAnimal entityanimal) {
+ public EntityMushroomCow c(EntityAgeable entityageable) {
return new EntityMushroomCow(this.world);
}
+
+ public EntityCow b(EntityAgeable entityageable) {
+ return this.c(entityageable);
+ }
+
+ public EntityAgeable createChild(EntityAgeable entityageable) {
+ return this.c(entityageable);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 958869b7..ff3aca23 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -28,7 +28,7 @@ public class EntityOcelot extends EntityTameableAnimal {
this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
- public void bj() {
+ public void bm() {
if (this.getControllerMove().a()) {
float f = this.getControllerMove().b();
@@ -48,11 +48,11 @@ public class EntityOcelot extends EntityTameableAnimal {
}
}
- protected boolean bg() {
+ protected boolean bj() {
return !this.isTamed();
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -72,19 +72,19 @@ public class EntityOcelot extends EntityTameableAnimal {
this.setCatType(nbttagcompound.getInt("CatType"));
}
- protected String aW() {
+ protected String aY() {
return this.isTamed() ? (this.r() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
}
- protected String aX() {
+ protected String aZ() {
return "mob.cat.hitt";
}
- protected String aY() {
+ protected String ba() {
return "mob.cat.hitt";
}
- protected float aV() {
+ protected float aX() {
return 0.4F;
}
@@ -92,20 +92,24 @@ public class EntityOcelot extends EntityTameableAnimal {
return Item.LEATHER.id;
}
- public boolean l(Entity entity) {
+ public boolean m(Entity entity) {
return entity.damageEntity(DamageSource.mobAttack(this), 3);
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.d.a(false);
- return super.damageEntity(damagesource, i);
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ this.d.a(false);
+ return super.damageEntity(damagesource, i);
+ }
}
protected void dropDeathLoot(boolean flag, int i) {
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit - Call EntityDeathEvent
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (this.isTamed()) {
@@ -139,10 +143,10 @@ public class EntityOcelot extends EntityTameableAnimal {
return true;
}
- return super.c(entityhuman);
+ return super.a(entityhuman);
}
- public EntityAnimal createChild(EntityAnimal entityanimal) {
+ public EntityOcelot b(EntityAgeable entityageable) {
EntityOcelot entityocelot = new EntityOcelot(this.world);
if (this.isTamed()) {
@@ -208,7 +212,7 @@ public class EntityOcelot extends EntityTameableAnimal {
return this.isTamed() ? "entity.Cat.name" : super.getLocalizedName();
}
- public void bD() {
+ public void bG() {
if (this.world.random.nextInt(7) == 0) {
for (int i = 0; i < 2; ++i) {
EntityOcelot entityocelot = new EntityOcelot(this.world);
@@ -219,4 +223,8 @@ public class EntityOcelot extends EntityTameableAnimal {
}
}
}
+
+ public EntityAgeable createChild(EntityAgeable entityageable) {
+ return this.b(entityageable);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 62e9c14f..c1ee3638 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -25,7 +25,7 @@ public class EntityPig extends EntityAnimal {
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -33,12 +33,12 @@ public class EntityPig extends EntityAnimal {
return 10;
}
- protected void bi() {
- super.bi();
+ protected void bl() {
+ super.bl();
}
- public boolean bF() {
- ItemStack itemstack = ((EntityHuman) this.passenger).bA();
+ public boolean bI() {
+ ItemStack itemstack = ((EntityHuman) this.passenger).bD();
return itemstack != null && itemstack.id == Item.CARROT_STICK.id;
}
@@ -58,24 +58,24 @@ public class EntityPig extends EntityAnimal {
this.setSaddle(nbttagcompound.getBoolean("Saddle"));
}
- protected String aW() {
+ protected String aY() {
return "mob.pig.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.pig.say";
}
- protected String aY() {
+ protected String ba() {
return "mob.pig.death";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.pig.step", 0.15F, 1.0F);
+ this.makeSound("mob.pig.step", 0.15F, 1.0F);
}
- public boolean c(EntityHuman entityhuman) {
- if (super.c(entityhuman)) {
+ public boolean a(EntityHuman entityhuman) {
+ if (super.a(entityhuman)) {
return true;
} else if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
entityhuman.mount(this);
@@ -146,7 +146,7 @@ public class EntityPig extends EntityAnimal {
}
}
- public EntityAnimal createChild(EntityAnimal entityanimal) {
+ public EntityPig b(EntityAgeable entityageable) {
return new EntityPig(this.world);
}
@@ -157,4 +157,8 @@ public class EntityPig extends EntityAnimal {
public PathfinderGoalPassengerCarrotStick n() {
return this.d;
}
+
+ public EntityAgeable createChild(EntityAgeable entityageable) {
+ return this.b(entityageable);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index bd8b5f71..94c7ac00 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -16,18 +15,18 @@ public class EntityPigZombie extends EntityZombie {
public EntityPigZombie(World world) {
super(world);
this.texture = "/mob/pigzombie.png";
- this.bI = 0.5F;
+ this.bG = 0.5F;
this.fireProof = true;
}
- protected boolean bb() {
+ protected boolean be() {
return false;
}
public void j_() {
- this.bI = this.target != null ? 0.95F : 0.5F;
+ this.bG = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
- this.world.makeSound(this, "mob.zombiepig.zpigangry", this.aV() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
+ this.makeSound("mob.zombiepig.zpigangry", this.aX() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
super.j_();
@@ -52,29 +51,32 @@ public class EntityPigZombie extends EntityZombie {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- Entity entity = damagesource.getEntity();
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ Entity entity = damagesource.getEntity();
- if (entity instanceof EntityHuman) {
- List list = this.world.getEntities(this, this.boundingBox.grow(32.0D, 32.0D, 32.0D));
- Iterator iterator = list.iterator();
+ if (entity instanceof EntityHuman) {
+ List list = this.world.getEntities(this, this.boundingBox.grow(32.0D, 32.0D, 32.0D));
- while (iterator.hasNext()) {
- Entity entity1 = (Entity) iterator.next();
+ for (int j = 0; j < list.size(); ++j) {
+ Entity entity1 = (Entity) list.get(j);
- if (entity1 instanceof EntityPigZombie) {
- EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
+ if (entity1 instanceof EntityPigZombie) {
+ EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
- entitypigzombie.o(entity);
+ entitypigzombie.p(entity);
+ }
}
+
+ this.p(entity);
}
- this.o(entity);
+ return super.damageEntity(damagesource, i);
}
-
- return super.damageEntity(damagesource, i);
}
- private void o(Entity entity) {
+ private void p(Entity entity) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
@@ -97,15 +99,15 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40);
}
- protected String aW() {
+ protected String aY() {
return "mob.zombiepig.zpig";
}
- protected String aX() {
+ protected String aZ() {
return "mob.zombiepig.zpighurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.zombiepig.zpigdeath";
}
@@ -140,7 +142,7 @@ public class EntityPigZombie extends EntityZombie {
// CraftBukkit end
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return false;
}
@@ -153,17 +155,17 @@ public class EntityPigZombie extends EntityZombie {
return Item.ROTTEN_FLESH.id;
}
- protected void bB() {
+ protected void bE() {
this.setEquipment(0, new ItemStack(Item.GOLD_SWORD));
}
- public void bD() {
- super.bD();
+ public void bG() {
+ super.bG();
this.setVillager(false);
}
public int c(Entity entity) {
- ItemStack itemstack = this.bA();
+ ItemStack itemstack = this.bD();
int i = 5;
if (itemstack != null) {
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 6130cd64..06709f9b 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -27,14 +27,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double e;
public final List chunkCoordIntPairQueue = new LinkedList();
public final List removeQueue = new LinkedList();
- private int cn = -99999999;
- private int co = -99999999;
- private boolean cp = true;
+ private int ck = -99999999;
+ private int cl = -99999999;
+ private boolean cm = true;
public int lastSentExp = -99999999; // CraftBukkit - private -> public
public int invulnerableTicks = 60; // CraftBukkit - private -> public
- private int cs = 0;
- private int ct = 0;
- private boolean cu = true;
+ private int cp = 0;
+ private int cq = 0;
+ private boolean cr = true;
private int containerCounter = 0;
public boolean h;
public int ping;
@@ -53,7 +53,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super(world);
iteminworldmanager.player = this;
this.itemInWorldManager = iteminworldmanager;
- this.cs = minecraftserver.getServerConfigurationManager().o();
+ this.cp = minecraftserver.getServerConfigurationManager().o();
ChunkCoordinates chunkcoordinates = world.getSpawn();
int i = chunkcoordinates.x;
int j = chunkcoordinates.z;
@@ -136,15 +136,30 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.itemInWorldManager.a();
--this.invulnerableTicks;
this.activeContainer.b();
+
+ while (!this.removeQueue.isEmpty()) {
+ int i = Math.min(this.removeQueue.size(), 127);
+ int[] aint = new int[i];
+ Iterator iterator = this.removeQueue.iterator();
+ int j = 0;
+
+ while (iterator.hasNext() && j < i) {
+ aint[j++] = ((Integer) iterator.next()).intValue();
+ iterator.remove();
+ }
+
+ this.netServerHandler.sendPacket(new Packet29DestroyEntity(aint));
+ }
+
if (!this.chunkCoordIntPairQueue.isEmpty()) {
ArrayList arraylist = new ArrayList();
- Iterator iterator = this.chunkCoordIntPairQueue.iterator();
+ Iterator iterator1 = this.chunkCoordIntPairQueue.iterator();
ArrayList arraylist1 = new ArrayList();
- while (iterator.hasNext() && arraylist.size() < 5) {
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
+ while (iterator1.hasNext() && arraylist.size() < 5) {
+ ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next();
- iterator.remove();
+ iterator1.remove();
if (chunkcoordintpair != null && this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
arraylist.add(this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z));
arraylist1.addAll(((WorldServer) this.world).getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 256, chunkcoordintpair.z * 16 + 16));
@@ -152,35 +167,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
if (!arraylist.isEmpty()) {
- // CraftBukkit start - don't use map chunk bulk for now TODO: fix this
- for (Object object : arraylist) {
- this.netServerHandler.sendPacket(new Packet51MapChunk((Chunk) object, true, 0xffff));
- }
- // this.netServerHandler.sendPacket(new Packet56MapChunkBulk(arraylist));
- // CraftBukkit end
+ this.netServerHandler.sendPacket(new Packet56MapChunkBulk(arraylist));
- Iterator iterator1 = arraylist1.iterator();
+ Iterator iterator2 = arraylist1.iterator();
- while (iterator1.hasNext()) {
- TileEntity tileentity = (TileEntity) iterator1.next();
+ while (iterator2.hasNext()) {
+ TileEntity tileentity = (TileEntity) iterator2.next();
this.b(tileentity);
}
- }
- }
- if (!this.removeQueue.isEmpty()) {
- int i = Math.min(this.removeQueue.size(), 127);
- int[] aint = new int[i];
- Iterator iterator2 = this.removeQueue.iterator();
- int j = 0;
+ iterator2 = arraylist.iterator();
- while (iterator2.hasNext() && j < i) {
- aint[j++] = ((Integer) iterator2.next()).intValue();
- iterator2.remove();
- }
+ while (iterator2.hasNext()) {
+ Chunk chunk = (Chunk) iterator2.next();
- this.netServerHandler.sendPacket(new Packet29DestroyEntity(aint));
+ this.p().getTracker().a(this, chunk);
+ }
+ }
}
}
@@ -199,11 +203,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- if (this.getHealth() != this.cn || this.co != this.foodData.a() || this.foodData.e() == 0.0F != this.cp) {
+ if (this.getHealth() != this.ck || this.cl != this.foodData.a() || this.foodData.e() == 0.0F != this.cm) {
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.e()));
- this.cn = this.getHealth();
- this.co = this.foodData.a();
- this.cp = this.foodData.e() == 0.0F;
+ this.ck = this.getHealth();
+ this.cl = this.foodData.a();
+ this.cm = this.foodData.e() == 0.0F;
}
if (this.expTotal != this.lastSentExp) {
@@ -273,27 +277,34 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (this.invulnerableTicks > 0) {
+ if (this.isInvulnerable()) {
return false;
} else {
// CraftBukkit - this.server.getPvP() -> this.world.pvpMode
- if (!this.world.pvpMode && damagesource instanceof EntityDamageSource) {
- Entity entity = damagesource.getEntity();
+ boolean flag = this.server.T() && this.world.pvpMode && "fall".equals(damagesource.translationIndex);
- if (entity instanceof EntityHuman) {
- return false;
- }
-
- if (entity instanceof EntityArrow) {
- EntityArrow entityarrow = (EntityArrow) entity;
+ if (!flag && this.invulnerableTicks > 0) {
+ return false;
+ } else {
+ // CraftBukkit - this.server.getPvP() -> this.world.pvpMode
+ if (!this.world.pvpMode && damagesource instanceof EntityDamageSource) {
+ Entity entity = damagesource.getEntity();
- if (entityarrow.shooter instanceof EntityHuman) {
+ if (entity instanceof EntityHuman) {
return false;
}
+
+ if (entity instanceof EntityArrow) {
+ EntityArrow entityarrow = (EntityArrow) entity;
+
+ if (entityarrow.shooter instanceof EntityHuman) {
+ return false;
+ }
+ }
}
- }
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, i);
+ }
}
}
@@ -324,14 +335,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.server.getServerConfigurationManager().changeDimension(this, i);
this.lastSentExp = -1;
- this.cn = -1;
- this.co = -1;
+ this.ck = -1;
+ this.cl = -1;
}
}
private void b(TileEntity tileentity) {
if (tileentity != null) {
- Packet packet = tileentity.l();
+ Packet packet = tileentity.getUpdatePacket();
if (packet != null) {
this.netServerHandler.sendPacket(packet);
@@ -350,7 +361,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (enumbedresult == EnumBedResult.OK) {
Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
- this.p().getTracker().a(this, packet17entitylocationaction);
+ this.p().getTracker().a((Entity) this, (Packet) packet17entitylocationaction);
this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.netServerHandler.sendPacket(packet17entitylocationaction);
}
@@ -573,7 +584,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void k() {
- this.activeContainer.a((EntityHuman) this);
+ this.activeContainer.b(this);
this.activeContainer = this.defaultContainer;
}
@@ -605,7 +616,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void m() {
- this.cn = -99999999;
+ this.ck = -99999999;
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -631,8 +642,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void copyTo(EntityHuman entityhuman, boolean flag) {
super.copyTo(entityhuman, flag);
this.lastSentExp = -1;
- this.cn = -1;
- this.co = -1;
+ this.ck = -1;
+ this.cl = -1;
this.removeQueue.addAll(((EntityPlayer) entityhuman).removeQueue);
}
@@ -702,11 +713,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
int i = 256 >> packet204localeandviewdistance.f();
if (i > 3 && i < 15) {
- this.cs = i;
+ this.cp = i;
}
- this.ct = packet204localeandviewdistance.g();
- this.cu = packet204localeandviewdistance.h();
+ this.cq = packet204localeandviewdistance.g();
+ this.cr = packet204localeandviewdistance.h();
if (this.server.I() && this.server.H().equals(this.name)) {
this.server.c(packet204localeandviewdistance.i());
}
@@ -719,7 +730,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public int getChatFlags() {
- return this.ct;
+ return this.cq;
}
public void a(String s, int i) {
@@ -739,10 +750,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public long getPlayerTime() {
if (this.relativeTime) {
// Adds timeOffset to the current server time.
- return this.world.F() + this.timeOffset;
+ return this.world.getDayTime() + this.timeOffset;
} else {
// Adds timeOffset to the beginning of this day.
- return this.world.F() - (this.world.F() % 24000) + this.timeOffset;
+ return this.world.getDayTime() - (this.world.getDayTime() % 24000) + this.timeOffset;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java
index ed382160..f205d74f 100644
--- a/src/main/java/net/minecraft/server/EntityPotion.java
+++ b/src/main/java/net/minecraft/server/EntityPotion.java
@@ -12,7 +12,7 @@ import org.bukkit.entity.LivingEntity;
public class EntityPotion extends EntityProjectile {
- private ItemStack d;
+ private ItemStack c;
public EntityPotion(World world) {
super(world);
@@ -24,12 +24,12 @@ public class EntityPotion extends EntityProjectile {
public EntityPotion(World world, EntityLiving entityliving, ItemStack itemstack) {
super(world, entityliving);
- this.d = itemstack;
+ this.c = itemstack;
}
public EntityPotion(World world, double d0, double d1, double d2, ItemStack itemstack) {
super(world, d0, d1, d2);
- this.d = itemstack;
+ this.c = itemstack;
}
protected float g() {
@@ -45,24 +45,24 @@ public class EntityPotion extends EntityProjectile {
}
public void setPotionValue(int i) {
- if (this.d == null) {
- this.d = new ItemStack(Item.POTION, 1, 0);
+ if (this.c == null) {
+ this.c = new ItemStack(Item.POTION, 1, 0);
}
- this.d.setData(i);
+ this.c.setData(i);
}
public int getPotionValue() {
- if (this.d == null) {
- this.d = new ItemStack(Item.POTION, 1, 0);
+ if (this.c == null) {
+ this.c = new ItemStack(Item.POTION, 1, 0);
}
- return this.d.getData();
+ return this.c.getData();
}
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
- List list = Item.POTION.l(this.d);
+ List list = Item.POTION.l(this.c);
if (list != null && !list.isEmpty()) {
AxisAlignedBB axisalignedbb = this.boundingBox.grow(4.0D, 2.0D, 4.0D);
@@ -108,7 +108,7 @@ public class EntityPotion extends EntityProjectile {
int i = mobeffect.getEffectId();
// CraftBukkit start - abide by PVP settings
- if (!this.world.pvpMode && entityliving instanceof EntityPlayer && entityliving != this.shooter) {
+ if (!this.world.pvpMode && entityliving instanceof EntityPlayer && entityliving != this.getShooter()) {
// Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions
if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) continue;
}
@@ -116,7 +116,7 @@ public class EntityPotion extends EntityProjectile {
if (MobEffectList.byId[i].isInstant()) {
// CraftBukkit - added 'this'
- MobEffectList.byId[i].applyInstantEffect(this.shooter, entityliving, mobeffect.getAmplifier(), d1, this);
+ MobEffectList.byId[i].applyInstantEffect(this.getShooter(), entityliving, mobeffect.getAmplifier(), d1, this);
} else {
int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
@@ -138,20 +138,20 @@ public class EntityPotion extends EntityProjectile {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
if (nbttagcompound.hasKey("Potion")) {
- this.d = ItemStack.a(nbttagcompound.getCompound("Potion"));
+ this.c = ItemStack.a(nbttagcompound.getCompound("Potion"));
} else {
this.setPotionValue(nbttagcompound.getInt("potionValue"));
}
- if (this.d == null) {
+ if (this.c == null) {
this.die();
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- if (this.d != null) {
- nbttagcompound.setCompound("Potion", this.d.save(new NBTTagCompound()));
+ if (this.c != null) {
+ nbttagcompound.setCompound("Potion", this.c.save(new NBTTagCompound()));
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 132af67d..7e8122dd 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit
@@ -13,9 +12,10 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
private int inBlockId = 0;
protected boolean inGround = false;
public int shake = 0;
- public EntityLiving shooter; // CraftBukkit - protected -> public
- private int h;
- private int i = 0;
+ public EntityLiving shooter; // CraftBukkit - private -> public
+ public String shooterName = null; // CraftBukkit - private -> public
+ private int i;
+ private int j = 0;
public EntityProjectile(World world) {
super(world);
@@ -44,7 +44,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
public EntityProjectile(World world, double d0, double d1, double d2) {
super(world);
- this.h = 0;
+ this.i = 0;
this.a(0.25F, 0.25F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
@@ -77,7 +77,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
- this.h = 0;
+ this.i = 0;
}
public void j_() {
@@ -93,8 +93,8 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
int i = this.world.getTypeId(this.blockX, this.blockY, this.blockZ);
if (i == this.inBlockId) {
- ++this.h;
- if (this.h == 1200) {
+ ++this.i;
+ if (this.i == 1200) {
this.die();
}
@@ -105,10 +105,10 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
- this.h = 0;
this.i = 0;
+ this.j = 0;
} else {
- ++this.i;
+ ++this.j;
}
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
@@ -125,12 +125,12 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
Entity entity = null;
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
- Iterator iterator = list.iterator();
+ EntityLiving entityliving = this.getShooter();
- while (iterator.hasNext()) {
- Entity entity1 = (Entity) iterator.next();
+ for (int j = 0; j < list.size(); ++j) {
+ Entity entity1 = (Entity) list.get(j);
- if (entity1.L() && (entity1 != this.shooter || this.i >= 5)) {
+ if (entity1.L() && (entity1 != entityliving || this.j >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -194,7 +194,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
float f3 = this.g();
if (this.H()) {
- for (int j = 0; j < 4; ++j) {
+ for (int k = 0; k < 4; ++k) {
float f4 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
@@ -223,6 +223,11 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
nbttagcompound.setByte("inTile", (byte) this.inBlockId);
nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
+ if ((this.shooterName == null || this.shooterName.length() == 0) && this.shooter != null && this.shooter instanceof EntityHuman) {
+ this.shooterName = this.shooter.getLocalizedName();
+ }
+
+ nbttagcompound.setString("ownerName", this.shooterName == null ? "" : this.shooterName);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -232,5 +237,17 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.inBlockId = nbttagcompound.getByte("inTile") & 255;
this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.getByte("inGround") == 1;
+ this.shooterName = nbttagcompound.getString("ownerName");
+ if (this.shooterName != null && this.shooterName.length() == 0) {
+ this.shooterName = null;
+ }
+ }
+
+ public EntityLiving getShooter() {
+ if (this.shooter == null && this.shooterName != null && this.shooterName.length() > 0) {
+ this.shooter = this.world.a(this.shooterName);
+ }
+
+ return this.shooter;
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index aadad334..1d8a94bb 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -9,9 +9,10 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
public class EntitySheep extends EntityAnimal {
- public static final float[][] d = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.95F, 0.7F, 0.2F}, { 0.9F, 0.5F, 0.85F}, { 0.6F, 0.7F, 0.95F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.7F, 0.8F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.6F, 0.7F}, { 0.7F, 0.4F, 0.9F}, { 0.2F, 0.4F, 0.8F}, { 0.5F, 0.4F, 0.3F}, { 0.4F, 0.5F, 0.2F}, { 0.8F, 0.3F, 0.3F}, { 0.1F, 0.1F, 0.1F}};
- private int e;
- private PathfinderGoalEatTile f = new PathfinderGoalEatTile(this);
+ private final InventoryCrafting e = new InventoryCrafting(new ContainerSheepBreed(this), 2, 1);
+ public static final float[][] d = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.85F, 0.5F, 0.2F}, { 0.7F, 0.3F, 0.85F}, { 0.4F, 0.6F, 0.85F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.5F, 0.65F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.5F, 0.6F}, { 0.5F, 0.25F, 0.7F}, { 0.2F, 0.3F, 0.7F}, { 0.4F, 0.3F, 0.2F}, { 0.4F, 0.5F, 0.2F}, { 0.6F, 0.2F, 0.2F}, { 0.1F, 0.1F, 0.1F}};
+ private int f;
+ private PathfinderGoalEatTile g = new PathfinderGoalEatTile(this);
public EntitySheep(World world) {
super(world);
@@ -25,24 +26,26 @@ public class EntitySheep extends EntityAnimal {
this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.25F));
- this.goalSelector.a(5, this.f);
+ this.goalSelector.a(5, this.g);
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, f));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.e.setItem(0, new ItemStack(Item.INK_SACK, 1, 0));
+ this.e.setItem(1, new ItemStack(Item.INK_SACK, 1, 0));
}
- protected boolean bb() {
+ protected boolean be() {
return true;
}
- protected void bi() {
- this.e = this.f.f();
- super.bi();
+ protected void bl() {
+ this.f = this.g.f();
+ super.bl();
}
public void c() {
if (this.world.isStatic) {
- this.e = Math.max(0, this.e - 1);
+ this.f = Math.max(0, this.f - 1);
}
super.c();
@@ -73,7 +76,7 @@ public class EntitySheep extends EntityAnimal {
return Block.WOOL.id;
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.isBaby()) {
@@ -100,10 +103,10 @@ public class EntitySheep extends EntityAnimal {
}
itemstack.damage(1, entityhuman);
- this.world.makeSound(this, "mob.sheep.shear", 1.0F, 1.0F);
+ this.makeSound("mob.sheep.shear", 1.0F, 1.0F);
}
- return super.c(entityhuman);
+ return super.a(entityhuman);
}
public void b(NBTTagCompound nbttagcompound) {
@@ -118,20 +121,20 @@ public class EntitySheep extends EntityAnimal {
this.setColor(nbttagcompound.getByte("Color"));
}
- protected String aW() {
+ protected String aY() {
return "mob.sheep.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.sheep.say";
}
- protected String aY() {
+ protected String ba() {
return "mob.sheep.say";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.sheep.step", 0.15F, 1.0F);
+ this.makeSound("mob.sheep.step", 0.15F, 1.0F);
}
public int getColor() {
@@ -164,20 +167,16 @@ public class EntitySheep extends EntityAnimal {
return i < 5 ? 15 : (i < 10 ? 7 : (i < 15 ? 8 : (i < 18 ? 12 : (random.nextInt(500) == 0 ? 6 : 0))));
}
- public EntityAnimal createChild(EntityAnimal entityanimal) {
- EntitySheep entitysheep = (EntitySheep) entityanimal;
+ public EntitySheep b(EntityAgeable entityageable) {
+ EntitySheep entitysheep = (EntitySheep) entityageable;
EntitySheep entitysheep1 = new EntitySheep(this.world);
+ int i = this.a(this, entitysheep);
- if (this.random.nextBoolean()) {
- entitysheep1.setColor(this.getColor());
- } else {
- entitysheep1.setColor(entitysheep.getColor());
- }
-
+ entitysheep1.setColor(15 - i);
return entitysheep1;
}
- public void aG() {
+ public void aH() {
// CraftBukkit start
SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
@@ -198,7 +197,33 @@ public class EntitySheep extends EntityAnimal {
}
}
- public void bD() {
+ public void bG() {
this.setColor(a(this.world.random));
}
+
+ private int a(EntityAnimal entityanimal, EntityAnimal entityanimal1) {
+ int i = this.b(entityanimal);
+ int j = this.b(entityanimal1);
+
+ this.e.getItem(0).setData(i);
+ this.e.getItem(1).setData(j);
+ ItemStack itemstack = CraftingManager.getInstance().craft(this.e, ((EntitySheep) entityanimal).world);
+ int k;
+
+ if (itemstack != null && itemstack.getItem().id == Item.INK_SACK.id) {
+ k = itemstack.getData();
+ } else {
+ k = this.world.random.nextBoolean() ? i : j;
+ }
+
+ return k;
+ }
+
+ private int b(EntityAnimal entityanimal) {
+ return 15 - ((EntitySheep) entityanimal).getColor();
+ }
+
+ public EntityAgeable createChild(EntityAgeable entityageable) {
+ return this.b(entityageable);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
index 802169c6..1dab71b6 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
@@ -10,7 +10,7 @@ public class EntitySilverfish extends EntityMonster {
super(world);
this.texture = "/mob/silverfish.png";
this.a(0.3F, 0.7F);
- this.bI = 0.6F;
+ this.bG = 0.6F;
}
public int getMaxHealth() {
@@ -27,24 +27,28 @@ public class EntitySilverfish extends EntityMonster {
return this.world.findNearbyVulnerablePlayer(this, d0);
}
- protected String aW() {
+ protected String aY() {
return "mob.silverfish.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.silverfish.hit";
}
- protected String aY() {
+ protected String ba() {
return "mob.silverfish.kill";
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (this.d <= 0 && (damagesource instanceof EntityDamageSource || damagesource == DamageSource.MAGIC)) {
- this.d = 20;
- }
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ if (this.d <= 0 && (damagesource instanceof EntityDamageSource || damagesource == DamageSource.MAGIC)) {
+ this.d = 20;
+ }
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, i);
+ }
}
protected void a(Entity entity, float f) {
@@ -55,7 +59,7 @@ public class EntitySilverfish extends EntityMonster {
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.silverfish.step", 0.15F, 1.0F);
+ this.makeSound("mob.silverfish.step", 0.15F, 1.0F);
}
protected int getLootId() {
@@ -67,8 +71,8 @@ public class EntitySilverfish extends EntityMonster {
super.j_();
}
- protected void bk() {
- super.bk();
+ protected void bn() {
+ super.bn();
if (!this.world.isStatic) {
int i;
int j;
@@ -124,7 +128,7 @@ public class EntitySilverfish extends EntityMonster {
// CraftBukkit end
this.world.setTypeIdAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.f(l));
- this.aQ();
+ this.aR();
this.die();
} else {
this.i();
diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java
index 70130d7d..39296ae3 100644
--- a/src/main/java/net/minecraft/server/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/server/EntitySkeleton.java
@@ -6,18 +6,24 @@ import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
public class EntitySkeleton extends EntityMonster implements IRangedEntity {
+ private PathfinderGoalArrowAttack d = new PathfinderGoalArrowAttack(this, 0.25F, 60, 10.0F);
+ private PathfinderGoalMeleeAttack e = new PathfinderGoalMeleeAttack(this, EntityHuman.class, 0.31F, false);
+
public EntitySkeleton(World world) {
super(world);
this.texture = "/mob/skeleton.png";
- this.bI = 0.25F;
+ this.bG = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalRestrictSun(this));
- this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bI));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bG));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
+ if (world != null && !world.isStatic) {
+ this.m();
+ }
}
protected void a() {
@@ -25,7 +31,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.datawatcher.a(13, new Byte((byte) 0));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -33,24 +39,24 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
return 20;
}
- protected String aW() {
+ protected String aY() {
return "mob.skeleton.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.skeleton.hurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.skeleton.death";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.skeleton.step", 0.15F, 1.0F);
+ this.makeSound("mob.skeleton.step", 0.15F, 1.0F);
}
- public boolean l(Entity entity) {
- if (super.l(entity)) {
+ public boolean m(Entity entity) {
+ if (super.m(entity)) {
if (this.getSkeletonType() == 1 && entity instanceof EntityLiving) {
((EntityLiving) entity).addEffect(new MobEffect(MobEffectList.WITHER.id, 200));
}
@@ -63,7 +69,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public int c(Entity entity) {
if (this.getSkeletonType() == 1) {
- ItemStack itemstack = this.bA();
+ ItemStack itemstack = this.bD();
int i = 4;
if (itemstack != null) {
@@ -81,10 +87,10 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
public void c() {
- if (this.world.t() && !this.world.isStatic) {
+ if (this.world.u() && !this.world.isStatic) {
float f = this.c(1.0F);
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
+ if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.k(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
boolean flag = true;
ItemStack itemstack = this.getEquipment(4);
@@ -179,25 +185,29 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
return null;
}
- protected void bB() {
- super.bB();
+ protected void bE() {
+ super.bD();
this.setEquipment(0, new ItemStack(Item.BOW));
}
- public void bD() {
- if (this.world.worldProvider instanceof WorldProviderHell && this.aA().nextInt(5) > 0) {
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bI, false));
+ public void bG() {
+ if (this.world.worldProvider instanceof WorldProviderHell && this.aB().nextInt(5) > 0) {
+ this.goalSelector.a(4, this.e);
this.setSkeletonType(1);
this.setEquipment(0, new ItemStack(Item.STONE_SWORD));
} else {
- this.goalSelector.a(4, new PathfinderGoalArrowAttack(this, this.bI, 60, 10.0F));
- this.bB();
- this.bC();
+ this.goalSelector.a(4, this.d);
+ this.bE();
+ this.bF();
}
- this.canPickUpLoot = this.random.nextFloat() < as[this.world.difficulty];
+ if (this.random.nextFloat() >= as[this.world.difficulty]) {
+ ;
+ }
+
+ this.canPickUpLoot = true;
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.S();
+ Calendar calendar = this.world.T();
if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) {
this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN));
@@ -206,10 +216,22 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
}
+ public void m() {
+ this.goalSelector.a((PathfinderGoal) this.e);
+ this.goalSelector.a((PathfinderGoal) this.d);
+ ItemStack itemstack = this.bD();
+
+ if (itemstack != null && itemstack.id == Item.BOW.id) {
+ this.goalSelector.a(4, this.d);
+ } else {
+ this.goalSelector.a(4, this.e);
+ }
+ }
+
public void d(EntityLiving entityliving) {
EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 12.0F);
- int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bA());
- int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bA());
+ int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bD());
+ int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bD());
if (i > 0) {
entityarrow.b(entityarrow.c() + (double) i * 0.5D + 0.5D);
@@ -219,11 +241,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
entityarrow.a(j);
}
- if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {
+ if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bD()) > 0 || this.getSkeletonType() == 1) {
entityarrow.setOnFire(100);
}
- this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.aA().nextFloat() * 0.4F + 0.8F));
+ this.makeSound("random.bow", 1.0F, 1.0F / (this.aB().nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entityarrow);
}
@@ -249,15 +271,18 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.setSkeletonType(b0);
}
- if (this.getSkeletonType() == 1) {
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bI, false));
- } else {
- this.goalSelector.a(4, new PathfinderGoalArrowAttack(this, this.bI, 60, 10.0F));
- }
+ this.m();
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setByte("SkeletonType", (byte) this.getSkeletonType());
}
+
+ public void setEquipment(int i, ItemStack itemstack) {
+ super.setEquipment(i, itemstack);
+ if (!this.world.isStatic && i == 0) {
+ this.m();
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index 8bb950a9..c57aa010 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -24,6 +24,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.datawatcher.a(16, new Byte((byte) 1));
}
+ // CraftBukkit - protected -> public
public void setSize(int i) {
this.datawatcher.watch(16, new Byte((byte) i));
this.a(0.6F * (float) i, 0.6F * (float) i);
@@ -70,8 +71,10 @@ public class EntitySlime extends EntityLiving implements IMonster {
boolean flag = this.onGround;
super.j_();
+ int i;
+
if (this.onGround && !flag) {
- int i = this.getSize();
+ i = this.getSize();
for (int j = 0; j < i * 8; ++j) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
@@ -83,7 +86,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
if (this.o()) {
- this.world.makeSound(this, this.n(), this.aV(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
+ this.makeSound(this.n(), this.aX(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.b = -0.5F;
@@ -92,10 +95,14 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
this.k();
+ if (this.world.isStatic) {
+ i = this.getSize();
+ this.a(0.6F * (float) i, 0.6F * (float) i);
+ }
}
- protected void bk() {
- this.bh();
+ protected void bn() {
+ this.bk();
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // CraftBukkit TODO: EntityTargetEvent
if (entityhuman != null) {
@@ -108,17 +115,17 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.jumpDelay /= 3;
}
- this.bG = true;
+ this.bE = true;
if (this.q()) {
- this.world.makeSound(this, this.n(), this.aV(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
+ this.makeSound(this.n(), this.aX(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
- this.bD = 1.0F - this.random.nextFloat() * 2.0F;
- this.bE = (float) (1 * this.getSize());
+ this.bB = 1.0F - this.random.nextFloat() * 2.0F;
+ this.bC = (float) (1 * this.getSize());
} else {
- this.bG = false;
+ this.bE = false;
if (this.onGround) {
- this.bD = this.bE = 0.0F;
+ this.bB = this.bC = 0.0F;
}
}
}
@@ -167,12 +174,12 @@ public class EntitySlime extends EntityLiving implements IMonster {
super.die();
}
- public void b_(EntityHuman entityhuman) {
+ public void c_(EntityHuman entityhuman) {
if (this.l()) {
int i = this.getSize();
- if (this.m(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.m())) {
- this.world.makeSound(this, "mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ if (this.n(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.m())) {
+ this.makeSound("mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
}
@@ -185,11 +192,11 @@ public class EntitySlime extends EntityLiving implements IMonster {
return this.getSize();
}
- protected String aX() {
+ protected String aZ() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String aY() {
+ protected String ba() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
@@ -217,11 +224,11 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
}
- protected float aV() {
+ protected float aX() {
return 0.4F * (float) this.getSize();
}
- public int bm() {
+ public int bp() {
return 0;
}
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index b6fe1c4b..5da1e6c6 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -19,7 +19,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 16.0F, 0, true, false, IMonster.a));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -102,7 +102,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
float f = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
entitysnowball.shoot(d0, d1 + (double) f, d2, 1.6F, 12.0F);
- this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.aA().nextFloat() * 0.4F + 0.8F));
+ this.makeSound("random.bow", 1.0F, 1.0F / (this.aB().nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entitysnowball);
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index 6f2e1510..c3cfa283 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -8,7 +8,7 @@ public class EntitySpider extends EntityMonster {
super(world);
this.texture = "/mob/spider.png";
this.a(1.4F, 0.9F);
- this.bI = 0.8F;
+ this.bG = 0.8F;
}
protected void a() {
@@ -43,20 +43,20 @@ public class EntitySpider extends EntityMonster {
}
}
- protected String aW() {
+ protected String aY() {
return "mob.spider.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.spider.say";
}
- protected String aY() {
+ protected String ba() {
return "mob.spider.death";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.spider.step", 0.15F, 1.0F);
+ this.makeSound("mob.spider.step", 0.15F, 1.0F);
}
protected void a(Entity entity, float f) {
@@ -149,12 +149,12 @@ public class EntitySpider extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
- public void bD() {
+ public void bG() {
if (this.world.random.nextInt(100) == 0) {
EntitySkeleton entityskeleton = new EntitySkeleton(this.world);
entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
- entityskeleton.bD();
+ entityskeleton.bG();
this.world.addEntity(entityskeleton);
entityskeleton.mount(this);
}
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index e2322b94..60218796 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -11,38 +11,38 @@ public class EntitySquid extends EntityWaterAnimal {
public float h = 0.0F;
public float i = 0.0F;
public float j = 0.0F;
- public float bK = 0.0F;
+ public float bI = 0.0F;
+ private float bJ = 0.0F;
+ private float bK = 0.0F;
private float bL = 0.0F;
private float bM = 0.0F;
private float bN = 0.0F;
private float bO = 0.0F;
- private float bP = 0.0F;
- private float bQ = 0.0F;
public EntitySquid(World world) {
super(world);
this.texture = "/mob/squid.png";
this.a(0.95F, 0.95F);
- this.bM = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.bK = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
public int getMaxHealth() {
return 10;
}
- protected String aW() {
+ protected String aY() {
return null;
}
- protected String aX() {
+ protected String aZ() {
return null;
}
- protected String aY() {
+ protected String ba() {
return null;
}
- protected float aV() {
+ protected float aX() {
return 0.4F;
}
@@ -72,12 +72,12 @@ public class EntitySquid extends EntityWaterAnimal {
this.e = this.d;
this.g = this.f;
this.i = this.h;
- this.bK = this.j;
- this.h += this.bM;
+ this.bI = this.j;
+ this.h += this.bK;
if (this.h > 6.2831855F) {
this.h -= 6.2831855F;
if (this.random.nextInt(10) == 0) {
- this.bM = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.bK = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
}
@@ -88,28 +88,28 @@ public class EntitySquid extends EntityWaterAnimal {
f = this.h / 3.1415927F;
this.j = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
if ((double) f > 0.75D) {
+ this.bJ = 1.0F;
this.bL = 1.0F;
- this.bN = 1.0F;
} else {
- this.bN *= 0.8F;
+ this.bL *= 0.8F;
}
} else {
this.j = 0.0F;
- this.bL *= 0.9F;
- this.bN *= 0.99F;
+ this.bJ *= 0.9F;
+ this.bL *= 0.99F;
}
if (!this.world.isStatic) {
- this.motX = (double) (this.bO * this.bL);
- this.motY = (double) (this.bP * this.bL);
- this.motZ = (double) (this.bQ * this.bL);
+ this.motX = (double) (this.bM * this.bJ);
+ this.motY = (double) (this.bN * this.bJ);
+ this.motZ = (double) (this.bO * this.bJ);
}
f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
// CraftBukkit - Math -> TrigMath
this.aw += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aw) * 0.1F;
this.yaw = this.aw;
- this.f += 3.1415927F * this.bN * 1.5F;
+ this.f += 3.1415927F * this.bL * 1.5F;
// CraftBukkit - Math -> TrigMath
this.d += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.d) * 0.1F;
} else {
@@ -129,19 +129,19 @@ public class EntitySquid extends EntityWaterAnimal {
this.move(this.motX, this.motY, this.motZ);
}
- protected void bk() {
- ++this.bC;
- if (this.bC > 100) {
- this.bO = this.bP = this.bQ = 0.0F;
- } else if (this.random.nextInt(50) == 0 || !this.ad || this.bO == 0.0F && this.bP == 0.0F && this.bQ == 0.0F) {
+ protected void bn() {
+ ++this.bA;
+ if (this.bA > 100) {
+ this.bM = this.bN = this.bO = 0.0F;
+ } else if (this.random.nextInt(50) == 0 || !this.ad || this.bM == 0.0F && this.bN == 0.0F && this.bO == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
- this.bO = MathHelper.cos(f) * 0.2F;
- this.bP = -0.1F + this.random.nextFloat() * 0.2F;
- this.bQ = MathHelper.sin(f) * 0.2F;
+ this.bM = MathHelper.cos(f) * 0.2F;
+ this.bN = -0.1F + this.random.nextFloat() * 0.2F;
+ this.bO = MathHelper.sin(f) * 0.2F;
}
- this.bh();
+ this.bk();
}
public boolean canSpawn() {
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index 999a0b37..f0ae58f5 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -139,18 +139,15 @@ public class EntityTracker {
}
}
- iterator = arraylist.iterator();
-
- while (iterator.hasNext()) {
- EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- EntityPlayer entityplayer1 = entityplayer;
+ for (int i = 0; i < arraylist.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) arraylist.get(i);
Iterator iterator1 = this.b.iterator();
while (iterator1.hasNext()) {
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
- if (entitytrackerentry1.tracker != entityplayer1) {
- entitytrackerentry1.updatePlayer(entityplayer1);
+ if (entitytrackerentry1.tracker != entityplayer) {
+ entitytrackerentry1.updatePlayer(entityplayer);
}
}
}
@@ -184,4 +181,16 @@ public class EntityTracker {
entitytrackerentry.clear(entityplayer);
}
}
+
+ public void a(EntityPlayer entityplayer, Chunk chunk) {
+ Iterator iterator = this.b.iterator();
+
+ while (iterator.hasNext()) {
+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
+
+ if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.ai == chunk.x && entitytrackerentry.tracker.ak == chunk.z) {
+ entitytrackerentry.updatePlayer(entityplayer);
+ }
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index d3e4978b..acb36376 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -32,6 +32,7 @@ public class EntityTrackerEntry {
private boolean isMoving;
private int u = 0;
private Entity v;
+ private boolean w = false;
public boolean n = false;
public Set trackedPlayers = new HashSet();
@@ -78,18 +79,18 @@ public class EntityTrackerEntry {
if (i5 != null && i5.getItem() instanceof ItemWorldMap) {
WorldMap i7 = Item.MAP.getSavedMap(i5, this.tracker.world);
- Iterator i8 = list.iterator();
+ Iterator j0 = list.iterator();
- while (i8.hasNext()) {
- EntityHuman j0 = (EntityHuman) i8.next();
- EntityPlayer j1 = (EntityPlayer) j0;
+ while (j0.hasNext()) {
+ EntityHuman j1 = (EntityHuman) j0.next();
+ EntityPlayer j2 = (EntityPlayer) j1;
- i7.a(j1, i5);
- if (j1.netServerHandler.lowPriorityCount() <= 5) {
- Packet j2 = Item.MAP.c(i5, this.tracker.world, j1);
+ i7.a(j2, i5);
+ if (j2.netServerHandler.lowPriorityCount() <= 5) {
+ Packet j3 = Item.MAP.c(i5, this.tracker.world, j2);
- if (j2 != null) {
- j1.netServerHandler.sendPacket(j2);
+ if (j3 != null) {
+ j2.netServerHandler.sendPacket(j3);
}
}
}
@@ -131,7 +132,7 @@ public class EntityTrackerEntry {
}
// CraftBukkit end
- if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.u <= 400) {
+ if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.u <= 400 && !this.w) {
if (flag && flag1) {
object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
} else if (flag) {
@@ -186,6 +187,8 @@ public class EntityTrackerEntry {
this.xRot = i1;
}
// CraftBukkit end */
+
+ this.w = false;
} else {
i = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
j = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
@@ -200,6 +203,13 @@ public class EntityTrackerEntry {
this.xLoc = this.tracker.ar.a(this.tracker.locX);
this.yLoc = MathHelper.floor(this.tracker.locY * 32.0D);
this.zLoc = this.tracker.ar.a(this.tracker.locZ);
+ DataWatcher datawatcher2 = this.tracker.getDataWatcher();
+
+ if (datawatcher2.a()) {
+ this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher2, false));
+ }
+
+ this.w = true;
}
i = MathHelper.d(this.tracker.ap() * 256.0F / 360.0F);
@@ -355,12 +365,8 @@ public class EntityTrackerEntry {
}
public void scanPlayers(List list) {
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- EntityHuman entityhuman = (EntityHuman) iterator.next();
-
- this.updatePlayer((EntityPlayer) entityhuman);
+ for (int i = 0; i < list.size(); ++i) {
+ this.updatePlayer((EntityPlayer) list.get(i));
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index 9026a63b..5d0c6b6a 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -11,10 +11,10 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
public EntityWitch(World world) {
super(world);
this.texture = "/mob/villager/witch.png";
- this.bI = 0.25F;
+ this.bG = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bI, 60, 10.0F));
- this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bG, 60, 10.0F));
+ this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(3, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
@@ -26,15 +26,15 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.getDataWatcher().a(21, Byte.valueOf((byte) 0));
}
- protected String aW() {
+ protected String aY() {
return "mob.witch.idle";
}
- protected String aX() {
+ protected String aZ() {
return "mob.witch.hurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.witch.death";
}
@@ -50,7 +50,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
return 26;
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -59,7 +59,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
if (this.m()) {
if (this.e-- <= 0) {
this.f(false);
- ItemStack itemstack = this.bA();
+ ItemStack itemstack = this.bD();
this.setEquipment(0, (ItemStack) null);
if (itemstack != null && itemstack.id == Item.POTION.id) {
@@ -83,15 +83,15 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
short1 = 16307;
} else if (this.random.nextFloat() < 0.05F && this.health < this.getMaxHealth()) {
short1 = 16341;
- } else if (this.random.nextFloat() < 0.25F && this.aF() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.aF().e(this) > 121.0D) {
+ } else if (this.random.nextFloat() < 0.25F && this.aG() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.aG().e(this) > 121.0D) {
short1 = 16274;
- } else if (this.random.nextFloat() < 0.25F && this.aF() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.aF().e(this) > 121.0D) {
+ } else if (this.random.nextFloat() < 0.25F && this.aG() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.aG().e(this) > 121.0D) {
short1 = 16274;
}
if (short1 > -1) {
this.setEquipment(0, new ItemStack(Item.POTION, 1, short1));
- this.e = this.bA().m();
+ this.e = this.bD().m();
this.f(true);
}
}
@@ -117,8 +117,8 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
return i;
}
- public float by() {
- float f = super.by();
+ public float bB() {
+ float f = super.bB();
if (this.m()) {
f *= 0.75F;
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index b4ce3a80..ea709e91 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -16,7 +16,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
private int[] h = new int[2];
private int[] i = new int[2];
private int j;
- private static final IEntitySelector bK = new EntitySelectorNotUndead();
+ private static final IEntitySelector bI = new EntitySelectorNotUndead();
public EntityWither(World world) {
super(world);
@@ -24,15 +24,15 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.texture = "/mob/wither.png";
this.a(0.9F, 4.0F);
this.fireProof = true;
- this.bI = 0.6F;
+ this.bG = 0.6F;
this.getNavigation().e(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bI, 40, 20.0F));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bG, 40, 20.0F));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 30.0F, 0, false, false, bK));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 30.0F, 0, false, false, bI));
this.bc = 50;
}
@@ -52,19 +52,19 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.s(nbttagcompound.getInt("Invul"));
+ this.t(nbttagcompound.getInt("Invul"));
this.datawatcher.watch(16, Integer.valueOf(this.health));
}
- protected String aW() {
+ protected String aY() {
return "mob.wither.idle";
}
- protected String aX() {
+ protected String aZ() {
return "mob.wither.hurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.wither.death";
}
@@ -78,8 +78,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
double d1;
double d2;
- if (!this.world.isStatic && this.t(0) > 0) {
- Entity entity = this.world.getEntity(this.t(0));
+ if (!this.world.isStatic && this.u(0) > 0) {
+ Entity entity = this.world.getEntity(this.u(0));
if (entity != null) {
if (this.locY < entity.locY || !this.o() && this.locY < entity.locY + 5.0D) {
@@ -118,7 +118,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
int j;
for (i = 0; i < 2; ++i) {
- j = this.t(i + 1);
+ j = this.u(i + 1);
Entity entity1 = null;
if (j > 0) {
@@ -126,9 +126,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
if (entity1 != null) {
- d0 = this.u(i + 1);
- d1 = this.v(i + 1);
- d2 = this.w(i + 1);
+ d0 = this.v(i + 1);
+ d1 = this.w(i + 1);
+ d2 = this.x(i + 1);
double d4 = entity1.locX - d0;
double d5 = entity1.locY + (double) entity1.getHeadHeight() - d1;
double d6 = entity1.locZ - d2;
@@ -146,9 +146,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
boolean flag = this.o();
for (j = 0; j < 3; ++j) {
- double d8 = this.u(j);
- double d9 = this.v(j);
- double d10 = this.w(j);
+ double d8 = this.v(j);
+ double d9 = this.w(j);
+ double d10 = this.x(j);
this.world.addParticle("smoke", d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D);
if (flag && this.world.random.nextInt(4) == 0) {
@@ -163,7 +163,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- protected void bi() {
+ protected void bl() {
int i;
if (this.n() > 0) {
@@ -181,12 +181,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.world.e(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
- this.s(i);
+ this.t(i);
if (this.ticksLived % 10 == 0) {
this.heal(10, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
}
} else {
- super.bi();
+ super.bl();
int j;
@@ -210,11 +210,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- j = this.t(i);
+ j = this.u(i);
if (j > 0) {
Entity entity = this.world.getEntity(j);
- if (entity != null && entity.isAlive() && this.e(entity) <= 900.0D && this.m(entity)) {
+ if (entity != null && entity.isAlive() && this.e(entity) <= 900.0D && this.n(entity)) {
this.a(i + 1, (EntityLiving) entity);
this.h[i - 1] = this.ticksLived + 40 + this.random.nextInt(20);
this.i[i - 1] = 0;
@@ -222,7 +222,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.c(i, 0);
}
} else {
- List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bK);
+ List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bI);
for (int i1 = 0; i1 < 10 && !list.isEmpty(); ++i1) {
EntityLiving entityliving = (EntityLiving) list.get(this.random.nextInt(list.size()));
@@ -244,8 +244,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- if (this.aF() != null) {
- this.c(0, this.aF().id);
+ if (this.aG() != null) {
+ this.c(0, this.aG().id);
} else {
this.c(0, 0);
}
@@ -266,7 +266,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
int l2 = j1 + l1;
int i3 = this.world.getTypeId(j2, k2, l2);
- if (i3 > 0 && i3 != Block.BEDROCK.id) {
+ if (i3 > 0 && i3 != Block.BEDROCK.id && i3 != Block.ENDER_PORTAL.id && i3 != Block.ENDER_PORTAL_FRAME.id) {
int j3 = this.world.getData(j2, k2, l2);
// CraftBukkit start
@@ -297,17 +297,17 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
public void m() {
- this.s(220);
+ this.t(220);
this.setHealth(this.getMaxHealth() / 3);
}
public void am() {}
- public int aU() {
+ public int aW() {
return 4;
}
- private double u(int i) {
+ private double v(int i) {
if (i <= 0) {
return this.locX;
} else {
@@ -318,11 +318,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- private double v(int i) {
+ private double w(int i) {
return i <= 0 ? this.locY + 3.0D : this.locY + 2.2D;
}
- private double w(int i) {
+ private double x(int i) {
if (i <= 0) {
return this.locZ;
} else {
@@ -353,9 +353,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
private void a(int i, double d0, double d1, double d2, boolean flag) {
this.world.a((EntityHuman) null, 1014, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
- double d3 = this.u(i);
- double d4 = this.v(i);
- double d5 = this.w(i);
+ double d3 = this.v(i);
+ double d4 = this.w(i);
+ double d5 = this.x(i);
double d6 = d0 - d3;
double d7 = d1 - d4;
double d8 = d2 - d5;
@@ -376,7 +376,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (damagesource == DamageSource.DROWN) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else if (damagesource == DamageSource.DROWN) {
return false;
} else if (this.n() > 0) {
return false;
@@ -415,8 +417,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit end
}
- protected void bh() {
- this.bC = 0;
+ protected void bk() {
+ this.bA = 0;
}
public boolean L() {
@@ -431,7 +433,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public void addEffect(MobEffect mobeffect) {}
- protected boolean bb() {
+ protected boolean be() {
return true;
}
@@ -443,11 +445,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
return this.datawatcher.getInt(20);
}
- public void s(int i) {
+ public void t(int i) {
this.datawatcher.watch(20, Integer.valueOf(i));
}
- public int t(int i) {
+ public int u(int i) {
return this.datawatcher.getInt(17 + i);
}
diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java
index 645210e4..a1fcdb1d 100644
--- a/src/main/java/net/minecraft/server/EntityWitherSkull.java
+++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java
@@ -28,7 +28,7 @@ public class EntityWitherSkull extends EntityFireball {
public float a(Explosion explosion, Block block, int i, int j, int k) {
float f = super.a(explosion, block, i, j, k);
- if (this.d() && block != Block.BEDROCK) {
+ if (this.d() && block != Block.BEDROCK && block != Block.ENDER_PORTAL && block != Block.ENDER_PORTAL_FRAME) {
f = Math.min(0.8F, f);
}
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 077a8a31..4345e003 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -13,15 +13,15 @@ public class EntityWolf extends EntityTameableAnimal {
super(world);
this.texture = "/mob/wolf.png";
this.a(0.6F, 0.8F);
- this.bI = 0.3F;
+ this.bG = 0.3F;
this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, this.d);
this.goalSelector.a(3, new PathfinderGoalLeapAtTarget(this, 0.4F));
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bI, true));
- this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bI, 10.0F, 2.0F));
- this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bI));
- this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bG, true));
+ this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bG, 10.0F, 2.0F));
+ this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bG));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(8, new PathfinderGoalBeg(this, 8.0F));
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(9, new PathfinderGoalRandomLookaround(this));
@@ -31,7 +31,7 @@ public class EntityWolf extends EntityTameableAnimal {
this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed(this, EntitySheep.class, 16.0F, 200, false));
}
- public boolean bb() {
+ public boolean be() {
return true;
}
@@ -42,7 +42,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- protected void bj() {
+ protected void bm() {
this.datawatcher.watch(18, Integer.valueOf(this.getHealth()));
}
@@ -58,7 +58,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.wolf.step", 0.15F, 1.0F);
+ this.makeSound("mob.wolf.step", 0.15F, 1.0F);
}
public void b(NBTTagCompound nbttagcompound) {
@@ -75,23 +75,23 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- protected boolean bg() {
+ protected boolean bj() {
return this.isAngry();
}
- protected String aW() {
+ protected String aY() {
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getInt(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
}
- protected String aX() {
+ protected String aZ() {
return "mob.wolf.hurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.wolf.death";
}
- protected float aV() {
+ protected float aX() {
return 0.4F;
}
@@ -112,14 +112,14 @@ public class EntityWolf extends EntityTameableAnimal {
public void j_() {
super.j_();
this.f = this.e;
- if (this.bI()) {
+ if (this.bM()) {
this.e += (1.0F - this.e) * 0.4F;
} else {
this.e += (0.0F - this.e) * 0.4F;
}
- if (this.bI()) {
- this.bJ = 10;
+ if (this.bM()) {
+ this.bH = 10;
}
if (this.G()) {
@@ -129,7 +129,7 @@ public class EntityWolf extends EntityTameableAnimal {
this.j = 0.0F;
} else if ((this.g || this.h) && this.h) {
if (this.i == 0.0F) {
- this.world.makeSound(this, "mob.wolf.shake", this.aV(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.makeSound("mob.wolf.shake", this.aX(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
this.j = this.i;
@@ -159,28 +159,32 @@ public class EntityWolf extends EntityTameableAnimal {
return this.length * 0.8F;
}
- public int bm() {
- return this.isSitting() ? 20 : super.bm();
+ public int bp() {
+ return this.isSitting() ? 20 : super.bp();
}
public boolean damageEntity(DamageSource damagesource, int i) {
- Entity entity = damagesource.getEntity();
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ Entity entity = damagesource.getEntity();
- this.d.a(false);
- if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
- i = (i + 1) / 2;
- }
+ this.d.a(false);
+ if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
+ i = (i + 1) / 2;
+ }
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, i);
+ }
}
- public boolean l(Entity entity) {
+ public boolean m(Entity entity) {
int i = this.isTamed() ? 4 : 2;
return entity.damageEntity(DamageSource.mobAttack(this), i);
}
- public boolean c(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (this.isTamed()) {
@@ -205,7 +209,7 @@ public class EntityWolf extends EntityTameableAnimal {
if (i != this.getCollarColor()) {
this.setCollarColor(i);
- if (!entityhuman.abilities.canInstantlyBuild && itemstack.count-- <= 0) {
+ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
@@ -216,7 +220,7 @@ public class EntityWolf extends EntityTameableAnimal {
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
this.d.a(!this.isSitting());
- this.bG = false;
+ this.bE = false;
this.setPathEntity((PathEntity) null);
}
} else if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
@@ -248,14 +252,14 @@ public class EntityWolf extends EntityTameableAnimal {
return true;
}
- return super.c(entityhuman);
+ return super.a(entityhuman);
}
public boolean c(ItemStack itemstack) {
return itemstack == null ? false : (!(Item.byId[itemstack.id] instanceof ItemFood) ? false : ((ItemFood) Item.byId[itemstack.id]).i());
}
- public int bs() {
+ public int bv() {
return 8;
}
@@ -281,7 +285,7 @@ public class EntityWolf extends EntityTameableAnimal {
this.datawatcher.watch(20, Byte.valueOf((byte) (i & 15)));
}
- public EntityAnimal createChild(EntityAnimal entityanimal) {
+ public EntityWolf b(EntityAgeable entityageable) {
EntityWolf entitywolf = new EntityWolf(this.world);
entitywolf.setOwnerName(this.getOwnerName());
@@ -313,7 +317,11 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- public boolean bI() {
+ public boolean bM() {
return this.datawatcher.getByte(19) == 1;
}
+
+ public EntityAgeable createChild(EntityAgeable entityageable) {
+ return this.b(entityageable);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 8960f782..84c1d115 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -11,15 +11,15 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) {
super(world);
this.texture = "/mob/zombie.png";
- this.bI = 0.23F;
+ this.bG = 0.23F;
this.getNavigation().b(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalBreakDoor(this));
- this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bI, false));
- this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bI, true));
- this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bI));
- this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bI, false));
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bG, false));
+ this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bG, true));
+ this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bG));
+ this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bG, false));
+ this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
@@ -27,8 +27,8 @@ public class EntityZombie extends EntityMonster {
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 16.0F, 0, false));
}
- public float by() {
- return super.by() * (this.isBaby() ? 1.5F : 1.0F);
+ public float bB() {
+ return super.bB() * (this.isBaby() ? 1.5F : 1.0F);
}
protected void a() {
@@ -42,8 +42,8 @@ public class EntityZombie extends EntityMonster {
return 20;
}
- public int aU() {
- int i = super.aU() + 2;
+ public int aW() {
+ int i = super.aW() + 2;
if (i > 20) {
i = 20;
@@ -52,7 +52,7 @@ public class EntityZombie extends EntityMonster {
return i;
}
- protected boolean bb() {
+ protected boolean be() {
return true;
}
@@ -73,10 +73,10 @@ public class EntityZombie extends EntityMonster {
}
public void c() {
- if (this.world.t() && !this.world.isStatic && !this.isBaby()) {
+ if (this.world.u() && !this.world.isStatic && !this.isBaby()) {
float f = this.c(1.0F);
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
+ if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.k(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
boolean flag = true;
ItemStack itemstack = this.getEquipment(4);
@@ -122,7 +122,7 @@ public class EntityZombie extends EntityMonster {
}
public int c(Entity entity) {
- ItemStack itemstack = this.bA();
+ ItemStack itemstack = this.bD();
int i = 4;
if (itemstack != null) {
@@ -132,20 +132,20 @@ public class EntityZombie extends EntityMonster {
return i;
}
- protected String aW() {
+ protected String aY() {
return "mob.zombie.say";
}
- protected String aX() {
+ protected String aZ() {
return "mob.zombie.hurt";
}
- protected String aY() {
+ protected String ba() {
return "mob.zombie.death";
}
protected void a(int i, int j, int k, int l) {
- this.world.makeSound(this, "mob.zombie.step", 0.15F, 1.0F);
+ this.makeSound("mob.zombie.step", 0.15F, 1.0F);
}
protected int getLootId() {
@@ -171,8 +171,8 @@ public class EntityZombie extends EntityMonster {
}
// CraftBukkit end
- protected void bB() {
- super.bB();
+ protected void bE() {
+ super.bE();
if (this.random.nextFloat() < (this.world.difficulty == 3 ? 0.05F : 0.01F)) {
int i = this.random.nextInt(3);
@@ -221,9 +221,9 @@ public class EntityZombie extends EntityMonster {
EntityZombie entityzombie = new EntityZombie(this.world);
- entityzombie.j(entityliving);
+ entityzombie.k(entityliving);
this.world.kill(entityliving);
- entityzombie.bD();
+ entityzombie.bG();
entityzombie.setVillager(true);
if (entityliving.isBaby()) {
entityzombie.setBaby(true);
@@ -234,16 +234,16 @@ public class EntityZombie extends EntityMonster {
}
}
- public void bD() {
+ public void bG() {
this.canPickUpLoot = this.random.nextFloat() < as[this.world.difficulty];
if (this.world.random.nextFloat() < 0.05F) {
this.setVillager(true);
}
- this.bB();
- this.bC();
+ this.bE();
+ this.bF();
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.S();
+ Calendar calendar = this.world.T();
if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) {
this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN));
@@ -252,8 +252,8 @@ public class EntityZombie extends EntityMonster {
}
}
- public boolean c(EntityHuman entityhuman) {
- ItemStack itemstack = entityhuman.bP();
+ public boolean a(EntityHuman entityhuman) {
+ ItemStack itemstack = entityhuman.bT();
if (itemstack != null && itemstack.getItem() == Item.GOLDEN_APPLE && itemstack.getData() == 0 && this.isVillager() && this.hasEffect(MobEffectList.WEAKNESS)) {
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -289,8 +289,8 @@ public class EntityZombie extends EntityMonster {
protected void p() {
EntityVillager entityvillager = new EntityVillager(this.world);
- entityvillager.j(this);
- entityvillager.bD();
+ entityvillager.k(this);
+ entityvillager.bG();
entityvillager.q();
if (this.isBaby()) {
entityvillager.setAge(-24000);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index cf2108c6..c91c9599 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -270,13 +270,17 @@ public class Explosion {
data = Block.SKULL.getDropData(this.world, i, j, k);
}
- Block.byId[l].dropNaturally(this.world, i, j, k, data, event.getYield(), 0);
+ Block block = Block.byId[l];
+
+ if (block.a(this)) {
+ block.dropNaturally(this.world, i, j, k, data, event.getYield(), 0);
+ }
// CraftBukkit end
if (this.world.setRawTypeIdAndData(i, j, k, 0, 0, this.world.isStatic)) {
this.world.applyPhysics(i, j, k, 0);
}
- Block.byId[l].wasExploded(this.world, i, j, k);
+ block.wasExploded(this.world, i, j, k);
}
}
}
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index f0b600e1..2bd3af14 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -44,7 +44,7 @@ public class FoodMetaData {
}
}
- if (this.foodLevel >= 18 && entityhuman.ca()) {
+ if (this.foodLevel >= 18 && entityhuman.ce()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason
diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java
index a25276cf..3d336296 100644
--- a/src/main/java/net/minecraft/server/IInventory.java
+++ b/src/main/java/net/minecraft/server/IInventory.java
@@ -20,7 +20,7 @@ public interface IInventory {
void update();
- boolean a(EntityHuman entityhuman);
+ boolean a_(EntityHuman entityhuman);
void startOpen();
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java
index 065b3a54..a2494017 100644
--- a/src/main/java/net/minecraft/server/InventoryCraftResult.java
+++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java
@@ -78,7 +78,7 @@ public class InventoryCraftResult implements IInventory {
public void update() {}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return true;
}
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java
index 217dd8c9..c840cde4 100644
--- a/src/main/java/net/minecraft/server/InventoryCrafting.java
+++ b/src/main/java/net/minecraft/server/InventoryCrafting.java
@@ -131,7 +131,7 @@ public class InventoryCrafting implements IInventory {
public void update() {}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return true;
}
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
index c7e3bdb6..af7c748d 100644
--- a/src/main/java/net/minecraft/server/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -87,8 +87,8 @@ public class InventoryEnderChest extends InventorySubcontainer {
return nbttaglist;
}
- public boolean a(EntityHuman entityhuman) {
- return this.a != null && !this.a.a(entityhuman) ? false : super.a(entityhuman);
+ public boolean a_(EntityHuman entityhuman) {
+ return this.a != null && !this.a.a(entityhuman) ? false : super.a_(entityhuman);
}
public void startOpen() {
diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java
index add43990..a13a5642 100644
--- a/src/main/java/net/minecraft/server/InventoryLargeChest.java
+++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java
@@ -68,6 +68,10 @@ public class InventoryLargeChest implements IInventory {
return this.left.getSize() + this.right.getSize();
}
+ public boolean a(IInventory iinventory) {
+ return this.left == iinventory || this.right == iinventory;
+ }
+
public String getName() {
return this.a;
}
@@ -101,8 +105,8 @@ public class InventoryLargeChest implements IInventory {
this.right.update();
}
- public boolean a(EntityHuman entityhuman) {
- return this.left.a(entityhuman) && this.right.a(entityhuman);
+ public boolean a_(EntityHuman entityhuman) {
+ return this.left.a_(entityhuman) && this.right.a_(entityhuman);
}
public void startOpen() {
diff --git a/src/main/java/net/minecraft/server/InventoryMerchant.java b/src/main/java/net/minecraft/server/InventoryMerchant.java
index 1e238710..99726746 100644
--- a/src/main/java/net/minecraft/server/InventoryMerchant.java
+++ b/src/main/java/net/minecraft/server/InventoryMerchant.java
@@ -123,7 +123,7 @@ public class InventoryMerchant implements IInventory {
return maxStack; // CraftBukkit
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return this.merchant.m_() == entityhuman;
}
diff --git a/src/main/java/net/minecraft/server/InventorySubcontainer.java b/src/main/java/net/minecraft/server/InventorySubcontainer.java
index c5d652dd..94218a7e 100644
--- a/src/main/java/net/minecraft/server/InventorySubcontainer.java
+++ b/src/main/java/net/minecraft/server/InventorySubcontainer.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
public abstract class InventorySubcontainer implements IInventory { // CraftBukkit - abstract
@@ -77,17 +76,13 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
public void update() {
if (this.d != null) {
- Iterator iterator = this.d.iterator();
-
- while (iterator.hasNext()) {
- IInventoryListener iinventorylistener = (IInventoryListener) iterator.next();
-
- iinventorylistener.a(this);
+ for (int i = 0; i < this.d.size(); ++i) {
+ ((IInventoryListener) this.d.get(i)).a(this);
}
}
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return true;
}
diff --git a/src/main/java/net/minecraft/server/ItemBed.java b/src/main/java/net/minecraft/server/ItemBed.java
index fe1c4a1e..bf83e2e3 100644
--- a/src/main/java/net/minecraft/server/ItemBed.java
+++ b/src/main/java/net/minecraft/server/ItemBed.java
@@ -10,7 +10,9 @@ public class ItemBed extends Item {
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
- if (l != 1) {
+ if (world.isStatic) {
+ return true;
+ } else if (l != 1) {
return false;
} else {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
@@ -38,7 +40,7 @@ public class ItemBed extends Item {
}
if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i + b0, j, k + b1, l, itemstack)) {
- if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.t(i, j - 1, k) && world.t(i + b0, j - 1, k + b1)) {
+ if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.v(i, j - 1, k) && world.v(i + b0, j - 1, k + b1)) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
world.setTypeIdAndData(i, j, k, blockbed.id, i1);
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index e3fe0132..f952b38b 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -68,11 +68,13 @@ public class ItemBlock extends Item {
if (id != this.id || world.mayPlace(this.id, i, j, k, false, l, entityhuman)) {
Block block = Block.byId[id];
+ int j1 = this.filterData(itemstack.getData());
+ int k1 = Block.byId[this.id].getPlacedData(world, i, j, k, l, f, f1, f2, j1);
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
world.suppressPhysics = true;
- world.setTypeIdAndData(i, j, k, id, this.filterData(itemstack.getData()));
+ world.setTypeIdAndData(i, j, k, id, k1);
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ);
id = world.getTypeId(i, j, k);
int data = world.getData(i, j, k);
@@ -84,12 +86,12 @@ public class ItemBlock extends Item {
}
if (world.setTypeIdAndData(i, j, k, id, data)) {
if (world.getTypeId(i, j, k) == id && Block.byId[id] != null) {
- Block.byId[id].postPlace(world, i, j, k, l, f, f1, f2);
Block.byId[id].postPlace(world, i, j, k, entityhuman);
+ Block.byId[this.id].postPlace(world, i, j, k, data);
// CraftBukkit end
}
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.b(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java
index 5f6acc37..5bd2e943 100644
--- a/src/main/java/net/minecraft/server/ItemBoat.java
+++ b/src/main/java/net/minecraft/server/ItemBoat.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.Iterator;
import java.util.List;
public class ItemBoat extends Item {
@@ -36,10 +35,11 @@ public class ItemBoat extends Item {
boolean flag = false;
float f9 = 1.0F;
List list = world.getEntities(entityhuman, entityhuman.boundingBox.a(vec3d2.c * d3, vec3d2.d * d3, vec3d2.e * d3).grow((double) f9, (double) f9, (double) f9));
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
+ int i;
+
+ for (i = 0; i < list.size(); ++i) {
+ Entity entity = (Entity) list.get(i);
if (entity.L()) {
float f10 = entity.Y();
@@ -55,24 +55,30 @@ public class ItemBoat extends Item {
return itemstack;
} else {
if (movingobjectposition.type == EnumMovingObjectType.TILE) {
- int i = movingobjectposition.b;
+ i = movingobjectposition.b;
int j = movingobjectposition.c;
int k = movingobjectposition.d;
- if (!world.isStatic) {
- // CraftBukkit start - Boat placement
- org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, i, j, k, movingobjectposition.face, itemstack);
+ // CraftBukkit start - Boat placement
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, i, j, k, movingobjectposition.face, itemstack);
+
+ if (event.isCancelled()) {
+ return itemstack;
+ }
+ // CraftBukkit end
- if (event.isCancelled()) {
- return itemstack;
- }
- // CraftBukkit end
+ if (world.getTypeId(i, j, k) == Block.SNOW.id) {
+ --j;
+ }
+
+ EntityBoat entityboat = new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.0F), (double) ((float) k + 0.5F));
- if (world.getTypeId(i, j, k) == Block.SNOW.id) {
- --j;
- }
+ if (!world.getCubes(entityboat, entityboat.boundingBox.grow(-0.1D, -0.1D, -0.1D)).isEmpty()) {
+ return itemstack;
+ }
- world.addEntity(new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.0F), (double) ((float) k + 0.5F)));
+ if (!world.isStatic) {
+ world.addEntity(entityboat);
}
if (!entityhuman.abilities.canInstantlyBuild) {
diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java
index de557ac4..6362d07e 100644
--- a/src/main/java/net/minecraft/server/ItemDoor.java
+++ b/src/main/java/net/minecraft/server/ItemDoor.java
@@ -73,8 +73,8 @@ public class ItemDoor extends Item {
b0 = 1;
}
- int i1 = (world.s(i - b0, j, k - b1) ? 1 : 0) + (world.s(i - b0, j + 1, k - b1) ? 1 : 0);
- int j1 = (world.s(i + b0, j, k + b1) ? 1 : 0) + (world.s(i + b0, j + 1, k + b1) ? 1 : 0);
+ int i1 = (world.t(i - b0, j, k - b1) ? 1 : 0) + (world.t(i - b0, j + 1, k - b1) ? 1 : 0);
+ int j1 = (world.t(i + b0, j, k + b1) ? 1 : 0) + (world.t(i + b0, j + 1, k + b1) ? 1 : 0);
boolean flag = world.getTypeId(i - b0, j, k - b1) == block.id || world.getTypeId(i - b0, j + 1, k - b1) == block.id;
boolean flag1 = world.getTypeId(i + b0, j, k + b1) == block.id || world.getTypeId(i + b0, j + 1, k + b1) == block.id;
boolean flag2 = false;
diff --git a/src/main/java/net/minecraft/server/ItemDye.java b/src/main/java/net/minecraft/server/ItemDye.java
index 744ff365..e8c1684a 100644
--- a/src/main/java/net/minecraft/server/ItemDye.java
+++ b/src/main/java/net/minecraft/server/ItemDye.java
@@ -29,6 +29,7 @@ public class ItemDye extends Item {
} else {
int i1;
int j1;
+ int k1;
if (itemstack.getData() == 15) {
i1 = world.getTypeId(i, j, k);
@@ -95,9 +96,9 @@ public class ItemDye extends Item {
if (!world.isStatic) {
--itemstack.count;
- label137:
+ label133:
for (j1 = 0; j1 < 128; ++j1) {
- int k1 = i;
+ k1 = i;
int l1 = j + 1;
int i2 = k;
@@ -105,8 +106,8 @@ public class ItemDye extends Item {
k1 += d.nextInt(3) - 1;
l1 += (d.nextInt(3) - 1) * d.nextInt(3) / 2;
i2 += d.nextInt(3) - 1;
- if (world.getTypeId(k1, l1 - 1, i2) != Block.GRASS.id || world.s(k1, l1, i2)) {
- continue label137;
+ if (world.getTypeId(k1, l1 - 1, i2) != Block.GRASS.id || world.t(k1, l1, i2)) {
+ continue label133;
}
}
@@ -157,11 +158,8 @@ public class ItemDye extends Item {
}
if (world.isEmpty(i, j, k)) {
- world.setTypeId(i, j, k, Block.COCOA.id);
- if (world.getTypeId(i, j, k) == Block.COCOA.id) {
- Block.byId[Block.COCOA.id].postPlace(world, i, j, k, l, f, f1, f2);
- }
-
+ k1 = Block.byId[Block.COCOA.id].getPlacedData(world, i, j, k, l, f, f1, f2, 0);
+ world.setTypeIdAndData(i, j, k, Block.COCOA.id, k1);
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java
index 1ce129e7..88a756d7 100644
--- a/src/main/java/net/minecraft/server/ItemFishingRod.java
+++ b/src/main/java/net/minecraft/server/ItemFishingRod.java
@@ -16,7 +16,7 @@ public class ItemFishingRod extends Item {
int i = entityhuman.hookedFish.c();
itemstack.damage(i, entityhuman);
- entityhuman.bE();
+ entityhuman.bH();
} else {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
@@ -32,7 +32,7 @@ public class ItemFishingRod extends Item {
world.addEntity(new EntityFishingHook(world, entityhuman));
}
- entityhuman.bE();
+ entityhuman.bH();
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java
index a2214886..5a3862d2 100644
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ b/src/main/java/net/minecraft/server/ItemFood.java
@@ -5,18 +5,18 @@ public class ItemFood extends Item {
public final int a;
private final int b;
private final float c;
- private final boolean ck;
- private boolean cl;
- private int cm;
+ private final boolean cl;
+ private boolean cm;
private int cn;
private int co;
- private float cp;
+ private int cp;
+ private float cq;
public ItemFood(int i, int j, float f, boolean flag) {
super(i);
this.a = 32;
this.b = j;
- this.ck = flag;
+ this.cl = flag;
this.c = f;
this.a(CreativeModeTab.h);
}
@@ -45,8 +45,8 @@ public class ItemFood extends Item {
}
protected void c(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (!world.isStatic && this.cm > 0 && world.random.nextFloat() < this.cp) {
- entityhuman.addEffect(new MobEffect(this.cm, this.cn * 20, this.co));
+ if (!world.isStatic && this.cn > 0 && world.random.nextFloat() < this.cq) {
+ entityhuman.addEffect(new MobEffect(this.cn, this.co * 20, this.cp));
}
}
@@ -59,7 +59,7 @@ public class ItemFood extends Item {
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (entityhuman.f(this.cl)) {
+ if (entityhuman.f(this.cm)) {
entityhuman.a(itemstack, this.a(itemstack));
}
@@ -75,19 +75,19 @@ public class ItemFood extends Item {
}
public boolean i() {
- return this.ck;
+ return this.cl;
}
public ItemFood a(int i, int j, int k, float f) {
- this.cm = i;
- this.cn = j;
- this.co = k;
- this.cp = f;
+ this.cn = i;
+ this.co = j;
+ this.cp = k;
+ this.cq = f;
return this;
}
public ItemFood j() {
- this.cl = true;
+ this.cm = true;
return this;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java
index 8b934c29..68756fba 100644
--- a/src/main/java/net/minecraft/server/ItemHoe.java
+++ b/src/main/java/net/minecraft/server/ItemHoe.java
@@ -26,7 +26,7 @@ public class ItemHoe extends Item {
} else {
Block block = Block.SOIL;
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
if (world.isStatic) {
return true;
} else {
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java
index 025c25a7..78ab6f26 100644
--- a/src/main/java/net/minecraft/server/ItemInWorldManager.java
+++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java
@@ -303,13 +303,13 @@ public class ItemInWorldManager {
if (this.isCreative()) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
- ItemStack itemstack = this.player.bP();
+ ItemStack itemstack = this.player.bT();
boolean flag1 = this.player.b(Block.byId[l]);
if (itemstack != null) {
itemstack.a(this.world, l, i, j, k, this.player);
if (itemstack.count == 0) {
- this.player.bQ();
+ this.player.bU();
}
}
@@ -348,7 +348,7 @@ public class ItemInWorldManager {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null;
}
- if (!entityhuman.bI()) {
+ if (!entityhuman.bM()) {
((EntityPlayer) entityhuman).updateInventory(entityhuman.defaultContainer);
}
@@ -356,7 +356,6 @@ public class ItemInWorldManager {
}
}
- // CraftBukkit - TODO: Review this code, it changed in 1.8 but I'm not sure if we need to update or not
public boolean interact(EntityHuman entityhuman, World world, ItemStack itemstack, int i, int j, int k, int l, float f, float f1, float f2) {
int i1 = world.getTypeId(i, j, k);
diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index 6769b1a3..cb8fc639 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -10,7 +10,7 @@ public class ItemMonsterEgg extends Item {
public String j(ItemStack itemstack) {
String s = ("" + LocaleI18n.get(this.getName() + ".name")).trim();
- String s1 = EntityTypes.a(itemstack.getData());
+ String s1 = EntityTypes.b(itemstack.getData());
if (s1 != null) {
s = s + " " + LocaleI18n.get("entity." + s1 + ".name");
@@ -30,7 +30,7 @@ public class ItemMonsterEgg extends Item {
k += Facing.d[l];
double d0 = 0.0D;
- if (l == 1 && i1 == Block.FENCE.id || i1 == Block.NETHER_FENCE.id) {
+ if (l == 1 && Block.byId[i1] != null && Block.byId[i1].d() == 11) {
d0 = 0.5D;
}
@@ -52,9 +52,9 @@ public class ItemMonsterEgg extends Item {
entity = EntityTypes.a(i, world);
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
entity.setPositionRotation(d0, d1, d2, world.random.nextFloat() * 360.0F, 0.0F);
- ((EntityLiving) entity).bD();
+ ((EntityLiving) entity).bG();
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
- ((EntityLiving) entity).aN();
+ ((EntityLiving) entity).aO();
}
}
diff --git a/src/main/java/net/minecraft/server/ItemReed.java b/src/main/java/net/minecraft/server/ItemReed.java
index 66c54674..97a9fb64 100644
--- a/src/main/java/net/minecraft/server/ItemReed.java
+++ b/src/main/java/net/minecraft/server/ItemReed.java
@@ -50,6 +50,7 @@ public class ItemReed extends Item {
} else {
if (world.mayPlace(this.id, i, j, k, false, l, (Entity) null)) {
Block block = Block.byId[this.id];
+ int j1 = block.getPlacedData(world, i, j, k, l, f, f1, f2, 0);
// CraftBukkit start - This executes the placement of the block
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
@@ -63,7 +64,7 @@ public class ItemReed extends Item {
* Whenever the call to 'world.setTypeId' changes we need to figure out again what to
* replace this with.
*/
- if (world.setRawTypeId(i, j, k, this.id)) { // <-- world.e does this to place the block
+ if (world.setRawTypeIdAndData(i, j, k, this.id, j1)) { // <-- world.e does this to place the block
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, replacedBlockState, clickedX, clickedY, clickedZ);
if (event.isCancelled() || !event.canBuild()) {
@@ -77,11 +78,11 @@ public class ItemReed extends Item {
// CraftBukkit end
if (world.getTypeId(i, j, k) == this.id) {
- Block.byId[this.id].postPlace(world, i, j, k, l, f, f1, f2);
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
+ Block.byId[this.id].postPlace(world, i, j, k, j1);
}
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.b(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java
index 4461dd63..1dcc3be8 100644
--- a/src/main/java/net/minecraft/server/ItemSkull.java
+++ b/src/main/java/net/minecraft/server/ItemSkull.java
@@ -65,8 +65,8 @@ public class ItemSkull extends Item {
s = itemstack.getTag().getString("SkullOwner");
}
- ((TileEntitySkull) tileentity).a(itemstack.getData(), s);
- ((TileEntitySkull) tileentity).a(i1);
+ ((TileEntitySkull) tileentity).setSkullType(itemstack.getData(), s);
+ ((TileEntitySkull) tileentity).setRotation(i1);
((BlockSkull) Block.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity);
}
diff --git a/src/main/java/net/minecraft/server/ItemStep.java b/src/main/java/net/minecraft/server/ItemStep.java
index 608a36bc..f1ab801c 100644
--- a/src/main/java/net/minecraft/server/ItemStep.java
+++ b/src/main/java/net/minecraft/server/ItemStep.java
@@ -75,7 +75,7 @@ public class ItemStep extends ItemBlock {
if (i1 == this.b.id && k1 == itemstack.getData()) {
if (world.b(this.c.e(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1)) {
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getName(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f797565d..132f3e76 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -26,7 +26,7 @@ import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.world.WorldSaveEvent;
// CraftBukkit end
-public abstract class MinecraftServer implements Runnable, IMojangStatistics, ICommandListener {
+public abstract class MinecraftServer implements ICommandListener, Runnable, IMojangStatistics {
public static Logger log = Logger.getLogger("Minecraft");
private static MinecraftServer l = null;
@@ -363,12 +363,10 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
log.info("Saving worlds");
this.saveChunks(false);
- /* CraftBukkit start - handled in saveChunks
- WorldServer[] aworldserver = this.worldServer;
- int i = aworldserver.length;
- for (int j = 0; j < i; ++j) {
- WorldServer worldserver = aworldserver[j];
+ /* CraftBukkit start - handled in saveChunks
+ for (int i = 0; i < this.worldServer.length; ++i) {
+ WorldServer worldserver = this.worldServer[i];
worldserver.saveLevel();
}
@@ -543,7 +541,9 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
}
}
- for (int i = 0; i < this.worlds.size(); ++i) {
+ int i;
+
+ for (i = 0; i < this.worlds.size(); ++i) {
long j = System.nanoTime();
// if (i == 0 || this.getAllowNether()) {
@@ -556,14 +556,31 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
/* Drop global time updates
if (this.ticks % 20 == 0) {
this.methodProfiler.a("timeSync");
- this.t.a(new Packet4UpdateTime(worldserver.getTime(), worldserver.F()), worldserver.worldProvider.dimension);
+ this.t.a(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()), worldserver.worldProvider.dimension);
this.methodProfiler.b();
}
// CraftBukkit end */
this.methodProfiler.a("tick");
- worldserver.doTick();
- worldserver.tickEntities();
+
+ CrashReport crashreport;
+
+ try {
+ worldserver.doTick();
+ } catch (Throwable throwable) {
+ crashreport = CrashReport.a(throwable, "Exception ticking world");
+ worldserver.a(crashreport);
+ throw new ReportedException(crashreport);
+ }
+
+ try {
+ worldserver.tickEntities();
+ } catch (Throwable throwable1) {
+ crashreport = CrashReport.a(throwable1, "Exception ticking world entities");
+ worldserver.a(crashreport);
+ throw new ReportedException(crashreport);
+ }
+
this.methodProfiler.b();
this.methodProfiler.a("tracker");
worldserver.getTracker().updatePlayers();
@@ -579,12 +596,9 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
this.methodProfiler.c("players");
this.t.tick();
this.methodProfiler.c("tickables");
- Iterator iterator = this.p.iterator();
-
- while (iterator.hasNext()) {
- IUpdatePlayerListBox iupdateplayerlistbox = (IUpdatePlayerListBox) iterator.next();
- iupdateplayerlistbox.a();
+ for (i = 0; i < this.p.size(); ++i) {
+ ((IUpdatePlayerListBox) this.p.get(i)).a();
}
this.methodProfiler.b();
@@ -741,7 +755,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
}
public String getVersion() {
- return "1.4.2";
+ return "1.4.4";
}
public int y() {
@@ -829,22 +843,13 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
}
public CrashReport b(CrashReport crashreport) {
- crashreport.a("Is Modded", (Callable) (new CrashReportModded(this)));
- crashreport.a("Profiler Position", (Callable) (new CrashReportProfilerPosition(this)));
- if (this.t != null) {
- crashreport.a("Player Count", (Callable) (new CrashReportPlayerCount(this)));
+ crashreport.g().a("Profiler Position", (Callable) (new CrashReportProfilerPosition(this)));
+ if (this.worlds != null && this.worlds.size() > 0 && this.worlds.get(0) != null) {
+ crashreport.g().a("Vec3 Pool Size", (Callable) (new CrashReportVec3DPoolSize(this)));
}
- // CraftBukkit start
- if (this.worlds != null) {
- for (int j = 0; j < this.worlds.size(); ++j) {
- WorldServer worldserver = this.worlds.get(j);
- // CraftBukkit end
-
- if (worldserver != null) {
- worldserver.a(crashreport);
- }
- }
+ if (this.t != null) {
+ crashreport.g().a("Player Count", (Callable) (new CrashReportPlayerCount(this)));
}
return crashreport;
@@ -1052,7 +1057,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC
mojangstatisticsgenerator.a("world[" + i + "][generator_name]", worlddata.getType().name());
mojangstatisticsgenerator.a("world[" + i + "][generator_version]", Integer.valueOf(worlddata.getType().getVersion()));
mojangstatisticsgenerator.a("world[" + i + "][height]", Integer.valueOf(this.D));
- mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.H().getLoadedChunks()));
+ mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.I().getLoadedChunks()));
++i;
// } // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java
index d8846033..2c4563d4 100644
--- a/src/main/java/net/minecraft/server/MobEffectList.java
+++ b/src/main/java/net/minecraft/server/MobEffectList.java
@@ -98,8 +98,8 @@ public class MobEffectList {
// CraftBukkit end
} else if (this.id == HUNGER.id && entityliving instanceof EntityHuman) {
((EntityHuman) entityliving).j(0.025F * (float) (i + 1));
- } else if ((this.id != HEAL.id || entityliving.bx()) && (this.id != HARM.id || !entityliving.bx())) {
- if (this.id == HARM.id && !entityliving.bx() || this.id == HEAL.id && entityliving.bx()) {
+ } else if ((this.id != HEAL.id || entityliving.bA()) && (this.id != HARM.id || !entityliving.bA())) {
+ if (this.id == HARM.id && !entityliving.bA() || this.id == HEAL.id && entityliving.bA()) {
// CraftBukkit start
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, entityliving, EntityDamageEvent.DamageCause.MAGIC, 6 << i);
@@ -122,8 +122,8 @@ public class MobEffectList {
// CraftBukkit end
int j;
- if ((this.id != HEAL.id || entityliving1.bx()) && (this.id != HARM.id || !entityliving1.bx())) {
- if (this.id == HARM.id && !entityliving1.bx() || this.id == HEAL.id && entityliving1.bx()) {
+ if ((this.id != HEAL.id || entityliving1.bA()) && (this.id != HARM.id || !entityliving1.bA())) {
+ if (this.id == HARM.id && !entityliving1.bA() || this.id == HEAL.id && entityliving1.bA()) {
j = (int) (d0 * (double) (6 << i) + 0.5D);
if (entityliving == null) {
entityliving1.damageEntity(DamageSource.MAGIC, j);
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index 2bc1d6c7..0b9beb7d 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -221,11 +221,16 @@ public class NBTTagCompound extends NBTBase {
}
private CrashReport a(String s, int i, ClassCastException classcastexception) {
- CrashReport crashreport = new CrashReport("Reading NBT data", classcastexception);
+ CrashReport crashreport = CrashReport.a(classcastexception, "Reading NBT data");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Corrupt NBT tag", 1);
+
+ crashreportsystemdetails.a("Tag type found", (Callable) (new CrashReportCorruptNBTTag(this, s)));
+ crashreportsystemdetails.a("Tag type expected", (Callable) (new CrashReportCorruptNBTTag2(this, i)));
+ crashreportsystemdetails.a("Tag name", s);
+ if (this.getName() != null && this.getName().length() > 0) {
+ crashreportsystemdetails.a("Tag parent", this.getName());
+ }
- crashreport.a("Corrupt tag type found", (Callable) (new CrashReportCorruptNBTTag(this, s)));
- crashreport.a("Corrupt tag type expected", (Callable) (new CrashReportCorruptNBTTag2(this, i)));
- crashreport.a("Corrupt tag name", s);
return crashreport;
}
diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java
index f46a83ad..977c89c3 100644
--- a/src/main/java/net/minecraft/server/NetLoginHandler.java
+++ b/src/main/java/net/minecraft/server/NetLoginHandler.java
@@ -73,8 +73,8 @@ public class NetLoginHandler extends NetHandler {
} else {
PublicKey publickey = this.server.F().getPublic();
- if (packet2handshake.d() != 47) {
- if (packet2handshake.d() > 47) {
+ if (packet2handshake.d() != 49) {
+ if (packet2handshake.d() > 49) {
this.disconnect("Outdated server!");
} else {
this.disconnect("Outdated client!");
@@ -151,7 +151,7 @@ public class NetLoginHandler extends NetHandler {
if (packet254getinfo.a == 1) {
// CraftBukkit start - fix decompile issues, don't create a list from an array
- Object[] list = new Object[] { 1, 47, this.server.getVersion(), pingEvent.getMotd(), serverconfigurationmanagerabstract.getPlayerCount(), pingEvent.getMaxPlayers() };
+ Object[] list = new Object[] { 1, 49, this.server.getVersion(), pingEvent.getMotd(), serverconfigurationmanagerabstract.getPlayerCount(), pingEvent.getMaxPlayers() };
for (Object object : list) {
if (s == null) {
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 3374639b..7f672c6c 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -10,6 +10,7 @@ import java.util.logging.Logger;
// CraftBukkit start
import java.io.UnsupportedEncodingException;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.logging.Level;
import java.util.HashSet;
@@ -51,7 +52,7 @@ public class NetServerHandler extends NetHandler {
public INetworkManager networkManager;
public boolean disconnected = false;
private MinecraftServer minecraftServer;
- public EntityPlayer player; // CraftBukkit - private -> public
+ public EntityPlayer player;
private int f;
private int g;
private boolean h;
@@ -59,7 +60,7 @@ public class NetServerHandler extends NetHandler {
private long j;
private static Random k = new Random();
private long l;
- private int m = 0;
+ private volatile int m = 0; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(NetServerHandler.class, "m"); // CraftBukkit - multithreaded field
private int x = 0;
private double y;
private double z;
@@ -117,22 +118,20 @@ public class NetServerHandler extends NetHandler {
this.sendPacket(new Packet0KeepAlive(this.i));
}
+ // CraftBukkit start
+ for (int spam; (spam = this.m) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ;
+ /* Use thread-safe field access instead
if (this.m > 0) {
--this.m;
}
+ */
+ // CraftBukkit end
if (this.x > 0) {
--this.x;
}
this.minecraftServer.methodProfiler.c("playerTick");
- if (!this.h && !this.player.viewingCredits) {
- this.player.g();
- if (this.player.vehicle == null) {
- this.player.setPositionRotation(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
- }
- }
-
this.minecraftServer.methodProfiler.b();
}
@@ -497,14 +496,14 @@ public class NetServerHandler extends NetHandler {
}
}
// CraftBukkit end
- this.player.bN();
+ this.player.bR();
} else if (packet14blockdig.e == 5) {
- this.player.bK();
+ this.player.bO();
} else {
boolean flag = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getServerConfigurationManager().getOPs().isEmpty() || this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || this.minecraftServer.I();
boolean flag1 = false;
- if (packet14blockdig.e == 0) {
+ if (packet14blockdig.e == 0 || packet14blockdig.e == 1) { // CraftBukkit - check cancelled
flag1 = true;
}
@@ -559,6 +558,11 @@ public class NetServerHandler extends NetHandler {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
}
} else if (packet14blockdig.e == 3) {
+ // CraftBukkit start
+ logger.warning(this.player.name + " is using a modded client!");
+ this.disconnect("Nope!");
+ return;
+ /*
double d4 = this.player.locX - ((double) i + 0.5D);
double d5 = this.player.locY - ((double) j + 0.5D);
double d6 = this.player.locZ - ((double) k + 0.5D);
@@ -567,6 +571,7 @@ public class NetServerHandler extends NetHandler {
if (d7 < 256.0D) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
}
+ // CraftBukkit end */
}
}
}
@@ -753,10 +758,6 @@ public class NetServerHandler extends NetHandler {
} else if (packet instanceof Packet6SpawnPosition) {
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
- } else if (packet.lowPriority == true) {
- // Reroute all low-priority packets through to compression thread.
- org.bukkit.craftbukkit.ChunkCompressionThread.sendPacket(this.player, packet);
- return;
}
// CraftBukkit end
@@ -786,13 +787,13 @@ public class NetServerHandler extends NetHandler {
String s = packet3chat.message;
if (s.length() > 100) {
- this.disconnect("Chat message too long");
+ this.networkManager.a("Chat message too long"); // CraftBukkit disconnect client asynchronously
} else {
s = s.trim();
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
- this.disconnect("Illegal characters in chat");
+ this.networkManager.a("Illegal characters in chat"); // CraftBukkit disconnect client asynchronously
return;
}
}
@@ -804,6 +805,11 @@ public class NetServerHandler extends NetHandler {
}
this.chat(s, packet3chat.a_());
+
+ // This section stays because it is only applicable to packets
+ if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getServerConfigurationManager().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
+ this.networkManager.a("disconnect.spam"); // CraftBukkit disconnect client asynchronously
+ }
}
}
}
@@ -884,11 +890,6 @@ public class NetServerHandler extends NetHandler {
}
}
}
-
- this.m += 20;
- if (this.m > 200 && !this.minecraftServer.getServerConfigurationManager().isOp(this.player.name)) {
- this.disconnect("disconnect.spam");
- }
}
return;
@@ -957,7 +958,7 @@ public class NetServerHandler extends NetHandler {
if (event.isCancelled()) return;
// CraftBukkit end
- this.player.bE();
+ this.player.bH();
}
}
@@ -1016,7 +1017,7 @@ public class NetServerHandler extends NetHandler {
Entity entity = worldserver.getEntity(packet7useentity.target);
if (entity != null) {
- boolean flag = this.player.m(entity);
+ boolean flag = this.player.n(entity);
double d0 = 36.0D;
if (!flag) {
@@ -1034,7 +1035,7 @@ public class NetServerHandler extends NetHandler {
return;
}
// CraftBukkit end
- this.player.o(entity);
+ this.player.p(entity);
// CraftBukkit start - update the client if the item is an infinite one
if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer);
@@ -1123,7 +1124,7 @@ public class NetServerHandler extends NetHandler {
public void a(Packet102WindowClick packet102windowclick) {
if (this.player.dead) return; // CraftBukkit
- if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.b(this.player)) {
+ if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
// CraftBukkit start - fire InventoryClickEvent
InventoryView inventory = this.player.activeContainer.getBukkitView();
SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot);
@@ -1182,8 +1183,8 @@ public class NetServerHandler extends NetHandler {
this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList();
- for (int i = 0; i < this.player.activeContainer.b.size(); ++i) {
- arraylist.add(((Slot) this.player.activeContainer.b.get(i)).getItem());
+ for (int i = 0; i < this.player.activeContainer.c.size(); ++i) {
+ arraylist.add(((Slot) this.player.activeContainer.c.get(i)).getItem());
}
this.player.a(this.player.activeContainer, arraylist);
@@ -1197,7 +1198,7 @@ public class NetServerHandler extends NetHandler {
}
public void a(Packet108ButtonClick packet108buttonclick) {
- if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.b(this.player)) {
+ if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b);
this.player.activeContainer.b();
}
@@ -1273,7 +1274,7 @@ public class NetServerHandler extends NetHandler {
if (this.player.dead) return; // CraftBukkit
Short oshort = (Short) this.s.get(this.player.activeContainer.windowId);
- if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.b(this.player)) {
+ if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a(this.player, true);
}
}
@@ -1407,7 +1408,7 @@ public class NetServerHandler extends NetHandler {
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BOOK_AND_QUILL.id && itemstack.id == itemstack1.id) {
- itemstack1.a("pages", itemstack.getTag().getList("pages")); // CraftBukkit
+ itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages"));
}
} catch (Exception exception) {
exception.printStackTrace();
@@ -1422,11 +1423,9 @@ public class NetServerHandler extends NetHandler {
itemstack1 = this.player.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.WRITTEN_BOOK.id && itemstack1.id == Item.BOOK_AND_QUILL.id) {
- // CraftBukkit start
- itemstack1.a("author", new NBTTagString("author", this.player.name));
- itemstack1.a("title", new NBTTagString("title", itemstack.getTag().getString("title")));
- itemstack1.a("pages", itemstack.getTag().getList("pages"));
- // CraftBukkit end
+ itemstack1.a("author", (NBTBase) (new NBTTagString("author", this.player.name)));
+ itemstack1.a("title", (NBTBase) (new NBTTagString("title", itemstack.getTag().getString("title"))));
+ itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages"));
itemstack1.id = Item.WRITTEN_BOOK.id;
}
} catch (Exception exception1) {
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 090060a1..25c27665 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -3,6 +3,7 @@ package net.minecraft.server;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import java.io.InputStream;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
@@ -78,11 +79,7 @@ public class NetworkManager implements INetworkManager {
synchronized (this.h) {
this.y += packet.a() + 1;
- if (packet.lowPriority) {
- this.lowPriorityQueue.add(packet);
- } else {
- this.highPriorityQueue.add(packet);
- }
+ this.highPriorityQueue.add(packet);
}
}
}
@@ -95,7 +92,7 @@ public class NetworkManager implements INetworkManager {
int i;
int[] aint;
- if (this.e == 0 || System.currentTimeMillis() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.e) {
+ if (this.e == 0 || !this.highPriorityQueue.isEmpty() && System.currentTimeMillis() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.e) {
packet = this.a(false);
if (packet != null) {
Packet.a(packet, this.output);
@@ -244,14 +241,25 @@ public class NetworkManager implements INetworkManager {
try {
this.input.close();
- this.input = null;
+ } catch (Throwable throwable) {
+ ;
+ }
+
+ try {
this.output.close();
- this.output = null;
+ } catch (Throwable throwable1) {
+ ;
+ }
+
+ try {
this.socket.close();
- this.socket = null;
- } catch (Throwable throwable) {
+ } catch (Throwable throwable2) {
;
}
+
+ this.input = null;
+ this.output = null;
+ this.socket = null;
}
}
@@ -303,13 +311,17 @@ public class NetworkManager implements INetworkManager {
private void j() throws IOException { // CraftBukkit - throws IOException
this.f = true;
- this.input = new DataInputStream(MinecraftEncryption.a(this.z, this.socket.getInputStream()));
+ InputStream inputstream = this.socket.getInputStream();
+
+ this.input = new DataInputStream(MinecraftEncryption.a(this.z, inputstream));
}
private void k() throws IOException { // CraftBukkit - throws IOException
this.output.flush();
this.g = true;
- this.output = new DataOutputStream(new BufferedOutputStream(MinecraftEncryption.a(this.z, this.socket.getOutputStream()), 5120));
+ BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(MinecraftEncryption.a(this.z, this.socket.getOutputStream()), 5120);
+
+ this.output = new DataOutputStream(bufferedoutputstream);
}
public int e() {
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
index 0533048e..5f7c930f 100644
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
+++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java
@@ -13,13 +13,19 @@ public class Packet51MapChunk extends Packet {
public int b;
public int c;
public int d;
- // CraftBukkit start - private -> public
- public byte[] buffer;
- public byte[] inflatedBuffer;
- public boolean e;
- public int size;
- // CraftBukkit end
+ private byte[] buffer;
+ private byte[] inflatedBuffer;
+ private boolean e;
+ private int size;
private static byte[] buildBuffer = new byte[196864];
+ // CraftBukkit start
+ static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() {
+ @Override
+ protected Deflater initialValue() {
+ return new Deflater(Deflater.DEFAULT_COMPRESSION);
+ }
+ };
+ // CraftBukkit end
public Packet51MapChunk() {
this.lowPriority = true;
@@ -36,7 +42,7 @@ public class Packet51MapChunk extends Packet {
this.d = chunkmap.c;
this.c = chunkmap.b;
- /* CraftBukkit start - compression moved to new thread
+ /* CraftBukkit start - moved to compress()
try {
this.inflatedBuffer = chunkmap.a;
deflater.setInput(chunkmap.a, 0, chunkmap.a.length);
@@ -48,9 +54,25 @@ public class Packet51MapChunk extends Packet {
}
*/
this.inflatedBuffer = chunkmap.a;
- // CraftBukkit end
}
+ // Add compression method
+ public void compress() {
+ if (this.buffer != null) {
+ return;
+ }
+
+ Deflater deflater = localDeflater.get();
+ deflater.reset();
+ deflater.setInput(this.inflatedBuffer);
+ deflater.finish();
+
+ this.buffer = new byte[this.inflatedBuffer.length + 100];
+
+ this.size = deflater.deflate(this.buffer);
+ }
+ // CraftBukkit end
+
public void a(DataInputStream datainputstream) throws IOException {
this.a = datainputstream.readInt();
this.b = datainputstream.readInt();
@@ -91,6 +113,7 @@ public class Packet51MapChunk extends Packet {
}
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ compress(); // CraftBukkit
dataoutputstream.writeInt(this.a);
dataoutputstream.writeInt(this.b);
dataoutputstream.writeBoolean(this.e);
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
index 014bdac1..f5aaea66 100644
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
@@ -14,11 +14,17 @@ public class Packet56MapChunkBulk extends Packet {
private int[] d;
public int[] a;
public int[] b;
- // CraftBukkit start - private -> public
- public byte[] buffer;
+ private byte[] buffer;
private byte[][] inflatedBuffers;
- public int size;
- public byte[] buildBuffer = new byte[0]; // - static
+ private int size;
+ private byte[] buildBuffer = new byte[0]; // CraftBukkit - remove static
+ // CraftBukkit start
+ static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() {
+ @Override
+ protected Deflater initialValue() {
+ return new Deflater(Deflater.BEST_COMPRESSION);
+ }
+ };
// CraftBukkit end
public Packet56MapChunkBulk() {}
@@ -53,7 +59,7 @@ public class Packet56MapChunkBulk extends Packet {
this.inflatedBuffers[k] = chunkmap.a;
}
- /* CraftBukkit start
+ /* CraftBukkit start - moved to compress()
Deflater deflater = new Deflater(-1);
try {
@@ -65,10 +71,24 @@ public class Packet56MapChunkBulk extends Packet {
deflater.end();
}
*/
- this.lowPriority = true;
- // CraftBukkit end
}
+ // Add compression method
+ public void compress() {
+ if (this.buffer != null) {
+ return;
+ }
+
+ Deflater deflater = localDeflater.get();
+ deflater.reset();
+ deflater.setInput(this.buildBuffer);
+ deflater.finish();
+
+ this.buffer = new byte[this.buildBuffer.length + 100];
+ this.size = deflater.deflate(this.buffer);
+ }
+ // CraftBukkit end
+
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
short short1 = datainputstream.readShort();
@@ -119,6 +139,7 @@ public class Packet56MapChunkBulk extends Packet {
}
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ compress(); // CraftBukkit
dataoutputstream.writeShort(this.c.length);
dataoutputstream.writeInt(this.size);
dataoutputstream.write(this.buffer, 0, this.size);
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
index 66431fb8..bf496af8 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
@@ -22,12 +22,13 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
this.e = f;
this.g = i;
this.h = f1 * f1;
+ this.d = i / 2;
this.a(3);
}
}
public boolean a() {
- EntityLiving entityliving = this.a.aF();
+ EntityLiving entityliving = this.a.aG();
if (entityliving == null) {
return false;
@@ -48,11 +49,12 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
// CraftBukkit end
this.c = null;
this.f = 0;
+ this.d = this.g / 2;
}
public void e() {
double d0 = this.a.e(this.c.locX, this.c.boundingBox.b, this.c.locZ);
- boolean flag = this.a.az().canSee(this.c);
+ boolean flag = this.a.aA().canSee(this.c);
if (flag) {
++this.f;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
index 930f2cce..c4efd2b8 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
@@ -31,7 +31,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
public void e() {
super.e();
- if (this.a.aA().nextInt(20) == 0) {
+ if (this.a.aB().nextInt(20) == 0) {
this.a.world.triggerEffect(1010, this.b, this.c, this.d, 0);
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index 3e96936c..d5ab4ce7 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
@@ -38,7 +38,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public void e() {
- this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bm());
+ this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bp());
this.d.getNavigation().a((EntityLiving) this.e, this.c);
++this.b;
if (this.b == 60) {
@@ -65,17 +65,17 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
private void g() {
- EntityAnimal entityanimal = this.d.createChild(this.e);
+ EntityAgeable entityageable = this.d.createChild(this.e);
- if (entityanimal != null) {
+ if (entityageable != null) {
this.d.setAge(6000);
this.e.setAge(6000);
this.d.s();
this.e.s();
- entityanimal.setAge(-24000);
- entityanimal.setPositionRotation(this.d.locX, this.d.locY, this.d.locZ, 0.0F, 0.0F);
- this.a.addEntity(entityanimal, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
- Random random = this.d.aA();
+ entityageable.setAge(-24000);
+ entityageable.setPositionRotation(this.d.locX, this.d.locY, this.d.locZ, 0.0F, 0.0F);
+ this.a.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
+ Random random = this.d.aB();
for (int i = 0; i < 7; ++i) {
double d0 = random.nextGaussian() * 0.02D;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
index 510d199b..68ad1063 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
@@ -18,7 +18,7 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
}
public boolean a() {
- if (this.b.aA().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
+ if (this.b.aB().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
return false;
} else {
int i = MathHelper.floor(this.b.locX);
@@ -59,7 +59,7 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.b.getBukkitEntity(), this.b.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) {
this.c.triggerEffect(2001, i, j, k, Block.LONG_GRASS.id + 4096);
this.c.setTypeId(i, j, k, 0);
- this.b.aG();
+ this.b.aH();
}
// CraftBukkit end
} else if (this.c.getTypeId(i, j - 1, k) == Block.GRASS.id) {
@@ -67,7 +67,7 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.b.getBukkitEntity(), this.b.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) {
this.c.triggerEffect(2001, i, j - 1, k, Block.GRASS.id);
this.c.setTypeId(i, j - 1, k, Block.DIRT.id);
- this.b.aG();
+ this.b.aH();
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
index 5c150b05..6cec26b1 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
@@ -29,7 +29,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
}
public boolean a() {
- EntityLiving entityliving = this.b.aF();
+ EntityLiving entityliving = this.b.aG();
if (entityliving == null) {
return false;
@@ -43,7 +43,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
}
public boolean b() {
- EntityLiving entityliving = this.b.aF();
+ EntityLiving entityliving = this.b.aG();
return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.getNavigation().f() : this.b.e(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ))));
}
@@ -65,8 +65,8 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
public void e() {
this.b.getControllerLook().a(this.c, 30.0F, 30.0F);
- if ((this.f || this.b.az().canSee(this.c)) && --this.i <= 0) {
- this.i = 4 + this.b.aA().nextInt(7);
+ if ((this.f || this.b.aA().canSee(this.c)) && --this.i <= 0) {
+ this.i = 4 + this.b.aB().nextInt(7);
this.b.getNavigation().a(this.c, this.e);
}
@@ -76,11 +76,11 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
if (this.b.e(this.c.locX, this.c.boundingBox.b, this.c.locZ) <= d0) {
if (this.d <= 0) {
this.d = 20;
- if (this.b.bA() != null) {
- this.b.bE();
+ if (this.b.bD() != null) {
+ this.b.bH();
}
- this.b.l(this.c);
+ this.b.m(this.c);
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index a1870730..28608784 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -24,6 +24,24 @@ public class PathfinderGoalSelector {
this.a.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal));
}
+ public void a(PathfinderGoal pathfindergoal) {
+ Iterator iterator = this.a.iterator();
+
+ while (iterator.hasNext()) {
+ PathfinderGoalSelectorItem pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
+ PathfinderGoal pathfindergoal1 = pathfindergoalselectoritem.a;
+
+ if (pathfindergoal1 == pathfindergoal) {
+ if (this.b.contains(pathfindergoalselectoritem)) {
+ pathfindergoal1.d();
+ this.b.remove(pathfindergoalselectoritem);
+ }
+
+ iterator.remove();
+ }
+ }
+ }
+
public void a() {
// ArrayList arraylist = new ArrayList(); // CraftBukkit - remove usage
Iterator iterator;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
index 0e82447c..2eb04228 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
@@ -27,7 +27,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
public boolean b() {
- EntityLiving entityliving = this.d.aF();
+ EntityLiving entityliving = this.d.aG();
if (entityliving == null) {
return false;
@@ -37,7 +37,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
return false;
} else {
if (this.f) {
- if (this.d.az().canSee(entityliving)) {
+ if (this.d.aA().canSee(entityliving)) {
this.g = 0;
} else if (++this.g > 60) {
return false;
@@ -82,7 +82,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
if (!this.d.e(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
return false;
- } else if (this.f && !this.d.az().canSee(entityliving)) {
+ } else if (this.f && !this.d.aA().canSee(entityliving)) {
return false;
} else {
if (this.a) {
@@ -136,7 +136,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
private boolean a(EntityLiving entityliving) {
- this.c = 10 + this.d.aA().nextInt(5);
+ this.c = 10 + this.d.aB().nextInt(5);
PathEntity pathentity = this.d.getNavigation().a(entityliving);
if (pathentity == null) {
diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java
index fcbd67c4..ba0797bf 100644
--- a/src/main/java/net/minecraft/server/PlayerInstance.java
+++ b/src/main/java/net/minecraft/server/PlayerInstance.java
@@ -1,7 +1,6 @@
package net.minecraft.server;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
class PlayerInstance {
@@ -70,10 +69,8 @@ class PlayerInstance {
}
public void sendAll(Packet packet) {
- Iterator iterator = this.b.iterator();
-
- while (iterator.hasNext()) {
- EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+ for (int i = 0; i < this.b.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) {
entityplayer.netServerHandler.sendPacket(packet);
@@ -107,12 +104,9 @@ class PlayerInstance {
if ((this.f & 1 << k) != 0) {
l = k << 4;
List list = PlayerManager.a(this.playerManager).getTileEntities(i, l, j, i + 16, l + 16, j + 16);
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- TileEntity tileentity = (TileEntity) iterator.next();
- this.sendTileEntity(tileentity);
+ for (int i1 = 0; i1 < list.size(); ++i1) {
+ this.sendTileEntity((TileEntity) list.get(i1));
}
}
}
@@ -137,7 +131,7 @@ class PlayerInstance {
private void sendTileEntity(TileEntity tileentity) {
if (tileentity != null) {
- Packet packet = tileentity.l();
+ Packet packet = tileentity.getUpdatePacket();
if (packet != null) {
this.sendAll(packet);
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
index 5b65b710..d63a4a4a 100644
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
@@ -403,16 +403,12 @@ public class PlayerInventory implements IInventory {
public int k() {
int i = 0;
- ItemStack[] aitemstack = this.armor;
- int j = aitemstack.length;
- for (int k = 0; k < j; ++k) {
- ItemStack itemstack = aitemstack[k];
-
- if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
- int l = ((ItemArmor) itemstack.getItem()).b;
+ for (int j = 0; j < this.armor.length; ++j) {
+ if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
+ int k = ((ItemArmor) this.armor[j].getItem()).b;
- i += l;
+ i += k;
}
}
@@ -470,30 +466,21 @@ public class PlayerInventory implements IInventory {
return this.g;
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return this.player.dead ? false : entityhuman.e(this.player) <= 64.0D;
}
public boolean c(ItemStack itemstack) {
- ItemStack[] aitemstack = this.armor;
- int i = aitemstack.length;
-
- int j;
- ItemStack itemstack1;
+ int i;
- for (j = 0; j < i; ++j) {
- itemstack1 = aitemstack[j];
- if (itemstack1 != null && itemstack1.doMaterialsMatch(itemstack)) {
+ for (i = 0; i < this.armor.length; ++i) {
+ if (this.armor[i] != null && this.armor[i].doMaterialsMatch(itemstack)) {
return true;
}
}
- aitemstack = this.items;
- i = aitemstack.length;
-
- for (j = 0; j < i; ++j) {
- itemstack1 = aitemstack[j];
- if (itemstack1 != null && itemstack1.doMaterialsMatch(itemstack)) {
+ for (i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null && this.items[i].doMaterialsMatch(itemstack)) {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java
index 51e5ac51..2b4f8849 100644
--- a/src/main/java/net/minecraft/server/PlayerManager.java
+++ b/src/main/java/net/minecraft/server/PlayerManager.java
@@ -1,10 +1,12 @@
package net.minecraft.server;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import java.util.Queue; // CraftBukkit
+// CraftBukkit start
+import java.util.Queue;
+import java.util.Iterator;
+// CraftBukkit end
public class PlayerManager {
@@ -32,15 +34,15 @@ public class PlayerManager {
}
public void flush() {
+ // CraftBukkit start - use iterator
Iterator iterator = this.d.iterator();
while (iterator.hasNext()) {
PlayerInstance playerinstance = (PlayerInstance) iterator.next();
-
playerinstance.a();
-
- iterator.remove(); // CraftBukkit - remove to insure we are the consumer
+ iterator.remove();
}
+ // CraftBukkit end
// this.d.clear(); // CraftBukkit - removals are already covered
if (this.managedPlayers.isEmpty()) {
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index d385b0a3..e7df5c20 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -1,5 +1,8 @@
package net.minecraft.server;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import java.util.Random;
// CraftBukkit start
@@ -14,15 +17,21 @@ import java.util.Random;
public class PortalTravelAgent {
- private Random a = new Random();
+ private final WorldServer a;
+ private final Random b;
+ private final LongHashMap c = new LongHashMap();
+ private final List d = new ArrayList();
- public PortalTravelAgent() {}
+ public PortalTravelAgent(WorldServer worldserver) {
+ this.a = worldserver;
+ this.b = new Random(worldserver.getSeed());
+ }
- public void a(World world, Entity entity, double d0, double d1, double d2, float f) {
- if (world.worldProvider.dimension != 1) {
- if (!this.b(world, entity, d0, d1, d2, f)) {
- this.a(world, entity);
- this.b(world, entity, d0, d1, d2, f);
+ public void a(Entity entity, double d0, double d1, double d2, float f) {
+ if (this.a.worldProvider.dimension != 1) {
+ if (!this.b(entity, d0, d1, d2, f)) {
+ this.a(entity);
+ this.b(entity, d0, d1, d2, f);
}
} else {
int i = MathHelper.floor(entity.locX);
@@ -39,7 +48,7 @@ public class PortalTravelAgent {
int i2 = k + i1 * b1 - l * b0;
boolean flag = j1 < 0;
- world.setTypeId(k1, l1, i2, flag ? Block.OBSIDIAN.id : 0);
+ this.a.setTypeId(k1, l1, i2, flag ? Block.OBSIDIAN.id : 0);
}
}
}
@@ -49,7 +58,7 @@ public class PortalTravelAgent {
}
}
- public boolean b(World world, Entity entity, double d0, double d1, double d2, float f) {
+ public boolean b(Entity entity, double d0, double d1, double d2, float f) {
short short1 = 128;
double d3 = -1.0D;
int i = 0;
@@ -57,113 +66,128 @@ public class PortalTravelAgent {
int k = 0;
int l = MathHelper.floor(entity.locX);
int i1 = MathHelper.floor(entity.locZ);
-
- int j1;
+ long j1 = ChunkCoordIntPair.a(l, i1);
+ boolean flag = true;
double d4;
+ int k1;
+
+ if (this.c.contains(j1)) {
+ ChunkCoordinatesPortal chunkcoordinatesportal = (ChunkCoordinatesPortal) this.c.getEntry(j1);
- for (j1 = l - short1; j1 <= l + short1; ++j1) {
- double d5 = (double) j1 + 0.5D - entity.locX;
+ d3 = 0.0D;
+ i = chunkcoordinatesportal.x;
+ j = chunkcoordinatesportal.y;
+ k = chunkcoordinatesportal.z;
+ chunkcoordinatesportal.d = this.a.getTime();
+ flag = false;
+ } else {
+ for (k1 = l - short1; k1 <= l + short1; ++k1) {
+ double d5 = (double) k1 + 0.5D - entity.locX;
- for (int k1 = i1 - short1; k1 <= i1 + short1; ++k1) {
- double d6 = (double) k1 + 0.5D - entity.locZ;
+ for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) {
+ double d6 = (double) l1 + 0.5D - entity.locZ;
- for (int l1 = world.O() - 1; l1 >= 0; --l1) {
- if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
- while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
- --l1;
- }
+ for (int i2 = this.a.P() - 1; i2 >= 0; --i2) {
+ if (this.a.getTypeId(k1, i2, l1) == Block.PORTAL.id) {
+ while (this.a.getTypeId(k1, i2 - 1, l1) == Block.PORTAL.id) {
+ --i2;
+ }
- d4 = (double) l1 + 0.5D - entity.locY;
- double d7 = d5 * d5 + d4 * d4 + d6 * d6;
+ d4 = (double) i2 + 0.5D - entity.locY;
+ double d7 = d5 * d5 + d4 * d4 + d6 * d6;
- if (d3 < 0.0D || d7 < d3) {
- d3 = d7;
- i = j1;
- j = l1;
- k = k1;
+ if (d3 < 0.0D || d7 < d3) {
+ d3 = d7;
+ i = k1;
+ j = i2;
+ k = l1;
+ }
}
}
}
}
}
- if (d3 < 0.0D) {
- return false;
- } else {
+ if (d3 >= 0.0D) {
+ if (flag) {
+ this.c.put(j1, new ChunkCoordinatesPortal(this, i, j, k, this.a.getTime()));
+ this.d.add(Long.valueOf(j1));
+ }
+
double d8 = (double) i + 0.5D;
double d9 = (double) j + 0.5D;
d4 = (double) k + 0.5D;
- int i2 = -1;
+ int j2 = -1;
- if (world.getTypeId(i - 1, j, k) == Block.PORTAL.id) {
- i2 = 2;
+ if (this.a.getTypeId(i - 1, j, k) == Block.PORTAL.id) {
+ j2 = 2;
}
- if (world.getTypeId(i + 1, j, k) == Block.PORTAL.id) {
- i2 = 0;
+ if (this.a.getTypeId(i + 1, j, k) == Block.PORTAL.id) {
+ j2 = 0;
}
- if (world.getTypeId(i, j, k - 1) == Block.PORTAL.id) {
- i2 = 3;
+ if (this.a.getTypeId(i, j, k - 1) == Block.PORTAL.id) {
+ j2 = 3;
}
- if (world.getTypeId(i, j, k + 1) == Block.PORTAL.id) {
- i2 = 1;
+ if (this.a.getTypeId(i, j, k + 1) == Block.PORTAL.id) {
+ j2 = 1;
}
- int j2 = entity.at();
-
- if (i2 > -1) {
- int k2 = Direction.h[i2];
- int l2 = Direction.a[i2];
- int i3 = Direction.b[i2];
- int j3 = Direction.a[k2];
- int k3 = Direction.b[k2];
- boolean flag = !world.isEmpty(i + l2 + j3, j, k + i3 + k3) || !world.isEmpty(i + l2 + j3, j + 1, k + i3 + k3);
- boolean flag1 = !world.isEmpty(i + l2, j, k + i3) || !world.isEmpty(i + l2, j + 1, k + i3);
-
- if (flag && flag1) {
- i2 = Direction.f[i2];
- k2 = Direction.f[k2];
- l2 = Direction.a[i2];
- i3 = Direction.b[i2];
- j3 = Direction.a[k2];
- k3 = Direction.b[k2];
- j1 = i - j3;
- d8 -= (double) j3;
- int l3 = k - k3;
-
- d4 -= (double) k3;
- flag = !world.isEmpty(j1 + l2 + j3, j, l3 + i3 + k3) || !world.isEmpty(j1 + l2 + j3, j + 1, l3 + i3 + k3);
- flag1 = !world.isEmpty(j1 + l2, j, l3 + i3) || !world.isEmpty(j1 + l2, j + 1, l3 + i3);
+ int k2 = entity.at();
+
+ if (j2 > -1) {
+ int l2 = Direction.h[j2];
+ int i3 = Direction.a[j2];
+ int j3 = Direction.b[j2];
+ int k3 = Direction.a[l2];
+ int l3 = Direction.b[l2];
+ boolean flag1 = !this.a.isEmpty(i + i3 + k3, j, k + j3 + l3) || !this.a.isEmpty(i + i3 + k3, j + 1, k + j3 + l3);
+ boolean flag2 = !this.a.isEmpty(i + i3, j, k + j3) || !this.a.isEmpty(i + i3, j + 1, k + j3);
+
+ if (flag1 && flag2) {
+ j2 = Direction.f[j2];
+ l2 = Direction.f[l2];
+ i3 = Direction.a[j2];
+ j3 = Direction.b[j2];
+ k3 = Direction.a[l2];
+ l3 = Direction.b[l2];
+ k1 = i - k3;
+ d8 -= (double) k3;
+ int i4 = k - l3;
+
+ d4 -= (double) l3;
+ flag1 = !this.a.isEmpty(k1 + i3 + k3, j, i4 + j3 + l3) || !this.a.isEmpty(k1 + i3 + k3, j + 1, i4 + j3 + l3);
+ flag2 = !this.a.isEmpty(k1 + i3, j, i4 + j3) || !this.a.isEmpty(k1 + i3, j + 1, i4 + j3);
}
float f1 = 0.5F;
float f2 = 0.5F;
- if (!flag && flag1) {
+ if (!flag1 && flag2) {
f1 = 1.0F;
- } else if (flag && !flag1) {
+ } else if (flag1 && !flag2) {
f1 = 0.0F;
- } else if (flag && flag1) {
+ } else if (flag1 && flag2) {
f2 = 0.0F;
}
- d8 += (double) ((float) j3 * f1 + f2 * (float) l2);
- d4 += (double) ((float) k3 * f1 + f2 * (float) i3);
+ d8 += (double) ((float) k3 * f1 + f2 * (float) i3);
+ d4 += (double) ((float) l3 * f1 + f2 * (float) j3);
float f3 = 0.0F;
float f4 = 0.0F;
float f5 = 0.0F;
float f6 = 0.0F;
- if (i2 == j2) {
+ if (j2 == k2) {
f3 = 1.0F;
f4 = 1.0F;
- } else if (i2 == Direction.f[j2]) {
+ } else if (j2 == Direction.f[k2]) {
f3 = -1.0F;
f4 = -1.0F;
- } else if (i2 == Direction.g[j2]) {
+ } else if (j2 == Direction.g[k2]) {
f5 = 1.0F;
f6 = -1.0F;
} else {
@@ -176,17 +200,19 @@ public class PortalTravelAgent {
entity.motX = d10 * (double) f3 + d11 * (double) f6;
entity.motZ = d10 * (double) f5 + d11 * (double) f4;
- entity.yaw = f - (float) (j2 * 90) + (float) (i2 * 90);
+ entity.yaw = f - (float) (k2 * 90) + (float) (j2 * 90);
} else {
entity.motX = entity.motY = entity.motZ = 0.0D;
}
entity.setPositionRotation(d8, d9, d4, entity.yaw, entity.pitch);
return true;
+ } else {
+ return false;
}
}
- public boolean a(World world, Entity entity) {
+ public boolean a(Entity entity) {
byte b0 = 16;
double d0 = -1.0D;
int i = MathHelper.floor(entity.locX);
@@ -196,12 +222,12 @@ public class PortalTravelAgent {
int i1 = j;
int j1 = k;
int k1 = 0;
- int l1 = this.a.nextInt(4);
+ int l1 = this.b.nextInt(4);
int i2;
double d1;
- int j2;
double d2;
+ int j2;
int k2;
int l2;
int i3;
@@ -221,42 +247,42 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - entity.locZ;
label274:
- for (l2 = world.O() - 1; l2 >= 0; --l2) {
- if (world.isEmpty(i2, l2, j2)) {
- while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
- --l2;
+ for (k2 = this.a.P() - 1; k2 >= 0; --k2) {
+ if (this.a.isEmpty(i2, k2, j2)) {
+ while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) {
+ --k2;
}
- for (k2 = l1; k2 < l1 + 4; ++k2) {
- j3 = k2 % 2;
- i3 = 1 - j3;
- if (k2 % 4 >= 2) {
- j3 = -j3;
- i3 = -i3;
+ for (i3 = l1; i3 < l1 + 4; ++i3) {
+ l2 = i3 % 2;
+ k3 = 1 - l2;
+ if (i3 % 4 >= 2) {
+ l2 = -l2;
+ k3 = -k3;
}
- for (l3 = 0; l3 < 3; ++l3) {
- for (k3 = 0; k3 < 4; ++k3) {
- for (j4 = -1; j4 < 4; ++j4) {
- i4 = i2 + (k3 - 1) * j3 + l3 * i3;
- k4 = l2 + j4;
- int l4 = j2 + (k3 - 1) * i3 - l3 * j3;
+ for (j3 = 0; j3 < 3; ++j3) {
+ for (i4 = 0; i4 < 4; ++i4) {
+ for (l3 = -1; l3 < 4; ++l3) {
+ k4 = i2 + (i4 - 1) * l2 + j3 * k3;
+ j4 = k2 + l3;
+ int l4 = j2 + (i4 - 1) * k3 - j3 * l2;
- if (j4 < 0 && !world.getMaterial(i4, k4, l4).isBuildable() || j4 >= 0 && !world.isEmpty(i4, k4, l4)) {
+ if (l3 < 0 && !this.a.getMaterial(k4, j4, l4).isBuildable() || l3 >= 0 && !this.a.isEmpty(k4, j4, l4)) {
continue label274;
}
}
}
}
- d3 = (double) l2 + 0.5D - entity.locY;
+ d3 = (double) k2 + 0.5D - entity.locY;
d4 = d1 * d1 + d3 * d3 + d2 * d2;
if (d0 < 0.0D || d4 < d0) {
d0 = d4;
l = i2;
- i1 = l2;
+ i1 = k2;
j1 = j2;
- k1 = k2 % 4;
+ k1 = i3 % 4;
}
}
}
@@ -272,35 +298,35 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - entity.locZ;
label222:
- for (l2 = world.O() - 1; l2 >= 0; --l2) {
- if (world.isEmpty(i2, l2, j2)) {
- while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
- --l2;
+ for (k2 = this.a.P() - 1; k2 >= 0; --k2) {
+ if (this.a.isEmpty(i2, k2, j2)) {
+ while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) {
+ --k2;
}
- for (k2 = l1; k2 < l1 + 2; ++k2) {
- j3 = k2 % 2;
- i3 = 1 - j3;
+ for (i3 = l1; i3 < l1 + 2; ++i3) {
+ l2 = i3 % 2;
+ k3 = 1 - l2;
- for (l3 = 0; l3 < 4; ++l3) {
- for (k3 = -1; k3 < 4; ++k3) {
- j4 = i2 + (l3 - 1) * j3;
- i4 = l2 + k3;
- k4 = j2 + (l3 - 1) * i3;
- if (k3 < 0 && !world.getMaterial(j4, i4, k4).isBuildable() || k3 >= 0 && !world.isEmpty(j4, i4, k4)) {
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (i4 = -1; i4 < 4; ++i4) {
+ l3 = i2 + (j3 - 1) * l2;
+ k4 = k2 + i4;
+ j4 = j2 + (j3 - 1) * k3;
+ if (i4 < 0 && !this.a.getMaterial(l3, k4, j4).isBuildable() || i4 >= 0 && !this.a.isEmpty(l3, k4, j4)) {
continue label222;
}
}
}
- d3 = (double) l2 + 0.5D - entity.locY;
+ d3 = (double) k2 + 0.5D - entity.locY;
d4 = d1 * d1 + d3 * d3 + d2 * d2;
if (d0 < 0.0D || d4 < d0) {
d0 = d4;
l = i2;
- i1 = l2;
+ i1 = k2;
j1 = j2;
- k1 = k2 % 2;
+ k1 = i3 % 2;
}
}
}
@@ -328,50 +354,67 @@ public class PortalTravelAgent {
i1 = 70;
}
- if (i1 > world.O() - 10) {
- i1 = world.O() - 10;
+ if (i1 > this.a.P() - 10) {
+ i1 = this.a.P() - 10;
}
j5 = i1;
- for (l2 = -1; l2 <= 1; ++l2) {
- for (k2 = 1; k2 < 3; ++k2) {
- for (j3 = -1; j3 < 3; ++j3) {
- i3 = i5 + (k2 - 1) * k5 + l2 * l5;
- l3 = j5 + j3;
- k3 = j2 + (k2 - 1) * l5 - l2 * k5;
- flag = j3 < 0;
- world.setTypeId(i3, l3, k3, flag ? Block.OBSIDIAN.id : 0);
+ for (k2 = -1; k2 <= 1; ++k2) {
+ for (i3 = 1; i3 < 3; ++i3) {
+ for (l2 = -1; l2 < 3; ++l2) {
+ k3 = i5 + (i3 - 1) * k5 + k2 * l5;
+ j3 = j5 + l2;
+ i4 = j2 + (i3 - 1) * l5 - k2 * k5;
+ flag = l2 < 0;
+ this.a.setTypeId(k3, j3, i4, flag ? Block.OBSIDIAN.id : 0);
}
}
}
}
- for (l2 = 0; l2 < 4; ++l2) {
- world.suppressPhysics = true;
+ for (k2 = 0; k2 < 4; ++k2) {
+ this.a.suppressPhysics = true;
- for (k2 = 0; k2 < 4; ++k2) {
- for (j3 = -1; j3 < 4; ++j3) {
- i3 = i5 + (k2 - 1) * k5;
- l3 = j5 + j3;
- k3 = j2 + (k2 - 1) * l5;
- flag = k2 == 0 || k2 == 3 || j3 == -1 || j3 == 3;
- world.setTypeId(i3, l3, k3, flag ? Block.OBSIDIAN.id : Block.PORTAL.id);
+ for (i3 = 0; i3 < 4; ++i3) {
+ for (l2 = -1; l2 < 4; ++l2) {
+ k3 = i5 + (i3 - 1) * k5;
+ j3 = j5 + l2;
+ i4 = j2 + (i3 - 1) * l5;
+ flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3;
+ this.a.setTypeId(k3, j3, i4, flag ? Block.OBSIDIAN.id : Block.PORTAL.id);
}
}
- world.suppressPhysics = false;
+ this.a.suppressPhysics = false;
- for (k2 = 0; k2 < 4; ++k2) {
- for (j3 = -1; j3 < 4; ++j3) {
- i3 = i5 + (k2 - 1) * k5;
- l3 = j5 + j3;
- k3 = j2 + (k2 - 1) * l5;
- world.applyPhysics(i3, l3, k3, world.getTypeId(i3, l3, k3));
+ for (i3 = 0; i3 < 4; ++i3) {
+ for (l2 = -1; l2 < 4; ++l2) {
+ k3 = i5 + (i3 - 1) * k5;
+ j3 = j5 + l2;
+ i4 = j2 + (i3 - 1) * l5;
+ this.a.applyPhysics(k3, j3, i4, this.a.getTypeId(k3, j3, i4));
}
}
}
return true;
}
+
+ public void a(long i) {
+ if (i % 100L == 0L) {
+ Iterator iterator = this.d.iterator();
+ long j = i - 600L;
+
+ while (iterator.hasNext()) {
+ Long olong = (Long) iterator.next();
+ ChunkCoordinatesPortal chunkcoordinatesportal = (ChunkCoordinatesPortal) this.c.getEntry(olong.longValue());
+
+ if (chunkcoordinatesportal == null || chunkcoordinatesportal.d < j) {
+ iterator.remove();
+ this.c.remove(olong.longValue());
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/RecipesMapClone.java b/src/main/java/net/minecraft/server/RecipesMapClone.java
index f9213730..f0e69736 100644
--- a/src/main/java/net/minecraft/server/RecipesMapClone.java
+++ b/src/main/java/net/minecraft/server/RecipesMapClone.java
@@ -66,7 +66,13 @@ public class RecipesMapClone extends ShapelessRecipes implements IRecipe { // Cr
}
if (itemstack != null && i >= 1) {
- return new ItemStack(Item.MAP, i + 1, itemstack.getData());
+ ItemStack itemstack2 = new ItemStack(Item.MAP, i + 1, itemstack.getData());
+
+ if (itemstack.s()) {
+ itemstack2.c(itemstack.r());
+ }
+
+ return itemstack2;
} else {
return null;
}
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java
index 7ab5156e..102d1626 100644
--- a/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java
+++ b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java
@@ -93,7 +93,7 @@ public abstract class ServerConfigurationManagerAbstract {
this.c(entityplayer);
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.server.ae().a(netserverhandler);
- netserverhandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.F()));
+ netserverhandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
if (this.server.getTexturePack().length() > 0) {
entityplayer.a(this.server.getTexturePack(), this.server.S());
}
@@ -149,15 +149,6 @@ public abstract class ServerConfigurationManagerAbstract {
this.players.add(entityplayer);
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
- // CraftBukkit start
- if (!cserver.useExactLoginLocation()) {
- while (!worldserver.getCubes(entityplayer, entityplayer.boundingBox).isEmpty()) {
- entityplayer.setPosition(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
- }
- } else {
- entityplayer.setPosition(entityplayer.locX, entityplayer.locY + entityplayer.getBukkitEntity().getEyeHeight(), entityplayer.locZ);
- }
-
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
this.cserver.getPluginManager().callEvent(playerJoinEvent);
@@ -171,7 +162,6 @@ public abstract class ServerConfigurationManagerAbstract {
worldserver.addEntity(entityplayer);
this.a(entityplayer, (WorldServer) null);
- Iterator iterator = this.players.iterator();
// CraftBukkit start - sendAll above replaced with this loop
Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, true, 1000);
@@ -184,8 +174,8 @@ public abstract class ServerConfigurationManagerAbstract {
}
// CraftBukkit end
- while (iterator.hasNext()) {
- EntityPlayer entityplayer1 = (EntityPlayer) iterator.next();
+ for (int i = 0; i < this.players.size(); ++i) {
+ EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
// CraftBukkit start - .name -> .listName
if (entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
@@ -284,18 +274,17 @@ public abstract class ServerConfigurationManagerAbstract {
public EntityPlayer processLogin(EntityPlayer player) { // CraftBukkit - String -> EntityPlayer
String s = player.name; // CraftBukkit
ArrayList arraylist = new ArrayList();
- Iterator iterator = this.players.iterator();
EntityPlayer entityplayer;
- while (iterator.hasNext()) {
- entityplayer = (EntityPlayer) iterator.next();
+ for (int i = 0; i < this.players.size(); ++i) {
+ entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.name.equalsIgnoreCase(s)) {
arraylist.add(entityplayer);
}
}
- iterator = arraylist.iterator();
+ Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
entityplayer = (EntityPlayer) iterator.next();
@@ -497,6 +486,7 @@ public abstract class ServerConfigurationManagerAbstract {
double d5 = entity.locZ;
float f = entity.yaw;
+ worldserver.methodProfiler.a("moving");
if (entity.dimension == -1) {
d0 /= d2;
d1 /= d2;
@@ -529,15 +519,19 @@ public abstract class ServerConfigurationManagerAbstract {
}
}
+ worldserver.methodProfiler.b();
if (i != 1) {
+ worldserver.methodProfiler.a("placing");
d0 = (double) MathHelper.a((int) d0, -29999872, 29999872);
d1 = (double) MathHelper.a((int) d1, -29999872, 29999872);
if (entity.isAlive()) {
worldserver1.addEntity(entity);
entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
worldserver1.entityJoinedWorld(entity, false);
- (new PortalTravelAgent()).a(worldserver1, entity, d3, d4, d5, f);
+ worldserver1.s().a(entity, d3, d4, d5, f);
}
+
+ worldserver.methodProfiler.b();
}
entity.spawnIn(worldserver1);
@@ -564,10 +558,8 @@ public abstract class ServerConfigurationManagerAbstract {
}
public void a(Packet packet, int i) {
- Iterator iterator = this.players.iterator();
-
- while (iterator.hasNext()) {
- EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+ for (int j = 0; j < this.players.size(); ++j) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
if (entityplayer.dimension == i) {
entityplayer.netServerHandler.sendPacket(packet);
@@ -713,10 +705,8 @@ public abstract class ServerConfigurationManagerAbstract {
// CraftBukkit end
public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet, Entity sourceentity) { // CraftBukkit - added sourceentity
- Iterator iterator = this.players.iterator();
-
- while (iterator.hasNext()) {
- EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+ for (int j = 0; j < this.players.size(); ++j) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
// CraftBukkit start - Test if player receiving packet can see the source of the packet
if (sourceentity != null && sourceentity instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer)sourceentity).getBukkitEntity())) {
@@ -736,12 +726,8 @@ public abstract class ServerConfigurationManagerAbstract {
}
public void savePlayers() {
- Iterator iterator = this.players.iterator();
-
- while (iterator.hasNext()) {
- EntityPlayer entityplayer = (EntityPlayer) iterator.next();
-
- this.b(entityplayer);
+ for (int i = 0; i < this.players.size(); ++i) {
+ this.b((EntityPlayer) this.players.get(i));
}
}
@@ -764,8 +750,8 @@ public abstract class ServerConfigurationManagerAbstract {
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
- entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.F()));
- if (worldserver.M()) {
+ entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
+ if (worldserver.N()) {
entityplayer.netServerHandler.sendPacket(new Packet70Bed(1, 0));
}
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 3ae2e830..a1ed84c3 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -21,7 +21,7 @@ public final class SpawnerCreature {
Chunk chunk = world.getChunkAt(i, j);
int k = i * 16 + world.random.nextInt(16);
int l = j * 16 + world.random.nextInt(16);
- int i1 = world.random.nextInt(chunk == null ? world.O() : chunk.h() + 16 - 1);
+ int i1 = world.random.nextInt(chunk == null ? world.P() : chunk.h() + 16 - 1);
return new ChunkPosition(k, i1, l);
}
@@ -105,7 +105,7 @@ public final class SpawnerCreature {
int l1 = chunkposition.y;
int i2 = chunkposition.z;
- if (!worldserver.s(k1, l1, i2) && worldserver.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
+ if (!worldserver.t(k1, l1, i2) && worldserver.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
int j2 = 0;
int k2 = 0;
@@ -157,7 +157,7 @@ public final class SpawnerCreature {
// CraftBukkit - added a reason for spawning this creature
worldserver.addEntity(entityliving, SpawnReason.NATURAL);
a(entityliving, worldserver, f, f1, f2);
- if (j2 >= entityliving.bs()) {
+ if (j2 >= entityliving.bv()) {
continue label110;
}
}
@@ -188,19 +188,19 @@ public final class SpawnerCreature {
public static boolean a(EnumCreatureType enumcreaturetype, World world, int i, int j, int k) {
if (enumcreaturetype.c() == Material.WATER) {
- return world.getMaterial(i, j, k).isLiquid() && !world.s(i, j + 1, k);
- } else if (!world.t(i, j - 1, k)) {
+ return world.getMaterial(i, j, k).isLiquid() && world.getMaterial(i, j - 1, k).isLiquid() && !world.t(i, j + 1, k);
+ } else if (!world.v(i, j - 1, k)) {
return false;
} else {
int l = world.getTypeId(i, j - 1, k);
- return l != Block.BEDROCK.id && !world.s(i, j, k) && !world.getMaterial(i, j, k).isLiquid() && !world.s(i, j + 1, k);
+ return l != Block.BEDROCK.id && !world.t(i, j, k) && !world.getMaterial(i, j, k).isLiquid() && !world.t(i, j + 1, k);
}
}
private static void a(EntityLiving entityliving, World world, float f, float f1, float f2) {
if (entityliving.dead) return; // CraftBukkit
- entityliving.bD();
+ entityliving.bG();
}
public static void a(World world, BiomeBase biomebase, int i, int j, int k, int l, Random random) {
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index b763b482..d8eb6b91 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.Callable;
import org.bukkit.inventory.InventoryHolder; // CraftBukkit
@@ -102,7 +103,7 @@ public class TileEntity {
return this.q;
}
- public Packet l() {
+ public Packet getUpdatePacket() {
return null;
}
@@ -125,6 +126,15 @@ public class TileEntity {
this.p = -1;
}
+ public void a(CrashReportSystemDetails crashreportsystemdetails) {
+ crashreportsystemdetails.a("Name", (Callable) (new CrashReportTileEntityName(this)));
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.x, this.y, this.z, this.q.id, this.p);
+ }
+
+ static Map t() {
+ return b;
+ }
+
static {
a(TileEntityFurnace.class, "Furnace");
a(TileEntityChest.class, "Chest");
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 5478b059..9c19453f 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -47,12 +47,12 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
public void g() {
if (this.world.getTime() % 80L == 0L) {
+ this.v();
this.u();
- this.t();
}
}
- private void t() {
+ private void u() {
if (this.d && this.e > 0 && !this.world.isStatic && this.f > 0) {
double d0 = (double) (this.e * 8 + 8);
byte b0 = 0;
@@ -83,8 +83,8 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
}
- private void u() {
- if (!this.world.j(this.x, this.y + 1, this.z)) {
+ private void v() {
+ if (!this.world.k(this.x, this.y + 1, this.z)) {
this.d = false;
this.e = 0;
} else {
@@ -171,7 +171,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
}
- public Packet l() {
+ public Packet getUpdatePacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.b(nbttagcompound);
@@ -241,7 +241,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
return maxStack; // CraftBukkit
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
index 2126950e..418a2262 100644
--- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
+++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
@@ -54,7 +54,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
if (this.brewTime > 0) {
--this.brewTime;
if (this.brewTime == 0) {
- this.t();
+ this.u();
this.update();
} else if (!this.k()) {
this.brewTime = 0;
@@ -118,7 +118,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
}
- private void t() {
+ private void u() {
if (this.k()) {
ItemStack itemstack = this.items[3];
@@ -236,7 +236,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
return this.maxStack; // CraftBukkit
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 91488ebc..0d1637c7 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -1,8 +1,9 @@
package net.minecraft.server;
-// CraftBukkit start
+import java.util.Iterator;
import java.util.List;
+// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
@@ -139,7 +140,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
return maxStack; // CraftBukkit
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
if (this.world == null) return true; // CraftBukkit
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
@@ -149,6 +150,37 @@ public class TileEntityChest extends TileEntity implements IInventory {
this.a = false;
}
+ private void a(TileEntityChest tileentitychest, int i) {
+ if (tileentitychest.r()) {
+ this.a = false;
+ } else if (this.a) {
+ switch (i) {
+ case 0:
+ if (this.e != tileentitychest) {
+ this.a = false;
+ }
+ break;
+
+ case 1:
+ if (this.d != tileentitychest) {
+ this.a = false;
+ }
+ break;
+
+ case 2:
+ if (this.b != tileentitychest) {
+ this.a = false;
+ }
+ break;
+
+ case 3:
+ if (this.c != tileentitychest) {
+ this.a = false;
+ }
+ }
+ }
+ }
+
public void i() {
if (!this.a) {
this.a = true;
@@ -173,19 +205,19 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
if (this.b != null) {
- this.b.h();
+ this.b.a(this, 0);
}
if (this.e != null) {
- this.e.h();
+ this.e.a(this, 1);
}
if (this.c != null) {
- this.c.h();
+ this.c.a(this, 2);
}
if (this.d != null) {
- this.d.h();
+ this.d.a(this, 3);
}
}
}
@@ -194,12 +226,30 @@ public class TileEntityChest extends TileEntity implements IInventory {
super.g();
if (this.world == null) return; // CraftBukkit
this.i();
- if (++this.ticks % (20 * 4) == 0) { // CraftBukkit
- ;
+ ++this.ticks;
+ float f;
+
+ if (!this.world.isStatic && this.h != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) {
+ this.h = 0;
+ f = 5.0F;
+ List list = this.world.a(EntityHuman.class, AxisAlignedBB.a().a((double) ((float) this.x - f), (double) ((float) this.y - f), (double) ((float) this.z - f), (double) ((float) (this.x + 1) + f), (double) ((float) (this.y + 1) + f), (double) ((float) (this.z + 1) + f)));
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ if (entityhuman.activeContainer instanceof ContainerChest) {
+ IInventory iinventory = ((ContainerChest) entityhuman.activeContainer).d();
+
+ if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).a(this)) {
+ ++this.h;
+ }
+ }
+ }
}
this.g = this.f;
- float f = 0.1F;
+ f = 0.1F;
double d0;
if (this.h > 0 && this.f == 0.0F && this.b == null && this.d == null) {
@@ -272,8 +322,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
public void w_() {
+ super.w_();
this.h();
this.i();
- super.w_();
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java
index 78e462a3..82b189bc 100644
--- a/src/main/java/net/minecraft/server/TileEntityCommand.java
+++ b/src/main/java/net/minecraft/server/TileEntityCommand.java
@@ -116,7 +116,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
return new ChunkCoordinates(this.x, this.y, this.z);
}
- public Packet l() {
+ public Packet getUpdatePacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.b(nbttagcompound);
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index b8be7aa9..a7aa950a 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -158,7 +158,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
return maxStack; // CraftBukkit
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index 299c6864..bf4ed58d 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -292,7 +292,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
return fuelTime(itemstack) > 0;
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
index 0f3b7b03..ccc94d22 100644
--- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
+++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
@@ -79,7 +79,7 @@ public class TileEntityMobSpawner extends TileEntity {
this.world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
this.world.triggerEffect(2004, this.x, this.y, this.z, 0);
if (entityliving != null) {
- entityliving.aQ();
+ entityliving.aR();
}
this.e();
@@ -107,12 +107,17 @@ public class TileEntityMobSpawner extends TileEntity {
entity.e(nbttagcompound);
} else if (entity instanceof EntityLiving && entity.world != null) {
- ((EntityLiving) entity).bD();
+ ((EntityLiving) entity).bG();
}
}
private void e() {
- this.spawnDelay = this.minSpawnDelay + this.world.random.nextInt(this.maxSpawnDelay - this.minSpawnDelay);
+ if (this.maxSpawnDelay <= this.minSpawnDelay) {
+ this.spawnDelay = this.minSpawnDelay;
+ } else {
+ this.spawnDelay = this.minSpawnDelay + this.world.random.nextInt(this.maxSpawnDelay - this.minSpawnDelay);
+ }
+
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, 0);
}
@@ -157,7 +162,7 @@ public class TileEntityMobSpawner extends TileEntity {
}
}
- public Packet l() {
+ public Packet getUpdatePacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.b(nbttagcompound);
diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java
index 20d0cb0e..becd33ec 100644
--- a/src/main/java/net/minecraft/server/TileEntityPiston.java
+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java
@@ -79,7 +79,7 @@ public class TileEntityPiston extends TileEntity {
public void f() {
if (this.g < 1.0F && this.world != null) {
this.g = this.f = 1.0F;
- this.world.q(this.x, this.y, this.z);
+ this.world.r(this.x, this.y, this.z);
this.w_();
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
@@ -93,7 +93,7 @@ public class TileEntityPiston extends TileEntity {
this.g = this.f;
if (this.g >= 1.0F) {
this.a(1.0F, 0.25F);
- this.world.q(this.x, this.y, this.z);
+ this.world.r(this.x, this.y, this.z);
this.w_();
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 20457593..43393d9b 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -28,7 +28,7 @@ public class TileEntitySign extends TileEntity {
}
}
- public Packet l() {
+ public Packet getUpdatePacket() {
String[] astring = new String[4];
// CraftBukkit start - limit sign text to 15 chars per line
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index 864559ca..c8822ce9 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -72,7 +72,7 @@ public class Village {
}
private boolean b(int i, int j, int k, int l, int i1, int j1) {
- if (!this.world.t(i, j - 1, k)) {
+ if (!this.world.v(i, j - 1, k)) {
return false;
} else {
int k1 = i - l / 2;
@@ -81,7 +81,7 @@ public class Village {
for (int i2 = k1; i2 < k1 + l; ++i2) {
for (int j2 = j; j2 < j + i1; ++j2) {
for (int k2 = l1; k2 < l1 + j1; ++k2) {
- if (this.world.s(i2, j2, k2)) {
+ if (this.world.t(i2, j2, k2)) {
return false;
}
}
@@ -230,10 +230,9 @@ public class Village {
public EntityLiving b(EntityLiving entityliving) {
double d0 = Double.MAX_VALUE;
VillageAggressor villageaggressor = null;
- Iterator iterator = this.aggressors.iterator();
- while (iterator.hasNext()) {
- VillageAggressor villageaggressor1 = (VillageAggressor) iterator.next();
+ for (int i = 0; i < this.aggressors.size(); ++i) {
+ VillageAggressor villageaggressor1 = (VillageAggressor) this.aggressors.get(i);
double d1 = villageaggressor1.a.e(entityliving);
if (d1 <= d0) {
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 86dc599d..b3e9687e 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -28,7 +28,7 @@ public class VillageSiege {
return;
}
} else {
- if (this.world.t()) {
+ if (this.world.u()) {
this.c = 0;
return;
}
@@ -139,7 +139,7 @@ public class VillageSiege {
try {
entityzombie = new EntityZombie(this.world);
- entityzombie.bD();
+ entityzombie.bG();
entityzombie.setVillager(false);
} catch (Exception exception) {
exception.printStackTrace();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e902c535..0260dd3c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -141,7 +141,20 @@ public abstract class World implements IBlockAccess {
this.worldProvider.a(this);
this.chunkProvider = this.j();
if (!this.worldData.isInitialized()) {
- this.a(worldsettings);
+ try {
+ this.a(worldsettings);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception initializing level");
+
+ try {
+ this.a(crashreport);
+ } catch (Throwable throwable1) {
+ ;
+ }
+
+ throw new ReportedException(crashreport);
+ }
+
this.worldData.d(true);
}
@@ -155,7 +168,7 @@ public abstract class World implements IBlockAccess {
this.villages.a(this);
}
- this.w();
+ this.x();
this.a();
this.getServer().addWorld(this.world); // CraftBukkit
@@ -178,7 +191,29 @@ public abstract class World implements IBlockAccess {
}
public int getTypeId(int i, int j, int k) {
- return i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 ? (j < 0 ? 0 : (j >= 256 ? 0 : this.getChunkAt(i >> 4, k >> 4).getTypeId(i & 15, j, k & 15))) : 0;
+ if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
+ if (j < 0) {
+ return 0;
+ } else if (j >= 256) {
+ return 0;
+ } else {
+ Chunk chunk = null;
+
+ try {
+ chunk = this.getChunkAt(i >> 4, k >> 4);
+ return chunk.getTypeId(i & 15, j, k & 15);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception getting block type in world");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Requested block coordinates");
+
+ crashreportsystemdetails.a("Found chunk", Boolean.valueOf(chunk == null));
+ crashreportsystemdetails.a("Location", CrashReportSystemDetails.a(i, j, k));
+ throw new ReportedException(crashreport);
+ }
+ }
+ } else {
+ return 0;
+ }
}
public int b(int i, int j, int k) {
@@ -195,6 +230,12 @@ public abstract class World implements IBlockAccess {
return Block.byId[l] != null && Block.byId[l].u();
}
+ public int e(int i, int j, int k) {
+ int l = this.getTypeId(i, j, k);
+
+ return Block.byId[l] != null ? Block.byId[l].d() : -1;
+ }
+
public boolean isLoaded(int i, int j, int k) {
return j >= 0 && j < 256 ? this.isChunkLoaded(i >> 4, k >> 4) : false;
}
@@ -263,7 +304,7 @@ public abstract class World implements IBlockAccess {
boolean flag1 = chunk.a(i & 15, j, k & 15, l, i1);
this.methodProfiler.a("checkLight");
- this.x(i, j, k);
+ this.z(i, j, k);
this.methodProfiler.b();
if (flag && flag1 && (this.isStatic || chunk.seenByPlayer)) {
this.notify(i, j, k);
@@ -287,7 +328,7 @@ public abstract class World implements IBlockAccess {
boolean flag = chunk.a(i & 15, j, k & 15, l);
this.methodProfiler.a("checkLight");
- this.x(i, j, k);
+ this.z(i, j, k);
this.methodProfiler.b();
if (flag && (this.isStatic || chunk.seenByPlayer)) {
this.notify(i, j, k);
@@ -375,12 +416,8 @@ public abstract class World implements IBlockAccess {
}
public void notify(int i, int j, int k) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.a(i, j, k);
+ for (int l = 0; l < this.w.size(); ++l) {
+ ((IWorldAccess) this.w.get(l)).a(i, j, k);
}
}
@@ -406,23 +443,15 @@ public abstract class World implements IBlockAccess {
this.e(i, k, j, i, l, j);
}
- public void i(int i, int j, int k) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.a(i, j, k, i, j, k);
+ public void j(int i, int j, int k) {
+ for (int l = 0; l < this.w.size(); ++l) {
+ ((IWorldAccess) this.w.get(l)).a(i, j, k, i, j, k);
}
}
public void e(int i, int j, int k, int l, int i1, int j1) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.a(i, j, k, l, i1, j1);
+ for (int k1 = 0; k1 < this.w.size(); ++k1) {
+ ((IWorldAccess) this.w.get(k1)).a(i, j, k, l, i1, j1);
}
}
@@ -437,31 +466,49 @@ public abstract class World implements IBlockAccess {
private void m(int i, int j, int k, int l) {
if (!this.suppressPhysics && !this.isStatic) {
- Block block = Block.byId[this.getTypeId(i, j, k)];
+ int i1 = this.getTypeId(i, j, k);
+ Block block = Block.byId[i1];
if (block != null) {
- // CraftBukkit start
- CraftWorld world = ((WorldServer) this).getWorld();
- if (world != null) {
- BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
- this.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
- return;
+ try {
+ // CraftBukkit start
+ CraftWorld world = ((WorldServer) this).getWorld();
+ if (world != null) {
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
+ this.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
}
- }
- // CraftBukkit end
+ // CraftBukkit end
+
+ block.doPhysics(this, i, j, k, l);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
- block.doPhysics(this, i, j, k, l);
+ int j1;
+
+ try {
+ j1 = this.getData(i, j, k);
+ } catch (Throwable throwable1) {
+ j1 = -1;
+ }
+
+ crashreportsystemdetails.a("Source block type", (Callable) (new CrashReportSourceBlockType(this, l)));
+ CrashReportSystemDetails.a(crashreportsystemdetails, i, j, k, i1, j1);
+ throw new ReportedException(crashreport);
+ }
}
}
}
- public boolean j(int i, int j, int k) {
+ public boolean k(int i, int j, int k) {
return this.getChunkAt(i >> 4, k >> 4).d(i & 15, j, k & 15);
}
- public int k(int i, int j, int k) {
+ public int l(int i, int j, int k) {
if (j < 0) {
return 0;
} else {
@@ -588,12 +635,9 @@ public abstract class World implements IBlockAccess {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
chunk.a(enumskyblock, i & 15, j, k & 15, l);
- Iterator iterator = this.w.iterator();
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.b(i, j, k);
+ for (int i1 = 0; i1 < this.w.size(); ++i1) {
+ ((IWorldAccess) this.w.get(i1)).b(i, j, k);
}
}
}
@@ -601,21 +645,17 @@ public abstract class World implements IBlockAccess {
}
}
- public void n(int i, int j, int k) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.b(i, j, k);
+ public void o(int i, int j, int k) {
+ for (int l = 0; l < this.w.size(); ++l) {
+ ((IWorldAccess) this.w.get(l)).b(i, j, k);
}
}
- public float o(int i, int j, int k) {
+ public float p(int i, int j, int k) {
return this.worldProvider.g[this.getLightLevel(i, j, k)];
}
- public boolean t() {
+ public boolean u() {
return this.j < 4;
}
@@ -790,24 +830,24 @@ public abstract class World implements IBlockAccess {
public void makeSound(Entity entity, String s, float f, float f1) {
if (entity != null && s != null) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+ for (int i = 0; i < this.w.size(); ++i) {
+ ((IWorldAccess) this.w.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
+ }
+ }
+ }
- ((WorldManager) iworldaccess).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1, entity); // CraftBukkit - Cast to WorldManager, add sourceentity
+ public void a(EntityHuman entityhuman, String s, float f, float f1) {
+ if (entityhuman != null && s != null) {
+ for (int i = 0; i < this.w.size(); ++i) {
+ ((IWorldAccess) this.w.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
}
}
}
public void makeSound(double d0, double d1, double d2, String s, float f, float f1) {
if (s != null) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.a(s, d0, d1, d2, f, f1);
+ for (int i = 0; i < this.w.size(); ++i) {
+ ((IWorldAccess) this.w.get(i)).a(s, d0, d1, d2, f, f1);
}
}
}
@@ -815,22 +855,14 @@ public abstract class World implements IBlockAccess {
public void b(double d0, double d1, double d2, String s, float f, float f1) {}
public void a(String s, int i, int j, int k) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.a(s, i, j, k);
+ for (int l = 0; l < this.w.size(); ++l) {
+ ((IWorldAccess) this.w.get(l)).a(s, i, j, k);
}
}
public void addParticle(String s, double d0, double d1, double d2, double d3, double d4, double d5) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.a(s, d0, d1, d2, d3, d4, d5);
+ for (int i = 0; i < this.w.size(); ++i) {
+ ((IWorldAccess) this.w.get(i)).a(s, d0, d1, d2, d3, d4, d5);
}
}
@@ -902,24 +934,16 @@ public abstract class World implements IBlockAccess {
}
protected void a(Entity entity) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.a(entity);
+ for (int i = 0; i < this.w.size(); ++i) {
+ ((IWorldAccess) this.w.get(i)).a(entity);
}
entity.valid = true; // CraftBukkit
}
protected void b(Entity entity) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
-
- iworldaccess.b(entity);
+ for (int i = 0; i < this.w.size(); ++i) {
+ ((IWorldAccess) this.w.get(i)).b(entity);
}
entity.valid = false; // CraftBukkit
@@ -988,17 +1012,15 @@ public abstract class World implements IBlockAccess {
double d0 = 0.25D;
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- Entity entity1 = (Entity) iterator.next();
- AxisAlignedBB axisalignedbb1 = entity1.E();
+ for (int j2 = 0; j2 < list.size(); ++j2) {
+ AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).E();
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
this.M.add(axisalignedbb1);
}
- axisalignedbb1 = entity.g(entity1);
+ axisalignedbb1 = entity.g((Entity) list.get(j2));
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
this.M.add(axisalignedbb1);
}
@@ -1053,7 +1075,7 @@ public abstract class World implements IBlockAccess {
}
public float c(float f) {
- return this.worldProvider.a(this.worldData.g(), f);
+ return this.worldProvider.a(this.worldData.getDayTime(), f);
}
public int h(int i, int j) {
@@ -1089,6 +1111,8 @@ public abstract class World implements IBlockAccess {
int i;
Entity entity;
+ CrashReport crashreport;
+ CrashReportSystemDetails crashreportsystemdetails;
for (i = 0; i < this.i.size(); ++i) {
entity = (Entity) this.i.get(i);
@@ -1103,7 +1127,20 @@ public abstract class World implements IBlockAccess {
}
// CraftBukkit end
- entity.j_();
+ try {
+ entity.j_();
+ } catch (Throwable throwable) {
+ crashreport = CrashReport.a(throwable, "Ticking entity");
+ crashreportsystemdetails = crashreport.a("Entity being ticked");
+ if (entity == null) {
+ crashreportsystemdetails.a("Entity", "~~NULL~~");
+ } else {
+ entity.a(crashreportsystemdetails);
+ }
+
+ throw new ReportedException(crashreport);
+ }
+
if (entity.dead) {
this.i.remove(i--);
}
@@ -1111,13 +1148,12 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.c("remove");
this.entityList.removeAll(this.f);
- Iterator iterator = this.f.iterator();
int j;
int k;
- while (iterator.hasNext()) {
- entity = (Entity) iterator.next();
+ for (i = 0; i < this.f.size(); ++i) {
+ entity = (Entity) this.f.get(i);
j = entity.ai;
k = entity.ak;
if (entity.ah && this.isChunkLoaded(j, k)) {
@@ -1125,11 +1161,8 @@ public abstract class World implements IBlockAccess {
}
}
- iterator = this.f.iterator();
-
- while (iterator.hasNext()) {
- entity = (Entity) iterator.next();
- this.b(entity);
+ for (i = 0; i < this.f.size(); ++i) {
+ this.b((Entity) this.f.get(i));
}
this.f.clear();
@@ -1156,7 +1189,19 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("tick");
if (!entity.dead) {
- this.playerJoinedWorld(entity);
+ try {
+ this.playerJoinedWorld(entity);
+ } catch (Throwable throwable1) {
+ crashreport = CrashReport.a(throwable1, "Ticking entity");
+ crashreportsystemdetails = crashreport.a("Entity being ticked");
+ if (entity == null) {
+ crashreportsystemdetails.a("Entity", "~~NULL~~");
+ } else {
+ entity.a(crashreportsystemdetails);
+ }
+
+ throw new ReportedException(crashreport);
+ }
}
this.methodProfiler.b();
@@ -1177,7 +1222,7 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.c("tileEntities");
this.N = true;
- iterator = this.tileEntityList.iterator();
+ Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
@@ -1189,7 +1234,19 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
- tileentity.g();
+ try {
+ tileentity.g();
+ } catch (Throwable throwable2) {
+ crashreport = CrashReport.a(throwable2, "Ticking tile entity");
+ crashreportsystemdetails = crashreport.a("Tile entity being ticked");
+ if (tileentity == null) {
+ crashreportsystemdetails.a("Tile entity", "~~NULL~~");
+ } else {
+ tileentity.a(crashreportsystemdetails);
+ }
+
+ throw new ReportedException(crashreport);
+ }
}
if (tileentity.r()) {
@@ -1212,10 +1269,8 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.c("pendingTileEntities");
if (!this.a.isEmpty()) {
- Iterator iterator1 = this.a.iterator();
-
- while (iterator1.hasNext()) {
- TileEntity tileentity1 = (TileEntity) iterator1.next();
+ for (int l = 0; l < this.a.size(); ++l) {
+ TileEntity tileentity1 = (TileEntity) this.a.get(l);
if (!tileentity1.r()) {
/* CraftBukkit start - order matters, moved down
@@ -1335,19 +1390,16 @@ public abstract class World implements IBlockAccess {
public boolean a(AxisAlignedBB axisalignedbb, Entity entity) {
List list = this.getEntities((Entity) null, axisalignedbb);
- Iterator iterator = list.iterator();
- Entity entity1;
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity1 = (Entity) list.get(i);
- do {
- if (!iterator.hasNext()) {
- return true;
+ if (!entity1.dead && entity1.m && entity1 != entity) {
+ return false;
}
+ }
- entity1 = (Entity) iterator.next();
- } while (entity1.dead || !entity1.m || entity1 == entity);
-
- return false;
+ return true;
}
public boolean c(AxisAlignedBB axisalignedbb) {
@@ -1633,10 +1685,8 @@ public abstract class World implements IBlockAccess {
TileEntity tileentity = chunk.e(i & 15, j, k & 15);
if (tileentity == null) {
- Iterator iterator = this.a.iterator();
-
- while (iterator.hasNext()) {
- TileEntity tileentity1 = (TileEntity) iterator.next();
+ for (int l = 0; l < this.a.size(); ++l) {
+ TileEntity tileentity1 = (TileEntity) this.a.get(l);
if (!tileentity1.r() && tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
tileentity = tileentity1;
@@ -1668,7 +1718,7 @@ public abstract class World implements IBlockAccess {
}
}
- public void q(int i, int j, int k) {
+ public void r(int i, int j, int k) {
TileEntity tileentity = this.getTileEntity(i, j, k);
if (tileentity != null && this.N) {
@@ -1692,17 +1742,29 @@ public abstract class World implements IBlockAccess {
this.b.add(tileentity);
}
- public boolean r(int i, int j, int k) {
+ public boolean s(int i, int j, int k) {
Block block = Block.byId[this.getTypeId(i, j, k)];
return block == null ? false : block.c();
}
- public boolean s(int i, int j, int k) {
+ public boolean t(int i, int j, int k) {
return Block.i(this.getTypeId(i, j, k));
}
- public boolean t(int i, int j, int k) {
+ public boolean u(int i, int j, int k) {
+ int l = this.getTypeId(i, j, k);
+
+ if (l != 0 && Block.byId[l] != null) {
+ AxisAlignedBB axisalignedbb = Block.byId[l].e(this, i, j, k);
+
+ return axisalignedbb != null && axisalignedbb.b() >= 1.0D;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean v(int i, int j, int k) {
Block block = Block.byId[this.getTypeId(i, j, k)];
return block == null ? false : (block.material.k() && block.b() ? true : (block instanceof BlockStairs ? (this.getData(i, j, k) & 4) == 4 : (block instanceof BlockStepAbstract ? (this.getData(i, j, k) & 8) == 8 : false)));
@@ -1724,7 +1786,7 @@ public abstract class World implements IBlockAccess {
}
}
- public void w() {
+ public void x() {
int i = this.a(1.0F);
if (i != this.j) {
@@ -1833,11 +1895,11 @@ public abstract class World implements IBlockAccess {
}
}
- public void x() {
+ public void y() {
this.worldData.setWeatherDuration(1);
}
- protected void y() {
+ protected void z() {
// this.chunkTickList.clear(); // CraftBukkit - removed
this.methodProfiler.a("buildList");
@@ -1879,7 +1941,7 @@ public abstract class World implements IBlockAccess {
k = MathHelper.floor(entityhuman.locY) + this.random.nextInt(11) - 5;
int j1 = MathHelper.floor(entityhuman.locZ) + this.random.nextInt(11) - 5;
- this.x(j, k, j1);
+ this.z(j, k, j1);
}
this.methodProfiler.b();
@@ -1897,7 +1959,7 @@ public abstract class World implements IBlockAccess {
l += i;
i1 += j;
- if (k1 == 0 && this.k(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
+ if (k1 == 0 && this.l(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
EntityHuman entityhuman = this.findNearbyPlayer((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, 8.0D);
if (entityhuman != null && entityhuman.e((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D) > 4.0D) {
@@ -1912,14 +1974,14 @@ public abstract class World implements IBlockAccess {
}
protected void g() {
- this.y();
+ this.z();
}
- public boolean u(int i, int j, int k) {
+ public boolean w(int i, int j, int k) {
return this.c(i, j, k, false);
}
- public boolean v(int i, int j, int k) {
+ public boolean x(int i, int j, int k) {
return this.c(i, j, k, true);
}
@@ -1966,7 +2028,7 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean w(int i, int j, int k) {
+ public boolean y(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
float f = biomebase.j();
@@ -1986,7 +2048,7 @@ public abstract class World implements IBlockAccess {
}
}
- public void x(int i, int j, int k) {
+ public void z(int i, int j, int k) {
if (!this.worldProvider.f) {
this.c(EnumSkyBlock.SKY, i, j, k);
}
@@ -1997,7 +2059,7 @@ public abstract class World implements IBlockAccess {
private int b(int i, int j, int k, int l, int i1, int j1) {
int k1 = 0;
- if (this.j(j, k, l)) {
+ if (this.k(j, k, l)) {
k1 = 15;
} else {
if (j1 == 0) {
@@ -2294,10 +2356,9 @@ public abstract class World implements IBlockAccess {
List list = this.a(oclass, axisalignedbb);
Entity entity1 = null;
double d0 = Double.MAX_VALUE;
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- Entity entity2 = (Entity) iterator.next();
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity2 = (Entity) list.get(i);
if (entity2 != entity) {
double d1 = entity.e(entity2);
@@ -2432,7 +2493,7 @@ public abstract class World implements IBlockAccess {
}
public boolean isBlockFaceIndirectlyPowered(int i, int j, int k, int l) {
- if (this.s(i, j, k)) {
+ if (this.t(i, j, k)) {
return this.isBlockPowered(i, j, k);
} else {
int i1 = this.getTypeId(i, j, k);
@@ -2496,7 +2557,7 @@ public abstract class World implements IBlockAccess {
}
if (entityhuman1.isInvisible()) {
- float f = entityhuman1.bO();
+ float f = entityhuman1.bS();
if (f < 0.1F) {
f = 0.1F;
@@ -2525,7 +2586,7 @@ public abstract class World implements IBlockAccess {
return null;
}
- public void C() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ public void D() throws ExceptionWorldConflict { // CraftBukkit - added throws
this.dataManager.checkSession();
}
@@ -2537,12 +2598,12 @@ public abstract class World implements IBlockAccess {
return this.worldData.getTime();
}
- public long F() {
- return this.worldData.g();
+ public long getDayTime() {
+ return this.worldData.getDayTime();
}
- public void setTime(long i) {
- this.worldData.c(i);
+ public void setDayTime(long i) {
+ this.worldData.setDayTime(i);
}
public ChunkCoordinates getSpawn() {
@@ -2555,7 +2616,7 @@ public abstract class World implements IBlockAccess {
public void broadcastEntityEffect(Entity entity, byte b0) {}
- public IChunkProvider H() {
+ public IChunkProvider I() {
return this.chunkProvider;
}
@@ -2597,18 +2658,18 @@ public abstract class World implements IBlockAccess {
return this.m + (this.n - this.m) * f;
}
- public boolean L() {
+ public boolean M() {
return (double) this.i(1.0F) > 0.9D;
}
- public boolean M() {
+ public boolean N() {
return (double) this.j(1.0F) > 0.2D;
}
- public boolean B(int i, int j, int k) {
- if (!this.M()) {
+ public boolean D(int i, int j, int k) {
+ if (!this.N()) {
return false;
- } else if (!this.j(i, j, k)) {
+ } else if (!this.k(i, j, k)) {
return false;
} else if (this.h(i, k) > j) {
return false;
@@ -2619,7 +2680,7 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean C(int i, int j, int k) {
+ public boolean E(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
return biomebase.e();
@@ -2657,7 +2718,7 @@ public abstract class World implements IBlockAccess {
return 256;
}
- public int O() {
+ public int P() {
return this.worldProvider.f ? 128 : 256;
}
@@ -2665,7 +2726,7 @@ public abstract class World implements IBlockAccess {
return null;
}
- public Random D(int i, int j, int k) {
+ public Random F(int i, int j, int k) {
long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k;
this.random.setSeed(l);
@@ -2673,21 +2734,28 @@ public abstract class World implements IBlockAccess {
}
public ChunkPosition b(String s, int i, int j, int k) {
- return this.H().findNearestMapFeature(this, s, i, j, k);
+ return this.I().findNearestMapFeature(this, s, i, j, k);
}
- public CrashReport a(CrashReport crashreport) {
- crashreport.a("World " + this.worldData.getName() + " Entities", (Callable) (new CrashReportEntities(this)));
- crashreport.a("World " + this.worldData.getName() + " Players", (Callable) (new CrashReportPlayers(this)));
- crashreport.a("World " + this.worldData.getName() + " Chunk Stats", (Callable) (new CrashReportChunkStats(this)));
- return crashreport;
+ public CrashReportSystemDetails a(CrashReport crashreport) {
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Affected level", 1);
+
+ crashreportsystemdetails.a("Level name", (this.worldData == null ? "????" : this.worldData.getName()));
+ crashreportsystemdetails.a("All players", (Callable) (new CrashReportPlayers(this)));
+ crashreportsystemdetails.a("Chunk stats", (Callable) (new CrashReportChunkStats(this)));
+
+ try {
+ this.worldData.a(crashreportsystemdetails);
+ } catch (Throwable throwable) {
+ crashreportsystemdetails.a("Level Data Unobtainable", throwable);
+ }
+
+ return crashreportsystemdetails;
}
public void g(int i, int j, int k, int l, int i1) {
- Iterator iterator = this.w.iterator();
-
- while (iterator.hasNext()) {
- IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+ for (int j1 = 0; j1 < this.w.size(); ++j1) {
+ IWorldAccess iworldaccess = (IWorldAccess) this.w.get(j1);
iworldaccess.b(i, j, k, l, i1);
}
@@ -2697,8 +2765,11 @@ public abstract class World implements IBlockAccess {
return this.K;
}
- public Calendar S() {
- this.L.setTimeInMillis(System.currentTimeMillis());
+ public Calendar T() {
+ if (this.getTime() % 600L == 0L) {
+ this.L.setTimeInMillis(System.currentTimeMillis());
+ }
+
return this.L;
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java
index 4124d941..d0d49bff 100644
--- a/src/main/java/net/minecraft/server/WorldGenTrees.java
+++ b/src/main/java/net/minecraft/server/WorldGenTrees.java
@@ -86,7 +86,7 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe
for (int l2 = k - i2; l2 <= k + i2; ++l2) {
int i3 = l2 - k;
- if ((Math.abs(k2) != i2 || Math.abs(i3) != i2 || random.nextInt(2) != 0 && k1 != 0) && !Block.q[world.getTypeId(j2, j1, l2)]) {
+ if ((Math.abs(k2) != i2 || Math.abs(i3) != i2 || random.nextInt(2) != 0 && k1 != 0) && world.isEmpty(j2, j1, l2)) {
this.setTypeAndData(world, j2, j1, l2, Block.LEAVES.id, this.d);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java
index 5bab0870..80145cd9 100644
--- a/src/main/java/net/minecraft/server/WorldManager.java
+++ b/src/main/java/net/minecraft/server/WorldManager.java
@@ -33,6 +33,10 @@ public class WorldManager implements IWorldAccess {
this.server.getServerConfigurationManager().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
}
+ public void a(EntityHuman entityhuman, String s, double d0, double d1, double d2, float f, float f1) {
+ this.server.getServerConfigurationManager().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.worldProvider.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
+ }
+
public void a(int i, int j, int k, int l, int i1, int j1) {}
public void a(int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index 7b3976f9..a154401e 100644
--- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -175,7 +175,7 @@ public class WorldMap extends WorldMapBase {
d2 += d2 < 0.0D ? -8.0D : 8.0D;
b3 = (byte) ((int) (d2 * 16.0D / 360.0D));
if (this.map < 0) {
- int k = (int) (world.getWorldData().g() / 10L);
+ int k = (int) (world.getWorldData().getDayTime() / 10L);
b3 = (byte) (k * k * 34187121 + k * 121 >> 15 & 15);
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index f9e246c7..02982bae 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -30,9 +30,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public boolean savingDisabled;
private boolean O;
private int emptyTime = 0;
- private NoteDataList[] Q = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
- private int R = 0;
- private static final StructurePieceTreasure[] S = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)};
+ private final PortalTravelAgent Q;
+ private NoteDataList[] R = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
+ private int S = 0;
+ private static final StructurePieceTreasure[] T = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)};
private IntHashMap entitiesById;
// CraftBukkit start
@@ -57,6 +58,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
if (this.N == null) {
this.N = new TreeSet();
}
+
+ this.Q = new PortalTravelAgent(this);
}
// CraftBukkit start
@@ -140,9 +143,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
if (!flag) {
- long i = this.worldData.g() + 24000L;
+ long i = this.worldData.getDayTime() + 24000L;
- this.worldData.c(i - i % 24000L);
+ this.worldData.setDayTime(i - i % 24000L);
this.d();
}
}
@@ -162,9 +165,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.j = j;
}
- this.U();
- this.worldData.b(this.worldData.getTime() + 1L);
- this.worldData.c(this.worldData.g() + 1L);
+ this.V();
+ this.worldData.setTime(this.worldData.getTime() + 1L);
+ this.worldData.setDayTime(this.worldData.getDayTime() + 1L);
this.methodProfiler.c("tickPending");
this.a(false);
this.methodProfiler.c("tickTiles");
@@ -174,12 +177,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.methodProfiler.c("village");
this.villages.tick();
this.siegeManager.a();
+ this.methodProfiler.c("portalForcer");
+ this.Q.a(this.getTime());
this.methodProfiler.b();
- this.U();
+ this.V();
}
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
- List list = this.H().getMobsFor(enumcreaturetype, i, j, k);
+ List list = this.I().getMobsFor(enumcreaturetype, i, j, k);
return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null;
}
@@ -210,10 +215,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- this.T();
+ this.U();
}
- private void T() {
+ private void U() {
// CraftBukkit start
WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
this.getServer().getPluginManager().callEvent(weather);
@@ -286,13 +291,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
int k1;
int l1;
- if (this.random.nextInt(100000) == 0 && this.M() && this.L()) {
+ if (this.random.nextInt(100000) == 0 && this.N() && this.M()) {
this.k = this.k * 3 + 1013904223;
i1 = this.k >> 2;
j1 = k + (i1 & 15);
k1 = l + (i1 >> 8 & 15);
l1 = this.h(j1, k1);
- if (this.B(j1, l1, k1)) {
+ if (this.D(j1, l1, k1)) {
this.strikeLightning(new EntityLightning(this, (double) j1, (double) l1, (double) k1));
this.q = 2;
}
@@ -307,7 +312,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
j1 = i1 & 15;
k1 = i1 >> 8 & 15;
l1 = this.h(j1 + k, k1 + l);
- if (this.v(j1 + k, l1 - 1, k1 + l)) {
+ if (this.x(j1 + k, l1 - 1, k1 + l)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1 - 1, k1 + l).getState();
blockState.setTypeId(Block.ICE.id);
@@ -320,7 +325,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.M() && this.w(j1 + k, l1, k1 + l)) {
+ if (this.N() && this.y(j1 + k, l1, k1 + l)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState();
blockState.setTypeId(Block.SNOW.id);
@@ -333,7 +338,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.M()) {
+ if (this.N()) {
BiomeBase biomebase = this.getBiome(j1 + k, k1 + l);
if (biomebase.d()) {
@@ -474,8 +479,23 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
int k = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
if (k == nextticklistentry.d && k > 0) {
- Block.byId[k].b(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
- }
+ try {
+ Block.byId[k].b(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception while ticking a block");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being ticked");
+
+ int l;
+
+ try {
+ l = this.getData(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
+ } catch (Throwable throwable1) {
+ l = -1;
+ }
+
+ CrashReportSystemDetails.a(crashreportsystemdetails, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, k, l);
+ throw new ReportedException(crashreport);
+ } }
}
}
@@ -555,10 +575,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public List getTileEntities(int i, int j, int k, int l, int i1, int j1) {
ArrayList arraylist = new ArrayList();
+ // CraftBukkit start - use iterator
Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
+ // CraftBukkit end
if (tileentity.x >= i && tileentity.y >= j && tileentity.z >= k && tileentity.x < l && tileentity.y < i1 && tileentity.z < j1) {
arraylist.add(tileentity);
@@ -654,7 +676,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void k() {
- WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(S, 10);
+ WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(T, 10);
for (int i = 0; i < 10; ++i) {
int j = this.worldData.c() + this.random.nextInt(6) - this.random.nextInt(6);
@@ -687,7 +709,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws
- this.C();
+ this.D();
this.dataManager.saveWorldData(this.worldData, this.server.getServerConfigurationManager().q());
this.worldMaps.a();
}
@@ -698,13 +720,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
Entity[] aentity = entity.ao();
if (aentity != null) {
- Entity[] aentity1 = aentity;
- int i = aentity.length;
-
- for (int j = 0; j < i; ++j) {
- Entity entity1 = aentity1[j];
-
- this.entitiesById.a(entity1.id, entity1);
+ for (int i = 0; i < aentity.length; ++i) {
+ this.entitiesById.a(aentity[i].id, aentity[i]);
}
}
}
@@ -715,13 +732,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
Entity[] aentity = entity.ao();
if (aentity != null) {
- Entity[] aentity1 = aentity;
- int i = aentity.length;
-
- for (int j = 0; j < i; ++j) {
- Entity entity1 = aentity1[j];
-
- this.entitiesById.d(entity1.id);
+ for (int i = 0; i < aentity.length; ++i) {
+ this.entitiesById.d(aentity[i].id);
}
}
}
@@ -789,13 +801,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public void playNote(int i, int j, int k, int l, int i1, int j1) {
NoteBlockData noteblockdata = new NoteBlockData(i, j, k, l, i1, j1);
- Iterator iterator = this.Q[this.R].iterator();
+ Iterator iterator = this.R[this.S].iterator();
NoteBlockData noteblockdata1;
do {
if (!iterator.hasNext()) {
- this.Q[this.R].add(noteblockdata);
+ this.R[this.S].add(noteblockdata);
return;
}
@@ -804,12 +816,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
- private void U() {
- while (!this.Q[this.R].isEmpty()) {
- int i = this.R;
+ private void V() {
+ while (!this.R[this.S].isEmpty()) {
+ int i = this.S;
- this.R ^= 1;
- Iterator iterator = this.Q[i].iterator();
+ this.S ^= 1;
+ Iterator iterator = this.R[i].iterator();
while (iterator.hasNext()) {
NoteBlockData noteblockdata = (NoteBlockData) iterator.next();
@@ -820,7 +832,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- this.Q[i].clear();
+ this.R[i].clear();
}
}
@@ -840,10 +852,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void n() {
- boolean flag = this.M();
+ boolean flag = this.N();
super.n();
- if (flag != this.M()) {
+ if (flag != this.N()) {
// CraftBukkit start - only sending weather packets to those affected
for (int i = 0; i < this.players.size(); ++i) {
if (((EntityPlayer) this.players.get(i)).world == this) {
@@ -865,4 +877,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public PlayerManager getPlayerManager() {
return this.manager;
}
+
+ public PortalTravelAgent s() {
+ return this.Q;
+ }
}