summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2012-07-29 02:33:13 -0500
committerTravis Watkins <amaranth@ubuntu.com>2012-08-02 04:58:50 -0500
commita43d621c0138110d2ec362b2eaa8f938f241bb49 (patch)
treed2ebc0d7a4a969d3257b1b958236428a24117eb1 /src/main
parent08e2923bd4282579ca0cf7af0e6207cba0591e5c (diff)
downloadcraftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar
craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar.gz
craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar.lz
craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar.xz
craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.zip
Update CraftBukkit to Minecraft 1.3.1
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/Block.java467
-rw-r--r--src/main/java/net/minecraft/server/BlockBloodStone.java1
-rw-r--r--src/main/java/net/minecraft/server/BlockButton.java105
-rw-r--r--src/main/java/net/minecraft/server/BlockCactus.java21
-rw-r--r--src/main/java/net/minecraft/server/BlockCauldron.java97
-rw-r--r--src/main/java/net/minecraft/server/BlockCrops.java17
-rw-r--r--src/main/java/net/minecraft/server/BlockDispenser.java311
-rw-r--r--src/main/java/net/minecraft/server/BlockDoor.java131
-rw-r--r--src/main/java/net/minecraft/server/BlockDragonEgg.java33
-rw-r--r--src/main/java/net/minecraft/server/BlockFire.java90
-rw-r--r--src/main/java/net/minecraft/server/BlockFlowing.java79
-rw-r--r--src/main/java/net/minecraft/server/BlockGrass.java9
-rw-r--r--src/main/java/net/minecraft/server/BlockIce.java45
-rw-r--r--src/main/java/net/minecraft/server/BlockLeaves.java92
-rw-r--r--src/main/java/net/minecraft/server/BlockLever.java147
-rw-r--r--src/main/java/net/minecraft/server/BlockMinecartDetector.java24
-rw-r--r--src/main/java/net/minecraft/server/BlockMinecartTrack.java29
-rw-r--r--src/main/java/net/minecraft/server/BlockMushroom.java17
-rw-r--r--src/main/java/net/minecraft/server/BlockMycel.java5
-rw-r--r--src/main/java/net/minecraft/server/BlockNetherWart.java23
-rw-r--r--src/main/java/net/minecraft/server/BlockPiston.java126
-rw-r--r--src/main/java/net/minecraft/server/BlockPistonExtension.java77
-rw-r--r--src/main/java/net/minecraft/server/BlockPortal.java30
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlate.java54
-rw-r--r--src/main/java/net/minecraft/server/BlockPumpkin.java12
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneLamp.java13
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneOre.java35
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneTorch.java49
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneWire.java132
-rw-r--r--src/main/java/net/minecraft/server/BlockReed.java20
-rw-r--r--src/main/java/net/minecraft/server/BlockSand.java19
-rw-r--r--src/main/java/net/minecraft/server/BlockSapling.java14
-rw-r--r--src/main/java/net/minecraft/server/BlockSign.java12
-rw-r--r--src/main/java/net/minecraft/server/BlockSnow.java23
-rw-r--r--src/main/java/net/minecraft/server/BlockSoil.java24
-rw-r--r--src/main/java/net/minecraft/server/BlockStationary.java28
-rw-r--r--src/main/java/net/minecraft/server/BlockStem.java21
-rw-r--r--src/main/java/net/minecraft/server/BlockTNT.java19
-rw-r--r--src/main/java/net/minecraft/server/BlockTrapdoor.java39
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java160
-rw-r--r--src/main/java/net/minecraft/server/ChunkProviderServer.java23
-rw-r--r--src/main/java/net/minecraft/server/ChunkRegionLoader.java54
-rw-r--r--src/main/java/net/minecraft/server/ChunkSection.java30
-rw-r--r--src/main/java/net/minecraft/server/ConsoleLogFormatter.java2
-rw-r--r--src/main/java/net/minecraft/server/ConsoleLogManager.java2
-rw-r--r--src/main/java/net/minecraft/server/Container.java109
-rw-r--r--src/main/java/net/minecraft/server/ContainerBrewingStand.java53
-rw-r--r--src/main/java/net/minecraft/server/ContainerChest.java30
-rw-r--r--src/main/java/net/minecraft/server/ContainerDispenser.java15
-rw-r--r--src/main/java/net/minecraft/server/ContainerEnchantTable.java59
-rw-r--r--src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java44
-rw-r--r--src/main/java/net/minecraft/server/ContainerFurnace.java42
-rw-r--r--src/main/java/net/minecraft/server/ContainerMerchant.java130
-rw-r--r--src/main/java/net/minecraft/server/ContainerPlayer.java33
-rw-r--r--src/main/java/net/minecraft/server/ContainerWorkbench.java21
-rw-r--r--src/main/java/net/minecraft/server/CraftingManager.java92
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServer.java307
-rw-r--r--src/main/java/net/minecraft/server/Enchantment.java5
-rw-r--r--src/main/java/net/minecraft/server/Entity.java580
-rw-r--r--src/main/java/net/minecraft/server/EntityAgeable.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java188
-rw-r--r--src/main/java/net/minecraft/server/EntityBlaze.java66
-rw-r--r--src/main/java/net/minecraft/server/EntityBoat.java200
-rw-r--r--src/main/java/net/minecraft/server/EntityChicken.java44
-rw-r--r--src/main/java/net/minecraft/server/EntityComplex.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityCow.java39
-rw-r--r--src/main/java/net/minecraft/server/EntityCreature.java97
-rw-r--r--src/main/java/net/minecraft/server/EntityCreeper.java59
-rw-r--r--src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityEgg.java5
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderCrystal.java29
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderDragon.java384
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderPearl.java59
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderman.java145
-rw-r--r--src/main/java/net/minecraft/server/EntityExperienceOrb.java30
-rw-r--r--src/main/java/net/minecraft/server/EntityFallingBlock.java90
-rw-r--r--src/main/java/net/minecraft/server/EntityFireball.java73
-rw-r--r--src/main/java/net/minecraft/server/EntityFishingHook.java244
-rw-r--r--src/main/java/net/minecraft/server/EntityGhast.java44
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java594
-rw-r--r--src/main/java/net/minecraft/server/EntityIronGolem.java86
-rw-r--r--src/main/java/net/minecraft/server/EntityItem.java84
-rw-r--r--src/main/java/net/minecraft/server/EntityLightning.java (renamed from src/main/java/net/minecraft/server/EntityWeatherLighting.java)22
-rw-r--r--src/main/java/net/minecraft/server/EntityLiving.java844
-rw-r--r--src/main/java/net/minecraft/server/EntityMagmaCube.java38
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecart.java223
-rw-r--r--src/main/java/net/minecraft/server/EntityMonster.java46
-rw-r--r--src/main/java/net/minecraft/server/EntityMushroomCow.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityOcelot.java107
-rw-r--r--src/main/java/net/minecraft/server/EntityPainting.java75
-rw-r--r--src/main/java/net/minecraft/server/EntityPig.java36
-rw-r--r--src/main/java/net/minecraft/server/EntityPigZombie.java40
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java516
-rw-r--r--src/main/java/net/minecraft/server/EntityPotion.java35
-rw-r--r--src/main/java/net/minecraft/server/EntityProjectile.java62
-rw-r--r--src/main/java/net/minecraft/server/EntitySheep.java43
-rw-r--r--src/main/java/net/minecraft/server/EntitySilverfish.java62
-rw-r--r--src/main/java/net/minecraft/server/EntitySkeleton.java39
-rw-r--r--src/main/java/net/minecraft/server/EntitySlime.java79
-rw-r--r--src/main/java/net/minecraft/server/EntitySmallFireball.java8
-rw-r--r--src/main/java/net/minecraft/server/EntitySnowman.java28
-rw-r--r--src/main/java/net/minecraft/server/EntitySpider.java58
-rw-r--r--src/main/java/net/minecraft/server/EntitySquid.java109
-rw-r--r--src/main/java/net/minecraft/server/EntityTNTPrimed.java20
-rw-r--r--src/main/java/net/minecraft/server/EntityThrownExpBottle.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityTracker.java43
-rw-r--r--src/main/java/net/minecraft/server/EntityTrackerEntry.java337
-rw-r--r--src/main/java/net/minecraft/server/EntityWolf.java200
-rw-r--r--src/main/java/net/minecraft/server/EntityZombie.java60
-rw-r--r--src/main/java/net/minecraft/server/Explosion.java215
-rw-r--r--src/main/java/net/minecraft/server/FoodMetaData.java8
-rw-r--r--src/main/java/net/minecraft/server/FurnaceRecipes.java44
-rw-r--r--src/main/java/net/minecraft/server/IDataManager.java9
-rw-r--r--src/main/java/net/minecraft/server/IInventory.java4
-rw-r--r--src/main/java/net/minecraft/server/IRecipe.java (renamed from src/main/java/net/minecraft/server/CraftingRecipe.java)2
-rw-r--r--src/main/java/net/minecraft/server/InventoryCraftResult.java5
-rw-r--r--src/main/java/net/minecraft/server/InventoryCrafting.java6
-rw-r--r--src/main/java/net/minecraft/server/InventoryEnderChest.java110
-rw-r--r--src/main/java/net/minecraft/server/InventoryLargeChest.java10
-rw-r--r--src/main/java/net/minecraft/server/InventoryMerchant.java182
-rw-r--r--src/main/java/net/minecraft/server/InventorySubcontainer.java (renamed from src/main/java/net/minecraft/server/ContainerEnchantTableSubcontainer.java)56
-rw-r--r--src/main/java/net/minecraft/server/ItemBed.java7
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java32
-rw-r--r--src/main/java/net/minecraft/server/ItemBoat.java29
-rw-r--r--src/main/java/net/minecraft/server/ItemBow.java31
-rw-r--r--src/main/java/net/minecraft/server/ItemBucket.java69
-rw-r--r--src/main/java/net/minecraft/server/ItemDoor.java9
-rw-r--r--src/main/java/net/minecraft/server/ItemDye.java115
-rw-r--r--src/main/java/net/minecraft/server/ItemFireball.java7
-rw-r--r--src/main/java/net/minecraft/server/ItemFishingRod.java11
-rw-r--r--src/main/java/net/minecraft/server/ItemFlintAndSteel.java7
-rw-r--r--src/main/java/net/minecraft/server/ItemFood.java60
-rw-r--r--src/main/java/net/minecraft/server/ItemHoe.java12
-rw-r--r--src/main/java/net/minecraft/server/ItemInWorldManager.java260
-rw-r--r--src/main/java/net/minecraft/server/ItemMinecart.java3
-rw-r--r--src/main/java/net/minecraft/server/ItemMonsterEgg.java13
-rw-r--r--src/main/java/net/minecraft/server/ItemPainting.java5
-rw-r--r--src/main/java/net/minecraft/server/ItemRedstone.java5
-rw-r--r--src/main/java/net/minecraft/server/ItemReed.java10
-rw-r--r--src/main/java/net/minecraft/server/ItemSeeds.java5
-rw-r--r--src/main/java/net/minecraft/server/ItemSign.java7
-rw-r--r--src/main/java/net/minecraft/server/ItemStack.java59
-rw-r--r--src/main/java/net/minecraft/server/ItemStep.java41
-rw-r--r--src/main/java/net/minecraft/server/ItemWaterLily.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemWorldMap.java208
-rw-r--r--src/main/java/net/minecraft/server/MinecartTrackLogic.java63
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java1162
-rw-r--r--src/main/java/net/minecraft/server/MobEffectList.java63
-rw-r--r--src/main/java/net/minecraft/server/NBTTagCompound.java5
-rw-r--r--src/main/java/net/minecraft/server/NetLoginHandler.java173
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java451
-rw-r--r--src/main/java/net/minecraft/server/NetworkAcceptThread.java56
-rw-r--r--src/main/java/net/minecraft/server/NetworkListenThread.java111
-rw-r--r--src/main/java/net/minecraft/server/NetworkManager.java300
-rw-r--r--src/main/java/net/minecraft/server/NetworkWriterThread.java37
-rw-r--r--src/main/java/net/minecraft/server/NoteDataList.java14
-rw-r--r--src/main/java/net/minecraft/server/Packet.java118
-rw-r--r--src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java7
-rw-r--r--src/main/java/net/minecraft/server/Packet24MobSpawn.java69
-rw-r--r--src/main/java/net/minecraft/server/Packet2Handshake.java46
-rw-r--r--src/main/java/net/minecraft/server/Packet3Chat.java24
-rw-r--r--src/main/java/net/minecraft/server/Packet51MapChunk.java221
-rw-r--r--src/main/java/net/minecraft/server/Packet56MapChunkBulk.java149
-rw-r--r--src/main/java/net/minecraft/server/Path.java4
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java20
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java35
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreed.java24
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalEatTile.java14
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java27
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalSelector.java106
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalTarget.java64
-rw-r--r--src/main/java/net/minecraft/server/PlayerInstance.java100
-rw-r--r--src/main/java/net/minecraft/server/PlayerInventory.java79
-rw-r--r--src/main/java/net/minecraft/server/PlayerManager.java149
-rw-r--r--src/main/java/net/minecraft/server/PortalTravelAgent.java10
-rw-r--r--src/main/java/net/minecraft/server/PropertyManager.java34
-rw-r--r--src/main/java/net/minecraft/server/RecipesFurnace.java51
-rw-r--r--src/main/java/net/minecraft/server/RemoteControlSession.java154
-rw-r--r--src/main/java/net/minecraft/server/SecondaryWorldServer.java9
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java (renamed from src/main/java/net/minecraft/server/ServerConfigurationManager.java)653
-rw-r--r--src/main/java/net/minecraft/server/ShapedRecipes.java2
-rw-r--r--src/main/java/net/minecraft/server/ShapelessRecipes.java2
-rw-r--r--src/main/java/net/minecraft/server/Slot.java18
-rw-r--r--src/main/java/net/minecraft/server/SpawnerCreature.java67
-rw-r--r--src/main/java/net/minecraft/server/ThreadCommandReader.java14
-rw-r--r--src/main/java/net/minecraft/server/ThreadLoginVerifier.java52
-rw-r--r--src/main/java/net/minecraft/server/TileEntity.java29
-rw-r--r--src/main/java/net/minecraft/server/TileEntityBrewingStand.java48
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java38
-rw-r--r--src/main/java/net/minecraft/server/TileEntityDispenser.java30
-rw-r--r--src/main/java/net/minecraft/server/TileEntityFurnace.java29
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java122
-rw-r--r--src/main/java/net/minecraft/server/TileEntityNote.java4
-rw-r--r--src/main/java/net/minecraft/server/TileEntityPiston.java26
-rw-r--r--src/main/java/net/minecraft/server/TileEntitySign.java10
-rw-r--r--src/main/java/net/minecraft/server/Village.java53
-rw-r--r--src/main/java/net/minecraft/server/VillageSiege.java6
-rw-r--r--src/main/java/net/minecraft/server/World.java1436
-rw-r--r--src/main/java/net/minecraft/server/WorldData.java259
-rw-r--r--src/main/java/net/minecraft/server/WorldGenBigTree.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldGenForest.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldGenGroundBush.java4
-rw-r--r--src/main/java/net/minecraft/server/WorldGenHugeMushroom.java8
-rw-r--r--src/main/java/net/minecraft/server/WorldGenMegaTree.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldGenSwampTree.java8
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga1.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga2.java6
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTrees.java17
-rw-r--r--src/main/java/net/minecraft/server/WorldGenerator.java4
-rw-r--r--src/main/java/net/minecraft/server/WorldManager.java36
-rw-r--r--src/main/java/net/minecraft/server/WorldMap.java29
-rw-r--r--src/main/java/net/minecraft/server/WorldNBTStorage.java43
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java685
-rw-r--r--src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java60
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftChunk.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java12
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java101
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java31
-rw-r--r--src/main/java/org/bukkit/craftbukkit/Main.java11
-rw-r--r--src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java9
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java21
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java7
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java7
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java12
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java12
239 files changed, 10677 insertions, 9064 deletions
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 6e229d5b..ae4ab83a 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -1,10 +1,11 @@
package net.minecraft.server;
-import java.util.ArrayList;
+import java.util.List;
import java.util.Random;
public class Block {
+ private CreativeModeTab creativeTab;
public static final StepSound d = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound e = new StepSound("wood", 1.0F, 1.0F);
public static final StepSound f = new StepSound("gravel", 1.0F, 1.0F);
@@ -21,137 +22,149 @@ public class Block {
public static final int[] lightEmission = new int[4096];
public static final boolean[] r = new boolean[4096];
public static boolean[] s = new boolean[4096];
- public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).a("stone");
- public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).a("grass");
- public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).a("dirt");
- public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stonebrick");
- public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(e).a("wood").j();
- public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).a("sapling").j();
- public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).l().b(6000000.0F).a(h).a("bedrock").s();
- public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).f(3).a("water").s().j();
- public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).f(3).a("water").s().j();
- public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).f(255).a("lava").s().j();
- public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).f(255).a("lava").s().j();
- public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).a("sand");
- public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).a("gravel");
- public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).a("oreGold");
- public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).a("oreIron");
- public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).a("oreCoal");
- public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).a("log").j();
- public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).f(1).a(g).a("leaves").j();
- public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).a("sponge");
- public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).a("glass");
- public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).a("oreLapis");
- public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).a("blockLapis");
- public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).a("dispenser").j();
- public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).a("sandStone").j();
- public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).a("musicBlock").j();
- public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed").s().j();
- public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).a("goldenRail").j();
- public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).a("detectorRail").j();
- public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).a("pistonStickyBase").j();
- public static final Block WEB = (new BlockWeb(30, 11)).f(1).c(4.0F).a("web");
- public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).a("tallgrass");
- public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).a("deadbush");
- public static final Block PISTON = (new BlockPiston(33, 107, false)).a("pistonBase").j();
- public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).j();
- public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).a("cloth").j();
+ public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).b("stone");
+ public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).b("grass");
+ public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).b("dirt");
+ public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stonebrick").a(CreativeModeTab.b);
+ public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(e).b("wood").p();
+ public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).b("sapling").p();
+ public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).q().b(6000000.0F).a(h).b("bedrock").v().a(CreativeModeTab.b);
+ public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).h(3).b("water").v().p();
+ public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).h(3).b("water").v().p();
+ public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).h(255).b("lava").v().p();
+ public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).h(255).b("lava").v().p();
+ public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).b("sand");
+ public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).b("gravel");
+ public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).b("oreGold");
+ public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).b("oreIron");
+ public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).b("oreCoal");
+ public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).b("log").p();
+ public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).h(1).a(g).b("leaves").p();
+ public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).b("sponge");
+ public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).b("glass");
+ public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).b("oreLapis");
+ public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).b("blockLapis").a(CreativeModeTab.b);
+ public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).b("dispenser").p();
+ public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).b("sandStone").p();
+ public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).b("musicBlock").p();
+ public static final Block BED = (new BlockBed(26)).c(0.2F).b("bed").v().p();
+ public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).b("goldenRail").p();
+ public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).b("detectorRail").p();
+ public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).b("pistonStickyBase").p();
+ public static final Block WEB = (new BlockWeb(30, 11)).h(1).c(4.0F).b("web");
+ public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).b("tallgrass");
+ public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).b("deadbush");
+ public static final Block PISTON = (new BlockPiston(33, 107, false)).b("pistonBase").p();
+ public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).p();
+ public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).b("cloth").p();
public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
- public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).a("flower");
- public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).a("rose");
- public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, 29)).c(0.0F).a(g).a(0.125F).a("mushroom");
- public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, 28)).c(0.0F).a(g).a("mushroom");
- public static final Block GOLD_BLOCK = (new BlockOreBlock(41, 23)).c(3.0F).b(10.0F).a(i).a("blockGold");
- public static final Block IRON_BLOCK = (new BlockOreBlock(42, 22)).c(5.0F).b(10.0F).a(i).a("blockIron");
- public static final Block DOUBLE_STEP = (new BlockStep(43, true)).c(2.0F).b(10.0F).a(h).a("stoneSlab");
- public static final Block STEP = (new BlockStep(44, false)).c(2.0F).b(10.0F).a(h).a("stoneSlab");
- public static final Block BRICK = (new Block(45, 7, Material.STONE)).c(2.0F).b(10.0F).a(h).a("brick");
- public static final Block TNT = (new BlockTNT(46, 8)).c(0.0F).a(g).a("tnt");
- public static final Block BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).a("bookshelf");
- public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stoneMoss");
- public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(50.0F).b(2000.0F).a(h).a("obsidian");
- public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).a("torch").j();
- public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").s();
- public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").s();
- public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").j();
- public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").j();
- public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust").s().j();
- public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).a("oreDiamond");
- public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond");
- public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench");
- public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").s().j();
- public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland").j();
- public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").j();
- public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).a("furnace").j();
- public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").s().j();
- public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).a("doorWood").s().j();
- public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).a("ladder").j();
- public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).a("rail").j();
- public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE)).a("stairsStone").j();
- public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).a("sign").s().j();
- public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).a("lever").j();
- public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).a("pressurePlate").j();
- public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).a("doorIron").s().j();
- public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).a("pressurePlate").j();
- public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).a("oreRedstone").j();
- public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).a("oreRedstone").j();
- public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).a("notGate").j();
- public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).a("notGate").j();
- public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).a("button").j();
- public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).a("snow").f(0);
- public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).f(3).a(j).a("ice");
- public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(k).a("snow");
- public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).a("cactus");
- public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).a("clay");
- public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").s();
- public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").j();
- public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).a("fence");
- public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).a("pumpkin").j();
- public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).a("hellrock");
- public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).a("hellsand");
- public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).a("lightgem");
- public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).a("portal");
- public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).a("litpumpkin").j();
- public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake").s().j();
- public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).a("diode").s().j();
- public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").s().j();
- public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).a("lockedchest").a(true).j();
- public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").s().j();
- public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F);
- public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).a("stonebricksmooth");
- public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).a("mushroom").j();
- public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).a("mushroom").j();
- public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).a("fenceIron");
- public static final Block THIN_GLASS = (new BlockThinFence(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).a("thinGlass");
- public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).a("melon");
- public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).a("pumpkinStem").j();
- public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).a("pumpkinStem").j();
- public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).a("vine").j();
- public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).a("fenceGate").j();
- public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK)).a("stairsBrick").j();
- public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK)).a("stairsStoneBrickSmooth").j();
- public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(g).a("mycel");
- public static final Block WATER_LILY = (new BlockWaterLily(111, 76)).c(0.0F).a(g).a("waterlily");
- public static final Block NETHER_BRICK = (new Block(112, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).a("netherBrick");
- public static final Block NETHER_FENCE = (new BlockFence(113, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).a("netherFence");
- public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK)).a("stairsNetherBrick").j();
- public static final Block NETHER_WART = (new BlockNetherWart(115)).a("netherStalk").j();
- public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).a("enchantmentTable");
- public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).a("brewingStand").j();
- public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).a("cauldron").j();
+ public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).b("flower");
+ public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).b("rose");
+ public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, 29)).c(0.0F).a(g).a(0.125F).b("mushroom");
+ public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, 28)).c(0.0F).a(g).b("mushroom");
+ public static final Block GOLD_BLOCK = (new BlockOreBlock(41, 23)).c(3.0F).b(10.0F).a(i).b("blockGold");
+ public static final Block IRON_BLOCK = (new BlockOreBlock(42, 22)).c(5.0F).b(10.0F).a(i).b("blockIron");
+ public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
+ public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
+ public static final Block BRICK = (new Block(45, 7, Material.STONE)).c(2.0F).b(10.0F).a(h).b("brick").a(CreativeModeTab.b);
+ public static final Block TNT = (new BlockTNT(46, 8)).c(0.0F).a(g).b("tnt");
+ public static final Block BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).b("bookshelf");
+ public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stoneMoss").a(CreativeModeTab.b);
+ public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(50.0F).b(2000.0F).a(h).b("obsidian");
+ public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).b("torch").p();
+ public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).b("fire").v();
+ public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).b("mobSpawner").v();
+ public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).b("stairsWood").p();
+ public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).b("chest").p();
+ public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).b("redstoneDust").v().p();
+ public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).b("oreDiamond");
+ public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).b("blockDiamond");
+ public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).b("workbench");
+ public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).b("crops").v().p();
+ public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).b("farmland").p();
+ public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).b("furnace").p().a(CreativeModeTab.c);
+ public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).b("furnace").p();
+ public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).b("sign").v().p();
+ public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).b("doorWood").v().p();
+ public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).b("ladder").p();
+ public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).b("rail").p();
+ public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).b("stairsStone").p();
+ public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).b("sign").v().p();
+ public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).b("lever").p();
+ public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).b("pressurePlate").p();
+ public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).b("doorIron").v().p();
+ public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).b("pressurePlate").p();
+ public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).b("oreRedstone").p().a(CreativeModeTab.b);
+ public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).b("oreRedstone").p();
+ public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).b("notGate").p();
+ public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).b("notGate").p().a(CreativeModeTab.d);
+ public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).b("button").p();
+ public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).b("snow").p().h(0);
+ public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).h(3).a(j).b("ice");
+ public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(k).b("snow");
+ public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).b("cactus");
+ public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).b("clay");
+ public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).b("reeds").v();
+ public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).b("jukebox").p();
+ public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).b("fence");
+ public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).b("pumpkin").p();
+ public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).b("hellrock");
+ public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).b("hellsand");
+ public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).b("lightgem");
+ public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).b("portal");
+ public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).b("litpumpkin").p();
+ public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).b("cake").v().p();
+ public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).b("diode").v().p();
+ public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).b("diode").v().p();
+ public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).b("lockedchest").b(true).p();
+ public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).b("trapdoor").v().p();
+ public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).b("monsterStoneEgg");
+ public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).b("stonebricksmooth");
+ public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).b("mushroom").p();
+ public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).b("mushroom").p();
+ public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).b("fenceIron");
+ public static final Block THIN_GLASS = (new BlockThinFence(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).b("thinGlass");
+ public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).b("melon");
+ public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).b("pumpkinStem").p();
+ public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).b("pumpkinStem").p();
+ public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).b("vine").p();
+ public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).b("fenceGate").p();
+ public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).b("stairsBrick").p();
+ public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).b("stairsStoneBrickSmooth").p();
+ public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(g).b("mycel");
+ public static final Block WATER_LILY = (new BlockWaterLily(111, 76)).c(0.0F).a(g).b("waterlily");
+ public static final Block NETHER_BRICK = (new Block(112, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherBrick").a(CreativeModeTab.b);
+ public static final Block NETHER_FENCE = (new BlockFence(113, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherFence");
+ public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).b("stairsNetherBrick").p();
+ public static final Block NETHER_WART = (new BlockNetherWart(115)).b("netherStalk").p();
+ public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).b("enchantmentTable");
+ public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).b("brewingStand").p();
+ public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).b("cauldron").p();
public static final Block ENDER_PORTAL = (new BlockEnderPortal(119, Material.PORTAL)).c(-1.0F).b(6000000.0F);
- public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).a("endPortalFrame").j().b(6000000.0F);
- public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).a("whiteStone");
- public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).a("dragonEgg");
- public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).a("redstoneLight");
- public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).a("redstoneLight");
+ public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).b("endPortalFrame").p().b(6000000.0F).a(CreativeModeTab.c);
+ public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).b("whiteStone").a(CreativeModeTab.b);
+ public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).b("dragonEgg");
+ public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).b("redstoneLight").a(CreativeModeTab.d);
+ public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).b("redstoneLight");
+ public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(e).b("woodSlab");
+ public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(e).b("woodSlab");
+ public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(e).b("cocoa").p();
+ public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).b("stairsSandStone").p();
+ public static final Block EMERALD_ORE = (new BlockOre(129, 171)).c(3.0F).b(5.0F).a(h).b("oreEmerald");
+ public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(h).b("enderChest").p().a(0.5F);
+ public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).b("tripWireSource").p();
+ public static final Block TRIPWIRE = (new BlockTripwire(132)).b("tripWire").p();
+ public static final Block EMERALD_BLOCK = (new BlockOreBlock(133, 25)).c(5.0F).b(10.0F).a(i).b("blockEmerald");
+ public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).b("stairsWoodSpruce").p();
+ public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).b("stairsWoodBirch").p();
+ public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).b("stairsWoodJungle").p();
public int textureId;
public final int id;
protected float strength;
protected float durability;
- protected boolean bR;
- protected boolean bS;
- protected boolean bT;
+ protected boolean cd;
+ protected boolean ce;
+ protected boolean cf;
protected boolean isTileEntity;
public double minX;
public double minY;
@@ -160,16 +173,16 @@ public class Block {
public double maxY;
public double maxZ;
public StepSound stepSound;
- public float cc;
+ public float co;
public final Material material;
public float frictionFactor;
private String name;
protected Block(int i, Material material) {
- this.bR = true;
- this.bS = true;
+ this.cd = true;
+ this.ce = true;
this.stepSound = d;
- this.cc = 1.0F;
+ this.co = 1.0F;
this.frictionFactor = 0.6F;
if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
@@ -178,18 +191,18 @@ public class Block {
byId[i] = this;
this.id = i;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- n[i] = this.a();
- lightBlock[i] = this.a() ? 255 : 0;
+ n[i] = this.d();
+ lightBlock[i] = this.d() ? 255 : 0;
p[i] = !material.blocksLight();
}
}
- protected Block j() {
+ protected Block p() {
r[this.id] = true;
return this;
}
- protected void k() {}
+ protected void r_() {}
protected Block(int i, int j, Material material) {
this(i, material);
@@ -201,7 +214,7 @@ public class Block {
return this;
}
- protected Block f(int i) {
+ protected Block h(int i) {
lightBlock[this.id] = i;
return this;
}
@@ -216,21 +229,21 @@ public class Block {
return this;
}
- public static boolean g(int i) {
+ public static boolean i(int i) {
Block block = byId[i];
- return block == null ? false : block.material.j() && block.b();
+ return block == null ? false : block.material.k() && block.c();
}
- public boolean b() {
+ public boolean c() {
return true;
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return !this.material.isSolid();
}
- public int c() {
+ public int b() {
return 0;
}
@@ -243,25 +256,25 @@ public class Block {
return this;
}
- protected Block l() {
+ protected Block q() {
this.c(-1.0F);
return this;
}
- public float m() {
+ public float m(World world, int i, int j, int k) {
return this.strength;
}
- protected Block a(boolean flag) {
- this.bT = flag;
+ protected Block b(boolean flag) {
+ this.cf = flag;
return this;
}
- public boolean n() {
- return this.bT;
+ public boolean r() {
+ return this.cf;
}
- public boolean o() {
+ public boolean s() {
return this.isTileEntity;
}
@@ -274,7 +287,7 @@ public class Block {
this.maxZ = (double) f5;
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return iblockaccess.getMaterial(i, j, k).isBuildable();
}
@@ -286,43 +299,43 @@ public class Block {
return this.textureId;
}
- public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
+ public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
AxisAlignedBB axisalignedbb1 = this.e(world, i, j, k);
if (axisalignedbb1 != null && axisalignedbb.a(axisalignedbb1)) {
- arraylist.add(axisalignedbb1);
+ list.add(axisalignedbb1);
}
}
public AxisAlignedBB e(World world, int i, int j, int k) {
- return AxisAlignedBB.b((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ);
+ return AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ);
}
- public boolean a() {
+ public boolean d() {
return true;
}
public boolean a(int i, boolean flag) {
- return this.E_();
+ return this.l();
}
- public boolean E_() {
+ public boolean l() {
return true;
}
- public void a(World world, int i, int j, int k, Random random) {}
+ public void b(World world, int i, int j, int k, Random random) {}
public void postBreak(World world, int i, int j, int k, int l) {}
public void doPhysics(World world, int i, int j, int k, int l) {}
- public int d() {
+ public int p_() {
return 10;
}
public void onPlace(World world, int i, int j, int k) {}
- public void remove(World world, int i, int j, int k) {}
+ public void remove(World world, int i, int j, int k, int l, int i1) {}
public int a(Random random) {
return 1;
@@ -332,11 +345,13 @@ public class Block {
return this.id;
}
- public float getDamage(EntityHuman entityhuman) {
- return this.strength < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / this.strength / 100.0F : entityhuman.a(this) / this.strength / 30.0F);
+ public float getDamage(EntityHuman entityhuman, World world, int i, int j, int k) {
+ float f = this.m(world, i, j, k);
+
+ return f < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / f / 100.0F : entityhuman.a(this) / f / 30.0F);
}
- public final void b(World world, int i, int j, int k, int l, int i1) {
+ public final void c(World world, int i, int j, int k, int l, int i1) {
this.dropNaturally(world, i, j, k, l, 1.0F, i1);
}
@@ -370,6 +385,17 @@ public class Block {
}
}
+ protected void g(World world, int i, int j, int k, int l) {
+ if (!world.isStatic) {
+ while (l > 0) {
+ int i1 = EntityExperienceOrb.getOrbValue(l);
+
+ l -= i1;
+ world.addEntity(new EntityExperienceOrb(world, (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, i1));
+ }
+ }
+ }
+
protected int getDropData(int i) {
return 0;
}
@@ -382,12 +408,12 @@ public class Block {
this.updateShape(world, i, j, k);
vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k));
vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k));
- Vec3D vec3d2 = vec3d.a(vec3d1, this.minX);
- Vec3D vec3d3 = vec3d.a(vec3d1, this.maxX);
- Vec3D vec3d4 = vec3d.b(vec3d1, this.minY);
- Vec3D vec3d5 = vec3d.b(vec3d1, this.maxY);
- Vec3D vec3d6 = vec3d.c(vec3d1, this.minZ);
- Vec3D vec3d7 = vec3d.c(vec3d1, this.maxZ);
+ Vec3D vec3d2 = vec3d.b(vec3d1, this.minX);
+ Vec3D vec3d3 = vec3d.b(vec3d1, this.maxX);
+ Vec3D vec3d4 = vec3d.c(vec3d1, this.minY);
+ Vec3D vec3d5 = vec3d.c(vec3d1, this.maxY);
+ Vec3D vec3d6 = vec3d.d(vec3d1, this.minZ);
+ Vec3D vec3d7 = vec3d.d(vec3d1, this.maxZ);
if (!this.a(vec3d2)) {
vec3d2 = null;
@@ -415,27 +441,27 @@ public class Block {
Vec3D vec3d8 = null;
- if (vec3d2 != null && (vec3d8 == null || vec3d.b(vec3d2) < vec3d.b(vec3d8))) {
+ if (vec3d2 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d2) < vec3d.distanceSquared(vec3d8))) {
vec3d8 = vec3d2;
}
- if (vec3d3 != null && (vec3d8 == null || vec3d.b(vec3d3) < vec3d.b(vec3d8))) {
+ if (vec3d3 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d3) < vec3d.distanceSquared(vec3d8))) {
vec3d8 = vec3d3;
}
- if (vec3d4 != null && (vec3d8 == null || vec3d.b(vec3d4) < vec3d.b(vec3d8))) {
+ if (vec3d4 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d4) < vec3d.distanceSquared(vec3d8))) {
vec3d8 = vec3d4;
}
- if (vec3d5 != null && (vec3d8 == null || vec3d.b(vec3d5) < vec3d.b(vec3d8))) {
+ if (vec3d5 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d5) < vec3d.distanceSquared(vec3d8))) {
vec3d8 = vec3d5;
}
- if (vec3d6 != null && (vec3d8 == null || vec3d.b(vec3d6) < vec3d.b(vec3d8))) {
+ if (vec3d6 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d6) < vec3d.distanceSquared(vec3d8))) {
vec3d8 = vec3d6;
}
- if (vec3d7 != null && (vec3d8 == null || vec3d.b(vec3d7) < vec3d.b(vec3d8))) {
+ if (vec3d7 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d7) < vec3d.distanceSquared(vec3d8))) {
vec3d8 = vec3d7;
}
@@ -493,16 +519,16 @@ public class Block {
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
- return l == 0 || byId[l].material.isReplacable();
+ return l == 0 || byId[l].material.isReplaceable();
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
return false;
}
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) {}
+ public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
@@ -520,7 +546,7 @@ public class Block {
public void a(World world, int i, int j, int k, Entity entity) {}
- public boolean d(World world, int i, int j, int k, int l) {
+ public boolean c(World world, int i, int j, int k, int l) {
return false;
}
@@ -528,9 +554,9 @@ public class Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1);
- entityhuman.c(0.025F);
- if (this.h() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
- ItemStack itemstack = this.a_(l);
+ entityhuman.j(0.025F);
+ if (this.q_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
+ ItemStack itemstack = this.c_(l);
if (itemstack != null) {
this.a(world, i, j, k, itemstack);
@@ -538,18 +564,18 @@ public class Block {
} else {
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory);
- this.b(world, i, j, k, l, i1);
+ this.c(world, i, j, k, l, i1);
}
}
- protected boolean h() {
- return this.b() && !this.isTileEntity;
+ protected boolean q_() {
+ return this.c() && !this.isTileEntity;
}
- protected ItemStack a_(int i) {
+ protected ItemStack c_(int i) {
int j = 0;
- if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].e()) {
+ if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].k()) {
j = i;
}
@@ -560,74 +586,91 @@ public class Block {
return this.a(random);
}
- public boolean f(World world, int i, int j, int k) {
+ public boolean d(World world, int i, int j, int k) {
return true;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {}
- public Block a(String s) {
+ public Block b(String s) {
this.name = "tile." + s;
return this;
}
public String getName() {
- return LocaleI18n.get(this.q() + ".name");
+ return LocaleI18n.get(this.a() + ".name");
}
- public String q() {
+ public String a() {
return this.name;
}
- public void a(World world, int i, int j, int k, int l, int i1) {}
+ public void b(World world, int i, int j, int k, int l, int i1) {}
- public boolean r() {
- return this.bS;
+ public boolean u() {
+ return this.ce;
}
- protected Block s() {
- this.bS = false;
+ protected Block v() {
+ this.ce = false;
return this;
}
- public int g() {
+ public int e() {
return this.material.getPushReaction();
}
public void a(World world, int i, int j, int k, Entity entity, float f) {}
+ public Block a(CreativeModeTab creativemodetab) {
+ this.creativeTab = creativemodetab;
+ return this;
+ }
+
+ public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
+
+ public void h(World world, int i, int j, int k, int l) {}
+
+ public void f(World world, int i, int j, int k) {}
+
+ public void a(World world, long i, long j) {}
+
static {
- Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth");
- Item.byId[LOG.id] = (new ItemWithAuxData(LOG.id - 256, LOG)).a("log");
- Item.byId[WOOD.id] = (new ItemWithAuxData(WOOD.id - 256, WOOD)).a("wood");
- Item.byId[SMOOTH_BRICK.id] = (new ItemWithAuxData(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).a("stonebricksmooth");
- Item.byId[SANDSTONE.id] = (new ItemWithAuxData(SANDSTONE.id - 256, SANDSTONE)).a("sandStone");
- Item.byId[STEP.id] = (new ItemStep(STEP.id - 256)).a("stoneSlab");
- Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling");
- Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves");
- Item.byId[VINE.id] = new ItemColoredBlock(VINE.id - 256, false);
- Item.byId[LONG_GRASS.id] = (new ItemColoredBlock(LONG_GRASS.id - 256, true)).a(new String[] { "shrub", "grass", "fern"});
+ Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
+ Item.byId[LOG.id] = (new ItemLog(LOG.id - 256, LOG)).b("log");
+ Item.byId[WOOD.id] = (new ItemWood(WOOD.id - 256, WOOD)).b("wood");
+ Item.byId[MONSTER_EGGS.id] = (new ItemMonsterEggs(MONSTER_EGGS.id - 256)).b("monsterStoneEgg");
+ Item.byId[SMOOTH_BRICK.id] = (new ItemSmoothStone(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).b("stonebricksmooth");
+ Item.byId[SANDSTONE.id] = (new ItemSandStone(SANDSTONE.id - 256, SANDSTONE)).b("sandStone");
+ Item.byId[STEP.id] = (new ItemStep(STEP.id - 256, STEP, DOUBLE_STEP, false)).b("stoneSlab");
+ Item.byId[DOUBLE_STEP.id] = (new ItemStep(DOUBLE_STEP.id - 256, STEP, DOUBLE_STEP, true)).b("stoneSlab");
+ Item.byId[WOOD_STEP.id] = (new ItemStep(WOOD_STEP.id - 256, WOOD_STEP, WOOD_DOUBLE_STEP, false)).b("woodSlab");
+ Item.byId[WOOD_DOUBLE_STEP.id] = (new ItemStep(WOOD_DOUBLE_STEP.id - 256, WOOD_STEP, WOOD_DOUBLE_STEP, true)).b("woodSlab");
+ Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).b("sapling");
+ Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).b("leaves");
+ Item.byId[VINE.id] = new ItemWithAuxData(VINE.id - 256, false);
+ Item.byId[LONG_GRASS.id] = (new ItemWithAuxData(LONG_GRASS.id - 256, true)).a(new String[] { "shrub", "grass", "fern"});
Item.byId[WATER_LILY.id] = new ItemWaterLily(WATER_LILY.id - 256);
Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256);
Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256);
- Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, BIG_MUSHROOM_1); // CraftBukkit
- Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, BIG_MUSHROOM_2); // CraftBukkit
- Item.byId[MOB_SPAWNER.id] = new ItemWithAuxData(MOB_SPAWNER.id - 256, MOB_SPAWNER); // CraftBukkit
+ Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, false); // CraftBukkit
+ Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, false); // CraftBukkit
+ Item.byId[MOB_SPAWNER.id] = new ItemWithAuxData(MOB_SPAWNER.id - 256, false); // CraftBukkit
for (int i = 0; i < 256; ++i) {
if (byId[i] != null) {
if (Item.byId[i] == null) {
Item.byId[i] = new ItemBlock(i - 256);
- byId[i].k();
+ byId[i].r_();
}
boolean flag = false;
- if (i > 0 && byId[i].c() == 10) {
+ if (i > 0 && byId[i].b() == 10) {
flag = true;
}
- if (i > 0 && byId[i] instanceof BlockStep) {
+ if (i > 0 && byId[i] instanceof BlockStepAbstract) {
flag = true;
}
@@ -639,6 +682,10 @@ public class Block {
flag = true;
}
+ if (lightBlock[i] == 0) {
+ flag = true;
+ }
+
s[i] = flag;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockBloodStone.java b/src/main/java/net/minecraft/server/BlockBloodStone.java
index b69fbf58..fb891933 100644
--- a/src/main/java/net/minecraft/server/BlockBloodStone.java
+++ b/src/main/java/net/minecraft/server/BlockBloodStone.java
@@ -6,6 +6,7 @@ public class BlockBloodStone extends Block {
public BlockBloodStone(int i, int j) {
super(i, j, Material.STONE);
+ this.a(CreativeModeTab.b);
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java
index aa3c6856..43d95f72 100644
--- a/src/main/java/net/minecraft/server/BlockButton.java
+++ b/src/main/java/net/minecraft/server/BlockButton.java
@@ -8,88 +8,89 @@ public class BlockButton extends Block {
protected BlockButton(int i, int j) {
super(i, j, Material.ORIENTABLE);
- this.a(true);
+ this.b(true);
+ this.a(CreativeModeTab.d);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
return null;
}
- public int d() {
+ public int p_() {
return 20;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 2 && world.e(i, j, k + 1) ? true : (l == 3 && world.e(i, j, k - 1) ? true : (l == 4 && world.e(i + 1, j, k) ? true : l == 5 && world.e(i - 1, j, k)));
+ 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)));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.e(i - 1, j, k) ? true : (world.e(i + 1, j, k) ? true : (world.e(i, j, k - 1) ? true : world.e(i, j, k + 1)));
+ 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)));
}
- public void postPlace(World world, int i, int j, int k, int l) {
+ 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.e(i, j, k + 1)) {
+ if (l == 2 && world.s(i, j, k + 1)) {
i1 = 4;
- } else if (l == 3 && world.e(i, j, k - 1)) {
+ } else if (l == 3 && world.s(i, j, k - 1)) {
i1 = 3;
- } else if (l == 4 && world.e(i + 1, j, k)) {
+ } else if (l == 4 && world.s(i + 1, j, k)) {
i1 = 2;
- } else if (l == 5 && world.e(i - 1, j, k)) {
+ } else if (l == 5 && world.s(i - 1, j, k)) {
i1 = 1;
} else {
- i1 = this.g(world, i, j, k);
+ i1 = this.l(world, i, j, k);
}
world.setData(i, j, k, i1 + j1);
}
- private int g(World world, int i, int j, int k) {
- return world.e(i - 1, j, k) ? 1 : (world.e(i + 1, j, k) ? 2 : (world.e(i, j, k - 1) ? 3 : (world.e(i, j, k + 1) ? 4 : 1)));
+ 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)));
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (this.h(world, i, j, k)) {
+ if (this.n(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.e(i - 1, j, k) && i1 == 1) {
+ if (!world.s(i - 1, j, k) && i1 == 1) {
flag = true;
}
- if (!world.e(i + 1, j, k) && i1 == 2) {
+ if (!world.s(i + 1, j, k) && i1 == 2) {
flag = true;
}
- if (!world.e(i, j, k - 1) && i1 == 3) {
+ if (!world.s(i, j, k - 1) && i1 == 3) {
flag = true;
}
- if (!world.e(i, j, k + 1) && i1 == 4) {
+ if (!world.s(i, j, k + 1) && i1 == 4) {
flag = true;
}
if (flag) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
}
}
- private boolean h(World world, int i, int j, int k) {
+ private boolean n(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
return false;
} else {
@@ -122,79 +123,77 @@ public class BlockButton extends Block {
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.interact(world, i, j, k, entityhuman);
+ this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
- int l = world.getData(i, j, k);
- int i1 = l & 7;
- int j1 = 8 - (l & 8);
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
+ int i1 = world.getData(i, j, k);
+ int j1 = i1 & 7;
+ int k1 = 8 - (i1 & 8);
- if (j1 == 0) {
+ if (k1 == 0) {
return true;
} else {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- int old = (j1 != 8) ? 1 : 0;
- int current = (j1 == 8) ? 1 : 0;
+ int old = (k1 != 8) ? 1 : 0;
+ int current = (k1 == 8) ? 1 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
- if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
+ if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8)) {
return true;
}
// CraftBukkit end
- world.setData(i, j, k, i1 + j1);
- world.b(i, j, k, i, j, k);
+ world.setData(i, j, k, j1 + k1);
+ world.d(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
world.applyPhysics(i, j, k, this.id);
- if (i1 == 1) {
+ if (j1 == 1) {
world.applyPhysics(i - 1, j, k, this.id);
- } else if (i1 == 2) {
+ } else if (j1 == 2) {
world.applyPhysics(i + 1, j, k, this.id);
- } else if (i1 == 3) {
+ } else if (j1 == 3) {
world.applyPhysics(i, j, k - 1, this.id);
- } else if (i1 == 4) {
+ } else if (j1 == 4) {
world.applyPhysics(i, j, k + 1, this.id);
} else {
world.applyPhysics(i, j - 1, k, this.id);
}
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
return true;
}
}
- public void remove(World world, int i, int j, int k) {
- int l = world.getData(i, j, k);
-
- if ((l & 8) > 0) {
+ public void remove(World world, int i, int j, int k, int l, int i1) {
+ if ((i1 & 8) > 0) {
world.applyPhysics(i, j, k, this.id);
- int i1 = l & 7;
+ int j1 = i1 & 7;
- if (i1 == 1) {
+ if (j1 == 1) {
world.applyPhysics(i - 1, j, k, this.id);
- } else if (i1 == 2) {
+ } else if (j1 == 2) {
world.applyPhysics(i + 1, j, k, this.id);
- } else if (i1 == 3) {
+ } else if (j1 == 3) {
world.applyPhysics(i, j, k - 1, this.id);
- } else if (i1 == 4) {
+ } else if (j1 == 4) {
world.applyPhysics(i, j, k + 1, this.id);
} else {
world.applyPhysics(i, j - 1, k, this.id);
}
}
- super.remove(world, i, j, k);
+ super.remove(world, i, j, k, l, i1);
}
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) > 0;
}
- public boolean d(World world, int i, int j, int k, int l) {
+ public boolean c(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
if ((i1 & 8) == 0) {
@@ -210,7 +209,7 @@ public class BlockButton extends Block {
return true;
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@@ -221,7 +220,9 @@ public class BlockButton extends Block {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
world.getServer().getPluginManager().callEvent(eventRedstone);
- if (eventRedstone.getNewCurrent() > 0) return;
+ if (eventRedstone.getNewCurrent() > 0) {
+ return;
+ }
// CraftBukkit end
world.setData(i, j, k, l & 7);
@@ -241,7 +242,7 @@ public class BlockButton extends Block {
}
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
- world.b(i, j, k, i, j, k);
+ world.d(i, j, k, i, j, k);
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index 1997a863..87f2b369 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -8,10 +8,11 @@ public class BlockCactus extends Block {
protected BlockCactus(int i, int j) {
super(i, j, Material.CACTUS);
- this.a(true);
+ this.b(true);
+ this.a(CreativeModeTab.c);
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (world.isEmpty(i, j + 1, k)) {
int l;
@@ -35,37 +36,37 @@ public class BlockCactus extends Block {
public AxisAlignedBB e(World world, int i, int j, int k) {
float f = 0.0625F;
- return AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f));
+ return AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f));
}
public int a(int i) {
return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId + 1 : this.textureId);
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public int c() {
+ public int b() {
return 13;
}
public boolean canPlace(World world, int i, int j, int k) {
- return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
+ return !super.canPlace(world, i, j, k) ? false : this.d(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.f(world, i, j, k)) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ if (!this.d(world, i, j, k)) {
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
}
- public boolean f(World world, int i, int j, int k) {
+ public boolean d(World world, int i, int j, int k) {
if (world.getMaterial(i - 1, j, k).isBuildable()) {
return false;
} else if (world.getMaterial(i + 1, j, k).isBuildable()) {
diff --git a/src/main/java/net/minecraft/server/BlockCauldron.java b/src/main/java/net/minecraft/server/BlockCauldron.java
deleted file mode 100644
index ba444961..00000000
--- a/src/main/java/net/minecraft/server/BlockCauldron.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package net.minecraft.server;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-public class BlockCauldron extends Block {
-
- public BlockCauldron(int i) {
- super(i, Material.ORE);
- this.textureId = 154;
- }
-
- public int a(int i, int j) {
- return i == 1 ? 138 : (i == 0 ? 155 : 154);
- }
-
- public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
- float f = 0.125F;
-
- this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
- super.a(world, i, j, k, axisalignedbb, arraylist);
- this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
- this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
- this.f();
- }
-
- public void f() {
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- }
-
- public boolean a() {
- return false;
- }
-
- public int c() {
- return 24;
- }
-
- public boolean b() {
- return false;
- }
-
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
- if (world.isStatic) {
- return true;
- } else {
- ItemStack itemstack = entityhuman.inventory.getItemInHand();
-
- if (itemstack == null) {
- return true;
- } else {
- int l = world.getData(i, j, k);
-
- if (itemstack.id == Item.WATER_BUCKET.id) {
- if (l < 3) {
- if (!entityhuman.abilities.canInstantlyBuild) {
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Item.BUCKET));
- }
-
- world.setData(i, j, k, 3);
- }
-
- return true;
- } else {
- if (itemstack.id == Item.GLASS_BOTTLE.id && l > 0) {
- ItemStack itemstack1 = new ItemStack(Item.POTION, 1, 0);
-
- if (!entityhuman.inventory.pickup(itemstack1)) {
- world.addEntity(new EntityItem(world, (double) i + 0.5D, (double) j + 1.5D, (double) k + 0.5D, itemstack1));
- } else if (entityhuman instanceof EntityPlayer) { // CraftBukkit
- ((EntityPlayer) entityhuman).updateInventory(entityhuman.defaultContainer); // CraftBukkit
- }
-
- --itemstack.count;
- if (itemstack.count <= 0) {
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
- }
-
- world.setData(i, j, k, l - 1);
- }
-
- return true;
- }
- }
- }
- }
-
- public int getDropType(int i, Random random, int j) {
- return Item.CAULDRON.id;
- }
-}
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
index dfdbc746..58d31cc9 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -7,23 +7,24 @@ public class BlockCrops extends BlockFlower {
protected BlockCrops(int i, int j) {
super(i, j);
this.textureId = j;
- this.a(true);
+ this.b(true);
float f = 0.5F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
+ this.a((CreativeModeTab) null);
}
- protected boolean d(int i) {
+ protected boolean d_(int i) {
return i == Block.SOIL.id;
}
- public void a(World world, int i, int j, int k, Random random) {
- super.a(world, i, j, k, random);
+ public void b(World world, int i, int j, int k, Random random) {
+ super.b(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9) {
int l = world.getData(i, j, k);
if (l < 7) {
- float f = this.i(world, i, j, k);
+ float f = this.l(world, i, j, k);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
@@ -32,11 +33,11 @@ public class BlockCrops extends BlockFlower {
}
}
- public void g(World world, int i, int j, int k) {
+ public void c_(World world, int i, int j, int k) {
world.setData(i, j, k, 7);
}
- private float i(World world, int i, int j, int k) {
+ private float l(World world, int i, int j, int k) {
float f = 1.0F;
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
@@ -85,7 +86,7 @@ public class BlockCrops extends BlockFlower {
return this.textureId + j;
}
- public int c() {
+ public int b() {
return 6;
}
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java
index 8a009674..c6636f27 100644
--- a/src/main/java/net/minecraft/server/BlockDispenser.java
+++ b/src/main/java/net/minecraft/server/BlockDispenser.java
@@ -14,9 +14,10 @@ public class BlockDispenser extends BlockContainer {
protected BlockDispenser(int i) {
super(i, Material.STONE);
this.textureId = 45;
+ this.a(CreativeModeTab.d);
}
- public int d() {
+ public int p_() {
return 4;
}
@@ -26,10 +27,10 @@ public class BlockDispenser extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
}
- private void g(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
if (!world.isStatic) {
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
@@ -61,7 +62,7 @@ public class BlockDispenser extends BlockContainer {
return i == 1 ? this.textureId + 17 : (i == 0 ? this.textureId + 17 : (i == 3 ? this.textureId + 1 : this.textureId));
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
} else {
@@ -75,7 +76,7 @@ public class BlockDispenser extends BlockContainer {
}
}
- // CraftBukkit - priv to public
+ // CraftBukkit - private to public
public void dispense(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
byte b0 = 0;
@@ -94,103 +95,53 @@ public class BlockDispenser extends BlockContainer {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
if (tileentitydispenser != null) {
- // CraftBukkit start
- int dispenseSlot = tileentitydispenser.findDispenseSlot();
- ItemStack itemstack = null;
- if (dispenseSlot > -1) {
- itemstack = tileentitydispenser.getContents()[dispenseSlot];
-
- // Copy item stack, because we want it to have 1 item
- itemstack = new ItemStack(itemstack.id, 1, itemstack.getData(), itemstack.getEnchantments());
- }
- // CraftBukkit end
-
- double d0 = (double) i + (double) b0 * 0.6D + 0.5D;
- double d1 = (double) j + 0.5D;
- double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
+ int i1 = tileentitydispenser.i();
- if (itemstack == null) {
+ if (i1 < 0) {
world.triggerEffect(1001, i, j, k, 0);
} else {
- // CraftBukkit start
- double d3 = random.nextDouble() * 0.1D + 0.2D;
- double motX = (double) b0 * d3;
- double motY = 0.20000000298023224D;
- double motZ = (double) b1 * d3;
- motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
- motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
- motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
-
- org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
-
- BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(motX, motY, motZ));
- world.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
- return;
- }
+ double d0 = (double) i + (double) b0 * 0.6D + 0.5D;
+ double d1 = (double) j + 0.5D;
+ double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
+ ItemStack itemstack = tileentitydispenser.getItem(i1);
+ int j1 = a(tileentitydispenser, world, itemstack, random, i, j, k, b0, b1, d0, d1, d2);
+
+ if (j1 == 1) {
+ tileentitydispenser.splitStack(i1, 1);
+ } else if (j1 == 0) {
+ // CraftBukkit start
+ double d3 = random.nextDouble() * 0.1D + 0.2D;
+ double motX = (double) b0 * d3;
+ double motY = 0.20000000298023224D;
+ double motZ = (double) b1 * d3;
+ motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
+ motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
+ motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
+
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
+ org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
+
+ BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(motX, motY, motZ));
+ world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return;
+ }
- if (event.getItem().equals(bukkitItem)) {
- // Actually remove the item
- tileentitydispenser.splitStack(dispenseSlot, 1);
- }
+ if (event.getItem().equals(bukkitItem)) {
+ // Actually remove the item
+ tileentitydispenser.splitStack(i1, 1);
+ }
- motX = event.getVelocity().getX();
- motY = event.getVelocity().getY();
- motZ = event.getVelocity().getZ();
-
- itemstack = CraftItemStack.createNMSItemStack(event.getItem());
- // CraftBukkit end
-
- if (itemstack.id == Item.ARROW.id) {
- EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
-
- entityarrow.shoot((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
- entityarrow.fromPlayer = true;
- world.addEntity(entityarrow);
- world.triggerEffect(1002, i, j, k, 0);
- } else if (itemstack.id == Item.EGG.id) {
- EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
-
- entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
- world.addEntity(entityegg);
- world.triggerEffect(1002, i, j, k, 0);
- } else if (itemstack.id == Item.SNOW_BALL.id) {
- EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
-
- entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
- world.addEntity(entitysnowball);
- world.triggerEffect(1002, i, j, k, 0);
- } else if (itemstack.id == Item.POTION.id && ItemPotion.c(itemstack.getData())) {
- EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData());
-
- entitypotion.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
- world.addEntity(entitypotion);
- world.triggerEffect(1002, i, j, k, 0);
- } else if (itemstack.id == Item.EXP_BOTTLE.id) {
- EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, d0, d1, d2);
-
- entitythrownexpbottle.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
- world.addEntity(entitythrownexpbottle);
- world.triggerEffect(1002, i, j, k, 0);
- } else if (itemstack.id == Item.MONSTER_EGG.id) {
- ItemMonsterEgg.a(world, itemstack.getData(), d0 + (double) b0 * 0.3D, d1 - 0.3D, d2 + (double) b1 * 0.3D);
- world.triggerEffect(1002, i, j, k, 0);
- } else if (itemstack.id == Item.FIREBALL.id) {
- EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0 + (double) b0 * 0.3D, d1, d2 + (double) b1 * 0.3D, (double) b0 + random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, (double) b1 + random.nextGaussian() * 0.05D);
-
- world.addEntity(entitysmallfireball);
- world.triggerEffect(1009, i, j, k, 0);
- } else {
- EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
- // CraftBukkit start
- // double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
- entityitem.motX = motX;
- entityitem.motY = motY;
- entityitem.motZ = motZ;
+ motX = event.getVelocity().getX();
+ motY = event.getVelocity().getY();
+ motZ = event.getVelocity().getZ();
+
+ itemstack = CraftItemStack.createNMSItemStack(event.getItem());
+
+ a(world, itemstack, random, motX, motY, motZ, d0, d1, d2);
// CraftBukkit end
- world.addEntity(entityitem);
+
world.triggerEffect(1000, i, j, k, 0);
}
@@ -204,18 +155,18 @@ public class BlockDispenser extends BlockContainer {
boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
if (flag) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
}
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic && (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k))) {
this.dispense(world, i, j, k, random);
}
}
- public TileEntity a_() {
+ public TileEntity a(World world) {
return new TileEntityDispenser();
}
@@ -239,12 +190,12 @@ public class BlockDispenser extends BlockContainer {
}
}
- public void remove(World world, int i, int j, int k) {
+ public void remove(World world, int i, int j, int k, int l, int i1) {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
if (tileentitydispenser != null) {
- for (int l = 0; l < tileentitydispenser.getSize(); ++l) {
- ItemStack itemstack = tileentitydispenser.getItem(l);
+ for (int j1 = 0; j1 < tileentitydispenser.getSize(); ++j1) {
+ ItemStack itemstack = tileentitydispenser.getItem(j1);
if (itemstack != null) {
float f = this.a.nextFloat() * 0.8F + 0.1F;
@@ -252,14 +203,14 @@ public class BlockDispenser extends BlockContainer {
float f2 = this.a.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
- int i1 = this.a.nextInt(21) + 10;
+ int k1 = this.a.nextInt(21) + 10;
- if (i1 > itemstack.count) {
- i1 = itemstack.count;
+ if (k1 > itemstack.count) {
+ k1 = itemstack.count;
}
- itemstack.count -= i1;
- EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData()));
+ itemstack.count -= k1;
+ EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, k1, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
@@ -276,6 +227,150 @@ public class BlockDispenser extends BlockContainer {
}
}
- super.remove(world, i, j, k);
+ super.remove(world, i, j, k, l, i1);
+ }
+
+ // CraftBukkit start - change of method signature!
+ private static void a(World world, ItemStack itemstack, Random random, double motX, double motY, double motZ, double d0, double d1, double d2) {
+ EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
+ // double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
+
+ entityitem.motX = motX;
+ entityitem.motY = motY;
+ entityitem.motZ = motZ;
+ world.addEntity(entityitem);
+ }
+ // CraftBukkit end
+
+ private static int a(TileEntityDispenser tileentitydispenser, World world, ItemStack itemstack, Random random, int i, int j, int k, int l, int i1, double d0, double d1, double d2) {
+ float f = 1.1F;
+ byte b0 = 6;
+
+ if (itemstack.id == Item.ARROW.id) {
+ EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
+
+ entityarrow.shoot((double) l, 0.10000000149011612D, (double) i1, f, (float) b0);
+ entityarrow.fromPlayer = 1;
+ world.addEntity(entityarrow);
+ world.triggerEffect(1002, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id == Item.EGG.id) {
+ EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
+
+ entityegg.c((double) l, 0.10000000149011612D, (double) i1, f, (float) b0);
+ world.addEntity(entityegg);
+ world.triggerEffect(1002, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id == Item.SNOW_BALL.id) {
+ EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
+
+ entitysnowball.c((double) l, 0.10000000149011612D, (double) i1, f, (float) b0);
+ world.addEntity(entitysnowball);
+ world.triggerEffect(1002, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id == Item.POTION.id && ItemPotion.g(itemstack.getData())) {
+ EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData());
+
+ entitypotion.c((double) l, 0.10000000149011612D, (double) i1, f * 1.25F, (float) b0 * 0.5F);
+ world.addEntity(entitypotion);
+ world.triggerEffect(1002, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id == Item.EXP_BOTTLE.id) {
+ EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, d0, d1, d2);
+
+ entitythrownexpbottle.c((double) l, 0.10000000149011612D, (double) i1, f * 1.25F, (float) b0 * 0.5F);
+ world.addEntity(entitythrownexpbottle);
+ world.triggerEffect(1002, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id == Item.MONSTER_EGG.id) {
+ ItemMonsterEgg.a(world, itemstack.getData(), d0 + (double) l * 0.3D, d1 - 0.3D, d2 + (double) i1 * 0.3D);
+ world.triggerEffect(1002, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id == Item.FIREBALL.id) {
+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0 + (double) l * 0.3D, d1, d2 + (double) i1 * 0.3D, (double) l + random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, (double) i1 + random.nextGaussian() * 0.05D);
+
+ world.addEntity(entitysmallfireball);
+ world.triggerEffect(1009, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id != Item.LAVA_BUCKET.id && itemstack.id != Item.WATER_BUCKET.id) {
+ if (itemstack.id == Item.BUCKET.id) {
+ int j1 = i + l;
+ int k1 = k + i1;
+ Material material = world.getMaterial(j1, j, k1);
+ int l1 = world.getData(j1, j, k1);
+
+ if (material == Material.WATER && l1 == 0) {
+ world.setTypeId(j1, j, k1, 0);
+ if (--itemstack.count == 0) {
+ itemstack.id = Item.WATER_BUCKET.id;
+ itemstack.count = 1;
+ } else if (tileentitydispenser.a(new ItemStack(Item.WATER_BUCKET)) < 0) {
+ a(world, new ItemStack(Item.WATER_BUCKET), random, 6, l, i1, d0, d1, d2);
+ }
+
+ return 2;
+ } else if (material == Material.LAVA && l1 == 0) {
+ world.setTypeId(j1, j, k1, 0);
+ if (--itemstack.count == 0) {
+ itemstack.id = Item.LAVA_BUCKET.id;
+ itemstack.count = 1;
+ } else if (tileentitydispenser.a(new ItemStack(Item.LAVA_BUCKET)) < 0) {
+ a(world, new ItemStack(Item.LAVA_BUCKET), random, 6, l, i1, d0, d1, d2);
+ }
+
+ return 2;
+ } else {
+ return 0;
+ }
+ } else if (itemstack.getItem() instanceof ItemMinecart) {
+ d0 = (double) i + (l < 0 ? (double) l * 0.8D : (double) ((float) l * 1.8F)) + (double) ((float) Math.abs(i1) * 0.5F);
+ d2 = (double) k + (i1 < 0 ? (double) i1 * 0.8D : (double) ((float) i1 * 1.8F)) + (double) ((float) Math.abs(l) * 0.5F);
+ if (BlockMinecartTrack.d_(world, i + l, j, k + i1)) {
+ d1 = (double) ((float) j + 0.5F);
+ } else {
+ if (!world.isEmpty(i + l, j, k + i1) || !BlockMinecartTrack.d_(world, i + l, j - 1, k + i1)) {
+ return 0;
+ }
+
+ d1 = (double) ((float) j - 0.5F);
+ }
+
+ EntityMinecart entityminecart = new EntityMinecart(world, d0, d1, d2, ((ItemMinecart) itemstack.getItem()).a);
+
+ world.addEntity(entityminecart);
+ world.triggerEffect(1000, i, j, k, 0);
+ return 1;
+ } else if (itemstack.id == Item.BOAT.id) {
+ d0 = (double) i + (l < 0 ? (double) l * 0.8D : (double) ((float) l * 1.8F)) + (double) ((float) Math.abs(i1) * 0.5F);
+ d2 = (double) k + (i1 < 0 ? (double) i1 * 0.8D : (double) ((float) i1 * 1.8F)) + (double) ((float) Math.abs(l) * 0.5F);
+ if (world.getMaterial(i + l, j, k + i1) == Material.WATER) {
+ d1 = (double) ((float) j + 1.0F);
+ } else {
+ if (!world.isEmpty(i + l, j, k + i1) || world.getMaterial(i + l, j - 1, k + i1) != Material.WATER) {
+ return 0;
+ }
+
+ d1 = (double) j;
+ }
+
+ EntityBoat entityboat = new EntityBoat(world, d0, d1, d2);
+
+ world.addEntity(entityboat);
+ world.triggerEffect(1000, i, j, k, 0);
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ ItemBucket itembucket = (ItemBucket) itemstack.getItem();
+
+ if (itembucket.a(world, (double) i, (double) j, (double) k, i + l, j, k + i1)) {
+ itemstack.id = Item.BUCKET.id;
+ itemstack.count = 1;
+ return 2;
+ } else {
+ return 0;
+ }
+ }
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java
index 8ce6fc8d..933e2755 100644
--- a/src/main/java/net/minecraft/server/BlockDoor.java
+++ b/src/main/java/net/minecraft/server/BlockDoor.java
@@ -19,21 +19,21 @@ public class BlockDoor extends Block {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
- int l = this.e(iblockaccess, i, j, k);
+ public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
+ int l = this.b_(iblockaccess, i, j, k);
return (l & 4) != 0;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public int c() {
+ public int b() {
return 7;
}
@@ -43,18 +43,18 @@ public class BlockDoor extends Block {
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.d(this.e(iblockaccess, i, j, k));
+ this.e(this.b_(iblockaccess, i, j, k));
}
- public int c(IBlockAccess iblockaccess, int i, int j, int k) {
- return this.e(iblockaccess, i, j, k) & 3;
+ public int d(IBlockAccess iblockaccess, int i, int j, int k) {
+ return this.b_(iblockaccess, i, j, k) & 3;
}
- public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
- return (this.e(iblockaccess, i, j, k) & 4) != 0;
+ public boolean a_(IBlockAccess iblockaccess, int i, int j, int k) {
+ return (this.b_(iblockaccess, i, j, k) & 4) != 0;
}
- private void d(int i) {
+ private void e(int i) {
float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
@@ -63,58 +63,66 @@ public class BlockDoor extends Block {
boolean flag1 = (i & 16) != 0;
if (j == 0) {
- if (!flag) {
- this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
- } else if (!flag1) {
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
+ if (flag) {
+ if (!flag1) {
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
+ } else {
+ this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
+ }
} else {
- this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
+ this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
} else if (j == 1) {
- if (!flag) {
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
- } else if (!flag1) {
- this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ if (flag) {
+ if (!flag1) {
+ this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ } else {
+ this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
+ }
} else {
- this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
}
} else if (j == 2) {
- if (!flag) {
- this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- } else if (!flag1) {
- this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
+ if (flag) {
+ if (!flag1) {
+ this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
+ } else {
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
+ }
} else {
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
+ this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
} else if (j == 3) {
- if (!flag) {
- this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
- } else if (!flag1) {
- this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
+ if (flag) {
+ if (!flag1) {
+ this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
+ } else {
+ this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ }
} else {
- this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
}
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.interact(world, i, j, k, entityhuman);
+ this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (this.material == Material.ORE) {
return true;
} else {
- int l = this.e((IBlockAccess) world, i, j, k);
- int i1 = l & 7;
+ int i1 = this.b_(world, i, j, k);
+ int j1 = i1 & 7;
- i1 ^= 4;
- if ((l & 8) != 0) {
- world.setData(i, j - 1, k, i1);
- world.b(i, j - 1, k, i, j, k);
+ j1 ^= 4;
+ if ((i1 & 8) == 0) {
+ world.setData(i, j, k, j1);
+ world.d(i, j, k, i, j, k);
} else {
- world.setData(i, j, k, i1);
- world.b(i, j, k, i, j, k);
+ world.setData(i, j - 1, k, j1);
+ world.d(i, j - 1, k, i, j, k);
}
world.a(entityhuman, 1003, i, j, k, 0);
@@ -123,19 +131,19 @@ public class BlockDoor extends Block {
}
public void setDoor(World world, int i, int j, int k, boolean flag) {
- int l = this.e((IBlockAccess) world, i, j, k);
+ int l = this.b_(world, i, j, k);
boolean flag1 = (l & 4) != 0;
if (flag1 != flag) {
int i1 = l & 7;
i1 ^= 4;
- if ((l & 8) != 0) {
- world.setData(i, j - 1, k, i1);
- world.b(i, j - 1, k, i, j, k);
- } else {
+ if ((l & 8) == 0) {
world.setData(i, j, k, i1);
- world.b(i, j, k, i, j, k);
+ world.d(i, j, k, i, j, k);
+ } else {
+ world.setData(i, j - 1, k, i1);
+ world.d(i, j - 1, k, i, j, k);
}
world.a((EntityHuman) null, 1003, i, j, k, 0);
@@ -145,14 +153,7 @@ public class BlockDoor extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
- if ((i1 & 8) != 0) {
- if (world.getTypeId(i, j - 1, k) != this.id) {
- world.setTypeId(i, j, k, 0);
- }
- else if (l > 0 && l != this.id) { // CraftBukkit
- this.doPhysics(world, i, j - 1, k, l);
- }
- } else {
+ if ((i1 & 8) == 0) {
boolean flag = false;
if (world.getTypeId(i, j + 1, k) != this.id) {
@@ -160,7 +161,7 @@ public class BlockDoor extends Block {
flag = true;
}
- if (!world.e(i, j - 1, k)) {
+ if (!world.t(i, j - 1, k)) {
world.setTypeId(i, j, k, 0);
flag = true;
if (world.getTypeId(i, j + 1, k) == this.id) {
@@ -170,7 +171,7 @@ public class BlockDoor extends Block {
if (flag) {
if (!world.isStatic) {
- this.b(world, i, j, k, i1, 0);
+ this.c(world, i, j, k, i1, 0);
}
// CraftBukkit start
} else if (l > 0 && Block.byId[l].isPowerSource()) {
@@ -191,6 +192,13 @@ public class BlockDoor extends Block {
}
// CraftBukkit end
}
+ } else {
+ if (world.getTypeId(i, j - 1, k) != this.id) {
+ world.setTypeId(i, j, k, 0);
+ }
+ else if (l > 0 && l != this.id) { // CraftBukkit
+ this.doPhysics(world, i, j - 1, k, l);
+ }
}
}
@@ -204,14 +212,14 @@ public class BlockDoor extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return j >= 255 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
+ return j >= 255 ? false : world.t(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
- public int g() {
+ public int e() {
return 1;
}
- public int e(IBlockAccess iblockaccess, int i, int j, int k) {
+ public int b_(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
boolean flag = (l & 8) != 0;
int i1;
@@ -226,8 +234,7 @@ public class BlockDoor extends Block {
}
boolean flag1 = (j1 & 1) != 0;
- int k1 = i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0);
- return k1;
+ return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
index f97b7cf1..9c0ec846 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -11,22 +11,22 @@ public class BlockDragonEgg extends Block {
}
public void onPlace(World world, int i, int j, int k) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
public void doPhysics(World world, int i, int j, int k, int l) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
- public void a(World world, int i, int j, int k, Random random) {
- this.g(world, i, j, k);
+ public void b(World world, int i, int j, int k, Random random) {
+ this.l(world, i, j, k);
}
- private void g(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
- if (!BlockSand.instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ if (!BlockSand.instaFall && world.c(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
// CraftBukkit - added data
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
@@ -45,16 +45,16 @@ public class BlockDragonEgg extends Block {
}
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.h(world, i, j, k);
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
+ this.n(world, i, j, k);
return true;
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.h(world, i, j, k);
+ this.n(world, i, j, k);
}
- private void h(World world, int i, int j, int k) {
+ 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) {
@@ -72,6 +72,7 @@ public class BlockDragonEgg extends Block {
if (event.isCancelled()) {
return;
}
+
i1 = event.getToBlock().getX();
j1 = event.getToBlock().getY();
k1 = event.getToBlock().getZ();
@@ -100,23 +101,19 @@ public class BlockDragonEgg extends Block {
}
}
- public int d() {
+ public int p_() {
return 3;
}
- public boolean canPlace(World world, int i, int j, int k) {
- return super.canPlace(world, i, j, k);
- }
-
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public int c() {
+ public int b() {
return 27;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index 3a4ce881..5d1ebab6 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -15,13 +15,18 @@ public class BlockFire extends Block {
protected BlockFire(int i, int j) {
super(i, j, Material.FIRE);
- this.a(true);
+ this.b(true);
}
- public void k() {
+ public void r_() {
this.a(Block.WOOD.id, 5, 20);
+ this.a(Block.WOOD_DOUBLE_STEP.id, 5, 20);
+ this.a(Block.WOOD_STEP.id, 5, 20);
this.a(Block.FENCE.id, 5, 20);
this.a(Block.WOOD_STAIRS.id, 5, 20);
+ this.a(Block.BIRCH_WOOD_STAIRS.id, 5, 20);
+ this.a(Block.SPRUCE_WOOD_STAIRS.id, 5, 20);
+ this.a(Block.JUNGLE_WOOD_STAIRS.id, 5, 20);
this.a(Block.LOG.id, 5, 5);
this.a(Block.LEAVES.id, 30, 60);
this.a(Block.BOOKSHELF.id, 30, 20);
@@ -40,15 +45,15 @@ public class BlockFire extends Block {
return null;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public int c() {
+ public int b() {
return 3;
}
@@ -56,11 +61,11 @@ public class BlockFire extends Block {
return 0;
}
- public int d() {
+ public int p_() {
return 30;
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
if (world.worldProvider instanceof WorldProviderTheEnd && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
@@ -68,11 +73,11 @@ public class BlockFire extends Block {
}
if (!this.canPlace(world, i, j, k)) {
- fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
+ fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
- if (!flag && world.x() && (world.y(i, j, k) || world.y(i - 1, j, k) || world.y(i + 1, j, k) || world.y(i, j, k - 1) || world.y(i, j, k + 1))) {
- fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
+ if (!flag && world.J() && (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))) {
+ fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
} else {
int l = world.getData(i, j, k);
@@ -80,15 +85,15 @@ public class BlockFire extends Block {
world.setRawData(i, j, k, l + random.nextInt(3) / 2);
}
- world.c(i, j, k, this.id, this.d() + random.nextInt(10));
- if (!flag && !this.g(world, i, j, k)) {
- if (!world.e(i, j - 1, k) || l > 3) {
- fireExtinguished(world, i, j, k); // CraftBukkit - burn out
+ world.a(i, j, k, this.id, this.p_() + random.nextInt(10));
+ if (!flag && !this.l(world, i, j, k)) {
+ if (!world.t(i, j - 1, k) || l > 3) {
+ fireExtinguished(world, i, j, k); // CraftBukkit - burn out
}
- } else if (!flag && !this.c(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
- fireExtinguished(world, i, j, k); // CraftBukkit - burn out
+ } 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.z(i, j, k);
+ boolean flag1 = world.C(i, j, k);
byte b0 = 0;
if (flag1) {
@@ -102,7 +107,7 @@ public class BlockFire extends Block {
this.a(world, i, j, k - 1, 300 + b0, random, l);
this.a(world, i, j, k + 1, 300 + b0, random, l);
- // CraftBukkit start - Call to stop spread of fire.
+ // CraftBukkit start - call to stop spread of fire
org.bukkit.Server server = world.getServer();
org.bukkit.World bworld = world.getWorld();
@@ -120,7 +125,7 @@ public class BlockFire extends Block {
l1 += (k1 - (j + 1)) * 100;
}
- int i2 = this.h(world, i1, k1, j1);
+ int i2 = this.n(world, i1, k1, j1);
if (i2 > 0) {
int j2 = (i2 + 40) / (l + 30);
@@ -129,13 +134,14 @@ public class BlockFire extends Block {
j2 /= 2;
}
- if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.x() || !world.y(i1, k1, j1)) && !world.y(i1 - 1, k1, k) && !world.y(i1 + 1, k1, j1) && !world.y(i1, k1, j1 - 1) && !world.y(i1, k1, j1 + 1)) {
+ if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.J() || !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)) {
int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) {
k2 = 15;
}
- // CraftBukkit start - Call to stop spread of fire.
+
+ // CraftBukkit start - call to stop spread of fire
org.bukkit.block.Block block = bworld.getBlockAt(i1, k1, j1);
if (block.getTypeId() != Block.FIRE.id) {
@@ -173,6 +179,7 @@ public class BlockFire extends Block {
if (random.nextInt(l) < j1) {
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
+
// CraftBukkit start
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);
@@ -184,7 +191,7 @@ public class BlockFire extends Block {
}
// CraftBukkit end
- if (random.nextInt(i1 + 10) < 5 && !world.y(i, j, k)) {
+ if (random.nextInt(i1 + 10) < 5 && !world.B(i, j, k)) {
int k1 = i1 + random.nextInt(5) / 4;
if (k1 > 15) {
@@ -202,60 +209,61 @@ public class BlockFire extends Block {
}
}
- private boolean g(World world, int i, int j, int k) {
- return this.c(world, i + 1, j, k) ? true : (this.c(world, i - 1, j, k) ? true : (this.c(world, i, j - 1, k) ? true : (this.c(world, i, j + 1, k) ? true : (this.c(world, i, j, k - 1) ? true : this.c(world, i, j, k + 1)))));
+ private boolean l(World world, int i, int j, int k) {
+ return this.d((IBlockAccess) world, i + 1, j, k) ? true : (this.d((IBlockAccess) world, i - 1, j, k) ? true : (this.d((IBlockAccess) world, i, j - 1, k) ? true : (this.d((IBlockAccess) world, i, j + 1, k) ? true : (this.d((IBlockAccess) world, i, j, k - 1) ? true : this.d((IBlockAccess) world, i, j, k + 1)))));
}
- private int h(World world, int i, int j, int k) {
+ private int n(World world, int i, int j, int k) {
byte b0 = 0;
if (!world.isEmpty(i, j, k)) {
return 0;
} else {
- int l = this.f(world, i + 1, j, k, b0);
+ int l = this.e(world, i + 1, j, k, b0);
- l = this.f(world, i - 1, j, k, l);
- l = this.f(world, i, j - 1, k, l);
- l = this.f(world, i, j + 1, k, l);
- l = this.f(world, i, j, k - 1, l);
- l = this.f(world, i, j, k + 1, l);
+ l = this.e(world, i - 1, j, k, l);
+ l = this.e(world, i, j - 1, k, l);
+ l = this.e(world, i, j + 1, k, l);
+ l = this.e(world, i, j, k - 1, l);
+ l = this.e(world, i, j, k + 1, l);
return l;
}
}
- public boolean E_() {
+ public boolean l() {
return false;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
}
- public int f(World world, int i, int j, int k, int l) {
+ public int e(World world, int i, int j, int k, int l) {
int i1 = this.a[world.getTypeId(i, j, k)];
return i1 > l ? i1 : l;
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.e(i, j - 1, k) || this.g(world, i, j, k);
+ return world.t(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.e(i, j - 1, k) && !this.g(world, i, j, k)) {
- fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone
+ if (!world.t(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.b_(world, i, j, k)) {
- if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) {
- fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
+ 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)) {
+ fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
} else {
- world.c(i, j, k, this.id, this.d() + world.random.nextInt(10));
+ world.a(i, j, k, this.id, this.p_() + world.random.nextInt(10));
}
}
}
+
// CraftBukkit start
private void fireExtinguished(World world, int x, int y, int z) {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled() == false) {
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 347733f2..e5f44a90 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -17,26 +17,25 @@ public class BlockFlowing extends BlockFluids {
super(i, material);
}
- private void i(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
world.setRawTypeIdAndData(i, j, k, this.id + 1, l);
- world.b(i, j, k, i, j, k);
- world.notify(i, j, k);
+ world.d(i, j, k, i, j, k);
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.Server server = world.getServer();
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
// CraftBukkit end
- int l = this.g(world, i, j, k);
+ int l = this.f_(world, i, j, k);
byte b0 = 1;
if (this.material == Material.LAVA && !world.worldProvider.d) {
@@ -50,18 +49,18 @@ public class BlockFlowing extends BlockFluids {
byte b1 = -100;
this.a = 0;
- int j1 = this.f(world, i - 1, j, k, b1);
+ int j1 = this.e(world, i - 1, j, k, b1);
- j1 = this.f(world, i + 1, j, k, j1);
- j1 = this.f(world, i, j, k - 1, j1);
- j1 = this.f(world, i, j, k + 1, j1);
+ j1 = this.e(world, i + 1, j, k, j1);
+ j1 = this.e(world, i, j, k - 1, j1);
+ j1 = this.e(world, i, j, k + 1, j1);
i1 = j1 + b0;
if (i1 >= 8 || j1 < 0) {
i1 = -1;
}
- if (this.g(world, i, j + 1, k) >= 0) {
- int k1 = this.g(world, i, j + 1, k);
+ if (this.f_(world, i, j + 1, k) >= 0) {
+ int k1 = this.f_(world, i, j + 1, k);
if (k1 >= 8) {
i1 = k1;
@@ -83,23 +82,25 @@ public class BlockFlowing extends BlockFluids {
flag = false;
}
- if (i1 != l) {
+ if (i1 == l) {
+ if (flag) {
+ this.l(world, i, j, k);
+ }
+ } else {
l = i1;
if (i1 < 0) {
world.setTypeId(i, j, k, 0);
} else {
world.setData(i, j, k, i1);
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
world.applyPhysics(i, j, k, this.id);
}
- } else if (flag) {
- this.i(world, i, j, k);
}
} else {
- this.i(world, i, j, k);
+ this.l(world, i, j, k);
}
- if (this.l(world, i, j - 1, k)) {
+ if (this.p(world, i, j - 1, k)) {
// CraftBukkit start - send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
if (server != null) {
@@ -114,14 +115,14 @@ public class BlockFlowing extends BlockFluids {
}
if (l >= 8) {
- world.setTypeIdAndData(i, j - 1, k, this.id, l);
+ this.flow(world, i, j - 1, k, l);
} else {
- world.setTypeIdAndData(i, j - 1, k, this.id, l + 8);
+ this.flow(world, i, j - 1, k, l + 8);
}
}
// CraftBukkit end
- } else if (l >= 0 && (l == 0 || this.k(world, i, j - 1, k))) {
- boolean[] aboolean = this.j(world, i, j, k);
+ } else if (l >= 0 && (l == 0 || this.o(world, i, j - 1, k))) {
+ boolean[] aboolean = this.n(world, i, j, k);
i1 = l + b0;
if (l >= 8) {
@@ -155,14 +156,14 @@ public class BlockFlowing extends BlockFluids {
}
private void flow(World world, int i, int j, int k, int l) {
- if (this.l(world, i, j, k)) {
+ if (this.p(world, i, j, k)) {
int i1 = world.getTypeId(i, j, k);
if (i1 > 0) {
if (this.material == Material.LAVA) {
this.fizz(world, i, j, k);
} else {
- Block.byId[i1].b(world, i, j, k, world.getData(i, j, k), 0);
+ Block.byId[i1].c(world, i, j, k, world.getData(i, j, k), 0);
}
}
@@ -170,7 +171,7 @@ public class BlockFlowing extends BlockFluids {
}
}
- private int c(World world, int i, int j, int k, int l, int i1) {
+ private int d(World world, int i, int j, int k, int l, int i1) {
int j1 = 1000;
for (int k1 = 0; k1 < 4; ++k1) {
@@ -194,13 +195,13 @@ public class BlockFlowing extends BlockFluids {
++i2;
}
- if (!this.k(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
- if (!this.k(world, l1, j - 1, i2)) {
+ if (!this.o(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
+ if (!this.o(world, l1, j - 1, i2)) {
return l;
}
if (l < 4) {
- int j2 = this.c(world, l1, j, i2, l + 1, k1);
+ int j2 = this.d(world, l1, j, i2, l + 1, k1);
if (j2 < j1) {
j1 = j2;
@@ -213,7 +214,7 @@ public class BlockFlowing extends BlockFluids {
return j1;
}
- private boolean[] j(World world, int i, int j, int k) {
+ private boolean[] n(World world, int i, int j, int k) {
int l;
int i1;
@@ -238,11 +239,11 @@ public class BlockFlowing extends BlockFluids {
++j1;
}
- if (!this.k(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
- if (!this.k(world, i1, j - 1, j1)) {
- this.c[l] = 0;
+ if (!this.o(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
+ if (this.o(world, i1, j - 1, j1)) {
+ this.c[l] = this.d(world, i1, j, j1, 1, l);
} else {
- this.c[l] = this.c(world, i1, j, j1, 1, l);
+ this.c[l] = 0;
}
}
}
@@ -262,7 +263,7 @@ public class BlockFlowing extends BlockFluids {
return this.b;
}
- private boolean k(World world, int i, int j, int k) {
+ private boolean o(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
if (l != Block.WOODEN_DOOR.id && l != Block.IRON_DOOR_BLOCK.id && l != Block.SIGN_POST.id && l != Block.LADDER.id && l != Block.SUGAR_CANE_BLOCK.id) {
@@ -278,8 +279,8 @@ public class BlockFlowing extends BlockFluids {
}
}
- protected int f(World world, int i, int j, int k, int l) {
- int i1 = this.g(world, i, j, k);
+ protected int e(World world, int i, int j, int k, int l) {
+ int i1 = this.f_(world, i, j, k);
if (i1 < 0) {
return l;
@@ -296,16 +297,16 @@ public class BlockFlowing extends BlockFluids {
}
}
- private boolean l(World world, int i, int j, int k) {
+ private boolean p(World world, int i, int j, int k) {
Material material = world.getMaterial(i, j, k);
- return material == this.material ? false : (material == Material.LAVA ? false : !this.k(world, i, j, k));
+ return material == this.material ? false : (material == Material.LAVA ? false : !this.o(world, i, j, k));
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (world.getTypeId(i, j, k) == this.id) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
index c3f06876..79a007c8 100644
--- a/src/main/java/net/minecraft/server/BlockGrass.java
+++ b/src/main/java/net/minecraft/server/BlockGrass.java
@@ -13,17 +13,18 @@ public class BlockGrass extends Block {
protected BlockGrass(int i) {
super(i, Material.GRASS);
this.textureId = 3;
- this.a(true);
+ this.b(true);
+ this.a(CreativeModeTab.b);
}
public int a(int i, int j) {
return i == 1 ? 0 : (i == 0 ? 2 : 3);
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
- // CraftBukkit start - reuse getLightLevel
+ // CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i, j, k).getState();
blockState.setTypeId(Block.DIRT.id);
@@ -46,7 +47,7 @@ public class BlockGrass extends Block {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
- blockState.setTypeId(this.id);
+ blockState.setTypeId(Block.GRASS.id);
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/BlockIce.java b/src/main/java/net/minecraft/server/BlockIce.java
index 7895543d..b6791ce9 100644
--- a/src/main/java/net/minecraft/server/BlockIce.java
+++ b/src/main/java/net/minecraft/server/BlockIce.java
@@ -7,15 +7,33 @@ public class BlockIce extends BlockHalfTransparant {
public BlockIce(int i, int j) {
super(i, j, Material.ICE, false);
this.frictionFactor = 0.98F;
- this.a(true);
+ this.b(true);
+ this.a(CreativeModeTab.b);
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- super.a(world, entityhuman, i, j, k, l);
- Material material = world.getMaterial(i, j - 1, k);
+ entityhuman.a(StatisticList.C[this.id], 1);
+ entityhuman.j(0.025F);
+ if (this.q_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
+ ItemStack itemstack = this.c_(l);
- if (material.isSolid() || material.isLiquid()) {
- world.setTypeId(i, j, k, Block.WATER.id);
+ if (itemstack != null) {
+ this.a(world, i, j, k, itemstack);
+ }
+ } else {
+ if (world.worldProvider.d) {
+ world.setTypeId(i, j, k, 0);
+ return;
+ }
+
+ int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory);
+
+ this.c(world, i, j, k, l, i1);
+ Material material = world.getMaterial(i, j - 1, k);
+
+ if (material.isSolid() || material.isLiquid()) {
+ world.setTypeId(i, j, k, Block.WATER.id);
+ }
}
}
@@ -23,24 +41,25 @@ public class BlockIce extends BlockHalfTransparant {
return 0;
}
- public void a(World world, int i, int j, int k, Random random) {
- if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
+ public void b(World world, int i, int j, int k, Random random) {
+ if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
return;
}
// CraftBukkit end
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ if (world.worldProvider.d) {
+ world.setTypeId(i, j, k, 0);
+ return;
+ }
+
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, Block.STATIONARY_WATER.id);
}
}
- public int g() {
+ public int e() {
return 0;
}
-
- protected ItemStack a_(int i) {
- return null;
- }
}
diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java
index ade3bed2..7f7066b5 100644
--- a/src/main/java/net/minecraft/server/BlockLeaves.java
+++ b/src/main/java/net/minecraft/server/BlockLeaves.java
@@ -6,29 +6,31 @@ import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
public class BlockLeaves extends BlockTransparant {
- private int c;
- int[] a;
+ private int cr;
+ public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
+ int[] b;
protected BlockLeaves(int i, int j) {
super(i, j, Material.LEAVES, false);
- this.c = j;
- this.a(true);
+ this.cr = j;
+ this.b(true);
+ this.a(CreativeModeTab.c);
}
- public void remove(World world, int i, int j, int k) {
+ public void remove(World world, int i, int j, int k, int l, int i1) {
byte b0 = 1;
- int l = b0 + 1;
+ int j1 = b0 + 1;
- if (world.a(i - l, j - l, k - l, i + l, j + l, k + l)) {
- for (int i1 = -b0; i1 <= b0; ++i1) {
- for (int j1 = -b0; j1 <= b0; ++j1) {
- for (int k1 = -b0; k1 <= b0; ++k1) {
- int l1 = world.getTypeId(i + i1, j + j1, k + k1);
+ if (world.c(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
+ for (int k1 = -b0; k1 <= b0; ++k1) {
+ for (int l1 = -b0; l1 <= b0; ++l1) {
+ for (int i2 = -b0; i2 <= b0; ++i2) {
+ int j2 = world.getTypeId(i + k1, j + l1, k + i2);
- if (l1 == Block.LEAVES.id) {
- int i2 = world.getData(i + i1, j + j1, k + k1);
+ if (j2 == Block.LEAVES.id) {
+ int k2 = world.getData(i + k1, j + l1, k + i2);
- world.setRawData(i + i1, j + j1, k + k1, i2 | 8);
+ world.setRawData(i + k1, j + l1, k + i2, k2 | 8);
}
}
}
@@ -36,7 +38,7 @@ public class BlockLeaves extends BlockTransparant {
}
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@@ -47,13 +49,13 @@ public class BlockLeaves extends BlockTransparant {
int j1 = b1 * b1;
int k1 = b1 / 2;
- if (this.a == null) {
- this.a = new int[b1 * b1 * b1];
+ if (this.b == null) {
+ this.b = new int[b1 * b1 * b1];
}
int l1;
- if (world.a(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
+ if (world.c(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
int i2;
int j2;
int k2;
@@ -63,11 +65,11 @@ public class BlockLeaves extends BlockTransparant {
for (j2 = -b0; j2 <= b0; ++j2) {
k2 = world.getTypeId(i + l1, j + i2, k + j2);
if (k2 == Block.LOG.id) {
- this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
+ this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
} else if (k2 == Block.LEAVES.id) {
- this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
+ this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
} else {
- this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
+ this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
}
}
}
@@ -77,29 +79,29 @@ public class BlockLeaves extends BlockTransparant {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
for (k2 = -b0; k2 <= b0; ++k2) {
- if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
- if (this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
- this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
+ if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
+ if (this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
+ this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
- if (this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
- this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
+ if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
+ this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
- if (this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
- this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
+ if (this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
+ this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
}
- if (this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
- this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
+ if (this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
+ this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
}
- if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
- this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
+ if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
+ this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
}
- if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
- this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
+ if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
+ this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
}
}
}
@@ -108,25 +110,27 @@ public class BlockLeaves extends BlockTransparant {
}
}
- l1 = this.a[k1 * j1 + k1 * b1 + k1];
+ l1 = this.b[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) {
world.setRawData(i, j, k, l & -9);
} else {
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
}
}
}
}
- private void g(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
// CraftBukkit start
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent(event);
- if (event.isCancelled()) return;
+ if (event.isCancelled()) {
+ return;
+ }
// CraftBukkit end
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
@@ -159,7 +163,7 @@ public class BlockLeaves extends BlockTransparant {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- if (!world.isStatic && entityhuman.U() != null && entityhuman.U().id == Item.SHEARS.id) {
+ if (!world.isStatic && entityhuman.bC() != null && entityhuman.bC().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));
} else {
@@ -171,15 +175,11 @@ public class BlockLeaves extends BlockTransparant {
return i & 3;
}
- public boolean a() {
- return !this.b;
+ public boolean d() {
+ return !this.c;
}
public int a(int i, int j) {
return (j & 3) == 1 ? this.textureId + 80 : ((j & 3) == 3 ? this.textureId + 144 : this.textureId);
}
-
- public void b(World world, int i, int j, int k, Entity entity) {
- super.b(world, i, j, k, entity);
- }
}
diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java
index 11a07ae4..df25656d 100644
--- a/src/main/java/net/minecraft/server/BlockLever.java
+++ b/src/main/java/net/minecraft/server/BlockLever.java
@@ -6,105 +6,143 @@ public class BlockLever extends Block {
protected BlockLever(int i, int j) {
super(i, j, Material.ORIENTABLE);
+ this.a(CreativeModeTab.d);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
return null;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public int c() {
+ public int b() {
return 12;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 1 && world.e(i, j - 1, k) ? true : (l == 2 && world.e(i, j, k + 1) ? true : (l == 3 && world.e(i, j, k - 1) ? true : (l == 4 && world.e(i + 1, j, k) ? true : l == 5 && world.e(i - 1, j, k))));
+ 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)))));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.e(i - 1, j, k) ? true : (world.e(i + 1, j, k) ? true : (world.e(i, j, k - 1) ? true : (world.e(i, j, k + 1) ? true : world.e(i, j - 1, 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)))));
}
- public void postPlace(World world, int i, int j, int k, int l) {
+ 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;
i1 = -1;
- if (l == 1 && world.e(i, j - 1, k)) {
+ if (l == 0 && world.s(i, j + 1, k)) {
+ i1 = world.random.nextBoolean() ? 0 : 7;
+ }
+
+ if (l == 1 && world.t(i, j - 1, k)) {
i1 = 5 + world.random.nextInt(2);
}
- if (l == 2 && world.e(i, j, k + 1)) {
+ if (l == 2 && world.s(i, j, k + 1)) {
i1 = 4;
}
- if (l == 3 && world.e(i, j, k - 1)) {
+ if (l == 3 && world.s(i, j, k - 1)) {
i1 = 3;
}
- if (l == 4 && world.e(i + 1, j, k)) {
+ if (l == 4 && world.s(i + 1, j, k)) {
i1 = 2;
}
- if (l == 5 && world.e(i - 1, j, k)) {
+ if (l == 5 && world.s(i - 1, j, k)) {
i1 = 1;
}
if (i1 == -1) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ 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);
}
}
+ public static int d(int i) {
+ switch (i) {
+ case 0:
+ return 0;
+
+ case 1:
+ return 5;
+
+ case 2:
+ return 4;
+
+ case 3:
+ return 3;
+
+ case 4:
+ return 2;
+
+ case 5:
+ return 1;
+
+ default:
+ return -1;
+ }
+ }
+
public void doPhysics(World world, int i, int j, int k, int l) {
- if (this.g(world, i, j, k)) {
+ if (this.l(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.e(i - 1, j, k) && i1 == 1) {
+ if (!world.s(i - 1, j, k) && i1 == 1) {
flag = true;
}
- if (!world.e(i + 1, j, k) && i1 == 2) {
+ if (!world.s(i + 1, j, k) && i1 == 2) {
flag = true;
}
- if (!world.e(i, j, k - 1) && i1 == 3) {
+ if (!world.s(i, j, k - 1) && i1 == 3) {
flag = true;
}
- if (!world.e(i, j, k + 1) && i1 == 4) {
+ if (!world.s(i, j, k + 1) && i1 == 4) {
flag = true;
}
- if (!world.e(i, j - 1, k) && i1 == 5) {
+ if (!world.t(i, j - 1, k) && i1 == 5) {
flag = true;
}
- if (!world.e(i, j - 1, k) && i1 == 6) {
+ if (!world.t(i, j - 1, k) && i1 == 6) {
+ flag = true;
+ }
+
+ if (!world.s(i, j + 1, k) && i1 == 0) {
+ flag = true;
+ }
+
+ if (!world.s(i, j + 1, k) && i1 == 7) {
flag = true;
}
if (flag) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
}
}
- private boolean g(World world, int i, int j, int k) {
+ private boolean l(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
return false;
} else {
@@ -124,6 +162,11 @@ public class BlockLever extends Block {
this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
} else if (l == 4) {
this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
+ } else if (l != 5 && l != 6) {
+ if (l == 0 || l == 7) {
+ f = 0.25F;
+ this.a(0.5F - f, 0.4F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
+ }
} else {
f = 0.25F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
@@ -131,42 +174,46 @@ public class BlockLever extends Block {
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.interact(world, i, j, k, entityhuman);
+ this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
} else {
- int l = world.getData(i, j, k);
- int i1 = l & 7;
- int j1 = 8 - (l & 8);
+ int i1 = world.getData(i, j, k);
+ int j1 = i1 & 7;
+ int k1 = 8 - (i1 & 8);
// CraftBukkit start - Interact Lever
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- int old = (j1 != 8) ? 1 : 0;
- int current = (j1 == 8) ? 1 : 0;
+ int old = (k1 != 8) ? 1 : 0;
+ int current = (k1 == 8) ? 1 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
- if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
+ if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8)) {
return true;
}
// CraftBukkit end
- world.setData(i, j, k, i1 + j1);
- world.b(i, j, k, i, j, k);
- world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, j1 > 0 ? 0.6F : 0.5F);
+ world.setData(i, j, k, j1 + k1);
+ world.d(i, j, k, i, j, k);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F);
world.applyPhysics(i, j, k, this.id);
- if (i1 == 1) {
+ if (j1 == 1) {
world.applyPhysics(i - 1, j, k, this.id);
- } else if (i1 == 2) {
+ } else if (j1 == 2) {
world.applyPhysics(i + 1, j, k, this.id);
- } else if (i1 == 3) {
+ } else if (j1 == 3) {
world.applyPhysics(i, j, k - 1, this.id);
- } else if (i1 == 4) {
+ } else if (j1 == 4) {
world.applyPhysics(i, j, k + 1, this.id);
+ } else if (j1 != 5 && j1 != 6) {
+ if (j1 == 0 || j1 == 7) {
+ world.applyPhysics(i, j + 1, k, this.id);
+ }
} else {
world.applyPhysics(i, j - 1, k, this.id);
}
@@ -175,34 +222,36 @@ public class BlockLever extends Block {
}
}
- public void remove(World world, int i, int j, int k) {
- int l = world.getData(i, j, k);
-
- if ((l & 8) > 0) {
+ public void remove(World world, int i, int j, int k, int l, int i1) {
+ if ((i1 & 8) > 0) {
world.applyPhysics(i, j, k, this.id);
- int i1 = l & 7;
+ int j1 = i1 & 7;
- if (i1 == 1) {
+ if (j1 == 1) {
world.applyPhysics(i - 1, j, k, this.id);
- } else if (i1 == 2) {
+ } else if (j1 == 2) {
world.applyPhysics(i + 1, j, k, this.id);
- } else if (i1 == 3) {
+ } else if (j1 == 3) {
world.applyPhysics(i, j, k - 1, this.id);
- } else if (i1 == 4) {
+ } else if (j1 == 4) {
world.applyPhysics(i, j, k + 1, this.id);
+ } else if (j1 != 5 && j1 != 6) {
+ if (j1 == 0 || j1 == 7) {
+ world.applyPhysics(i, j + 1, k, this.id);
+ }
} else {
world.applyPhysics(i, j - 1, k, this.id);
}
}
- super.remove(world, i, j, k);
+ super.remove(world, i, j, k, l, i1);
}
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) > 0;
}
- public boolean d(World world, int i, int j, int k, int l) {
+ public boolean c(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
if ((i1 & 8) == 0) {
@@ -210,7 +259,7 @@ public class BlockLever extends Block {
} else {
int j1 = i1 & 7;
- return j1 == 6 && l == 1 ? true : (j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5))));
+ return j1 == 0 && l == 0 ? true : (j1 == 7 && l == 0 ? true : (j1 == 6 && l == 1 ? true : (j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5))))));
}
}
diff --git a/src/main/java/net/minecraft/server/BlockMinecartDetector.java b/src/main/java/net/minecraft/server/BlockMinecartDetector.java
index 5f4bb85d..b5689bfa 100644
--- a/src/main/java/net/minecraft/server/BlockMinecartDetector.java
+++ b/src/main/java/net/minecraft/server/BlockMinecartDetector.java
@@ -9,10 +9,10 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
public BlockMinecartDetector(int i, int j) {
super(i, j, true);
- this.a(true);
+ this.b(true);
}
- public int d() {
+ public int p_() {
return 20;
}
@@ -25,17 +25,17 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
int l = world.getData(i, j, k);
if ((l & 8) == 0) {
- this.f(world, i, j, k, l);
+ this.e(world, i, j, k, l);
}
}
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
if ((l & 8) != 0) {
- this.f(world, i, j, k, l);
+ this.e(world, i, j, k, l);
}
}
}
@@ -44,17 +44,17 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
return (iblockaccess.getData(i, j, k) & 8) != 0;
}
- public boolean d(World world, int i, int j, int k, int l) {
+ public boolean c(World world, int i, int j, int k, int l) {
return (world.getData(i, j, k) & 8) == 0 ? false : l == 1;
}
- private void f(World world, int i, int j, int k, int l) {
+ private void e(World world, int i, int j, int k, int l) {
boolean flag = (l & 8) != 0;
boolean flag1 = false;
float f = 0.125F;
- List list = world.a(EntityMinecart.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
+ List list = world.a(EntityMinecart.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
- if (list.size() > 0) {
+ if (!list.isEmpty()) {
flag1 = true;
}
@@ -73,18 +73,18 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
world.setData(i, j, k, l | 8);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- world.b(i, j, k, i, j, k);
+ world.d(i, j, k, i, j, k);
}
if (!flag1 && flag) {
world.setData(i, j, k, l & 7);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- world.b(i, j, k, i, j, k);
+ world.d(i, j, k, i, j, k);
}
if (flag1) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrack.java b/src/main/java/net/minecraft/server/BlockMinecartTrack.java
index 528fdd84..662430c6 100644
--- a/src/main/java/net/minecraft/server/BlockMinecartTrack.java
+++ b/src/main/java/net/minecraft/server/BlockMinecartTrack.java
@@ -6,7 +6,7 @@ public class BlockMinecartTrack extends Block {
private final boolean a;
- public static final boolean g(World world, int i, int j, int k) {
+ public static final boolean d_(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
return l == Block.RAILS.id || l == Block.GOLDEN_RAIL.id || l == Block.DETECTOR_RAIL.id;
@@ -20,9 +20,10 @@ public class BlockMinecartTrack extends Block {
super(i, j, Material.ORIENTABLE);
this.a = flag;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
+ this.a(CreativeModeTab.e);
}
- public boolean i() {
+ public boolean n() {
return this.a;
}
@@ -30,7 +31,7 @@ public class BlockMinecartTrack extends Block {
return null;
}
- public boolean a() {
+ public boolean d() {
return false;
}
@@ -61,11 +62,11 @@ public class BlockMinecartTrack extends Block {
return this.textureId;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public int c() {
+ public int b() {
return 9;
}
@@ -74,14 +75,14 @@ public class BlockMinecartTrack extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.e(i, j - 1, k);
+ return world.t(i, j - 1, k);
}
public void onPlace(World world, int i, int j, int k) {
if (!world.isStatic) {
this.a(world, i, j, k, true);
if (this.id == Block.GOLDEN_RAIL.id) {
- // this.doPhysics(world, i, j, k, this.id); // CraftBukkit - Fix issues with rails
+ // this.doPhysics(world, i, j, k, this.id); // CraftBukkit - fix issues with rails
}
}
}
@@ -97,28 +98,28 @@ public class BlockMinecartTrack extends Block {
boolean flag = false;
- if (!world.e(i, j - 1, k)) {
+ if (!world.t(i, j - 1, k)) {
flag = true;
}
- if (j1 == 2 && !world.e(i + 1, j, k)) {
+ if (j1 == 2 && !world.t(i + 1, j, k)) {
flag = true;
}
- if (j1 == 3 && !world.e(i - 1, j, k)) {
+ if (j1 == 3 && !world.t(i - 1, j, k)) {
flag = true;
}
- if (j1 == 4 && !world.e(i, j, k - 1)) {
+ if (j1 == 4 && !world.t(i, j, k - 1)) {
flag = true;
}
- if (j1 == 5 && !world.e(i, j, k + 1)) {
+ if (j1 == 5 && !world.t(i, j, k + 1)) {
flag = true;
}
if (flag) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
} else if (this.id == Block.GOLDEN_RAIL.id) {
boolean flag1 = world.isBlockIndirectlyPowered(i, j, k);
@@ -255,7 +256,7 @@ public class BlockMinecartTrack extends Block {
return false;
}
- public int g() {
+ public int e() {
return 0;
}
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
index c9f1143d..177cfaf3 100644
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java
@@ -19,10 +19,10 @@ public class BlockMushroom extends BlockFlower {
float f = 0.2F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
- this.a(true);
+ this.b(true);
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (random.nextInt(25) == 0) {
byte b0 = 4;
int l = 5;
@@ -49,7 +49,7 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
- if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
+ if (world.isEmpty(i1, j1, k1) && this.d(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
@@ -60,7 +60,7 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
}
- if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
+ if (world.isEmpty(i1, j1, k1) && this.d(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
@@ -78,18 +78,18 @@ public class BlockMushroom extends BlockFlower {
}
public boolean canPlace(World world, int i, int j, int k) {
- return super.canPlace(world, i, j, k) && this.f(world, i, j, k);
+ return super.canPlace(world, i, j, k) && this.d(world, i, j, k);
}
- protected boolean d(int i) {
+ protected boolean d_(int i) {
return Block.n[i];
}
- public boolean f(World world, int i, int j, int k) {
+ public boolean d(World world, int i, int j, int k) {
if (j >= 0 && j < 256) {
int l = world.getTypeId(i, j - 1, k);
- return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.d(l);
+ return l == Block.MYCEL.id || world.k(i, j, k) < 13 && this.d_(l);
} else {
return false;
}
@@ -113,6 +113,7 @@ public class BlockMushroom extends BlockFlower {
event = new StructureGrowEvent(location, TreeType.RED_MUSHROOM, bonemeal, player, new ArrayList<BlockState>());
worldgenhugemushroom = new WorldGenHugeMushroom(1);
}
+
if (worldgenhugemushroom != null && event != null) {
grown = worldgenhugemushroom.grow((org.bukkit.BlockChangeDelegate)world, random, i, j, k, event, itemstack, world.getWorld());
if (event.isFromBonemeal() && itemstack != null) {
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java
index d0d51e2e..6dbf49f7 100644
--- a/src/main/java/net/minecraft/server/BlockMycel.java
+++ b/src/main/java/net/minecraft/server/BlockMycel.java
@@ -13,14 +13,15 @@ public class BlockMycel extends Block {
protected BlockMycel(int i) {
super(i, Material.GRASS);
this.textureId = 77;
- this.a(true);
+ this.b(true);
+ this.a(CreativeModeTab.b);
}
public int a(int i, int j) {
return i == 1 ? 78 : (i == 0 ? 2 : 77);
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java
index 8230de98..9c4b7761 100644
--- a/src/main/java/net/minecraft/server/BlockNetherWart.java
+++ b/src/main/java/net/minecraft/server/BlockNetherWart.java
@@ -6,39 +6,36 @@ public class BlockNetherWart extends BlockFlower {
protected BlockNetherWart(int i) {
super(i, 226);
- this.a(true);
+ this.b(true);
float f = 0.5F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
+ this.a((CreativeModeTab) null);
}
- protected boolean d(int i) {
+ protected boolean d_(int i) {
return i == Block.SOUL_SAND.id;
}
- public boolean f(World world, int i, int j, int k) {
- return this.d(world.getTypeId(i, j - 1, k));
+ public boolean d(World world, int i, int j, int k) {
+ return this.d_(world.getTypeId(i, j - 1, k));
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
- if (l < 3) {
- BiomeBase biomebase = world.getBiome(i, k);
-
- if (biomebase instanceof BiomeHell && random.nextInt(10) == 0) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
- }
+ if (l < 3 && random.nextInt(10) == 0) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
}
- super.a(world, i, j, k, random);
+ super.b(world, i, j, k, random);
}
public int a(int i, int j) {
return j >= 3 ? this.textureId + 2 : (j > 0 ? this.textureId + 1 : this.textureId);
}
- public int c() {
+ public int b() {
return 6;
}
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index b33e4bb5..2944eca7 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-import java.util.ArrayList;
+import java.util.List;
// CraftBukkit start
import org.bukkit.craftbukkit.block.CraftBlock;
@@ -11,63 +11,64 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
public class BlockPiston extends Block {
private boolean a;
- private static boolean b;
public BlockPiston(int i, int j, boolean flag) {
super(i, j, Material.PISTON);
this.a = flag;
this.a(h);
this.c(0.5F);
+ this.a(CreativeModeTab.d);
}
public int a(int i, int j) {
- int k = d(j);
+ int k = e(j);
- return k > 5 ? this.textureId : (i == k ? (!e(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == Facing.OPPOSITE_FACING[k] ? 109 : 108));
+ return k > 5 ? this.textureId : (i == k ? (!f(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == Facing.OPPOSITE_FACING[k] ? 109 : 108));
}
- public int c() {
+ public int b() {
return 16;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
return false;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
- int l = c(world, i, j, k, (EntityHuman) entityliving);
+ int l = b(world, i, j, k, (EntityHuman) entityliving);
world.setData(i, j, k, l);
- if (!world.isStatic && !b) {
- this.g(world, i, j, k);
+ if (!world.isStatic) {
+ this.l(world, i, j, k);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (!world.isStatic && !b) {
- this.g(world, i, j, k);
+ if (!world.isStatic) {
+ this.l(world, i, j, k);
}
}
public void onPlace(World world, int i, int j, int k) {
- if (!world.isStatic && world.getTileEntity(i, j, k) == null && !b) {
- this.g(world, i, j, k);
+ if (!world.isStatic && world.getTileEntity(i, j, k) == null) {
+ this.l(world, i, j, k);
}
}
- private void g(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- int i1 = d(l);
- boolean flag = this.f(world, i, j, k, i1);
+ int i1 = e(l);
- if (l != 7) {
- if (flag && !e(l)) {
+ if (i1 != 7) {
+ boolean flag = this.e(world, i, j, k, i1);
+
+ if (flag && !f(l)) {
// CraftBukkit start
- int length = g(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);
@@ -79,10 +80,9 @@ public class BlockPiston extends Block {
}
// CraftBukkit end
- world.setRawData(i, j, k, i1 | 8);
- world.playNote(i, j, k, 0, i1);
+ world.playNote(i, j, k, this.id, 0, i1);
}
- } else if (!flag && e(l)) {
+ } else if (!flag && f(l)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
@@ -94,20 +94,24 @@ public class BlockPiston extends Block {
}
// CraftBukkit end
- world.setRawData(i, j, k, i1);
- world.playNote(i, j, k, 1, i1);
+ world.playNote(i, j, k, this.id, 1, i1);
}
}
}
- private boolean f(World world, int i, int j, int k, int l) {
+ private boolean e(World world, int i, int j, int k, int l) {
return l != 0 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : (world.isBlockFaceIndirectlyPowered(i, j, k, 0) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 2, k, 1) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFaceIndirectlyPowered(i - 1, j + 1, k, 4) ? true : world.isBlockFaceIndirectlyPowered(i + 1, j + 1, k, 5)))))))))));
}
- public void a(World world, int i, int j, int k, int l, int i1) {
- b = true;
+ public void b(World world, int i, int j, int k, int l, int i1) {
if (l == 0) {
- if (this.h(world, i, j, k, i1)) {
+ world.setRawData(i, j, k, i1 | 8);
+ } else {
+ world.setRawData(i, j, k, i1);
+ }
+
+ if (l == 0) {
+ 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 {
@@ -116,8 +120,8 @@ public class BlockPiston extends Block {
} else if (l == 1) {
TileEntity tileentity = world.getTileEntity(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
- if (tileentity != null && tileentity instanceof TileEntityPiston) {
- ((TileEntityPiston) tileentity).g();
+ if (tileentity instanceof TileEntityPiston) {
+ ((TileEntityPiston) tileentity).i();
}
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
@@ -133,49 +137,41 @@ public class BlockPiston extends Block {
if (i2 == Block.PISTON_MOVING.id) {
TileEntity tileentity1 = world.getTileEntity(j1, k1, l1);
- if (tileentity1 != null && tileentity1 instanceof TileEntityPiston) {
+ if (tileentity1 instanceof TileEntityPiston) {
TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1;
- if (tileentitypiston.f() == i1 && tileentitypiston.e()) {
- tileentitypiston.g();
- i2 = tileentitypiston.c();
- j2 = tileentitypiston.k();
+ if (tileentitypiston.c() == i1 && tileentitypiston.b()) {
+ tileentitypiston.i();
+ i2 = tileentitypiston.a();
+ j2 = tileentitypiston.n();
flag = true;
}
}
}
- if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].g() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
+ if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].e() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
i += Facing.b[i1];
j += Facing.c[i1];
k += Facing.d[i1];
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2);
world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
- b = false;
world.setTypeId(j1, k1, l1, 0);
- b = true;
} else if (!flag) {
- b = false;
world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
- b = true;
}
} else {
- b = false;
world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
- b = true;
}
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.in", 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
}
-
- b = false;
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- if (e(l)) {
- switch (d(l)) {
+ if (f(l)) {
+ switch (e(l)) {
case 0:
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
@@ -208,9 +204,9 @@ public class BlockPiston extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
- public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
+ public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
@@ -218,20 +214,20 @@ public class BlockPiston extends Block {
return super.e(world, i, j, k);
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public static int d(int i) {
+ public static int e(int i) {
if ((i & 7) >= Facing.OPPOSITE_FACING.length) return 0; // CraftBukkit - check for AIOOB on piston data
return i & 7;
}
- public static boolean e(int i) {
+ public static boolean f(int i) {
return (i & 8) != 0;
}
- private static int c(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public static int b(World world, int i, int j, int k, EntityHuman entityhuman) {
if (MathHelper.abs((float) entityhuman.locX - (float) i) < 2.0F && MathHelper.abs((float) entityhuman.locZ - (float) k) < 2.0F) {
double d0 = entityhuman.locY + 1.82D - (double) entityhuman.height;
@@ -254,18 +250,18 @@ public class BlockPiston extends Block {
return false;
} else {
if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) {
- if (Block.byId[i].m() == -1.0F) {
+ if (Block.byId[i].m(world, j, k, l) == -1.0F) {
return false;
}
- if (Block.byId[i].g() == 2) {
+ if (Block.byId[i].e() == 2) {
return false;
}
- if (!flag && Block.byId[i].g() == 1) {
+ if (!flag && Block.byId[i].e() == 1) {
return false;
}
- } else if (e(world.getData(j, k, l))) {
+ } else if (f(world.getData(j, k, l))) {
return false;
}
@@ -273,8 +269,8 @@ public class BlockPiston extends Block {
}
}
- // CraftBukkit - boolean -> int
- private static int g(World world, int i, int j, int k, int l) {
+ // CraftBukkit - change return from boolean to int
+ 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];
@@ -293,7 +289,7 @@ public class BlockPiston extends Block {
return -1; // CraftBukkit
}
- if (Block.byId[i2].g() != 1) {
+ if (Block.byId[i2].e() != 1) {
if (l1 == 12) {
return -1; // CraftBukkit
}
@@ -311,7 +307,7 @@ public class BlockPiston extends Block {
}
}
- private boolean h(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];
@@ -331,7 +327,7 @@ public class BlockPiston extends Block {
return false;
}
- if (Block.byId[i2].g() != 1) {
+ if (Block.byId[i2].e() != 1) {
if (l1 == 12) {
return false;
}
@@ -343,7 +339,7 @@ public class BlockPiston extends Block {
continue;
}
- Block.byId[i2].b(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
+ Block.byId[i2].c(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
world.setTypeId(i1, j1, k1, 0);
}
}
@@ -356,10 +352,10 @@ public class BlockPiston extends Block {
int l2 = world.getData(l1, i2, j2);
if (k2 == this.id && l1 == i && i2 == j && j2 == k) {
- world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0));
+ world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0), false);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(Block.PISTON_EXTENSION.id, l | (this.a ? 8 : 0), l, true, false));
} else {
- world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l2);
+ world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l2, false);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k2, l2, l, true, false));
}
diff --git a/src/main/java/net/minecraft/server/BlockPistonExtension.java b/src/main/java/net/minecraft/server/BlockPistonExtension.java
index e6a7b186..28967175 100644
--- a/src/main/java/net/minecraft/server/BlockPistonExtension.java
+++ b/src/main/java/net/minecraft/server/BlockPistonExtension.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-import java.util.ArrayList;
+import java.util.List;
import java.util.Random;
public class BlockPistonExtension extends Block {
@@ -13,41 +13,40 @@ public class BlockPistonExtension extends Block {
this.c(0.5F);
}
- public void remove(World world, int i, int j, int k) {
- super.remove(world, i, j, k);
- int l = world.getData(i, j, k);
- if (l > 5 || l < 0) return; // CraftBukkit - fixed a piston AIOOBE issue.
- int i1 = Facing.OPPOSITE_FACING[b(l)];
-
- i += Facing.b[i1];
- j += Facing.c[i1];
- k += Facing.d[i1];
- int j1 = world.getTypeId(i, j, k);
-
- if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) {
- l = world.getData(i, j, k);
- if (BlockPiston.e(l)) {
- Block.byId[j1].b(world, i, j, k, l, 0);
+ public void remove(World world, int i, int j, int k, int l, int i1) {
+ super.remove(world, i, j, k, l, i1);
+ if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue
+ int j1 = Facing.OPPOSITE_FACING[f(i1)];
+
+ i += Facing.b[j1];
+ j += Facing.c[j1];
+ k += Facing.d[j1];
+ int k1 = world.getTypeId(i, j, k);
+
+ if (k1 == Block.PISTON.id || k1 == Block.PISTON_STICKY.id) {
+ i1 = world.getData(i, j, k);
+ if (BlockPiston.f(i1)) {
+ Block.byId[k1].c(world, i, j, k, i1, 0);
world.setTypeId(i, j, k, 0);
}
}
}
public int a(int i, int j) {
- int k = b(j);
+ int k = f(j);
- return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == Facing.OPPOSITE_FACING[k] ? 107 : 108);
+ return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (k < 6 && i == Facing.OPPOSITE_FACING[k] ? 107 : 108);
}
- public int c() {
+ public int b() {
return 17;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
@@ -63,50 +62,50 @@ public class BlockPistonExtension extends Block {
return 0;
}
- public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
+ public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
int l = world.getData(i, j, k);
- switch (b(l)) {
+ switch (f(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
this.a(0.375F, 0.25F, 0.375F, 0.625F, 1.0F, 0.625F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
break;
case 1:
this.a(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
this.a(0.375F, 0.0F, 0.375F, 0.625F, 0.75F, 0.625F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
break;
case 2:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
this.a(0.25F, 0.375F, 0.25F, 0.75F, 0.625F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
break;
case 3:
this.a(0.0F, 0.0F, 0.75F, 1.0F, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
this.a(0.25F, 0.375F, 0.0F, 0.75F, 0.625F, 0.75F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
break;
case 4:
this.a(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
this.a(0.375F, 0.25F, 0.25F, 0.625F, 0.75F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
break;
case 5:
this.a(0.75F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
this.a(0.0F, 0.375F, 0.25F, 0.75F, 0.625F, 0.75F);
- super.a(world, i, j, k, axisalignedbb, arraylist);
+ super.a(world, i, j, k, axisalignedbb, list, entity);
}
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
@@ -115,7 +114,7 @@ public class BlockPistonExtension extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- switch (b(l)) {
+ switch (f(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
break;
@@ -142,8 +141,8 @@ public class BlockPistonExtension extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
- int i1 = b(world.getData(i, j, k));
- if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue.
+ int i1 = f(world.getData(i, j, k));
+ if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue
int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
@@ -153,7 +152,7 @@ public class BlockPistonExtension extends Block {
}
}
- public static int b(int i) {
+ public static int f(int i) {
return i & 7;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java
index 057f526b..c18a9750 100644
--- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -11,6 +11,22 @@ public class BlockPortal extends BlockHalfTransparant {
public BlockPortal(int i, int j) {
super(i, j, Material.PORTAL, false);
+ this.b(true);
+ }
+
+ public void b(World world, int i, int j, int k, Random random) {
+ super.b(world, i, j, k, random);
+ if (world.worldProvider.d() && random.nextInt(2000) < world.difficulty) {
+ int l;
+
+ for (l = j; !world.t(i, l, k) && l > 0; --l) {
+ ;
+ }
+
+ if (l > 0 && !world.s(i, l + 1, k)) {
+ ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
+ }
+ }
}
public AxisAlignedBB e(World world, int i, int j, int k) {
@@ -32,15 +48,15 @@ public class BlockPortal extends BlockHalfTransparant {
}
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public boolean b_(World world, int i, int j, int k) {
+ public boolean i_(World world, int i, int j, int k) {
byte b0 = 0;
byte b1 = 0;
@@ -146,8 +162,10 @@ public class BlockPortal extends BlockHalfTransparant {
if (flag && flag1) {
world.setTypeId(i, j, k, 0);
- } else if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id || world.getTypeId(i - b0, j, k - b1) != this.id) && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id || world.getTypeId(i + b0, j, k + b1) != this.id)) {
- world.setTypeId(i, j, k, 0);
+ } else {
+ if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id || world.getTypeId(i - b0, j, k - b1) != this.id) && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id || world.getTypeId(i + b0, j, k + b1) != this.id)) {
+ world.setTypeId(i, j, k, 0);
+ }
}
} else {
world.setTypeId(i, j, k, 0);
@@ -166,7 +184,7 @@ public class BlockPortal extends BlockHalfTransparant {
world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
- entity.ad();
+ entity.aa();
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java
index e15ee3b5..d05e6987 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlate.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java
@@ -15,13 +15,14 @@ public class BlockPressurePlate extends Block {
protected BlockPressurePlate(int i, int j, EnumMobType enummobtype, Material material) {
super(i, j, material);
this.a = enummobtype;
- this.a(true);
+ this.a(CreativeModeTab.d);
+ this.b(true);
float f = 0.0625F;
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
}
- public int d() {
+ public int p_() {
return 20;
}
@@ -29,41 +30,39 @@ public class BlockPressurePlate extends Block {
return null;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.FENCE.id;
+ return world.t(i, j - 1, k) || BlockFence.c(world.getTypeId(i, j - 1, k));
}
- public void onPlace(World world, int i, int j, int k) {}
-
public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false;
- if (!world.e(i, j - 1, k) && world.getTypeId(i, j - 1, k) != Block.FENCE.id) {
+ if (!world.t(i, j - 1, k) && !BlockFence.c(world.getTypeId(i, j - 1, k))) {
flag = true;
}
if (flag) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getData(i, j, k) != 0) {
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
}
}
}
@@ -71,30 +70,30 @@ public class BlockPressurePlate extends Block {
public void a(World world, int i, int j, int k, Entity entity) {
if (!world.isStatic) {
if (world.getData(i, j, k) != 1) {
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
}
}
}
- private void g(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
boolean flag = world.getData(i, j, k) == 1;
boolean flag1 = false;
float f = 0.125F;
List list = null;
if (this.a == EnumMobType.EVERYTHING) {
- list = world.getEntities((Entity) null, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
+ list = world.getEntities((Entity) null, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
}
if (this.a == EnumMobType.MOBS) {
- list = world.a(EntityLiving.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
+ list = world.a(EntityLiving.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
}
if (this.a == EnumMobType.PLAYERS) {
- list = world.a(EntityHuman.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
+ list = world.a(EntityHuman.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
}
- if (list.size() > 0) {
+ if (!list.isEmpty()) {
flag1 = true;
}
@@ -116,6 +115,7 @@ public class BlockPressurePlate extends Block {
} else {
continue;
}
+
if (cancellable.isCancelled()) {
return;
}
@@ -134,7 +134,7 @@ public class BlockPressurePlate extends Block {
world.setData(i, j, k, 1);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- world.b(i, j, k, i, j, k);
+ world.d(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
}
@@ -142,24 +142,22 @@ public class BlockPressurePlate extends Block {
world.setData(i, j, k, 0);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- world.b(i, j, k, i, j, k);
+ world.d(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
}
if (flag1) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
}
- public void remove(World world, int i, int j, int k) {
- int l = world.getData(i, j, k);
-
- if (l > 0) {
+ public void remove(World world, int i, int j, int k, int l, int i1) {
+ if (i1 > 0) {
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
}
- super.remove(world, i, j, k);
+ super.remove(world, i, j, k, l, i1);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
@@ -177,7 +175,7 @@ public class BlockPressurePlate extends Block {
return iblockaccess.getData(i, j, k) > 0;
}
- public boolean d(World world, int i, int j, int k, int l) {
+ public boolean c(World world, int i, int j, int k, int l) {
return world.getData(i, j, k) == 0 ? false : l == 1;
}
@@ -193,7 +191,7 @@ public class BlockPressurePlate extends Block {
this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
}
- public int g() {
+ public int e() {
return 1;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java
index a7c33bc9..86ec54eb 100644
--- a/src/main/java/net/minecraft/server/BlockPumpkin.java
+++ b/src/main/java/net/minecraft/server/BlockPumpkin.java
@@ -13,8 +13,9 @@ public class BlockPumpkin extends BlockDirectional {
protected BlockPumpkin(int i, int j, boolean flag) {
super(i, Material.PUMPKIN);
this.textureId = j;
- this.a(true);
+ this.b(true);
this.a = flag;
+ this.a(CreativeModeTab.b);
}
public int a(int i, int j) {
@@ -42,7 +43,7 @@ public class BlockPumpkin extends BlockDirectional {
if (world.suppressPhysics) return; // CraftBukkit
if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
if (!world.isStatic) {
- // CraftBukkit start - Use BlockStateListPopulator
+ // CraftBukkit start - use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
blockList.setTypeId(i, j, k, 0);
@@ -66,12 +67,13 @@ public class BlockPumpkin extends BlockDirectional {
boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id;
if (flag || flag1) {
- // CraftBukkit start - Use BlockStateListPopulator
+ // CraftBukkit start - use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
blockList.setTypeId(i, j, k, 0);
blockList.setTypeId(i, j - 1, k, 0);
blockList.setTypeId(i, j - 2, k, 0);
+
if (flag) {
blockList.setTypeId(i - 1, j - 1, k, 0);
blockList.setTypeId(i + 1, j - 1, k, 0);
@@ -82,7 +84,7 @@ public class BlockPumpkin extends BlockDirectional {
EntityIronGolem entityirongolem = new EntityIronGolem(world);
- entityirongolem.b(true);
+ entityirongolem.f(true);
entityirongolem.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
for (int i1 = 0; i1 < 120; ++i1) {
@@ -99,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.isReplacable()) && world.e(i, j - 1, k);
+ return (l == 0 || Block.byId[l].material.isReplaceable()) && world.t(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/BlockRedstoneLamp.java b/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
index 5aa16d64..6bdd14aa 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
@@ -2,9 +2,7 @@ package net.minecraft.server;
import java.util.Random;
-// CraftBukkit start
-import org.bukkit.craftbukkit.event.CraftEventFactory;
-// CraftBukkit end
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockRedstoneLamp extends Block {
@@ -22,13 +20,14 @@ public class BlockRedstoneLamp extends Block {
public void onPlace(World world, int i, int j, int k) {
if (!world.isStatic) {
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
- world.c(i, j, k, this.id, 4);
+ world.a(i, j, k, this.id, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
return;
}
// CraftBukkit end
+
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
}
}
@@ -37,25 +36,27 @@ public class BlockRedstoneLamp extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
- world.c(i, j, k, this.id, 4);
+ world.a(i, j, k, this.id, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
return;
}
// CraftBukkit end
+
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
}
}
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic && this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
return;
}
// CraftBukkit end
+
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_OFF.id);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneOre.java b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
index 7811b87a..123d8fd2 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneOre.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
@@ -11,18 +11,18 @@ public class BlockRedstoneOre extends Block {
public BlockRedstoneOre(int i, int j, boolean flag) {
super(i, j, Material.STONE);
if (flag) {
- this.a(true);
+ this.b(true);
}
this.a = flag;
}
- public int d() {
+ public int p_() {
return 30;
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
super.attack(world, i, j, k, entityhuman);
}
@@ -31,33 +31,33 @@ public class BlockRedstoneOre extends Block {
if (entity instanceof EntityHuman) {
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
if (!event.isCancelled()) {
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
super.b(world, i, j, k, entity);
}
} else {
EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
super.b(world, i, j, k, entity);
}
}
// CraftBukkit end
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.g(world, i, j, k);
- return super.interact(world, i, j, k, entityhuman);
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
+ this.l(world, i, j, k);
+ return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
- private void g(World world, int i, int j, int k) {
- this.h(world, i, j, k);
+ private void l(World world, int i, int j, int k) {
+ this.n(world, i, j, k);
if (this.id == Block.REDSTONE_ORE.id) {
world.setTypeId(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
}
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (this.id == Block.GLOWING_REDSTONE_ORE.id) {
world.setTypeId(i, j, k, Block.REDSTONE_ORE.id);
}
@@ -75,7 +75,16 @@ public class BlockRedstoneOre extends Block {
return 4 + random.nextInt(2);
}
- private void h(World world, int i, int j, int k) {
+ public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
+ super.dropNaturally(world, i, j, k, l, f, i1);
+ if (this.getDropType(l, world.random, i1) != this.id) {
+ int j1 = 1 + world.random.nextInt(5);
+
+ this.g(world, i, j, k, j1);
+ }
+ }
+
+ private void n(World world, int i, int j, int k) {
Random random = world.random;
double d0 = 0.0625D;
@@ -114,7 +123,7 @@ public class BlockRedstoneOre extends Block {
}
}
- protected ItemStack a_(int i) {
+ protected ItemStack c_(int i) {
return new ItemStack(Block.REDSTONE_ORE);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index 21c7593e..2904401c 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -1,7 +1,10 @@
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;
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
@@ -9,21 +12,26 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockRedstoneTorch extends BlockTorch {
private boolean isOn = false;
- private static List b = new ArrayList();
+ private static Map b = new HashMap();
public int a(int i, int j) {
return i == 1 ? Block.REDSTONE_WIRE.a(i, j) : super.a(i, j);
}
private boolean a(World world, int i, int j, int k, boolean flag) {
+ if (!b.containsKey(world)) {
+ b.put(world, new ArrayList());
+ }
+
if (flag) {
- b.add(new RedstoneUpdateInfo(i, j, k, world.getTime()));
+ ((List) b.get(world)).add(new RedstoneUpdateInfo(i, j, k, world.getTime()));
}
int l = 0;
+ Iterator iterator = ((List) b.get(world)).iterator();
- for (int i1 = 0; i1 < b.size(); ++i1) {
- RedstoneUpdateInfo redstoneupdateinfo = (RedstoneUpdateInfo) b.get(i1);
+ while (iterator.hasNext()) {
+ RedstoneUpdateInfo redstoneupdateinfo = (RedstoneUpdateInfo) iterator.next();
if (redstoneupdateinfo.a == i && redstoneupdateinfo.b == j && redstoneupdateinfo.c == k) {
++l;
@@ -39,10 +47,11 @@ public class BlockRedstoneTorch extends BlockTorch {
protected BlockRedstoneTorch(int i, int j, boolean flag) {
super(i, j);
this.isOn = flag;
- this.a(true);
+ this.b(true);
+ this.a((CreativeModeTab) null);
}
- public int d() {
+ public int p_() {
return 2;
}
@@ -61,7 +70,7 @@ public class BlockRedstoneTorch extends BlockTorch {
}
}
- public void remove(World world, int i, int j, int k) {
+ public void remove(World world, int i, int j, int k, int l, int i1) {
if (this.isOn) {
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j + 1, k, this.id);
@@ -82,17 +91,18 @@ public class BlockRedstoneTorch extends BlockTorch {
}
}
- private boolean g(World world, int i, int j, int k) {
+ private boolean l(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
return l == 5 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l == 3 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l == 4 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l == 1 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : l == 2 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5))));
}
- public void a(World world, int i, int j, int k, Random random) {
- boolean flag = this.g(world, i, j, k);
+ public void b(World world, int i, int j, int k, Random random) {
+ boolean flag = this.l(world, i, j, k);
+ List list = (List) b.get(world);
- while (b.size() > 0 && world.getTime() - ((RedstoneUpdateInfo) b.get(0)).d > 60L) {
- b.remove(0);
+ while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).d > 60L) {
+ list.remove(0);
}
// CraftBukkit start
@@ -145,10 +155,10 @@ public class BlockRedstoneTorch extends BlockTorch {
public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l);
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
- public boolean d(World world, int i, int j, int k, int l) {
+ public boolean c(World world, int i, int j, int k, int l) {
return l == 0 ? this.a(world, i, j, k, l) : false;
}
@@ -159,4 +169,15 @@ public class BlockRedstoneTorch extends BlockTorch {
public boolean isPowerSource() {
return true;
}
+
+ public void a(World world, long i, long j) {
+ List list = (List) b.get(world);
+ RedstoneUpdateInfo redstoneupdateinfo;
+
+ if (list != null) {
+ for (Iterator iterator = list.iterator(); iterator.hasNext(); redstoneupdateinfo.d += i) {
+ redstoneupdateinfo = (RedstoneUpdateInfo) iterator.next();
+ }
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index e36b7a23..0b656b53 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Random;
import java.util.Set;
@@ -25,30 +26,31 @@ public class BlockRedstoneWire extends Block {
return null;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public int c() {
+ public int b() {
return 5;
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
+ return world.t(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
}
- private void g(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
this.a(world, i, j, k, i, j, k);
ArrayList arraylist = new ArrayList(this.b);
this.b.clear();
+ Iterator iterator = arraylist.iterator();
- for (int l = 0; l < arraylist.size(); ++l) {
- ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
+ while (iterator.hasNext()) {
+ ChunkPosition chunkposition = (ChunkPosition) iterator.next();
world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this.id);
}
@@ -92,11 +94,11 @@ public class BlockRedstoneWire extends Block {
l1 = this.getPower(world, j2, j, k2, l1);
}
- if (world.e(j2, j, k2) && !world.e(i, j + 1, k)) {
+ if (world.s(j2, j, k2) && !world.s(i, j + 1, k)) {
if (j2 != l || j + 1 != i1 || k2 != j1) {
l1 = this.getPower(world, j2, j + 1, k2, l1);
}
- } else if (!world.e(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
+ } else if (!world.s(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
l1 = this.getPower(world, j2, j - 1, k2, l1);
}
}
@@ -120,7 +122,7 @@ public class BlockRedstoneWire extends Block {
if (k1 != l1) {
world.suppressPhysics = true;
world.setData(i, j, k, l1);
- world.b(i, j, k, i, j, k);
+ world.d(i, j, k, i, j, k);
world.suppressPhysics = false;
for (i2 = 0; i2 < 4; ++i2) {
@@ -144,7 +146,7 @@ public class BlockRedstoneWire extends Block {
++k2;
}
- if (world.e(j2, j, k2)) {
+ if (world.s(j2, j, k2)) {
l2 += 2;
}
@@ -183,7 +185,7 @@ public class BlockRedstoneWire extends Block {
}
}
- private void h(World world, int i, int j, int k) {
+ private void n(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
@@ -199,41 +201,41 @@ public class BlockRedstoneWire extends Block {
if (world.suppressPhysics) return; // CraftBukkit
super.onPlace(world, i, j, k);
if (!world.isStatic) {
- this.g(world, i, j, k);
+ this.l(world, i, j, k);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- this.h(world, i - 1, j, k);
- this.h(world, i + 1, j, k);
- this.h(world, i, j, k - 1);
- this.h(world, i, j, k + 1);
- if (world.e(i - 1, j, k)) {
- this.h(world, i - 1, j + 1, k);
+ this.n(world, i - 1, j, k);
+ 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)) {
+ this.n(world, i - 1, j + 1, k);
} else {
- this.h(world, i - 1, j - 1, k);
+ this.n(world, i - 1, j - 1, k);
}
- if (world.e(i + 1, j, k)) {
- this.h(world, i + 1, j + 1, k);
+ if (world.s(i + 1, j, k)) {
+ this.n(world, i + 1, j + 1, k);
} else {
- this.h(world, i + 1, j - 1, k);
+ this.n(world, i + 1, j - 1, k);
}
- if (world.e(i, j, k - 1)) {
- this.h(world, i, j + 1, k - 1);
+ if (world.s(i, j, k - 1)) {
+ this.n(world, i, j + 1, k - 1);
} else {
- this.h(world, i, j - 1, k - 1);
+ this.n(world, i, j - 1, k - 1);
}
- if (world.e(i, j, k + 1)) {
- this.h(world, i, j + 1, k + 1);
+ if (world.s(i, j, k + 1)) {
+ this.n(world, i, j + 1, k + 1);
} else {
- this.h(world, i, j - 1, k + 1);
+ this.n(world, i, j - 1, k + 1);
}
}
}
- public void remove(World world, int i, int j, int k) {
- super.remove(world, i, j, k);
+ public void remove(World world, int i, int j, int k, int l, int i1) {
+ super.remove(world, i, j, k, l, i1);
if (!world.isStatic) {
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
@@ -241,33 +243,33 @@ public class BlockRedstoneWire extends Block {
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k - 1, this.id);
- this.g(world, i, j, k);
- this.h(world, i - 1, j, k);
- this.h(world, i + 1, j, k);
- this.h(world, i, j, k - 1);
- this.h(world, i, j, k + 1);
- if (world.e(i - 1, j, k)) {
- this.h(world, i - 1, j + 1, k);
+ this.l(world, i, j, k);
+ this.n(world, i - 1, j, k);
+ 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)) {
+ this.n(world, i - 1, j + 1, k);
} else {
- this.h(world, i - 1, j - 1, k);
+ this.n(world, i - 1, j - 1, k);
}
- if (world.e(i + 1, j, k)) {
- this.h(world, i + 1, j + 1, k);
+ if (world.s(i + 1, j, k)) {
+ this.n(world, i + 1, j + 1, k);
} else {
- this.h(world, i + 1, j - 1, k);
+ this.n(world, i + 1, j - 1, k);
}
- if (world.e(i, j, k - 1)) {
- this.h(world, i, j + 1, k - 1);
+ if (world.s(i, j, k - 1)) {
+ this.n(world, i, j + 1, k - 1);
} else {
- this.h(world, i, j - 1, k - 1);
+ this.n(world, i, j - 1, k - 1);
}
- if (world.e(i, j, k + 1)) {
- this.h(world, i, j + 1, k + 1);
+ if (world.s(i, j, k + 1)) {
+ this.n(world, i, j + 1, k + 1);
} else {
- this.h(world, i, j - 1, k + 1);
+ this.n(world, i, j - 1, k + 1);
}
}
}
@@ -288,11 +290,11 @@ public class BlockRedstoneWire extends Block {
int i1 = world.getData(i, j, k);
boolean flag = this.canPlace(world, i, j, k);
- if (!flag) {
- this.b(world, i, j, k, i1, 0);
- world.setTypeId(i, j, k, 0);
+ if (flag) {
+ this.l(world, i, j, k);
} else {
- this.g(world, i, j, k);
+ this.c(world, i, j, k, i1, 0);
+ world.setTypeId(i, j, k, 0);
}
super.doPhysics(world, i, j, k, l);
@@ -303,7 +305,7 @@ public class BlockRedstoneWire extends Block {
return Item.REDSTONE.id;
}
- public boolean d(World world, int i, int j, int k, int l) {
+ public boolean c(World world, int i, int j, int k, int l) {
return !this.a ? false : this.a(world, i, j, k, l);
}
@@ -315,25 +317,25 @@ public class BlockRedstoneWire extends Block {
} else if (l == 1) {
return true;
} else {
- boolean flag = d(iblockaccess, i - 1, j, k, 1) || !iblockaccess.e(i - 1, j, k) && d(iblockaccess, i - 1, j - 1, k, -1);
- boolean flag1 = d(iblockaccess, i + 1, j, k, 3) || !iblockaccess.e(i + 1, j, k) && d(iblockaccess, i + 1, j - 1, k, -1);
- boolean flag2 = d(iblockaccess, i, j, k - 1, 2) || !iblockaccess.e(i, j, k - 1) && d(iblockaccess, i, j - 1, k - 1, -1);
- boolean flag3 = d(iblockaccess, i, j, k + 1, 0) || !iblockaccess.e(i, j, k + 1) && d(iblockaccess, i, j - 1, k + 1, -1);
+ boolean flag = f(iblockaccess, i - 1, j, k, 1) || !iblockaccess.s(i - 1, j, k) && f(iblockaccess, i - 1, j - 1, k, -1);
+ boolean flag1 = f(iblockaccess, i + 1, j, k, 3) || !iblockaccess.s(i + 1, j, k) && f(iblockaccess, i + 1, j - 1, k, -1);
+ boolean flag2 = f(iblockaccess, i, j, k - 1, 2) || !iblockaccess.s(i, j, k - 1) && f(iblockaccess, i, j - 1, k - 1, -1);
+ boolean flag3 = f(iblockaccess, i, j, k + 1, 0) || !iblockaccess.s(i, j, k + 1) && f(iblockaccess, i, j - 1, k + 1, -1);
- if (!iblockaccess.e(i, j + 1, k)) {
- if (iblockaccess.e(i - 1, j, k) && d(iblockaccess, i - 1, j + 1, k, -1)) {
+ if (!iblockaccess.s(i, j + 1, k)) {
+ if (iblockaccess.s(i - 1, j, k) && f(iblockaccess, i - 1, j + 1, k, -1)) {
flag = true;
}
- if (iblockaccess.e(i + 1, j, k) && d(iblockaccess, i + 1, j + 1, k, -1)) {
+ if (iblockaccess.s(i + 1, j, k) && f(iblockaccess, i + 1, j + 1, k, -1)) {
flag1 = true;
}
- if (iblockaccess.e(i, j, k - 1) && d(iblockaccess, i, j + 1, k - 1, -1)) {
+ if (iblockaccess.s(i, j, k - 1) && f(iblockaccess, i, j + 1, k - 1, -1)) {
flag2 = true;
}
- if (iblockaccess.e(i, j, k + 1) && d(iblockaccess, i, j + 1, k + 1, -1)) {
+ if (iblockaccess.s(i, j, k + 1) && f(iblockaccess, i, j + 1, k + 1, -1)) {
flag3 = true;
}
}
@@ -346,7 +348,7 @@ public class BlockRedstoneWire extends Block {
return this.a;
}
- public static boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public static boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getTypeId(i, j, k);
if (i1 == Block.REDSTONE_WIRE.id) {
@@ -362,8 +364,8 @@ public class BlockRedstoneWire extends Block {
}
}
- public static boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- if (c(iblockaccess, i, j, k, l)) {
+ public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ if (e(iblockaccess, i, j, k, l)) {
return true;
} else {
int i1 = iblockaccess.getTypeId(i, j, k);
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 58f90fab..1b459a19 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -10,10 +10,10 @@ public class BlockReed extends Block {
float f = 0.375F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
- this.a(true);
+ this.b(true);
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (world.isEmpty(i, j + 1, k)) {
int l;
@@ -41,17 +41,17 @@ public class BlockReed extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
- this.g(world, i, j, k);
+ this.k_(world, i, j, k);
}
- protected final void g(World world, int i, int j, int k) {
- if (!this.f(world, i, j, k)) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ protected final void k_(World world, int i, int j, int k) {
+ if (!this.d(world, i, j, k)) {
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
}
- public boolean f(World world, int i, int j, int k) {
+ public boolean d(World world, int i, int j, int k) {
return this.canPlace(world, i, j, k);
}
@@ -63,15 +63,15 @@ public class BlockReed extends Block {
return Item.SUGAR_CANE.id;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public int c() {
+ public int b() {
return 1;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSand.java b/src/main/java/net/minecraft/server/BlockSand.java
index 487eb084..053b75e7 100644
--- a/src/main/java/net/minecraft/server/BlockSand.java
+++ b/src/main/java/net/minecraft/server/BlockSand.java
@@ -8,27 +8,30 @@ public class BlockSand extends Block {
public BlockSand(int i, int j) {
super(i, j, Material.SAND);
+ this.a(CreativeModeTab.b);
}
public void onPlace(World world, int i, int j, int k) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
public void doPhysics(World world, int i, int j, int k, int l) {
- world.c(i, j, k, this.id, this.d());
+ world.a(i, j, k, this.id, this.p_());
}
- public void a(World world, int i, int j, int k, Random random) {
- this.h(world, i, j, k);
+ public void b(World world, int i, int j, int k, Random random) {
+ if (!world.isStatic) {
+ this.l(world, i, j, k);
+ }
}
- private void h(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
if (canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
- if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ if (!instaFall && world.c(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (!world.isStatic) {
- // CraftBukkit - Change call to add data
+ // CraftBukkit - change call to add data
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
world.addEntity(entityfallingblock);
@@ -47,7 +50,7 @@ public class BlockSand extends Block {
}
}
- public int d() {
+ public int p_() {
return 3;
}
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 27853ae7..9495da10 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -11,16 +11,19 @@ import org.bukkit.event.world.StructureGrowEvent;
public class BlockSapling extends BlockFlower {
+ public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
+
protected BlockSapling(int i, int j) {
super(i, j);
float f = 0.4F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
+ this.a(CreativeModeTab.c);
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
- super.a(world, i, j, k, random);
+ super.b(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
int l = world.getData(i, j, k);
@@ -43,12 +46,12 @@ public class BlockSapling extends BlockFlower {
int l = world.getData(i, j, k) & 3;
int i1 = 0;
int j1 = 0;
+ boolean flag = false;
// CraftBukkit start - records tree generation and calls StructureGrowEvent
StructureGrowDelegate delegate = new StructureGrowDelegate(world);
TreeType treeType = null;
TreeGenerator gen = null;
boolean grownTree = false;
- boolean flag = false;
if (l == 1) {
treeType = TreeType.REDWOOD;
@@ -59,7 +62,7 @@ public class BlockSapling extends BlockFlower {
} else if (l == 3) {
for (i1 = 0; i1 >= -1; --i1) {
for (j1 = 0; j1 >= -1; --j1) {
- if (this.f(world, i + i1, j, k + j1, 3) && this.f(world, i + i1 + 1, j, k + j1, 3) && this.f(world, i + i1, j, k + j1 + 1, 3) && this.f(world, i + i1 + 1, j, k + j1 + 1, 3)) {
+ if (this.e(world, i + i1, j, k + j1, 3) && this.e(world, i + i1 + 1, j, k + j1, 3) && this.e(world, i + i1, j, k + j1 + 1, 3) && this.e(world, i + i1 + 1, j, k + j1 + 1, 3)) {
treeType = TreeType.JUNGLE;
gen = new WorldGenMegaTree(false, 10 + random.nextInt(20), 3, 3);
flag = true;
@@ -95,6 +98,7 @@ public class BlockSapling extends BlockFlower {
} else {
world.setRawTypeId(i, j, k, 0);
}
+
grownTree = gen.generate(delegate, random, i + i1, j, k + j1);
if (grownTree) {
Location location = new Location(world.getWorld(), i, j, k);
@@ -124,7 +128,7 @@ public class BlockSapling extends BlockFlower {
// CraftBukkit end
}
- public boolean f(World world, int i, int j, int k, int l) {
+ public boolean e(World world, int i, int j, int k, int l) {
return world.getTypeId(i, j, k) == this.id && (world.getData(i, j, k) & 3) == l;
}
diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java
index 2d57b776..329a3d41 100644
--- a/src/main/java/net/minecraft/server/BlockSign.java
+++ b/src/main/java/net/minecraft/server/BlockSign.java
@@ -52,23 +52,23 @@ public class BlockSign extends BlockContainer {
}
}
- public int c() {
+ public int b() {
return -1;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public TileEntity a_() {
+ public TileEntity a(World world) {
try {
return (TileEntity) this.a.newInstance();
} catch (Exception exception) {
@@ -109,7 +109,7 @@ public class BlockSign extends BlockContainer {
}
if (flag) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
diff --git a/src/main/java/net/minecraft/server/BlockSnow.java b/src/main/java/net/minecraft/server/BlockSnow.java
index 52db4965..ecade8e2 100644
--- a/src/main/java/net/minecraft/server/BlockSnow.java
+++ b/src/main/java/net/minecraft/server/BlockSnow.java
@@ -7,20 +7,21 @@ public class BlockSnow extends Block {
protected BlockSnow(int i, int j) {
super(i, j, Material.SNOW_LAYER);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
- this.a(true);
+ this.b(true);
+ this.a(CreativeModeTab.c);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
int l = world.getData(i, j, k) & 7;
- return l >= 3 ? AxisAlignedBB.b((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + 0.5F), (double) k + this.maxZ) : null;
+ return l >= 3 ? AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + 0.5F), (double) k + this.maxZ) : null;
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
@@ -34,16 +35,16 @@ public class BlockSnow extends Block {
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j - 1, k);
- return l != 0 && (l == Block.LEAVES.id || Block.byId[l].a()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
+ return l != 0 && (l == Block.LEAVES.id || Block.byId[l].d()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
}
public void doPhysics(World world, int i, int j, int k, int l) {
- this.g(world, i, j, k);
+ this.n(world, i, j, k);
}
- private boolean g(World world, int i, int j, int k) {
+ private boolean n(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setRawTypeId(i, j, k, 0); // CraftBukkit
world.notify(i, j, k); // CraftBukkit - Notify clients of the reversion
return false;
@@ -74,15 +75,15 @@ public class BlockSnow extends Block {
return 0;
}
- public void a(World world, int i, int j, int k, Random random) {
- if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11) {
+ public void b(World world, int i, int j, int k, Random random) {
+ if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), 0).isCancelled()) {
return;
}
// CraftBukkit end
- this.b(world, i, j, k, world.getData(i, j, k), 0);
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
index 1c2c201e..6804187a 100644
--- a/src/main/java/net/minecraft/server/BlockSoil.java
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
@@ -9,20 +9,20 @@ public class BlockSoil extends Block {
protected BlockSoil(int i) {
super(i, Material.EARTH);
this.textureId = 87;
- this.a(true);
+ this.b(true);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
- this.f(255);
+ this.h(255);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
- return AxisAlignedBB.b((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
+ return AxisAlignedBB.a().a((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
@@ -30,13 +30,13 @@ public class BlockSoil extends Block {
return i == 1 && j > 0 ? this.textureId - 1 : (i == 1 ? this.textureId : 2);
}
- public void a(World world, int i, int j, int k, Random random) {
- if (!this.h(world, i, j, k) && !world.y(i, j + 1, k)) {
+ 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)) {
int l = world.getData(i, j, k);
if (l > 0) {
world.setData(i, j, k, l - 1);
- } else if (!this.g(world, i, j, k)) {
+ } else if (!this.l(world, i, j, k)) {
world.setTypeId(i, j, k, Block.DIRT.id);
}
} else {
@@ -45,8 +45,8 @@ public class BlockSoil extends Block {
}
public void a(World world, int i, int j, int k, Entity entity, float f) {
- if (world.random.nextFloat() < f - 0.5F) {
- // CraftBukkit start - Interact Soil
+ if (!world.isStatic && world.random.nextFloat() < f - 0.5F) {
+ // CraftBukkit start - interact soil
org.bukkit.event.Cancellable cancellable;
if (entity instanceof EntityHuman) {
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
@@ -64,7 +64,7 @@ public class BlockSoil extends Block {
}
}
- private boolean g(World world, int i, int j, int k) {
+ private boolean l(World world, int i, int j, int k) {
byte b0 = 0;
for (int l = i - b0; l <= i + b0; ++l) {
@@ -80,7 +80,7 @@ public class BlockSoil extends Block {
return false;
}
- private boolean h(World world, int i, int j, int k) {
+ private boolean n(World world, int i, int j, int k) {
for (int l = i - 4; l <= i + 4; ++l) {
for (int i1 = j; i1 <= j + 1; ++i1) {
for (int j1 = k - 4; j1 <= k + 4; ++j1) {
diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java
index a3a266d7..d9ef03fe 100644
--- a/src/main/java/net/minecraft/server/BlockStationary.java
+++ b/src/main/java/net/minecraft/server/BlockStationary.java
@@ -11,41 +11,41 @@ public class BlockStationary extends BlockFluids {
protected BlockStationary(int i, Material material) {
super(i, material);
- this.a(false);
+ this.b(false);
if (material == Material.LAVA) {
- this.a(true);
+ this.b(true);
}
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l);
if (world.getTypeId(i, j, k) == this.id) {
- this.i(world, i, j, k);
+ this.l(world, i, j, k);
}
}
- private void i(World world, int i, int j, int k) {
+ private void l(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
world.suppressPhysics = true;
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
- world.b(i, j, k, i, j, k);
- world.c(i, j, k, this.id - 1, this.d());
+ world.d(i, j, k, i, j, k);
+ world.a(i, j, k, this.id - 1, this.p_());
world.suppressPhysics = false;
}
- public void a(World world, int i, int j, int k, Random random) {
+ public void b(World world, int i, int j, int k, Random random) {
if (this.material == Material.LAVA) {
int l = random.nextInt(3);
int i1;
int j1;
- // CraftBukkit start - prevent lava putting something on fire.
+ // CraftBukkit start - prevent lava putting something on fire
org.bukkit.World bworld = world.getWorld();
BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
// CraftBukkit end
@@ -56,8 +56,8 @@ public class BlockStationary extends BlockFluids {
k += random.nextInt(3) - 1;
j1 = world.getTypeId(i, j, k);
if (j1 == 0) {
- if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
- // CraftBukkit start - prevent lava putting something on fire.
+ if (this.n(world, i - 1, j, k) || this.n(world, i + 1, j, k) || this.n(world, i, j, k - 1) || this.n(world, i, j, k + 1) || this.n(world, i, j - 1, k) || this.n(world, i, j + 1, k)) {
+ // CraftBukkit start - prevent lava putting something on fire
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
if (block.getTypeId() != Block.FIRE.id) {
if (CraftEventFactory.callEvent(new BlockIgniteEvent(block, igniteCause, null)).isCancelled()) {
@@ -81,8 +81,8 @@ public class BlockStationary extends BlockFluids {
for (int k1 = 0; k1 < 3; ++k1) {
i = i1 + random.nextInt(3) - 1;
k = j1 + random.nextInt(3) - 1;
- if (world.isEmpty(i, j + 1, k) && this.j(world, i, j, k)) {
- // CraftBukkit start - prevent lava putting something on fire.
+ if (world.isEmpty(i, j + 1, k) && this.n(world, i, j, k)) {
+ // CraftBukkit start - prevent lava putting something on fire
org.bukkit.block.Block block = bworld.getBlockAt(i, j + 1, k);
if (block.getTypeId() != Block.FIRE.id) {
if (CraftEventFactory.callEvent(new BlockIgniteEvent(block, igniteCause, null)).isCancelled()) {
@@ -98,7 +98,7 @@ public class BlockStationary extends BlockFluids {
}
}
- private boolean j(World world, int i, int j, int k) {
+ private boolean n(World world, int i, int j, int k) {
return world.getMaterial(i, j, k).isBurnable();
}
}
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
index 513aab62..d8a2c1d0 100644
--- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -11,20 +11,21 @@ public class BlockStem extends BlockFlower {
protected BlockStem(int i, Block block) {
super(i, 111);
this.blockFruit = block;
- this.a(true);
+ this.b(true);
float f = 0.125F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
+ this.a((CreativeModeTab) null);
}
- protected boolean d(int i) {
+ protected boolean d_(int i) {
return i == Block.SOIL.id;
}
- public void a(World world, int i, int j, int k, Random random) {
- super.a(world, i, j, k, random);
+ public void b(World world, int i, int j, int k, Random random) {
+ super.b(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9) {
- float f = this.i(world, i, j, k);
+ float f = this.n(world, i, j, k);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
int l = world.getData(i, j, k);
@@ -79,11 +80,11 @@ public class BlockStem extends BlockFlower {
}
}
- public void g(World world, int i, int j, int k) {
+ public void l(World world, int i, int j, int k) {
world.setData(i, j, k, 7);
}
- private float i(World world, int i, int j, int k) {
+ private float n(World world, int i, int j, int k) {
float f = 1.0F;
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
@@ -141,7 +142,7 @@ public class BlockStem extends BlockFlower {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, (float) this.maxY, 0.5F + f);
}
- public int c() {
+ public int b() {
return 19;
}
@@ -174,10 +175,6 @@ public class BlockStem extends BlockFlower {
}
public int getDropType(int i, Random random, int j) {
- if (i == 7) {
- ;
- }
-
return -1;
}
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
index 212b3a17..df7bb644 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -6,6 +6,7 @@ public class BlockTNT extends Block {
public BlockTNT(int i, int j) {
super(i, j, Material.TNT);
+ this.a(CreativeModeTab.d);
}
public int a(int i) {
@@ -28,7 +29,7 @@ public class BlockTNT extends Block {
}
public int a(Random random) {
- return 0;
+ return 1;
}
public void wasExploded(World world, int i, int j, int k) {
@@ -42,9 +43,7 @@ public class BlockTNT extends Block {
public void postBreak(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
- if ((l & 1) == 0) {
- this.a(world, i, j, k, new ItemStack(Block.TNT.id, 1, 0));
- } else {
+ if ((l & 1) == 1) {
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
world.addEntity(entitytntprimed);
@@ -53,21 +52,17 @@ public class BlockTNT extends Block {
}
}
- public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- super.attack(world, i, j, k, entityhuman);
- }
-
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
- if (entityhuman.U() != null && entityhuman.U().id == Item.FLINT_AND_STEEL.id) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
+ if (entityhuman.bC() != null && entityhuman.bC().id == Item.FLINT_AND_STEEL.id) {
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
return true;
} else {
- return super.interact(world, i, j, k, entityhuman);
+ return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
}
- protected ItemStack a_(int i) {
+ protected ItemStack c_(int i) {
return null;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTrapdoor.java b/src/main/java/net/minecraft/server/BlockTrapdoor.java
index 3a276315..cd735dc7 100644
--- a/src/main/java/net/minecraft/server/BlockTrapdoor.java
+++ b/src/main/java/net/minecraft/server/BlockTrapdoor.java
@@ -15,21 +15,22 @@ public class BlockTrapdoor extends Block {
float f1 = 1.0F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
+ this.a(CreativeModeTab.d);
}
- public boolean a() {
+ public boolean d() {
return false;
}
- public boolean b() {
+ public boolean c() {
return false;
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
- return !e(iblockaccess.getData(i, j, k));
+ public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
+ return !g(iblockaccess.getData(i, j, k));
}
- public int c() {
+ public int b() {
return 0;
}
@@ -39,7 +40,7 @@ public class BlockTrapdoor extends Block {
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.d(iblockaccess.getData(i, j, k));
+ this.e(iblockaccess.getData(i, j, k));
}
public void f() {
@@ -48,11 +49,11 @@ public class BlockTrapdoor extends Block {
this.a(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F);
}
- public void d(int i) {
+ public void e(int i) {
float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
- if (e(i)) {
+ if (g(i)) {
if ((i & 3) == 0) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
@@ -72,16 +73,16 @@ public class BlockTrapdoor extends Block {
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.interact(world, i, j, k, entityhuman);
+ this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
}
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (this.material == Material.ORE) {
return true;
} else {
- int l = world.getData(i, j, k);
+ int i1 = world.getData(i, j, k);
- world.setData(i, j, k, l ^ 4);
+ world.setData(i, j, k, i1 ^ 4);
world.a(entityhuman, 1003, i, j, k, 0);
return true;
}
@@ -119,9 +120,9 @@ public class BlockTrapdoor extends Block {
--j1;
}
- if (!h(world.getTypeId(j1, j, k1))) {
+ if (!j(world.getTypeId(j1, j, k1))) {
world.setTypeId(i, j, k, 0);
- this.b(world, i, j, k, i1, 0);
+ this.c(world, i, j, k, i1, 0);
}
// CraftBukkit start
@@ -148,7 +149,7 @@ 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) {
+ public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
byte b0 = 0;
if (l == 2) {
@@ -193,21 +194,21 @@ public class BlockTrapdoor extends Block {
--i;
}
- return h(world.getTypeId(i, j, k));
+ return j(world.getTypeId(i, j, k));
}
}
- public static boolean e(int i) {
+ public static boolean g(int i) {
return (i & 4) != 0;
}
- private static boolean h(int i) {
+ private static boolean j(int i) {
if (i <= 0) {
return false;
} else {
Block block = Block.byId[i];
- return block != null && block.material.j() && block.b() || block == Block.GLOWSTONE;
+ return block != null && block.material.k() && block.c() || block == Block.GLOWSTONE;
}
}
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 223ed087..31cdcd55 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-// import java.util.ArrayList; // CraftBukkit
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
@@ -11,7 +11,6 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.Bukkit;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.util.UnsafeList;
// CraftBukkit end
public class Chunk {
@@ -58,7 +57,7 @@ public class Chunk {
this.heightMap = new int[256];
for (int k = 0; k < this.entitySlices.length; ++k) {
- this.entitySlices[k] = new UnsafeList(); // CraftBukkit - use UnsafeList
+ this.entitySlices[k] = new ArrayList();
}
Arrays.fill(this.b, -999);
@@ -104,22 +103,22 @@ public class Chunk {
return this.heightMap[j << 4 | i];
}
- public int g() {
+ public int h() {
for (int i = this.sections.length - 1; i >= 0; --i) {
if (this.sections[i] != null) {
- return this.sections[i].c();
+ return this.sections[i].d();
}
}
return 0;
}
- public ChunkSection[] h() {
+ public ChunkSection[] i() {
return this.sections;
}
public void initLighting() {
- int i = this.g();
+ int i = this.h();
int j;
int k;
@@ -152,7 +151,7 @@ public class Chunk {
if (chunksection != null) {
chunksection.c(j, i1 & 15, k, l);
- this.world.o((this.x << 4) + j, i1, (this.z << 4) + k);
+ this.world.n((this.x << 4) + j, i1, (this.z << 4) + k);
}
}
@@ -175,15 +174,13 @@ public class Chunk {
}
}
- public void loadNOP() {}
-
private void e(int i, int j) {
this.c[i + j * 16] = true;
this.s = true;
}
- private void o() {
- MethodProfiler.a("recheckGaps");
+ private void q() {
+ this.world.methodProfiler.a("recheckGaps");
if (this.world.areChunksLoaded(this.x * 16 + 8, 0, this.z * 16 + 8, 16)) {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
@@ -221,7 +218,7 @@ public class Chunk {
this.s = false;
}
- MethodProfiler.a();
+ this.world.methodProfiler.b();
}
private void g(int i, int j, int k) {
@@ -237,7 +234,7 @@ public class Chunk {
private void d(int i, int j, int k, int l) {
if (l > k && this.world.areChunksLoaded(i, 0, j, 16)) {
for (int i1 = k; i1 < l; ++i1) {
- this.world.b(EnumSkyBlock.SKY, i, i1, j);
+ this.world.c(EnumSkyBlock.SKY, i, i1, j);
}
this.l = true;
@@ -272,7 +269,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 15);
- this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.n((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
} else {
@@ -280,7 +277,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 0);
- this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.n((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
}
@@ -365,8 +362,9 @@ public class Chunk {
int k1 = this.heightMap[j1];
int l1 = this.getTypeId(i, j, k);
+ int i2 = this.getData(i, j, k);
- if (l1 == l && this.getData(i, j, k) == i1) {
+ if (l1 == l && i2 == i1) {
return false;
} else {
ChunkSection chunksection = this.sections[j >> 4];
@@ -381,15 +379,19 @@ public class Chunk {
flag = j >= k1;
}
- chunksection.a(i, j & 15, k, l);
- int i2 = this.x * 16 + i;
- int j2 = this.z * 16 + k;
+ int j2 = this.x * 16 + i;
+ int k2 = this.z * 16 + k;
+
+ if (l1 != 0 && !this.world.isStatic) {
+ Block.byId[l1].h(this.world, j2, j, k2, i2);
+ }
+ chunksection.a(i, j & 15, k, l);
if (l1 != 0) {
if (!this.world.isStatic) {
- Block.byId[l1].remove(this.world, i2, j, j2);
+ Block.byId[l1].remove(this.world, j2, j, k2, l1, i2);
} else if (Block.byId[l1] instanceof BlockContainer && l1 != l) {
- this.world.q(i2, j, j2);
+ this.world.q(j2, j, k2);
}
}
@@ -415,14 +417,14 @@ public class Chunk {
if (l != 0) {
if (!this.world.isStatic) {
- Block.byId[l].onPlace(this.world, i2, j, j2);
+ Block.byId[l].onPlace(this.world, j2, j, k2);
}
if (Block.byId[l] instanceof BlockContainer) {
tileentity = this.e(i, j, k);
if (tileentity == null) {
- tileentity = ((BlockContainer) Block.byId[l]).a_();
- this.world.setTileEntity(i2, j, j2, tileentity);
+ tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
+ this.world.setTileEntity(j2, j, k2, tileentity);
}
if (tileentity != null) {
@@ -474,7 +476,7 @@ public class Chunk {
public int getBrightness(EnumSkyBlock enumskyblock, int i, int j, int k) {
ChunkSection chunksection = this.sections[j >> 4];
- return chunksection == null ? enumskyblock.c : (enumskyblock == EnumSkyBlock.SKY ? chunksection.c(i, j & 15, k) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.d(i, j & 15, k) : enumskyblock.c));
+ return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? chunksection.c(i, j & 15, k) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.d(i, j & 15, k) : enumskyblock.c));
}
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
@@ -490,11 +492,7 @@ public class Chunk {
if (!this.world.worldProvider.e) {
chunksection.c(i, j & 15, k, l);
}
- } else {
- if (enumskyblock != EnumSkyBlock.BLOCK) {
- return;
- }
-
+ } else if (enumskyblock == EnumSkyBlock.BLOCK) {
chunksection.d(i, j & 15, k, l);
}
}
@@ -545,15 +543,15 @@ public class Chunk {
k = this.entitySlices.length - 1;
}
- entity.bZ = true;
- entity.ca = this.x;
- entity.cb = k;
- entity.cc = this.z;
+ entity.ag = true;
+ entity.ah = this.x;
+ entity.ai = k;
+ entity.aj = this.z;
this.entitySlices[k].add(entity);
}
public void b(Entity entity) {
- this.a(entity, entity.cb);
+ this.a(entity, entity.ai);
}
public void a(Entity entity, int i) {
@@ -579,19 +577,19 @@ public class Chunk {
if (tileentity == null) {
int l = this.getTypeId(i, j, k);
- if (l <= 0 || !Block.byId[l].o()) {
+ if (l <= 0 || !Block.byId[l].s()) {
return null;
}
if (tileentity == null) {
- tileentity = ((BlockContainer) Block.byId[l]).a_();
+ tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity);
}
tileentity = (TileEntity) this.tileEntities.get(chunkposition);
}
- if (tileentity != null && tileentity.l()) {
+ if (tileentity != null && tileentity.p()) {
this.tileEntities.remove(chunkposition);
return null;
} else {
@@ -613,12 +611,12 @@ public class Chunk {
public void a(int i, int j, int k, TileEntity tileentity) {
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
- tileentity.world = this.world;
+ tileentity.a(this.world);
tileentity.x = this.x * 16 + i;
tileentity.y = j;
tileentity.z = this.z * 16 + k;
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
- tileentity.m();
+ tileentity.q();
this.tileEntities.put(chunkposition, tileentity);
// CraftBukkit start
} else {
@@ -645,9 +643,13 @@ 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 i = 0; i < this.entitySlices.length; ++i) {
- this.world.a(this.entitySlices[i]);
+ for (int j = 0; j < i; ++j) {
+ List list = alist[j];
+
+ this.world.a(list);
}
}
@@ -661,9 +663,12 @@ public class Chunk {
this.world.a(tileentity);
}
- for (int i = 0; i < this.entitySlices.length; ++i) {
+ List[] alist = this.entitySlices;
+ int i = alist.length;
+
+ for (int j = 0; j < i; ++j) {
// CraftBukkit start
- java.util.Iterator<Object> iter = this.entitySlices[i].iterator();
+ java.util.Iterator<Object> iter = this.entitySlices[j].iterator();
while (iter.hasNext()) {
Entity entity = (Entity) iter.next();
int cx = Location.locToBlock(entity.locX) >> 4;
@@ -677,7 +682,9 @@ public class Chunk {
}
// CraftBukkit end
- this.world.b(this.entitySlices[i]);
+ List list = alist[j];
+
+ this.world.b(list);
}
}
@@ -698,18 +705,19 @@ public class Chunk {
}
for (int k = i; k <= j; ++k) {
- UnsafeList list1 = (UnsafeList) this.entitySlices[k]; // CraftBukkit - use UnsafeList
+ List list1 = this.entitySlices[k];
+ Iterator iterator = list1.iterator();
- for (int l = 0; l < list1.size(); ++l) {
- Entity entity1 = (Entity) list1.unsafeGet(l); // CraftBukkit - use unsafeGet
+ while (iterator.hasNext()) {
+ Entity entity1 = (Entity) iterator.next();
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
list.add(entity1);
- Entity[] aentity = entity1.bb();
+ Entity[] aentity = entity1.al();
if (aentity != null) {
- for (int i1 = 0; i1 < aentity.length; ++i1) {
- entity1 = aentity[i1];
+ for (int l = 0; l < aentity.length; ++l) {
+ entity1 = aentity[l];
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
list.add(entity1);
}
@@ -737,10 +745,11 @@ public class Chunk {
}
for (int k = i; k <= j; ++k) {
- UnsafeList list1 = (UnsafeList) this.entitySlices[k]; // CraftBukkit - use UnsafeList
+ List list1 = this.entitySlices[k];
+ Iterator iterator = list1.iterator();
- for (int l = 0; l < list1.size(); ++l) {
- Entity entity = (Entity) list1.unsafeGet(l); // CraftBukkit - use unsafeGet
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.a(axisalignedbb)) {
list.add(entity);
@@ -769,19 +778,6 @@ public class Chunk {
return false;
}
- public void i() {
- ChunkSection[] achunksection = this.sections;
- int i = achunksection.length;
-
- for (int j = 0; j < i; ++j) {
- ChunkSection chunksection = achunksection[j];
-
- if (chunksection != null) {
- chunksection.e();
- }
- }
- }
-
public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) {
ichunkprovider.getChunkAt(ichunkprovider1, i, j);
@@ -805,7 +801,7 @@ public class Chunk {
int l = this.b[k];
if (l == -999) {
- int i1 = this.g() + 15;
+ int i1 = this.h() + 15;
l = -1;
@@ -826,13 +822,13 @@ public class Chunk {
return l;
}
- public void j() {
+ public void k() {
if (this.s && !this.world.worldProvider.e) {
- this.o();
+ this.q();
}
}
- public ChunkCoordIntPair k() {
+ public ChunkCoordIntPair l() {
return new ChunkCoordIntPair(this.x, this.z);
}
@@ -873,7 +869,7 @@ public class Chunk {
return BiomeBase.biomes[k] == null ? BiomeBase.PLAINS : BiomeBase.biomes[k];
}
- public byte[] l() {
+ public byte[] m() {
return this.r;
}
@@ -881,11 +877,11 @@ public class Chunk {
this.r = abyte;
}
- public void m() {
+ public void n() {
this.t = 0;
}
- public void n() {
+ public void o() {
for (int i = 0; i < 8; ++i) {
if (this.t >= 4096) {
return;
@@ -904,30 +900,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.v(i1, l1 - 1, j1);
+ this.world.x(i1, l1 - 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) {
- this.world.v(i1, l1 + 1, j1);
+ this.world.x(i1, l1 + 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) {
- this.world.v(i1 - 1, l1, j1);
+ this.world.x(i1 - 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) {
- this.world.v(i1 + 1, l1, j1);
+ this.world.x(i1 + 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) {
- this.world.v(i1, l1, j1 - 1);
+ this.world.x(i1, l1, j1 - 1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) {
- this.world.v(i1, l1, j1 + 1);
+ this.world.x(i1, l1, j1 + 1);
}
- this.world.v(i1, l1, j1);
+ this.world.x(i1, l1, j1);
}
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index f3a38c94..0a3d9d85 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -23,7 +23,7 @@ public class ChunkProviderServer implements IChunkProvider {
public Chunk emptyChunk;
public IChunkProvider chunkProvider; // CraftBukkit
private IChunkLoader e;
- public boolean forceChunkLoad = false;
+ public boolean forceChunkLoad = true;
public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
public List chunkList = new ArrayList();
public WorldServer world;
@@ -41,7 +41,7 @@ public class ChunkProviderServer implements IChunkProvider {
}
public void queueUnload(int i, int j) {
- if (this.world.worldProvider.c()) {
+ if (this.world.worldProvider.e()) {
ChunkCoordinates chunkcoordinates = this.world.getSpawn();
int k = i * 16 + 8 - chunkcoordinates.x;
int l = j * 16 + 8 - chunkcoordinates.z;
@@ -55,7 +55,7 @@ public class ChunkProviderServer implements IChunkProvider {
}
}
- public void c() {
+ public void a() {
Iterator iterator = this.chunkList.iterator();
while (iterator.hasNext()) {
@@ -86,7 +86,6 @@ public class ChunkProviderServer implements IChunkProvider {
this.chunks.put(i, j, chunk); // CraftBukkit
this.chunkList.add(chunk);
if (chunk != null) {
- chunk.loadNOP();
chunk.addEntities();
}
@@ -161,7 +160,12 @@ public class ChunkProviderServer implements IChunkProvider {
this.e.a(this.world, chunk);
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
ioexception.printStackTrace();
+ // CraftBukkit start - remove extra exception
}
+ // } catch (ExceptionWorldConflict exceptionworldconflict) {
+ // exceptionworldconflict.printStackTrace();
+ // }
+ // CraftBukkit end
}
}
@@ -198,9 +202,10 @@ public class ChunkProviderServer implements IChunkProvider {
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
int i = 0;
+ Iterator iterator = this.chunkList.iterator();
- for (int j = 0; j < this.chunkList.size(); ++j) {
- Chunk chunk = (Chunk) this.chunkList.get(j);
+ while (iterator.hasNext()) {
+ Chunk chunk = (Chunk) iterator.next();
if (flag) {
this.saveChunkNOP(chunk);
@@ -261,7 +266,7 @@ public class ChunkProviderServer implements IChunkProvider {
return !this.world.savingDisabled;
}
- public String d() {
+ public String getName() {
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit
}
@@ -272,4 +277,8 @@ public class ChunkProviderServer implements IChunkProvider {
public ChunkPosition findNearestMapFeature(World world, String s, int i, int j, int k) {
return this.chunkProvider.findNearestMapFeature(world, s, i, j, k);
}
+
+ public int getLoadedChunks() {
+ return this.chunks.values().size(); // CraftBukkit
+ }
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index e4ba36a5..20950e0e 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -11,7 +11,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
-public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
+public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
private List a = new ArrayList();
private Set b = new HashSet();
@@ -29,9 +29,13 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
synchronized (this.c) {
if (this.b.contains(chunkcoordintpair)) {
- 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;
+ Iterator iterator = this.a.iterator();
+
+ while (iterator.hasNext()) {
+ PendingChunkToSave pendingchunktosave = (PendingChunkToSave) iterator.next();
+
+ if (pendingchunktosave.a.equals(chunkcoordintpair)) {
+ nbttagcompound = pendingchunktosave.b;
break;
}
}
@@ -39,7 +43,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
if (nbttagcompound == null) {
- DataInputStream datainputstream = RegionFileCache.b(this.d, i, j);
+ DataInputStream datainputstream = RegionFileCache.c(this.d, i, j);
if (datainputstream == null) {
return null;
@@ -68,13 +72,18 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
chunk = this.a(world, nbttagcompound.getCompound("Level"));
}
- chunk.i();
return chunk;
}
}
public void a(World world, Chunk chunk) {
- world.m();
+ // CraftBukkit start - "handle" exception
+ try {
+ world.B();
+ } catch (ExceptionWorldConflict ex) {
+ ex.printStackTrace();
+ }
+ // CraftBukkit end
try {
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -82,7 +91,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
nbttagcompound.set("Level", nbttagcompound1);
this.a(chunk, world, nbttagcompound1);
- this.a(chunk.k(), nbttagcompound);
+ this.a(chunk.l(), nbttagcompound);
} catch (Exception exception) {
exception.printStackTrace();
}
@@ -112,7 +121,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
Object object = this.c;
synchronized (this.c) {
- if (this.a.size() <= 0) {
+ if (this.a.isEmpty()) {
return false;
}
@@ -131,8 +140,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
return true;
}
- public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - Added throws
- DataOutputStream dataoutputstream = RegionFileCache.c(this.d, pendingchunktosave.a.x, pendingchunktosave.a.z);
+ public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - public -> private, added throws
+ DataOutputStream dataoutputstream = RegionFileCache.d(this.d, pendingchunktosave.a.x, pendingchunktosave.a.z);
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);
dataoutputstream.close();
@@ -145,13 +154,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
public void b() {}
private void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) {
- world.m();
nbttagcompound.setInt("xPos", chunk.x);
nbttagcompound.setInt("zPos", chunk.z);
nbttagcompound.setLong("LastUpdate", world.getTime());
nbttagcompound.setIntArray("HeightMap", chunk.heightMap);
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
- ChunkSection[] achunksection = chunk.h();
+ ChunkSection[] achunksection = chunk.i();
NBTTagList nbttaglist = new NBTTagList("Sections");
ChunkSection[] achunksection1 = achunksection;
int i = achunksection.length;
@@ -161,23 +169,23 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
for (int j = 0; j < i; ++j) {
ChunkSection chunksection = achunksection1[j];
- if (chunksection != null && chunksection.f() != 0) {
+ if (chunksection != null) {
nbttagcompound1 = new NBTTagCompound();
- nbttagcompound1.setByte("Y", (byte) (chunksection.c() >> 4 & 255));
+ nbttagcompound1.setByte("Y", (byte) (chunksection.d() >> 4 & 255));
nbttagcompound1.setByteArray("Blocks", chunksection.g());
- if (chunksection.h() != null) {
- nbttagcompound1.setByteArray("Add", chunksection.h().a);
+ if (chunksection.i() != null) {
+ nbttagcompound1.setByteArray("Add", chunksection.i().a);
}
- nbttagcompound1.setByteArray("Data", chunksection.i().a);
- nbttagcompound1.setByteArray("SkyLight", chunksection.k().a);
- nbttagcompound1.setByteArray("BlockLight", chunksection.j().a);
+ nbttagcompound1.setByteArray("Data", chunksection.j().a);
+ nbttagcompound1.setByteArray("SkyLight", chunksection.l().a);
+ nbttagcompound1.setByteArray("BlockLight", chunksection.k().a);
nbttaglist.add(nbttagcompound1);
}
}
nbttagcompound.set("Sections", nbttaglist);
- nbttagcompound.setByteArray("Biomes", chunk.l());
+ nbttagcompound.setByteArray("Biomes", chunk.m());
chunk.m = false;
NBTTagList nbttaglist1 = new NBTTagList();
@@ -258,7 +266,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
chunksection.b(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4));
chunksection.d(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4));
chunksection.c(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4));
- chunksection.d();
+ chunksection.e();
achunksection[b1] = chunksection;
}
@@ -301,7 +309,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
for (int j1 = 0; j1 < nbttaglist3.size(); ++j1) {
NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist3.get(j1);
- world.d(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z"), nbttagcompound4.getInt("i"), nbttagcompound4.getInt("t"));
+ world.b(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z"), nbttagcompound4.getInt("i"), nbttagcompound4.getInt("t"));
}
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 94c967ec..4d38de8a 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -29,7 +29,7 @@ public class ChunkSection {
this.f = new NibbleArray(this.d.length, 4);
this.h = new NibbleArray(this.d.length, 4);
this.g = new NibbleArray(this.d.length, 4);
- this.d();
+ this.e();
}
// CraftBukkit end
@@ -48,17 +48,17 @@ public class ChunkSection {
if (i1 == 0 && l != 0) {
++this.b;
- if (Block.byId[l] != null && Block.byId[l].n()) {
+ if (Block.byId[l] != null && Block.byId[l].r()) {
++this.c;
}
} else if (i1 != 0 && l == 0) {
--this.b;
- if (Block.byId[i1] != null && Block.byId[i1].n()) {
+ if (Block.byId[i1] != null && Block.byId[i1].r()) {
--this.c;
}
- } else if (Block.byId[i1] != null && Block.byId[i1].n() && (Block.byId[l] == null || !Block.byId[l].n())) {
+ } else if (Block.byId[i1] != null && Block.byId[i1].r() && (Block.byId[l] == null || !Block.byId[l].r())) {
--this.c;
- } else if ((Block.byId[i1] == null || !Block.byId[i1].n()) && Block.byId[l] != null && Block.byId[l].n()) {
+ } else if ((Block.byId[i1] == null || !Block.byId[i1].r()) && Block.byId[l] != null && Block.byId[l].r()) {
++this.c;
}
@@ -90,7 +90,7 @@ public class ChunkSection {
return this.c > 0;
}
- public int c() {
+ public int d() {
return this.a;
}
@@ -110,7 +110,7 @@ public class ChunkSection {
return this.g.a(i, j, k);
}
- public void d() {
+ public void e() {
this.b = 0;
this.c = 0;
@@ -127,7 +127,7 @@ public class ChunkSection {
}
} else {
++this.b;
- if (Block.byId[l].n()) {
+ if (Block.byId[l].r()) {
++this.c;
}
}
@@ -137,29 +137,23 @@ public class ChunkSection {
}
}
- public void e() {}
-
- public int f() {
- return this.b;
- }
-
public byte[] g() {
return this.d;
}
- public NibbleArray h() {
+ public NibbleArray i() {
return this.e;
}
- public NibbleArray i() {
+ public NibbleArray j() {
return this.f;
}
- public NibbleArray j() {
+ public NibbleArray k() {
return this.g;
}
- public NibbleArray k() {
+ public NibbleArray l() {
return this.h;
}
diff --git a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
index d1bd5eff..943bb952 100644
--- a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
+++ b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
@@ -40,7 +40,7 @@ final class ConsoleLogFormatter extends Formatter {
} else if (level == Level.SEVERE) {
stringbuilder.append(" [SEVERE] ");
} else if (level == Level.SEVERE) {
- stringbuilder.append(" [" + level.getLocalizedName() + "] ");
+ stringbuilder.append(" [").append(level.getLocalizedName()).append("] ");
}
stringbuilder.append(logrecord.getMessage());
diff --git a/src/main/java/net/minecraft/server/ConsoleLogManager.java b/src/main/java/net/minecraft/server/ConsoleLogManager.java
index f9f3f222..7afc1a4b 100644
--- a/src/main/java/net/minecraft/server/ConsoleLogManager.java
+++ b/src/main/java/net/minecraft/server/ConsoleLogManager.java
@@ -12,8 +12,6 @@ public class ConsoleLogManager {
public static Logger a = Logger.getLogger("Minecraft");
public static Logger global = Logger.getLogger(""); // CraftBukkit
- public ConsoleLogManager() {}
-
// CraftBukkit - change of method signature!
public static void init(MinecraftServer server) {
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(server.options.has("log-strip-color")); // CraftBukkit - pass strip color option
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
index 6ffd42ed..dd894fe8 100644
--- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -12,12 +13,12 @@ import org.bukkit.inventory.InventoryView;
public abstract class Container {
- public List d = new ArrayList();
- public List e = new ArrayList();
+ public List a = new ArrayList();
+ public List b = new ArrayList();
public int windowId = 0;
- private short a = 0;
+ private short e = 0;
protected List listeners = new ArrayList();
- private Set b = new HashSet();
+ private Set f = new HashSet();
// CraftBukkit start
public boolean checkReachable = true;
@@ -33,10 +34,11 @@ public abstract class Container {
public Container() {}
- protected void a(Slot slot) {
- slot.c = this.e.size();
- this.e.add(slot);
- this.d.add(null);
+ protected Slot a(Slot slot) {
+ slot.d = this.b.size();
+ this.b.add(slot);
+ this.a.add(null);
+ return slot;
}
public void addSlotListener(ICrafting icrafting) {
@@ -44,32 +46,38 @@ public abstract class Container {
throw new IllegalArgumentException("Listener already listening");
} else {
this.listeners.add(icrafting);
- icrafting.a(this, this.b());
- this.a();
+ icrafting.a(this, this.a());
+ this.b();
}
}
- public List b() {
+ public List a() {
ArrayList arraylist = new ArrayList();
+ Iterator iterator = this.b.iterator();
- for (int i = 0; i < this.e.size(); ++i) {
- arraylist.add(((Slot) this.e.get(i)).getItem());
+ while (iterator.hasNext()) {
+ Slot slot = (Slot) iterator.next();
+
+ arraylist.add(slot.getItem());
}
return arraylist;
}
- public void a() {
- for (int i = 0; i < this.e.size(); ++i) {
- ItemStack itemstack = ((Slot) this.e.get(i)).getItem();
- ItemStack itemstack1 = (ItemStack) this.d.get(i);
+ 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);
if (!ItemStack.matches(itemstack1, itemstack)) {
itemstack1 = itemstack == null ? null : itemstack.cloneItemStack();
- this.d.set(i, itemstack1);
+ this.a.set(i, itemstack1);
+ Iterator iterator = this.listeners.iterator();
+
+ while (iterator.hasNext()) {
+ ICrafting icrafting = (ICrafting) iterator.next();
- for (int j = 0; j < this.listeners.size(); ++j) {
- ((ICrafting) this.listeners.get(j)).a(this, i, itemstack1);
+ icrafting.a(this, i, itemstack1);
}
}
}
@@ -80,23 +88,27 @@ public abstract class Container {
}
public Slot a(IInventory iinventory, int i) {
- for (int j = 0; j < this.e.size(); ++j) {
- Slot slot = (Slot) this.e.get(j);
+ Iterator iterator = this.b.iterator();
- if (slot.a(iinventory, i)) {
- return slot;
+ Slot slot;
+
+ do {
+ if (!iterator.hasNext()) {
+ return null;
}
- }
- return null;
+ slot = (Slot) iterator.next();
+ } while (!slot.a(iinventory, i));
+
+ return slot;
}
public Slot getSlot(int i) {
- return (Slot) this.e.get(i);
+ return (Slot) this.b.get(i);
}
- public ItemStack a(int i) {
- Slot slot = (Slot) this.e.get(i);
+ public ItemStack b(int i) {
+ Slot slot = (Slot) this.b.get(i);
return slot != null ? slot.getItem() : null;
}
@@ -118,7 +130,7 @@ public abstract class Container {
}
if (j == 1) {
- // CraftBukkit start - Store a reference
+ // CraftBukkit start - store a reference
ItemStack itemstack1 = playerinventory.getCarried();
if (itemstack1.count > 0) {
entityhuman.drop(itemstack1.a(1));
@@ -131,13 +143,13 @@ public abstract class Container {
}
}
} else if (flag) {
- ItemStack itemstack1 = this.a(i);
+ ItemStack itemstack1 = this.b(i);
if (itemstack1 != null) {
int k = itemstack1.id;
itemstack = itemstack1.cloneItemStack();
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
if (slot != null && slot.getItem() != null && slot.getItem().id == k) {
this.b(i, j, flag, entityhuman);
@@ -148,10 +160,9 @@ public abstract class Container {
return null;
}
- Slot slot1 = (Slot) this.e.get(i);
+ Slot slot1 = (Slot) this.b.get(i);
if (slot1 != null) {
- slot1.d();
ItemStack itemstack2 = slot1.getItem();
ItemStack itemstack3 = playerinventory.getCarried();
@@ -167,11 +178,13 @@ public abstract class Container {
if (l > slot1.a()) {
l = slot1.a();
}
+
// CraftBukkit start
if (itemstack3.count >= l) {
slot1.set(itemstack3.a(l));
}
// CraftBukkit end
+
if (itemstack3.count == 0) {
playerinventory.setCarried((ItemStack) null);
}
@@ -185,7 +198,7 @@ public abstract class Container {
slot1.set((ItemStack) null);
}
- slot1.c(playerinventory.getCarried());
+ slot1.b(playerinventory.getCarried());
} else if (slot1.isAllowed(itemstack3)) {
if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
l = j == 0 ? itemstack3.count : 1;
@@ -216,9 +229,11 @@ public abstract class Container {
slot1.set((ItemStack) null);
}
- slot1.c(playerinventory.getCarried());
+ slot1.b(playerinventory.getCarried());
}
}
+
+ slot1.e();
}
}
}
@@ -241,26 +256,26 @@ public abstract class Container {
}
public void a(IInventory iinventory) {
- this.a();
+ this.b();
}
public void setItem(int i, ItemStack itemstack) {
this.getSlot(i).set(itemstack);
}
- public boolean c(EntityHuman entityhuman) {
- return !this.b.contains(entityhuman);
+ public boolean b(EntityHuman entityhuman) {
+ return !this.f.contains(entityhuman);
}
public void a(EntityHuman entityhuman, boolean flag) {
if (flag) {
- this.b.remove(entityhuman);
+ this.f.remove(entityhuman);
} else {
- this.b.add(entityhuman);
+ this.f.add(entityhuman);
}
}
- public abstract boolean b(EntityHuman entityhuman);
+ public abstract boolean c(EntityHuman entityhuman);
protected boolean a(ItemStack itemstack, int i, int j, boolean flag) {
boolean flag1 = false;
@@ -275,7 +290,7 @@ public abstract class Container {
if (itemstack.isStackable()) {
while (itemstack.count > 0 && (!flag && k < j || flag && k >= i)) {
- slot = (Slot) this.e.get(k);
+ slot = (Slot) this.b.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;
@@ -283,12 +298,12 @@ public abstract class Container {
if (l <= itemstack.getMaxStackSize()) {
itemstack.count = 0;
itemstack1.count = l;
- slot.d();
+ slot.e();
flag1 = true;
} else if (itemstack1.count < itemstack.getMaxStackSize()) {
itemstack.count -= itemstack.getMaxStackSize() - itemstack1.count;
itemstack1.count = itemstack.getMaxStackSize();
- slot.d();
+ slot.e();
flag1 = true;
}
}
@@ -309,11 +324,11 @@ public abstract class Container {
}
while (!flag && k < j || flag && k >= i) {
- slot = (Slot) this.e.get(k);
+ slot = (Slot) this.b.get(k);
itemstack1 = slot.getItem();
if (itemstack1 == null) {
slot.set(itemstack.cloneItemStack());
- slot.d();
+ slot.e();
itemstack.count = 0;
flag1 = true;
break;
diff --git a/src/main/java/net/minecraft/server/ContainerBrewingStand.java b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
index b7d11dba..fa068f6c 100644
--- a/src/main/java/net/minecraft/server/ContainerBrewingStand.java
+++ b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Iterator;
+
// CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
@@ -8,7 +10,8 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerBrewingStand extends Container {
private TileEntityBrewingStand brewingStand;
- private int b = 0;
+ private final Slot f;
+ private int g = 0;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -17,10 +20,10 @@ public class ContainerBrewingStand extends Container {
public ContainerBrewingStand(PlayerInventory playerinventory, TileEntityBrewingStand tileentitybrewingstand) {
player = playerinventory; // CraftBukkit
this.brewingStand = tileentitybrewingstand;
- this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 0, 56, 46));
- this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 1, 79, 53));
- this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 2, 102, 46));
- this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
+ this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 0, 56, 46));
+ this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 1, 79, 53));
+ this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 2, 102, 46));
+ this.f = this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
int i;
@@ -37,38 +40,47 @@ public class ContainerBrewingStand extends Container {
public void addSlotListener(ICrafting icrafting) {
super.addSlotListener(icrafting);
- icrafting.setContainerData(this, 0, this.brewingStand.i());
+ icrafting.setContainerData(this, 0, this.brewingStand.t_());
}
- public void a() {
- super.a();
+ public void b() {
+ super.b();
+ Iterator iterator = this.listeners.iterator();
- for (int i = 0; i < this.listeners.size(); ++i) {
- ICrafting icrafting = (ICrafting) this.listeners.get(i);
+ while (iterator.hasNext()) {
+ ICrafting icrafting = (ICrafting) iterator.next();
- if (this.b != this.brewingStand.i()) {
- icrafting.setContainerData(this, 0, this.brewingStand.i());
+ if (this.g != this.brewingStand.t_()) {
+ icrafting.setContainerData(this, 0, this.brewingStand.t_());
}
}
- this.b = this.brewingStand.i();
+ this.g = this.brewingStand.t_();
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.a(entityhuman);
}
- public ItemStack a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if ((i < 0 || i > 2) && i != 3) {
- if (i >= 4 && i < 31) {
+ if (!this.f.d() && this.f.isAllowed(itemstack1)) {
+ if (!this.a(itemstack1, 3, 4, false)) {
+ return null;
+ }
+ } else if (SlotPotionBottle.a_(itemstack)) {
+ if (!this.a(itemstack1, 0, 3, false)) {
+ return null;
+ }
+ } else if (i >= 4 && i < 31) {
if (!this.a(itemstack1, 31, 40, false)) {
return null;
}
@@ -90,14 +102,14 @@ public class ContainerBrewingStand extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
if (itemstack1.count == itemstack.count) {
return null;
}
- slot.c(itemstack1);
+ slot.b(itemstack1);
}
return itemstack;
@@ -108,6 +120,7 @@ public class ContainerBrewingStand extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
+
CraftInventory inventory = new CraftInventory(this.brewingStand);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
diff --git a/src/main/java/net/minecraft/server/ContainerChest.java b/src/main/java/net/minecraft/server/ContainerChest.java
index 86270600..6f3c93ac 100644
--- a/src/main/java/net/minecraft/server/ContainerChest.java
+++ b/src/main/java/net/minecraft/server/ContainerChest.java
@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerChest extends Container {
public IInventory container; // CraftBukkit - private->public
- private int b;
+ private int f;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -17,6 +17,7 @@ public class ContainerChest extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
+
CraftInventory inventory;
if (this.container instanceof PlayerInventory) {
inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryPlayer((PlayerInventory) this.container);
@@ -25,6 +26,7 @@ public class ContainerChest extends Container {
} else {
inventory = new CraftInventory(this.container);
}
+
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
@@ -32,9 +34,9 @@ public class ContainerChest extends Container {
public ContainerChest(IInventory iinventory, IInventory iinventory1) {
this.container = iinventory1;
- this.b = iinventory1.getSize() / 9;
- iinventory1.f();
- int i = (this.b - 4) * 18;
+ this.f = iinventory1.getSize() / 9;
+ iinventory1.startOpen();
+ int i = (this.f - 4) * 18;
// CraftBukkit start - save player
// TODO: Should we check to make sure it really is an InventoryPlayer?
this.player = (PlayerInventory)iinventory;
@@ -43,7 +45,7 @@ public class ContainerChest extends Container {
int j;
int k;
- for (j = 0; j < this.b; ++j) {
+ for (j = 0; j < this.f; ++j) {
for (k = 0; k < 9; ++k) {
this.a(new Slot(iinventory1, k + j * 9, 8 + k * 18, 18 + j * 18));
}
@@ -60,31 +62,31 @@ public class ContainerChest extends Container {
}
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.container.a(entityhuman);
}
- public ItemStack a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
- if (i < this.b * 9) {
- if (!this.a(itemstack1, this.b * 9, this.e.size(), true)) {
+ if (i < this.f * 9) {
+ if (!this.a(itemstack1, this.f * 9, this.b.size(), true)) {
return null;
}
- } else if (!this.a(itemstack1, 0, this.b * 9, false)) {
+ } else if (!this.a(itemstack1, 0, this.f * 9, false)) {
return null;
}
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
}
@@ -93,6 +95,6 @@ public class ContainerChest extends Container {
public void a(EntityHuman entityhuman) {
super.a(entityhuman);
- this.container.g();
+ this.container.f();
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerDispenser.java b/src/main/java/net/minecraft/server/ContainerDispenser.java
index b73e968d..93148601 100644
--- a/src/main/java/net/minecraft/server/ContainerDispenser.java
+++ b/src/main/java/net/minecraft/server/ContainerDispenser.java
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerDispenser extends Container {
- public TileEntityDispenser items; // CraftBukkit - Private -> Public
+ public TileEntityDispenser items; // CraftBukkit - private -> public
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -40,16 +40,16 @@ public class ContainerDispenser extends Container {
}
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.items.a(entityhuman);
}
- public ItemStack a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -64,14 +64,14 @@ public class ContainerDispenser extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
if (itemstack1.count == itemstack.count) {
return null;
}
- slot.c(itemstack1);
+ slot.b(itemstack1);
}
return itemstack;
@@ -82,6 +82,7 @@ public class ContainerDispenser extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
+
CraftInventory inventory = new CraftInventory(this.items);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
index ece50e71..3269a218 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-// import java.util.Iterator; // CraftBukkit
+import java.util.Iterator;
import java.util.List;
import java.util.Random;
@@ -24,7 +24,7 @@ public class ContainerEnchantTable extends Container {
private int y;
private int z;
private Random l = new Random();
- public long b;
+ public long f;
public int[] costs = new int[3];
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
@@ -49,8 +49,9 @@ public class ContainerEnchantTable extends Container {
for (l = 0; l < 9; ++l) {
this.a(new Slot(playerinventory, l, 8 + l * 18, 142));
}
+
// CraftBukkit start
- player = (Player) playerinventory.player.bukkitEntity;
+ player = (Player) playerinventory.player.getBukkitEntity();
enchantSlots.player = player;
// CraftBukkit end
}
@@ -62,11 +63,12 @@ public class ContainerEnchantTable extends Container {
icrafting.setContainerData(this, 2, this.costs[2]);
}
- public void a() {
- super.a();
+ public void b() {
+ super.b();
+ Iterator iterator = this.listeners.iterator();
- for (int i = 0; i < this.listeners.size(); ++i) {
- ICrafting icrafting = (ICrafting) this.listeners.get(i);
+ while (iterator.hasNext()) {
+ ICrafting icrafting = (ICrafting) iterator.next();
icrafting.setContainerData(this, 0, this.costs[0]);
icrafting.setContainerData(this, 1, this.costs[1]);
@@ -79,8 +81,8 @@ public class ContainerEnchantTable extends Container {
ItemStack itemstack = iinventory.getItem(0);
int i;
- if (itemstack != null && itemstack.q()) {
- this.b = this.l.nextLong();
+ if (itemstack != null && itemstack.u()) {
+ this.f = this.l.nextLong();
if (!this.world.isStatic) {
i = 0;
@@ -134,7 +136,8 @@ public class ContainerEnchantTable extends Container {
return;
}
// CraftBukkit end
- this.a();
+
+ this.b();
}
} else {
for (i = 0; i < 3; ++i) {
@@ -160,13 +163,14 @@ public class ContainerEnchantTable extends Container {
}
CraftItemStack item = new CraftItemStack(itemstack);
- EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.bukkitEntity, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs[i], enchants, i);
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs[i], enchants, i);
this.world.getServer().getPluginManager().callEvent(event);
int level = event.getExpLevelCost();
if (event.isCancelled() || (level > entityhuman.expLevel && !entityhuman.abilities.canInstantlyBuild) || enchants.isEmpty()) {
return false;
}
+
entityhuman.levelDown(level);
for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
try {
@@ -198,38 +202,48 @@ public class ContainerEnchantTable extends Container {
}
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(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 a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
- if (i != 0) {
- return null;
- }
+ if (i == 0) {
+ if (!this.a(itemstack1, 1, 37, true)) {
+ return null;
+ }
+ } else {
+ if (((Slot) this.b.get(0)).d() || !((Slot) this.b.get(0)).isAllowed(itemstack1)) {
+ return null;
+ }
- if (!this.a(itemstack1, 1, 37, true)) {
- return null;
+ if (itemstack1.hasTag() && itemstack1.count == 1) {
+ ((Slot) this.b.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()));
+ --itemstack1.count;
+ }
}
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
if (itemstack1.count == itemstack.count) {
return null;
}
- slot.c(itemstack1);
+ slot.b(itemstack1);
}
return itemstack;
@@ -240,6 +254,7 @@ public class ContainerEnchantTable extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
+
CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.enchantSlots);
bukkitEntity = new CraftInventoryView(this.player, inventory, this);
return bukkitEntity;
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java b/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
index 191de73a..0075cb16 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
@@ -1,17 +1,53 @@
package net.minecraft.server;
-public class ContainerEnchantTableInventory extends ContainerEnchantTableSubcontainer { // CraftBukkit -> public
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
- public final ContainerEnchantTable enchantTable; // CraftBukkit -> public
+public class ContainerEnchantTableInventory extends InventorySubcontainer { // CraftBukkit -> public
+
+ private final ContainerEnchantTable enchantTable;
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ public org.bukkit.entity.Player player;
+ private int maxStack = MAX_STACK;
+
+ public ItemStack[] getContents() {
+ return this.items;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return this.player;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+ // CraftBukkit end
ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, int i) {
super(s, i);
this.enchantTable = containerenchanttable;
- super.setMaxStackSize(1); // CraftBukkit
+ this.setMaxStackSize(1); // CraftBukkit
}
public int getMaxStackSize() {
- return super.getMaxStackSize(); // CraftBukkit
+ return maxStack; // CraftBukkit
}
public void update() {
diff --git a/src/main/java/net/minecraft/server/ContainerFurnace.java b/src/main/java/net/minecraft/server/ContainerFurnace.java
index 790d1dd6..1770a676 100644
--- a/src/main/java/net/minecraft/server/ContainerFurnace.java
+++ b/src/main/java/net/minecraft/server/ContainerFurnace.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Iterator;
+
// CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
@@ -7,10 +9,11 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerFurnace extends Container {
- public TileEntityFurnace furnace; // CraftBukkit - Private -> Public
- private int b = 0;
- private int c = 0;
+ private TileEntityFurnace furnace;
+ private int f = 0;
+ private int g = 0;
private int h = 0;
+
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -30,7 +33,7 @@ public class ContainerFurnace extends Container {
this.furnace = tileentityfurnace;
this.a(new Slot(tileentityfurnace, 0, 56, 17));
this.a(new Slot(tileentityfurnace, 1, 56, 53));
- this.a(new SlotResult2(playerinventory.player, tileentityfurnace, 2, 116, 35));
+ this.a(new SlotFurnaceResult(playerinventory.player, tileentityfurnace, 2, 116, 35));
this.player = playerinventory; // CraftBukkit - save player
int i;
@@ -53,17 +56,18 @@ public class ContainerFurnace extends Container {
icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
}
- public void a() {
- super.a();
+ public void b() {
+ super.b();
+ Iterator iterator = this.listeners.iterator();
- for (int i = 0; i < this.listeners.size(); ++i) {
- ICrafting icrafting = (ICrafting) this.listeners.get(i);
+ while (iterator.hasNext()) {
+ ICrafting icrafting = (ICrafting) iterator.next();
- if (this.b != this.furnace.cookTime) {
+ if (this.f != this.furnace.cookTime) {
icrafting.setContainerData(this, 0, this.furnace.cookTime);
}
- if (this.c != this.furnace.burnTime) {
+ if (this.g != this.furnace.burnTime) {
icrafting.setContainerData(this, 1, this.furnace.burnTime);
}
@@ -72,21 +76,21 @@ public class ContainerFurnace extends Container {
}
}
- this.b = this.furnace.cookTime;
- this.c = this.furnace.burnTime;
+ this.f = this.furnace.cookTime;
+ this.g = this.furnace.burnTime;
this.h = this.furnace.ticksForCurrentFuel;
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.furnace.a(entityhuman);
}
- public ItemStack a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -97,7 +101,7 @@ public class ContainerFurnace extends Container {
slot.a(itemstack1, itemstack);
} else if (i != 1 && i != 0) {
- if (FurnaceRecipes.getInstance().getResult(itemstack1.getItem().id) != null) {
+ if (RecipesFurnace.getInstance().getResult(itemstack1.getItem().id) != null) {
if (!this.a(itemstack1, 0, 1, false)) {
return null;
}
@@ -119,14 +123,14 @@ public class ContainerFurnace extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
if (itemstack1.count == itemstack.count) {
return null;
}
- slot.c(itemstack1);
+ slot.b(itemstack1);
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/ContainerMerchant.java b/src/main/java/net/minecraft/server/ContainerMerchant.java
new file mode 100644
index 00000000..1f242ded
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ContainerMerchant.java
@@ -0,0 +1,130 @@
+package net.minecraft.server;
+
+import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
+
+public class ContainerMerchant extends Container {
+
+ private IMerchant merchant;
+ private InventoryMerchant f;
+ private final World g;
+
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity == null) {
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(this.getMerchantInventory()), this);
+ }
+ return bukkitEntity;
+ }
+ // CraftBukkit end
+
+ public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
+ this.merchant = imerchant;
+ this.g = world;
+ this.f = new InventoryMerchant(playerinventory.player, imerchant);
+ this.a(new Slot(this.f, 0, 36, 53));
+ this.a(new Slot(this.f, 1, 62, 53));
+ this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.f, 2, 120, 53)));
+ this.player = playerinventory; // CraftBukkit - save player
+
+ int i;
+
+ for (i = 0; i < 3; ++i) {
+ for (int j = 0; j < 9; ++j) {
+ this.a(new Slot(playerinventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+
+ for (i = 0; i < 9; ++i) {
+ this.a(new Slot(playerinventory, i, 8 + i * 18, 142));
+ }
+ }
+
+ public InventoryMerchant getMerchantInventory() {
+ return this.f;
+ }
+
+ public void addSlotListener(ICrafting icrafting) {
+ super.addSlotListener(icrafting);
+ }
+
+ public void b() {
+ super.b();
+ }
+
+ public void a(IInventory iinventory) {
+ this.f.g();
+ super.a(iinventory);
+ }
+
+ public void c(int i) {
+ this.f.c(i);
+ }
+
+ public boolean c(EntityHuman entityhuman) {
+ return this.merchant.l_() == entityhuman;
+ }
+
+ public ItemStack b(int i) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.b.get(i);
+
+ if (slot != null && slot.d()) {
+ ItemStack itemstack1 = slot.getItem();
+
+ itemstack = itemstack1.cloneItemStack();
+ if (i == 2) {
+ if (!this.a(itemstack1, 3, 39, true)) {
+ return null;
+ }
+
+ slot.a(itemstack1, itemstack);
+ } else if (i != 0 && i != 1) {
+ if (i >= 3 && i < 30) {
+ if (!this.a(itemstack1, 30, 39, false)) {
+ return null;
+ }
+ } else if (i >= 30 && i < 39 && !this.a(itemstack1, 3, 30, false)) {
+ return null;
+ }
+ } else if (!this.a(itemstack1, 3, 39, false)) {
+ return null;
+ }
+
+ if (itemstack1.count == 0) {
+ slot.set((ItemStack) null);
+ } else {
+ slot.e();
+ }
+
+ if (itemstack1.count == itemstack.count) {
+ return null;
+ }
+
+ slot.b(itemstack1);
+ }
+
+ return itemstack;
+ }
+
+ public void a(EntityHuman entityhuman) {
+ super.a(entityhuman);
+ this.merchant.a_((EntityHuman) null);
+ super.a(entityhuman);
+ if (!this.g.isStatic) {
+ ItemStack itemstack = this.f.splitWithoutUpdate(0);
+
+ if (itemstack != null) {
+ entityhuman.drop(itemstack);
+ }
+
+ itemstack = this.f.splitWithoutUpdate(1);
+ if (itemstack != null) {
+ entityhuman.drop(itemstack);
+ }
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ContainerPlayer.java b/src/main/java/net/minecraft/server/ContainerPlayer.java
index 374da502..121663fa 100644
--- a/src/main/java/net/minecraft/server/ContainerPlayer.java
+++ b/src/main/java/net/minecraft/server/ContainerPlayer.java
@@ -9,7 +9,7 @@ public class ContainerPlayer extends Container {
public InventoryCrafting craftInventory;
public IInventory resultInventory;
- public boolean c;
+ public boolean g;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -24,8 +24,8 @@ public class ContainerPlayer extends Container {
this.craftInventory = new InventoryCrafting(this, 2, 2, playerinventory.player); // CraftBukkit - pass player
this.craftInventory.resultInventory = this.resultInventory; // CraftBukkit - let InventoryCrafting know about its result slot
this.player = playerinventory; // CraftBukkit - save player
- this.c = false;
- this.c = flag;
+ this.g = false;
+ this.g = flag;
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 144, 36)));
int i;
@@ -82,15 +82,15 @@ public class ContainerPlayer extends Container {
this.resultInventory.setItem(0, (ItemStack) null);
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
return true;
}
- public ItemStack a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -100,6 +100,20 @@ public class ContainerPlayer extends Container {
}
slot.a(itemstack1, itemstack);
+ } else if (i >= 1 && i < 5) {
+ if (!this.a(itemstack1, 9, 45, false)) {
+ return null;
+ }
+ } else if (i >= 5 && i < 9) {
+ 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()) {
+ int j = 5 + ((ItemArmor) itemstack.getItem()).a;
+
+ if (!this.a(itemstack1, j, j + 1, false)) {
+ return null;
+ }
} else if (i >= 9 && i < 36) {
if (!this.a(itemstack1, 36, 45, false)) {
return null;
@@ -115,14 +129,14 @@ public class ContainerPlayer extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
if (itemstack1.count == itemstack.count) {
return null;
}
- slot.c(itemstack1);
+ slot.b(itemstack1);
}
return itemstack;
@@ -133,6 +147,7 @@ public class ContainerPlayer extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
+
CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
diff --git a/src/main/java/net/minecraft/server/ContainerWorkbench.java b/src/main/java/net/minecraft/server/ContainerWorkbench.java
index 0d298e85..d1e61170 100644
--- a/src/main/java/net/minecraft/server/ContainerWorkbench.java
+++ b/src/main/java/net/minecraft/server/ContainerWorkbench.java
@@ -9,7 +9,7 @@ public class ContainerWorkbench extends Container {
public InventoryCrafting craftInventory; // CraftBukkit - move initialization into constructor
public IInventory resultInventory; // CraftBukkit - move initialization into constructor
- private World c;
+ private World g;
private int h;
private int i;
private int j;
@@ -25,7 +25,7 @@ public class ContainerWorkbench extends Container {
this.craftInventory.resultInventory = this.resultInventory;
this.player = playerinventory;
// CraftBukkit end
- this.c = world;
+ this.g = world;
this.h = i;
this.i = j;
this.j = k;
@@ -69,7 +69,7 @@ public class ContainerWorkbench extends Container {
public void a(EntityHuman entityhuman) {
super.a(entityhuman);
- if (!this.c.isStatic) {
+ if (!this.g.isStatic) {
for (int i = 0; i < 9; ++i) {
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
@@ -80,16 +80,16 @@ public class ContainerWorkbench extends Container {
}
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.c.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;
+ 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 a(int i) {
+ public ItemStack b(int i) {
ItemStack itemstack = null;
- Slot slot = (Slot) this.e.get(i);
+ Slot slot = (Slot) this.b.get(i);
- if (slot != null && slot.c()) {
+ if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -114,14 +114,14 @@ public class ContainerWorkbench extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.d();
+ slot.e();
}
if (itemstack1.count == itemstack.count) {
return null;
}
- slot.c(itemstack1);
+ slot.b(itemstack1);
}
return itemstack;
@@ -132,6 +132,7 @@ public class ContainerWorkbench extends Container {
if (bukkitEntity != null) {
return bukkitEntity;
}
+
CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index e6f8691c..72cd878f 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -3,6 +3,7 @@ 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
@@ -10,9 +11,9 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class CraftingManager {
private static final CraftingManager a = new CraftingManager();
- public List recipies = new ArrayList(); // CraftBukkit - private -> public
+ public List recipes = new ArrayList(); // CraftBukkit - private -> public
// CraftBukkit start
- public CraftingRecipe lastRecipe;
+ public IRecipe lastRecipe;
public org.bukkit.inventory.InventoryView lastCraftView;
// CraftBukkit end
@@ -29,7 +30,8 @@ public class CraftingManager {
(new RecipesArmor()).a(this);
(new RecipesDyes()).a(this);
this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
- this.registerShapedRecipe(new ItemStack(Item.BOOK, 1), new Object[] { "#", "#", "#", Character.valueOf('#'), Item.PAPER});
+ this.registerShapelessRecipe(new ItemStack(Item.BOOK, 1), new Object[] { Item.PAPER, Item.PAPER, Item.PAPER, Item.LEATHER});
+ this.registerShapelessRecipe(new ItemStack(Item.BOOK_AND_QUILL, 1), new Object[] { Item.BOOK, new ItemStack(Item.INK_SACK, 1, 0), Item.FEATHER});
this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Item.STICK, Character.valueOf('W'), Block.WOOD});
@@ -45,14 +47,17 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
- this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
+ this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
+ this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
+ this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
this.registerShapedRecipe(new ItemStack(Block.LADDER, 3), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Item.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Item.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Item.IRON_INGOT});
- this.registerShapedRecipe(new ItemStack(Item.SIGN, 1), new Object[] { "###", "###", " X ", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.STICK});
+ this.registerShapedRecipe(new ItemStack(Item.SIGN, 3), new Object[] { "###", "###", " X ", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Item.CAKE, 1), new Object[] { "AAA", "BEB", "CCC", Character.valueOf('A'), Item.MILK_BUCKET, Character.valueOf('B'), Item.SUGAR, Character.valueOf('C'), Item.WHEAT, Character.valueOf('E'), Item.EGG});
this.registerShapedRecipe(new ItemStack(Item.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Item.SUGAR_CANE});
this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 0), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 0)});
@@ -77,15 +82,21 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Item.FLINT_AND_STEEL, 1), new Object[] { "A ", " B", Character.valueOf('A'), Item.IRON_INGOT, Character.valueOf('B'), Item.FLINT});
this.registerShapedRecipe(new ItemStack(Item.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Item.WHEAT});
- this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.WOOD});
+ this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
+ this.registerShapedRecipe(new ItemStack(Block.BIRCH_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
+ this.registerShapedRecipe(new ItemStack(Block.SPRUCE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Block.JUNGLE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.NETHER_BRICK});
+ this.registerShapedRecipe(new ItemStack(Block.SANDSTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
- this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.APPLE});
+ this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.APPLE});
+ this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
+ this.registerShapedRecipe(new ItemStack(Block.TRIPWIRE_SOURCE, 2), new Object[] { "I", "S", "#", Character.valueOf('#'), Block.WOOD, Character.valueOf('S'), Item.STICK, Character.valueOf('I'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Block.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.REDSTONE, Character.valueOf('I'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Item.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.REDSTONE});
@@ -104,12 +115,12 @@ public class CraftingManager {
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, new ItemStack(Item.COAL, 1, 1)});
//Collections.sort(this.b, new RecipeSorter(this)); // CraftBukkit - removed; see below
this.sort(); // CraftBukkit - moved sort to a separate method
- System.out.println(this.recipies.size() + " recipes");
+ System.out.println(this.recipes.size() + " recipes");
}
// CraftBukkit start
public void sort() {
- Collections.sort(this.recipies, new RecipeSorter(this));
+ Collections.sort(this.recipes, new RecipeSorter(this));
}
// CraftBukkit end
@@ -118,12 +129,16 @@ 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;
- for (int l = 0; l < astring.length; ++l) {
- String s1 = astring[l];
+ l = astring.length;
+
+ for (int i1 = 0; i1 < l; ++i1) {
+ String s1 = astring1[i1];
++k;
j = s1.length();
@@ -158,17 +173,17 @@ public class CraftingManager {
ItemStack[] aitemstack = new ItemStack[j * k];
- for (int i1 = 0; i1 < j * k; ++i1) {
- char c0 = s.charAt(i1);
+ for (l = 0; l < j * k; ++l) {
+ char c0 = s.charAt(l);
if (hashmap.containsKey(Character.valueOf(c0))) {
- aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
+ aitemstack[l] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
} else {
- aitemstack[i1] = null;
+ aitemstack[l] = null;
}
}
- this.recipies.add(new ShapedRecipes(j, k, aitemstack, itemstack));
+ this.recipes.add(new ShapedRecipes(j, k, aitemstack, itemstack));
}
public void registerShapelessRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
@@ -192,7 +207,7 @@ public class CraftingManager {
}
}
- this.recipies.add(new ShapelessRecipes(itemstack, arraylist));
+ this.recipes.add(new ShapelessRecipes(itemstack, arraylist));
}
public ItemStack craft(InventoryCrafting inventorycrafting) {
@@ -200,9 +215,7 @@ public class CraftingManager {
ItemStack itemstack = null;
ItemStack itemstack1 = null;
- int j;
-
- for (j = 0; j < inventorycrafting.getSize(); ++j) {
+ for (int j = 0; j < inventorycrafting.getSize(); ++j) {
ItemStack itemstack2 = inventorycrafting.getItem(j);
if (itemstack2 != null) {
@@ -218,10 +231,10 @@ public class CraftingManager {
}
}
- if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].g()) {
+ if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].m()) {
Item item = Item.byId[itemstack.id];
- int k = item.getMaxDurability() - itemstack.g();
- int l = item.getMaxDurability() - itemstack1.g();
+ int k = item.getMaxDurability() - itemstack.i();
+ int l = item.getMaxDurability() - itemstack1.i();
int i1 = k + l + item.getMaxDurability() * 10 / 100;
int j1 = item.getMaxDurability() - i1;
@@ -240,24 +253,27 @@ public class CraftingManager {
return result;
// CraftBukkit end
} else {
- for (j = 0; j < this.recipies.size(); ++j) {
- CraftingRecipe craftingrecipe = (CraftingRecipe) this.recipies.get(j);
-
- if (craftingrecipe.a(inventorycrafting)) {
- // CraftBukkit start - INVENTORY_PRE_CRAFT event
- inventorycrafting.currentRecipe = craftingrecipe;
- ItemStack result = craftingrecipe.b(inventorycrafting);
- result = CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
- return result;
- // CraftBukkit end
+ Iterator iterator = this.recipes.iterator();
+
+ IRecipe irecipe;
+
+ do {
+ if (!iterator.hasNext()) {
+ return null;
}
- }
- inventorycrafting.currentRecipe = null; // CraftBukkit
- return null;
+
+ irecipe = (IRecipe) iterator.next();
+ } while (!irecipe.a(inventorycrafting));
+
+ // CraftBukkit start - INVENTORY_PRE_CRAFT event
+ inventorycrafting.currentRecipe = irecipe;
+ ItemStack result = irecipe.b(inventorycrafting);
+ return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
+ // CraftBukkit end
}
}
- public List getRecipies() {
- return this.recipies;
+ public List getRecipes() {
+ return this.recipes;
}
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
new file mode 100644
index 00000000..66a517ff
--- /dev/null
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -0,0 +1,307 @@
+package net.minecraft.server;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.Callable;
+import java.util.logging.Level;
+
+// CraftBukkit start
+import java.io.PrintStream;
+
+import org.bukkit.craftbukkit.LoggerOutputStream;
+import org.bukkit.event.server.ServerCommandEvent;
+// CraftBukkit end
+
+public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
+
+ private final List l = Collections.synchronizedList(new ArrayList());
+ private RemoteStatusListener m;
+ private RemoteControlListener n;
+ public PropertyManager propertyManager; // CraftBukkit - private -> public
+ private boolean generateStructures;
+ private EnumGamemode q;
+ private ServerConnection r;
+ private boolean s = false;
+
+ // CraftBukkit start - Signature changed
+ public DedicatedServer(joptsimple.OptionSet options) {
+ super(options);
+ // CraftBukkit end
+ new ThreadSleepForever(this);
+ }
+
+ protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException
+ ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
+
+ threadcommandreader.setDaemon(true);
+ threadcommandreader.start();
+ ConsoleLogManager.init(this); // CraftBukkit
+
+ // CraftBukkit start
+ System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
+ System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
+ // CraftBukkit end
+
+ log.info("Starting minecraft server version 1.3.1");
+ 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\"");
+ }
+
+ log.info("Loading properties");
+ this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
+ if (this.H()) {
+ this.e("127.0.0.1");
+ } else {
+ this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
+ this.e(this.propertyManager.getString("server-ip", ""));
+ }
+
+ this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
+ this.setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true));
+ this.setPvP(this.propertyManager.getBoolean("pvp", true));
+ this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
+ this.setTexturePack(this.propertyManager.getString("texture-pack", ""));
+ this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
+ this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
+ int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
+
+ this.q = WorldSettings.a(i);
+ log.info("Default game type: " + this.q);
+ InetAddress inetaddress = null;
+
+ if (this.getServerIp().length() > 0) {
+ inetaddress = InetAddress.getByName(this.getServerIp());
+ }
+
+ if (this.F() < 0) {
+ this.setPort(this.propertyManager.getInt("server-port", 25565));
+ }
+
+ log.info("Generating keypair");
+ this.a(MinecraftEncryption.b());
+ log.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.F());
+
+ try {
+ this.r = new DedicatedServerConnection(this, inetaddress, this.F());
+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
+ log.warning("**** FAILED TO BIND TO PORT!");
+ log.log(Level.WARNING, "The exception was: " + ioexception.toString());
+ log.warning("Perhaps a server is already running on that port?");
+ return false;
+ }
+
+ if (!this.getOnlineMode()) {
+ log.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
+ log.warning("The server will make no attempt to authenticate usernames. Beware.");
+ log.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
+ log.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
+ }
+
+ this.a((ServerConfigurationManagerAbstract) (new ServerConfigurationManager(this)));
+ this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
+ long j = System.nanoTime();
+
+ if (this.I() == null) {
+ this.m(this.propertyManager.getString("level-name", "world"));
+ }
+
+ String s = this.propertyManager.getString("level-seed", "");
+ String s1 = this.propertyManager.getString("level-type", "DEFAULT");
+ long k = (new Random()).nextLong();
+
+ if (s.length() > 0) {
+ try {
+ long l = Long.parseLong(s);
+
+ if (l != 0L) {
+ k = l;
+ }
+ } catch (NumberFormatException numberformatexception) {
+ k = (long) s.hashCode();
+ }
+ }
+
+ WorldType worldtype = WorldType.getType(s1);
+
+ if (worldtype == null) {
+ worldtype = WorldType.NORMAL;
+ }
+
+ this.d(this.propertyManager.getInt("max-build-height", 256));
+ this.d((this.getMaxBuildHeight() + 8) / 16 * 16);
+ this.d(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
+ this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
+ log.info("Preparing level \"" + this.I() + "\"");
+ this.a(this.I(), this.I(), k, worldtype);
+ long i1 = System.nanoTime() - j;
+ String s2 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
+
+ log.info("Done (" + s2 + ")! For help, type \"help\" or \"?\"");
+ if (this.propertyManager.getBoolean("enable-query", false)) {
+ log.info("Starting GS4 status listener");
+ this.m = new RemoteStatusListener(this);
+ this.m.a();
+ }
+
+ if (this.propertyManager.getBoolean("enable-rcon", false)) {
+ log.info("Starting remote control listener");
+ this.n = new RemoteControlListener(this);
+ this.n.a();
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
+ }
+
+ // CraftBukkit start
+ if (this.propertyManager.properties.containsKey("spawn-protection")) {
+ log.info("'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you.");
+ this.server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16));
+ this.propertyManager.properties.remove("spawn-protection");
+ this.propertyManager.savePropertiesFile();
+ }
+
+ return true;
+ }
+
+ public PropertyManager getPropertyManager() {
+ return this.propertyManager;
+ }
+ // CraftBukkit end
+
+ public boolean getGenerateStructures() {
+ return this.generateStructures;
+ }
+
+ public EnumGamemode getGamemode() {
+ return this.q;
+ }
+
+ public int getDifficulty() {
+ return this.propertyManager.getInt("difficulty", 1);
+ }
+
+ public boolean isHardcore() {
+ return this.propertyManager.getBoolean("hardcore", false);
+ }
+
+ protected void a(CrashReport crashreport) {
+ while (this.isRunning()) {
+ this.ah();
+
+ try {
+ Thread.sleep(10L);
+ } catch (InterruptedException interruptedexception) {
+ interruptedexception.printStackTrace();
+ }
+ }
+ }
+
+ public CrashReport b(CrashReport crashreport) {
+ crashreport.a("Type", (Callable) (new CrashReportType(this)));
+ return super.b(crashreport);
+ }
+
+ protected void o() {
+ System.exit(0);
+ }
+
+ public void q() {
+ super.q();
+ this.ah();
+ }
+
+ public boolean getAllowNether() {
+ return this.propertyManager.getBoolean("allow-nether", true);
+ }
+
+ public boolean getSpawnMonsters() {
+ return this.propertyManager.getBoolean("spawn-monsters", true);
+ }
+
+ public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
+ mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.ai().getHasWhitelist()));
+ mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.ai().getWhitelisted().size()));
+ super.a(mojangstatisticsgenerator);
+ }
+
+ public boolean getSnooperEnabled() {
+ return this.propertyManager.getBoolean("snooper-enabled", true);
+ }
+
+ public void issueCommand(String s, ICommandListener icommandlistener) {
+ this.l.add(new ServerCommand(s, icommandlistener));
+ }
+
+ public void ah() {
+ while (!this.l.isEmpty()) {
+ ServerCommand servercommand = (ServerCommand) this.l.remove(0);
+
+ // CraftBukkit start - ServerCommand for preprocessing
+ ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
+ this.server.getPluginManager().callEvent(event);
+ servercommand = new ServerCommand(event.getCommand(), servercommand.source);
+
+ // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
+ this.server.dispatchServerCommand(this.console, servercommand);
+ // CraftBukkit end
+ }
+ }
+
+ public boolean S() {
+ return true;
+ }
+
+ public ServerConfigurationManager ai() {
+ return (ServerConfigurationManager) super.getServerConfigurationManager();
+ }
+
+ public ServerConnection ac() {
+ return this.r;
+ }
+
+ public int a(String s, int i) {
+ return this.propertyManager.getInt(s, i);
+ }
+
+ public String a(String s, String s1) {
+ return this.propertyManager.getString(s, s1);
+ }
+
+ public boolean a(String s, boolean flag) {
+ return this.propertyManager.getBoolean(s, flag);
+ }
+
+ public void a(String s, Object object) {
+ this.propertyManager.a(s, object);
+ }
+
+ public void a() {
+ this.propertyManager.savePropertiesFile();
+ }
+
+ public String c() {
+ File file1 = this.propertyManager.c();
+
+ return file1 != null ? file1.getAbsolutePath() : "No settings file";
+ }
+
+ public void aj() {
+ ServerGUI.a(this);
+ this.s = true;
+ }
+
+ public boolean ae() {
+ return this.s;
+ }
+
+ public String a(EnumGamemode enumgamemode, boolean flag) {
+ return "";
+ }
+
+ public ServerConfigurationManagerAbstract getServerConfigurationManager() {
+ return this.ai();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Enchantment.java b/src/main/java/net/minecraft/server/Enchantment.java
index 8fa4811d..a5a03f41 100644
--- a/src/main/java/net/minecraft/server/Enchantment.java
+++ b/src/main/java/net/minecraft/server/Enchantment.java
@@ -1,7 +1,8 @@
package net.minecraft.server;
public abstract class Enchantment {
- // CraftBukkit - update CraftEnchant.getName(i) if this changes.
+
+ // CraftBukkit - update CraftEnchant.getName(i) if this changes
public static final Enchantment[] byId = new Enchantment[256];
public static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentProtection(0, 10, 0);
public static final Enchantment PROTECTION_FIRE = new EnchantmentProtection(1, 5, 1);
@@ -74,7 +75,7 @@ public abstract class Enchantment {
return this != enchantment;
}
- public Enchantment a(String s) {
+ public Enchantment b(String s) {
this.name = s;
return this;
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d8b778ec..9db77a9c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
import java.util.Random;
@@ -24,70 +25,14 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.plugin.PluginManager;
-import org.bukkit.util.NumberConversions;
// CraftBukkit end
public abstract class Entity {
- // CraftBukkit start - size of entity for clipping calculations
- public enum EntitySize {
- SIZE_1,
- SIZE_2,
- SIZE_3,
- SIZE_4,
- SIZE_5,
- SIZE_6;
-
- public int getXZCoord(double loc) {
- double diff = loc - (NumberConversions.floor(loc) + 0.5D);
-
- switch (this) {
- case SIZE_1:
- if (diff < 0.0D ? diff < -0.3125D : diff < 0.3125D) {
- return NumberConversions.ceil(loc * 32.0D);
- }
-
- return NumberConversions.floor(loc * 32.0D);
- case SIZE_2:
- if (diff < 0.0D ? diff < -0.3125D : diff < 0.3125D) {
- return NumberConversions.floor(loc * 32.0D);
- }
-
- return NumberConversions.ceil(loc * 32.0D);
- case SIZE_3:
- if (diff > 0.0D) {
- return NumberConversions.floor(loc * 32.0D);
- }
-
- return NumberConversions.ceil(loc * 32.0D);
- case SIZE_4:
- if (diff < 0.0D ? diff < -0.1875D : diff < 0.1875D) {
- return NumberConversions.ceil(loc * 32.0D);
- }
-
- return NumberConversions.floor(loc * 32.0D);
- case SIZE_5:
- if (diff < 0.0D ? diff < -0.1875D : diff < 0.1875D) {
- return NumberConversions.floor(loc * 32.0D);
- }
-
- return NumberConversions.ceil(loc * 32.0D);
- case SIZE_6:
- default:
- if (diff > 0.0D) {
- return NumberConversions.ceil(loc * 32.0D);
- }
-
- return NumberConversions.floor(loc * 32.0D);
- }
- }
- }
- public EntitySize size;
- // CraftBukkit end
private static int entityCount = 0;
public int id;
- public double be;
- public boolean bf;
+ public double l;
+ public boolean m;
public Entity passenger;
public Entity vehicle;
public World world;
@@ -107,86 +52,87 @@ public abstract class Entity {
public final AxisAlignedBB boundingBox;
public boolean onGround;
public boolean positionChanged;
- public boolean bz;
- public boolean bA;
+ public boolean G;
+ public boolean H;
public boolean velocityChanged;
- protected boolean bC;
- public boolean bD;
+ protected boolean J;
+ public boolean K;
public boolean dead;
public float height;
public float width;
public float length;
- public float bI;
- public float bJ;
- public float fallDistance; // CraftBukkit - private -> public
+ public float P;
+ public float Q;
+ public float fallDistance;
private int b;
- public double bL;
- public double bM;
- public double bN;
- public float bO;
- public float bP;
- public boolean bQ;
- public float bR;
+ public double S;
+ public double T;
+ public double U;
+ public float V;
+ public float W;
+ public boolean X;
+ public float Y;
protected Random random;
public int ticksLived;
public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public
- protected boolean bV;
+ protected boolean ac;
public int noDamageTicks;
private boolean justCreated;
protected boolean fireProof;
protected DataWatcher datawatcher;
private double e;
private double f;
- public boolean bZ;
- public int ca;
- public int cb;
- public int cc;
- public boolean cd;
- public boolean ce;
+ public boolean ag;
+ public int ah;
+ public int ai;
+ public int aj;
+ public boolean ak;
+ public boolean al;
+ public EnumEntitySize am;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public boolean valid = true; // CraftBukkit
public Entity(World world) {
this.id = entityCount++;
- this.be = 1.0D;
- this.bf = false;
+ this.l = 1.0D;
+ this.m = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false;
- this.bA = false;
+ this.H = false;
this.velocityChanged = false;
- this.bD = true;
+ this.K = true;
this.dead = false;
this.height = 0.0F;
this.width = 0.6F;
- this.size = EntitySize.SIZE_2; // CraftBukkit
this.length = 1.8F;
- this.bI = 0.0F;
- this.bJ = 0.0F;
+ this.P = 0.0F;
+ this.Q = 0.0F;
this.fallDistance = 0.0F;
this.b = 1;
- this.bO = 0.0F;
- this.bP = 0.0F;
- this.bQ = false;
- this.bR = 0.0F;
+ this.V = 0.0F;
+ this.W = 0.0F;
+ this.X = false;
+ this.Y = 0.0F;
this.random = new Random();
this.ticksLived = 0;
this.maxFireTicks = 1;
this.fireTicks = 0;
- this.bV = false;
+ this.ac = false;
this.noDamageTicks = 0;
this.justCreated = true;
this.fireProof = false;
this.datawatcher = new DataWatcher();
- this.bZ = false;
+ this.ag = false;
+ this.am = EnumEntitySize.SIZE_2;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
this.datawatcher.a(0, Byte.valueOf((byte) 0));
this.datawatcher.a(1, Short.valueOf((short) 300));
- this.b();
+ this.a();
}
- protected abstract void b();
+ protected abstract void a();
public DataWatcher getDataWatcher() {
return this.datawatcher;
@@ -204,29 +150,28 @@ public abstract class Entity {
this.dead = true;
}
- protected void b(float f, float f1) {
+ protected void a(float f, float f1) {
this.width = f;
this.length = f1;
- // CraftBukkit start - figure out entity size for clipping calculations
- float mod = f % 2f;
- if (mod < 0.375) {
- this.size = EntitySize.SIZE_1;
- } else if (mod < 0.75) {
- this.size = EntitySize.SIZE_2;
- } else if (mod < 1.0) {
- this.size = EntitySize.SIZE_3;
- } else if (mod < 1.375) {
- this.size = EntitySize.SIZE_4;
- } else if (mod < 1.75) {
- this.size = EntitySize.SIZE_5;
+ float f2 = f % 2.0F;
+
+ if ((double) f2 < 0.375D) {
+ this.am = EnumEntitySize.SIZE_1;
+ } else if ((double) f2 < 0.75D) {
+ this.am = EnumEntitySize.SIZE_2;
+ } else if ((double) f2 < 1.0D) {
+ this.am = EnumEntitySize.SIZE_3;
+ } else if ((double) f2 < 1.375D) {
+ this.am = EnumEntitySize.SIZE_4;
+ } else if ((double) f2 < 1.75D) {
+ this.am = EnumEntitySize.SIZE_5;
} else {
- this.size = EntitySize.SIZE_6;
+ this.am = EnumEntitySize.SIZE_6;
}
- // CraftBukkit end
}
- protected void c(float f, float f1) {
- // CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0.
+ protected void b(float f, float f1) {
+ // CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0
if (Float.isNaN(f)) {
f = 0;
}
@@ -264,21 +209,21 @@ public abstract class Entity {
float f = this.width / 2.0F;
float f1 = this.length;
- this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bO, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bO + (double) f1, d2 + (double) f);
+ this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.V, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.V + (double) f1, d2 + (double) f);
}
- public void F_() {
- this.aA();
+ public void h_() {
+ this.z();
}
- public void aA() {
- // MethodProfiler.a("entityBaseTick"); // CraftBukkit - not in production code
+ public void z() {
+ // this.world.methodProfiler.a("entityBaseTick"); // CraftBukkit - not in production code
if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null;
}
++this.ticksLived;
- this.bI = this.bJ;
+ this.P = this.Q;
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -286,7 +231,7 @@ public abstract class Entity {
this.lastYaw = this.yaw;
int i;
- if (this.isSprinting() && !this.aU()) {
+ if (this.isSprinting() && !this.H()) {
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
@@ -298,8 +243,8 @@ public abstract class Entity {
}
}
- if (this.h_()) {
- if (!this.bV && !this.justCreated) {
+ if (this.I()) {
+ if (!this.ac && !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) {
@@ -326,10 +271,10 @@ public abstract class Entity {
}
this.fallDistance = 0.0F;
- this.bV = true;
+ this.ac = true;
this.fireTicks = 0;
} else {
- this.bV = false;
+ this.ac = false;
}
if (this.world.isStatic) {
@@ -361,13 +306,13 @@ public abstract class Entity {
}
}
- if (this.aV()) {
- this.aQ();
+ if (this.J()) {
+ this.A();
this.fallDistance *= 0.5F;
}
if (this.locY < -64.0D) {
- this.aI();
+ this.C();
}
if (!this.world.isStatic) {
@@ -376,10 +321,10 @@ public abstract class Entity {
}
this.justCreated = false;
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
}
- protected void aQ() {
+ protected void A() {
if (!this.fireProof) {
// CraftBukkit start - fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) {
@@ -406,7 +351,7 @@ public abstract class Entity {
this.setOnFire(combustEvent.getDuration());
}
} else {
- // This will be called every single tick the entity is in lava, so don't throw an event.
+ // This will be called every single tick the entity is in lava, so don't throw an event
this.setOnFire(15);
}
return;
@@ -430,31 +375,31 @@ public abstract class Entity {
this.fireTicks = 0;
}
- protected void aI() {
+ protected void C() {
this.die();
}
- public boolean d(double d0, double d1, double d2) {
+ public boolean c(double d0, double d1, double d2) {
AxisAlignedBB axisalignedbb = this.boundingBox.c(d0, d1, d2);
List list = this.world.getCubes(this, axisalignedbb);
- return list.size() > 0 ? false : !this.world.containsLiquid(axisalignedbb);
+ return !list.isEmpty() ? false : !this.world.containsLiquid(axisalignedbb);
}
public void move(double d0, double d1, double d2) {
- if (this.bQ) {
+ if (this.X) {
this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
- this.locY = this.boundingBox.b + (double) this.height - (double) this.bO;
+ this.locY = this.boundingBox.b + (double) this.height - (double) this.V;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else {
- // MethodProfiler.a("move"); // CraftBukkit - not in production code
- this.bO *= 0.4F;
+ // this.world.methodProfiler.a("move"); // CraftBukkit - not in production code
+ this.V *= 0.4F;
double d3 = this.locX;
double d4 = this.locZ;
- if (this.bC) {
- this.bC = false;
+ if (this.J) {
+ this.J = false;
d0 *= 0.25D;
d1 *= 0.05000000074505806D;
d2 *= 0.25D;
@@ -472,7 +417,7 @@ public abstract class Entity {
if (flag) {
double d8;
- for (d8 = 0.05D; d0 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0; d5 = d0) {
+ for (d8 = 0.05D; d0 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, 0.0D)).isEmpty(); d5 = d0) {
if (d0 < d8 && d0 >= -d8) {
d0 = 0.0D;
} else if (d0 > 0.0D) {
@@ -482,7 +427,7 @@ public abstract class Entity {
}
}
- for (; d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0; d7 = d2) {
+ for (; d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(0.0D, -1.0D, d2)).isEmpty(); d7 = d2) {
if (d2 < d8 && d2 >= -d8) {
d2 = 0.0D;
} else if (d2 > 0.0D) {
@@ -492,7 +437,7 @@ public abstract class Entity {
}
}
- while (d0 != 0.0D && d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, d2)).size() == 0) {
+ while (d0 != 0.0D && d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, d2)).isEmpty()) {
if (d0 < d8 && d0 >= -d8) {
d0 = 0.0D;
} else if (d0 > 0.0D) {
@@ -516,12 +461,14 @@ public abstract class Entity {
List list = this.world.getCubes(this, this.boundingBox.a(d0, d1, d2));
- for (int i = 0; i < list.size(); ++i) {
- d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1);
+ AxisAlignedBB axisalignedbb1;
+
+ for (Iterator iterator = list.iterator(); iterator.hasNext(); d1 = axisalignedbb1.b(this.boundingBox, d1)) {
+ axisalignedbb1 = (AxisAlignedBB) iterator.next();
}
this.boundingBox.d(0.0D, d1, 0.0D);
- if (!this.bD && d6 != d1) {
+ if (!this.K && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -529,25 +476,26 @@ public abstract class Entity {
boolean flag1 = this.onGround || d6 != d1 && d6 < 0.0D;
- int j;
+ AxisAlignedBB axisalignedbb2;
+ Iterator iterator1;
- for (j = 0; j < list.size(); ++j) {
- d0 = ((AxisAlignedBB) list.get(j)).a(this.boundingBox, d0);
+ for (iterator1 = list.iterator(); iterator1.hasNext(); d0 = axisalignedbb2.a(this.boundingBox, d0)) {
+ axisalignedbb2 = (AxisAlignedBB) iterator1.next();
}
this.boundingBox.d(d0, 0.0D, 0.0D);
- if (!this.bD && d5 != d0) {
+ if (!this.K && d5 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
- for (j = 0; j < list.size(); ++j) {
- d2 = ((AxisAlignedBB) list.get(j)).c(this.boundingBox, d2);
+ for (iterator1 = list.iterator(); iterator1.hasNext(); d2 = axisalignedbb2.c(this.boundingBox, d2)) {
+ axisalignedbb2 = (AxisAlignedBB) iterator1.next();
}
this.boundingBox.d(0.0D, 0.0D, d2);
- if (!this.bD && d7 != d2) {
+ if (!this.K && d7 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -555,63 +503,65 @@ public abstract class Entity {
double d9;
double d10;
- int k;
- if (this.bP > 0.0F && flag1 && (flag || this.bO < 0.05F) && (d5 != d0 || d7 != d2)) {
+ if (this.W > 0.0F && flag1 && (flag || this.V < 0.05F) && (d5 != d0 || d7 != d2)) {
d9 = d0;
d10 = d1;
double d11 = d2;
d0 = d5;
- d1 = (double) this.bP;
+ d1 = (double) this.W;
d2 = d7;
- AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
+ AxisAlignedBB axisalignedbb3 = this.boundingBox.clone();
- this.boundingBox.b(axisalignedbb);
+ this.boundingBox.c(axisalignedbb);
list = this.world.getCubes(this, this.boundingBox.a(d5, d1, d7));
- for (k = 0; k < list.size(); ++k) {
- d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
+ Iterator iterator2;
+ AxisAlignedBB axisalignedbb4;
+
+ for (iterator2 = list.iterator(); iterator2.hasNext(); d1 = axisalignedbb4.b(this.boundingBox, d1)) {
+ axisalignedbb4 = (AxisAlignedBB) iterator2.next();
}
this.boundingBox.d(0.0D, d1, 0.0D);
- if (!this.bD && d6 != d1) {
+ if (!this.K && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
- for (k = 0; k < list.size(); ++k) {
- d0 = ((AxisAlignedBB) list.get(k)).a(this.boundingBox, d0);
+ for (iterator2 = list.iterator(); iterator2.hasNext(); d0 = axisalignedbb4.a(this.boundingBox, d0)) {
+ axisalignedbb4 = (AxisAlignedBB) iterator2.next();
}
this.boundingBox.d(d0, 0.0D, 0.0D);
- if (!this.bD && d5 != d0) {
+ if (!this.K && d5 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
- for (k = 0; k < list.size(); ++k) {
- d2 = ((AxisAlignedBB) list.get(k)).c(this.boundingBox, d2);
+ for (iterator2 = list.iterator(); iterator2.hasNext(); d2 = axisalignedbb4.c(this.boundingBox, d2)) {
+ axisalignedbb4 = (AxisAlignedBB) iterator2.next();
}
this.boundingBox.d(0.0D, 0.0D, d2);
- if (!this.bD && d7 != d2) {
+ if (!this.K && d7 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
- if (!this.bD && d6 != d1) {
+ if (!this.K && d6 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
} else {
- d1 = (double) (-this.bP);
+ d1 = (double) (-this.W);
- for (k = 0; k < list.size(); ++k) {
- d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
+ for (iterator2 = list.iterator(); iterator2.hasNext(); d1 = axisalignedbb4.b(this.boundingBox, d1)) {
+ axisalignedbb4 = (AxisAlignedBB) iterator2.next();
}
this.boundingBox.d(0.0D, d1, 0.0D);
@@ -621,25 +571,25 @@ public abstract class Entity {
d0 = d9;
d1 = d10;
d2 = d11;
- this.boundingBox.b(axisalignedbb1);
+ this.boundingBox.c(axisalignedbb3);
} else {
double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
if (d12 > 0.0D) {
- this.bO = (float) ((double) this.bO + d12 + 0.01D);
+ this.V = (float) ((double) this.V + d12 + 0.01D);
}
}
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
- // MethodProfiler.a("rest"); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("rest"); // CraftBukkit - not in production code
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
- this.locY = this.boundingBox.b + (double) this.height - (double) this.bO;
+ this.locY = this.boundingBox.b + (double) this.height - (double) this.V;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.positionChanged = d5 != d0 || d7 != d2;
- this.bz = d6 != d1;
+ this.G = d6 != d1;
this.onGround = d6 != d1 && d6 < 0.0D;
- this.bA = this.positionChanged || this.bz;
+ this.H = this.positionChanged || this.G;
this.a(d1, this.onGround);
if (d5 != d0) {
this.motX = 0.0D;
@@ -655,9 +605,6 @@ public abstract class Entity {
d9 = this.locX - d3;
d10 = this.locZ - d4;
- int l;
- int i1;
- int j1;
// CraftBukkit start
if ((this.positionChanged) && (this.getBukkitEntity() instanceof Vehicle)) {
@@ -679,47 +626,28 @@ public abstract class Entity {
}
// CraftBukkit end
- if (this.g_() && !flag && this.vehicle == null) {
- this.bJ = (float) ((double) this.bJ + (double) MathHelper.sqrt(d9 * d9 + d10 * d10) * 0.6D);
- l = MathHelper.floor(this.locX);
- i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
- j1 = MathHelper.floor(this.locZ);
- k = this.world.getTypeId(l, i1, j1);
- if (k == 0 && this.world.getTypeId(l, i1 - 1, j1) == Block.FENCE.id) {
- k = this.world.getTypeId(l, i1 - 1, j1);
- }
+ if (this.e_() && !flag && this.vehicle == null) {
+ this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d9 * d9 + d10 * d10) * 0.6D);
+ 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 (this.bJ > (float) this.b && k > 0) {
- this.b = (int) this.bJ + 1;
- this.a(l, i1, j1, k);
- Block.byId[k].b(this.world, l, i1, j1, this);
+ if (l == 0 && this.world.getTypeId(i, j - 1, k) == Block.FENCE.id) {
+ l = this.world.getTypeId(i, j - 1, k);
}
- }
- l = MathHelper.floor(this.boundingBox.a + 0.0010D);
- i1 = MathHelper.floor(this.boundingBox.b + 0.0010D);
- j1 = MathHelper.floor(this.boundingBox.c + 0.0010D);
- k = MathHelper.floor(this.boundingBox.d - 0.0010D);
- int k1 = MathHelper.floor(this.boundingBox.e - 0.0010D);
- int l1 = MathHelper.floor(this.boundingBox.f - 0.0010D);
-
- if (this.world.a(l, i1, j1, k, k1, l1)) {
- for (int i2 = l; i2 <= k; ++i2) {
- for (int j2 = i1; j2 <= k1; ++j2) {
- for (int k2 = j1; k2 <= l1; ++k2) {
- int l2 = this.world.getTypeId(i2, j2, k2);
-
- if (l2 > 0) {
- Block.byId[l2].a(this.world, i2, j2, k2, this);
- }
- }
- }
+ if (this.Q > (float) this.b && l > 0) {
+ this.b = (int) this.Q + 1;
+ this.a(i, j, k, l);
+ Block.byId[l].b(this.world, i, j, k, this);
}
}
- boolean flag2 = this.aT();
+ this.D();
+ boolean flag2 = this.G();
- if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
+ if (this.world.e(this.boundingBox.shrink(0.001D, 0.001D, 0.001D))) {
this.burn(1);
if (!flag2) {
++this.fireTicks;
@@ -745,7 +673,30 @@ public abstract class Entity {
this.fireTicks = -this.maxFireTicks;
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ }
+ }
+
+ protected void D() {
+ int i = MathHelper.floor(this.boundingBox.a + 0.001D);
+ int j = MathHelper.floor(this.boundingBox.b + 0.001D);
+ int k = MathHelper.floor(this.boundingBox.c + 0.001D);
+ int l = MathHelper.floor(this.boundingBox.d - 0.001D);
+ int i1 = MathHelper.floor(this.boundingBox.e - 0.001D);
+ int j1 = MathHelper.floor(this.boundingBox.f - 0.001D);
+
+ if (this.world.c(i, j, k, l, i1, j1)) {
+ for (int k1 = i; k1 <= l; ++k1) {
+ for (int l1 = j; l1 <= i1; ++l1) {
+ for (int i2 = k; i2 <= j1; ++i2) {
+ int j2 = this.world.getTypeId(k1, l1, i2);
+
+ if (j2 > 0) {
+ Block.byId[j2].a(this.world, k1, l1, i2, this);
+ }
+ }
+ }
+ }
}
}
@@ -760,7 +711,7 @@ public abstract class Entity {
}
}
- protected boolean g_() {
+ protected boolean e_() {
return true;
}
@@ -790,7 +741,7 @@ public abstract class Entity {
}
}
- public AxisAlignedBB h() {
+ public AxisAlignedBB E() {
return null;
}
@@ -809,6 +760,7 @@ public abstract class Entity {
event.getEntity().setLastDamageCause(event);
}
// CraftBukkit end
+
this.damageEntity(DamageSource.FIRE, i);
}
}
@@ -823,16 +775,16 @@ public abstract class Entity {
}
}
- public boolean aT() {
- return this.bV || this.world.y(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ public boolean G() {
+ return this.ac || this.world.B(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
- public boolean aU() {
- return this.bV;
+ public boolean H() {
+ return this.ac;
}
- public boolean h_() {
- return this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.0010D, 0.0010D, 0.0010D), Material.WATER, this);
+ 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);
}
public boolean a(Material material) {
@@ -856,14 +808,15 @@ public abstract class Entity {
return 0.0F;
}
- public boolean aV() {
+ public boolean J() {
return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
}
public void a(float f, float f1, float f2) {
- float f3 = MathHelper.c(f * f + f1 * f1);
+ float f3 = f * f + f1 * f1;
- if (f3 >= 0.01F) {
+ if (f3 >= 1.0E-4F) {
+ f3 = MathHelper.c(f3);
if (f3 < 1.0F) {
f3 = 1.0F;
}
@@ -879,7 +832,7 @@ public abstract class Entity {
}
}
- public float b(float f) {
+ public float c(float f) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
@@ -887,7 +840,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.p(i, k, j);
+ return this.world.o(i, k, j);
} else {
return 0.0F;
}
@@ -901,6 +854,7 @@ public abstract class Entity {
return;
}
// CraftBukkit end
+
this.world = world;
}
@@ -910,7 +864,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1;
- this.bO = 0.0F;
+ this.V = 0.0F;
double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) {
@@ -922,19 +876,19 @@ public abstract class Entity {
}
this.setPosition(this.locX, this.locY, this.locZ);
- this.c(f, f1);
+ this.b(f, f1);
}
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
- this.bL = this.lastX = this.locX = d0;
- this.bM = this.lastY = this.locY = d1 + (double) this.height;
- this.bN = this.lastZ = this.locZ = d2;
+ this.S = this.lastX = this.locX = d0;
+ this.T = this.lastY = this.locY = d1 + (double) this.height;
+ this.U = this.lastZ = this.locZ = d2;
this.yaw = f;
this.pitch = f1;
this.setPosition(this.locX, this.locY, this.locZ);
}
- public float i(Entity entity) {
+ public float d(Entity entity) {
float f = (float) (this.locX - entity.locX);
float f1 = (float) (this.locY - entity.locY);
float f2 = (float) (this.locZ - entity.locZ);
@@ -958,7 +912,7 @@ public abstract class Entity {
return (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
}
- public double j(Entity entity) {
+ public double e(Entity entity) {
double d0 = this.locX - entity.locX;
double d1 = this.locY - entity.locY;
double d2 = this.locZ - entity.locZ;
@@ -966,7 +920,7 @@ public abstract class Entity {
return d0 * d0 + d1 * d1 + d2 * d2;
}
- public void a_(EntityHuman entityhuman) {}
+ public void b_(EntityHuman entityhuman) {}
public void collide(Entity entity) {
if (entity.passenger != this && entity.vehicle != this) {
@@ -988,42 +942,42 @@ public abstract class Entity {
d1 *= d3;
d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D;
- d0 *= (double) (1.0F - this.bR);
- d1 *= (double) (1.0F - this.bR);
- this.b_(-d0, 0.0D, -d1);
- entity.b_(d0, 0.0D, d1);
+ d0 *= (double) (1.0F - this.Y);
+ d1 *= (double) (1.0F - this.Y);
+ this.g(-d0, 0.0D, -d1);
+ entity.g(d0, 0.0D, d1);
}
}
}
- public void b_(double d0, double d1, double d2) {
+ public void g(double d0, double d1, double d2) {
this.motX += d0;
this.motY += d1;
this.motZ += d2;
- this.ce = true;
+ this.al = true;
}
- protected void aW() {
+ protected void K() {
this.velocityChanged = true;
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.aW();
+ this.K();
return false;
}
- public boolean o_() {
+ public boolean L() {
return false;
}
- public boolean e_() {
+ public boolean M() {
return false;
}
- public void b(Entity entity, int i) {}
+ public void c(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) {
- String s = this.aX();
+ String s = this.Q();
if (!this.dead && s != null) {
nbttagcompound.setString("id", s);
@@ -1035,7 +989,7 @@ public abstract class Entity {
}
public void d(NBTTagCompound nbttagcompound) {
- nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bO, this.locZ}));
+ nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.V, 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
@@ -1055,8 +1009,8 @@ public abstract class Entity {
nbttagcompound.setShort("Air", (short) this.getAirTicks());
nbttagcompound.setBoolean("OnGround", this.onGround);
// CraftBukkit start
- nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits());
- nbttagcompound.setLong("WorldUUIDMost", this.world.getUUID().getMostSignificantBits());
+ 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
@@ -1085,9 +1039,9 @@ public abstract class Entity {
}
// CraftBukkit end */
- this.lastX = this.bL = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
- this.lastY = this.bM = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
- this.lastZ = this.bN = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
+ this.lastX = this.S = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
+ this.lastY = this.T = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
+ this.lastZ = this.U = 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");
@@ -1105,10 +1059,10 @@ public abstract class Entity {
}
// CraftBukkit end
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
this.a(nbttagcompound);
- // CraftBukkit start - Exempt Vehicles from notch's sanity check
+ // 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;
@@ -1138,6 +1092,7 @@ public abstract class Entity {
} else {
bworld = server.getWorld(worldName);
}
+
if (bworld == null) {
EntityPlayer entityPlayer = (EntityPlayer) this;
bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
@@ -1148,7 +1103,7 @@ public abstract class Entity {
// CraftBukkit end
}
- protected final String aX() {
+ protected final String Q() {
return EntityTypes.b(this);
}
@@ -1213,7 +1168,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.e(j, k, l)) {
+ if (this.world.s(j, k, l)) {
return true;
}
}
@@ -1221,24 +1176,24 @@ public abstract class Entity {
return false;
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
return false;
}
- public AxisAlignedBB b_(Entity entity) {
+ public AxisAlignedBB g(Entity entity) {
return null;
}
- public void R() {
+ public void U() {
if (this.vehicle.dead) {
this.vehicle = null;
} else {
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
- this.F_();
+ this.h_();
if (this.vehicle != null) {
- this.vehicle.i_();
+ this.vehicle.V();
this.f += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
for (this.e += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.f >= 180.0D; this.f -= 360.0D) {
@@ -1285,15 +1240,21 @@ public abstract class Entity {
}
}
- public void i_() {
- this.passenger.setPosition(this.locX, this.locY + this.x_() + this.passenger.W(), this.locZ);
+ public void V() {
+ if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bF()) {
+ this.passenger.S = this.passenger.locX;
+ this.passenger.T = this.passenger.locY;
+ this.passenger.U = this.passenger.locZ;
+ }
+
+ this.passenger.setPosition(this.locX, this.locY + this.X() + this.passenger.W(), this.locZ);
}
public double W() {
return (double) this.height;
}
- public double x_() {
+ public double X() {
return (double) this.length * 0.75D;
}
@@ -1342,9 +1303,9 @@ public abstract class Entity {
}
// CraftBukkit end
+ this.h(entity);
this.vehicle.passenger = null;
this.vehicle = null;
- this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.length, entity.locZ, this.yaw, this.pitch);
} else {
// CraftBukkit start
if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
@@ -1370,45 +1331,76 @@ public abstract class Entity {
}
}
- public float j_() {
+ public void h(Entity entity) {
+ double d0 = entity.locX;
+ double d1 = entity.boundingBox.b + (double) entity.length;
+ double d2 = entity.locZ;
+
+ for (double d3 = -1.5D; d3 < 2.0D; ++d3) {
+ for (double d4 = -1.5D; d4 < 2.0D; ++d4) {
+ if (d3 != 0.0D || d4 != 0.0D) {
+ int i = (int) (this.locX + d3);
+ int j = (int) (this.locZ + d4);
+ AxisAlignedBB axisalignedbb = this.boundingBox.c(d3, 1.0D, d4);
+
+ if (this.world.a(axisalignedbb).isEmpty()) {
+ if (this.world.t(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) {
+ d0 = this.locX + d3;
+ d1 = this.locY + 1.0D;
+ d2 = this.locZ + d4;
+ }
+ }
+ }
+ }
+ }
+
+ this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
+ }
+
+ public float Y() {
return 0.1F;
}
- public Vec3D aJ() {
+ public Vec3D Z() {
return null;
}
- public void ad() {}
+ public void aa() {}
public ItemStack[] getEquipment() {
return null;
}
public boolean isBurning() {
- return this.fireTicks > 0 || this.j(0);
+ return this.fireTicks > 0 || this.f(0);
}
public boolean isSneaking() {
- return this.j(1);
+ return this.f(1);
}
- public void setSneak(boolean flag) {
+ public void setSneaking(boolean flag) {
this.a(1, flag);
}
public boolean isSprinting() {
- return this.j(3);
+ return this.f(3);
}
public void setSprinting(boolean flag) {
this.a(3, flag);
}
- public void i(boolean flag) {
+ public void c(boolean flag) {
this.a(4, flag);
}
- protected boolean j(int i) {
+ protected boolean f(int i) {
return (this.datawatcher.getByte(0) & 1 << i) != 0;
}
@@ -1423,17 +1415,17 @@ public abstract class Entity {
}
public int getAirTicks() {
- return this.datawatcher.b(1);
+ return this.datawatcher.getShort(1);
}
public void setAirTicks(int i) {
this.datawatcher.watch(1, Short.valueOf((short) i));
}
- public void a(EntityWeatherLighting entityweatherlighting) {
+ public void a(EntityLightning entitylightning) {
// CraftBukkit start
final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
- final org.bukkit.entity.Entity stormBukkitEntity = entityweatherlighting.getBukkitEntity();
+ final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
final PluginManager pluginManager = Bukkit.getPluginManager();
if (thisBukkitEntity instanceof Painting) {
@@ -1468,9 +1460,9 @@ public abstract class Entity {
}
}
- public void c(EntityLiving entityliving) {}
+ public void a(EntityLiving entityliving) {}
- protected boolean g(double d0, double d1, double d2) {
+ protected boolean i(double d0, double d1, double d2) {
int i = MathHelper.floor(d0);
int j = MathHelper.floor(d1);
int k = MathHelper.floor(d2);
@@ -1478,13 +1470,13 @@ public abstract class Entity {
double d4 = d1 - (double) j;
double d5 = d2 - (double) k;
- if (this.world.e(i, j, k)) {
- boolean flag = !this.world.e(i - 1, j, k);
- boolean flag1 = !this.world.e(i + 1, j, k);
- boolean flag2 = !this.world.e(i, j - 1, k);
- boolean flag3 = !this.world.e(i, j + 1, k);
- boolean flag4 = !this.world.e(i, j, k - 1);
- boolean flag5 = !this.world.e(i, j, k + 1);
+ 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;
double d6 = 9999.0D;
@@ -1550,8 +1542,8 @@ public abstract class Entity {
}
}
- public void u() {
- this.bC = true;
+ public void aj() {
+ this.J = true;
this.fallDistance = 0.0F;
}
@@ -1565,19 +1557,23 @@ public abstract class Entity {
return LocaleI18n.get("entity." + s + ".name");
}
- public Entity[] bb() {
+ public Entity[] al() {
return null;
}
- public boolean a_(Entity entity) {
+ public boolean i(Entity entity) {
return this == entity;
}
- public float ar() {
+ public float am() {
return 0.0F;
}
- public boolean k_() {
+ public boolean an() {
return true;
}
+
+ 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)});
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index fd5b948c..e8adc0ec 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -7,8 +7,8 @@ public abstract class EntityAgeable extends EntityCreature {
super(world);
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(12, new Integer(0));
}
@@ -32,8 +32,8 @@ public abstract class EntityAgeable extends EntityCreature {
this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
}
- public void e() {
- super.e();
+ public void d() {
+ super.d();
int i = this.getAge();
if (ageLocked) return; // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 2ae8a007..75fdb0e7 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -11,29 +12,28 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
public class EntityArrow extends Entity {
+ private int d = -1;
private int e = -1;
private int f = -1;
- private int g = -1;
+ private int g = 0;
private int h = 0;
- private int i = 0;
private boolean inGround = false;
- public boolean fromPlayer = false;
+ public int fromPlayer = 0;
public int shake = 0;
public Entity shooter;
- private int k;
- private int l = 0;
+ private int j;
+ private int an = 0;
private double damage = 2.0D;
- private int n;
- public boolean d = false;
+ private int ap;
public EntityArrow(World world) {
super(world);
- this.b(0.5F, 0.5F);
+ this.a(0.5F, 0.5F);
}
public EntityArrow(World world, double d0, double d1, double d2) {
super(world);
- this.b(0.5F, 0.5F);
+ this.a(0.5F, 0.5F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
}
@@ -41,7 +41,10 @@ public class EntityArrow extends Entity {
public EntityArrow(World world, EntityLiving entityliving, EntityLiving entityliving1, float f, float f1) {
super(world);
this.shooter = entityliving;
- this.fromPlayer = entityliving instanceof EntityHuman;
+ if (entityliving instanceof EntityHuman) {
+ this.fromPlayer = 1;
+ }
+
this.locY = entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D;
double d0 = entityliving1.locX - entityliving.locX;
double d1 = entityliving1.locY + (double) entityliving1.getHeadHeight() - 0.699999988079071D - this.locY;
@@ -65,8 +68,11 @@ public class EntityArrow extends Entity {
public EntityArrow(World world, EntityLiving entityliving, float f) {
super(world);
this.shooter = entityliving;
- this.fromPlayer = entityliving instanceof EntityHuman;
- this.b(0.5F, 0.5F);
+ if (entityliving instanceof EntityHuman) {
+ this.fromPlayer = 1;
+ }
+
+ this.a(0.5F, 0.5F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
@@ -79,7 +85,9 @@ public class EntityArrow extends Entity {
this.shoot(this.motX, this.motY, this.motZ, f * 1.5F, 1.0F);
}
- protected void b() {}
+ protected void a() {
+ this.datawatcher.a(16, Byte.valueOf((byte) 0));
+ }
public void shoot(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
@@ -100,11 +108,11 @@ public class EntityArrow extends Entity {
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.k = 0;
+ this.j = 0;
}
- public void F_() {
- super.F_();
+ public void h_() {
+ super.h_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -112,13 +120,13 @@ public class EntityArrow extends Entity {
this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
}
- int i = this.world.getTypeId(this.e, this.f, this.g);
+ int i = this.world.getTypeId(this.d, this.e, this.f);
if (i > 0) {
- Block.byId[i].updateShape(this.world, this.e, this.f, this.g);
- AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.e, this.f, this.g);
+ Block.byId[i].updateShape(this.world, this.d, this.e, this.f);
+ AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.d, this.e, this.f);
- if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) {
+ if (axisalignedbb != null && axisalignedbb.a(Vec3D.a().create(this.locX, this.locY, this.locZ))) {
this.inGround = true;
}
}
@@ -128,12 +136,12 @@ public class EntityArrow extends Entity {
}
if (this.inGround) {
- i = this.world.getTypeId(this.e, this.f, this.g);
- int j = this.world.getData(this.e, this.f, this.g);
+ int j = this.world.getTypeId(this.d, this.e, this.f);
+ int k = this.world.getData(this.d, this.e, this.f);
- if (i == this.h && j == this.i) {
- ++this.k;
- if (this.k == 1200) {
+ if (j == this.g && k == this.h) {
+ ++this.j;
+ if (this.j == 1200) {
this.die();
}
} else {
@@ -141,32 +149,32 @@ public class EntityArrow extends Entity {
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.k = 0;
- this.l = 0;
+ this.j = 0;
+ this.an = 0;
}
} else {
- ++this.l;
- Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ ++this.an;
+ Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ Vec3D vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
- vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
- vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
+ vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
}
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 k;
float f1;
- for (k = 0; k < list.size(); ++k) {
- Entity entity1 = (Entity) list.get(k);
+ while (iterator.hasNext()) {
+ Entity entity1 = (Entity) iterator.next();
- if (entity1.o_() && (entity1 != this.shooter || this.l >= 5)) {
+ if (entity1.L() && (entity1 != this.shooter || this.an >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
@@ -196,9 +204,9 @@ public class EntityArrow extends Entity {
// CraftBukkit end
if (movingobjectposition.entity != null) {
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
- int l = (int) Math.ceil((double) f2 * this.damage);
+ int l = MathHelper.f((double) f2 * this.damage);
- if (this.d) {
+ if (this.g()) {
l += this.random.nextInt(l / 2 + 2);
}
@@ -222,14 +230,14 @@ public class EntityArrow extends Entity {
// CraftBukkit end
}
- //if (movingobjectposition.entity.damageEntity(damagesource, l)) { // CraftBukkit
+ // if (movingobjectposition.entity.damageEntity(damagesource, l)) { // CraftBukkit - moved up
if (movingobjectposition.entity instanceof EntityLiving) {
- ++((EntityLiving) movingobjectposition.entity).aI;
- if (this.n > 0) {
+ ++((EntityLiving) movingobjectposition.entity).bd;
+ if (this.ap > 0) {
float f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (f3 > 0.0F) {
- movingobjectposition.entity.b_(this.motX * (double) this.n * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.n * 0.6000000238418579D / (double) f3);
+ movingobjectposition.entity.g(this.motX * (double) this.ap * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.ap * 0.6000000238418579D / (double) f3);
}
}
}
@@ -242,14 +250,14 @@ public class EntityArrow extends Entity {
this.motZ *= -0.10000000149011612D;
this.yaw += 180.0F;
this.lastYaw += 180.0F;
- this.l = 0;
+ this.an = 0;
}
} else {
- this.e = movingobjectposition.b;
- this.f = movingobjectposition.c;
- this.g = movingobjectposition.d;
- this.h = this.world.getTypeId(this.e, this.f, this.g);
- this.i = this.world.getData(this.e, this.f, this.g);
+ this.d = movingobjectposition.b;
+ this.e = movingobjectposition.c;
+ this.f = movingobjectposition.d;
+ this.g = this.world.getTypeId(this.d, this.e, this.f);
+ this.h = this.world.getData(this.d, this.e, this.f);
this.motX = (double) ((float) (movingobjectposition.pos.a - this.locX));
this.motY = (double) ((float) (movingobjectposition.pos.b - this.locY));
this.motZ = (double) ((float) (movingobjectposition.pos.c - this.locZ));
@@ -260,13 +268,13 @@ public class EntityArrow extends Entity {
this.world.makeSound(this, "random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.shake = 7;
- this.d = false;
+ this.d(false);
}
}
- if (this.d) {
- for (k = 0; k < 4; ++k) {
- this.world.a("crit", this.locX + this.motX * (double) k / 4.0D, this.locY + this.motY * (double) k / 4.0D, this.locZ + this.motZ * (double) k / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
+ if (this.g()) {
+ for (int i1 = 0; i1 < 4; ++i1) {
+ this.world.a("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);
}
}
@@ -297,8 +305,8 @@ public class EntityArrow extends Entity {
float f4 = 0.99F;
f1 = 0.05F;
- if (this.aU()) {
- for (int i1 = 0; i1 < 4; ++i1) {
+ if (this.H()) {
+ for (int j1 = 0; j1 < 4; ++j1) {
float f5 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f5, this.locY - this.motY * (double) f5, this.locZ - this.motZ * (double) f5, this.motX, this.motY, this.motZ);
@@ -312,40 +320,46 @@ public class EntityArrow extends Entity {
this.motZ *= (double) f4;
this.motY -= (double) f1;
this.setPosition(this.locX, this.locY, this.locZ);
+ this.D();
}
}
public void b(NBTTagCompound nbttagcompound) {
- nbttagcompound.setShort("xTile", (short) this.e);
- nbttagcompound.setShort("yTile", (short) this.f);
- nbttagcompound.setShort("zTile", (short) this.g);
- nbttagcompound.setByte("inTile", (byte) this.h);
- nbttagcompound.setByte("inData", (byte) this.i);
+ nbttagcompound.setShort("xTile", (short) this.d);
+ nbttagcompound.setShort("yTile", (short) this.e);
+ nbttagcompound.setShort("zTile", (short) this.f);
+ nbttagcompound.setByte("inTile", (byte) this.g);
+ nbttagcompound.setByte("inData", (byte) this.h);
nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
- nbttagcompound.setBoolean("player", this.fromPlayer);
+ nbttagcompound.setByte("pickup", (byte) this.fromPlayer);
nbttagcompound.setDouble("damage", this.damage);
}
public void a(NBTTagCompound nbttagcompound) {
- this.e = nbttagcompound.getShort("xTile");
- this.f = nbttagcompound.getShort("yTile");
- this.g = nbttagcompound.getShort("zTile");
- this.h = nbttagcompound.getByte("inTile") & 255;
- this.i = nbttagcompound.getByte("inData") & 255;
+ this.d = nbttagcompound.getShort("xTile");
+ this.e = nbttagcompound.getShort("yTile");
+ this.f = nbttagcompound.getShort("zTile");
+ this.g = nbttagcompound.getByte("inTile") & 255;
+ this.h = nbttagcompound.getByte("inData") & 255;
this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.getByte("inGround") == 1;
- this.fromPlayer = nbttagcompound.getBoolean("player");
if (nbttagcompound.hasKey("damage")) {
this.damage = nbttagcompound.getDouble("damage");
}
+
+ if (nbttagcompound.hasKey("pickup")) {
+ this.fromPlayer = nbttagcompound.getByte("pickup");
+ } else if (nbttagcompound.hasKey("player")) {
+ this.fromPlayer = nbttagcompound.getBoolean("player") ? 1 : 0;
+ }
}
- public void a_(EntityHuman entityhuman) {
- if (!this.world.isStatic) {
+ public void b_(EntityHuman entityhuman) {
+ if (!this.world.isStatic && this.inGround && this.shake <= 0) {
// CraftBukkit start
ItemStack itemstack = new ItemStack(Item.ARROW);
- if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
+ if (this.inGround && this.fromPlayer == 1 && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), 0);
@@ -357,7 +371,13 @@ public class EntityArrow extends Entity {
}
// CraftBukkit end
- if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
+ boolean flag = this.fromPlayer == 1 || this.fromPlayer == 2 && entityhuman.abilities.canInstantlyBuild;
+
+ if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
+ flag = false;
+ }
+
+ if (flag) {
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, 1);
this.die();
@@ -365,19 +385,35 @@ public class EntityArrow extends Entity {
}
}
- public void a(double d0) {
+ public void b(double d0) {
this.damage = d0;
}
- public double k() {
+ public double d() {
return this.damage;
}
- public void b(int i) {
- this.n = i;
+ public void a(int i) {
+ this.ap = i;
}
- public boolean k_() {
+ public boolean an() {
return false;
}
+
+ public void d(boolean flag) {
+ byte b0 = this.datawatcher.getByte(16);
+
+ if (flag) {
+ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
+ } else {
+ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
+ }
+ }
+
+ public boolean g() {
+ byte b0 = this.datawatcher.getByte(16);
+
+ return (b0 & 1) != 0;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
index ca3af516..3ae97b34 100644
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -2,8 +2,8 @@ package net.minecraft.server;
public class EntityBlaze extends EntityMonster {
- private float a = 0.5F;
- private int b;
+ private float d = 0.5F;
+ private int e;
private int g;
public EntityBlaze(World world) {
@@ -11,55 +11,47 @@ public class EntityBlaze extends EntityMonster {
this.texture = "/mob/fire.png";
this.fireProof = true;
this.damage = 6;
- this.aA = 10;
+ this.aV = 10;
}
public int getMaxHealth() {
return 20;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, new Byte((byte) 0));
}
- protected String i() {
+ protected String aQ() {
return "mob.blaze.breathe";
}
- protected String j() {
+ protected String aR() {
return "mob.blaze.hit";
}
- protected String k() {
+ protected String aS() {
return "mob.blaze.death";
}
- public boolean damageEntity(DamageSource damagesource, int i) {
- return super.damageEntity(damagesource, i);
- }
-
- public void die(DamageSource damagesource) {
- super.die(damagesource);
- }
-
- public float b(float f) {
+ public float c(float f) {
return 1.0F;
}
- public void e() {
+ public void d() {
if (!this.world.isStatic) {
- if (this.aT()) {
+ if (this.G()) {
this.damageEntity(DamageSource.DROWN, 1);
}
- --this.b;
- if (this.b <= 0) {
- this.b = 100;
- this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F;
+ --this.e;
+ if (this.e <= 0) {
+ this.e = 100;
+ this.d = 0.5F + (float) this.random.nextGaussian() * 3.0F;
}
- if (this.I() != null && this.I().locY + (double) this.I().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) {
+ if (this.m() != null && this.m().locY + (double) this.m().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.d) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
}
}
@@ -76,13 +68,13 @@ public class EntityBlaze extends EntityMonster {
this.world.a("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
}
- super.e();
+ super.d();
}
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.a(entity);
+ this.k(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));
@@ -92,13 +84,13 @@ public class EntityBlaze extends EntityMonster {
++this.g;
if (this.g == 1) {
this.attackTicks = 60;
- this.a(true);
+ this.e(true);
} else if (this.g <= 4) {
this.attackTicks = 6;
} else {
this.attackTicks = 100;
this.g = 0;
- this.a(false);
+ this.e(false);
}
if (this.g > 1) {
@@ -116,26 +108,18 @@ public class EntityBlaze extends EntityMonster {
}
this.yaw = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
- this.e = true;
+ this.b = true;
}
}
protected void a(float f) {}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
protected int getLootId() {
return Item.BLAZE_ROD.id;
}
public boolean isBurning() {
- return this.A();
+ return this.n();
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -153,11 +137,11 @@ public class EntityBlaze extends EntityMonster {
}
}
- public boolean A() {
+ public boolean n() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
- public void a(boolean flag) {
+ public void e(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
@@ -169,7 +153,7 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
- protected boolean C() {
+ protected boolean o() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index 88b98447..e2d31354 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -13,12 +14,14 @@ import org.bukkit.event.vehicle.VehicleMoveEvent;
public class EntityBoat extends Entity {
- private int a;
+ private boolean a;
private double b;
- private double c;
+ private int c;
private double d;
private double e;
private double f;
+ private double g;
+ private double h;
// CraftBukkit start
public double maxSpeed = 0.4D;
@@ -43,30 +46,32 @@ public class EntityBoat extends Entity {
public EntityBoat(World world) {
super(world);
- this.bf = true;
- this.b(1.5F, 0.6F);
+ this.a = true;
+ this.b = 0.07D;
+ this.m = true;
+ this.a(1.5F, 0.6F);
this.height = this.length / 2.0F;
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
- protected void b() {
+ protected void a() {
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(1));
this.datawatcher.a(19, new Integer(0));
}
- public AxisAlignedBB b_(Entity entity) {
+ public AxisAlignedBB g(Entity entity) {
return entity.boundingBox;
}
- public AxisAlignedBB h() {
+ public AxisAlignedBB E() {
return this.boundingBox;
}
- public boolean e_() {
+ public boolean M() {
return true;
}
@@ -83,7 +88,7 @@ public class EntityBoat extends Entity {
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
- public double x_() {
+ public double X() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@@ -102,10 +107,14 @@ public class EntityBoat extends Entity {
// i = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
- this.d(-this.m());
- this.c(10);
+ this.c(-this.i());
+ this.b(10);
this.setDamage(this.getDamage() + i * 10);
- this.aW();
+ this.K();
+ if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
+ this.setDamage(100);
+ }
+
if (this.getDamage() > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
@@ -121,16 +130,7 @@ public class EntityBoat extends Entity {
this.passenger.mount(this);
}
- int j;
-
- for (j = 0; j < 3; ++j) {
- this.a(Block.WOOD.id, 1, 0.0F);
- }
-
- for (j = 0; j < 2; ++j) {
- this.a(Item.STICK.id, 1, 0.0F);
- }
-
+ this.a(Item.BOAT.id, 1, 0.0F);
this.die();
}
@@ -140,11 +140,11 @@ public class EntityBoat extends Entity {
}
}
- public boolean o_() {
+ public boolean L() {
return !this.dead;
}
- public void F_() {
+ public void h_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@@ -153,9 +153,9 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
- super.F_();
- if (this.l() > 0) {
- this.c(this.l() - 1);
+ super.h_();
+ if (this.h() > 0) {
+ this.b(this.h() - 1);
}
if (this.getDamage() > 0) {
@@ -171,7 +171,7 @@ public class EntityBoat extends Entity {
for (int i = 0; i < b0; ++i) {
double d1 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 0) / (double) b0 - 0.125D;
double d2 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 1) / (double) b0 - 0.125D;
- AxisAlignedBB axisalignedbb = AxisAlignedBB.b(this.boundingBox.a, d1, this.boundingBox.c, this.boundingBox.d, d2, this.boundingBox.f);
+ AxisAlignedBB axisalignedbb = AxisAlignedBB.a().a(this.boundingBox.a, d1, this.boundingBox.c, this.boundingBox.d, d2, this.boundingBox.f);
if (this.world.b(axisalignedbb, Material.WATER)) {
d0 += 1.0D / (double) b0;
@@ -182,7 +182,7 @@ public class EntityBoat extends Entity {
double d4;
double d5;
- if (d3 > 0.15D) {
+ if (d3 > 0.26249999999999996D) {
d4 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D);
d5 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D);
@@ -207,25 +207,17 @@ public class EntityBoat extends Entity {
double d10;
double d11;
- if (this.world.isStatic) {
- if (this.a > 0) {
- d4 = this.locX + (this.b - this.locX) / (double) this.a;
- d5 = this.locY + (this.c - this.locY) / (double) this.a;
- d10 = this.locZ + (this.d - this.locZ) / (double) this.a;
-
- for (d11 = this.e - (double) this.yaw; d11 < -180.0D; d11 += 360.0D) {
- ;
- }
-
- while (d11 >= 180.0D) {
- d11 -= 360.0D;
- }
-
- this.yaw = (float) ((double) this.yaw + d11 / (double) this.a);
- this.pitch = (float) ((double) this.pitch + (this.f - (double) this.pitch) / (double) this.a);
- --this.a;
+ if (this.world.isStatic && this.a) {
+ if (this.c > 0) {
+ d4 = this.locX + (this.d - this.locX) / (double) this.c;
+ d5 = this.locY + (this.e - this.locY) / (double) this.c;
+ d10 = this.locZ + (this.f - this.locZ) / (double) this.c;
+ d11 = MathHelper.g(this.g - (double) this.yaw);
+ this.yaw = (float) ((double) this.yaw + d11 / (double) this.c);
+ this.pitch = (float) ((double) this.pitch + (this.h - (double) this.pitch) / (double) this.c);
+ --this.c;
this.setPosition(d4, d5, d10);
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
} else {
d4 = this.locX + this.motX;
d5 = this.locY + this.motY;
@@ -254,8 +246,8 @@ public class EntityBoat extends Entity {
}
if (this.passenger != null) {
- this.motX += this.passenger.motX * occupiedDeceleration; // CraftBukkit
- this.motZ += this.passenger.motZ * occupiedDeceleration; // CraftBukkit
+ this.motX += this.passenger.motX * this.b;
+ this.motZ += this.passenger.motZ * this.b;
}
// CraftBukkit start - block not in vanilla
else if (unoccupiedDeceleration >= 0) {
@@ -271,25 +263,27 @@ public class EntityBoat extends Entity {
}
// CraftBukkit end
- // CraftBukkit
- d4 = this.maxSpeed;
- if (this.motX < -d4) {
- this.motX = -d4;
- }
-
- if (this.motX > d4) {
- this.motX = d4;
+ d4 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+ if (d4 > 0.35D) {
+ d5 = 0.35D / d4;
+ this.motX *= d5;
+ this.motZ *= d5;
+ d4 = 0.35D;
}
- if (this.motZ < -d4) {
- this.motZ = -d4;
- }
-
- if (this.motZ > d4) {
- this.motZ = d4;
+ if (d4 > d3 && this.b < 0.35D) {
+ this.b += (0.35D - this.b) / 35.0D;
+ if (this.b > 0.35D) {
+ this.b = 0.35D;
+ }
+ } else {
+ this.b -= (this.b - 0.07D) / 35.0D;
+ if (this.b < 0.07D) {
+ this.b = 0.07D;
+ }
}
- if (this.onGround && !landBoats) { // CraftBukkit
+ if (this.onGround && !this.landBoats) { // CraftBukkit
this.motX *= 0.5D;
this.motY *= 0.5D;
this.motZ *= 0.5D;
@@ -302,7 +296,6 @@ public class EntityBoat extends Entity {
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
-
if (!destroyEvent.isCancelled()) {
this.die();
@@ -328,19 +321,11 @@ public class EntityBoat extends Entity {
d5 = (double) this.yaw;
d10 = this.lastX - this.locX;
d11 = this.lastZ - this.locZ;
- if (d10 * d10 + d11 * d11 > 0.0010D) {
+ if (d10 * d10 + d11 * d11 > 0.001D) {
d5 = (double) ((float) (Math.atan2(d11, d10) * 180.0D / 3.141592653589793D));
}
- double d12;
-
- for (d12 = d5 - (double) this.yaw; d12 >= 180.0D; d12 -= 360.0D) {
- ;
- }
-
- while (d12 < -180.0D) {
- d12 += 360.0D;
- }
+ double d12 = MathHelper.g(d5 - (double) this.yaw);
if (d12 > 20.0D) {
d12 = 20.0D;
@@ -351,7 +336,7 @@ public class EntityBoat extends Entity {
}
this.yaw = (float) ((double) this.yaw + d12);
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
// CraftBukkit start
org.bukkit.Server server = this.world.getServer();
@@ -369,42 +354,53 @@ public class EntityBoat extends Entity {
}
// CraftBukkit end
- List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- int l;
+ if (!this.world.isStatic) {
+ List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ if (list != null && !list.isEmpty()) {
+ Iterator iterator = list.iterator();
- if (list != null && list.size() > 0) {
- for (l = 0; l < list.size(); ++l) {
- Entity entity = (Entity) list.get(l);
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
- if (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) {
- entity.collide(this);
+ if (entity != this.passenger && entity.M() && entity instanceof EntityBoat) {
+ entity.collide(this);
+ }
}
}
- }
- for (l = 0; l < 4; ++l) {
- int i1 = MathHelper.floor(this.locX + ((double) (l % 2) - 0.5D) * 0.8D);
- int j1 = MathHelper.floor(this.locY);
- int k1 = MathHelper.floor(this.locZ + ((double) (l / 2) - 0.5D) * 0.8D);
+ for (int 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);
+
+ for (int k1 = 0; k1 < 2; ++k1) {
+ int l1 = MathHelper.floor(this.locY) + k1;
+ int i2 = this.world.getTypeId(i1, l1, j1);
+ int j2 = this.world.getData(i1, l1, j1);
- if (this.world.getTypeId(i1, j1, k1) == Block.SNOW.id) {
- this.world.setTypeId(i1, j1, k1, 0);
+ if (i2 == Block.SNOW.id) {
+ this.world.setTypeId(i1, l1, j1, 0);
+ } else if (i2 == Block.WATER_LILY.id) {
+ Block.WATER_LILY.dropNaturally(this.world, i1, l1, j1, j2, 0.3F, 0);
+ this.world.setTypeId(i1, l1, j1, 0);
+ }
+ }
}
- }
- if (this.passenger != null && this.passenger.dead) {
- this.passenger.vehicle = null; // CraftBukkit
- this.passenger = null;
+ if (this.passenger != null && this.passenger.dead) {
+ this.passenger.vehicle = null; // CraftBukkit
+ this.passenger = null;
+ }
}
}
}
- public void i_() {
+ public void V() {
if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
- this.passenger.setPosition(this.locX + d0, this.locY + this.x_() + this.passenger.W(), this.locZ + d1);
+ this.passenger.setPosition(this.locX + d0, this.locY + this.X() + this.passenger.W(), this.locZ + d1);
}
}
@@ -412,7 +408,7 @@ public class EntityBoat extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
} else {
@@ -432,19 +428,19 @@ public class EntityBoat extends Entity {
return this.datawatcher.getInt(19);
}
- public void c(int i) {
+ public void b(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
- public int l() {
+ public int h() {
return this.datawatcher.getInt(17);
}
- public void d(int i) {
+ public void c(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
- public int m() {
+ public int i() {
return this.datawatcher.getInt(18);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index ce0bf76b..dbf69a39 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -2,9 +2,9 @@ package net.minecraft.server;
public class EntityChicken extends EntityAnimal {
- public boolean a = false;
- public float b = 0.0F;
- public float c = 0.0F;
+ public boolean d = false;
+ public float e = 0.0F;
+ public float f = 0.0F;
public float g;
public float h;
public float i = 1.0F;
@@ -13,7 +13,7 @@ public class EntityChicken extends EntityAnimal {
public EntityChicken(World world) {
super(world);
this.texture = "/mob/chicken.png";
- this.b(0.3F, 0.7F);
+ this.a(0.3F, 0.7F);
this.j = this.random.nextInt(6000) + 6000;
float f = 0.25F;
@@ -27,7 +27,7 @@ public class EntityChicken extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -35,17 +35,17 @@ public class EntityChicken extends EntityAnimal {
return 4;
}
- public void e() {
- super.e();
- this.h = this.b;
- this.g = this.c;
- this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D);
- if (this.c < 0.0F) {
- this.c = 0.0F;
+ public void d() {
+ super.d();
+ this.h = this.e;
+ this.g = this.f;
+ this.f = (float) ((double) this.f + (double) (this.onGround ? -1 : 4) * 0.3D);
+ if (this.f < 0.0F) {
+ this.f = 0.0F;
}
- if (this.c > 1.0F) {
- this.c = 1.0F;
+ if (this.f > 1.0F) {
+ this.f = 1.0F;
}
if (!this.onGround && this.i < 1.0F) {
@@ -57,7 +57,7 @@ public class EntityChicken extends EntityAnimal {
this.motY *= 0.6D;
}
- this.b += this.i * 2.0F;
+ this.e += this.i * 2.0F;
if (!this.isBaby() && !this.world.isStatic && --this.j <= 0) {
this.world.makeSound(this, "mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.b(Item.EGG.id, 1);
@@ -67,23 +67,15 @@ public class EntityChicken extends EntityAnimal {
protected void a(float f) {}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
- protected String i() {
+ protected String aQ() {
return "mob.chicken";
}
- protected String j() {
+ protected String aR() {
return "mob.chickenhurt";
}
- protected String k() {
+ protected String aS() {
return "mob.chickenhurt";
}
diff --git a/src/main/java/net/minecraft/server/EntityComplex.java b/src/main/java/net/minecraft/server/EntityComplex.java
index fea2046e..e11f6d2b 100644
--- a/src/main/java/net/minecraft/server/EntityComplex.java
+++ b/src/main/java/net/minecraft/server/EntityComplex.java
@@ -2,14 +2,14 @@ package net.minecraft.server;
public class EntityComplex extends EntityLiving {
- protected int t = 100;
+ protected int a = 100;
public EntityComplex(World world) {
super(world);
}
public int getMaxHealth() {
- return this.t;
+ return this.a;
}
public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, int i) {
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 2b7d341f..136e75b0 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -1,14 +1,17 @@
package net.minecraft.server;
-import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+// CraftBukkit end
public class EntityCow extends EntityAnimal {
public EntityCow(World world) {
super(world);
this.texture = "/mob/cow.png";
- this.b(0.9F, 1.3F);
- this.al().a(true);
+ this.a(0.9F, 1.3F);
+ this.getNavigation().a(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 0.2F));
@@ -19,7 +22,7 @@ public class EntityCow extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -27,27 +30,19 @@ public class EntityCow extends EntityAnimal {
return 10;
}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
- protected String i() {
+ protected String aQ() {
return "mob.cow";
}
- protected String j() {
+ protected String aR() {
return "mob.cowhurt";
}
- protected String k() {
+ protected String aS() {
return "mob.cowhurt";
}
- protected float p() {
+ protected float aP() {
return 0.4F;
}
@@ -60,6 +55,8 @@ public class EntityCow extends EntityAnimal {
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
+ int k;
+
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, j));
}
@@ -74,7 +71,7 @@ public class EntityCow extends EntityAnimal {
// CraftBukkit end
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
@@ -86,12 +83,16 @@ public class EntityCow extends EntityAnimal {
return false;
}
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, org.bukkit.craftbukkit.inventory.CraftItemStack.createNMSItemStack(event.getItemStack()));
+ if (--itemstack.count <= 0) {
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, CraftItemStack.createNMSItemStack(event.getItemStack()));
+ } else if (!entityhuman.inventory.pickup(new ItemStack(Item.MILK_BUCKET))) {
+ entityhuman.drop(CraftItemStack.createNMSItemStack(event.getItemStack()));
+ }
// CraftBukkit end
return true;
} else {
- return super.b(entityhuman);
+ return super.c(entityhuman);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index 3f7914d7..d7cb6bf2 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -9,24 +9,24 @@ public abstract class EntityCreature extends EntityLiving {
public PathEntity pathEntity; // CraftBukkit - public
public Entity target; // CraftBukkit - public
- protected boolean e = false;
- protected int f = 0;
+ protected boolean b = false;
+ protected int c = 0;
public EntityCreature(World world) {
super(world);
}
- protected boolean F() {
+ protected boolean i() {
return false;
}
- protected void d_() {
- // MethodProfiler.a("ai"); // CraftBukkit - not in production code
- if (this.f > 0) {
- --this.f;
+ protected void be() {
+ // this.world.methodProfiler.a("ai"); // CraftBukkit - not in production code
+ if (this.c > 0) {
+ --this.c;
}
- this.e = this.F();
+ this.b = this.i();
float f = 16.0F;
if (this.target == null) {
@@ -49,7 +49,13 @@ public abstract class EntityCreature extends EntityLiving {
if (this.target != null) {
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
}
- } else if (!this.target.isAlive()) {
+ } else if (this.target.isAlive()) {
+ float f1 = this.target.d((Entity) this);
+
+ if (this.l(this.target)) {
+ this.a(this.target, f1);
+ }
+ } else {
// CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
this.world.getServer().getPluginManager().callEvent(event);
@@ -62,30 +68,22 @@ public abstract class EntityCreature extends EntityLiving {
}
}
// CraftBukkit end
- } else {
- float f1 = this.target.i(this);
-
- if (this.h(this.target)) {
- this.a(this.target, f1);
- } else {
- this.b(this.target, f1);
- }
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
- if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ 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.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aV < 100) {
- this.G();
+ } else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bq < 100) {
+ this.j();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
- boolean flag = this.aU();
- boolean flag1 = this.aV();
+ boolean flag = this.H();
+ boolean flag1 = this.J();
this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
- // MethodProfiler.a("followpath"); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("followpath"); // CraftBukkit - not in production code
Vec3D vec3d = this.pathEntity.a((Entity) this);
double d0 = (double) (this.width * 2.0F);
@@ -99,23 +97,16 @@ public abstract class EntityCreature extends EntityLiving {
}
}
- this.aZ = false;
+ this.bu = false;
if (vec3d != null) {
double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ;
double d3 = vec3d.b - (double) i;
// CraftBukkit - Math -> TrigMath
float f2 = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
- float f3 = f2 - this.yaw;
-
- for (this.aX = this.bb; f3 < -180.0F; f3 += 360.0F) {
- ;
- }
-
- while (f3 >= 180.0F) {
- f3 -= 360.0F;
- }
+ float f3 = MathHelper.g(f2 - this.yaw);
+ this.bs = this.bw;
if (f3 > 30.0F) {
f3 = 30.0F;
}
@@ -125,19 +116,19 @@ public abstract class EntityCreature extends EntityLiving {
}
this.yaw += f3;
- if (this.e && this.target != null) {
+ if (this.b && this.target != null) {
double d4 = this.target.locX - this.locX;
double d5 = this.target.locZ - this.locZ;
float f4 = this.yaw;
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
- this.aW = -MathHelper.sin(f3) * this.aX * 1.0F;
- this.aX = MathHelper.cos(f3) * this.aX * 1.0F;
+ this.br = -MathHelper.sin(f3) * this.bs * 1.0F;
+ this.bs = MathHelper.cos(f3) * this.bs * 1.0F;
}
if (d3 > 0.0D) {
- this.aZ = true;
+ this.bu = true;
}
}
@@ -145,23 +136,23 @@ public abstract class EntityCreature extends EntityLiving {
this.a(this.target, 30.0F, 30.0F);
}
- if (this.positionChanged && !this.H()) {
- this.aZ = true;
+ if (this.positionChanged && !this.l()) {
+ this.bu = true;
}
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
- this.aZ = true;
+ this.bu = true;
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
} else {
- super.d_();
+ super.be();
this.pathEntity = null;
}
}
- protected void G() {
- // MethodProfiler.a("stroll"); // CraftBukkit - not in production code
+ protected void j() {
+ // this.world.methodProfiler.a("stroll"); // CraftBukkit - not in production code
boolean flag = false;
int i = -1;
int j = -1;
@@ -187,13 +178,11 @@ public abstract class EntityCreature extends EntityLiving {
this.pathEntity = this.world.a(this, i, j, k, 10.0F, true, false, false, true);
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
}
protected void a(Entity entity, float f) {}
- protected void b(Entity entity, float f) {}
-
public float a(int i, int j, int k) {
return 0.0F;
}
@@ -210,7 +199,7 @@ public abstract class EntityCreature extends EntityLiving {
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
}
- public boolean H() {
+ public boolean l() {
return this.pathEntity != null;
}
@@ -218,7 +207,7 @@ public abstract class EntityCreature extends EntityLiving {
this.pathEntity = pathentity;
}
- public Entity I() {
+ public Entity m() {
return this.target;
}
@@ -226,13 +215,13 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity;
}
- protected float J() {
- if (this.c_()) {
+ protected float bs() {
+ if (this.aV()) {
return 1.0F;
} else {
- float f = super.J();
+ float f = super.bs();
- if (this.f > 0) {
+ if (this.c > 0) {
f *= 2.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 8f943210..175be784 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -8,7 +8,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
public class EntityCreeper extends EntityMonster {
int fuseTicks;
- int b;
+ int e;
private int record = -1; // CraftBukkit
public EntityCreeper(World world) {
@@ -25,7 +25,7 @@ public class EntityCreeper extends EntityMonster {
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -33,8 +33,8 @@ public class EntityCreeper extends EntityMonster {
return 20;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, Byte.valueOf((byte) -1));
this.datawatcher.a(17, Byte.valueOf((byte) 0));
}
@@ -51,10 +51,10 @@ public class EntityCreeper extends EntityMonster {
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0)));
}
- public void F_() {
+ public void h_() {
if (this.isAlive()) {
- this.b = this.fuseTicks;
- int i = this.A();
+ this.e = this.fuseTicks;
+ int i = this.p();
if (i > 0 && this.fuseTicks == 0) {
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
@@ -67,30 +67,31 @@ public class EntityCreeper extends EntityMonster {
if (this.fuseTicks >= 30) {
this.fuseTicks = 30;
- // CraftBukkit start
- float radius = this.isPowered() ? 6.0F : 3.0F;
-
- ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (!event.isCancelled()) {
- this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
- this.die();
- } else {
- this.fuseTicks = 0;
+ if (!this.world.isStatic) {
+ // CraftBukkit start
+ float radius = this.isPowered() ? 6.0F : 3.0F;
+
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
+ this.die();
+ } else {
+ this.fuseTicks = 0;
+ }
+ // CraftBukkit end
}
- // CraftBukkit end
}
}
- super.F_();
+ super.h_();
}
- protected String j() {
+ protected String aR() {
return "mob.creeper";
}
- protected String k() {
+ protected String aS() {
return "mob.creeperdeath";
}
@@ -100,6 +101,7 @@ public class EntityCreeper extends EntityMonster {
// this.b(Item.RECORD_1.id + this.random.nextInt(10), 1); // CraftBukkit
this.record = Item.RECORD_1.id + this.random.nextInt(10);
}
+
super.die(damagesource);
// CraftBukkit end
}
@@ -132,7 +134,7 @@ public class EntityCreeper extends EntityMonster {
}
// CraftBukkit end
- public boolean a(Entity entity) {
+ public boolean k(Entity entity) {
return true;
}
@@ -144,19 +146,18 @@ public class EntityCreeper extends EntityMonster {
return Item.SULPHUR.id;
}
- public int A() {
+ public int p() {
return this.datawatcher.getByte(16);
}
- public void c(int i) {
+ public void a(int i) {
this.datawatcher.watch(16, Byte.valueOf((byte) i));
}
- public void a(EntityWeatherLighting entityweatherlighting) {
- super.a(entityweatherlighting);
-
+ public void a(EntityLightning entitylightning) {
+ super.a(entitylightning);
// CraftBukkit start
- if (CraftEventFactory.callCreeperPowerEvent(this, entityweatherlighting, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
+ if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
return;
}
diff --git a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
index b8ceace5..9222a1bb 100644
--- a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
+++ b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
@@ -9,8 +9,8 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
this.owner = entity1;
}
- public Entity b() {
- return this.a;
+ public Entity f() {
+ return this.o;
}
public Entity getEntity() {
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java
index 2ef13243..a7006491 100644
--- a/src/main/java/net/minecraft/server/EntityEgg.java
+++ b/src/main/java/net/minecraft/server/EntityEgg.java
@@ -23,8 +23,8 @@ public class EntityEgg extends EntityProjectile {
}
protected void a(MovingObjectPosition movingobjectposition) {
- if (movingobjectposition.entity != null && movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0)) {
- ;
+ if (movingobjectposition.entity != null) {
+ movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
}
// CraftBukkit start
@@ -50,7 +50,6 @@ public class EntityEgg extends EntityProjectile {
if (hatching) {
for (int k = 0; k < numHatching; k++) {
org.bukkit.entity.Entity entity = world.getWorld().spawn(new org.bukkit.Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG);
-
if (entity instanceof Ageable) {
((Ageable) entity).setBaby();
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
index a137ba03..641dc654 100644
--- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java
+++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
@@ -7,22 +7,22 @@ public class EntityEnderCrystal extends Entity {
public EntityEnderCrystal(World world) {
super(world);
- this.bf = true;
- this.b(2.0F, 2.0F);
+ this.m = true;
+ this.a(2.0F, 2.0F);
this.height = this.length / 2.0F;
this.b = 5;
this.a = this.random.nextInt(100000);
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
- protected void b() {
+ protected void a() {
this.datawatcher.a(8, Integer.valueOf(this.b));
}
- public void F_() {
+ public void h_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -41,24 +41,23 @@ public class EntityEnderCrystal extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
- public boolean o_() {
+ public boolean L() {
return true;
}
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
+
this.b = 0;
if (this.b <= 0) {
+ this.die();
if (!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.die();
- this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F); // CraftBukkit - (Entity) null -> this.
- } else {
- this.die();
+ this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F); // CraftBukkit - (Entity) null -> this
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 470c09b8..51411bef 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -15,43 +15,43 @@ import org.bukkit.Bukkit;
public class EntityEnderDragon extends EntityComplex {
- public double a;
public double b;
public double c;
- public double[][] d = new double[64][3];
- public int e = -1;
+ public double d;
+ public double[][] e = new double[64][3];
+ public int f = -1;
public EntityComplexPart[] children;
- public EntityComplexPart g;
public EntityComplexPart h;
public EntityComplexPart i;
public EntityComplexPart j;
- public EntityComplexPart k;
- public EntityComplexPart l;
- public EntityComplexPart m;
- public float n = 0.0F;
- public float o = 0.0F;
- public boolean p = false;
- public boolean q = false;
- private Entity u;
- public int r = 0;
- public EntityEnderCrystal s = null;
+ public EntityComplexPart by;
+ public EntityComplexPart bz;
+ public EntityComplexPart bA;
+ public EntityComplexPart bB;
+ public float bC = 0.0F;
+ public float bD = 0.0F;
+ public boolean bE = false;
+ public boolean bF = false;
+ private Entity bI;
+ public int bG = 0;
+ public EntityEnderCrystal bH = 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.k = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.l = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.m = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
- this.t = 200;
- this.setHealth(this.t);
+ this.children = new EntityComplexPart[] { this.h = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.i = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.by = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bz = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bA = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bB = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
+ this.a = 200;
+ this.setHealth(this.a);
this.texture = "/mob/enderdragon/ender.png";
- this.b(16.0F, 8.0F);
- this.bQ = true;
+ this.a(16.0F, 8.0F);
+ this.X = true;
this.fireProof = true;
- this.b = 100.0D;
- this.cd = true;
+ this.c = 100.0D;
+ this.ak = true;
}
- protected void b() {
- super.b();
- this.datawatcher.a(16, new Integer(this.t));
+ protected void a() {
+ super.a();
+ this.datawatcher.a(16, new Integer(this.a));
}
public double[] a(int i, float f) {
@@ -60,31 +60,22 @@ public class EntityEnderDragon extends EntityComplex {
}
f = 1.0F - f;
- int j = this.e - i * 1 & 63;
- int k = this.e - i * 1 - 1 & 63;
+ int j = this.f - i * 1 & 63;
+ int k = this.f - i * 1 - 1 & 63;
double[] adouble = new double[3];
- double d0 = this.d[j][0];
-
- double d1;
-
- for (d1 = this.d[k][0] - d0; d1 < -180.0D; d1 += 360.0D) {
- ;
- }
-
- while (d1 >= 180.0D) {
- d1 -= 360.0D;
- }
+ double d0 = this.e[j][0];
+ double d1 = MathHelper.g(this.e[k][0] - d0);
adouble[0] = d0 + d1 * (double) f;
- d0 = this.d[j][1];
- d1 = this.d[k][1] - d0;
+ d0 = this.e[j][1];
+ d1 = this.e[k][1] - d0;
adouble[1] = d0 + d1 * (double) f;
- adouble[2] = this.d[j][2] + (this.d[k][2] - this.d[j][2]) * (double) f;
+ adouble[2] = this.e[j][2] + (this.e[k][2] - this.e[j][2]) * (double) f;
return adouble;
}
- public void e() {
- this.n = this.o;
+ public void d() {
+ this.bC = this.bD;
if (!this.world.isStatic) {
this.datawatcher.watch(16, Integer.valueOf(this.health));
}
@@ -99,36 +90,29 @@ public class EntityEnderDragon extends EntityComplex {
f1 = (this.random.nextFloat() - 0.5F) * 8.0F;
this.world.a("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) d05, this.locZ + (double) f1, 0.0D, 0.0D, 0.0D);
} else {
- this.A();
+ this.j();
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.q) {
- this.o += f * 0.5F;
+ if (this.bF) {
+ this.bD += f * 0.5F;
} else {
- this.o += f;
+ this.bD += f;
}
- while (this.yaw >= 180.0F) {
- this.yaw -= 360.0F;
- }
-
- while (this.yaw < -180.0F) {
- this.yaw += 360.0F;
- }
-
- if (this.e < 0) {
- for (int i = 0; i < this.d.length; ++i) {
- this.d[i][0] = (double) this.yaw;
- this.d[i][1] = this.locY;
+ this.yaw = MathHelper.g(this.yaw);
+ if (this.f < 0) {
+ for (int i = 0; i < this.e.length; ++i) {
+ this.e[i][0] = (double) this.yaw;
+ this.e[i][1] = this.locY;
}
}
- if (++this.e == this.d.length) {
- this.e = 0;
+ if (++this.f == this.e.length) {
+ this.f = 0;
}
- this.d[this.e][0] = (double) this.yaw;
- this.d[this.e][1] = this.locY;
+ this.e[this.f][0] = (double) this.yaw;
+ this.e[this.f][1] = this.locY;
double d0;
double d1;
double d2;
@@ -136,35 +120,27 @@ public class EntityEnderDragon extends EntityComplex {
float f3;
if (this.world.isStatic) {
- if (this.aN > 0) {
- d0 = this.locX + (this.aO - this.locX) / (double) this.aN;
- d1 = this.locY + (this.aP - this.locY) / (double) this.aN;
- d2 = this.locZ + (this.aQ - this.locZ) / (double) this.aN;
-
- for (d3 = this.aR - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
- ;
- }
-
- while (d3 >= 180.0D) {
- d3 -= 360.0D;
- }
-
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.aN);
- this.pitch = (float) ((double) this.pitch + (this.aS - (double) this.pitch) / (double) this.aN);
- --this.aN;
+ if (this.bi > 0) {
+ d0 = this.locX + (this.bj - this.locX) / (double) this.bi;
+ d1 = this.locY + (this.bk - this.locY) / (double) this.bi;
+ d2 = this.locZ + (this.bl - this.locZ) / (double) this.bi;
+ d3 = MathHelper.g(this.bm - (double) this.yaw);
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.bi);
+ this.pitch = (float) ((double) this.pitch + (this.bn - (double) this.pitch) / (double) this.bi);
+ --this.bi;
this.setPosition(d0, d1, d2);
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
}
} else {
- d0 = this.a - this.locX;
- d1 = this.b - this.locY;
- d2 = this.c - this.locZ;
+ d0 = this.b - this.locX;
+ d1 = this.c - this.locY;
+ d2 = this.d - this.locZ;
d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (this.u != null) {
- this.a = this.u.locX;
- this.c = this.u.locZ;
- double d4 = this.a - this.locX;
- double d5 = this.c - this.locZ;
+ if (this.bI != null) {
+ this.b = this.bI.locX;
+ this.d = this.bI.locZ;
+ double d4 = this.b - this.locX;
+ double d5 = this.d - this.locZ;
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
double d7 = 0.4000000059604645D + d6 / 80.0D - 1.0D;
@@ -172,14 +148,14 @@ public class EntityEnderDragon extends EntityComplex {
d7 = 10.0D;
}
- this.b = this.u.boundingBox.b + d7;
+ this.c = this.bI.boundingBox.b + d7;
} else {
- this.a += this.random.nextGaussian() * 2.0D;
- this.c += this.random.nextGaussian() * 2.0D;
+ this.b += this.random.nextGaussian() * 2.0D;
+ this.d += this.random.nextGaussian() * 2.0D;
}
- if (this.p || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.bz) {
- this.E();
+ if (this.bE || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
+ this.k();
}
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
@@ -192,25 +168,10 @@ public class EntityEnderDragon extends EntityComplex {
d1 = (double) f3;
}
- for (this.motY += d1 * 0.10000000149011612D; this.yaw < -180.0F; this.yaw += 360.0F) {
- ;
- }
-
- while (this.yaw >= 180.0F) {
- this.yaw -= 360.0F;
- }
-
+ this.motY += d1 * 0.10000000149011612D;
+ this.yaw = MathHelper.g(this.yaw);
double d8 = 180.0D - Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D;
-
- double d9;
-
- for (d9 = d8 - (double) this.yaw; d9 < -180.0D; d9 += 360.0D) {
- ;
- }
-
- while (d9 >= 180.0D) {
- d9 -= 360.0D;
- }
+ double d9 = MathHelper.g(d8 - (double) this.yaw);
if (d9 > 50.0D) {
d9 = 50.0D;
@@ -220,15 +181,15 @@ public class EntityEnderDragon extends EntityComplex {
d9 = -50.0D;
}
- Vec3D vec3d = Vec3D.create(this.a - this.locX, this.b - this.locY, this.c - this.locZ).b();
- Vec3D vec3d1 = Vec3D.create((double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F), this.motY, (double) (-MathHelper.cos(this.yaw * 3.1415927F / 180.0F))).b();
- float f4 = (float) (vec3d1.a(vec3d) + 0.5D) / 1.5F;
+ Vec3D vec3d = Vec3D.a().create(this.b - this.locX, this.c - this.locY, this.d - this.locZ).b();
+ Vec3D vec3d1 = Vec3D.a().create((double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F), this.motY, (double) (-MathHelper.cos(this.yaw * 3.1415927F / 180.0F))).b();
+ float f4 = (float) (vec3d1.b(vec3d) + 0.5D) / 1.5F;
if (f4 < 0.0F) {
f4 = 0.0F;
}
- this.aY *= 0.8F;
+ this.bt *= 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;
@@ -236,20 +197,20 @@ public class EntityEnderDragon extends EntityComplex {
d10 = 40.0D;
}
- this.aY = (float) ((double) this.aY + d9 * (0.699999988079071D / d10 / (double) f5));
- this.yaw += this.aY * 0.1F;
+ this.bt = (float) ((double) this.bt + d9 * (0.699999988079071D / d10 / (double) f5));
+ this.yaw += this.bt * 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.q) {
+ if (this.bF) {
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
} else {
this.move(this.motX, this.motY, this.motZ);
}
- Vec3D vec3d2 = Vec3D.create(this.motX, this.motY, this.motZ).b();
- float f8 = (float) (vec3d2.a(vec3d1) + 1.0D) / 2.0F;
+ Vec3D vec3d2 = Vec3D.a().create(this.motX, this.motY, this.motZ).b();
+ float f8 = (float) (vec3d2.b(vec3d1) + 1.0D) / 2.0F;
f8 = 0.8F + 0.15F * f8;
this.motX *= (double) f8;
@@ -257,17 +218,17 @@ public class EntityEnderDragon extends EntityComplex {
this.motY *= 0.9100000262260437D;
}
- this.V = this.yaw;
- this.g.width = this.g.length = 3.0F;
- this.i.width = this.i.length = 2.0F;
+ this.aq = this.yaw;
+ this.h.width = this.h.length = 3.0F;
this.j.width = this.j.length = 2.0F;
- this.k.width = this.k.length = 2.0F;
- this.h.length = 3.0F;
- this.h.width = 5.0F;
- this.l.length = 2.0F;
- this.l.width = 4.0F;
- this.m.length = 3.0F;
- this.m.width = 4.0F;
+ this.by.width = this.by.length = 2.0F;
+ this.bz.width = this.bz.length = 2.0F;
+ this.i.length = 3.0F;
+ this.i.width = 5.0F;
+ this.bA.length = 2.0F;
+ this.bA.width = 4.0F;
+ this.bB.length = 3.0F;
+ this.bB.width = 4.0F;
d05 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
f1 = MathHelper.cos(d05);
float f9 = -MathHelper.sin(d05);
@@ -275,72 +236,68 @@ public class EntityEnderDragon extends EntityComplex {
float f11 = MathHelper.sin(f10);
float f12 = MathHelper.cos(f10);
- this.h.F_();
- this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
- this.l.F_();
- this.l.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
- this.m.F_();
- this.m.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.C();
- }
-
- if (!this.world.isStatic && this.hurtTicks == 0) { // CraftBukkit
- this.a(this.world.getEntities(this, this.l.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
- this.a(this.world.getEntities(this, this.m.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)));
+ this.i.h_();
+ this.i.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
+ this.bA.h_();
+ this.bA.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
+ this.bB.h_();
+ this.bB.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.bA.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
+ this.a(this.world.getEntities(this, this.bB.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
+ this.b(this.world.getEntities(this, this.h.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.aY * 0.01F);
- float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.aY * 0.01F);
+ f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bt * 0.01F);
+ float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bt * 0.01F);
- this.g.F_();
- this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f1), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f1), 0.0F, 0.0F);
+ this.h.h_();
+ this.h.setPositionRotation(this.locX + (double) (f3 * 5.5F * f1), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f1), 0.0F, 0.0F);
for (int j = 0; j < 3; ++j) {
EntityComplexPart entitycomplexpart = null;
if (j == 0) {
- entitycomplexpart = this.i;
+ entitycomplexpart = this.j;
}
if (j == 1) {
- entitycomplexpart = this.j;
+ entitycomplexpart = this.by;
}
if (j == 2) {
- entitycomplexpart = this.k;
+ entitycomplexpart = this.bz;
}
double[] adouble2 = this.a(12 + j * 2, 1.0F);
- float f14 = this.yaw * 3.1415927F / 180.0F + this.a(adouble2[0] - adouble[0]) * 3.1415927F / 180.0F * 1.0F;
+ float f14 = this.yaw * 3.1415927F / 180.0F + this.b(adouble2[0] - adouble[0]) * 3.1415927F / 180.0F * 1.0F;
float f15 = MathHelper.sin(f14);
float f16 = MathHelper.cos(f14);
float f17 = 1.5F;
float f18 = (float) (j + 1) * 2.0F;
- entitycomplexpart.F_();
+ entitycomplexpart.h_();
entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f1), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f1), 0.0F, 0.0F);
}
if (!this.world.isStatic) {
- this.q = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
+ this.bF = this.a(this.h.boundingBox) | this.a(this.i.boundingBox);
}
}
}
- private void A() {
- if (this.s != null) {
- if (this.s.dead) {
+ private void j() {
+ if (this.bH != null) {
+ if (this.bH.dead) {
if (!this.world.isStatic) {
- this.a(this.g, DamageSource.EXPLOSION, 10);
+ this.a(this.h, DamageSource.EXPLOSION, 10);
}
- this.s = null;
- } else if (this.ticksLived % 10 == 0 && this.health < this.t) {
+ this.bH = null;
+ } else if (this.ticksLived % 10 == 0 && this.health < this.a) {
// CraftBukkit start
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
this.world.getServer().getPluginManager().callEvent(event);
@@ -360,24 +317,22 @@ public class EntityEnderDragon extends EntityComplex {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- double d1 = entity.j(this);
+ EntityEnderCrystal entityendercrystal1 = (EntityEnderCrystal) iterator.next();
+ double d1 = entityendercrystal1.e(this);
if (d1 < d0) {
d0 = d1;
- entityendercrystal = (EntityEnderCrystal) entity;
+ entityendercrystal = entityendercrystal1;
}
}
- this.s = entityendercrystal;
+ this.bH = entityendercrystal;
}
}
- private void C() {}
-
private void a(List list) {
- double d0 = (this.h.boundingBox.a + this.h.boundingBox.d) / 2.0D;
- double d1 = (this.h.boundingBox.c + this.h.boundingBox.f) / 2.0D;
+ double d0 = (this.i.boundingBox.a + this.i.boundingBox.d) / 2.0D;
+ double d1 = (this.i.boundingBox.c + this.i.boundingBox.f) / 2.0D;
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
@@ -388,14 +343,16 @@ public class EntityEnderDragon extends EntityComplex {
double d3 = entity.locZ - d1;
double d4 = d2 * d2 + d3 * d3;
- entity.b_(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
+ entity.g(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
}
}
}
private void b(List list) {
- for (int i = 0; i < list.size(); ++i) {
- Entity entity = (Entity) list.get(i);
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
if (entity instanceof EntityLiving) {
// CraftBukkit start - throw damage events when the dragon attacks
@@ -416,40 +373,32 @@ public class EntityEnderDragon extends EntityComplex {
}
}
- private void E() {
- this.p = false;
- if (this.random.nextInt(2) == 0 && this.world.players.size() > 0) {
- this.u = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
+ private void k() {
+ this.bE = false;
+ if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
+ this.bI = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
} else {
boolean flag = false;
do {
- this.a = 0.0D;
- this.b = (double) (70.0F + this.random.nextFloat() * 50.0F);
- this.c = 0.0D;
- this.a += (double) (this.random.nextFloat() * 120.0F - 60.0F);
- this.c += (double) (this.random.nextFloat() * 120.0F - 60.0F);
- double d0 = this.locX - this.a;
- double d1 = this.locY - this.b;
- double d2 = this.locZ - this.c;
+ this.b = 0.0D;
+ this.c = (double) (70.0F + this.random.nextFloat() * 50.0F);
+ this.d = 0.0D;
+ this.b += (double) (this.random.nextFloat() * 120.0F - 60.0F);
+ this.d += (double) (this.random.nextFloat() * 120.0F - 60.0F);
+ double d0 = this.locX - this.b;
+ double d1 = this.locY - this.c;
+ double d2 = this.locZ - this.d;
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
} while (!flag);
- this.u = null;
+ this.bI = null;
}
}
- private float a(double d0) {
- while (d0 >= 180.0D) {
- d0 -= 360.0D;
- }
-
- while (d0 < -180.0D) {
- d0 += 360.0D;
- }
-
- return (float) d0;
+ private float b(double d0) {
+ return (float) MathHelper.g(d0);
}
private boolean a(AxisAlignedBB axisalignedbb) {
@@ -466,6 +415,7 @@ public class EntityEnderDragon extends EntityComplex {
List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld();
// CraftBukkit end
+
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
for (int i2 = k; i2 <= j1; ++i2) {
@@ -475,7 +425,7 @@ public class EntityEnderDragon extends EntityComplex {
if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id) {
flag1 = true;
// CraftBukkit start - add blocks to list rather than destroying them
- //this.world.setTypeId(k1, l1, i2, 0);
+ // this.world.setTypeId(k1, l1, i2, 0);
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
// CraftBukkit end
} else {
@@ -501,6 +451,7 @@ public class EntityEnderDragon extends EntityComplex {
}
}
// CraftBukkit end
+
double d0 = axisalignedbb.a + (axisalignedbb.d - axisalignedbb.a) * (double) this.random.nextFloat();
double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat();
double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat();
@@ -512,7 +463,7 @@ public class EntityEnderDragon extends EntityComplex {
}
public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, int i) {
- if (entitycomplexpart != this.g) {
+ if (entitycomplexpart != this.h) {
i = i / 4 + 1;
}
@@ -520,10 +471,10 @@ public class EntityEnderDragon extends EntityComplex {
float f1 = MathHelper.sin(f);
float f2 = MathHelper.cos(f);
- 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.u = null;
+ this.b = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
+ this.c = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
+ this.d = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
+ this.bI = null;
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
this.dealDamage(damagesource, i);
}
@@ -531,9 +482,9 @@ public class EntityEnderDragon extends EntityComplex {
return true;
}
- protected void aB() {
- ++this.r;
- if (this.r >= 180 && this.r <= 200) {
+ protected void aI() {
+ ++this.bG;
+ if (this.bG >= 180 && this.bG <= 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;
@@ -544,8 +495,8 @@ public class EntityEnderDragon extends EntityComplex {
int i;
int j;
- if (!this.world.isStatic && this.r > 150 && this.r % 5 == 0) {
- i = expToDrop / 20; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
+ if (!this.world.isStatic && this.bG > 150 && this.bG % 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) {
j = EntityExperienceOrb.getOrbValue(i);
@@ -555,9 +506,9 @@ public class EntityEnderDragon extends EntityComplex {
}
this.move(0.0D, 0.10000000149011612D, 0.0D);
- this.V = this.yaw += 20.0F;
- if (this.r == 200) {
- i = expToDrop - 10 * (expToDrop / 20); // CraftBukkit - drop the remaining experience
+ this.aq = this.yaw += 20.0F;
+ if (this.bG == 200 && !this.world.isStatic) {
+ i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
while (i > 0) {
j = EntityExperienceOrb.getOrbValue(i);
@@ -566,7 +517,6 @@ public class EntityEnderDragon extends EntityComplex {
}
this.a(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
- this.aH();
this.die();
}
}
@@ -585,16 +535,16 @@ public class EntityEnderDragon extends EntityComplex {
for (int i1 = j - b1; i1 <= j + b1; ++i1) {
double d0 = (double) (l - i);
double d1 = (double) (i1 - j);
- double d2 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
+ double d2 = d0 * d0 + d1 * d1;
- if (d2 <= (double) b1 - 0.5D) {
+ if (d2 <= ((double) b1 - 0.5D) * ((double) b1 - 0.5D)) {
if (k < b0) {
- if (d2 <= (double) (b1 - 1) - 0.5D) {
+ if (d2 <= ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
world.setTypeId(l, k, i1, Block.BEDROCK.id);
}
} else if (k > b0) {
world.setTypeId(l, k, i1, 0);
- } else if (d2 > (double) (b1 - 1) - 0.5D) {
+ } else if (d2 > ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
world.setTypeId(l, k, i1, Block.BEDROCK.id);
} else {
world.setTypeId(l, k, i1, Block.ENDER_PORTAL.id);
@@ -637,21 +587,21 @@ public class EntityEnderDragon extends EntityComplex {
BlockEnderPortal.a = false;
}
- protected void aG() {}
+ protected void bb() {}
- public Entity[] bb() {
+ public Entity[] al() {
return this.children;
}
- public boolean o_() {
+ public boolean L() {
return false;
}
// CraftBukkit start
public int getExpReward() {
// This value is equal to the amount of experience dropped while falling from the sky (10 * 1000)
- // plus what is dropped when the dragon hits the ground (10000)
- return 20000;
+ // plus what is dropped when the dragon hits the ground (2000)
+ return 12000;
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index 4878da82..d7351e66 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -17,13 +17,9 @@ public class EntityEnderPearl extends EntityProjectile {
super(world, entityliving);
}
- public EntityEnderPearl(World world, double d0, double d1, double d2) {
- super(world, d0, d1, d2);
- }
-
protected void a(MovingObjectPosition movingobjectposition) {
- if (movingobjectposition.entity != null && movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0)) {
- ;
+ if (movingobjectposition.entity != null) {
+ movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
}
for (int i = 0; i < 32; ++i) {
@@ -31,46 +27,35 @@ public class EntityEnderPearl extends EntityProjectile {
}
if (!this.world.isStatic) {
- // CraftBukkit start - dupe fix + damage event
- boolean teleport = false;
- PlayerTeleportEvent teleEvent = null;
+ if (this.shooter != null && this.shooter instanceof EntityPlayer) {
+ EntityPlayer entityplayer = (EntityPlayer) this.shooter;
- if (this.shooter != null) {
- if (this.shooter instanceof EntityPlayer) {
+ if (!entityplayer.netServerHandler.disconnected && entityplayer.world == this.world) {
+ // CraftBukkit start
CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity;
- teleport = player.isOnline() && player.getWorld() == getBukkitEntity().getWorld();
org.bukkit.Location location = getBukkitEntity().getLocation();
location.setPitch(player.getLocation().getPitch());
location.setYaw(player.getLocation().getYaw());
- if (teleport) {
- teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
- Bukkit.getPluginManager().callEvent(teleEvent);
- teleport = !teleEvent.isCancelled();
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
+ Bukkit.getPluginManager().callEvent(teleEvent);
+ if (!teleEvent.isCancelled()) {
+ ((EntityPlayer) this.shooter).netServerHandler.teleport(teleEvent.getTo());
+ this.shooter.fallDistance = 0.0F;
+
+ EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5);
+ Bukkit.getPluginManager().callEvent(damageEvent);
+
+ if (!damageEvent.isCancelled()) {
+ org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name);
+ ((CraftPlayer) bPlayer).getHandle().invulnerableTicks = -1; // Remove spawning invulnerability
+ bPlayer.setLastDamageCause(damageEvent);
+ ((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, damageEvent.getDamage()); // Damage the new player instead of the old
+ }
}
- } else {
- teleport = true;
- }
- }
-
- if (teleport) {
- if (this.shooter instanceof EntityPlayer) {
- ((EntityPlayer) this.shooter).netServerHandler.teleport(teleEvent.getTo());
- } else {
- this.shooter.enderTeleportTo(this.locX, this.locY, this.locZ);
- }
- this.shooter.fallDistance = 0.0F;
- EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5);
- Bukkit.getPluginManager().callEvent(damageEvent);
-
- if (!damageEvent.isCancelled()) {
- org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name);
- ((CraftPlayer) bPlayer).getHandle().invulnerableTicks = -1; // Remove spawning invulnerability.
- bPlayer.setLastDamageCause(damageEvent);
- ((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, damageEvent.getDamage()); // Damage the new player instead of the old
+ // CraftBukkit end
}
}
- // CraftBukkit end
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index ae251da1..48e9c1bd 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -8,28 +8,28 @@ import org.bukkit.event.entity.EntityTeleportEvent;
public class EntityEnderman extends EntityMonster {
- private static boolean[] b = new boolean[256];
- public boolean a = false;
+ private static boolean[] d = new boolean[256];
+ private int e = 0;
private int g = 0;
- private int h = 0;
public EntityEnderman(World world) {
super(world);
this.texture = "/mob/enderman.png";
- this.bb = 0.2F;
+ this.bw = 0.2F;
this.damage = 7;
- this.b(0.6F, 2.9F);
- this.bP = 1.0F;
+ this.a(0.6F, 2.9F);
+ this.W = 1.0F;
}
public int getMaxHealth() {
return 40;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, new Byte((byte) 0));
this.datawatcher.a(17, new Byte((byte) 0));
+ this.datawatcher.a(18, new Byte((byte) 0));
}
public void b(NBTTagCompound nbttagcompound) {
@@ -48,47 +48,43 @@ public class EntityEnderman extends EntityMonster {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
if (entityhuman != null) {
- if (this.c(entityhuman)) {
- if (this.h++ == 5) {
- this.h = 0;
+ if (this.d(entityhuman)) {
+ if (this.g++ == 5) {
+ this.g = 0;
+ this.e(true);
return entityhuman;
}
} else {
- this.h = 0;
+ this.g = 0;
}
}
return null;
}
- public float b(float f) {
- return super.b(f);
- }
-
- private boolean c(EntityHuman entityhuman) {
+ private boolean d(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.armor[3];
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
return false;
} else {
- Vec3D vec3d = entityhuman.f(1.0F).b();
- Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
+ Vec3D vec3d = entityhuman.i(1.0F).b();
+ Vec3D vec3d1 = Vec3D.a().create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
double d0 = vec3d1.c();
vec3d1 = vec3d1.b();
- double d1 = vec3d.a(vec3d1);
+ double d1 = vec3d.b(vec3d1);
- return d1 > 1.0D - 0.025D / d0 ? entityhuman.h(this) : false;
+ return d1 > 1.0D - 0.025D / d0 ? entityhuman.l(this) : false;
}
}
- public void e() {
- if (this.aT()) {
+ public void d() {
+ if (this.G()) {
this.damageEntity(DamageSource.DROWN, 1);
}
- this.a = this.target != null;
- this.bb = this.target != null ? 6.5F : 0.3F;
+ this.bw = this.target != null ? 6.5F : 0.3F;
int i;
if (!this.world.isStatic) {
@@ -102,7 +98,7 @@ public class EntityEnderman extends EntityMonster {
j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D);
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
l = this.world.getTypeId(i, j, k);
- if (b[l]) {
+ if (d[l]) {
// CraftBukkit start - pickup event
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
this.setCarriedId(this.world.getTypeId(i, j, k));
@@ -119,7 +115,7 @@ public class EntityEnderman extends EntityMonster {
l = this.world.getTypeId(i, j, k);
int i1 = this.world.getTypeId(i, j - 1, k);
- if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
+ if (l == 0 && i1 > 0 && Block.byId[i1].c()) {
// CraftBukkit start - place event
org.bukkit.block.Block bblock = this.world.getWorld().getBlockAt(i, j, k);
@@ -136,56 +132,59 @@ public class EntityEnderman extends EntityMonster {
this.world.a("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.e() && !this.world.isStatic) {
- float f = this.b(1.0F);
+ if (this.world.r() && !this.world.isStatic) {
+ float f = this.c(1.0F);
- if (f > 0.5F && this.world.isChunkLoaded(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.j(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.x();
+ this.e(false);
+ this.n();
}
}
- if (this.aT()) {
+ if (this.G()) {
this.target = null;
- this.x();
+ this.e(false);
+ this.n();
}
- this.aZ = false;
+ this.bu = false;
if (this.target != null) {
this.a(this.target, 100.0F, 100.0F);
}
if (!this.world.isStatic && this.isAlive()) {
if (this.target != null) {
- if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) {
- this.aW = this.aX = 0.0F;
- this.bb = 0.0F;
- if (this.target.j(this) < 16.0D) {
- this.x();
+ if (this.target instanceof EntityHuman && this.d((EntityHuman) this.target)) {
+ this.br = this.bs = 0.0F;
+ this.bw = 0.0F;
+ if (this.target.e((Entity) this) < 16.0D) {
+ this.n();
}
- this.g = 0;
- } else if (this.target.j(this) > 256.0D && this.g++ >= 30 && this.e(this.target)) {
- this.g = 0;
+ this.e = 0;
+ } else if (this.target.e((Entity) this) > 256.0D && this.e++ >= 30 && this.c(this.target)) {
+ this.e = 0;
}
} else {
- this.g = 0;
+ this.e(false);
+ this.e = 0;
}
}
- super.e();
+ super.d();
}
- protected boolean x() {
+ protected boolean n() {
double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D;
double d1 = this.locY + (double) (this.random.nextInt(64) - 32);
double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D;
- return this.b(d0, d1, d2);
+ return this.j(d0, d1, d2);
}
- protected boolean e(Entity entity) {
- Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
+ protected boolean c(Entity entity) {
+ Vec3D vec3d = Vec3D.a().create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
vec3d = vec3d.b();
double d0 = 16.0D;
@@ -193,10 +192,10 @@ public class EntityEnderman extends EntityMonster {
double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.b * d0;
double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0;
- return this.b(d1, d2, d3);
+ return this.j(d1, d2, d3);
}
- protected boolean b(double d0, double d1, double d2) {
+ protected boolean j(double d0, double d1, double d2) {
double d3 = this.locX;
double d4 = this.locY;
double d5 = this.locZ;
@@ -235,7 +234,7 @@ public class EntityEnderman extends EntityMonster {
this.setPosition(to.getX(), to.getY(), to.getZ());
// CraftBukkit end
- if (this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox)) {
+ if (this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox)) {
flag = true;
}
}
@@ -265,15 +264,15 @@ public class EntityEnderman extends EntityMonster {
}
}
- protected String i() {
+ protected String aQ() {
return "mob.endermen.idle";
}
- protected String j() {
+ protected String aR() {
return "mob.endermen.hit";
}
- protected String k() {
+ protected String aS() {
return "mob.endermen.death";
}
@@ -317,31 +316,39 @@ public class EntityEnderman extends EntityMonster {
public boolean damageEntity(DamageSource damagesource, int i) {
if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
- if (this.x()) {
+ if (this.n()) {
return true;
}
}
return false;
} else {
+ if (damagesource.getEntity() instanceof EntityHuman) {
+ this.e(true);
+ }
+
return super.damageEntity(damagesource, i);
}
}
+ public void e(boolean flag) {
+ this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
+ }
+
static {
- b[Block.GRASS.id] = true;
- b[Block.DIRT.id] = true;
- b[Block.SAND.id] = true;
- b[Block.GRAVEL.id] = true;
- b[Block.YELLOW_FLOWER.id] = true;
- b[Block.RED_ROSE.id] = true;
- b[Block.BROWN_MUSHROOM.id] = true;
- b[Block.RED_MUSHROOM.id] = true;
- b[Block.TNT.id] = true;
- b[Block.CACTUS.id] = true;
- b[Block.CLAY.id] = true;
- b[Block.PUMPKIN.id] = true;
- b[Block.MELON.id] = true;
- b[Block.MYCEL.id] = true;
+ d[Block.GRASS.id] = true;
+ d[Block.DIRT.id] = true;
+ d[Block.SAND.id] = true;
+ d[Block.GRAVEL.id] = true;
+ d[Block.YELLOW_FLOWER.id] = true;
+ d[Block.RED_ROSE.id] = true;
+ d[Block.BROWN_MUSHROOM.id] = true;
+ d[Block.RED_MUSHROOM.id] = true;
+ d[Block.TNT.id] = true;
+ d[Block.CACTUS.id] = true;
+ d[Block.CLAY.id] = true;
+ d[Block.PUMPKIN.id] = true;
+ d[Block.MELON.id] = true;
+ d[Block.MYCEL.id] = true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 3217c2d7..c6d8ecd7 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -11,11 +11,11 @@ public class EntityExperienceOrb extends Entity {
public int b = 0;
public int c;
private int d = 5;
- public int value; // CraftBukkit - priv to pub
+ public int value; // CraftBukkit - private -> public
public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) {
super(world);
- this.b(0.5F, 0.5F);
+ this.a(0.5F, 0.5F);
this.height = this.length / 2.0F;
this.setPosition(d0, d1, d2);
this.yaw = (float) (Math.random() * 360.0D);
@@ -25,20 +25,20 @@ public class EntityExperienceOrb extends Entity {
this.value = i;
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
public EntityExperienceOrb(World world) {
super(world);
- this.b(0.25F, 0.25F);
+ this.a(0.25F, 0.25F);
this.height = this.length / 2.0F;
}
- protected void b() {}
+ protected void a() {}
- public void F_() {
- super.F_();
+ public void h_() {
+ super.h_();
if (this.c > 0) {
--this.c;
}
@@ -54,7 +54,7 @@ public class EntityExperienceOrb extends Entity {
this.world.makeSound(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
}
- this.g(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
+ this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
double d0 = 8.0D;
EntityHuman entityhuman = this.world.findNearbyPlayer(this, d0);
@@ -105,7 +105,7 @@ public class EntityExperienceOrb extends Entity {
}
}
- public boolean h_() {
+ public boolean I() {
return this.world.a(this.boundingBox, Material.WATER, this);
}
@@ -114,7 +114,7 @@ public class EntityExperienceOrb extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.aW();
+ this.K();
this.d -= i;
if (this.d <= 0) {
this.die();
@@ -135,10 +135,10 @@ public class EntityExperienceOrb extends Entity {
this.value = nbttagcompound.getShort("Value");
}
- public void a_(EntityHuman entityhuman) {
+ public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
- if (this.c == 0 && entityhuman.x == 0) {
- entityhuman.x = 2;
+ if (this.c == 0 && entityhuman.bL == 0) {
+ entityhuman.bL = 2;
this.world.makeSound(this, "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()
@@ -147,7 +147,7 @@ public class EntityExperienceOrb extends Entity {
}
}
- public int y_() {
+ public int d() {
return this.value;
}
@@ -174,7 +174,7 @@ public class EntityExperienceOrb extends Entity {
return i >= 2477 ? 2477 : (i >= 1237 ? 1237 : (i >= 617 ? 617 : (i >= 307 ? 307 : (i >= 149 ? 149 : (i >= 73 ? 73 : (i >= 37 ? 37 : (i >= 17 ? 17 : (i >= 7 ? 7 : (i >= 3 ? 3 : 1)))))))));
}
- public boolean k_() {
+ public boolean an() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
deleted file mode 100644
index 27b16de3..00000000
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package net.minecraft.server;
-
-public class EntityFallingBlock extends Entity {
-
- public int id;
- public int data; // CraftBukkit
- public int b = 0;
-
- public EntityFallingBlock(World world) {
- super(world);
- }
-
- // CraftBukkit - changed method signature
- public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int data) {
- super(world);
- this.id = i;
- this.bf = true;
- this.data = data; // CraftBukkit
- this.b(0.98F, 0.98F);
- this.height = this.length / 2.0F;
- this.setPosition(d0, d1, d2);
- this.motX = 0.0D;
- this.motY = 0.0D;
- this.motZ = 0.0D;
- this.lastX = d0;
- this.lastY = d1;
- this.lastZ = d2;
- }
-
- protected boolean g_() {
- return false;
- }
-
- protected void b() {}
-
- public boolean o_() {
- return !this.dead;
- }
-
- public void F_() {
- if (this.id == 0) {
- this.die();
- } else {
- this.lastX = this.locX;
- this.lastY = this.locY;
- this.lastZ = this.locZ;
- ++this.b;
- this.motY -= 0.03999999910593033D;
- this.move(this.motX, this.motY, this.motZ);
- this.motX *= 0.9800000190734863D;
- this.motY *= 0.9800000190734863D;
- this.motZ *= 0.9800000190734863D;
- int i = MathHelper.floor(this.locX);
- int j = MathHelper.floor(this.locY);
- int k = MathHelper.floor(this.locZ);
-
- if (this.b == 1 && this.world.getTypeId(i, j, k) == this.id) {
- this.world.setTypeId(i, j, k, 0);
- } else if (!this.world.isStatic && this.b == 1) {
- this.die();
- }
-
- if (this.onGround) {
- this.motX *= 0.699999988079071D;
- this.motZ *= 0.699999988079071D;
- this.motY *= -0.5D;
- if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
- this.die();
- // CraftBukkit - setTypeId => setTypeIdAndData
- if ((!this.world.mayPlace(this.id, i, j, k, true, 1) || BlockSand.canFall(this.world, i, j - 1, k) || !this.world.setTypeIdAndData(i, j, k, this.id, this.data)) && !this.world.isStatic) {
- this.b(this.id, 1);
- }
- }
- } else if (this.b > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.b > 600) {
- this.b(this.id, 1);
- this.die();
- }
- }
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- nbttagcompound.setByte("Tile", (byte) this.id);
- nbttagcompound.setByte("Data", (byte) this.data); // CraftBukkit
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- this.id = nbttagcompound.getByte("Tile") & 255;
- this.data = nbttagcompound.getByte("Data") & 15; // CraftBukkit
- }
-}
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index fac4901c..05a14ab8 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -16,24 +17,23 @@ public class EntityFireball extends Entity {
private boolean i = false;
public EntityLiving shooter;
private int j;
- private int k = 0;
+ private int an = 0;
public double dirX;
public double dirY;
public double dirZ;
-
public float yield = 1; // CraftBukkit
public boolean isIncendiary = true; // CraftBukkit
public EntityFireball(World world) {
super(world);
- this.b(1.0F, 1.0F);
+ this.a(1.0F, 1.0F);
}
- protected void b() {}
+ protected void a() {}
public EntityFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
super(world);
- this.b(1.0F, 1.0F);
+ this.a(1.0F, 1.0F);
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
this.setPosition(d0, d1, d2);
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
@@ -46,7 +46,7 @@ public class EntityFireball extends Entity {
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
super(world);
this.shooter = entityliving;
- this.b(1.0F, 1.0F);
+ this.a(1.0F, 1.0F);
this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.setPosition(this.locX, this.locY, this.locZ);
this.height = 0.0F;
@@ -67,11 +67,11 @@ public class EntityFireball extends Entity {
this.dirZ = d2 / d3 * 0.1D;
}
- public void F_() {
+ public void h_() {
if (!this.world.isStatic && (this.shooter != null && this.shooter.dead || !this.world.isLoaded((int) this.locX, (int) this.locY, (int) this.locZ))) {
this.die();
} else {
- super.F_();
+ super.h_();
this.setOnFire(1);
if (this.i) {
int i = this.world.getTypeId(this.e, this.f, this.g);
@@ -90,29 +90,30 @@ public class EntityFireball extends Entity {
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
- this.k = 0;
+ this.an = 0;
} else {
- ++this.k;
+ ++this.an;
}
- Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ Vec3D vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
- vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
- vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
+ vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
}
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();
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ while (iterator.hasNext()) {
+ Entity entity1 = (Entity) iterator.next();
- if (entity1.o_() && (!entity1.a_((Entity) this.shooter) || this.k >= 25)) {
+ if (entity1.L() && (!entity1.i(this.shooter) || this.an >= 25)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -134,6 +135,7 @@ public class EntityFireball extends Entity {
if (movingobjectposition != null) {
this.a(movingobjectposition);
+
// CraftBukkit start
if (this.dead) {
ProjectileHitEvent phe = new ProjectileHitEvent((org.bukkit.entity.Projectile) this.getBukkitEntity());
@@ -169,8 +171,8 @@ public class EntityFireball extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F;
- if (this.aU()) {
- for (int k = 0; k < 4; ++k) {
+ if (this.H()) {
+ for (int j = 0; j < 4; ++j) {
float f3 = 0.25F;
this.world.a("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);
@@ -192,9 +194,10 @@ public class EntityFireball extends Entity {
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
- if (movingobjectposition.entity != null && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 4)) {
- ;
+ if (movingobjectposition.entity != null) {
+ movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6);
}
+
// CraftBukkit start
ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
this.world.getServer().getPluginManager().callEvent(event);
@@ -214,8 +217,7 @@ public class EntityFireball extends Entity {
nbttagcompound.setShort("zTile", (short) this.g);
nbttagcompound.setByte("inTile", (byte) this.h);
nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
- // CraftBukkit
- nbttagcompound.set("Direction", this.a(new double[] { this.dirX, this.dirY, this.dirZ}));
+ nbttagcompound.set("direction", this.a(new double[] { this.motX, this.motY, this.motZ}));
}
public void a(NBTTagCompound nbttagcompound) {
@@ -224,30 +226,29 @@ public class EntityFireball extends Entity {
this.g = nbttagcompound.getShort("zTile");
this.h = nbttagcompound.getByte("inTile") & 255;
this.i = nbttagcompound.getByte("inGround") == 1;
- // CraftBukkit start
- if (nbttagcompound.hasKey("Direction")) {
- NBTTagList nbttaglist1 = nbttagcompound.getList("Direction");
- this.dirX = ((NBTTagDouble) nbttaglist1.get(0)).data;
- this.dirY = ((NBTTagDouble) nbttaglist1.get(1)).data;
- this.dirZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
+ if (nbttagcompound.hasKey("direction")) {
+ NBTTagList nbttaglist = nbttagcompound.getList("direction");
+
+ this.motX = ((NBTTagDouble) nbttaglist.get(0)).data;
+ this.motY = ((NBTTagDouble) nbttaglist.get(1)).data;
+ this.motZ = ((NBTTagDouble) nbttaglist.get(2)).data;
} else {
this.die();
}
- // CraftBukkit end
}
- public boolean o_() {
+ public boolean L() {
return true;
}
- public float j_() {
+ public float Y() {
return 1.0F;
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.aW();
+ this.K();
if (damagesource.getEntity() != null) {
- Vec3D vec3d = damagesource.getEntity().aJ();
+ Vec3D vec3d = damagesource.getEntity().Z();
if (vec3d != null) {
this.motX = vec3d.a;
@@ -268,7 +269,7 @@ public class EntityFireball extends Entity {
}
}
- public float b(float f) {
+ public float c(float f) {
return 1.0F;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 109c8dec..cb1a6d87 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -18,27 +19,27 @@ public class EntityFishingHook extends Entity {
public EntityHuman owner;
private int i;
private int j = 0;
- private int k = 0;
+ private int an = 0;
public Entity hooked = null;
- private int l;
- private double m;
- private double n;
- private double o;
- private double p;
- private double q;
+ private int ao;
+ private double ap;
+ private double aq;
+ private double ar;
+ private double as;
+ private double at;
public EntityFishingHook(World world) {
super(world);
- this.b(0.25F, 0.25F);
- this.cd = true;
+ this.a(0.25F, 0.25F);
+ this.ak = true;
}
public EntityFishingHook(World world, EntityHuman entityhuman) {
super(world);
- this.cd = true;
+ this.ak = true;
this.owner = entityhuman;
this.owner.hookedFish = this;
- this.b(0.25F, 0.25F);
+ this.a(0.25F, 0.25F);
this.setPositionRotation(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
@@ -50,12 +51,12 @@ public class EntityFishingHook extends Entity {
this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f);
- this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
+ this.c(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
}
- protected void b() {}
+ protected void a() {}
- public void a(double d0, double d1, double d2, float f, float f1) {
+ public void c(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= (double) f2;
@@ -77,33 +78,24 @@ public class EntityFishingHook extends Entity {
this.i = 0;
}
- public void F_() {
- super.F_();
- if (this.l > 0) {
- double d0 = this.locX + (this.m - this.locX) / (double) this.l;
- double d1 = this.locY + (this.n - this.locY) / (double) this.l;
- double d2 = this.locZ + (this.o - this.locZ) / (double) this.l;
-
- double d3;
-
- for (d3 = this.p - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
- ;
- }
-
- while (d3 >= 180.0D) {
- d3 -= 360.0D;
- }
-
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.l);
- this.pitch = (float) ((double) this.pitch + (this.q - (double) this.pitch) / (double) this.l);
- --this.l;
+ public void h_() {
+ super.h_();
+ if (this.ao > 0) {
+ double d0 = this.locX + (this.ap - this.locX) / (double) this.ao;
+ double d1 = this.locY + (this.aq - this.locY) / (double) this.ao;
+ double d2 = this.locZ + (this.ar - this.locZ) / (double) this.ao;
+ double d3 = MathHelper.g(this.as - (double) this.yaw);
+
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.ao);
+ this.pitch = (float) ((double) this.pitch + (this.at - (double) this.pitch) / (double) this.ao);
+ --this.ao;
this.setPosition(d0, d1, d2);
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
- ItemStack itemstack = this.owner.U();
+ ItemStack itemstack = this.owner.bC();
- if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.j(this.owner) > 1024.0D) {
+ if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
this.die();
this.owner.hookedFish = null;
return;
@@ -147,26 +139,27 @@ public class EntityFishingHook extends Entity {
++this.j;
}
- Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ Vec3D vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
- vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
- vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
+ vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
}
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;
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ while (iterator.hasNext()) {
+ Entity entity1 = (Entity) iterator.next();
- if (entity1.o_() && (entity1 != this.owner || this.j >= 5)) {
+ if (entity1.L() && (entity1 != this.owner || this.j >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -228,10 +221,10 @@ public class EntityFishingHook extends Entity {
byte b0 = 5;
double d6 = 0.0D;
- 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.b(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f);
+ 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;
+ 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)) {
d6 += 1.0D / (double) b0;
@@ -239,32 +232,32 @@ public class EntityFishingHook extends Entity {
}
if (d6 > 0.0D) {
- if (this.k > 0) {
- --this.k;
+ if (this.an > 0) {
+ --this.an;
} else {
short short1 = 500;
- if (this.world.y(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
+ if (this.world.B(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
short1 = 300;
}
if (this.random.nextInt(short1) == 0) {
- this.k = this.random.nextInt(30) + 10;
+ this.an = 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);
float f3 = (float) MathHelper.floor(this.boundingBox.b);
float f4;
- int l;
+ int k;
float f5;
- for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
+ for (k = 0; (float) k < 1.0F + this.width * 20.0F; ++k) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.a("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 (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
+ for (k = 0; (float) k < 1.0F + this.width * 20.0F; ++k) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
this.world.a("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ);
@@ -273,7 +266,7 @@ public class EntityFishingHook extends Entity {
}
}
- if (this.k > 0) {
+ if (this.an > 0) {
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
}
@@ -310,80 +303,93 @@ public class EntityFishingHook extends Entity {
this.h = nbttagcompound.getByte("inGround") == 1;
}
- public int k() {
- byte b0 = 0;
+ public int d() {
+ if (this.world.isStatic) {
+ return 0;
+ } else {
+ byte b0 = 0;
- if (this.hooked != null) {
- // CraftBukkit start
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
- this.world.getServer().getPluginManager().callEvent(playerFishEvent);
+ if (this.hooked != null) {
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
- if (playerFishEvent.isCancelled()) {
- this.die();
- this.owner.hookedFish = null;
- return 0;
+ if (playerFishEvent.isCancelled()) {
+ this.die();
+ this.owner.hookedFish = null;
+ return 0;
+ }
+ // CraftBukkit end
+
+ double d0 = this.owner.locX - this.locX;
+ double d1 = this.owner.locY - this.locY;
+ double d2 = this.owner.locZ - this.locZ;
+ double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
+ double d4 = 0.1D;
+
+ this.hooked.motX += d0 * d4;
+ this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
+ this.hooked.motZ += d2 * d4;
+ b0 = 3;
+ } else if (this.an > 0) {
+ EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
+
+ if (playerFishEvent.isCancelled()) {
+ this.die();
+ this.owner.hookedFish = null;
+ return 0;
+ }
+ // CraftBukkit end
+
+ double d5 = this.owner.locX - this.locX;
+ double d6 = this.owner.locY - this.locY;
+ double d7 = this.owner.locZ - this.locZ;
+ double d8 = (double) MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
+ double d9 = 0.1D;
+
+ entityitem.motX = d5 * d9;
+ entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
+ entityitem.motZ = d7 * d9;
+ this.world.addEntity(entityitem);
+ this.owner.a(StatisticList.B, 1);
+ b0 = 1;
}
- // CraftBukkit end
- double d0 = this.owner.locX - this.locX;
- double d1 = this.owner.locY - this.locY;
- double d2 = this.owner.locZ - this.locZ;
- double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
- double d4 = 0.1D;
-
- this.hooked.motX += d0 * d4;
- this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
- this.hooked.motZ += d2 * d4;
- b0 = 3;
- } else if (this.k > 0) {
- EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
- // CraftBukkit start
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
- this.world.getServer().getPluginManager().callEvent(playerFishEvent);
+ if (this.h) {
+ // CraftBukkit start
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.IN_GROUND);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
- if (playerFishEvent.isCancelled()) {
- this.die();
- this.owner.hookedFish = null;
- return 0;
- }
- // CraftBukkit end
+ if (playerFishEvent.isCancelled()) {
+ this.die();
+ this.owner.hookedFish = null;
+ return 0;
+ }
+ // CraftBukkit end
- double d5 = this.owner.locX - this.locX;
- double d6 = this.owner.locY - this.locY;
- double d7 = this.owner.locZ - this.locZ;
- double d8 = (double) MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
- double d9 = 0.1D;
-
- entityitem.motX = d5 * d9;
- entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
- entityitem.motZ = d7 * d9;
- this.world.addEntity(entityitem);
- this.owner.a(StatisticList.B, 1);
- b0 = 1;
- }
+ b0 = 2;
+ }
- if (this.h) {
// CraftBukkit start
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.IN_GROUND);
- this.world.getServer().getPluginManager().callEvent(playerFishEvent);
-
- if (playerFishEvent.isCancelled()) {
- this.die();
- this.owner.hookedFish = null;
- return 0;
+ if (b0 == 0) {
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.FAILED_ATTEMPT);
+ this.world.getServer().getPluginManager().callEvent(playerFishEvent);
}
// CraftBukkit end
- b0 = 2;
+
+ this.die();
+ this.owner.hookedFish = null;
+ return b0;
}
+ }
- // CraftBukkit start
- if (b0 == 0) {
- PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.FAILED_ATTEMPT);
- this.world.getServer().getPluginManager().callEvent(playerFishEvent);
+ public void die() {
+ super.die();
+ if (this.owner != null) {
+ this.owner.hookedFish = null;
}
- // CraftBukkit end
- this.die();
- this.owner.hookedFish = null;
- return b0;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java
index 91a82cc2..e4377eee 100644
--- a/src/main/java/net/minecraft/server/EntityGhast.java
+++ b/src/main/java/net/minecraft/server/EntityGhast.java
@@ -20,9 +20,9 @@ public class EntityGhast extends EntityFlying implements IMonster {
public EntityGhast(World world) {
super(world);
this.texture = "/mob/ghast.png";
- this.b(4.0F, 4.0F);
+ this.a(4.0F, 4.0F);
this.fireProof = true;
- this.aA = 5;
+ this.aV = 5;
}
public boolean damageEntity(DamageSource damagesource, int i) {
@@ -35,8 +35,8 @@ public class EntityGhast extends EntityFlying implements IMonster {
}
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
@@ -44,26 +44,26 @@ public class EntityGhast extends EntityFlying implements IMonster {
return 10;
}
- public void F_() {
- super.F_();
+ public void h_() {
+ super.h_();
byte b0 = this.datawatcher.getByte(16);
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
}
- protected void d_() {
+ protected void be() {
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
- this.aG();
+ this.bb();
this.e = this.f;
double d0 = this.b - this.locX;
double d1 = this.c - this.locY;
double d2 = this.d - this.locZ;
- double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
+ double d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (d3 < 1.0D || d3 > 60.0D) {
+ if (d3 < 1.0D || d3 > 3600.0D) {
this.b = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.c = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
this.d = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
@@ -71,6 +71,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
if (this.a-- <= 0) {
this.a += this.random.nextInt(5) + 2;
+ d3 = (double) MathHelper.sqrt(d3);
if (this.a(this.b, this.c, this.d, d3)) {
this.motX += d0 / d3 * 0.1D;
this.motY += d1 / d3 * 0.1D;
@@ -113,6 +114,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
}
}
// CraftBukkit end
+
if (this.target != null) {
this.h = 20;
}
@@ -120,13 +122,13 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d4 = 64.0D;
- if (this.target != null && this.target.j(this) < d4 * d4) {
+ if (this.target != null && this.target.e((Entity) this) < d4 * d4) {
double d5 = this.target.locX - this.locX;
double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
double d7 = this.target.locZ - this.locZ;
- this.V = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
- if (this.h(this.target)) {
+ this.aq = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
+ if (this.l(this.target)) {
if (this.f == 10) {
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
@@ -136,7 +138,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7);
double d8 = 4.0D;
- Vec3D vec3d = this.f(1.0F);
+ Vec3D vec3d = this.i(1.0F);
entityfireball.locX = this.locX + vec3d.a * d8;
entityfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
@@ -148,7 +150,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
--this.f;
}
} else {
- this.V = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
+ this.aq = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
if (this.f > 0) {
--this.f;
}
@@ -172,7 +174,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
for (int i = 1; (double) i < d3; ++i) {
axisalignedbb.d(d4, d5, d6);
- if (this.world.getCubes(this, axisalignedbb).size() > 0) {
+ if (!this.world.getCubes(this, axisalignedbb).isEmpty()) {
return false;
}
}
@@ -180,15 +182,15 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true;
}
- protected String i() {
+ protected String aQ() {
return "mob.ghast.moan";
}
- protected String j() {
+ protected String aR() {
return "mob.ghast.scream";
}
- protected String k() {
+ protected String aS() {
return "mob.ghast.death";
}
@@ -217,7 +219,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
// CraftBukkit end
}
- protected float p() {
+ protected float aP() {
return 10.0F;
}
@@ -225,7 +227,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
}
- public int q() {
+ public int bl() {
return 1;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 8ce4aeb0..2b09abc5 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -13,28 +13,29 @@ import org.bukkit.event.player.PlayerBedLeaveEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
// CraftBukkit end
-public abstract class EntityHuman extends EntityLiving {
+public abstract class EntityHuman extends EntityLiving implements ICommandListener {
public PlayerInventory inventory = new PlayerInventory(this);
+ private InventoryEnderChest enderChest = new InventoryEnderChest();
public Container defaultContainer;
public Container activeContainer;
protected FoodMetaData foodData = new FoodMetaData();
- protected int o = 0;
- public byte p = 0;
- public int q = 0;
- public float r;
- public float s;
- public boolean t = false;
- public int u = 0;
+ protected int bC = 0;
+ public byte bD = 0;
+ public int bE = 0;
+ public float bF;
+ public float bG;
+ public boolean bH = false;
+ public int bI = 0;
public String name;
public int dimension;
- public int x = 0;
- public double y;
- public double z;
- public double A;
- public double B;
- public double C;
- public double D;
+ public int bL = 0;
+ public double bM;
+ public double bN;
+ public double bO;
+ public double bP;
+ public double bQ;
+ public double bR;
// CraftBukkit start
public boolean sleeping;
public boolean fauxSleeping;
@@ -45,24 +46,24 @@ public abstract class EntityHuman extends EntityLiving {
}
// CraftBukkit end
- public ChunkCoordinates F;
+ public ChunkCoordinates bT;
public int sleepTicks; // CraftBukkit - private -> public
- public float G;
- public float H;
- private ChunkCoordinates b;
+ public float bU;
+ public float bV;
private ChunkCoordinates c;
- public int I = 20;
- protected boolean J = false;
- public float K;
+ private ChunkCoordinates d;
+ public int bW = 20;
+ protected boolean bX = false;
+ public float bY;
public PlayerAbilities abilities = new PlayerAbilities();
public int oldLevel = -1; // CraftBukkit
public int expLevel;
public int expTotal;
public float exp;
- private ItemStack d;
- private int e;
- protected float P = 0.1F;
- protected float Q = 0.02F;
+ private ItemStack e;
+ private int f;
+ protected float cd = 0.1F;
+ protected float ce = 0.02F;
public EntityFishingHook hookedFish = null;
public EntityHuman(World world) {
@@ -73,8 +74,8 @@ public abstract class EntityHuman extends EntityLiving {
ChunkCoordinates chunkcoordinates = world.getSpawn();
this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F);
- this.ah = "humanoid";
- this.ag = 180.0F;
+ this.aC = "humanoid";
+ this.aB = 180.0F;
this.maxFireTicks = 20;
this.texture = "/mob/char.png";
}
@@ -83,55 +84,55 @@ public abstract class EntityHuman extends EntityLiving {
return 20;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
this.datawatcher.a(17, Byte.valueOf((byte) 0));
}
- public boolean M() {
- return this.d != null;
+ public boolean bw() {
+ return this.e != null;
}
- public void N() {
- if (this.d != null) {
- this.d.b(this.world, this, this.e);
+ public void by() {
+ if (this.e != null) {
+ this.e.b(this.world, this, this.f);
}
- this.O();
+ this.bz();
}
- public void O() {
- this.d = null;
- this.e = 0;
+ public void bz() {
+ this.e = null;
+ this.f = 0;
if (!this.world.isStatic) {
- this.i(false);
+ this.c(false);
}
}
- public boolean P() {
- return this.M() && Item.byId[this.d.id].d(this.d) == EnumAnimation.d;
+ public boolean aY() {
+ return this.bw() && Item.byId[this.e.id].b(this.e) == EnumAnimation.d;
}
- public void F_() {
- if (this.d != null) {
+ public void h_() {
+ if (this.e != null) {
ItemStack itemstack = this.inventory.getItemInHand();
- if (itemstack != this.d) {
- this.O();
- } else {
- if (this.e <= 25 && this.e % 4 == 0) {
- this.b(itemstack, 5);
+ if (itemstack == this.e) {
+ if (this.f <= 25 && this.f % 4 == 0) {
+ this.c(itemstack, 5);
}
- if (--this.e == 0 && !this.world.isStatic) {
- this.K();
+ if (--this.f == 0 && !this.world.isStatic) {
+ this.o();
}
+ } else {
+ this.bz();
}
}
- if (this.x > 0) {
- --this.x;
+ if (this.bL > 0) {
+ --this.bL;
}
if (this.isSleeping()) {
@@ -141,9 +142,9 @@ public abstract class EntityHuman extends EntityLiving {
}
if (!this.world.isStatic) {
- if (!this.G()) {
+ if (!this.l()) {
this.a(true, true, false);
- } else if (this.world.e()) {
+ } else if (this.world.r()) {
this.a(false, true, true);
}
}
@@ -154,60 +155,54 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- super.F_();
- if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) {
+ super.h_();
+ if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.c(this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
}
- if (this.abilities.isFlying) {
- for (int i = 0; i < 8; ++i) {
- ;
- }
- }
-
if (this.isBurning() && this.abilities.isInvulnerable) {
this.extinguish();
}
- this.y = this.B;
- this.z = this.C;
- this.A = this.D;
- double d0 = this.locX - this.B;
- double d1 = this.locY - this.C;
- double d2 = this.locZ - this.D;
+ this.bM = this.bP;
+ this.bN = this.bQ;
+ this.bO = this.bR;
+ double d0 = this.locX - this.bP;
+ double d1 = this.locY - this.bQ;
+ double d2 = this.locZ - this.bR;
double d3 = 10.0D;
if (d0 > d3) {
- this.y = this.B = this.locX;
+ this.bM = this.bP = this.locX;
}
if (d2 > d3) {
- this.A = this.D = this.locZ;
+ this.bO = this.bR = this.locZ;
}
if (d1 > d3) {
- this.z = this.C = this.locY;
+ this.bN = this.bQ = this.locY;
}
if (d0 < -d3) {
- this.y = this.B = this.locX;
+ this.bM = this.bP = this.locX;
}
if (d2 < -d3) {
- this.A = this.D = this.locZ;
+ this.bO = this.bR = this.locZ;
}
if (d1 < -d3) {
- this.z = this.C = this.locY;
+ this.bN = this.bQ = this.locY;
}
- this.B += d0 * 0.25D;
- this.D += d2 * 0.25D;
- this.C += d1 * 0.25D;
+ this.bP += d0 * 0.25D;
+ this.bR += d2 * 0.25D;
+ this.bQ += d1 * 0.25D;
this.a(StatisticList.k, 1);
if (this.vehicle == null) {
- this.c = null;
+ this.d = null;
}
if (!this.world.isStatic) {
@@ -215,18 +210,18 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- protected void b(ItemStack itemstack, int i) {
- if (itemstack.m() == EnumAnimation.c) {
+ 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);
}
- if (itemstack.m() == EnumAnimation.b) {
+ if (itemstack.n() == EnumAnimation.b) {
for (int j = 0; j < i; ++j) {
- Vec3D vec3d = Vec3D.create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
+ Vec3D vec3d = Vec3D.a().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
vec3d.a(-this.pitch * 3.1415927F / 180.0F);
vec3d.b(-this.yaw * 3.1415927F / 180.0F);
- Vec3D vec3d1 = Vec3D.create(((double) this.random.nextFloat() - 0.5D) * 0.3D, (double) (-this.random.nextFloat()) * 0.6D - 0.3D, 0.6D);
+ Vec3D vec3d1 = Vec3D.a().create(((double) this.random.nextFloat() - 0.5D) * 0.3D, (double) (-this.random.nextFloat()) * 0.6D - 0.3D, 0.6D);
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
@@ -238,24 +233,24 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- protected void K() {
- if (this.d != null) {
- this.b(this.d, 16);
- int i = this.d.count;
- ItemStack itemstack = this.d.b(this.world, this);
+ protected void o() {
+ if (this.e != null) {
+ this.c(this.e, 16);
+ int i = this.e.count;
+ ItemStack itemstack = this.e.b(this.world, this);
- if (itemstack != this.d || itemstack != null && itemstack.count != i) {
+ if (itemstack != this.e || itemstack != null && itemstack.count != i) {
this.inventory.items[this.inventory.itemInHandIndex] = itemstack;
if (itemstack.count == 0) {
this.inventory.items[this.inventory.itemInHandIndex] = null;
}
}
- this.O();
+ this.bz();
}
}
- protected boolean Q() {
+ protected boolean aX() {
return this.getHealth() <= 0 || this.isSleeping();
}
@@ -264,40 +259,40 @@ public abstract class EntityHuman extends EntityLiving {
this.activeContainer = this.defaultContainer;
}
- public void R() {
+ public void U() {
double d0 = this.locX;
double d1 = this.locY;
double d2 = this.locZ;
- super.R();
- this.r = this.s;
- this.s = 0.0F;
- this.h(this.locX - d0, this.locY - d1, this.locZ - d2);
+ super.U();
+ this.bF = this.bG;
+ this.bG = 0.0F;
+ this.k(this.locX - d0, this.locY - d1, this.locZ - d2);
}
- private int E() {
+ private int k() {
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);
}
- protected void d_() {
- int i = this.E();
+ protected void be() {
+ int i = this.k();
- if (this.t) {
- ++this.u;
- if (this.u >= i) {
- this.u = 0;
- this.t = false;
+ if (this.bH) {
+ ++this.bI;
+ if (this.bI >= i) {
+ this.bI = 0;
+ this.bH = false;
}
} else {
- this.u = 0;
+ this.bI = 0;
}
- this.ao = (float) this.u / (float) i;
+ this.aJ = (float) this.bI / (float) i;
}
- public void e() {
- if (this.o > 0) {
- --this.o;
+ public void d() {
+ if (this.bC > 0) {
+ --this.bC;
}
if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 * 12 == 0) {
@@ -305,14 +300,14 @@ public abstract class EntityHuman extends EntityLiving {
this.heal(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
}
- this.inventory.i();
- this.r = this.s;
- super.e();
- this.al = this.P;
- this.am = this.Q;
+ this.inventory.k();
+ this.bF = this.bG;
+ super.d();
+ this.aG = this.abilities.b();
+ this.aH = this.ce;
if (this.isSprinting()) {
- this.al = (float) ((double) this.al + (double) this.P * 0.3D);
- this.am = (float) ((double) this.am + (double) this.Q * 0.3D);
+ this.aG = (float) ((double) this.aG + (double) this.abilities.b() * 0.3D);
+ this.aH = (float) ((double) this.aH + (double) this.ce * 0.3D);
}
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -331,40 +326,42 @@ public abstract class EntityHuman extends EntityLiving {
f1 = 0.0F;
}
- this.s += (f - this.s) * 0.4F;
- this.ay += (f1 - this.ay) * 0.8F;
+ this.bG += (f - this.bG) * 0.4F;
+ this.aT += (f1 - this.aT) * 0.8F;
if (this.getHealth() > 0) {
List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
if (list != null) {
- for (int i = 0; i < list.size(); ++i) {
- Entity entity = (Entity) list.get(i);
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
if (!entity.dead) {
- this.l(entity);
+ this.o(entity);
}
}
}
}
}
- private void l(Entity entity) {
- entity.a_(this);
+ private void o(Entity entity) {
+ entity.b_(this);
}
public void die(DamageSource damagesource) {
super.die(damagesource);
- this.b(0.2F, 0.2F);
+ this.a(0.2F, 0.2F);
this.setPosition(this.locX, this.locY, this.locZ);
this.motY = 0.10000000149011612D;
if (this.name.equals("Notch")) {
this.a(new ItemStack(Item.APPLE, 1), true);
}
- this.inventory.k();
+ this.inventory.m();
if (damagesource != null) {
- this.motX = (double) (-MathHelper.cos((this.au + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
- this.motZ = (double) (-MathHelper.sin((this.au + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
+ this.motX = (double) (-MathHelper.cos((this.aP + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
+ this.motZ = (double) (-MathHelper.sin((this.aP + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
} else {
this.motX = this.motZ = 0.0D;
}
@@ -373,8 +370,8 @@ public abstract class EntityHuman extends EntityLiving {
this.a(StatisticList.y, 1);
}
- public void b(Entity entity, int i) {
- this.q += i;
+ public void c(Entity entity, int i) {
+ this.bE += i;
if (entity instanceof EntityHuman) {
this.a(StatisticList.A, 1);
} else {
@@ -382,13 +379,13 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- protected int b_(int i) {
+ protected int h(int i) {
int j = EnchantmentManager.getOxygenEnchantmentLevel(this.inventory);
- return j > 0 && this.random.nextInt(j + 1) > 0 ? i : super.b_(i);
+ return j > 0 && this.random.nextInt(j + 1) > 0 ? i : super.h(i);
}
- public EntityItem S() {
+ public EntityItem bB() {
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
}
@@ -451,30 +448,29 @@ public abstract class EntityHuman extends EntityLiving {
public float a(Block block) {
float f = this.inventory.a(block);
- float f1 = f;
int i = EnchantmentManager.getDigSpeedEnchantmentLevel(this.inventory);
if (i > 0 && this.inventory.b(block)) {
- f1 = f + (float) (i * i + 1);
+ f += (float) (i * i + 1);
}
if (this.hasEffect(MobEffectList.FASTER_DIG)) {
- f1 *= 1.0F + (float) (this.getEffect(MobEffectList.FASTER_DIG).getAmplifier() + 1) * 0.2F;
+ f *= 1.0F + (float) (this.getEffect(MobEffectList.FASTER_DIG).getAmplifier() + 1) * 0.2F;
}
if (this.hasEffect(MobEffectList.SLOWER_DIG)) {
- f1 *= 1.0F - (float) (this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F;
+ f *= 1.0F - (float) (this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F;
}
if (this.a(Material.WATER) && !EnchantmentManager.hasWaterWorkerEnchantment(this.inventory)) {
- f1 /= 5.0F;
+ f /= 5.0F;
}
if (!this.onGround) {
- f1 /= 5.0F;
+ f /= 5.0F;
}
- return f1;
+ return f;
}
public boolean b(Block block) {
@@ -493,7 +489,7 @@ public abstract class EntityHuman extends EntityLiving {
this.expLevel = nbttagcompound.getInt("XpLevel");
this.expTotal = nbttagcompound.getInt("XpTotal");
if (this.sleeping) {
- this.F = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ this.bT = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
@@ -505,11 +501,16 @@ public abstract class EntityHuman extends EntityLiving {
// CraftBukkit end
if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
- this.b = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
+ this.c = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
}
this.foodData.a(nbttagcompound);
this.abilities.b(nbttagcompound);
+ if (nbttagcompound.hasKey("EnderItems")) {
+ NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems");
+
+ this.enderChest.a(nbttaglist1);
+ }
}
public void b(NBTTagCompound nbttagcompound) {
@@ -521,15 +522,16 @@ public abstract class EntityHuman extends EntityLiving {
nbttagcompound.setFloat("XpP", this.exp);
nbttagcompound.setInt("XpLevel", this.expLevel);
nbttagcompound.setInt("XpTotal", this.expTotal);
- if (this.b != null) {
- nbttagcompound.setInt("SpawnX", this.b.x);
- nbttagcompound.setInt("SpawnY", this.b.y);
- nbttagcompound.setInt("SpawnZ", this.b.z);
+ if (this.c != null) {
+ nbttagcompound.setInt("SpawnX", this.c.x);
+ nbttagcompound.setInt("SpawnY", this.c.y);
+ nbttagcompound.setInt("SpawnZ", this.c.z);
nbttagcompound.setString("SpawnWorld", spawnWorld); // CraftBukkit - fixes bed spawns for multiworld worlds
}
this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound);
+ nbttagcompound.set("EnderItems", this.enderChest.g());
}
public void openContainer(IInventory iinventory) {}
@@ -544,7 +546,7 @@ public abstract class EntityHuman extends EntityLiving {
return 0.12F;
}
- protected void A() {
+ protected void d_() {
this.height = 1.62F;
}
@@ -552,7 +554,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
return false;
} else {
- this.aV = 0;
+ this.bq = 0;
if (this.getHealth() <= 0) {
return false;
} else {
@@ -562,7 +564,7 @@ public abstract class EntityHuman extends EntityLiving {
Entity entity = damagesource.getEntity();
- if (entity instanceof EntityMonster || entity instanceof EntityArrow) {
+ if (damagesource.n()) {
if (this.world.difficulty == 0) {
return false; // CraftBukkit - i = 0 -> return false
}
@@ -575,13 +577,14 @@ public abstract class EntityHuman extends EntityLiving {
i = i * 3 / 2;
}
}
+
if (false && i == 0) { // CraftBukkit - Don't filter out 0 damage
return false;
} else {
- Entity entity1 = entity;
+ Entity entity1 = damagesource.getEntity();
- if (entity instanceof EntityArrow && ((EntityArrow) entity).shooter != null) {
- entity1 = ((EntityArrow) entity).shooter;
+ if (entity1 instanceof EntityArrow && ((EntityArrow) entity1).shooter != null) {
+ entity1 = ((EntityArrow) entity1).shooter;
}
if (entity1 instanceof EntityLiving) {
@@ -595,8 +598,8 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- protected int b(DamageSource damagesource, int i) {
- int j = super.b(damagesource, i);
+ protected int c(DamageSource damagesource, int i) {
+ int j = super.c(damagesource, i);
if (j <= 0) {
return 0;
@@ -609,17 +612,17 @@ public abstract class EntityHuman extends EntityLiving {
if (k > 0 && k <= 20) {
int l = 25 - k;
- int i1 = j * l + this.ar;
+ int i1 = j * l + this.aM;
j = i1 / 25;
- this.ar = i1 % 25;
+ this.aM = i1 % 25;
}
return j;
}
}
- protected boolean C() {
+ protected boolean h() {
return false;
}
@@ -633,15 +636,14 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- if (!(entityliving instanceof EntityHuman) || this.C()) {
- List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
+ if (!(entityliving instanceof EntityHuman) || this.h()) {
+ List list = this.world.a(EntityWolf.class, AxisAlignedBB.a().a(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- EntityWolf entitywolf1 = (EntityWolf) entity;
+ EntityWolf entitywolf1 = (EntityWolf) iterator.next();
- if (entitywolf1.isTamed() && entitywolf1.I() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
+ if (entitywolf1.isTamed() && entitywolf1.m() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
entitywolf1.setSitting(false);
entitywolf1.setTarget(entityliving);
}
@@ -650,22 +652,22 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- protected void f(int i) {
- this.inventory.e(i);
+ protected void k(int i) {
+ this.inventory.g(i);
}
- public int T() {
- return this.inventory.j();
+ public int aO() {
+ return this.inventory.l();
}
- protected void c(DamageSource damagesource, int i) {
- if (!damagesource.ignoresArmor() && this.P()) {
+ protected void d(DamageSource damagesource, int i) {
+ if (!damagesource.ignoresArmor() && this.aY()) {
i = 1 + i >> 1;
}
- i = this.d(damagesource, i);
i = this.b(damagesource, i);
- this.c(damagesource.f());
+ i = this.c(damagesource, i);
+ this.j(damagesource.d());
this.health -= i;
}
@@ -677,27 +679,40 @@ public abstract class EntityHuman extends EntityLiving {
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {}
- public void e(Entity entity) {
- if (!entity.b(this)) {
- ItemStack itemstack = this.U();
+ public void openTrade(IMerchant imerchant) {}
+
+ public void c(ItemStack itemstack) {}
+
+ public boolean m(Entity entity) {
+ if (entity.c(this)) {
+ return true;
+ } else {
+ ItemStack itemstack = this.bC();
if (itemstack != null && entity instanceof EntityLiving) {
- if (this.abilities.canInstantlyBuild) itemstack = itemstack.cloneItemStack(); // CraftBukkit - if the player can instantly build, don't decrement the stack.
- itemstack.a((EntityLiving) entity);
- // CraftBukkit - bypass infinite items; <= 0 -> == 0, only remove items if not able to instantly build
- if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
- itemstack.a(this);
- this.V();
+ if (this.abilities.canInstantlyBuild) {
+ itemstack = itemstack.cloneItemStack();
+ }
+
+ if (itemstack.a((EntityLiving) entity)) {
+ // CraftBukkit - bypass infinite items; <= 0 -> == 0
+ if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
+ this.bD();
+ }
+
+ return true;
}
}
+
+ return false;
}
}
- public ItemStack U() {
+ public ItemStack bC() {
return this.inventory.getItemInHand();
}
- public void V() {
+ public void bD() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
@@ -705,15 +720,15 @@ public abstract class EntityHuman extends EntityLiving {
return (double) (this.height - 0.5F);
}
- public void C_() {
- if (!this.t || this.u >= this.E() / 2 || this.u < 0) {
- this.u = -1;
- this.t = true;
+ public void i() {
+ if (!this.bH || this.bI >= this.k() / 2 || this.bI < 0) {
+ this.bI = -1;
+ this.bH = true;
}
}
public void attack(Entity entity) {
- if (entity.k_()) {
+ if (entity.an()) {
int i = this.inventory.a(entity);
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
@@ -737,7 +752,7 @@ public abstract class EntityHuman extends EntityLiving {
}
if (i > 0 || k > 0) {
- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.t() && !this.aU() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
+ boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.f_() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag) {
i += this.random.nextInt(i / 2 + 2);
@@ -754,35 +769,34 @@ public abstract class EntityHuman extends EntityLiving {
if (flag1) {
if (j > 0) {
- entity.b_((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));
+ 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 (flag) {
- this.c(entity);
+ this.b(entity);
}
if (k > 0) {
- this.d(entity);
+ this.c(entity);
}
if (i >= 18) {
this.a((Statistic) AchievementList.E);
}
- this.g(entity);
+ this.j(entity);
}
- ItemStack itemstack = this.U();
+ ItemStack itemstack = this.bC();
if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
- itemstack.a(this);
- this.V();
+ this.bD();
}
}
@@ -806,16 +820,14 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- this.c(0.3F);
+ this.j(0.3F);
}
}
}
- public void c(Entity entity) {}
+ public void b(Entity entity) {}
- public void d(Entity entity) {}
-
- public void carriedChanged(ItemStack itemstack) {}
+ public void c(Entity entity) {}
public void die() {
super.die();
@@ -829,6 +841,10 @@ public abstract class EntityHuman extends EntityLiving {
return !this.sleeping && super.inBlock();
}
+ public boolean bF() {
+ return false;
+ }
+
public EnumBedResult a(int i, int j, int k) {
if (!this.world.isStatic) {
if (this.isSleeping() || !this.isAlive()) {
@@ -839,7 +855,7 @@ public abstract class EntityHuman extends EntityLiving {
return EnumBedResult.NOT_POSSIBLE_HERE;
}
- if (this.world.e()) {
+ if (this.world.r()) {
return EnumBedResult.NOT_POSSIBLE_NOW;
}
@@ -849,7 +865,7 @@ public abstract class EntityHuman extends EntityLiving {
double d0 = 8.0D;
double d1 = 5.0D;
- List list = this.world.a(EntityMonster.class, AxisAlignedBB.b((double) i - d0, (double) j - d1, (double) k - d0, (double) i + d0, (double) j + d1, (double) k + d0));
+ List list = this.world.a(EntityMonster.class, AxisAlignedBB.a().a((double) i - d0, (double) j - d1, (double) k - d0, (double) i + d0, (double) j + d1, (double) k + d0));
if (!list.isEmpty()) {
return EnumBedResult.NOT_SAFE;
@@ -870,11 +886,11 @@ public abstract class EntityHuman extends EntityLiving {
}
// CraftBukkit end
- this.b(0.2F, 0.2F);
+ this.a(0.2F, 0.2F);
this.height = 0.2F;
if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
- int i1 = BlockBed.b(l);
+ int i1 = BlockBed.d(l);
float f = 0.5F;
float f1 = 0.5F;
@@ -895,7 +911,7 @@ public abstract class EntityHuman extends EntityLiving {
f = 0.9F;
}
- this.c(i1);
+ this.b(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));
@@ -903,7 +919,7 @@ public abstract class EntityHuman extends EntityLiving {
this.sleeping = true;
this.sleepTicks = 0;
- this.F = new ChunkCoordinates(i, j, k);
+ this.bT = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
@@ -912,38 +928,44 @@ public abstract class EntityHuman extends EntityLiving {
return EnumBedResult.OK;
}
- private void c(int i) {
- this.G = 0.0F;
- this.H = 0.0F;
+ private void b(int i) {
+ this.bU = 0.0F;
+ this.bV = 0.0F;
switch (i) {
case 0:
- this.H = -1.8F;
+ this.bV = -1.8F;
break;
case 1:
- this.G = 1.8F;
+ this.bU = 1.8F;
break;
case 2:
- this.H = 1.8F;
+ this.bV = 1.8F;
break;
case 3:
- this.G = -1.8F;
+ this.bU = -1.8F;
}
}
public void a(boolean flag, boolean flag1, boolean flag2) {
if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
- this.b(0.6F, 1.8F);
- this.A();
- ChunkCoordinates chunkcoordinates = this.F;
- ChunkCoordinates chunkcoordinates1 = this.F;
+ // CraftBukkit start - moved check from packet19 handler TODO: make sure this works before turning on
+ // if (this instanceof EntityPlayer) {
+ // ((EntityPlayer) this).netServerHandler.checkMovement = false;
+ // }
+ // CraftBukkit end
+
+ this.a(0.6F, 1.8F);
+ this.d_();
+ ChunkCoordinates chunkcoordinates = this.bT;
+ ChunkCoordinates chunkcoordinates1 = this.bT;
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);
- chunkcoordinates1 = BlockBed.f(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
+ chunkcoordinates1 = BlockBed.b(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
if (chunkcoordinates1 == null) {
chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z);
}
@@ -979,16 +1001,16 @@ public abstract class EntityHuman extends EntityLiving {
}
if (flag2) {
- this.setRespawnPosition(this.F);
+ this.setRespawnPosition(this.bT);
}
}
- private boolean G() {
- return this.world.getTypeId(this.F.x, this.F.y, this.F.z) == Block.BED.id;
+ private boolean l() {
+ return this.world.getTypeId(this.bT.x, this.bT.y, this.bT.z) == Block.BED.id;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates) {
- IChunkProvider ichunkprovider = world.q();
+ IChunkProvider ichunkprovider = world.F();
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
@@ -997,7 +1019,7 @@ public abstract class EntityHuman extends EntityLiving {
if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) != Block.BED.id) {
return null;
} else {
- ChunkCoordinates chunkcoordinates1 = BlockBed.f(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
+ ChunkCoordinates chunkcoordinates1 = BlockBed.b(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
return chunkcoordinates1;
}
@@ -1011,18 +1033,18 @@ public abstract class EntityHuman extends EntityLiving {
return this.sleeping && this.sleepTicks >= 100;
}
- public void a(String s) {}
+ public void c(String s) {}
public ChunkCoordinates getBed() {
- return this.b;
+ return this.c;
}
public void setRespawnPosition(ChunkCoordinates chunkcoordinates) {
if (chunkcoordinates != null) {
- this.b = new ChunkCoordinates(chunkcoordinates);
- this.spawnWorld = this.world.worldData.name; // CraftBukkit
+ this.c = new ChunkCoordinates(chunkcoordinates);
+ this.spawnWorld = this.world.worldData.getName();
} else {
- this.b = null;
+ this.c = null;
}
}
@@ -1032,31 +1054,31 @@ public abstract class EntityHuman extends EntityLiving {
public void a(Statistic statistic, int i) {}
- protected void ac() {
- super.ac();
+ protected void aZ() {
+ super.aZ();
this.a(StatisticList.u, 1);
if (this.isSprinting()) {
- this.c(0.8F);
+ this.j(0.8F);
} else {
- this.c(0.2F);
+ this.j(0.2F);
}
}
- public void a(float f, float f1) {
+ public void e(float f, float f1) {
double d0 = this.locX;
double d1 = this.locY;
double d2 = this.locZ;
- if (this.abilities.isFlying) {
+ if (this.abilities.isFlying && this.vehicle == null) {
double d3 = this.motY;
- float f2 = this.am;
+ float f2 = this.aH;
- this.am = 0.05F;
- super.a(f, f1);
+ this.aH = this.abilities.a();
+ super.e(f, f1);
this.motY = d3 * 0.6D;
- this.am = f2;
+ this.aH = f2;
} else {
- super.a(f, f1);
+ super.e(f, f1);
}
this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2);
@@ -1070,15 +1092,15 @@ public abstract class EntityHuman extends EntityLiving {
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.q, i);
- this.c(0.015F * (float) i * 0.01F);
+ this.j(0.015F * (float) i * 0.01F);
}
- } else if (this.aU()) {
+ } else if (this.H()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
- this.c(0.015F * (float) i * 0.01F);
+ this.j(0.015F * (float) i * 0.01F);
}
- } else if (this.t()) {
+ } else if (this.f_()) {
if (d1 > 0.0D) {
this.a(StatisticList.o, (int) Math.round(d1 * 100.0D));
}
@@ -1087,9 +1109,9 @@ public abstract class EntityHuman extends EntityLiving {
if (i > 0) {
this.a(StatisticList.l, i);
if (this.isSprinting()) {
- this.c(0.099999994F * (float) i * 0.01F);
+ this.j(0.099999994F * (float) i * 0.01F);
} else {
- this.c(0.01F * (float) i * 0.01F);
+ this.j(0.01F * (float) i * 0.01F);
}
}
} else {
@@ -1101,16 +1123,16 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- private void h(double d0, double d1, double d2) {
+ private void k(double d0, double d1, double d2) {
if (this.vehicle != null) {
int i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
if (this.vehicle instanceof EntityMinecart) {
this.a(StatisticList.r, i);
- if (this.c == null) {
- this.c = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
- } else if (this.c.b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000.0D) {
+ if (this.d == null) {
+ this.d = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ } else if ((double) this.d.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000000.0D) {
this.a((Statistic) AchievementList.q, 1);
}
} else if (this.vehicle instanceof EntityBoat) {
@@ -1132,22 +1154,22 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- public void c(EntityLiving entityliving) {
+ public void a(EntityLiving entityliving) {
if (entityliving instanceof EntityMonster) {
this.a((Statistic) AchievementList.s);
}
}
- public void ad() {
- if (this.I > 0) {
- this.I = 10;
+ public void aa() {
+ if (this.bW > 0) {
+ this.bW = 10;
} else {
- this.J = true;
+ this.bX = true;
}
}
public void giveExp(int i) {
- this.q += i;
+ this.bE += i;
int j = Integer.MAX_VALUE - this.expTotal;
if (i > j) {
@@ -1170,14 +1192,14 @@ public abstract class EntityHuman extends EntityLiving {
}
public int getExpToLevel() {
- return 7 + (this.expLevel * 7 >> 1);
+ return this.expLevel >= 30 ? 62 + (this.expLevel - 30) * 7 : (this.expLevel >= 15 ? 17 + (this.expLevel - 15) * 3 : 17);
}
private void levelUp() {
++this.expLevel;
}
- public void c(float f) {
+ public void j(float f) {
if (!this.abilities.isInvulnerable) {
if (!this.world.isStatic) {
this.foodData.a(f);
@@ -1189,26 +1211,26 @@ public abstract class EntityHuman extends EntityLiving {
return this.foodData;
}
- public boolean b(boolean flag) {
- return (flag || this.foodData.b()) && !this.abilities.isInvulnerable;
+ public boolean e(boolean flag) {
+ return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
}
- public boolean ag() {
+ public boolean bM() {
return this.getHealth() > 0 && this.getHealth() < this.getMaxHealth();
}
public void a(ItemStack itemstack, int i) {
- if (itemstack != this.d) {
- this.d = itemstack;
- this.e = i;
+ if (itemstack != this.e) {
+ this.e = itemstack;
+ this.f = i;
if (!this.world.isStatic) {
- this.i(true);
+ this.c(true);
}
}
}
- public boolean d(int i, int j, int k) {
- return true;
+ public boolean e(int i, int j, int k) {
+ return this.abilities.mayBuild;
}
protected int getExpValue(EntityHuman entityhuman) {
@@ -1225,21 +1247,43 @@ public abstract class EntityHuman extends EntityLiving {
return this.name;
}
- public void e(int i) {}
+ public void c(int i) {}
- public void copyTo(EntityHuman entityhuman) {
- this.inventory.a(entityhuman.inventory);
- this.health = entityhuman.health;
- this.foodData = entityhuman.foodData;
- this.expLevel = entityhuman.expLevel;
- this.expTotal = entityhuman.expTotal;
- this.exp = entityhuman.exp;
- this.q = entityhuman.q;
+ public void copyTo(EntityHuman entityhuman, boolean flag) {
+ if (flag) {
+ this.inventory.b(entityhuman.inventory);
+ this.health = entityhuman.health;
+ this.foodData = entityhuman.foodData;
+ this.expLevel = entityhuman.expLevel;
+ this.expTotal = entityhuman.expTotal;
+ this.exp = entityhuman.exp;
+ this.bE = entityhuman.bE;
+ }
+
+ this.enderChest = entityhuman.enderChest;
}
- protected boolean g_() {
+ protected boolean e_() {
return !this.abilities.isFlying;
}
public void updateAbilities() {}
+
+ public void a(EnumGamemode enumgamemode) {}
+
+ public String getName() {
+ return this.name;
+ }
+
+ public LocaleLanguage getLocale() {
+ return LocaleLanguage.a();
+ }
+
+ public String a(String s, Object... aobject) {
+ return this.getLocale().a(s, aobject);
+ }
+
+ public InventoryEnderChest getEnderChest() {
+ return this.enderChest;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
index cdb786cd..937e1791 100644
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
@@ -4,16 +4,16 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
public class EntityIronGolem extends EntityGolem {
- private int b = 0;
- Village a = null;
- private int c;
+ private int e = 0;
+ Village d = null;
+ private int f;
private int g;
public EntityIronGolem(World world) {
super(world);
this.texture = "/mob/villager_golem.png";
- this.b(1.4F, 2.9F);
- this.al().a(true);
+ this.a(1.4F, 2.9F);
+ this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 0.25F, true));
this.goalSelector.a(2, new PathfinderGoalMoveTowardsTarget(this, 0.22F, 32.0F));
this.goalSelector.a(3, new PathfinderGoalMoveThroughVillage(this, 0.16F, true));
@@ -27,43 +27,43 @@ public class EntityIronGolem extends EntityGolem {
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityMonster.class, 16.0F, 0, false, true));
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
- protected void g() {
- if (--this.b <= 0) {
- this.b = 70 + this.random.nextInt(50);
- this.a = this.world.villages.getClosestVillage(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32);
- if (this.a == null) {
- this.ax();
+ protected void bd() {
+ 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.aE();
} else {
- ChunkCoordinates chunkcoordinates = this.a.getCenter();
+ ChunkCoordinates chunkcoordinates = this.d.getCenter();
- this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, this.a.getSize());
+ this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, this.d.getSize());
}
}
- super.g();
+ super.bd();
}
public int getMaxHealth() {
return 100;
}
- protected int b_(int i) {
+ protected int h(int i) {
return i;
}
- public void e() {
- super.e();
- if (this.c > 0) {
- --this.c;
+ public void d() {
+ super.d();
+ if (this.f > 0) {
+ --this.f;
}
if (this.g > 0) {
@@ -83,21 +83,11 @@ public class EntityIronGolem extends EntityGolem {
}
public boolean a(Class oclass) {
- return this.n_() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
+ return this.q() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- nbttagcompound.setBoolean("PlayerCreated", this.n_());
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- this.b(nbttagcompound.getBoolean("PlayerCreated"));
- }
-
- public boolean a(Entity entity) {
- this.c = 10;
+ public boolean k(Entity entity) {
+ this.f = 10;
this.world.broadcastEntityEffect(this, (byte) 4);
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), 7 + this.random.nextInt(15));
@@ -109,24 +99,24 @@ public class EntityIronGolem extends EntityGolem {
return flag;
}
- public Village l_() {
- return this.a;
+ public Village n() {
+ return this.d;
}
- public void a(boolean flag) {
+ public void e(boolean flag) {
this.g = flag ? 400 : 0;
this.world.broadcastEntityEffect(this, (byte) 11);
}
- protected String i() {
+ protected String aQ() {
return "none";
}
- protected String j() {
+ protected String aR() {
return "mob.irongolem.hit";
}
- protected String k() {
+ protected String aS() {
return "mob.irongolem.death";
}
@@ -141,29 +131,29 @@ public class EntityIronGolem extends EntityGolem {
int k;
- for (k = 0; k < j; ++k) {
- loot.add(new CraftItemStack(Block.RED_ROSE.id, 1));
+ if (j > 0) {
+ loot.add(new CraftItemStack(Block.RED_ROSE.id, j));
}
k = 3 + this.random.nextInt(3);
- for (int l = 0; l < k; ++l) {
- loot.add(new CraftItemStack(Item.IRON_INGOT.id, 1));
+ if (k > 0) {
+ loot.add(new CraftItemStack(Item.IRON_INGOT.id, k));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
- public int m_() {
+ public int p() {
return this.g;
}
- public boolean n_() {
+ public boolean q() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
- public void b(boolean flag) {
+ public void f(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 34a87bdf..e4b95267 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Iterator;
+
import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
public class EntityItem extends Entity {
@@ -13,7 +15,7 @@ public class EntityItem extends Entity {
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
super(world);
- this.b(0.25F, 0.25F);
+ this.a(0.25F, 0.25F);
this.height = this.length / 2.0F;
this.setPosition(d0, d1, d2);
this.itemStack = itemstack;
@@ -31,20 +33,20 @@ public class EntityItem extends Entity {
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
public EntityItem(World world) {
super(world);
- this.b(0.25F, 0.25F);
+ this.a(0.25F, 0.25F);
this.height = this.length / 2.0F;
}
- protected void b() {}
+ protected void a() {}
- public void F_() {
- super.F_();
+ public void h_() {
+ super.h_();
// CraftBukkit start
int currentTick = (int) (System.currentTimeMillis() / 50);
this.pickupDelay -= (currentTick - this.lastTick);
@@ -55,15 +57,29 @@ public class EntityItem extends Entity {
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
- if (this.world.getMaterial(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) == Material.LAVA) {
- 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.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;
+
+ if (flag) {
+ if (this.world.getMaterial(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) == Material.LAVA) {
+ 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);
+ }
+
+ 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.g(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
- this.move(this.motX, this.motY, this.motZ);
float f = 0.98F;
if (this.onGround) {
@@ -94,11 +110,35 @@ public class EntityItem extends Entity {
}
}
- public void k() {
+ 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.getItem().k() && 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;
+ } 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;
+ }
+ }
+
+ public void d() {
this.age = 4800;
}
- public boolean h_() {
+ public boolean I() {
return this.world.a(this.boundingBox, Material.WATER, this);
}
@@ -107,7 +147,7 @@ public class EntityItem extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.aW();
+ this.K();
this.e -= i;
if (this.e <= 0) {
this.die();
@@ -119,8 +159,9 @@ public class EntityItem extends Entity {
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Health", (short) ((byte) this.e));
nbttagcompound.setShort("Age", (short) this.age);
- if (this.itemStack != null) // CraftBukkit - Nullchex!
- nbttagcompound.setCompound("Item", this.itemStack.save(new NBTTagCompound()));
+ if (this.itemStack != null) {
+ nbttagcompound.setCompound("Item", this.itemStack.save(new NBTTagCompound()));
+ }
}
public void a(NBTTagCompound nbttagcompound) {
@@ -134,13 +175,14 @@ public class EntityItem extends Entity {
}
}
- public void a_(EntityHuman entityhuman) {
+ public void b_(EntityHuman entityhuman) {
if ((!this.world.isStatic) && (this.itemStack != null)) { // CraftBukkit - nullcheck
int i = this.itemStack.count;
// CraftBukkit start
int canHold = entityhuman.inventory.canHold(this.itemStack);
int remaining = this.itemStack.count - canHold;
+
if (this.pickupDelay <= 0 && canHold > 0) {
this.itemStack.count = canHold;
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
@@ -184,10 +226,10 @@ public class EntityItem extends Entity {
public String getLocalizedName() {
if (this.itemStack == null) return LocaleI18n.get("item.unknown"); // CraftBukkit - nullcheck
- return LocaleI18n.get("item." + this.itemStack.k());
+ return LocaleI18n.get("item." + this.itemStack.a());
}
- public boolean k_() {
+ public boolean an() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWeatherLighting.java b/src/main/java/net/minecraft/server/EntityLightning.java
index 6f04c6ee..c65f92c4 100644
--- a/src/main/java/net/minecraft/server/EntityWeatherLighting.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -1,10 +1,11 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
import org.bukkit.event.block.BlockIgniteEvent; // CraftBukkit
-public class EntityWeatherLighting extends EntityWeather {
+public class EntityLightning extends EntityWeather {
private int lifeTicks;
public long a = 0L;
@@ -14,11 +15,11 @@ public class EntityWeatherLighting extends EntityWeather {
private org.bukkit.craftbukkit.CraftWorld cworld;
public boolean isEffect = false;
- public EntityWeatherLighting(World world, double d0, double d1, double d2) {
+ public EntityLightning(World world, double d0, double d1, double d2) {
this(world, d0, d1, d2, false);
}
- public EntityWeatherLighting(World world, double d0, double d1, double d2, boolean isEffect) {
+ public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect) {
// CraftBukkit end
super(world);
@@ -69,8 +70,8 @@ public class EntityWeatherLighting extends EntityWeather {
}
}
- public void F_() {
- super.F_();
+ public void h_() {
+ super.h_();
if (this.lifeTicks == 2) {
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
@@ -106,19 +107,20 @@ public class EntityWeatherLighting extends EntityWeather {
if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit
double d0 = 3.0D;
- List list = this.world.getEntities(this, AxisAlignedBB.b(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
+ 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));
+ Iterator iterator = list.iterator();
- for (int l = 0; l < list.size(); ++l) {
- Entity entity = (Entity) list.get(l);
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
entity.a(this);
}
- this.world.n = 2;
+ this.world.s = 2;
}
}
- protected void b() {}
+ protected void a() {}
protected void a(NBTTagCompound nbttagcompound) {}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index c55c599b..7844e6a8 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -16,104 +16,106 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
public abstract class EntityLiving extends Entity {
public int maxNoDamageTicks = 20;
- public float T;
- public float U;
- public float V = 0.0F;
- public float W = 0.0F;
- public float X = 0.0F;
- public float Y = 0.0F;
- protected float Z;
- protected float aa;
- protected float ab;
- protected float ac;
- protected boolean ad = true;
- protected String texture = "/mob/char.png";
- protected boolean af = true;
- protected float ag = 0.0F;
- protected String ah = null;
- protected float ai = 1.0F;
- protected int aj = 0;
- protected float ak = 0.0F;
- public float al = 0.1F;
- public float am = 0.02F;
- public float an;
public float ao;
+ public float ap;
+ public float aq = 0.0F;
+ public float ar = 0.0F;
+ public float as = 0.0F;
+ public float at = 0.0F;
+ protected float au;
+ protected float av;
+ protected float aw;
+ protected float ax;
+ protected boolean ay = true;
+ protected String texture = "/mob/char.png";
+ protected boolean aA = true;
+ protected float aB = 0.0F;
+ protected String aC = null;
+ protected float aD = 1.0F;
+ protected int aE = 0;
+ protected float aF = 0.0F;
+ public float aG = 0.1F;
+ public float aH = 0.02F;
+ public float aI;
+ public float aJ;
protected int health = this.getMaxHealth();
- public int aq;
- protected int ar;
+ public int aL;
+ protected int aM;
private int a;
public int hurtTicks;
- public int at;
- public float au = 0.0F;
+ public int aO;
+ public float aP = 0.0F;
public int deathTicks = 0;
public int attackTicks = 0;
- public float ax;
- public float ay;
- protected boolean az = false;
- protected int aA;
- public int aB = -1;
- public float aC = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
- public float aD;
- public float aE;
- public float aF;
- public EntityHuman killer = null; // CraftBukkit - prot to pub
+ public float aS;
+ public float aT;
+ protected boolean aU = false;
+ protected int aV;
+ public int aW = -1;
+ public float aX = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
+ public float aY;
+ public float aZ;
+ public float ba;
+ public EntityHuman killer = null; // CraftBukkit - protected -> public
protected int lastDamageByPlayerTime = 0;
- public EntityLiving lastDamager = null; // CraftBukkit - priv to pub
+ public EntityLiving lastDamager = null; // CraftBukkit - private -> public
private int c = 0;
private EntityLiving d = null;
- public int aI = 0;
- public int aJ = 0;
+ public int bd = 0;
+ public int be = 0;
public HashMap effects = new HashMap(); // CraftBukkit - protected -> public
- public boolean e = true; // CraftBukkit - private -> public
+ public boolean updateEffects = true; // CraftBukkit - private -> public
private int f;
private ControllerLook lookController;
private ControllerMove moveController;
private ControllerJump jumpController;
private EntityAIBodyControl senses;
private Navigation navigation;
- protected PathfinderGoalSelector goalSelector = new PathfinderGoalSelector();
- protected PathfinderGoalSelector targetSelector = new PathfinderGoalSelector();
- private EntityLiving l;
- private EntitySenses m;
- private float n;
- private ChunkCoordinates o = new ChunkCoordinates(0, 0, 0);
- private float p = -1.0F;
- protected int aN;
- protected double aO;
- protected double aP;
- protected double aQ;
- protected double aR;
- protected double aS;
- float aT = 0.0F;
+ protected final PathfinderGoalSelector goalSelector;
+ protected final PathfinderGoalSelector targetSelector;
+ private EntityLiving bz;
+ private EntitySenses bA;
+ private float bB;
+ private ChunkCoordinates bC = new ChunkCoordinates(0, 0, 0);
+ private float bD = -1.0F;
+ protected int bi;
+ protected double bj;
+ protected double bk;
+ protected double bl;
+ protected double bm;
+ protected double bn;
+ float bo = 0.0F;
public int lastDamage = 0; // CraftBukkit - protected -> public
- protected int aV = 0;
- protected float aW;
- protected float aX;
- protected float aY;
- protected boolean aZ = false;
- protected float ba = 0.0F;
- protected float bb = 0.7F;
- private int q = 0;
- private Entity r;
- protected int bc = 0;
+ protected int bq = 0;
+ protected float br;
+ protected float bs;
+ protected float bt;
+ protected boolean bu = false;
+ protected float bv = 0.0F;
+ protected float bw = 0.7F;
+ private int bE = 0;
+ private Entity bF;
+ protected int bx = 0;
public int expToDrop = 0; // CraftBukkit
public int maxAirTicks = 300; // CraftBukkit
public EntityLiving(World world) {
super(world);
- this.bf = true;
+ this.m = true;
+ this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
+ this.targetSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
this.lookController = new ControllerLook(this);
this.moveController = new ControllerMove(this);
this.jumpController = new ControllerJump(this);
this.senses = new EntityAIBodyControl(this);
this.navigation = new Navigation(this, world, 16.0F);
- this.m = new EntitySenses(this);
- this.U = (float) (Math.random() + 1.0D) * 0.01F;
+ this.bA = new EntitySenses(this);
+ this.ap = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
- this.T = (float) Math.random() * 12398.0F;
+ this.ao = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
- this.X = this.yaw;
- this.bP = 0.5F;
+ this.as = this.yaw;
+ this.W = 0.5F;
}
public ControllerLook getControllerLook() {
@@ -128,115 +130,115 @@ public abstract class EntityLiving extends Entity {
return this.jumpController;
}
- public Navigation al() {
+ public Navigation getNavigation() {
return this.navigation;
}
- public EntitySenses am() {
- return this.m;
+ public EntitySenses at() {
+ return this.bA;
}
- public Random an() {
+ public Random au() {
return this.random;
}
- public EntityLiving ao() {
+ public EntityLiving av() {
return this.lastDamager;
}
- public EntityLiving ap() {
+ public EntityLiving aw() {
return this.d;
}
- public void g(Entity entity) {
+ public void j(Entity entity) {
if (entity instanceof EntityLiving) {
this.d = (EntityLiving) entity;
}
}
- public int aq() {
- return this.aV;
+ public int ax() {
+ return this.bq;
}
- public float ar() {
- return this.X;
+ public float am() {
+ return this.as;
}
- public float as() {
- return this.n;
+ public float ay() {
+ return this.bB;
}
- public void d(float f) {
- this.n = f;
- this.e(f);
+ public void e(float f) {
+ this.bB = f;
+ this.f(f);
}
- public boolean a(Entity entity) {
- this.g(entity);
+ public boolean k(Entity entity) {
+ this.j(entity);
return false;
}
- public EntityLiving at() {
- return this.l;
+ public EntityLiving az() {
+ return this.bz;
}
public void b(EntityLiving entityliving) {
- this.l = entityliving;
+ this.bz = entityliving;
}
public boolean a(Class oclass) {
return EntityCreeper.class != oclass && EntityGhast.class != oclass;
}
- public void z() {}
+ public void aA() {}
- public boolean au() {
- return this.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ public boolean aB() {
+ return this.d(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
- public boolean e(int i, int j, int k) {
- return this.p == -1.0F ? true : this.o.c(i, j, k) < this.p * this.p;
+ public boolean d(int i, int j, int k) {
+ return this.bD == -1.0F ? true : this.bC.e(i, j, k) < this.bD * this.bD;
}
public void b(int i, int j, int k, int l) {
- this.o.a(i, j, k);
- this.p = (float) l;
+ this.bC.b(i, j, k);
+ this.bD = (float) l;
}
- public ChunkCoordinates av() {
- return this.o;
+ public ChunkCoordinates aC() {
+ return this.bC;
}
- public float aw() {
- return this.p;
+ public float aD() {
+ return this.bD;
}
- public void ax() {
- this.p = -1.0F;
+ public void aE() {
+ this.bD = -1.0F;
}
- public boolean ay() {
- return this.p != -1.0F;
+ public boolean aF() {
+ return this.bD != -1.0F;
}
- public void a(EntityLiving entityliving) {
+ public void c(EntityLiving entityliving) {
this.lastDamager = entityliving;
this.c = this.lastDamager != null ? 60 : 0;
}
- protected void b() {
+ protected void a() {
this.datawatcher.a(8, Integer.valueOf(this.f));
}
- public boolean h(Entity entity) {
- return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
+ public boolean l(Entity entity) {
+ return this.world.a(Vec3D.a().create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), Vec3D.a().create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
}
- public boolean o_() {
+ public boolean L() {
return !this.dead;
}
- public boolean e_() {
+ public boolean M() {
return !this.dead;
}
@@ -244,28 +246,28 @@ public abstract class EntityLiving extends Entity {
return this.length * 0.85F;
}
- public int m() {
+ public int aG() {
return 80;
}
- public void az() {
- String s = this.i();
+ public void aH() {
+ String s = this.aQ();
if (s != null) {
- this.world.makeSound(this, s, this.p(), this.A());
+ this.world.makeSound(this, s, this.aP(), this.i());
}
}
- public void aA() {
- this.an = this.ao;
- super.aA();
- // MethodProfiler.a("mobBaseTick"); // CraftBukkit - not in production code
+ public void z() {
+ this.aI = this.aJ;
+ super.z();
+ // this.world.methodProfiler.a("mobBaseTick"); // CraftBukkit - not in production code
if (this.isAlive() && this.random.nextInt(1000) < this.a++) {
- this.a = -this.m();
- this.az();
+ this.a = -this.aG();
+ this.aH();
}
- // CraftBukkit start - don't inline the damage, perform it with an event
+ // CraftBukkit start
if (this.isAlive() && this.inBlock() && !(this instanceof EntityEnderDragon)) { // EnderDragon's don't suffocate.
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.SUFFOCATION, 1);
this.world.getServer().getPluginManager().callEvent(event);
@@ -281,8 +283,8 @@ public abstract class EntityLiving extends Entity {
this.extinguish();
}
- if (this.isAlive() && this.a(Material.WATER) && !this.f_() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) {
- this.setAirTicks(this.b_(this.getAirTicks()));
+ if (this.isAlive() && this.a(Material.WATER) && !this.aU() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) {
+ this.setAirTicks(this.h(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
@@ -314,7 +316,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
- this.ax = this.ay;
+ this.aS = this.aT;
if (this.attackTicks > 0) {
--this.attackTicks;
}
@@ -328,7 +330,7 @@ public abstract class EntityLiving extends Entity {
}
if (this.health <= 0) {
- this.aB();
+ this.aI();
}
if (this.lastDamageByPlayerTime > 0) {
@@ -343,21 +345,21 @@ public abstract class EntityLiving extends Entity {
if (this.lastDamager != null) {
if (!this.lastDamager.isAlive()) {
- this.a((EntityLiving) null);
+ this.c((EntityLiving) null);
} else if (this.c > 0) {
--this.c;
} else {
- this.a((EntityLiving) null);
+ this.c((EntityLiving) null);
}
}
- this.aK();
- this.ac = this.ab;
- this.W = this.V;
- this.Y = this.X;
+ this.bo();
+ this.ax = this.aw;
+ this.ar = this.aq;
+ this.at = this.as;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
}
// CraftBukkit start
@@ -372,9 +374,9 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
- protected void aB() {
+ protected void aI() {
++this.deathTicks;
- if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead).
+ 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!
@@ -387,7 +389,6 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
- this.aH();
this.die();
for (i = 0; i < 20; ++i) {
@@ -400,19 +401,19 @@ public abstract class EntityLiving extends Entity {
}
}
- protected int b_(int i) {
+ protected int h(int i) {
return i - 1;
}
protected int getExpValue(EntityHuman entityhuman) {
- return this.aA;
+ return this.aV;
}
protected boolean alwaysGivesExp() {
return false;
}
- public void aC() {
+ public void aK() {
for (int i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
@@ -423,44 +424,44 @@ public abstract class EntityLiving extends Entity {
}
}
- public void R() {
- super.R();
- this.Z = this.aa;
- this.aa = 0.0F;
+ public void U() {
+ super.U();
+ this.au = this.av;
+ this.av = 0.0F;
this.fallDistance = 0.0F;
}
- public void F_() {
- super.F_();
- if (this.aI > 0) {
- if (this.aJ <= 0) {
- this.aJ = 60;
+ public void h_() {
+ super.h_();
+ if (this.bd > 0) {
+ if (this.be <= 0) {
+ this.be = 60;
}
- --this.aJ;
- if (this.aJ <= 0) {
- --this.aI;
+ --this.be;
+ if (this.be <= 0) {
+ --this.bd;
}
}
- this.e();
+ this.d();
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
- float f = MathHelper.sqrt(d0 * d0 + d1 * d1);
- float f1 = this.V;
+ float f = (float) (d0 * d0 + d1 * d1);
+ float f1 = this.aq;
float f2 = 0.0F;
- this.Z = this.aa;
+ this.au = this.av;
float f3 = 0.0F;
- if (f > 0.05F) {
+ if (f > 0.0025000002F) {
f3 = 1.0F;
- f2 = f * 3.0F;
+ f2 = (float) Math.sqrt((double) f) * 3.0F;
// CraftBukkit - Math -> TrigMath
f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
}
- if (this.ao > 0.0F) {
+ if (this.aJ > 0.0F) {
f1 = this.yaw;
}
@@ -468,32 +469,15 @@ public abstract class EntityLiving extends Entity {
f3 = 0.0F;
}
- this.aa += (f3 - this.aa) * 0.3F;
- if (this.c_()) {
+ this.av += (f3 - this.av) * 0.3F;
+ this.world.methodProfiler.a("headTurn");
+ if (this.aV()) {
this.senses.a();
} else {
- float f4;
-
- for (f4 = f1 - this.V; f4 < -180.0F; f4 += 360.0F) {
- ;
- }
-
- while (f4 >= 180.0F) {
- f4 -= 360.0F;
- }
-
- this.V += f4 * 0.3F;
-
- float f5;
-
- for (f5 = this.yaw - this.V; f5 < -180.0F; f5 += 360.0F) {
- ;
- }
-
- while (f5 >= 180.0F) {
- f5 -= 360.0F;
- }
+ float f4 = MathHelper.g(f1 - this.aq);
+ this.aq += f4 * 0.3F;
+ float f5 = MathHelper.g(this.yaw - this.aq);
boolean flag = f5 < -90.0F || f5 >= 90.0F;
if (f5 < -75.0F) {
@@ -504,9 +488,9 @@ public abstract class EntityLiving extends Entity {
f5 = 75.0F;
}
- this.V = this.yaw - f5;
+ this.aq = this.yaw - f5;
if (f5 * f5 > 2500.0F) {
- this.V += f5 * 0.2F;
+ this.aq += f5 * 0.2F;
}
if (flag) {
@@ -514,6 +498,9 @@ public abstract class EntityLiving extends Entity {
}
}
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("rangeChecks");
+
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
@@ -522,12 +509,12 @@ public abstract class EntityLiving extends Entity {
this.lastYaw += 360.0F;
}
- while (this.V - this.W < -180.0F) {
- this.W -= 360.0F;
+ while (this.aq - this.ar < -180.0F) {
+ this.ar -= 360.0F;
}
- while (this.V - this.W >= 180.0F) {
- this.W += 360.0F;
+ while (this.aq - this.ar >= 180.0F) {
+ this.ar += 360.0F;
}
while (this.pitch - this.lastPitch < -180.0F) {
@@ -538,19 +525,16 @@ public abstract class EntityLiving extends Entity {
this.lastPitch += 360.0F;
}
- while (this.X - this.Y < -180.0F) {
- this.Y -= 360.0F;
+ while (this.as - this.at < -180.0F) {
+ this.at -= 360.0F;
}
- while (this.X - this.Y >= 180.0F) {
- this.Y += 360.0F;
+ while (this.as - this.at >= 180.0F) {
+ this.at += 360.0F;
}
- this.ab += f2;
- }
-
- protected void b(float f, float f1) {
- super.b(f, f1);
+ this.world.methodProfiler.b();
+ this.aw += f2;
}
// CraftBukkit start - delegate so we can handle providing a reason for health being regained
@@ -593,13 +577,13 @@ public abstract class EntityLiving extends Entity {
if (this.world.isStatic) {
return false;
} else {
- this.aV = 0;
+ this.bq = 0;
if (this.health <= 0) {
return false;
} else if (damagesource.k() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
return false;
} else {
- this.aE = 1.5F;
+ this.aZ = 1.5F;
boolean flag = true;
// CraftBukkit start
@@ -617,23 +601,23 @@ public abstract class EntityLiving extends Entity {
return false;
}
- this.c(damagesource, i - this.lastDamage);
+ this.d(damagesource, i - this.lastDamage);
this.lastDamage = i;
flag = false;
} else {
this.lastDamage = i;
- this.aq = this.health;
+ this.aL = this.health;
this.noDamageTicks = this.maxNoDamageTicks;
- this.c(damagesource, i);
- this.hurtTicks = this.at = 10;
+ this.d(damagesource, i);
+ this.hurtTicks = this.aO = 10;
}
- this.au = 0.0F;
+ this.aP = 0.0F;
Entity entity = damagesource.getEntity();
if (entity != null) {
if (entity instanceof EntityLiving) {
- this.a((EntityLiving) entity);
+ this.c((EntityLiving) entity);
}
if (entity instanceof EntityHuman) {
@@ -651,7 +635,10 @@ public abstract class EntityLiving extends Entity {
if (flag) {
this.world.broadcastEntityEffect(this, (byte) 2);
- this.aW();
+ if (damagesource != DamageSource.DROWN && damagesource != DamageSource.EXPLOSION2) {
+ this.K();
+ }
+
if (entity != null) {
double d0 = entity.locX - this.locX;
@@ -661,21 +648,21 @@ public abstract class EntityLiving extends Entity {
d0 = (Math.random() - Math.random()) * 0.01D;
}
- this.au = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
+ this.aP = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
this.a(entity, i, d0, d1);
} else {
- this.au = (float) ((int) (Math.random() * 2.0D) * 180);
+ this.aP = (float) ((int) (Math.random() * 2.0D) * 180);
}
}
if (this.health <= 0) {
if (flag) {
- this.world.makeSound(this, this.k(), this.p(), this.A());
+ this.world.makeSound(this, this.aS(), this.aP(), this.i());
}
this.die(damagesource);
} else if (flag) {
- this.world.makeSound(this, this.j(), this.p(), this.A());
+ this.world.makeSound(this, this.aR(), this.aP(), this.i());
}
return true;
@@ -683,66 +670,66 @@ public abstract class EntityLiving extends Entity {
}
}
- private float A() {
+ private float i() {
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 T() {
+ public int aO() {
return 0;
}
- protected void f(int i) {}
+ protected void k(int i) {}
- protected int d(DamageSource damagesource, int i) {
+ protected int b(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor()) {
- int j = 25 - this.T();
- int k = i * j + this.ar;
+ int j = 25 - this.aO();
+ int k = i * j + this.aM;
- this.f(i);
+ this.k(i);
i = k / 25;
- this.ar = k % 25;
+ this.aM = k % 25;
}
return i;
}
- protected int b(DamageSource damagesource, int i) {
+ protected int c(DamageSource damagesource, int i) {
if (this.hasEffect(MobEffectList.RESISTANCE)) {
int j = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
int k = 25 - j;
- int l = i * k + this.ar;
+ int l = i * k + this.aM;
i = l / 25;
- this.ar = l % 25;
+ this.aM = l % 25;
}
return i;
}
- protected void c(DamageSource damagesource, int i) {
- i = this.d(damagesource, i);
+ protected void d(DamageSource damagesource, int i) {
i = this.b(damagesource, i);
+ i = this.c(damagesource, i);
this.health -= i;
}
- protected float p() {
+ protected float aP() {
return 1.0F;
}
- protected String i() {
+ protected String aQ() {
return null;
}
- protected String j() {
+ protected String aR() {
return "damage.hurtflesh";
}
- protected String k() {
+ protected String aS() {
return "damage.hurtflesh";
}
public void a(Entity entity, int i, double d0, double d1) {
- this.ce = true;
+ this.al = true;
float f = MathHelper.sqrt(d0 * d0 + d1 * d1);
float f1 = 0.4F;
@@ -760,15 +747,15 @@ public abstract class EntityLiving extends Entity {
public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity();
- if (this.aj >= 0 && entity != null) {
- entity.b(this, this.aj);
+ if (this.aE >= 0 && entity != null) {
+ entity.c(this, this.aE);
}
if (entity != null) {
- entity.c(this);
+ entity.a(this);
}
- this.az = true;
+ this.aU = true;
if (!this.world.isStatic) {
int i = 0;
@@ -782,7 +769,7 @@ public abstract class EntityLiving extends Entity {
int j = this.random.nextInt(200) - i;
if (j < 5) {
- this.b(j <= 0 ? 1 : 0);
+ this.l(j <= 0 ? 1 : 0);
}
}
} else { // CraftBukkit
@@ -794,16 +781,15 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit start - change return type to ItemStack
- protected ItemStack b(int i) {
+ protected ItemStack l(int i) {
return null;
}
// CraftBukkit end
protected void dropDeathLoot(boolean flag, int i) {
- int j = this.getLootId();
-
// CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+ int j = this.getLootId();
if (j > 0) {
int k = this.random.nextInt(3);
@@ -822,7 +808,7 @@ public abstract class EntityLiving extends Entity {
int k = this.random.nextInt(200) - i;
if (k < 5) {
- ItemStack itemstack = this.b(k <= 0 ? 1 : 0);
+ ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
if (itemstack != null) {
loot.add(new org.bukkit.craftbukkit.inventory.CraftItemStack(itemstack));
}
@@ -839,7 +825,7 @@ public abstract class EntityLiving extends Entity {
protected void a(float f) {
super.a(f);
- int i = (int) Math.ceil((double) (f - 3.0F));
+ int i = MathHelper.f(f - 3.0F);
if (i > 0) {
// CraftBukkit start
@@ -854,10 +840,12 @@ public abstract class EntityLiving extends Entity {
} else {
this.world.makeSound(this, "damage.fallsmall", 1.0F, 1.0F);
}
+
this.getBukkitEntity().setLastDamageCause(event);
this.damageEntity(DamageSource.FALL, i);
}
// CraftBukkit end
+
int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
if (j > 0) {
@@ -868,21 +856,21 @@ public abstract class EntityLiving extends Entity {
}
}
- public void a(float f, float f1) {
+ public void e(float f, float f1) {
double d0;
- if (this.aU()) {
+ if (this.H() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
- this.a(f, f1, this.c_() ? 0.04F : 0.02F);
+ this.a(f, f1, this.aV() ? 0.04F : 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
this.motZ *= 0.800000011920929D;
this.motY -= 0.02D;
- if (this.positionChanged && this.d(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
+ if (this.positionChanged && this.c(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
- } else if (this.aV()) {
+ } else if (this.J() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
this.a(f, f1, 0.02F);
this.move(this.motX, this.motY, this.motZ);
@@ -890,7 +878,7 @@ public abstract class EntityLiving extends Entity {
this.motY *= 0.5D;
this.motZ *= 0.5D;
this.motY -= 0.02D;
- if (this.positionChanged && this.d(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
+ if (this.positionChanged && this.c(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
} else {
@@ -909,15 +897,15 @@ public abstract class EntityLiving extends Entity {
float f4;
if (this.onGround) {
- if (this.c_()) {
- f4 = this.as();
+ if (this.aV()) {
+ f4 = this.ay();
} else {
- f4 = this.al;
+ f4 = this.aG;
}
f4 *= f3;
} else {
- f4 = this.am;
+ f4 = this.aH;
}
this.a(f, f1, f4);
@@ -931,7 +919,7 @@ public abstract class EntityLiving extends Entity {
}
}
- if (this.t()) {
+ if (this.f_()) {
float f5 = 0.15F;
if (this.motX < (double) (-f5)) {
@@ -963,7 +951,7 @@ public abstract class EntityLiving extends Entity {
}
this.move(this.motX, this.motY, this.motZ);
- if (this.positionChanged && this.t()) {
+ if (this.positionChanged && this.f_()) {
this.motY = 0.2D;
}
@@ -973,7 +961,7 @@ public abstract class EntityLiving extends Entity {
this.motZ *= (double) f2;
}
- this.aD = this.aE;
+ this.aY = this.aZ;
d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f6 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
@@ -982,11 +970,11 @@ public abstract class EntityLiving extends Entity {
f6 = 1.0F;
}
- this.aE += (f6 - this.aE) * 0.4F;
- this.aF += this.aE;
+ this.aZ += (f6 - this.aZ) * 0.4F;
+ this.ba += this.aZ;
}
- public boolean t() {
+ public boolean f_() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
@@ -1049,144 +1037,130 @@ public abstract class EntityLiving extends Entity {
return !this.dead && this.health > 0;
}
- public boolean f_() {
+ public boolean aU() {
return false;
}
- public void e(float f) {
- this.aX = f;
+ public void f(float f) {
+ this.bs = f;
}
- public void f(boolean flag) {
- this.aZ = flag;
+ public void d(boolean flag) {
+ this.bu = flag;
}
- public void e() {
- if (this.q > 0) {
- --this.q;
+ public void d() {
+ if (this.bE > 0) {
+ --this.bE;
}
- if (this.aN > 0) {
- double d0 = this.locX + (this.aO - this.locX) / (double) this.aN;
- double d1 = this.locY + (this.aP - this.locY) / (double) this.aN;
- double d2 = this.locZ + (this.aQ - this.locZ) / (double) this.aN;
+ if (this.bi > 0) {
+ double d0 = this.locX + (this.bj - this.locX) / (double) this.bi;
+ double d1 = this.locY + (this.bk - this.locY) / (double) this.bi;
+ double d2 = this.locZ + (this.bl - this.locZ) / (double) this.bi;
+ double d3 = MathHelper.g(this.bm - (double) this.yaw);
- double d3;
-
- for (d3 = this.aR - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
- ;
- }
-
- while (d3 >= 180.0D) {
- d3 -= 360.0D;
- }
-
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.aN);
- this.pitch = (float) ((double) this.pitch + (this.aS - (double) this.pitch) / (double) this.aN);
- --this.aN;
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.bi);
+ this.pitch = (float) ((double) this.pitch + (this.bn - (double) this.pitch) / (double) this.bi);
+ --this.bi;
this.setPosition(d0, d1, d2);
- this.c(this.yaw, this.pitch);
- // CraftBukkit start - getCubes is expensive, use an approximation
- if (this.world.getTypeId(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)) != 0) {
- d1 += 1.0D;
- this.setPosition(d0, d1, d2);
- }
- /*List list = this.world.getCubes(this, this.boundingBox.shrink(0.03125D, 0.0D, 0.03125D));
-
- if (list.size() > 0) {
- double d4 = 0.0D;
+ this.b(this.yaw, this.pitch);
+ }
- for (int i = 0; i < list.size(); ++i) {
- AxisAlignedBB axisalignedbb = (AxisAlignedBB) list.get(i);
+ if (Math.abs(this.motX) < 0.005D) {
+ this.motX = 0.0D;
+ }
- if (axisalignedbb.e > d4) {
- d4 = axisalignedbb.e;
- }
- }
+ if (Math.abs(this.motY) < 0.005D) {
+ this.motY = 0.0D;
+ }
- d1 += d4 - this.boundingBox.b;
- this.setPosition(d0, d1, d2);
- }*/
- // CraftBukkit end
+ if (Math.abs(this.motZ) < 0.005D) {
+ this.motZ = 0.0D;
}
- // MethodProfiler.a("ai"); // CraftBukkit - not in production code
- if (this.Q()) {
- this.aZ = false;
- this.aW = 0.0F;
- this.aX = 0.0F;
- this.aY = 0.0F;
- } else if (this.aF()) {
- if (this.c_()) {
- // MethodProfiler.a("newAi"); // CraftBukkit - not in production code
- this.z_();
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("ai"); // CraftBukkit - not in production code
+ if (this.aX()) {
+ this.bu = false;
+ this.br = 0.0F;
+ this.bs = 0.0F;
+ this.bt = 0.0F;
+ } else if (this.aW()) {
+ if (this.aV()) {
+ // this.world.methodProfiler.a("newAi"); // CraftBukkit - not in production code
+ this.bc();
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
} else {
- // MethodProfiler.a("oldAi"); // CraftBukkit - not in production code
- this.d_();
- // MethodProfiler.a(); // CraftBukkit - not in production code
- this.X = this.yaw;
+ // this.world.methodProfiler.a("oldAi"); // CraftBukkit - not in production code
+ this.be();
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ this.as = this.yaw;
}
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
- boolean flag = this.aU();
- boolean flag1 = this.aV();
-
- if (this.aZ) {
- if (flag) {
- this.motY += 0.03999999910593033D;
- } else if (flag1) {
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("jump"); // CraftBukkit - not in production code
+ if (this.bu) {
+ if (!this.H() && !this.J()) {
+ if (this.onGround && this.bE == 0) {
+ this.aZ();
+ this.bE = 10;
+ }
+ } else {
this.motY += 0.03999999910593033D;
- } else if (this.onGround && this.q == 0) {
- this.ac();
- this.q = 10;
}
} else {
- this.q = 0;
+ this.bE = 0;
}
- this.aW *= 0.98F;
- this.aX *= 0.98F;
- this.aY *= 0.9F;
- float f = this.al;
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("travel"); // CraftBukkit - not in production code
+ this.br *= 0.98F;
+ this.bs *= 0.98F;
+ this.bt *= 0.9F;
+ float f = this.aG;
- this.al *= this.J();
- this.a(this.aW, this.aX);
- this.al = f;
- // MethodProfiler.a("push"); // CraftBukkit - not in production code
- List list1 = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+ this.aG *= this.bs();
+ this.e(this.br, this.bs);
+ this.aG = f;
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("push"); // CraftBukkit - not in production code
+ if (!this.world.isStatic) {
+ List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ if (list != null && !list.isEmpty()) {
+ Iterator iterator = list.iterator();
- if (list1 != null && list1.size() > 0) {
- for (int j = 0; j < list1.size(); ++j) {
- Entity entity = (Entity) list1.get(j);
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
- if (entity.e_()) {
- entity.collide(this);
+ if (entity.M()) {
+ entity.collide(this);
+ }
}
}
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
}
- protected boolean c_() {
+ protected boolean aV() {
return false;
}
- protected boolean aF() {
+ protected boolean aW() {
return !this.world.isStatic;
}
- protected boolean Q() {
+ protected boolean aX() {
return this.health <= 0;
}
- public boolean P() {
+ public boolean aY() {
return false;
}
- protected void ac() {
+ protected void aZ() {
this.motY = 0.41999998688697815D;
if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
@@ -1199,14 +1173,14 @@ public abstract class EntityLiving extends Entity {
this.motZ += (double) (MathHelper.cos(f) * 0.2F);
}
- this.ce = true;
+ this.al = true;
}
- protected boolean n() {
+ protected boolean ba() {
return true;
}
- protected void aG() {
+ protected void bb() {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
if (entityhuman != null) {
@@ -1215,88 +1189,92 @@ public abstract class EntityLiving extends Entity {
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (this.n() && d3 > 16384.0D) {
+ if (this.ba() && d3 > 16384.0D) {
this.die();
}
- if (this.aV > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.n()) {
+ if (this.bq > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.ba()) {
this.die();
} else if (d3 < 1024.0D) {
- this.aV = 0;
+ this.bq = 0;
}
}
}
- protected void z_() {
- ++this.aV;
- //MethodProfiler.a("checkDespawn"); // CraftBukkit - not in production code
- this.aG();
- //MethodProfiler.a(); // CraftBukkit - not in production code
- //MethodProfiler.a("sensing"); // CraftBukkit - not in production code
- this.m.a();
- //MethodProfiler.a(); // CraftBukkit - not in production code
- //MethodProfiler.a("targetSelector"); // CraftBukkit - not in production code
+ protected void bc() {
+ ++this.bq;
+ // this.world.methodProfiler.a("checkDespawn"); // CraftBukkit - not in production code
+ this.bb();
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("sensing"); // CraftBukkit - not in production code
+ this.bA.a();
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("targetSelector"); // CraftBukkit - not in production code
this.targetSelector.a();
- //MethodProfiler.a(); // CraftBukkit - not in production code
- //MethodProfiler.a("goalSelector"); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("goalSelector"); // CraftBukkit - not in production code
this.goalSelector.a();
- //MethodProfiler.a(); // CraftBukkit - not in production code
- //MethodProfiler.a("navigation"); // CraftBukkit - not in production code
- this.navigation.d();
- //MethodProfiler.a(); // CraftBukkit - not in production code
- //MethodProfiler.a("mob tick"); // CraftBukkit - not in production code
- this.g();
- //MethodProfiler.a(); // CraftBukkit - not in production code
- //MethodProfiler.a("controls"); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("navigation"); // CraftBukkit - not in production code
+ this.navigation.e();
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("mob tick"); // CraftBukkit - not in production code
+ this.bd();
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("controls"); // CraftBukkit - not in production code
+ // this.world.methodProfiler.a("move"); // CraftBukkit - not in production code
this.moveController.c();
+ // this.world.methodProfiler.c("look"); // CraftBukkit - not in production code
this.lookController.a();
+ // this.world.methodProfiler.c("jump"); // CraftBukkit - not in production code
this.jumpController.b();
- //MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.world.methodProfiler.b(); // CraftBukkit - not in production code
}
- protected void g() {}
+ protected void bd() {}
- protected void d_() {
- ++this.aV;
- this.aG();
- this.aW = 0.0F;
- this.aX = 0.0F;
+ protected void be() {
+ ++this.bq;
+ this.bb();
+ this.br = 0.0F;
+ this.bs = 0.0F;
float f = 8.0F;
if (this.random.nextFloat() < 0.02F) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, (double) f);
if (entityhuman != null) {
- this.r = entityhuman;
- this.bc = 10 + this.random.nextInt(20);
+ this.bF = entityhuman;
+ this.bx = 10 + this.random.nextInt(20);
} else {
- this.aY = (this.random.nextFloat() - 0.5F) * 20.0F;
+ this.bt = (this.random.nextFloat() - 0.5F) * 20.0F;
}
}
- if (this.r != null) {
- this.a(this.r, 10.0F, (float) this.D());
- if (this.bc-- <= 0 || this.r.dead || this.r.j(this) > (double) (f * f)) {
- this.r = null;
+ if (this.bF != null) {
+ this.a(this.bF, 10.0F, (float) this.bf());
+ if (this.bx-- <= 0 || this.bF.dead || this.bF.e((Entity) this) > (double) (f * f)) {
+ this.bF = null;
}
} else {
if (this.random.nextFloat() < 0.05F) {
- this.aY = (this.random.nextFloat() - 0.5F) * 20.0F;
+ this.bt = (this.random.nextFloat() - 0.5F) * 20.0F;
}
- this.yaw += this.aY;
- this.pitch = this.ba;
+ this.yaw += this.bt;
+ this.pitch = this.bv;
}
- boolean flag = this.aU();
- boolean flag1 = this.aV();
+ boolean flag = this.H();
+ boolean flag1 = this.J();
if (flag || flag1) {
- this.aZ = this.random.nextFloat() < 0.8F;
+ this.bu = this.random.nextFloat() < 0.8F;
}
}
- public int D() {
+ public int bf() {
return 40;
}
@@ -1322,15 +1300,7 @@ public abstract class EntityLiving extends Entity {
}
private float b(float f, float f1, float f2) {
- float f3;
-
- for (f3 = f1 - f; f3 < -180.0F; f3 += 360.0F) {
- ;
- }
-
- while (f3 >= 180.0F) {
- f3 -= 360.0F;
- }
+ float f3 = MathHelper.g(f1 - f);
if (f3 > f2) {
f3 = f2;
@@ -1343,13 +1313,11 @@ public abstract class EntityLiving extends Entity {
return f + f3;
}
- public void aH() {}
-
public boolean canSpawn() {
- return this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
+ return this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- protected void aI() {
+ protected void C() {
// CraftBukkit start
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.VOID, 4);
this.world.getServer().getPluginManager().callEvent(event);
@@ -1363,11 +1331,11 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
- public Vec3D aJ() {
- return this.f(1.0F);
+ public Vec3D Z() {
+ return this.i(1.0F);
}
- public Vec3D f(float f) {
+ public Vec3D i(float f) {
float f1;
float f2;
float f3;
@@ -1378,7 +1346,7 @@ public abstract class EntityLiving extends Entity {
f2 = MathHelper.sin(-this.yaw * 0.017453292F - 3.1415927F);
f3 = -MathHelper.cos(-this.pitch * 0.017453292F);
f4 = MathHelper.sin(-this.pitch * 0.017453292F);
- return Vec3D.create((double) (f2 * f3), (double) f4, (double) (f1 * f3));
+ return Vec3D.a().create((double) (f2 * f3), (double) f4, (double) (f1 * f3));
} else {
f1 = this.lastPitch + (this.pitch - this.lastPitch) * f;
f2 = this.lastYaw + (this.yaw - this.lastYaw) * f;
@@ -1387,11 +1355,11 @@ public abstract class EntityLiving extends Entity {
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
float f6 = MathHelper.sin(-f1 * 0.017453292F);
- return Vec3D.create((double) (f4 * f5), (double) f6, (double) (f3 * f5));
+ return Vec3D.a().create((double) (f4 * f5), (double) f6, (double) (f3 * f5));
}
}
- public int q() {
+ public int bl() {
return 4;
}
@@ -1399,7 +1367,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
- protected void aK() {
+ protected void bo() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@@ -1408,23 +1376,23 @@ public abstract class EntityLiving extends Entity {
if (!mobeffect.tick(this) && !this.world.isStatic) {
iterator.remove();
- this.d(mobeffect);
+ this.c(mobeffect);
}
}
int i;
- if (this.e) {
+ if (this.updateEffects) {
if (!this.world.isStatic) {
- if (!this.effects.isEmpty()) {
+ if (this.effects.isEmpty()) {
+ this.datawatcher.watch(8, Integer.valueOf(0));
+ } else {
i = PotionBrewer.a(this.effects.values());
this.datawatcher.watch(8, Integer.valueOf(i));
- } else {
- this.datawatcher.watch(8, Integer.valueOf(0));
}
}
- this.e = false;
+ this.updateEffects = false;
}
if (this.random.nextBoolean()) {
@@ -1439,7 +1407,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public void aL() {
+ public void bp() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@@ -1448,7 +1416,7 @@ public abstract class EntityLiving extends Entity {
if (!this.world.isStatic) {
iterator.remove();
- this.d(mobeffect);
+ this.c(mobeffect);
}
}
}
@@ -1466,19 +1434,19 @@ public abstract class EntityLiving extends Entity {
}
public void addEffect(MobEffect mobeffect) {
- if (this.a(mobeffect)) {
+ if (this.e(mobeffect)) {
if (this.effects.containsKey(Integer.valueOf(mobeffect.getEffectId()))) {
((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId()))).a(mobeffect);
- this.c((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId())));
+ this.b((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId())));
} else {
this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
- this.b(mobeffect);
+ this.a(mobeffect);
}
}
}
- public boolean a(MobEffect mobeffect) {
- if (this.getMonsterType() == MonsterType.UNDEAD) {
+ public boolean e(MobEffect mobeffect) {
+ if (this.getMonsterType() == EnumMonsterType.UNDEAD) {
int i = mobeffect.getEffectId();
if (i == MobEffectList.REGENERATION.id || i == MobEffectList.POISON.id) {
@@ -1489,23 +1457,23 @@ public abstract class EntityLiving extends Entity {
return true;
}
- public boolean aN() {
- return this.getMonsterType() == MonsterType.UNDEAD;
+ public boolean br() {
+ return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
- protected void b(MobEffect mobeffect) {
- this.e = true;
+ protected void a(MobEffect mobeffect) {
+ this.updateEffects = true;
}
- protected void c(MobEffect mobeffect) {
- this.e = true;
+ protected void b(MobEffect mobeffect) {
+ this.updateEffects = true;
}
- protected void d(MobEffect mobeffect) {
- this.e = true;
+ protected void c(MobEffect mobeffect) {
+ this.updateEffects = true;
}
- protected float J() {
+ protected float bs() {
float f = 1.0F;
if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
@@ -1527,19 +1495,19 @@ public abstract class EntityLiving extends Entity {
return false;
}
- public MonsterType getMonsterType() {
- return MonsterType.UNDEFINED;
+ public EnumMonsterType getMonsterType() {
+ return EnumMonsterType.UNDEFINED;
}
- public void c(ItemStack itemstack) {
+ public void a(ItemStack itemstack) {
this.world.makeSound(this, "random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F);
for (int i = 0; i < 5; ++i) {
- Vec3D vec3d = Vec3D.create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
+ Vec3D vec3d = Vec3D.a().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
vec3d.a(-this.pitch * 3.1415927F / 180.0F);
vec3d.b(-this.yaw * 3.1415927F / 180.0F);
- Vec3D vec3d1 = Vec3D.create(((double) this.random.nextFloat() - 0.5D) * 0.3D, (double) (-this.random.nextFloat()) * 0.6D - 0.3D, 0.6D);
+ Vec3D vec3d1 = Vec3D.a().create(((double) this.random.nextFloat() - 0.5D) * 0.3D, (double) (-this.random.nextFloat()) * 0.6D - 0.3D, 0.6D);
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java
index cbfd6ad1..8bccfaa4 100644
--- a/src/main/java/net/minecraft/server/EntityMagmaCube.java
+++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java
@@ -6,26 +6,26 @@ public class EntityMagmaCube extends EntitySlime {
super(world);
this.texture = "/mob/lava.png";
this.fireProof = true;
- this.al = 0.2F;
+ this.aG = 0.2F;
}
public boolean canSpawn() {
- return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
+ return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- public int T() {
+ public int aO() {
return this.getSize() * 3;
}
- public float b(float f) {
+ public float c(float f) {
return 1.0F;
}
- protected String A() {
+ protected String i() {
return "flame";
}
- protected EntitySlime C() {
+ protected EntitySlime j() {
return new EntityMagmaCube(this.world);
}
@@ -58,46 +58,46 @@ public class EntityMagmaCube extends EntitySlime {
return false;
}
- protected int E() {
- return super.E() * 4;
+ protected int k() {
+ return super.k() * 4;
}
- protected void F() {
+ protected void l() {
this.a *= 0.9F;
}
- protected void ac() {
+ protected void aZ() {
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
- this.ce = true;
+ this.al = true;
}
protected void a(float f) {}
- protected boolean G() {
+ protected boolean m() {
return true;
}
- protected int H() {
- return super.H() + 2;
+ protected int n() {
+ return super.n() + 2;
}
- protected String j() {
+ protected String aR() {
return "mob.slime";
}
- protected String k() {
+ protected String aS() {
return "mob.slime";
}
- protected String I() {
+ protected String o() {
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
}
- public boolean aV() {
+ public boolean J() {
return false;
}
- protected boolean K() {
+ protected boolean p() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java
index 2cc6db22..f60dcdb3 100644
--- a/src/main/java/net/minecraft/server/EntityMinecart.java
+++ b/src/main/java/net/minecraft/server/EntityMinecart.java
@@ -26,9 +26,9 @@ public class EntityMinecart extends Entity implements IInventory {
private int h;
private double i;
private double j;
- private double k;
- private double l;
- private double m;
+ private double an;
+ private double ao;
+ private double ap;
// CraftBukkit start
public boolean slowWhenEmpty = true;
@@ -74,31 +74,31 @@ public class EntityMinecart extends Entity implements IInventory {
this.items = new ItemStack[27]; // CraftBukkit
this.e = 0;
this.f = false;
- this.bf = true;
- this.b(0.98F, 0.7F);
+ this.m = true;
+ this.a(0.98F, 0.7F);
this.height = this.length / 2.0F;
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
- protected void b() {
+ protected void a() {
this.datawatcher.a(16, new Byte((byte) 0));
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(1));
this.datawatcher.a(19, new Integer(0));
}
- public AxisAlignedBB b_(Entity entity) {
+ public AxisAlignedBB g(Entity entity) {
return entity.boundingBox;
}
- public AxisAlignedBB h() {
+ public AxisAlignedBB E() {
return null;
}
- public boolean e_() {
+ public boolean M() {
return true;
}
@@ -116,7 +116,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
- public double x_() {
+ public double X() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@@ -136,14 +136,19 @@ public class EntityMinecart extends Entity implements IInventory {
i = event.getDamage();
// CraftBukkit end
- this.e(-this.n());
- this.d(10);
- this.aW();
+ 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);
+ }
+
if (this.getDamage() > 40) {
if (this.passenger != null) {
this.passenger.mount(this);
}
+
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
@@ -199,7 +204,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
- public boolean o_() {
+ public boolean L() {
return !this.dead;
}
@@ -239,7 +244,7 @@ public class EntityMinecart extends Entity implements IInventory {
super.die();
}
- public void F_() {
+ public void h_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@@ -248,8 +253,8 @@ public class EntityMinecart extends Entity implements IInventory {
float prevPitch = this.pitch;
// CraftBukkit end
- if (this.m() > 0) {
- this.d(this.m() - 1);
+ if (this.j() > 0) {
+ this.h(this.j() - 1);
}
if (this.getDamage() > 0) {
@@ -257,10 +262,10 @@ public class EntityMinecart extends Entity implements IInventory {
}
if (this.locY < -64.0D) {
- this.aI();
+ this.C();
}
- if (this.k() && this.random.nextInt(4) == 0) {
+ if (this.h() && this.random.nextInt(4) == 0) {
this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
}
@@ -268,26 +273,17 @@ public class EntityMinecart extends Entity implements IInventory {
if (this.h > 0) {
double d0 = this.locX + (this.i - this.locX) / (double) this.h;
double d1 = this.locY + (this.j - this.locY) / (double) this.h;
- double d2 = this.locZ + (this.k - this.locZ) / (double) this.h;
-
- double d3;
-
- for (d3 = this.l - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
- ;
- }
-
- while (d3 >= 180.0D) {
- d3 -= 360.0D;
- }
+ double d2 = this.locZ + (this.an - this.locZ) / (double) this.h;
+ double d3 = MathHelper.g(this.ao - (double) this.yaw);
this.yaw = (float) ((double) this.yaw + d3 / (double) this.h);
- this.pitch = (float) ((double) this.pitch + (this.m - (double) this.pitch) / (double) this.h);
+ this.pitch = (float) ((double) this.pitch + (this.ap - (double) this.pitch) / (double) this.h);
--this.h;
this.setPosition(d0, d1, d2);
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
} else {
this.setPosition(this.locX, this.locY, this.locZ);
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
}
} else {
this.lastX = this.locX;
@@ -298,7 +294,7 @@ public class EntityMinecart extends Entity implements IInventory {
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- if (BlockMinecartTrack.g(this.world, i, j - 1, k)) {
+ if (BlockMinecartTrack.d_(this.world, i, j - 1, k)) {
--j;
}
@@ -308,7 +304,7 @@ public class EntityMinecart extends Entity implements IInventory {
int l = this.world.getTypeId(i, j, k);
if (BlockMinecartTrack.d(l)) {
- Vec3D vec3d = this.h(this.locX, this.locY, this.locZ);
+ Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
int i1 = this.world.getData(i, j, k);
this.locY = (double) j;
@@ -320,7 +316,7 @@ public class EntityMinecart extends Entity implements IInventory {
flag1 = !flag;
}
- if (((BlockMinecartTrack) Block.byId[l]).i()) {
+ if (((BlockMinecartTrack) Block.byId[l]).n()) {
i1 &= 7;
}
@@ -360,10 +356,21 @@ public class EntityMinecart extends Entity implements IInventory {
this.motX = d10 * d6 / d8;
this.motZ = d10 * d7 / d8;
double d11;
+ double d12;
+
+ if (this.passenger != null) {
+ d12 = this.passenger.motX * this.passenger.motX + this.passenger.motZ * this.passenger.motZ;
+ d11 = this.motX * this.motX + this.motZ * this.motZ;
+ if (d12 > 1.0E-4D && d11 < 0.01D) {
+ this.motX += this.passenger.motX * 0.1D;
+ this.motZ += this.passenger.motZ * 0.1D;
+ flag1 = false;
+ }
+ }
if (flag1) {
- d11 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- if (d11 < 0.03D) {
+ d12 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+ if (d12 < 0.03D) {
this.motX *= 0.0D;
this.motY *= 0.0D;
this.motZ *= 0.0D;
@@ -374,39 +381,37 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
- d11 = 0.0D;
- double d12 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
+ d12 = 0.0D;
+ d11 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
double d13 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
double d14 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
double d15 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
- d6 = d14 - d12;
+ d6 = d14 - d11;
d7 = d15 - d13;
double d16;
double d17;
- double d18;
if (d6 == 0.0D) {
this.locX = (double) i + 0.5D;
- d11 = this.locZ - (double) k;
+ d12 = this.locZ - (double) k;
} else if (d7 == 0.0D) {
this.locZ = (double) k + 0.5D;
- d11 = this.locX - (double) i;
+ d12 = this.locX - (double) i;
} else {
- d16 = this.locX - d12;
- d18 = this.locZ - d13;
- d17 = (d16 * d6 + d18 * d7) * 2.0D;
- d11 = d17;
+ d16 = this.locX - d11;
+ d17 = this.locZ - d13;
+ d12 = (d16 * d6 + d17 * d7) * 2.0D;
}
- this.locX = d12 + d6 * d11;
- this.locZ = d13 + d7 * d11;
+ this.locX = d11 + d6 * d12;
+ this.locZ = d13 + d7 * d12;
this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
d16 = this.motX;
- d18 = this.motZ;
+ d17 = this.motZ;
if (this.passenger != null) {
d16 *= 0.75D;
- d18 *= 0.75D;
+ d17 *= 0.75D;
}
if (d16 < -d4) {
@@ -417,15 +422,15 @@ public class EntityMinecart extends Entity implements IInventory {
d16 = d4;
}
- if (d18 < -d4) {
- d18 = -d4;
+ if (d17 < -d4) {
+ d17 = -d4;
}
- if (d18 > d4) {
- d18 = d4;
+ if (d17 > d4) {
+ d17 = d4;
}
- this.move(d16, 0.0D, d18);
+ this.move(d16, 0.0D, d17);
if (aint[0][1] != 0 && MathHelper.floor(this.locX) - i == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) {
this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ);
} else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - i == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) {
@@ -439,10 +444,12 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ *= 0.996999979019165D;
} else {
if (this.type == 2) {
- d17 = (double) MathHelper.sqrt(this.b * this.b + this.c * this.c);
- if (d17 > 0.01D) {
- this.b /= d17;
- this.c /= d17;
+ double d18 = this.b * this.b + this.c * this.c;
+
+ if (d18 > 1.0E-4D) {
+ d18 = (double) MathHelper.sqrt(d18);
+ this.b /= d18;
+ this.c /= d18;
double d19 = 0.04D;
this.motX *= 0.800000011920929D;
@@ -462,7 +469,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ *= 0.9599999785423279D;
}
- Vec3D vec3d1 = this.h(this.locX, this.locY, this.locZ);
+ Vec3D vec3d1 = this.a(this.locX, this.locY, this.locZ);
if (vec3d1 != null && vec3d != null) {
double d20 = (vec3d.b - vec3d1.b) * 0.05D;
@@ -488,8 +495,9 @@ public class EntityMinecart extends Entity implements IInventory {
double d21;
if (this.type == 2) {
- d21 = (double) MathHelper.sqrt(this.b * this.b + this.c * this.c);
- if (d21 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
+ d21 = this.b * this.b + this.c * this.c;
+ if (d21 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) {
+ d21 = (double) MathHelper.sqrt(d21);
this.b /= d21;
this.c /= d21;
if (this.b * this.motX + this.c * this.motZ < 0.0D) {
@@ -510,19 +518,21 @@ 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.e(i - 1, j, k)) {
+ if (this.world.s(i - 1, j, k)) {
this.motX = 0.02D;
- } else if (this.world.e(i + 1, j, k)) {
+ } else if (this.world.s(i + 1, j, k)) {
this.motX = -0.02D;
}
} else if (i1 == 0) {
- if (this.world.e(i, j, k - 1)) {
+ if (this.world.s(i, j, k - 1)) {
this.motZ = 0.02D;
- } else if (this.world.e(i, j, k + 1)) {
+ } else if (this.world.s(i, j, k + 1)) {
this.motZ = -0.02D;
}
}
}
+
+ this.D();
} else {
if (this.motX < -d4) {
this.motX = -d4;
@@ -562,29 +572,21 @@ public class EntityMinecart extends Entity implements IInventory {
double d23 = this.lastX - this.locX;
double d24 = this.lastZ - this.locZ;
- if (d23 * d23 + d24 * d24 > 0.0010D) {
+ if (d23 * d23 + d24 * d24 > 0.001D) {
this.yaw = (float) (Math.atan2(d24, d23) * 180.0D / 3.141592653589793D);
if (this.f) {
this.yaw += 180.0F;
}
}
- double d25;
-
- for (d25 = (double) (this.yaw - this.lastYaw); d25 >= 180.0D; d25 -= 360.0D) {
- ;
- }
-
- while (d25 < -180.0D) {
- d25 += 360.0D;
- }
+ double d25 = (double) MathHelper.g(this.yaw - this.lastYaw);
if (d25 < -170.0D || d25 >= 170.0D) {
this.yaw += 180.0F;
this.f = !this.f;
}
- this.c(this.yaw, this.pitch);
+ this.b(this.yaw, this.pitch);
// CraftBukkit start
org.bukkit.World bworld = this.world.getWorld();
@@ -601,11 +603,11 @@ public class EntityMinecart extends Entity implements IInventory {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- if (list != null && list.size() > 0) {
+ if (list != null && !list.isEmpty()) {
for (int l1 = 0; l1 < list.size(); ++l1) {
Entity entity = (Entity) list.get(l1);
- if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) {
+ if (entity != this.passenger && entity.M() && entity instanceof EntityMinecart) {
entity.collide(this);
}
}
@@ -627,16 +629,16 @@ public class EntityMinecart extends Entity implements IInventory {
this.b = this.c = 0.0D;
}
- this.a(this.e > 0);
+ this.d(this.e > 0);
}
}
- public Vec3D h(double d0, double d1, double d2) {
+ public Vec3D a(double d0, double d1, double d2) {
int i = MathHelper.floor(d0);
int j = MathHelper.floor(d1);
int k = MathHelper.floor(d2);
- if (BlockMinecartTrack.g(this.world, i, j - 1, k)) {
+ if (BlockMinecartTrack.d_(this.world, i, j - 1, k)) {
--j;
}
@@ -646,7 +648,7 @@ public class EntityMinecart extends Entity implements IInventory {
int i1 = this.world.getData(i, j, k);
d1 = (double) j;
- if (((BlockMinecartTrack) Block.byId[l]).i()) {
+ if (((BlockMinecartTrack) Block.byId[l]).n()) {
i1 &= 7;
}
@@ -675,9 +677,8 @@ public class EntityMinecart extends Entity implements IInventory {
} else {
double d13 = d0 - d4;
double d14 = d2 - d6;
- double d15 = (d13 * d10 + d14 * d12) * 2.0D;
- d3 = d15;
+ d3 = (d13 * d10 + d14 * d12) * 2.0D;
}
d0 = d4 + d10 * d3;
@@ -691,7 +692,7 @@ public class EntityMinecart extends Entity implements IInventory {
d1 += 0.5D;
}
- return Vec3D.create(d0, d1, d2);
+ return Vec3D.a().create(d0, d1, d2);
} else {
return null;
}
@@ -765,7 +766,7 @@ public class EntityMinecart extends Entity implements IInventory {
double d1 = entity.locZ - this.locZ;
double d2 = d0 * d0 + d1 * d1;
- // CraftBukkit - Collision
+ // CraftBukkit - collision
if (d2 >= 9.999999747378752E-5D && !collisionEvent.isCollisionCancelled()) {
d2 = (double) MathHelper.sqrt(d2);
d0 /= d2;
@@ -780,16 +781,16 @@ public class EntityMinecart extends Entity implements IInventory {
d1 *= d3;
d0 *= 0.10000000149011612D;
d1 *= 0.10000000149011612D;
- d0 *= (double) (1.0F - this.bR);
- d1 *= (double) (1.0F - this.bR);
+ d0 *= (double) (1.0F - this.Y);
+ d1 *= (double) (1.0F - this.Y);
d0 *= 0.5D;
d1 *= 0.5D;
if (entity instanceof EntityMinecart) {
double d4 = entity.locX - this.locX;
double d5 = entity.locZ - this.locZ;
- Vec3D vec3d = Vec3D.create(d4, 0.0D, d5).b();
- Vec3D vec3d1 = Vec3D.create((double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F), 0.0D, (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F)).b();
- double d6 = Math.abs(vec3d.a(vec3d1));
+ Vec3D vec3d = Vec3D.a().create(d4, 0.0D, d5).b();
+ Vec3D vec3d1 = Vec3D.a().create((double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F), 0.0D, (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F)).b();
+ double d6 = Math.abs(vec3d.b(vec3d1));
if (d6 < 0.800000011920929D) {
return;
@@ -801,13 +802,13 @@ public class EntityMinecart extends Entity implements IInventory {
if (((EntityMinecart) entity).type == 2 && this.type != 2) {
this.motX *= 0.20000000298023224D;
this.motZ *= 0.20000000298023224D;
- this.b_(entity.motX - d0, 0.0D, entity.motZ - d1);
+ this.g(entity.motX - d0, 0.0D, entity.motZ - d1);
entity.motX *= 0.949999988079071D;
entity.motZ *= 0.949999988079071D;
} else if (((EntityMinecart) entity).type != 2 && this.type == 2) {
entity.motX *= 0.20000000298023224D;
entity.motZ *= 0.20000000298023224D;
- entity.b_(this.motX + d0, 0.0D, this.motZ + d1);
+ entity.g(this.motX + d0, 0.0D, this.motZ + d1);
this.motX *= 0.949999988079071D;
this.motZ *= 0.949999988079071D;
} else {
@@ -815,14 +816,14 @@ public class EntityMinecart extends Entity implements IInventory {
d8 /= 2.0D;
this.motX *= 0.20000000298023224D;
this.motZ *= 0.20000000298023224D;
- this.b_(d7 - d0, 0.0D, d8 - d1);
+ this.g(d7 - d0, 0.0D, d8 - d1);
entity.motX *= 0.20000000298023224D;
entity.motZ *= 0.20000000298023224D;
- entity.b_(d7 + d0, 0.0D, d8 + d1);
+ entity.g(d7 + d0, 0.0D, d8 + d1);
}
} else {
- this.b_(-d0, 0.0D, -d1);
- entity.b_(d0 / 4.0D, 0.0D, d1 / 4.0D);
+ this.g(-d0, 0.0D, -d1);
+ entity.g(d0 / 4.0D, 0.0D, d1 / 4.0D);
}
}
}
@@ -886,7 +887,7 @@ public class EntityMinecart extends Entity implements IInventory {
public void update() {}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (this.type == 0) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
@@ -918,14 +919,14 @@ public class EntityMinecart extends Entity implements IInventory {
}
public boolean a(EntityHuman entityhuman) {
- return this.dead ? false : entityhuman.j(this) <= 64.0D;
+ return this.dead ? false : entityhuman.e(this) <= 64.0D;
}
- protected boolean k() {
+ protected boolean h() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
- protected void a(boolean flag) {
+ protected void d(boolean flag) {
if (flag) {
this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) | 1)));
} else {
@@ -933,9 +934,9 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
public void setDamage(int i) {
this.datawatcher.watch(19, Integer.valueOf(i));
@@ -945,19 +946,19 @@ public class EntityMinecart extends Entity implements IInventory {
return this.datawatcher.getInt(19);
}
- public void d(int i) {
+ public void h(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
- public int m() {
+ public int j() {
return this.datawatcher.getInt(17);
}
- public void e(int i) {
+ public void i(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
- public int n() {
+ public int k() {
return this.datawatcher.getInt(18);
}
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index a72b2707..0a2eae32 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -8,21 +8,21 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
public EntityMonster(World world) {
super(world);
- this.aA = 5;
+ this.aV = 5;
}
- public void e() {
- float f = this.b(1.0F);
+ public void d() {
+ float f = this.c(1.0F);
if (f > 0.5F) {
- this.aV += 2;
+ this.bq += 2;
}
- super.e();
+ super.d();
}
- public void F_() {
- super.F_();
+ public void h_() {
+ super.h_();
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
@@ -31,7 +31,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
- return entityhuman != null && this.h(entityhuman) ? entityhuman : null;
+ return entityhuman != null && this.l(entityhuman) ? entityhuman : null;
}
public boolean damageEntity(DamageSource damagesource, int i) {
@@ -40,7 +40,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
if (this.passenger != entity && this.vehicle != entity) {
if (entity != this) {
- // CraftBukkit start - We still need to call events for entities without goals
+ // CraftBukkit start - we still need to call events for entities without goals
if (entity != this.target && (this instanceof EntityBlaze || this instanceof EntityEnderman || this instanceof EntitySpider || this instanceof EntityGiantZombie || this instanceof EntitySilverfish)) {
EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this, entity, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
@@ -66,7 +66,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
- public boolean a(Entity entity) {
+ public boolean k(Entity entity) {
int i = this.damage;
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
@@ -83,38 +83,30 @@ 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.a(entity);
+ this.k(entity);
}
}
public float a(int i, int j, int k) {
- return 0.5F - this.world.p(i, j, k);
+ return 0.5F - this.world.o(i, j, k);
}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
- protected boolean C() {
+ protected boolean o() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
- if (this.world.a(EnumSkyBlock.SKY, i, j, k) > this.random.nextInt(32)) {
+ if (this.world.b(EnumSkyBlock.SKY, i, j, k) > this.random.nextInt(32)) {
return false;
} else {
int l = this.world.getLightLevel(i, j, k);
- if (this.world.w()) {
- int i1 = this.world.f;
+ if (this.world.I()) {
+ int i1 = this.world.k;
- this.world.f = 10;
+ this.world.k = 10;
l = this.world.getLightLevel(i, j, k);
- this.world.f = i1;
+ this.world.k = i1;
}
return l <= this.random.nextInt(8);
@@ -122,6 +114,6 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public boolean canSpawn() {
- return this.C() && super.canSpawn();
+ return this.o() && super.canSpawn();
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index 21ced48b..7043682f 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -7,10 +7,10 @@ public class EntityMushroomCow extends EntityCow {
public EntityMushroomCow(World world) {
super(world);
this.texture = "/mob/redcow.png";
- this.b(0.9F, 1.3F);
+ this.a(0.9F, 1.3F);
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
@@ -42,7 +42,7 @@ public class EntityMushroomCow extends EntityCow {
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
- entitycow.V = this.V;
+ entitycow.aq = this.aq;
this.world.addEntity(entitycow);
for (int i = 0; i < 5; ++i) {
@@ -52,7 +52,7 @@ public class EntityMushroomCow extends EntityCow {
return true;
} else {
- return super.b(entityhuman);
+ return super.c(entityhuman);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 4df09bc4..276c219b 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -2,16 +2,16 @@ package net.minecraft.server;
public class EntityOcelot extends EntityTameableAnimal {
- private PathfinderGoalTempt b;
+ private PathfinderGoalTempt e;
public EntityOcelot(World world) {
super(world);
this.texture = "/mob/ozelot.png";
- this.b(0.6F, 0.8F);
- this.al().a(true);
+ this.a(0.6F, 0.8F);
+ this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, this.a);
- this.goalSelector.a(3, this.b = new PathfinderGoalTempt(this, 0.18F, Item.RAW_FISH.id, true));
+ this.goalSelector.a(2, this.d);
+ this.goalSelector.a(3, this.e = new PathfinderGoalTempt(this, 0.18F, Item.RAW_FISH.id, true));
this.goalSelector.a(4, new PathfinderGoalAvoidPlayer(this, EntityHuman.class, 16.0F, 0.23F, 0.4F));
this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, 0.3F, 10.0F, 5.0F));
this.goalSelector.a(6, new PathfinderGoalJumpOnBlock(this, 0.4F));
@@ -23,36 +23,36 @@ public class EntityOcelot extends EntityTameableAnimal {
this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed(this, EntityChicken.class, 14.0F, 750, false));
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
- public void g() {
- if (!this.getControllerMove().a()) {
- this.setSneak(false);
- this.setSprinting(false);
- } else {
+ public void bd() {
+ if (this.getControllerMove().a()) {
float f = this.getControllerMove().b();
if (f == 0.18F) {
- this.setSneak(true);
+ this.setSneaking(true);
this.setSprinting(false);
} else if (f == 0.4F) {
- this.setSneak(false);
+ this.setSneaking(false);
this.setSprinting(true);
} else {
- this.setSneak(false);
+ this.setSneaking(false);
this.setSprinting(false);
}
+ } else {
+ this.setSneaking(false);
+ this.setSprinting(false);
}
}
- protected boolean n() {
+ protected boolean ba() {
return !this.isTamed();
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -72,19 +72,19 @@ public class EntityOcelot extends EntityTameableAnimal {
this.setCatType(nbttagcompound.getInt("CatType"));
}
- protected String i() {
- return this.isTamed() ? (this.r_() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
+ protected String aQ() {
+ return this.isTamed() ? (this.s() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
}
- protected String j() {
+ protected String aR() {
return "mob.cat.hitt";
}
- protected String k() {
+ protected String aS() {
return "mob.cat.hitt";
}
- protected float p() {
+ protected float aP() {
return 0.4F;
}
@@ -92,12 +92,12 @@ public class EntityOcelot extends EntityTameableAnimal {
return Item.LEATHER.id;
}
- public boolean a(Entity entity) {
+ public boolean k(Entity entity) {
return entity.damageEntity(DamageSource.mobAttack(this), 3);
}
public boolean damageEntity(DamageSource damagesource, int i) {
- this.a.a(false);
+ this.d.a(false);
return super.damageEntity(damagesource, i);
}
@@ -105,40 +105,41 @@ public class EntityOcelot extends EntityTameableAnimal {
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit - Call EntityDeathEvent
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (!this.isTamed()) {
- if (this.b.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.j(this) < 9.0D) {
- if (!entityhuman.abilities.canInstantlyBuild) --itemstack.count; // CraftBukkit - if the player can instantly build, don't decrement the item stack
- if (itemstack.count <= 0) {
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
- }
+ if (this.isTamed()) {
+ if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.b(itemstack)) {
+ this.d.a(!this.isSitting());
+ }
+ } else if (this.e.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.e(this) < 9.0D) {
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ }
- if (!this.world.isStatic) {
- // CraftBukkit - added event call and isCancelled check.
- if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
- this.setTamed(true);
- this.setCatType(1 + this.world.random.nextInt(3));
- this.setOwnerName(entityhuman.name);
- this.a(true);
- this.a.a(true);
- this.world.broadcastEntityEffect(this, (byte) 7);
- } else {
- this.a(false);
- this.world.broadcastEntityEffect(this, (byte) 6);
- }
- }
+ if (itemstack.count <= 0) {
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
- return true;
- } else {
- if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.a(itemstack)) {
- this.a.a(!this.isSitting());
+ if (!this.world.isStatic) {
+ // CraftBukkit - added event call and isCancelled check
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
+ this.setTamed(true);
+ this.setCatType(1 + this.world.random.nextInt(3));
+ this.setOwnerName(entityhuman.name);
+ this.e(true);
+ this.d.a(true);
+ this.world.broadcastEntityEffect(this, (byte) 7);
+ } else {
+ this.e(false);
+ this.world.broadcastEntityEffect(this, (byte) 6);
+ }
}
- return super.b(entityhuman);
+ return true;
}
+
+ return super.c(entityhuman);
}
public EntityAnimal createChild(EntityAnimal entityanimal) {
@@ -153,7 +154,7 @@ public class EntityOcelot extends EntityTameableAnimal {
return entityocelot;
}
- public boolean a(ItemStack itemstack) {
+ public boolean b(ItemStack itemstack) {
return itemstack != null && itemstack.id == Item.RAW_FISH.id;
}
@@ -167,7 +168,7 @@ public class EntityOcelot extends EntityTameableAnimal {
} else {
EntityOcelot entityocelot = (EntityOcelot) entityanimal;
- return !entityocelot.isTamed() ? false : this.r_() && entityocelot.r_();
+ return !entityocelot.isTamed() ? false : this.s() && entityocelot.s();
}
}
@@ -183,7 +184,7 @@ public class EntityOcelot extends EntityTameableAnimal {
if (this.world.random.nextInt(3) == 0) {
return false;
} else {
- if (this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox)) {
+ if (this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox)) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
diff --git a/src/main/java/net/minecraft/server/EntityPainting.java b/src/main/java/net/minecraft/server/EntityPainting.java
index 21eba049..46da1989 100644
--- a/src/main/java/net/minecraft/server/EntityPainting.java
+++ b/src/main/java/net/minecraft/server/EntityPainting.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -23,7 +24,7 @@ public class EntityPainting extends Entity {
this.f = 0;
this.direction = 0;
this.height = 0.0F;
- this.b(0.5F, 0.5F);
+ this.a(0.5F, 0.5F);
this.art = EnumArt.values()[this.random.nextInt(EnumArt.values().length)]; // CraftBukkit - generate a non-null painting
}
@@ -46,14 +47,14 @@ public class EntityPainting extends Entity {
}
}
- if (arraylist.size() > 0) {
+ if (!arraylist.isEmpty()) {
this.art = (EnumArt) arraylist.get(this.random.nextInt(arraylist.size()));
}
this.setDirection(l);
}
- protected void b() {}
+ protected void a() {}
public void setDirection(int i) {
this.direction = i;
@@ -93,39 +94,40 @@ public class EntityPainting extends Entity {
}
if (i == 0) {
- f3 -= this.c(this.art.B);
+ f3 -= this.b(this.art.B);
}
if (i == 1) {
- f5 += this.c(this.art.B);
+ f5 += this.b(this.art.B);
}
if (i == 2) {
- f3 += this.c(this.art.B);
+ f3 += this.b(this.art.B);
}
if (i == 3) {
- f5 -= this.c(this.art.B);
+ f5 -= this.b(this.art.B);
}
- f4 += this.c(this.art.C);
+ f4 += this.b(this.art.C);
this.setPosition((double) f3, (double) f4, (double) f5);
float f7 = -0.00625F;
- this.boundingBox.c((double) (f3 - f - f7), (double) (f4 - f1 - f7), (double) (f5 - f2 - f7), (double) (f3 + f + f7), (double) (f4 + f1 + f7), (double) (f5 + f2 + f7));
+ this.boundingBox.b((double) (f3 - f - f7), (double) (f4 - f1 - f7), (double) (f5 - f2 - f7), (double) (f3 + f + f7), (double) (f4 + f1 + f7), (double) (f5 + f2 + f7));
}
- private float c(int i) {
+ private float b(int i) {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
}
- public void F_() {
+ public void h_() {
if (this.f++ == 100 && !this.world.isStatic) {
this.f = 0;
if (!this.dead && !this.survives()) {
// CraftBukkit start
Material material = this.world.getMaterial((int) this.locX, (int) this.locY, (int) this.locZ);
RemoveCause cause;
+
if (material.equals(Material.WATER)) {
cause = RemoveCause.WATER;
} else if (!material.equals(Material.AIR)) {
@@ -134,6 +136,7 @@ public class EntityPainting extends Entity {
} else {
cause = RemoveCause.PHYSICS;
}
+
PaintingBreakEvent event = new PaintingBreakEvent((Painting) this.getBukkitEntity(), cause);
this.world.getServer().getPluginManager().callEvent(event);
@@ -149,7 +152,7 @@ public class EntityPainting extends Entity {
}
public boolean survives() {
- if (this.world.getCubes(this, this.boundingBox).size() > 0) {
+ if (!this.world.getCubes(this, this.boundingBox).isEmpty()) {
return false;
} else {
int i = this.art.B / 16;
@@ -176,16 +179,14 @@ public class EntityPainting extends Entity {
l = MathHelper.floor(this.locY - (double) ((float) this.art.C / 32.0F));
- int j1;
-
- for (int k1 = 0; k1 < i; ++k1) {
- for (j1 = 0; j1 < j; ++j1) {
+ for (int j1 = 0; j1 < i; ++j1) {
+ for (int k1 = 0; k1 < j; ++k1) {
Material material;
if (this.direction != 0 && this.direction != 2) {
- material = this.world.getMaterial(this.x, l + j1, i1 + k1);
+ material = this.world.getMaterial(this.x, l + k1, i1 + j1);
} else {
- material = this.world.getMaterial(k + k1, l + j1, this.z);
+ material = this.world.getMaterial(k + j1, l + k1, this.z);
}
if (!material.isBuildable()) {
@@ -195,18 +196,23 @@ public class EntityPainting extends Entity {
}
List list = this.world.getEntities(this, this.boundingBox);
+ Iterator iterator = list.iterator();
+
+ Entity entity;
- for (j1 = 0; j1 < list.size(); ++j1) {
- if (list.get(j1) instanceof EntityPainting) {
- return false;
+ do {
+ if (!iterator.hasNext()) {
+ return true;
}
- }
- return true;
+ entity = (Entity) iterator.next();
+ } while (!(entity instanceof EntityPainting));
+
+ return false;
}
}
- public boolean o_() {
+ public boolean L() {
return true;
}
@@ -222,6 +228,7 @@ public class EntityPainting extends Entity {
}
// TODO: Could put other stuff here?
}
+
if (event != null) {
this.world.getServer().getPluginManager().callEvent(event);
@@ -230,11 +237,23 @@ public class EntityPainting extends Entity {
}
}
- if (dead) return true;
+ if (this.dead) {
+ return true;
+ }
// CraftBukkit end
this.die();
- this.aW();
+ this.K();
+ EntityHuman entityhuman = null;
+
+ if (damagesource.getEntity() instanceof EntityHuman) {
+ entityhuman = (EntityHuman) damagesource.getEntity();
+ }
+
+ if (entityhuman != null && entityhuman.abilities.canInstantlyBuild) {
+ return true;
+ }
+
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
}
@@ -282,8 +301,8 @@ public class EntityPainting extends Entity {
}
}
- public void b_(double d0, double d1, double d2) {
- if (false && !this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit start - not needed for paintings
+ public void g(double d0, double d1, double d2) {
+ if (false && !this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed for paintings
this.die();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
}
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 62585a10..e809ba5f 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -5,8 +5,8 @@ public class EntityPig extends EntityAnimal {
public EntityPig(World world) {
super(world);
this.texture = "/mob/pig.png";
- this.b(0.9F, 0.9F);
- this.al().a(true);
+ this.a(0.9F, 0.9F);
+ this.getNavigation().a(true);
float f = 0.25F;
this.goalSelector.a(0, new PathfinderGoalFloat(this));
@@ -19,7 +19,7 @@ public class EntityPig extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -27,8 +27,8 @@ public class EntityPig extends EntityAnimal {
return 10;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
@@ -42,20 +42,20 @@ public class EntityPig extends EntityAnimal {
this.setSaddle(nbttagcompound.getBoolean("Saddle"));
}
- protected String i() {
+ protected String aQ() {
return "mob.pig";
}
- protected String j() {
+ protected String aR() {
return "mob.pig";
}
- protected String k() {
+ protected String aS() {
return "mob.pigdeath";
}
- public boolean b(EntityHuman entityhuman) {
- if (super.b(entityhuman)) {
+ public boolean c(EntityHuman entityhuman) {
+ if (super.c(entityhuman)) {
return true;
} else if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
entityhuman.mount(this);
@@ -69,6 +69,18 @@ public class EntityPig extends EntityAnimal {
return this.isBurning() ? Item.GRILLED_PORK.id : Item.PORK.id;
}
+ protected void dropDeathLoot(boolean flag, int i) {
+ int j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
+
+ for (int k = 0; k < j; ++k) {
+ if (this.isBurning()) {
+ this.b(Item.GRILLED_PORK.id, 1);
+ } else {
+ this.b(Item.PORK.id, 1);
+ }
+ }
+ }
+
public boolean hasSaddle() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@@ -81,12 +93,12 @@ public class EntityPig extends EntityAnimal {
}
}
- public void a(EntityWeatherLighting entityweatherlighting) {
+ public void a(EntityLightning entitylightning) {
if (!this.world.isStatic) {
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
// CraftBukkit start
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callPigZapEvent(this, entityweatherlighting, entitypigzombie).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
return;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index 4a9666e5..35a21eb0 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -16,26 +17,26 @@ public class EntityPigZombie extends EntityZombie {
public EntityPigZombie(World world) {
super(world);
this.texture = "/mob/pigzombie.png";
- this.bb = 0.5F;
+ this.bw = 0.5F;
this.damage = 5;
this.fireProof = true;
}
- protected boolean c_() {
+ protected boolean aV() {
return false;
}
- public void F_() {
- this.bb = this.target != null ? 0.95F : 0.5F;
+ public void h_() {
+ this.bw = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
- this.world.makeSound(this, "mob.zombiepig.zpigangry", this.p() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
+ this.world.makeSound(this, "mob.zombiepig.zpigangry", this.aP() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
- super.F_();
+ super.h_();
}
public boolean canSpawn() {
- return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
+ return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
public void b(NBTTagCompound nbttagcompound) {
@@ -52,33 +53,30 @@ public class EntityPigZombie extends EntityZombie {
return this.angerLevel == 0 ? null : super.findTarget();
}
- public void e() {
- super.e();
- }
-
public boolean damageEntity(DamageSource damagesource, int i) {
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();
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ while (iterator.hasNext()) {
+ Entity entity1 = (Entity) iterator.next();
if (entity1 instanceof EntityPigZombie) {
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
- entitypigzombie.e(entity);
+ entitypigzombie.c(entity);
}
}
- this.e(entity);
+ this.c(entity);
}
return super.damageEntity(damagesource, i);
}
- private void e(Entity entity) {
+ private void c(Entity entity) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
@@ -101,15 +99,15 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40);
}
- protected String i() {
+ protected String aQ() {
return "mob.zombiepig.zpig";
}
- protected String j() {
+ protected String aR() {
return "mob.zombiepig.zpighurt";
}
- protected String k() {
+ protected String aS() {
return "mob.zombiepig.zpigdeath";
}
@@ -133,7 +131,7 @@ public class EntityPigZombie extends EntityZombie {
int k = this.random.nextInt(200) - i;
if (k < 5) {
- ItemStack itemstack = this.b(k <= 0 ? 1 : 0);
+ ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
if (itemstack != null) {
loot.add(new CraftItemStack(itemstack));
}
@@ -145,7 +143,7 @@ public class EntityPigZombie extends EntityZombie {
}
// CraftBukkit start - return rare dropped item instead of dropping it
- protected ItemStack b(int i) {
+ protected ItemStack l(int i) {
if (i > 0) {
ItemStack itemstack = new ItemStack(Item.GOLD_SWORD);
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 8676d9d5..e5a30da3 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1,9 +1,12 @@
package net.minecraft.server;
-import java.util.HashSet;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Set;
// CraftBukkit start
import org.bukkit.Bukkit;
@@ -16,76 +19,79 @@ import org.bukkit.event.inventory.InventoryType;
public class EntityPlayer extends EntityHuman implements ICrafting {
+ private LocaleLanguage locale = new LocaleLanguage("en_US");
public NetServerHandler netServerHandler;
public MinecraftServer server;
public ItemInWorldManager itemInWorldManager;
public double d;
public double e;
- public List chunkCoordIntPairQueue = new LinkedList();
- public Set playerChunkCoordIntPairs = new HashSet();
- private int cf = -99999999;
- private int cg = -99999999;
- private boolean ch = true;
- public int lastSentExp = -99999999; // CraftBukkit - priv to pub
- public int invulnerableTicks = 60; // CraftBukkit - private to public; temporary until we get an API out
- private ItemStack[] ck = new ItemStack[] { null, null, null, null, null};
+ public final List chunkCoordIntPairQueue = new LinkedList();
+ public final List g = new LinkedList();
+ private int ch = -99999999;
+ private int ci = -99999999;
+ private boolean cj = true;
+ public int lastSentExp = -99999999; // CraftBukkit - private -> public
+ public int invulnerableTicks = 60; // CraftBukkit - private -> public
+ private int cm = 0;
+ private int cn = 0;
+ private boolean co = true;
+ private ItemStack[] cp = new ItemStack[] { null, null, null, null, null};
private int containerCounter = 0;
public boolean h;
public int ping;
public boolean viewingCredits = false;
+ // CraftBukkit start
+ public String displayName;
+ public String listName;
+ public org.bukkit.Location compassTarget;
+ public int newExp = 0;
+ public int newLevel = 0;
+ public int newTotalExp = 0;
+ public boolean keepLevel = false;
+ // CraftBukkit end
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world);
iteminworldmanager.player = this;
this.itemInWorldManager = iteminworldmanager;
+ this.cm = minecraftserver.getServerConfigurationManager().o();
ChunkCoordinates chunkcoordinates = world.getSpawn();
int i = chunkcoordinates.x;
int j = chunkcoordinates.z;
int k = chunkcoordinates.y;
- if (!world.worldProvider.e) {
+ if (!world.worldProvider.e && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
i += this.random.nextInt(20) - 10;
- k = world.g(i, j);
+ k = world.h(i, j);
j += this.random.nextInt(20) - 10;
}
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.server = minecraftserver;
- this.bP = 0.0F;
+ this.W = 0.0F;
this.name = s;
this.height = 0.0F;
-
- // CraftBukkit start
- this.displayName = this.name;
- this.listName = this.name;
+ this.displayName = this.name; // CraftBukkit
+ this.listName = this.name; // CraftBukkit
}
- public String displayName;
- public String listName;
- public org.bukkit.Location compassTarget;
- public int newExp = 0;
- public int newLevel = 0;
- public int newTotalExp = 0;
- public boolean keepLevel = false;
- // CraftBukkit end
-
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
if (nbttagcompound.hasKey("playerGameType")) {
- this.itemInWorldManager.setGameMode(nbttagcompound.getInt("playerGameType"));
+ this.itemInWorldManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType")));
}
this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setInt("playerGameType", this.itemInWorldManager.getGameMode());
+ nbttagcompound.setInt("playerGameType", this.itemInWorldManager.getGameMode().a());
this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
}
+ // CraftBukkit start - world fallback code, either respawn location or global spawn
public void spawnIn(World world) {
super.spawnIn(world);
- // CraftBukkit start - world fallback code, either respawn location or global spawn
if (world == null) {
this.dead = false;
ChunkCoordinates position = null;
@@ -105,8 +111,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
this.dimension = ((WorldServer) this.world).dimension;
this.itemInWorldManager.a((WorldServer) world);
- // CraftBukkit end
}
+ // CraftBukkit end
public void levelDown(int i) {
super.levelDown(i);
@@ -118,10 +124,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public ItemStack[] getEquipment() {
- return this.ck;
+ return this.cp;
}
- protected void A() {
+ protected void d_() {
this.height = 0.0F;
}
@@ -129,102 +135,71 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return 1.62F;
}
- public void F_() {
- this.itemInWorldManager.c();
+ public void h_() {
+ this.itemInWorldManager.a();
--this.invulnerableTicks;
- this.activeContainer.a();
+ this.activeContainer.b();
- for (int i = 0; i < 5; ++i) {
- ItemStack itemstack = this.c(i);
+ int i;
- if (itemstack != this.ck[i]) {
- this.server.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
- this.ck[i] = itemstack;
- }
- }
- }
-
- public ItemStack c(int i) {
- return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
- }
+ for (i = 0; i < 5; ++i) {
+ ItemStack itemstack = this.b(i);
- public void die(DamageSource damagesource) {
- // CraftBukkit start
- java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
-
- for (int i = 0; i < this.inventory.items.length; ++i) {
- if (this.inventory.items[i] != null) {
- loot.add(new CraftItemStack(this.inventory.items[i]));
+ if (itemstack != this.cp[i]) {
+ this.q().getTracker().a(this, new Packet5EntityEquipment(this.id, i, itemstack));
+ this.cp[i] = itemstack;
}
}
- for (int i = 0; i < this.inventory.armor.length; ++i) {
- if (this.inventory.armor[i] != null) {
- loot.add(new CraftItemStack(this.inventory.armor[i]));
- }
- }
+ if (!this.chunkCoordIntPairQueue.isEmpty()) {
+ ArrayList arraylist = new ArrayList();
+ Iterator iterator = this.chunkCoordIntPairQueue.iterator();
+ ArrayList arraylist1 = new ArrayList();
- org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, damagesource.getLocalizedDeathMessage(this));
+ while (iterator.hasNext() && arraylist.size() < 5) {
+ ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
- String deathMessage = event.getDeathMessage();
-
- if (deathMessage != null && deathMessage.length() > 0) {
- this.server.serverConfigurationManager.sendAll(new Packet3Chat(event.getDeathMessage()));
- }
-
- // CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
- for (int i = 0; i < this.inventory.items.length; ++i) {
- this.inventory.items[i] = null;
- }
-
- for (int i = 0; i < this.inventory.armor.length; ++i) {
- this.inventory.armor[i] = null;
- }
+ iterator.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));
+ }
+ }
- this.closeInventory();
- // CraftBukkit end
- }
+ if (!arraylist.isEmpty()) {
+ this.netServerHandler.sendPacket(new Packet56MapChunkBulk(arraylist));
+ Iterator iterator1 = arraylist1.iterator();
- public boolean damageEntity(DamageSource damagesource, int i) {
- if (this.invulnerableTicks > 0) {
- return false;
- } else {
- // CraftBukkit - this.b.pvpMode -> this.world.pvpMode
- if (!this.world.pvpMode && damagesource instanceof EntityDamageSource) {
- Entity entity = damagesource.getEntity();
+ while (iterator1.hasNext()) {
+ TileEntity tileentity = (TileEntity) iterator1.next();
- if (entity instanceof EntityHuman) {
- return false;
+ this.a(tileentity);
}
+ }
+ }
- if (entity instanceof EntityArrow) {
- EntityArrow entityarrow = (EntityArrow) entity;
+ if (!this.g.isEmpty()) {
+ i = Math.min(this.g.size(), 127);
+ int[] aint = new int[i];
+ Iterator iterator2 = this.g.iterator();
+ int j = 0;
- if (entityarrow.shooter instanceof EntityHuman) {
- return false;
- }
- }
+ while (iterator2.hasNext() && j < i) {
+ aint[j++] = ((Integer) iterator2.next()).intValue();
+ iterator2.remove();
}
- return super.damageEntity(damagesource, i);
+ this.netServerHandler.sendPacket(new Packet29DestroyEntity(aint));
}
}
- protected boolean C() {
- return this.server.pvpMode;
- }
-
- public void heal(int i) {
- super.heal(i);
- }
-
- public void a(boolean flag) {
- super.F_();
+ public void g() {
+ super.h_();
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
- if (itemstack != null && Item.byId[itemstack.id].t_() && this.netServerHandler.lowPriorityCount() <= 2) {
+ if (itemstack != null && Item.byId[itemstack.id].m_() && this.netServerHandler.lowPriorityCount() <= 2) {
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
if (packet != null) {
@@ -233,50 +208,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- if (flag && !this.chunkCoordIntPairQueue.isEmpty()) {
- ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(0);
- double d0 = chunkcoordintpair.a(this);
-
- for (int j = 0; j < this.chunkCoordIntPairQueue.size(); ++j) {
- ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(j);
- double d1 = chunkcoordintpair1.a(this);
-
- if (d1 < d0) {
- chunkcoordintpair = chunkcoordintpair1;
- d0 = d1;
- }
- }
-
- if (chunkcoordintpair != null) {
- boolean flag1 = false;
-
- // CraftBukkit - Add check against Chunk Packets in the ChunkCompressionThread.
- if (this.netServerHandler.lowPriorityCount() + org.bukkit.craftbukkit.ChunkCompressionThread.getPlayerQueueSize(this) < 4) {
- flag1 = true;
- }
-
- if (flag1) {
- WorldServer worldserver = this.server.getWorldServer(this.dimension);
-
- if (worldserver.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
- Chunk chunk = worldserver.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
-
- if (chunk.done) {
- this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
- this.netServerHandler.sendPacket(new Packet51MapChunk(worldserver.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z), true, 0));
- List list = worldserver.getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 256, chunkcoordintpair.z * 16 + 16);
-
- for (int k = 0; k < list.size(); ++k) {
- this.a((TileEntity) list.get(k));
- }
- }
- }
- }
- }
- }
-
- if (this.J) {
- //if (this.server.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
+ if (this.bX) {
+ // if (this.server.getAllowNether()) { // CraftBukkit
if (this.activeContainer != this.defaultContainer) {
this.closeInventory();
}
@@ -284,11 +217,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.vehicle != null) {
this.mount(this.vehicle);
} else {
- this.K += 0.0125F;
- if (this.K >= 1.0F) {
- this.K = 1.0F;
- this.I = 10;
- boolean flag2 = false;
+ this.bY += 0.0125F;
+ if (this.bY >= 1.0F) {
+ this.bY = 1.0F;
+ this.bW = 10;
+ boolean flag = false;
byte b0;
if (this.dimension == -1) {
@@ -297,35 +230,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
b0 = -1;
}
- this.server.serverConfigurationManager.changeDimension(this, b0);
+ this.server.getServerConfigurationManager().changeDimension(this, b0);
this.lastSentExp = -1;
- this.cf = -1;
- this.cg = -1;
+ this.ch = -1;
+ this.ci = -1;
this.a((Statistic) AchievementList.x);
}
}
- this.J = false;
- //} // CraftBukkit
+ this.bX = false;
+ // } // CraftBukkit
} else {
- if (this.K > 0.0F) {
- this.K -= 0.05F;
+ if (this.bY > 0.0F) {
+ this.bY -= 0.05F;
}
- if (this.K < 0.0F) {
- this.K = 0.0F;
+ if (this.bY < 0.0F) {
+ this.bY = 0.0F;
}
}
- if (this.I > 0) {
- --this.I;
+ if (this.bW > 0) {
+ --this.bW;
}
- if (this.getHealth() != this.cf || this.cg != this.foodData.a() || this.foodData.c() == 0.0F != this.ch) {
- this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.c()));
- this.cf = this.getHealth();
- this.cg = this.foodData.a();
- this.ch = this.foodData.c() == 0.0F;
+ if (this.getHealth() != this.ch || this.ci != this.foodData.a() || this.foodData.e() == 0.0F != this.cj) {
+ this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.e()));
+ this.ch = this.getHealth();
+ this.ci = this.foodData.a();
+ this.cj = this.foodData.e() == 0.0F;
}
if (this.expTotal != this.lastSentExp) {
@@ -345,7 +278,77 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
}
- public void e(int i) {
+ public ItemStack b(int i) {
+ return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
+ }
+
+ public void die(DamageSource damagesource) {
+ // CraftBukkit start
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+
+ for (int i = 0; i < this.inventory.items.length; ++i) {
+ if (this.inventory.items[i] != null) {
+ loot.add(new CraftItemStack(this.inventory.items[i]));
+ }
+ }
+
+ for (int i = 0; i < this.inventory.armor.length; ++i) {
+ if (this.inventory.armor[i] != null) {
+ loot.add(new CraftItemStack(this.inventory.armor[i]));
+ }
+ }
+
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, damagesource.getLocalizedDeathMessage(this));
+
+ String deathMessage = event.getDeathMessage();
+
+ if (deathMessage != null && deathMessage.length() > 0) {
+ this.server.getServerConfigurationManager().sendAll(new Packet3Chat(event.getDeathMessage()));
+ }
+
+ // CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
+ for (int i = 0; i < this.inventory.items.length; ++i) {
+ this.inventory.items[i] = null;
+ }
+
+ for (int i = 0; i < this.inventory.armor.length; ++i) {
+ this.inventory.armor[i] = null;
+ }
+
+ this.closeInventory();
+ // CraftBukkit end
+ }
+
+ public boolean damageEntity(DamageSource damagesource, int i) {
+ if (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 (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);
+ }
+ }
+
+ protected boolean h() {
+ return this.server.getPvP();
+ }
+
+ public void c(int i) {
if (this.dimension == 1 && i == 1) {
this.a((Statistic) AchievementList.C);
this.world.kill(this);
@@ -354,23 +357,23 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} else {
this.a((Statistic) AchievementList.B);
/* CraftBukkit start - removed to fix our handling of The End portals
- ChunkCoordinates chunkcoordinates = this.b.getWorldServer(i).d();
+ ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();
if (chunkcoordinates != null) {
this.netServerHandler.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
}
// CraftBukkit end */
- this.server.serverConfigurationManager.changeDimension(this, 1);
+ this.server.getServerConfigurationManager().changeDimension(this, 1);
this.lastSentExp = -1;
- this.cf = -1;
- this.cg = -1;
+ this.ch = -1;
+ this.ci = -1;
}
}
private void a(TileEntity tileentity) {
if (tileentity != null) {
- Packet packet = tileentity.d();
+ Packet packet = tileentity.e();
if (packet != null) {
this.netServerHandler.sendPacket(packet);
@@ -380,7 +383,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void receive(Entity entity, int i) {
if (!entity.dead) {
- EntityTracker entitytracker = this.server.getTracker(this.dimension);
+ EntityTracker entitytracker = this.q().getTracker();
if (entity instanceof EntityItem) {
entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
@@ -396,29 +399,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
super.receive(entity, i);
- this.activeContainer.a();
+ this.activeContainer.b();
}
- public void C_() {
- if (!this.t) {
- this.u = -1;
- this.t = true;
- EntityTracker entitytracker = this.server.getTracker(this.dimension);
-
- entitytracker.a(this, new Packet18ArmAnimation(this, 1));
+ public void i() {
+ if (!this.bH) {
+ this.bI = -1;
+ this.bH = true;
+ this.q().getTracker().a(this, new Packet18ArmAnimation(this, 1));
}
}
- public void E() {}
-
public EnumBedResult a(int i, int j, int k) {
EnumBedResult enumbedresult = super.a(i, j, k);
if (enumbedresult == EnumBedResult.OK) {
- EntityTracker entitytracker = this.server.getTracker(this.dimension);
Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
- entitytracker.a(this, packet17entitylocationaction);
+ this.q().getTracker().a(this, packet17entitylocationaction);
this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.netServerHandler.sendPacket(packet17entitylocationaction);
}
@@ -428,9 +426,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(boolean flag, boolean flag1, boolean flag2) {
if (this.isSleeping()) {
- EntityTracker entitytracker = this.server.getTracker(this.dimension);
-
- entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
+ this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
}
super.a(flag, flag1, flag2);
@@ -493,6 +489,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void openContainer(IInventory iinventory) {
+ if (this.activeContainer != this.defaultContainer) {
+ this.closeInventory();
+ }
+
// CraftBukkit start - INVENTORY_OPEN hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
if(container == null) return;
@@ -544,6 +544,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.addSlotListener(this);
}
+ public void openTrade(IMerchant imerchant) {
+ // CraftBukkit start - INVENTORY_OPEN hook
+ Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
+ if(container == null) return;
+ // CraftBukkit end
+
+ this.nextContainerCounter();
+ this.activeContainer = container; // CraftBukkit - User container passed to event
+ this.activeContainer.windowId = this.containerCounter;
+ this.activeContainer.addSlotListener(this);
+ InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory();
+
+ this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, inventorymerchant.getName(), inventorymerchant.getSize()));
+ MerchantRecipeList merchantrecipelist = imerchant.getOffers(this);
+
+ if (merchantrecipelist != null) {
+ try {
+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
+ DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
+
+ dataoutputstream.writeInt(this.containerCounter);
+ merchantrecipelist.a(dataoutputstream);
+ this.netServerHandler.sendPacket(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray()));
+ } catch (IOException ioexception) {
+ ioexception.printStackTrace();
+ }
+ }
+ }
+
public void a(Container container, int i, ItemStack itemstack) {
if (!(container.getSlot(i) instanceof SlotResult)) {
if (!this.h) {
@@ -553,7 +582,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void updateInventory(Container container) {
- this.a(container, container.b());
+ this.a(container, container.a());
}
public void a(Container container, List list) {
@@ -570,11 +599,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j));
}
- public void carriedChanged(ItemStack itemstack) {}
-
public void closeInventory() {
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
- this.H();
+ this.l();
}
public void broadcastCarriedItem() {
@@ -583,7 +610,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public void H() {
+ public void l() {
this.activeContainer.a((EntityHuman) this);
this.activeContainer = this.defaultContainer;
}
@@ -601,7 +628,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public void I() {
+ public void m() {
if (this.vehicle != null) {
this.mount(this.vehicle);
}
@@ -615,32 +642,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public void D_() {
- this.cf = -99999999;
+ public void n() {
+ this.ch = -99999999;
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
- public void a(String s) {
+ public void c(String s) {
LocaleLanguage localelanguage = LocaleLanguage.a();
String s1 = localelanguage.b(s);
this.netServerHandler.sendPacket(new Packet3Chat(s1));
}
- protected void K() {
+ protected void o() {
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
- super.K();
+ super.o();
}
public void a(ItemStack itemstack, int i) {
super.a(itemstack, i);
- if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().d(itemstack) == EnumAnimation.b) {
- EntityTracker entitytracker = this.server.getTracker(this.dimension);
-
- entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
+ if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().b(itemstack) == EnumAnimation.b) {
+ this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
}
}
+ protected void a(MobEffect mobeffect) {
+ super.a(mobeffect);
+ this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
+ }
+
protected void b(MobEffect mobeffect) {
super.b(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
@@ -648,11 +678,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
protected void c(MobEffect mobeffect) {
super.c(mobeffect);
- this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
- }
-
- protected void d(MobEffect mobeffect) {
- super.d(mobeffect);
this.netServerHandler.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
}
@@ -660,16 +685,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.netServerHandler.a(d0, d1, d2, this.yaw, this.pitch);
}
- public void c(Entity entity) {
- EntityTracker entitytracker = this.server.getTracker(this.dimension);
-
- entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
+ public void b(Entity entity) {
+ this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
}
- public void d(Entity entity) {
- EntityTracker entitytracker = this.server.getTracker(this.dimension);
-
- entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
+ public void c(Entity entity) {
+ this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
}
public void updateAbilities() {
@@ -678,6 +699,63 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
+ public WorldServer q() {
+ return (WorldServer) this.world;
+ }
+
+ public void a(EnumGamemode enumgamemode) {
+ this.itemInWorldManager.setGameMode(enumgamemode);
+ this.netServerHandler.sendPacket(new Packet70Bed(3, enumgamemode.a()));
+ }
+
+ public void sendMessage(String s) {
+ this.netServerHandler.sendPacket(new Packet3Chat(s));
+ }
+
+ public boolean b(String s) {
+ return "seed".equals(s) && !this.server.S() ? true : this.server.getServerConfigurationManager().isOp(this.name);
+ }
+
+ public String r() {
+ String s = this.netServerHandler.networkManager.getSocketAddress().toString();
+
+ s = s.substring(s.indexOf("/") + 1);
+ s = s.substring(0, s.indexOf(":"));
+ return s;
+ }
+
+ public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
+ if (this.locale.b().containsKey(packet204localeandviewdistance.d())) {
+ this.locale.a(packet204localeandviewdistance.d());
+ }
+
+ int i = 256 >> packet204localeandviewdistance.f();
+
+ if (i > 3 && i < 15) {
+ this.cm = i;
+ }
+
+ this.cn = packet204localeandviewdistance.g();
+ this.co = packet204localeandviewdistance.h();
+ if (this.server.H() && this.server.G().equals(this.name)) {
+ this.server.c(packet204localeandviewdistance.i());
+ }
+ }
+
+ public LocaleLanguage getLocale() {
+ return this.locale;
+ }
+
+ public int getChatFlags() {
+ return this.cn;
+ }
+
+ public void a(String s, int i) {
+ String s1 = s + "\0" + i; // CraftBukkit - fix decompile error
+
+ this.netServerHandler.sendPacket(new Packet250CustomPayload("MC|TPack", s1.getBytes()));
+ }
+
// CraftBukkit start
public long timeOffset = 0;
public boolean relativeTime = true;
diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java
index 09968061..95b3454d 100644
--- a/src/main/java/net/minecraft/server/EntityPotion.java
+++ b/src/main/java/net/minecraft/server/EntityPotion.java
@@ -28,15 +28,15 @@ public class EntityPotion extends EntityProjectile {
this.d = i;
}
- protected float e() {
+ protected float h() {
return 0.05F;
}
- protected float c() {
+ protected float d() {
return 0.5F;
}
- protected float d() {
+ protected float g() {
return -20.0F;
}
@@ -46,7 +46,7 @@ public class EntityPotion extends EntityProjectile {
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
- List list = Item.POTION.b(this.d);
+ List list = Item.POTION.f(this.d);
if (list != null && !list.isEmpty()) {
AxisAlignedBB axisalignedbb = this.boundingBox.grow(4.0D, 2.0D, 4.0D);
@@ -59,18 +59,18 @@ public class EntityPotion extends EntityProjectile {
HashMap<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>();
while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- double d0 = this.j(entity);
+ EntityLiving entityliving = (EntityLiving) iterator.next();
+ double d0 = this.e(entityliving);
if (d0 < 16.0D) {
double d1 = 1.0D - Math.sqrt(d0) / 4.0D;
- if (entity == movingobjectposition.entity) {
+ if (entityliving == movingobjectposition.entity) {
d1 = 1.0D;
}
// CraftBukkit start
- affected.put((LivingEntity) entity.getBukkitEntity(), d1);
+ affected.put((LivingEntity) entityliving.getBukkitEntity(), d1);
}
}
@@ -80,7 +80,8 @@ public class EntityPotion extends EntityProjectile {
if (!(victim instanceof CraftLivingEntity)) {
continue;
}
- EntityLiving entity = ((CraftLivingEntity) victim).getHandle();
+
+ EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle();
double d1 = event.getIntensity(victim);
// CraftBukkit end
@@ -91,7 +92,7 @@ public class EntityPotion extends EntityProjectile {
int i = mobeffect.getEffectId();
// CraftBukkit start - abide by PVP settings
- if (!this.world.pvpMode && entity instanceof EntityPlayer && entity != this.shooter) {
+ if (!this.world.pvpMode && entityliving instanceof EntityPlayer && entityliving != this.shooter) {
// 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;
}
@@ -99,12 +100,12 @@ public class EntityPotion extends EntityProjectile {
if (MobEffectList.byId[i].isInstant()) {
// CraftBukkit - added 'this'
- MobEffectList.byId[i].applyInstantEffect(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1, this);
+ MobEffectList.byId[i].applyInstantEffect(this.shooter, entityliving, mobeffect.getAmplifier(), d1, this);
} else {
int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
if (j > 20) {
- ((EntityLiving) entity).addEffect(new MobEffect(i, j, mobeffect.getAmplifier()));
+ entityliving.addEffect(new MobEffect(i, j, mobeffect.getAmplifier()));
}
}
}
@@ -117,4 +118,14 @@ public class EntityPotion extends EntityProjectile {
this.die();
}
}
+
+ public void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ this.d = nbttagcompound.getInt("potionValue");
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ nbttagcompound.setInt("potionValue", this.d);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 039d599c..cca2d9b7 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -1,10 +1,9 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
-// CraftBukkit start
-import org.bukkit.event.entity.ProjectileHitEvent;
-// CraftBukkit end
+import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit
public abstract class EntityProjectile extends Entity {
@@ -14,21 +13,21 @@ public abstract class EntityProjectile extends Entity {
private int inBlockId = 0;
protected boolean inGround = false;
public int shake = 0;
- public EntityLiving shooter; // CraftBukkit - prot to public
+ public EntityLiving shooter; // CraftBukkit - protected -> public
private int h;
private int i = 0;
public EntityProjectile(World world) {
super(world);
- this.b(0.25F, 0.25F);
+ this.a(0.25F, 0.25F);
}
- protected void b() {}
+ protected void a() {}
public EntityProjectile(World world, EntityLiving entityliving) {
super(world);
this.shooter = entityliving;
- this.b(0.25F, 0.25F);
+ this.a(0.25F, 0.25F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
@@ -39,27 +38,27 @@ public abstract class EntityProjectile extends Entity {
this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
- this.motY = (double) (-MathHelper.sin((this.pitch + this.d()) / 180.0F * 3.1415927F) * f);
- this.a(this.motX, this.motY, this.motZ, this.c(), 1.0F);
+ this.motY = (double) (-MathHelper.sin((this.pitch + this.g()) / 180.0F * 3.1415927F) * f);
+ this.c(this.motX, this.motY, this.motZ, this.d(), 1.0F);
}
public EntityProjectile(World world, double d0, double d1, double d2) {
super(world);
this.h = 0;
- this.b(0.25F, 0.25F);
+ this.a(0.25F, 0.25F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
}
- protected float c() {
+ protected float d() {
return 1.5F;
}
- protected float d() {
+ protected float g() {
return 0.0F;
}
- public void a(double d0, double d1, double d2, float f, float f1) {
+ public void c(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= (double) f2;
@@ -81,11 +80,11 @@ public abstract class EntityProjectile extends Entity {
this.h = 0;
}
- public void F_() {
- this.bL = this.locX;
- this.bM = this.locY;
- this.bN = this.locZ;
- super.F_();
+ public void h_() {
+ this.S = this.locX;
+ this.T = this.locY;
+ this.U = this.locZ;
+ super.h_();
if (this.shake > 0) {
--this.shake;
}
@@ -112,25 +111,26 @@ public abstract class EntityProjectile extends Entity {
++this.i;
}
- Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ Vec3D vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
- vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
- vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+ vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
+ vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
- vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
+ vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
}
if (!this.world.isStatic) {
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();
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ while (iterator.hasNext()) {
+ Entity entity1 = (Entity) iterator.next();
- if (entity1.o_() && (entity1 != this.shooter || this.i >= 5)) {
+ if (entity1.L() && (entity1 != this.shooter || this.i >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -187,10 +187,10 @@ public abstract class EntityProjectile extends Entity {
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.99F;
- float f3 = this.e();
+ float f3 = this.h();
- if (this.aU()) {
- for (int k = 0; k < 4; ++k) {
+ if (this.H()) {
+ for (int j = 0; j < 4; ++j) {
float f4 = 0.25F;
this.world.a("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);
@@ -206,7 +206,7 @@ public abstract class EntityProjectile extends Entity {
this.setPosition(this.locX, this.locY, this.locZ);
}
- protected float e() {
+ protected float h() {
return 0.03F;
}
@@ -229,6 +229,4 @@ public abstract class EntityProjectile extends Entity {
this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.getByte("inGround") == 1;
}
-
- public void a_(EntityHuman entityhuman) {}
}
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index 7dba926e..d74cf4d7 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -9,51 +9,51 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
public class EntitySheep extends EntityAnimal {
- public static final float[][] a = 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 b;
- private PathfinderGoalEatTile c = new PathfinderGoalEatTile(this);
+ 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);
public EntitySheep(World world) {
super(world);
this.texture = "/mob/sheep.png";
- this.b(0.9F, 1.3F);
+ this.a(0.9F, 1.3F);
float f = 0.23F;
- this.al().a(true);
+ this.getNavigation().a(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
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.c);
+ this.goalSelector.a(5, this.f);
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));
}
- protected boolean c_() {
+ protected boolean aV() {
return true;
}
- protected void z_() {
- this.b = this.c.f();
- super.z_();
+ protected void bc() {
+ this.e = this.f.f();
+ super.bc();
}
- public void e() {
+ public void d() {
if (this.world.isStatic) {
- this.b = Math.max(0, this.b - 1);
+ this.e = Math.max(0, this.e - 1);
}
- super.e();
+ super.d();
}
public int getMaxHealth() {
return 8;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, new Byte((byte) 0));
}
@@ -73,7 +73,7 @@ public class EntitySheep extends EntityAnimal {
return Block.WOOL.id;
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.isBaby()) {
@@ -92,6 +92,7 @@ public class EntitySheep extends EntityAnimal {
for (int j = 0; j < i; ++j) {
EntityItem entityitem = this.a(new ItemStack(Block.WOOL.id, 1, this.getColor()), 1.0F);
+
entityitem.motY += (double) (this.random.nextFloat() * 0.05F);
entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
entityitem.motZ += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
@@ -101,7 +102,7 @@ public class EntitySheep extends EntityAnimal {
itemstack.damage(1, entityhuman);
}
- return super.b(entityhuman);
+ return super.c(entityhuman);
}
public void b(NBTTagCompound nbttagcompound) {
@@ -116,15 +117,15 @@ public class EntitySheep extends EntityAnimal {
this.setColor(nbttagcompound.getByte("Color"));
}
- protected String i() {
+ protected String aQ() {
return "mob.sheep";
}
- protected String j() {
+ protected String aR() {
return "mob.sheep";
}
- protected String k() {
+ protected String aS() {
return "mob.sheep";
}
@@ -171,7 +172,7 @@ public class EntitySheep extends EntityAnimal {
return entitysheep1;
}
- public void z() {
+ public void aA() {
// CraftBukkit start
SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
index 88a80d73..35eba18a 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
@@ -4,13 +4,13 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntitySilverfish extends EntityMonster {
- private int a;
+ private int d;
public EntitySilverfish(World world) {
super(world);
this.texture = "/mob/silverfish.png";
- this.b(0.3F, 0.7F);
- this.bb = 0.6F;
+ this.a(0.3F, 0.7F);
+ this.bw = 0.6F;
this.damage = 1;
}
@@ -18,7 +18,7 @@ public class EntitySilverfish extends EntityMonster {
return 8;
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
@@ -28,21 +28,21 @@ public class EntitySilverfish extends EntityMonster {
return this.world.findNearbyVulnerablePlayer(this, d0);
}
- protected String i() {
+ protected String aQ() {
return "mob.silverfish.say";
}
- protected String j() {
+ protected String aR() {
return "mob.silverfish.hit";
}
- protected String k() {
+ protected String aS() {
return "mob.silverfish.kill";
}
public boolean damageEntity(DamageSource damagesource, int i) {
- if (this.a <= 0 && damagesource instanceof EntityDamageSource) {
- this.a = 20;
+ if (this.d <= 0 && (damagesource instanceof EntityDamageSource || damagesource == DamageSource.MAGIC)) {
+ this.d = 20;
}
return super.damageEntity(damagesource, i);
@@ -59,34 +59,26 @@ public class EntitySilverfish extends EntityMonster {
this.world.makeSound(this, "mob.silverfish.step", 1.0F, 1.0F);
}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
protected int getLootId() {
return 0;
}
- public void F_() {
- this.V = this.yaw;
- super.F_();
+ public void h_() {
+ this.aq = this.yaw;
+ super.h_();
}
- protected void d_() {
- super.d_();
+ protected void be() {
+ super.be();
if (!this.world.isStatic) {
int i;
int j;
int k;
int l;
- if (this.a > 0) {
- --this.a;
- if (this.a == 0) {
+ if (this.d > 0) {
+ --this.d;
+ if (this.d == 0) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
@@ -103,6 +95,7 @@ public class EntitySilverfish extends EntityMonster {
continue;
}
// CraftBukkit end
+
this.world.triggerEffect(2001, i + i1, j + l, k + j1, Block.MONSTER_EGGS.id + (this.world.getData(i + i1, j + l, k + j1) << 12));
this.world.setTypeId(i + i1, j + l, k + j1, 0);
Block.MONSTER_EGGS.postBreak(this.world, i + i1, j + l, k + j1, 0);
@@ -117,26 +110,27 @@ public class EntitySilverfish extends EntityMonster {
}
}
- if (this.target == null && !this.H()) {
+ if (this.target == null && !this.l()) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY + 0.5D);
k = MathHelper.floor(this.locZ);
int l1 = this.random.nextInt(6);
l = this.world.getTypeId(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
- if (BlockMonsterEggs.d(l)) {
+ if (BlockMonsterEggs.e(l)) {
// CraftBukkit start
if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id).isCancelled()) {
return;
}
// CraftBukkit end
- this.world.setTypeIdAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l));
- this.aC();
+
+ this.world.setTypeIdAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.f(l));
+ this.aK();
this.die();
} else {
- this.G();
+ this.j();
}
- } else if (this.target != null && !this.H()) {
+ } else if (this.target != null && !this.l()) {
this.target = null;
}
}
@@ -146,7 +140,7 @@ public class EntitySilverfish extends EntityMonster {
return this.world.getTypeId(i, j - 1, k) == Block.STONE.id ? 10.0F : super.a(i, j, k);
}
- protected boolean C() {
+ protected boolean o() {
return true;
}
@@ -160,7 +154,7 @@ public class EntitySilverfish extends EntityMonster {
}
}
- public MonsterType getMonsterType() {
- return MonsterType.ARTHROPOD;
+ public EnumMonsterType getMonsterType() {
+ return EnumMonsterType.ARTHROPOD;
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java
index 477f75ad..d96458af 100644
--- a/src/main/java/net/minecraft/server/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/server/EntitySkeleton.java
@@ -4,24 +4,24 @@ import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
public class EntitySkeleton extends EntityMonster {
- private static final ItemStack a = new ItemStack(Item.BOW, 1);
+ private static final ItemStack d = new ItemStack(Item.BOW, 1);
public EntitySkeleton(World world) {
super(world);
this.texture = "/mob/skeleton.png";
- this.bb = 0.25F;
+ this.bw = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalRestrictSun(this));
- this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bb));
- this.goalSelector.a(4, new PathfinderGoalArrowAttack(this, this.bb, 1, 60));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bb));
+ this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bw));
+ this.goalSelector.a(4, new PathfinderGoalArrowAttack(this, this.bw, 1, 60));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bw));
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));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -29,27 +29,27 @@ public class EntitySkeleton extends EntityMonster {
return 20;
}
- protected String i() {
+ protected String aQ() {
return "mob.skeleton";
}
- protected String j() {
+ protected String aR() {
return "mob.skeletonhurt";
}
- protected String k() {
+ protected String aS() {
return "mob.skeletonhurt";
}
- public MonsterType getMonsterType() {
- return MonsterType.UNDEAD;
+ public EnumMonsterType getMonsterType() {
+ return EnumMonsterType.UNDEAD;
}
- public void e() {
- if (this.world.e() && !this.world.isStatic) {
- float f = this.b(1.0F);
+ public void d() {
+ if (this.world.r() && !this.world.isStatic) {
+ float f = this.c(1.0F);
- if (f > 0.5F && this.world.isChunkLoaded(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.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
this.world.getServer().getPluginManager().callEvent(event);
@@ -61,12 +61,12 @@ public class EntitySkeleton extends EntityMonster {
}
}
- super.e();
+ super.d();
}
public void die(DamageSource damagesource) {
super.die(damagesource);
- if (damagesource.b() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
+ if (damagesource.f() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX;
double d1 = entityhuman.locZ - this.locZ;
@@ -84,6 +84,7 @@ public class EntitySkeleton extends EntityMonster {
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+ int j = this.random.nextInt(3 + i);
int count = this.random.nextInt(3 + i);
if (count > 0) {
@@ -100,7 +101,7 @@ public class EntitySkeleton extends EntityMonster {
int k = this.random.nextInt(200) - i;
if (k < 5) {
- ItemStack itemstack = this.b(k <= 0 ? 1 : 0);
+ ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
if (itemstack != null) {
loot.add(new org.bukkit.craftbukkit.inventory.CraftItemStack(itemstack));
}
@@ -112,7 +113,7 @@ public class EntitySkeleton extends EntityMonster {
}
// CraftBukkit start - return rare dropped item instead of dropping it
- protected ItemStack b(int i) {
+ protected ItemStack l(int i) {
if (i > 0) {
ItemStack itemstack = new ItemStack(Item.BOW);
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index 5e2d29aa..a4681baf 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -19,17 +19,17 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.setSize(i);
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, new Byte((byte) 1));
}
public void setSize(int i) {
this.datawatcher.watch(16, new Byte((byte) i));
- this.b(0.6F * (float) i, 0.6F * (float) i);
+ this.a(0.6F * (float) i, 0.6F * (float) i);
this.setPosition(this.locX, this.locY, this.locZ);
this.setHealth(this.getMaxHealth());
- this.aA = i;
+ this.aV = i;
}
public int getMaxHealth() {
@@ -52,15 +52,15 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.setSize(nbttagcompound.getInt("Size") + 1);
}
- protected String A() {
+ protected String i() {
return "slime";
}
- protected String I() {
+ protected String o() {
return "mob.slime";
}
- public void F_() {
+ public void h_() {
if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
this.dead = true;
}
@@ -69,7 +69,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.c = this.b;
boolean flag = this.onGround;
- super.F_();
+ super.h_();
if (this.onGround && !flag) {
int i = this.getSize();
@@ -79,21 +79,23 @@ public class EntitySlime extends EntityLiving implements IMonster {
float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
- this.world.a(this.A(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
+ this.world.a(this.i(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
}
- if (this.K()) {
- this.world.makeSound(this, this.I(), this.p(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
+ if (this.p()) {
+ this.world.makeSound(this, this.o(), this.aP(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.a = -0.5F;
+ } else if (!this.onGround && flag) {
+ this.a = 1.0F;
}
- this.F();
+ this.l();
}
- protected void d_() {
- this.aG();
+ protected void be() {
+ this.bb();
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // CraftBukkit TODO: EntityTargetEvent
if (entityhuman != null) {
@@ -101,36 +103,35 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
if (this.onGround && this.jumpDelay-- <= 0) {
- this.jumpDelay = this.E();
+ this.jumpDelay = this.k();
if (entityhuman != null) {
this.jumpDelay /= 3;
}
- this.aZ = true;
- if (this.M()) {
- this.world.makeSound(this, this.I(), this.p(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
+ this.bu = true;
+ if (this.r()) {
+ this.world.makeSound(this, this.o(), this.aP(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
- this.a = 1.0F;
- this.aW = 1.0F - this.random.nextFloat() * 2.0F;
- this.aX = (float) (1 * this.getSize());
+ this.br = 1.0F - this.random.nextFloat() * 2.0F;
+ this.bs = (float) (1 * this.getSize());
} else {
- this.aZ = false;
+ this.bu = false;
if (this.onGround) {
- this.aW = this.aX = 0.0F;
+ this.br = this.bs = 0.0F;
}
}
}
- protected void F() {
+ protected void l() {
this.a *= 0.6F;
}
- protected int E() {
+ protected int k() {
return this.random.nextInt(20) + 10;
}
- protected EntitySlime C() {
+ protected EntitySlime j() {
return new EntitySlime(this.world);
}
@@ -155,7 +156,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
- EntitySlime entityslime = this.C();
+ EntitySlime entityslime = this.j();
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
@@ -166,29 +167,29 @@ public class EntitySlime extends EntityLiving implements IMonster {
super.die();
}
- public void a_(EntityHuman entityhuman) {
- if (this.G()) {
+ public void b_(EntityHuman entityhuman) {
+ if (this.m()) {
int i = this.getSize();
- if (this.h(entityhuman) && (double) this.i(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.H())) {
+ if (this.l(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.n())) {
this.world.makeSound(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
}
- protected boolean G() {
+ protected boolean m() {
return this.getSize() > 1;
}
- protected int H() {
+ protected int n() {
return this.getSize();
}
- protected String j() {
+ protected String aR() {
return "mob.slime";
}
- protected String k() {
+ protected String aS() {
return "mob.slime";
}
@@ -199,22 +200,22 @@ public class EntitySlime extends EntityLiving implements IMonster {
public boolean canSpawn() {
Chunk chunk = this.world.getChunkAtWorldCoords(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
- return (this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.canSpawn() : false;
+ return this.world.getWorldData().getType() == WorldType.FLAT && this.random.nextInt(4) != 1 ? false : ((this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.canSpawn() : false);
}
- protected float p() {
+ protected float aP() {
return 0.4F * (float) this.getSize();
}
- public int D() {
+ public int bf() {
return 0;
}
- protected boolean M() {
+ protected boolean r() {
return this.getSize() > 1;
}
- protected boolean K() {
+ protected boolean p() {
return this.getSize() > 2;
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySmallFireball.java b/src/main/java/net/minecraft/server/EntitySmallFireball.java
index bfd8e824..a1265bfc 100644
--- a/src/main/java/net/minecraft/server/EntitySmallFireball.java
+++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java
@@ -9,17 +9,17 @@ public class EntitySmallFireball extends EntityFireball {
public EntitySmallFireball(World world) {
super(world);
- this.b(0.3125F, 0.3125F);
+ this.a(0.3125F, 0.3125F);
}
public EntitySmallFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
super(world, entityliving, d0, d1, d2);
- this.b(0.3125F, 0.3125F);
+ this.a(0.3125F, 0.3125F);
}
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
super(world, d0, d1, d2, d3, d4, d5);
- this.b(0.3125F, 0.3125F);
+ this.a(0.3125F, 0.3125F);
}
protected void a(MovingObjectPosition movingobjectposition) {
@@ -82,7 +82,7 @@ public class EntitySmallFireball extends EntityFireball {
}
}
- public boolean o_() {
+ public boolean L() {
return false;
}
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index 3cd0c7d9..9348b6a6 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -1,7 +1,5 @@
package net.minecraft.server;
-import java.util.List;
-
// CraftBukkit start
import org.bukkit.event.block.EntityBlockFormEvent;
import org.bukkit.event.entity.EntityDamageEvent;
@@ -12,8 +10,8 @@ public class EntitySnowman extends EntityGolem {
public EntitySnowman(World world) {
super(world);
this.texture = "/mob/snowman.png";
- this.b(0.4F, 1.8F);
- this.al().a(true);
+ this.a(0.4F, 1.8F);
+ this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalArrowAttack(this, 0.25F, 2, 20));
this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, 0.2F));
this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
@@ -21,7 +19,7 @@ public class EntitySnowman extends EntityGolem {
this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityMonster.class, 16.0F, 0, true));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -29,9 +27,9 @@ public class EntitySnowman extends EntityGolem {
return 4;
}
- public void e() {
- super.e();
- if (this.aT()) {
+ public void d() {
+ super.d();
+ if (this.G()) {
// CraftBukkit start
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.DROWNING, 1);
this.world.getServer().getPluginManager().callEvent(event);
@@ -46,7 +44,7 @@ public class EntitySnowman extends EntityGolem {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
- if (this.world.getBiome(i, j).i() > 1.0F) {
+ if (this.world.getBiome(i, j).j() > 1.0F) {
// CraftBukkit start
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.MELTING, 1);
this.world.getServer().getPluginManager().callEvent(event);
@@ -63,7 +61,7 @@ public class EntitySnowman extends EntityGolem {
int k = MathHelper.floor(this.locY);
int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));
- if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).i() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
+ if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).j() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
blockState.setTypeId(Block.SNOW.id);
@@ -79,21 +77,13 @@ public class EntitySnowman extends EntityGolem {
}
}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
protected int getLootId() {
return Item.SNOW_BALL.id;
}
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start
- List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(16);
if (j > 0) {
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index 21b0c6d7..fa933849 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -7,23 +7,19 @@ public class EntitySpider extends EntityMonster {
public EntitySpider(World world) {
super(world);
this.texture = "/mob/spider.png";
- this.b(1.4F, 0.9F);
- this.bb = 0.8F;
+ this.a(1.4F, 0.9F);
+ this.bw = 0.8F;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(16, new Byte((byte) 0));
}
- public void e() {
- super.e();
- }
-
- public void F_() {
- super.F_();
+ public void h_() {
+ super.h_();
if (!this.world.isStatic) {
- this.a(this.positionChanged);
+ this.e(this.positionChanged);
}
}
@@ -31,16 +27,16 @@ public class EntitySpider extends EntityMonster {
return 16;
}
- public double x_() {
+ public double X() {
return (double) this.length * 0.75D - 0.5D;
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
protected Entity findTarget() {
- float f = this.b(1.0F);
+ float f = this.c(1.0F);
if (f < 0.5F) {
double d0 = 16.0D;
@@ -51,20 +47,20 @@ public class EntitySpider extends EntityMonster {
}
}
- protected String i() {
+ protected String aQ() {
return "mob.spider";
}
- protected String j() {
+ protected String aR() {
return "mob.spider";
}
- protected String k() {
+ protected String aS() {
return "mob.spiderdeath";
}
protected void a(Entity entity, float f) {
- float f1 = this.b(1.0F);
+ float f1 = this.c(1.0F);
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start
@@ -97,14 +93,6 @@ public class EntitySpider extends EntityMonster {
}
}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
protected int getLootId() {
return Item.STRING.id;
}
@@ -131,25 +119,25 @@ public class EntitySpider extends EntityMonster {
// CraftBukkit end
}
- public boolean t() {
- return this.w();
+ public boolean f_() {
+ return this.p();
}
- public void u() {}
+ public void aj() {}
- public MonsterType getMonsterType() {
- return MonsterType.ARTHROPOD;
+ public EnumMonsterType getMonsterType() {
+ return EnumMonsterType.ARTHROPOD;
}
- public boolean a(MobEffect mobeffect) {
- return mobeffect.getEffectId() == MobEffectList.POISON.id ? false : super.a(mobeffect);
+ public boolean e(MobEffect mobeffect) {
+ return mobeffect.getEffectId() == MobEffectList.POISON.id ? false : super.e(mobeffect);
}
- public boolean w() {
+ public boolean p() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
- public void a(boolean flag) {
+ public void e(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index f245e84b..e0c76d8d 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -1,55 +1,46 @@
package net.minecraft.server;
-
public class EntitySquid extends EntityWaterAnimal {
- public float a = 0.0F;
- public float b = 0.0F;
- public float c = 0.0F;
+ public float d = 0.0F;
+ public float e = 0.0F;
+ public float f = 0.0F;
public float g = 0.0F;
public float h = 0.0F;
public float i = 0.0F;
public float j = 0.0F;
- public float k = 0.0F;
- private float l = 0.0F;
- private float m = 0.0F;
- private float n = 0.0F;
- private float o = 0.0F;
- private float p = 0.0F;
- private float q = 0.0F;
+ public float by = 0.0F;
+ private float bz = 0.0F;
+ private float bA = 0.0F;
+ private float bB = 0.0F;
+ private float bC = 0.0F;
+ private float bD = 0.0F;
+ private float bE = 0.0F;
public EntitySquid(World world) {
super(world);
this.texture = "/mob/squid.png";
- this.b(0.95F, 0.95F);
- this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.a(0.95F, 0.95F);
+ this.bA = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
public int getMaxHealth() {
return 10;
}
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- }
-
- protected String i() {
+ protected String aQ() {
return null;
}
- protected String j() {
+ protected String aR() {
return null;
}
- protected String k() {
+ protected String aS() {
return null;
}
- protected float p() {
+ protected float aP() {
return 0.4F;
}
@@ -70,57 +61,53 @@ public class EntitySquid extends EntityWaterAnimal {
// CraftBukkit end
}
- public boolean b(EntityHuman entityhuman) {
- return super.b(entityhuman);
- }
-
- public boolean aU() {
+ public boolean H() {
return this.world.a(this.boundingBox.grow(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
}
- public void e() {
- super.e();
- this.b = this.a;
- this.g = this.c;
+ public void d() {
+ super.d();
+ this.e = this.d;
+ this.g = this.f;
this.i = this.h;
- this.k = this.j;
- this.h += this.m;
+ this.by = this.j;
+ this.h += this.bA;
if (this.h > 6.2831855F) {
this.h -= 6.2831855F;
if (this.random.nextInt(10) == 0) {
- this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.bA = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
}
- if (this.aU()) {
+ if (this.H()) {
float f;
if (this.h < 3.1415927F) {
f = this.h / 3.1415927F;
this.j = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
if ((double) f > 0.75D) {
- this.l = 1.0F;
- this.n = 1.0F;
+ this.bz = 1.0F;
+ this.bB = 1.0F;
} else {
- this.n *= 0.8F;
+ this.bB *= 0.8F;
}
} else {
this.j = 0.0F;
- this.l *= 0.9F;
- this.n *= 0.99F;
+ this.bz *= 0.9F;
+ this.bB *= 0.99F;
}
if (!this.world.isStatic) {
- this.motX = (double) (this.o * this.l);
- this.motY = (double) (this.p * this.l);
- this.motZ = (double) (this.q * this.l);
+ this.motX = (double) (this.bC * this.bz);
+ this.motY = (double) (this.bD * this.bz);
+ this.motZ = (double) (this.bE * this.bz);
}
f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- this.V += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.V) * 0.1F;
- this.yaw = this.V;
- this.c += 3.1415927F * this.n * 1.5F;
- this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
+ this.aq += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aq) * 0.1F;
+ this.yaw = this.aq;
+ this.f += 3.1415927F * this.bB * 1.5F;
+ this.d += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.d) * 0.1F;
} else {
this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
if (!this.world.isStatic) {
@@ -130,27 +117,27 @@ public class EntitySquid extends EntityWaterAnimal {
this.motZ = 0.0D;
}
- this.a = (float) ((double) this.a + (double) (-90.0F - this.a) * 0.02D);
+ this.d = (float) ((double) this.d + (double) (-90.0F - this.d) * 0.02D);
}
}
- public void a(float f, float f1) {
+ public void e(float f, float f1) {
this.move(this.motX, this.motY, this.motZ);
}
- protected void d_() {
- ++this.aV;
- if (this.aV > 100) {
- this.o = this.p = this.q = 0.0F;
- } else if (this.random.nextInt(50) == 0 || !this.bV || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
+ protected void be() {
+ ++this.bq;
+ if (this.bq > 100) {
+ this.bC = this.bD = this.bE = 0.0F;
+ } else if (this.random.nextInt(50) == 0 || !this.ac || this.bC == 0.0F && this.bD == 0.0F && this.bE == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
- this.o = MathHelper.cos(f) * 0.2F;
- this.p = -0.1F + this.random.nextFloat() * 0.2F;
- this.q = MathHelper.sin(f) * 0.2F;
+ this.bC = MathHelper.cos(f) * 0.2F;
+ this.bD = -0.1F + this.random.nextFloat() * 0.2F;
+ this.bE = MathHelper.sin(f) * 0.2F;
}
- this.aG();
+ this.bb();
}
public boolean canSpawn() {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 70e01349..a45f4c5e 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -11,8 +11,8 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world) {
super(world);
this.fuseTicks = 0;
- this.bf = true;
- this.b(0.98F, 0.98F);
+ this.m = true;
+ this.a(0.98F, 0.98F);
this.height = this.length / 2.0F;
}
@@ -30,17 +30,17 @@ public class EntityTNTPrimed extends Entity {
this.lastZ = d2;
}
- protected void b() {}
+ protected void a() {}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
- public boolean o_() {
+ public boolean L() {
return !this.dead;
}
- public void F_() {
+ public void h_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -56,14 +56,12 @@ public class EntityTNTPrimed extends Entity {
}
if (this.fuseTicks-- <= 0) {
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
if (!this.world.isStatic) {
- // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event.
this.explode();
- this.die();
- // CraftBukkit end
- } else {
- this.die();
}
+ this.die();
+ // CraftBukkit end
} else {
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
}
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
index 820b330e..97060359 100644
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
@@ -14,22 +14,22 @@ public class EntityThrownExpBottle extends EntityProjectile {
super(world, d0, d1, d2);
}
- protected float e() {
+ protected float h() {
return 0.07F;
}
- protected float c() {
+ protected float d() {
return 0.7F;
}
- protected float d() {
+ protected float g() {
return -20.0F;
}
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
// CraftBukkit moved after event
- //this.world.triggerEffect(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), 0);
+ // this.world.triggerEffect(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), 0);
int i = 3 + this.world.random.nextInt(5) + this.world.random.nextInt(5);
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index ac7b95a5..9b6a2868 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -7,16 +7,14 @@ import java.util.Set;
public class EntityTracker {
- private Set a = new HashSet();
+ private final WorldServer world;
+ private Set b = new HashSet();
public IntHashMap trackedEntities = new IntHashMap(); // CraftBukkit - private -> public
- private MinecraftServer c;
private int d;
- private World world; // CraftBukkit - change type
- public EntityTracker(MinecraftServer minecraftserver, World i) { // CraftBukkit - change method signature
- this.c = minecraftserver;
- this.world = i;
- this.d = minecraftserver.serverConfigurationManager.a();
+ public EntityTracker(WorldServer worldserver) {
+ this.world = worldserver;
+ this.d = worldserver.getMinecraftServer().getServerConfigurationManager().a();
}
// CraftBukkit - synchronized
@@ -24,7 +22,7 @@ public class EntityTracker {
if (entity instanceof EntityPlayer) {
this.addEntity(entity, 512, 2);
EntityPlayer entityplayer = (EntityPlayer) entity;
- Iterator iterator = this.a.iterator();
+ Iterator iterator = this.b.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
@@ -46,7 +44,7 @@ public class EntityTracker {
} else if (entity instanceof EntityEnderPearl) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityEnderSignal) {
- this.addEntity(entity, 64, 10, true);
+ this.addEntity(entity, 64, 4, true);
} else if (entity instanceof EntityEgg) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityPotion) {
@@ -94,9 +92,9 @@ public class EntityTracker {
} else {
EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag);
- this.a.add(entitytrackerentry);
+ this.b.add(entitytrackerentry);
this.trackedEntities.a(entity.id, entitytrackerentry);
- entitytrackerentry.scanPlayers(this.world.players); // CraftBukkit
+ entitytrackerentry.scanPlayers(this.world.players);
}
}
@@ -104,7 +102,7 @@ public class EntityTracker {
public synchronized void untrackEntity(Entity entity) {
if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
- Iterator iterator = this.a.iterator();
+ Iterator iterator = this.b.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
@@ -116,7 +114,7 @@ public class EntityTracker {
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.trackedEntities.d(entity.id);
if (entitytrackerentry1 != null) {
- this.a.remove(entitytrackerentry1);
+ this.b.remove(entitytrackerentry1);
entitytrackerentry1.a();
}
}
@@ -124,26 +122,29 @@ public class EntityTracker {
// CraftBukkit - synchronized
public synchronized void updatePlayers() {
ArrayList arraylist = new ArrayList();
- Iterator iterator = this.a.iterator();
+ Iterator iterator = this.b.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
- entitytrackerentry.track(this.world.players); // CraftBukkit
+ entitytrackerentry.track(this.world.players);
if (entitytrackerentry.n && entitytrackerentry.tracker instanceof EntityPlayer) {
arraylist.add((EntityPlayer) entitytrackerentry.tracker);
}
}
- for (int i = 0; i < arraylist.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) arraylist.get(i);
- Iterator iterator1 = this.a.iterator();
+ iterator = arraylist.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+ EntityPlayer entityplayer1 = entityplayer;
+ Iterator iterator1 = this.b.iterator();
while (iterator1.hasNext()) {
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
- if (entitytrackerentry1.tracker != entityplayer) {
- entitytrackerentry1.updatePlayer(entityplayer);
+ if (entitytrackerentry1.tracker != entityplayer1) {
+ entitytrackerentry1.updatePlayer(entityplayer1);
}
}
}
@@ -169,7 +170,7 @@ public class EntityTracker {
// CraftBukkit - synchronized
public synchronized void untrackPlayer(EntityPlayer entityplayer) {
- Iterator iterator = this.a.iterator();
+ Iterator iterator = this.b.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 72e4a325..c504d35f 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -32,6 +31,7 @@ public class EntityTrackerEntry {
private boolean s = false;
private boolean isMoving;
private int u = 0;
+ private Entity v;
public boolean n = false;
public Set trackedPlayers = new HashSet();
@@ -45,7 +45,7 @@ public class EntityTrackerEntry {
this.zLoc = MathHelper.floor(entity.locZ * 32.0D);
this.yRot = MathHelper.d(entity.yaw * 256.0F / 360.0F);
this.xRot = MathHelper.d(entity.pitch * 256.0F / 360.0F);
- this.i = MathHelper.d(entity.ar() * 256.0F / 360.0F);
+ this.i = MathHelper.d(entity.am() * 256.0F / 360.0F);
}
public boolean equals(Object object) {
@@ -67,107 +67,106 @@ public class EntityTrackerEntry {
this.scanPlayers(list);
}
- ++this.u;
- if (this.m++ % this.c == 0 || this.tracker.ce) {
- // CraftBukkit start - add logic for clipping
- int i = this.tracker.size.getXZCoord(this.tracker.locX);
- int j = org.bukkit.util.NumberConversions.floor(this.tracker.locY * 32.0D);
- int k = this.tracker.size.getXZCoord(this.tracker.locZ);
- // CraftBukkit end - logic for clipping
-
- int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
- int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
- int j1 = i - this.xLoc;
- int k1 = j - this.yLoc;
- int l1 = k - this.zLoc;
- Object object = null;
- boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4;
- boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4;
-
- // CraftBukkit start - code moved from below
- if (flag) {
- this.xLoc = i;
- this.yLoc = j;
- this.zLoc = k;
- }
-
- if (flag1) {
- this.yRot = l;
- this.xRot = i1;
- }
- // CraftBukkit end
+ if (this.v != this.tracker.vehicle) {
+ this.v = this.tracker.vehicle;
+ this.broadcast(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
+ }
- if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.u <= 400) {
- if (flag && flag1) {
- object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
- } else if (flag) {
- object = new Packet31RelEntityMove(this.tracker.id, (byte) j1, (byte) k1, (byte) l1);
- } else if (flag1) {
- object = new Packet32EntityLook(this.tracker.id, (byte) l, (byte) i1);
+ if (this.tracker.vehicle == null) {
+ ++this.u;
+ if (this.m++ % this.c == 0 || this.tracker.al) {
+ int i = this.tracker.am.a(this.tracker.locX);
+ int j = MathHelper.floor(this.tracker.locY * 32.0D);
+ int k = this.tracker.am.a(this.tracker.locZ);
+ int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
+ int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
+ int j1 = i - this.xLoc;
+ int k1 = j - this.yLoc;
+ int l1 = k - this.zLoc;
+ Object object = null;
+ boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4;
+ boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4;
+
+ // CraftBukkit start - code moved from below
+ if (flag) {
+ this.xLoc = i;
+ this.yLoc = j;
+ this.zLoc = k;
}
- } else {
- this.u = 0;
- // CraftBukkit start
- // remove setting of entity location to avoid clipping through blocks
- //this.tracker.locX = (double) i / 32.0D;
- //this.tracker.locY = (double) j / 32.0D;
- //this.tracker.locZ = (double) k / 32.0D;
-
- // refresh list of who can see a player before sending teleport packet
- if (this.tracker instanceof EntityPlayer) {
- this.scanPlayers(new ArrayList(this.trackedPlayers));
+
+ if (flag1) {
+ this.yRot = l;
+ this.xRot = i1;
}
- object = new Packet34EntityTeleport(this.tracker.id, i, j, k, (byte) l, (byte) i1);
// CraftBukkit end
- }
- if (this.isMoving) {
- double d0 = this.tracker.motX - this.j;
- double d1 = this.tracker.motY - this.k;
- double d2 = this.tracker.motZ - this.l;
- double d3 = 0.02D;
- double d4 = d0 * d0 + d1 * d1 + d2 * d2;
+ if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.u <= 400) {
+ if (flag && flag1) {
+ object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
+ } else if (flag) {
+ object = new Packet31RelEntityMove(this.tracker.id, (byte) j1, (byte) k1, (byte) l1);
+ } else if (flag1) {
+ object = new Packet32EntityLook(this.tracker.id, (byte) l, (byte) i1);
+ }
+ } else {
+ this.u = 0;
+ // CraftBukkit start - refresh list of who can see a player before sending teleport packet
+ if (this.tracker instanceof EntityPlayer) {
+ this.scanPlayers(new java.util.ArrayList(this.trackedPlayers));
+ }
+ // CraftBukkit end
+ object = new Packet34EntityTeleport(this.tracker.id, i, j, k, (byte) l, (byte) i1);
+ }
- if (d4 > d3 * d3 || d4 > 0.0D && this.tracker.motX == 0.0D && this.tracker.motY == 0.0D && this.tracker.motZ == 0.0D) {
- this.j = this.tracker.motX;
- this.k = this.tracker.motY;
- this.l = this.tracker.motZ;
- this.broadcast(new Packet28EntityVelocity(this.tracker.id, this.j, this.k, this.l));
+ if (this.isMoving) {
+ double d0 = this.tracker.motX - this.j;
+ double d1 = this.tracker.motY - this.k;
+ double d2 = this.tracker.motZ - this.l;
+ double d3 = 0.02D;
+ double d4 = d0 * d0 + d1 * d1 + d2 * d2;
+
+ if (d4 > d3 * d3 || d4 > 0.0D && this.tracker.motX == 0.0D && this.tracker.motY == 0.0D && this.tracker.motZ == 0.0D) {
+ this.j = this.tracker.motX;
+ this.k = this.tracker.motY;
+ this.l = this.tracker.motZ;
+ this.broadcast(new Packet28EntityVelocity(this.tracker.id, this.j, this.k, this.l));
+ }
}
- }
- if (object != null) {
- this.broadcast((Packet) object);
- }
+ if (object != null) {
+ this.broadcast((Packet) object);
+ }
- DataWatcher datawatcher = this.tracker.getDataWatcher();
+ DataWatcher datawatcher = this.tracker.getDataWatcher();
- if (datawatcher.a()) {
- this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
- }
+ if (datawatcher.a()) {
+ this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
+ }
- int i2 = MathHelper.d(this.tracker.ar() * 256.0F / 360.0F);
+ int i2 = MathHelper.d(this.tracker.am() * 256.0F / 360.0F);
- if (Math.abs(i2 - this.i) >= 4) {
- this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i2));
- this.i = i2;
- }
+ if (Math.abs(i2 - this.i) >= 4) {
+ this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i2));
+ this.i = i2;
+ }
- /* CraftBukkit start - code moved up
- if (flag) {
- this.xLoc = i;
- this.yLoc = j;
- this.zLoc = k;
- }
+ /* CraftBukkit start - code moved up
+ if (flag) {
+ this.xLoc = i;
+ this.yLoc = j;
+ this.zLoc = k;
+ }
- if (flag1) {
- this.yRot = l;
- this.xRot = i1;
+ if (flag1) {
+ this.yRot = l;
+ this.xRot = i1;
+ }
+ // CraftBukkit end */
}
- // CraftBukkit end */
+
+ this.tracker.al = false;
}
- this.tracker.ce = false;
if (this.tracker.velocityChanged) {
// CraftBukkit start - create PlayerVelocity event
boolean cancelled = false;
@@ -212,7 +211,13 @@ public class EntityTrackerEntry {
}
public void a() {
- this.broadcast(new Packet29DestroyEntity(this.tracker.id));
+ Iterator iterator = this.trackedPlayers.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+
+ entityplayer.g.add(Integer.valueOf(this.tracker.id));
+ }
}
public void a(EntityPlayer entityplayer) {
@@ -227,7 +232,7 @@ public class EntityTrackerEntry {
double d1 = entityplayer.locZ - (double) (this.zLoc / 32);
if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) {
- if (!this.trackedPlayers.contains(entityplayer)) {
+ if (!this.trackedPlayers.contains(entityplayer) && this.d(entityplayer)) {
// CraftBukkit start
if (tracker instanceof EntityPlayer) {
Player player = ((EntityPlayer) tracker).getBukkitEntity();
@@ -237,11 +242,20 @@ public class EntityTrackerEntry {
}
// CraftBukkit end
this.trackedPlayers.add(entityplayer);
- entityplayer.netServerHandler.sendPacket(this.b());
- if (this.isMoving) {
+ Packet packet = this.b();
+
+ entityplayer.netServerHandler.sendPacket(packet);
+ this.j = this.tracker.motX;
+ this.k = this.tracker.motY;
+ this.l = this.tracker.motZ;
+ if (this.isMoving && !(packet instanceof Packet24MobSpawn)) {
entityplayer.netServerHandler.sendPacket(new Packet28EntityVelocity(this.tracker.id, this.tracker.motX, this.tracker.motY, this.tracker.motZ));
}
+ if (this.tracker.vehicle != null) {
+ entityplayer.netServerHandler.sendPacket(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
+ }
+
ItemStack[] aitemstack = this.tracker.getEquipment();
if (aitemstack != null) {
@@ -259,7 +273,7 @@ public class EntityTrackerEntry {
}
// CraftBukkit start - Fix for nonsensical head yaw
- this.i = MathHelper.d(this.tracker.ar() * 256.0F / 360.0F);
+ this.i = MathHelper.d(this.tracker.am() * 256.0F / 360.0F); // tracker.am() should be getHeadRotation
this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i));
// CraftBukkit end
@@ -276,14 +290,22 @@ public class EntityTrackerEntry {
}
} else if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer);
- entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));
+ entityplayer.g.add(Integer.valueOf(this.tracker.id));
}
}
}
+ private boolean d(EntityPlayer entityplayer) {
+ return entityplayer.q().getPlayerManager().a(entityplayer, this.tracker.ah, this.tracker.aj);
+ }
+
public void scanPlayers(List list) {
- for (int i = 0; i < list.size(); ++i) {
- this.updatePlayer((EntityPlayer) list.get(i));
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ this.updatePlayer((EntityPlayer) entityhuman);
}
}
@@ -324,81 +346,67 @@ public class EntityTrackerEntry {
if (this.tracker instanceof EntityBoat) {
return new Packet23VehicleSpawn(this.tracker, 1);
- } else if (this.tracker instanceof IAnimal) {
- return new Packet24MobSpawn((EntityLiving) this.tracker);
- } else if (this.tracker instanceof EntityEnderDragon) {
- return new Packet24MobSpawn((EntityLiving) this.tracker);
- } else if (this.tracker instanceof EntityFishingHook) {
- return new Packet23VehicleSpawn(this.tracker, 90);
- } else if (this.tracker instanceof EntityArrow) {
- Entity entity = ((EntityArrow) this.tracker).shooter;
-
- return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
- } else if (this.tracker instanceof EntitySnowball) {
- return new Packet23VehicleSpawn(this.tracker, 61);
- } else if (this.tracker instanceof EntityPotion) {
- return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
- } else if (this.tracker instanceof EntityThrownExpBottle) {
- return new Packet23VehicleSpawn(this.tracker, 75);
- } else if (this.tracker instanceof EntityEnderPearl) {
- return new Packet23VehicleSpawn(this.tracker, 65);
- } else if (this.tracker instanceof EntityEnderSignal) {
- return new Packet23VehicleSpawn(this.tracker, 72);
- } else {
- Packet23VehicleSpawn packet23vehiclespawn;
-
- if (this.tracker instanceof EntitySmallFireball) {
- EntitySmallFireball entitysmallfireball = (EntitySmallFireball) this.tracker;
-
- packet23vehiclespawn = null;
- if (entitysmallfireball.shooter != null) {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, entitysmallfireball.shooter.id);
- } else {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, 0);
- }
-
- packet23vehiclespawn.e = (int) (entitysmallfireball.dirX * 8000.0D);
- packet23vehiclespawn.f = (int) (entitysmallfireball.dirY * 8000.0D);
- packet23vehiclespawn.g = (int) (entitysmallfireball.dirZ * 8000.0D);
- return packet23vehiclespawn;
- } else if (this.tracker instanceof EntityFireball) {
- EntityFireball entityfireball = (EntityFireball) this.tracker;
-
- packet23vehiclespawn = null;
- if (entityfireball.shooter != null) {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
- } else {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, 0);
- }
-
- packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
- packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
- packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
- return packet23vehiclespawn;
- } else if (this.tracker instanceof EntityEgg) {
- return new Packet23VehicleSpawn(this.tracker, 62);
- } else if (this.tracker instanceof EntityTNTPrimed) {
- return new Packet23VehicleSpawn(this.tracker, 50);
- } else if (this.tracker instanceof EntityEnderCrystal) {
- return new Packet23VehicleSpawn(this.tracker, 51);
+ } else if (!(this.tracker instanceof IAnimal) && !(this.tracker instanceof EntityEnderDragon)) {
+ if (this.tracker instanceof EntityFishingHook) {
+ EntityHuman entityhuman = ((EntityFishingHook) this.tracker).owner;
+
+ return new Packet23VehicleSpawn(this.tracker, 90, entityhuman != null ? entityhuman.id : this.tracker.id);
+ } else if (this.tracker instanceof EntityArrow) {
+ Entity entity = ((EntityArrow) this.tracker).shooter;
+
+ return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
+ } else if (this.tracker instanceof EntitySnowball) {
+ return new Packet23VehicleSpawn(this.tracker, 61);
+ } else if (this.tracker instanceof EntityPotion) {
+ return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
+ } else if (this.tracker instanceof EntityThrownExpBottle) {
+ return new Packet23VehicleSpawn(this.tracker, 75);
+ } else if (this.tracker instanceof EntityEnderPearl) {
+ return new Packet23VehicleSpawn(this.tracker, 65);
+ } else if (this.tracker instanceof EntityEnderSignal) {
+ return new Packet23VehicleSpawn(this.tracker, 72);
} else {
- if (this.tracker instanceof EntityFallingBlock) {
- EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
+ Packet23VehicleSpawn packet23vehiclespawn;
- if (entityfallingblock.id == Block.SAND.id) {
- return new Packet23VehicleSpawn(this.tracker, 70);
- }
+ if (this.tracker instanceof EntitySmallFireball) {
+ EntitySmallFireball entitysmallfireball = (EntitySmallFireball) this.tracker;
- if (entityfallingblock.id == Block.GRAVEL.id) {
- return new Packet23VehicleSpawn(this.tracker, 71);
+ packet23vehiclespawn = null;
+ if (entitysmallfireball.shooter != null) {
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, entitysmallfireball.shooter.id);
+ } else {
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, 0);
}
- if (entityfallingblock.id == Block.DRAGON_EGG.id) {
- return new Packet23VehicleSpawn(this.tracker, 74);
+ packet23vehiclespawn.e = (int) (entitysmallfireball.dirX * 8000.0D);
+ packet23vehiclespawn.f = (int) (entitysmallfireball.dirY * 8000.0D);
+ packet23vehiclespawn.g = (int) (entitysmallfireball.dirZ * 8000.0D);
+ return packet23vehiclespawn;
+ } else if (this.tracker instanceof EntityFireball) {
+ EntityFireball entityfireball = (EntityFireball) this.tracker;
+
+ packet23vehiclespawn = null;
+ if (entityfireball.shooter != null) {
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
+ } else {
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, 0);
}
- }
- if (this.tracker instanceof EntityPainting) {
+ packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
+ packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
+ packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
+ return packet23vehiclespawn;
+ } else if (this.tracker instanceof EntityEgg) {
+ return new Packet23VehicleSpawn(this.tracker, 62);
+ } else if (this.tracker instanceof EntityTNTPrimed) {
+ return new Packet23VehicleSpawn(this.tracker, 50);
+ } else if (this.tracker instanceof EntityEnderCrystal) {
+ return new Packet23VehicleSpawn(this.tracker, 51);
+ } else if (this.tracker instanceof EntityFallingBlock) {
+ EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
+
+ return new Packet23VehicleSpawn(this.tracker, 70, entityfallingblock.id | entityfallingblock.data << 16);
+ } else if (this.tracker instanceof EntityPainting) {
return new Packet25EntityPainting((EntityPainting) this.tracker);
} else if (this.tracker instanceof EntityExperienceOrb) {
return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
@@ -406,6 +414,9 @@ public class EntityTrackerEntry {
throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
}
}
+ } else {
+ this.i = MathHelper.d(this.tracker.am() * 256.0F / 360.0F);
+ return new Packet24MobSpawn((EntityLiving) this.tracker);
}
}
}
@@ -413,7 +424,7 @@ public class EntityTrackerEntry {
public void clear(EntityPlayer entityplayer) {
if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer);
- entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));
+ entityplayer.g.add(Integer.valueOf(this.tracker.id));
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 688fe2ca..2c1f7d1c 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -2,27 +2,26 @@ package net.minecraft.server;
public class EntityWolf extends EntityTameableAnimal {
- private boolean b = false;
- private float c;
- private float g;
+ private float e;
+ private float f;
+ private boolean g;
private boolean h;
- private boolean i;
+ private float i;
private float j;
- private float k;
public EntityWolf(World world) {
super(world);
this.texture = "/mob/wolf.png";
- this.b(0.6F, 0.8F);
- this.bb = 0.3F;
- this.al().a(true);
+ this.a(0.6F, 0.8F);
+ this.bw = 0.3F;
+ this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, this.a);
+ this.goalSelector.a(2, this.d);
this.goalSelector.a(3, new PathfinderGoalLeapAtTarget(this, 0.4F));
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bb, true));
- this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bb, 10.0F, 2.0F));
- this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bb));
- this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bb));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bw, true));
+ this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bw, 10.0F, 2.0F));
+ this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bw));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bw));
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));
@@ -32,7 +31,7 @@ public class EntityWolf extends EntityTameableAnimal {
this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed(this, EntitySheep.class, 16.0F, 200, false));
}
- public boolean c_() {
+ public boolean aV() {
return true;
}
@@ -43,7 +42,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- protected void g() {
+ protected void bd() {
this.datawatcher.watch(18, Integer.valueOf(this.getHealth()));
}
@@ -51,12 +50,13 @@ public class EntityWolf extends EntityTameableAnimal {
return this.isTamed() ? 20 : 8;
}
- protected void b() {
- super.b();
+ protected void a() {
+ super.a();
this.datawatcher.a(18, new Integer(this.getHealth()));
+ this.datawatcher.a(19, new Byte((byte) 0));
}
- protected boolean g_() {
+ protected boolean e_() {
return false;
}
@@ -70,23 +70,23 @@ public class EntityWolf extends EntityTameableAnimal {
this.setAngry(nbttagcompound.getBoolean("Angry"));
}
- protected boolean n() {
+ protected boolean ba() {
return this.isAngry();
}
- protected String i() {
+ protected String aQ() {
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 j() {
+ protected String aR() {
return "mob.wolf.hurt";
}
- protected String k() {
+ protected String aS() {
return "mob.wolf.death";
}
- protected float p() {
+ protected float aP() {
return 0.4F;
}
@@ -94,51 +94,51 @@ public class EntityWolf extends EntityTameableAnimal {
return -1;
}
- public void e() {
- super.e();
- if (!this.world.isStatic && this.h && !this.i && !this.H() && this.onGround) {
- this.i = true;
+ public void d() {
+ super.d();
+ if (!this.world.isStatic && this.g && !this.h && !this.l() && this.onGround) {
+ this.h = true;
+ this.i = 0.0F;
this.j = 0.0F;
- this.k = 0.0F;
this.world.broadcastEntityEffect(this, (byte) 8);
}
}
- public void F_() {
- super.F_();
- this.g = this.c;
- if (this.b) {
- this.c += (1.0F - this.c) * 0.4F;
+ public void h_() {
+ super.h_();
+ this.f = this.e;
+ if (this.bv()) {
+ this.e += (1.0F - this.e) * 0.4F;
} else {
- this.c += (0.0F - this.c) * 0.4F;
+ this.e += (0.0F - this.e) * 0.4F;
}
- if (this.b) {
- this.bc = 10;
+ if (this.bv()) {
+ this.bx = 10;
}
- if (this.aT()) {
- this.h = true;
- this.i = false;
+ if (this.G()) {
+ this.g = true;
+ this.h = false;
+ this.i = 0.0F;
this.j = 0.0F;
- this.k = 0.0F;
- } else if ((this.h || this.i) && this.i) {
- if (this.j == 0.0F) {
- this.world.makeSound(this, "mob.wolf.shake", this.p(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ } else if ((this.g || this.h) && this.h) {
+ if (this.i == 0.0F) {
+ this.world.makeSound(this, "mob.wolf.shake", this.aP(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
- this.k = this.j;
- this.j += 0.05F;
- if (this.k >= 2.0F) {
+ this.j = this.i;
+ this.i += 0.05F;
+ if (this.j >= 2.0F) {
+ this.g = false;
this.h = false;
- this.i = false;
- this.k = 0.0F;
this.j = 0.0F;
+ this.i = 0.0F;
}
- if (this.j > 0.4F) {
+ if (this.i > 0.4F) {
float f = (float) this.boundingBox.b;
- int i = (int) (MathHelper.sin((this.j - 0.4F) * 3.1415927F) * 7.0F);
+ int i = (int) (MathHelper.sin((this.i - 0.4F) * 3.1415927F) * 7.0F);
for (int j = 0; j < i; ++j) {
float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
@@ -154,14 +154,14 @@ public class EntityWolf extends EntityTameableAnimal {
return this.length * 0.8F;
}
- public int D() {
- return this.isSitting() ? 20 : super.D();
+ public int bf() {
+ return this.isSitting() ? 20 : super.bf();
}
public boolean damageEntity(DamageSource damagesource, int i) {
Entity entity = damagesource.getEntity();
- this.a.a(false);
+ this.d.a(false);
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
i = (i + 1) / 2;
}
@@ -169,49 +169,20 @@ public class EntityWolf extends EntityTameableAnimal {
return super.damageEntity(damagesource, i);
}
- public boolean a(Entity entity) {
+ public boolean k(Entity entity) {
int i = this.isTamed() ? 4 : 2;
return entity.damageEntity(DamageSource.mobAttack(this), i);
}
- public boolean b(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (!this.isTamed()) {
- if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
- if (!entityhuman.abilities.canInstantlyBuild) {
- --itemstack.count;
- }
-
- if (itemstack.count <= 0) {
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
- }
-
- if (!this.world.isStatic) {
- // CraftBukkit - added event call and isCancelled check.
- if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
- this.setTamed(true);
- this.setPathEntity((PathEntity) null);
- this.b((EntityLiving) null);
- this.a.a(true);
- this.setHealth(20);
- this.setOwnerName(entityhuman.name);
- this.a(true);
- this.world.broadcastEntityEffect(this, (byte) 7);
- } else {
- this.a(false);
- this.world.broadcastEntityEffect(this, (byte) 6);
- }
- }
-
- return true;
- }
- } else {
+ if (this.isTamed()) {
if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) {
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
- if (itemfood.q() && this.datawatcher.getInt(18) < 20) {
+ if (itemfood.h() && this.datawatcher.getInt(18) < 20) {
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -225,21 +196,48 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.a(itemstack)) {
- this.a.a(!this.isSitting());
- this.aZ = false;
+ if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.b(itemstack)) {
+ this.d.a(!this.isSitting());
+ this.bu = false;
this.setPathEntity((PathEntity) null);
}
+ } else if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ }
+
+ if (itemstack.count <= 0) {
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
+ }
+
+ if (!this.world.isStatic) {
+ // CraftBukkit - added event call and isCancelled check.
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
+ this.setTamed(true);
+ this.setPathEntity((PathEntity) null);
+ this.b((EntityLiving) null);
+ this.d.a(true);
+ this.setHealth(20);
+ this.setOwnerName(entityhuman.name);
+ this.e(true);
+ this.world.broadcastEntityEffect(this, (byte) 7);
+ } else {
+ this.e(false);
+ this.world.broadcastEntityEffect(this, (byte) 6);
+ }
+ }
+
+ return true;
}
- return super.b(entityhuman);
+ return super.c(entityhuman);
}
- public boolean a(ItemStack itemstack) {
- return itemstack == null ? false : (!(Item.byId[itemstack.id] instanceof ItemFood) ? false : ((ItemFood) Item.byId[itemstack.id]).q());
+ public boolean b(ItemStack itemstack) {
+ return itemstack == null ? false : (!(Item.byId[itemstack.id] instanceof ItemFood) ? false : ((ItemFood) Item.byId[itemstack.id]).h());
}
- public int q() {
+ public int bl() {
return 8;
}
@@ -265,8 +263,14 @@ public class EntityWolf extends EntityTameableAnimal {
return entitywolf;
}
- public void e(boolean flag) {
- this.b = flag;
+ public void i(boolean flag) {
+ byte b0 = this.datawatcher.getByte(19);
+
+ if (flag) {
+ this.datawatcher.watch(19, Byte.valueOf((byte) 1));
+ } else {
+ this.datawatcher.watch(19, Byte.valueOf((byte) 0));
+ }
}
public boolean mate(EntityAnimal entityanimal) {
@@ -279,7 +283,11 @@ public class EntityWolf extends EntityTameableAnimal {
} else {
EntityWolf entitywolf = (EntityWolf) entityanimal;
- return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.r_() && entitywolf.r_());
+ return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.s() && entitywolf.s());
}
}
+
+ public boolean bv() {
+ return this.datawatcher.getByte(19) == 1;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index ebedc69d..ef5ad29d 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -7,16 +7,16 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) {
super(world);
this.texture = "/mob/zombie.png";
- this.bb = 0.23F;
+ this.bw = 0.23F;
this.damage = 4;
- this.al().b(true);
+ 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.bb, false));
- this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bb, true));
- this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bb));
- this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bb, false));
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bb));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bw, false));
+ this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bw, true));
+ this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bw));
+ this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bw, false));
+ this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bw));
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));
@@ -28,19 +28,19 @@ public class EntityZombie extends EntityMonster {
return 20;
}
- public int T() {
+ public int aO() {
return 2;
}
- protected boolean c_() {
+ protected boolean aV() {
return true;
}
- public void e() {
- if (this.world.e() && !this.world.isStatic) {
- float f = this.b(1.0F);
+ public void d() {
+ if (this.world.r() && !this.world.isStatic) {
+ float f = this.c(1.0F);
- if (f > 0.5F && this.world.isChunkLoaded(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.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
this.world.getServer().getPluginManager().callEvent(event);
@@ -52,18 +52,18 @@ public class EntityZombie extends EntityMonster {
}
}
- super.e();
+ super.d();
}
- protected String i() {
+ protected String aQ() {
return "mob.zombie";
}
- protected String j() {
+ protected String aR() {
return "mob.zombiehurt";
}
- protected String k() {
+ protected String aS() {
return "mob.zombiedeath";
}
@@ -71,23 +71,23 @@ public class EntityZombie extends EntityMonster {
return Item.ROTTEN_FLESH.id;
}
- public MonsterType getMonsterType() {
- return MonsterType.UNDEAD;
+ public EnumMonsterType getMonsterType() {
+ return EnumMonsterType.UNDEAD;
}
// CraftBukkit start - return rare dropped item instead of dropping it
- protected ItemStack b(int i) {
+ protected ItemStack l(int i) {
switch (this.random.nextInt(4)) {
- case 0:
- return new ItemStack(Item.IRON_SWORD.id, 1, 0);
- case 1:
- return new ItemStack(Item.IRON_HELMET.id, 1, 0);
- case 2:
- return new ItemStack(Item.IRON_INGOT.id, 1, 0);
- case 3:
- return new ItemStack(Item.IRON_SPADE.id, 1, 0);
- default:
- return null;
+ case 0:
+ return new ItemStack(Item.IRON_SWORD.id, 1, 0);
+ case 1:
+ return new ItemStack(Item.IRON_HELMET.id, 1, 0);
+ case 2:
+ return new ItemStack(Item.IRON_INGOT.id, 1, 0);
+ case 3:
+ return new ItemStack(Item.IRON_SPADE.id, 1, 0);
+ default:
+ return null;
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 63b82408..b30e7662 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -1,10 +1,12 @@
package net.minecraft.server;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Random;
-import java.util.Set;
// CraftBukkit start
import org.bukkit.Bukkit;
@@ -18,15 +20,16 @@ import org.bukkit.Location;
public class Explosion {
public boolean a = false;
- private Random h = new Random();
+ private int h = 16;
+ private Random i = new Random();
private World world;
public double posX;
public double posY;
public double posZ;
public Entity source;
public float size;
- public Set blocks = new HashSet();
-
+ public List blocks = new ArrayList();
+ private Map k = new HashMap();
public boolean wasCanceled = false; // CraftBukkit
public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
@@ -44,8 +47,9 @@ public class Explosion {
return;
}
// CraftBukkit end
+
float f = this.size;
- byte b0 = 16;
+ HashSet hashset = new HashSet();
int i;
int j;
@@ -54,13 +58,13 @@ public class Explosion {
double d1;
double d2;
- for (i = 0; i < b0; ++i) {
- for (j = 0; j < b0; ++j) {
- for (k = 0; k < b0; ++k) {
- if (i == 0 || i == b0 - 1 || j == 0 || j == b0 - 1 || k == 0 || k == b0 - 1) {
- double d3 = (double) ((float) i / ((float) b0 - 1.0F) * 2.0F - 1.0F);
- double d4 = (double) ((float) j / ((float) b0 - 1.0F) * 2.0F - 1.0F);
- double d5 = (double) ((float) k / ((float) b0 - 1.0F) * 2.0F - 1.0F);
+ for (i = 0; i < this.h; ++i) {
+ for (j = 0; j < this.h; ++j) {
+ for (k = 0; k < this.h; ++k) {
+ if (i == 0 || i == this.h - 1 || j == 0 || j == this.h - 1 || k == 0 || k == this.h - 1) {
+ double d3 = (double) ((float) i / ((float) this.h - 1.0F) * 2.0F - 1.0F);
+ double d4 = (double) ((float) j / ((float) this.h - 1.0F) * 2.0F - 1.0F);
+ double d5 = (double) ((float) k / ((float) this.h - 1.0F) * 2.0F - 1.0F);
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
d3 /= d6;
@@ -82,8 +86,8 @@ public class Explosion {
f1 -= (Block.byId[k1].a(this.source) + 0.3F) * f2;
}
- if (f1 > 0.0F && i1 < 256 && i1 >= 0) { // CraftBukkit - Don't wrap explosions
- this.blocks.add(new ChunkPosition(l, i1, j1));
+ if (f1 > 0.0F && i1 < 256 && i1 >= 0) { // CraftBukkit - don't wrap explosions
+ hashset.add(new ChunkPosition(l, i1, j1));
}
d0 += d3 * (double) f2;
@@ -95,6 +99,7 @@ public class Explosion {
}
}
+ this.blocks.addAll(hashset);
this.size *= 2.0F;
i = MathHelper.floor(this.posX - (double) this.size - 1.0D);
j = MathHelper.floor(this.posX + (double) this.size + 1.0D);
@@ -102,87 +107,83 @@ public class Explosion {
int l1 = MathHelper.floor(this.posY + (double) this.size + 1.0D);
int i2 = MathHelper.floor(this.posZ - (double) this.size - 1.0D);
int j2 = MathHelper.floor(this.posZ + (double) this.size + 1.0D);
- List list = this.world.getEntities(this.source, AxisAlignedBB.b((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
- Vec3D vec3d = Vec3D.create(this.posX, this.posY, this.posZ);
+ List list = this.world.getEntities(this.source, AxisAlignedBB.a().a((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
+ Vec3D vec3d = Vec3D.a().create(this.posX, this.posY, this.posZ);
for (int k2 = 0; k2 < list.size(); ++k2) {
Entity entity = (Entity) list.get(k2);
- // CraftBukkit start
- d0 = entity.locX - this.posX;
- d1 = entity.locY - this.posY;
- d2 = entity.locZ - this.posZ;
- double d8 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
-
- double d7 = d8 / this.size; // Don't call sub-method and sqrt again
+ double d7 = entity.f(this.posX, this.posY, this.posZ) / (double) this.size;
if (d7 <= 1.0D) {
- // Moved calculations up
- if (d8 != 0) {
+ d0 = entity.locX - this.posX;
+ d1 = entity.locY + (double) entity.getHeadHeight() - this.posY;
+ d2 = entity.locZ - this.posZ;
+ double d8 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
+
+ if (d8 != 0.0D) {
d0 /= d8;
d1 /= d8;
d2 /= d8;
- } else { // Compensate for underflow
- d0 = 0d;
- d1 = 0d;
- d2 = 0d;
- }
- // CraftBukkit end
- double d9 = (double) this.world.a(vec3d, entity.boundingBox);
- double d10 = (1.0D - d7) * d9;
-
- // CraftBukkit start - explosion damage hook
- org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
- int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D);
-
- if (damagee == null) {
- // nothing was hurt
- } else if (this.source == null) { // Block explosion (without an entity source; bed etc.)
- EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damageDone);
- Bukkit.getPluginManager().callEvent(event);
-
- if (!event.isCancelled()) {
- damagee.setLastDamageCause(event);
- entity.damageEntity(DamageSource.EXPLOSION, event.getDamage());
- entity.motX += d0 * d10;
- entity.motY += d1 * d10;
- entity.motZ += d2 * d10;
- }
- } else {
- final org.bukkit.entity.Entity damager = this.source.getBukkitEntity();
- final EntityDamageEvent.DamageCause damageCause;
- if (damager instanceof org.bukkit.entity.TNTPrimed) {
- damageCause = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
+ double d9 = (double) this.world.a(vec3d, entity.boundingBox);
+ double d10 = (1.0D - d7) * d9;
+
+ // CraftBukkit start - explosion damage hook
+ org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
+ int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D);
+
+ if (damagee == null) {
+ // nothing was hurt
+ } else if (this.source == null) { // Block explosion (without an entity source; bed etc.)
+ EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damageDone);
+ Bukkit.getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ damagee.setLastDamageCause(event);
+ entity.damageEntity(DamageSource.EXPLOSION, event.getDamage());
+
+ entity.motX += d0 * d10;
+ entity.motY += d1 * d10;
+ entity.motZ += d2 * d10;
+ if (entity instanceof EntityHuman) {
+ this.k.put((EntityHuman) entity, Vec3D.a().create(d0 * d10, d1 * d10, d2 * d10));
+ }
+ }
} else {
- damageCause = EntityDamageEvent.DamageCause.ENTITY_EXPLOSION;
- }
- EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageCause, damageDone);
- Bukkit.getPluginManager().callEvent(event);
+ final org.bukkit.entity.Entity damager = this.source.getBukkitEntity();
+ final EntityDamageEvent.DamageCause damageCause;
+
+ if (damager instanceof org.bukkit.entity.TNTPrimed) {
+ damageCause = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
+ } else {
+ damageCause = EntityDamageEvent.DamageCause.ENTITY_EXPLOSION;
+ }
+
+ EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageCause, damageDone);
+ Bukkit.getPluginManager().callEvent(event);
- if (!event.isCancelled()) {
- entity.getBukkitEntity().setLastDamageCause(event);
- entity.damageEntity(DamageSource.EXPLOSION, event.getDamage());
+ if (!event.isCancelled()) {
+ entity.getBukkitEntity().setLastDamageCause(event);
+ entity.damageEntity(DamageSource.EXPLOSION, event.getDamage());
- entity.motX += d0 * d10;
- entity.motY += d1 * d10;
- entity.motZ += d2 * d10;
+ entity.motX += d0 * d10;
+ entity.motY += d1 * d10;
+ entity.motZ += d2 * d10;
+ if (entity instanceof EntityHuman) {
+ this.k.put((EntityHuman) entity, Vec3D.a().create(d0 * d10, d1 * d10, d2 * d10));
+ }
+ }
}
+ // CraftBukkit end
}
- // CraftBukkit end
}
}
this.size = f;
- ArrayList arraylist = new ArrayList();
-
- arraylist.addAll(this.blocks);
}
public void a(boolean flag) {
this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
this.world.a("hugeexplosion", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
- ArrayList arraylist = new ArrayList();
-
- arraylist.addAll(this.blocks);
// CraftBukkit start
org.bukkit.World bworld = this.world.getWorld();
@@ -190,8 +191,8 @@ public class Explosion {
Location location = new Location(bworld, this.posX, this.posY, this.posZ);
List<org.bukkit.block.Block> blockList = new ArrayList<org.bukkit.block.Block>();
- for (int j = arraylist.size() - 1; j >= 0; j--) {
- ChunkPosition cpos = (ChunkPosition) arraylist.get(j);
+ for (int j = blocks.size() - 1; j >= 0; j--) {
+ ChunkPosition cpos = (ChunkPosition) blocks.get(j);
org.bukkit.block.Block block = bworld.getBlockAt(cpos.x, cpos.y, cpos.z);
if (block.getType() != org.bukkit.Material.AIR) {
blockList.add(block);
@@ -201,12 +202,10 @@ public class Explosion {
EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, 0.3F);
this.world.getServer().getPluginManager().callEvent(event);
- arraylist.clear();
blocks.clear();
for (org.bukkit.block.Block block : event.blockList()) {
ChunkPosition coords = new ChunkPosition(block.getX(), block.getY(), block.getZ());
- arraylist.add(coords);
blocks.add(coords);
}
@@ -214,25 +213,26 @@ public class Explosion {
this.wasCanceled = true;
return;
}
+
+ Iterator iterator = this.blocks.iterator();
// CraftBukkit end
- int i;
ChunkPosition chunkposition;
+ int i;
int j;
int k;
int l;
- int i1;
-
- for (i = arraylist.size() - 1; i >= 0; --i) {
- chunkposition = (ChunkPosition) arraylist.get(i);
- j = chunkposition.x;
- k = chunkposition.y;
- l = chunkposition.z;
- i1 = this.world.getTypeId(j, k, l);
+
+ while (iterator.hasNext()) {
+ chunkposition = (ChunkPosition) iterator.next();
+ i = chunkposition.x;
+ j = chunkposition.y;
+ k = chunkposition.z;
+ l = this.world.getTypeId(i, j, k);
if (flag) {
- double d0 = (double) ((float) j + this.world.random.nextFloat());
- double d1 = (double) ((float) k + this.world.random.nextFloat());
- double d2 = (double) ((float) l + this.world.random.nextFloat());
+ double d0 = (double) ((float) i + this.world.random.nextFloat());
+ double d1 = (double) ((float) j + this.world.random.nextFloat());
+ double d2 = (double) ((float) k + this.world.random.nextFloat());
double d3 = d0 - this.posX;
double d4 = d1 - this.posY;
double d5 = d2 - this.posZ;
@@ -252,27 +252,36 @@ public class Explosion {
}
// CraftBukkit - stop explosions from putting out fire
- if (i1 > 0 && i1 != Block.FIRE.id) {
+ if (l > 0 && l != Block.FIRE.id) {
// CraftBukkit
- Block.byId[i1].dropNaturally(this.world, j, k, l, this.world.getData(j, k, l), event.getYield(), 0);
- this.world.setTypeId(j, k, l, 0);
- Block.byId[i1].wasExploded(this.world, j, k, l);
+ Block.byId[l].dropNaturally(this.world, i, j, k, this.world.getData(i, j, k), event.getYield(), 0);
+ 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);
}
}
if (this.a) {
- for (i = arraylist.size() - 1; i >= 0; --i) {
- chunkposition = (ChunkPosition) arraylist.get(i);
- j = chunkposition.x;
- k = chunkposition.y;
- l = chunkposition.z;
- i1 = this.world.getTypeId(j, k, l);
- int j1 = this.world.getTypeId(j, k - 1, l);
-
- if (i1 == 0 && Block.n[j1] && this.h.nextInt(3) == 0) {
- this.world.setTypeId(j, k, l, Block.FIRE.id);
+ iterator = this.blocks.iterator();
+
+ while (iterator.hasNext()) {
+ chunkposition = (ChunkPosition) iterator.next();
+ i = chunkposition.x;
+ j = chunkposition.y;
+ k = chunkposition.z;
+ l = this.world.getTypeId(i, j, k);
+ int i1 = this.world.getTypeId(i, j - 1, k);
+
+ if (l == 0 && Block.n[i1] && this.i.nextInt(3) == 0) {
+ this.world.setTypeId(i, j, k, Block.FIRE.id);
}
}
}
}
+
+ public Map b() {
+ return this.k;
+ }
}
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index 3c10b06d..d2b3a8dc 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -42,10 +42,10 @@ public class FoodMetaData {
}
}
- if (this.foodLevel >= 18 && entityhuman.ag()) {
+ if (this.foodLevel >= 18 && entityhuman.bM()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
- // CraftBukkit - added RegainReason.
+ // CraftBukkit - added RegainReason
entityhuman.heal(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
this.foodTickTimer = 0;
}
@@ -91,7 +91,7 @@ public class FoodMetaData {
return this.foodLevel;
}
- public boolean b() {
+ public boolean c() {
return this.foodLevel < 20;
}
@@ -99,7 +99,7 @@ public class FoodMetaData {
this.exhaustionLevel = Math.min(this.exhaustionLevel + f, 40.0F);
}
- public float c() {
+ public float e() {
return this.saturationLevel;
}
}
diff --git a/src/main/java/net/minecraft/server/FurnaceRecipes.java b/src/main/java/net/minecraft/server/FurnaceRecipes.java
deleted file mode 100644
index 883eebc0..00000000
--- a/src/main/java/net/minecraft/server/FurnaceRecipes.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package net.minecraft.server;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class FurnaceRecipes {
-
- private static final FurnaceRecipes a = new FurnaceRecipes();
- public Map recipies = new HashMap(); // CraftBukkit - private -> public
-
- public static final FurnaceRecipes getInstance() {
- return a;
- }
-
- public FurnaceRecipes() { // CraftBukkit - private -> public
- this.registerRecipe(Block.IRON_ORE.id, new ItemStack(Item.IRON_INGOT));
- this.registerRecipe(Block.GOLD_ORE.id, new ItemStack(Item.GOLD_INGOT));
- this.registerRecipe(Block.DIAMOND_ORE.id, new ItemStack(Item.DIAMOND));
- this.registerRecipe(Block.SAND.id, new ItemStack(Block.GLASS));
- this.registerRecipe(Item.PORK.id, new ItemStack(Item.GRILLED_PORK));
- this.registerRecipe(Item.RAW_BEEF.id, new ItemStack(Item.COOKED_BEEF));
- this.registerRecipe(Item.RAW_CHICKEN.id, new ItemStack(Item.COOKED_CHICKEN));
- this.registerRecipe(Item.RAW_FISH.id, new ItemStack(Item.COOKED_FISH));
- this.registerRecipe(Block.COBBLESTONE.id, new ItemStack(Block.STONE));
- this.registerRecipe(Item.CLAY_BALL.id, new ItemStack(Item.CLAY_BRICK));
- this.registerRecipe(Block.CACTUS.id, new ItemStack(Item.INK_SACK, 1, 2));
- this.registerRecipe(Block.LOG.id, new ItemStack(Item.COAL, 1, 1));
- this.registerRecipe(Block.COAL_ORE.id, new ItemStack(Item.COAL));
- this.registerRecipe(Block.REDSTONE_ORE.id, new ItemStack(Item.REDSTONE));
- this.registerRecipe(Block.LAPIS_ORE.id, new ItemStack(Item.INK_SACK, 1, 4));
- }
-
- public void registerRecipe(int i, ItemStack itemstack) {
- this.recipies.put(Integer.valueOf(i), itemstack);
- }
-
- public ItemStack getResult(int i) {
- return (ItemStack) this.recipies.get(Integer.valueOf(i));
- }
-
- public Map getRecipies() {
- return this.recipies;
- }
-}
diff --git a/src/main/java/net/minecraft/server/IDataManager.java b/src/main/java/net/minecraft/server/IDataManager.java
index afdb4dd3..a91d244a 100644
--- a/src/main/java/net/minecraft/server/IDataManager.java
+++ b/src/main/java/net/minecraft/server/IDataManager.java
@@ -1,25 +1,26 @@
package net.minecraft.server;
import java.io.File;
-import java.util.List;
public interface IDataManager {
WorldData getWorldData();
- void checkSession();
+ void checkSession() throws ExceptionWorldConflict; // CraftBukkit - throws ExceptionWorldConflict
IChunkLoader createChunkLoader(WorldProvider worldprovider);
- void saveWorldData(WorldData worlddata, List list);
+ void saveWorldData(WorldData worlddata, NBTTagCompound nbttagcompound);
void saveWorldData(WorldData worlddata);
PlayerFileData getPlayerFileData();
- void e();
+ void a();
File getDataFile(String s);
+ String g();
+
java.util.UUID getUUID(); // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java
index 0e9ad1b5..a25276cf 100644
--- a/src/main/java/net/minecraft/server/IInventory.java
+++ b/src/main/java/net/minecraft/server/IInventory.java
@@ -22,9 +22,9 @@ public interface IInventory {
boolean a(EntityHuman entityhuman);
- void f();
+ void startOpen();
- void g();
+ void f();
// CraftBukkit start
ItemStack[] getContents();
diff --git a/src/main/java/net/minecraft/server/CraftingRecipe.java b/src/main/java/net/minecraft/server/IRecipe.java
index fceeb736..fbd3e3c4 100644
--- a/src/main/java/net/minecraft/server/CraftingRecipe.java
+++ b/src/main/java/net/minecraft/server/IRecipe.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-public interface CraftingRecipe {
+public interface IRecipe {
boolean a(InventoryCrafting inventorycrafting);
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java
index 90ddeddd..f5855d65 100644
--- a/src/main/java/net/minecraft/server/InventoryCraftResult.java
+++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java
@@ -15,6 +15,7 @@ public class InventoryCraftResult implements IInventory {
public ItemStack[] getContents() {
return this.items;
}
+
public org.bukkit.inventory.InventoryHolder getOwner() {
return null; // Result slots don't get an owner
}
@@ -81,7 +82,7 @@ public class InventoryCraftResult implements IInventory {
return true;
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
}
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java
index be99de8d..217dd8c9 100644
--- a/src/main/java/net/minecraft/server/InventoryCrafting.java
+++ b/src/main/java/net/minecraft/server/InventoryCrafting.java
@@ -16,7 +16,7 @@ public class InventoryCrafting implements IInventory {
// CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
- public CraftingRecipe currentRecipe;
+ public IRecipe currentRecipe;
public IInventory resultInventory;
private EntityHuman owner;
private int maxStack = MAX_STACK;
@@ -135,7 +135,7 @@ public class InventoryCrafting implements IInventory {
return true;
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
}
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
new file mode 100644
index 00000000..c7e3bdb6
--- /dev/null
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -0,0 +1,110 @@
+package net.minecraft.server;
+
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
+public class InventoryEnderChest extends InventorySubcontainer {
+
+ private TileEntityEnderChest a;
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ public org.bukkit.entity.Player player;
+ private int maxStack = MAX_STACK;
+
+ public ItemStack[] getContents() {
+ return this.items;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return this.player;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+ // CraftBukkit end
+
+ public InventoryEnderChest() {
+ super("container.enderchest", 27);
+ }
+
+ public void a(TileEntityEnderChest tileentityenderchest) {
+ this.a = tileentityenderchest;
+ }
+
+ public void a(NBTTagList nbttaglist) {
+ int i;
+
+ for (i = 0; i < this.getSize(); ++i) {
+ this.setItem(i, (ItemStack) null);
+ }
+
+ for (i = 0; i < nbttaglist.size(); ++i) {
+ NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
+ int j = nbttagcompound.getByte("Slot") & 255;
+
+ if (j >= 0 && j < this.getSize()) {
+ this.setItem(j, ItemStack.a(nbttagcompound));
+ }
+ }
+ }
+
+ public NBTTagList g() {
+ NBTTagList nbttaglist = new NBTTagList("EnderItems");
+
+ for (int i = 0; i < this.getSize(); ++i) {
+ ItemStack itemstack = this.getItem(i);
+
+ if (itemstack != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ nbttagcompound.setByte("Slot", (byte) i);
+ itemstack.save(nbttagcompound);
+ nbttaglist.add(nbttagcompound);
+ }
+ }
+
+ return nbttaglist;
+ }
+
+ public boolean a(EntityHuman entityhuman) {
+ return this.a != null && !this.a.a(entityhuman) ? false : super.a(entityhuman);
+ }
+
+ public void startOpen() {
+ if (this.a != null) {
+ this.a.a();
+ }
+
+ super.startOpen();
+ }
+
+ public void f() {
+ if (this.a != null) {
+ this.a.b();
+ }
+
+ super.f();
+ this.a = null;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java
index 41391c4a..add43990 100644
--- a/src/main/java/net/minecraft/server/InventoryLargeChest.java
+++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java
@@ -105,13 +105,13 @@ public class InventoryLargeChest implements IInventory {
return this.left.a(entityhuman) && this.right.a(entityhuman);
}
+ public void startOpen() {
+ this.left.startOpen();
+ this.right.startOpen();
+ }
+
public void f() {
this.left.f();
this.right.f();
}
-
- public void g() {
- this.left.g();
- this.right.g();
- }
}
diff --git a/src/main/java/net/minecraft/server/InventoryMerchant.java b/src/main/java/net/minecraft/server/InventoryMerchant.java
new file mode 100644
index 00000000..f1d7add0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/InventoryMerchant.java
@@ -0,0 +1,182 @@
+package net.minecraft.server;
+
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
+public class InventoryMerchant implements IInventory {
+
+ private final IMerchant merchant;
+ private ItemStack[] itemsInSlots = new ItemStack[3];
+ private final EntityHuman player;
+ private MerchantRecipe recipe;
+ private int e;
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ public ItemStack[] getContents() {
+ return this.itemsInSlots;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ public void setMaxStackSize(int i) {
+ maxStack = i;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return player.getBukkitEntity();
+ }
+ // CraftBukkit end
+
+ public InventoryMerchant(EntityHuman entityhuman, IMerchant imerchant) {
+ this.player = entityhuman;
+ this.merchant = imerchant;
+ }
+
+ public int getSize() {
+ return this.itemsInSlots.length;
+ }
+
+ public ItemStack getItem(int i) {
+ return this.itemsInSlots[i];
+ }
+
+ public ItemStack splitStack(int i, int j) {
+ if (this.itemsInSlots[i] != null) {
+ ItemStack itemstack;
+
+ if (i == 2) {
+ itemstack = this.itemsInSlots[i];
+ this.itemsInSlots[i] = null;
+ return itemstack;
+ } else if (this.itemsInSlots[i].count <= j) {
+ itemstack = this.itemsInSlots[i];
+ this.itemsInSlots[i] = null;
+ if (this.d(i)) {
+ this.g();
+ }
+
+ return itemstack;
+ } else {
+ itemstack = this.itemsInSlots[i].a(j);
+ if (this.itemsInSlots[i].count == 0) {
+ this.itemsInSlots[i] = null;
+ }
+
+ if (this.d(i)) {
+ this.g();
+ }
+
+ return itemstack;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ private boolean d(int i) {
+ return i == 0 || i == 1;
+ }
+
+ public ItemStack splitWithoutUpdate(int i) {
+ if (this.itemsInSlots[i] != null) {
+ ItemStack itemstack = this.itemsInSlots[i];
+
+ this.itemsInSlots[i] = null;
+ return itemstack;
+ } else {
+ return null;
+ }
+ }
+
+ public void setItem(int i, ItemStack itemstack) {
+ this.itemsInSlots[i] = itemstack;
+ if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
+ }
+
+ if (this.d(i)) {
+ this.g();
+ }
+ }
+
+ public String getName() {
+ return "mob.villager";
+ }
+
+ public int getMaxStackSize() {
+ return maxStack; // CraftBukkit
+ }
+
+ public boolean a(EntityHuman entityhuman) {
+ return this.merchant.l_() == entityhuman;
+ }
+
+ public void startOpen() {}
+
+ public void f() {}
+
+ public void update() {
+ this.g();
+ }
+
+ public void g() {
+ this.recipe = null;
+ ItemStack itemstack = this.itemsInSlots[0];
+ ItemStack itemstack1 = this.itemsInSlots[1];
+
+ if (itemstack == null) {
+ itemstack = itemstack1;
+ itemstack1 = null;
+ }
+
+ if (itemstack == null) {
+ this.setItem(2, (ItemStack) null);
+ } else {
+ MerchantRecipeList merchantrecipelist = this.merchant.getOffers(this.player);
+
+ if (merchantrecipelist != null) {
+ MerchantRecipe merchantrecipe = merchantrecipelist.a(itemstack, itemstack1, this.e);
+
+ if (merchantrecipe != null) {
+ this.recipe = merchantrecipe;
+ this.setItem(2, merchantrecipe.getBuyItem3().cloneItemStack());
+ } else if (itemstack1 != null) {
+ merchantrecipe = merchantrecipelist.a(itemstack1, itemstack, this.e);
+ if (merchantrecipe != null) {
+ this.recipe = merchantrecipe;
+ this.setItem(2, merchantrecipe.getBuyItem3().cloneItemStack());
+ } else {
+ this.setItem(2, (ItemStack) null);
+ }
+ } else {
+ this.setItem(2, (ItemStack) null);
+ }
+ }
+ }
+ }
+
+ public MerchantRecipe getRecipe() {
+ return this.recipe;
+ }
+
+ public void c(int i) {
+ this.e = i;
+ this.g();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTableSubcontainer.java b/src/main/java/net/minecraft/server/InventorySubcontainer.java
index 99e0f5cb..c5d652dd 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTableSubcontainer.java
+++ b/src/main/java/net/minecraft/server/InventorySubcontainer.java
@@ -1,50 +1,16 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
-// CraftBukkit start
-import org.bukkit.craftbukkit.entity.CraftHumanEntity;
-import org.bukkit.entity.HumanEntity;
-// CraftBukkit end
-
-public class ContainerEnchantTableSubcontainer implements IInventory {
+public abstract class InventorySubcontainer implements IInventory { // CraftBukkit - abstract
private String a;
private int b;
- private ItemStack[] items;
+ protected ItemStack[] items; // CraftBukkit - protected
private List d;
- // CraftBukkit start
- public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
- public org.bukkit.entity.Player player;
- private int maxStack = MAX_STACK;
-
- public ItemStack[] getContents() {
- return this.items;
- }
-
- public void onOpen(CraftHumanEntity who) {
- transaction.add(who);
- }
-
- public void onClose(CraftHumanEntity who) {
- transaction.remove(who);
- }
-
- public List<HumanEntity> getViewers() {
- return transaction;
- }
-
- public org.bukkit.inventory.InventoryHolder getOwner() {
- return this.player;
- }
-
- public void setMaxStackSize(int size) {
- maxStack = size;
- }
- // CraftBukkit end
-
- public ContainerEnchantTableSubcontainer(String s, int i) {
+ public InventorySubcontainer(String s, int i) {
this.a = s;
this.b = i;
this.items = new ItemStack[i];
@@ -106,13 +72,17 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
}
public int getMaxStackSize() {
- return maxStack; // CraftBukkit
+ return 64;
}
public void update() {
if (this.d != null) {
- for (int i = 0; i < this.d.size(); ++i) {
- ((IInventoryListener) this.d.get(i)).a(this);
+ Iterator iterator = this.d.iterator();
+
+ while (iterator.hasNext()) {
+ IInventoryListener iinventorylistener = (IInventoryListener) iterator.next();
+
+ iinventorylistener.a(this);
}
}
}
@@ -121,7 +91,7 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
return true;
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
}
diff --git a/src/main/java/net/minecraft/server/ItemBed.java b/src/main/java/net/minecraft/server/ItemBed.java
index 0fcbd676..ddf61bce 100644
--- a/src/main/java/net/minecraft/server/ItemBed.java
+++ b/src/main/java/net/minecraft/server/ItemBed.java
@@ -6,9 +6,10 @@ public class ItemBed extends Item {
public ItemBed(int i) {
super(i);
+ this.a(CreativeModeTab.c);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ 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) {
return false;
} else {
@@ -36,8 +37,8 @@ public class ItemBed extends Item {
b0 = 1;
}
- if (entityhuman.d(i, j, k) && entityhuman.d(i + b0, j, k + b1)) {
- if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.e(i, j - 1, k) && world.e(i + b0, j - 1, k + b1)) {
+ if (entityhuman.e(i, j, k) && entityhuman.e(i + b0, j, k + b1)) {
+ 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)) {
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 5545c011..c2b9d54f 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -9,14 +9,14 @@ public class ItemBlock extends Item {
public ItemBlock(int i) {
super(i);
this.id = i + 256;
- this.d(Block.byId[i + 256].a(2));
+ this.c(Block.byId[i + 256].a(2));
}
- public int a() {
+ public int f() {
return this.id;
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k);
@@ -50,14 +50,23 @@ public class ItemBlock extends Item {
if (itemstack.count == 0) {
return false;
- } else if (!entityhuman.d(i, j, k)) {
+ } else if (!entityhuman.e(i, j, k)) {
return false;
} else if (j == 255 && Block.byId[this.id].material.isBuildable()) {
return false;
+ // CraftBukkit start
}
- // CraftBukkit start
- int id = (l == -1 && itemstack.getItem() instanceof ItemStep) ? Block.DOUBLE_STEP.id : this.id;
- if (id != this.id || world.mayPlace(this.id, i, j, k, false, l)) {
+
+ int id = this.id;
+ if (l == -1 && itemstack.getItem() instanceof ItemStep) {
+ if (this.id == Block.STEP.id) {
+ id = Block.DOUBLE_STEP.id;
+ } else if (this.id == Block.WOOD_STEP.id) {
+ id = Block.WOOD_DOUBLE_STEP.id;
+ }
+ }
+
+ if (id != this.id || world.mayPlace(this.id, i, j, k, false, l, entityhuman)) {
Block block = Block.byId[id];
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
@@ -73,10 +82,9 @@ public class ItemBlock extends Item {
if (event.isCancelled() || !event.canBuild()) {
return true;
}
-
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);
+ Block.byId[id].postPlace(world, i, j, k, l, f, f1, f2);
Block.byId[id].postPlace(world, i, j, k, entityhuman);
// CraftBukkit end
}
@@ -91,11 +99,11 @@ public class ItemBlock extends Item {
}
}
- public String a(ItemStack itemstack) {
- return Block.byId[this.id].q();
+ public String c(ItemStack itemstack) {
+ return Block.byId[this.id].a();
}
public String getName() {
- return Block.byId[this.id].q();
+ return Block.byId[this.id].a();
}
}
diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java
index 776167ac..e53dc600 100644
--- a/src/main/java/net/minecraft/server/ItemBoat.java
+++ b/src/main/java/net/minecraft/server/ItemBoat.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
public class ItemBoat extends Item {
@@ -7,6 +8,7 @@ public class ItemBoat extends Item {
public ItemBoat(int i) {
super(i);
this.maxStackSize = 1;
+ this.a(CreativeModeTab.e);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
@@ -16,7 +18,7 @@ public class ItemBoat extends Item {
double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
- Vec3D vec3d = Vec3D.create(d0, d1, d2);
+ Vec3D vec3d = Vec3D.a().create(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
@@ -30,16 +32,17 @@ public class ItemBoat extends Item {
if (movingobjectposition == null) {
return itemstack;
} else {
- Vec3D vec3d2 = entityhuman.f(f);
+ Vec3D vec3d2 = entityhuman.i(f);
boolean flag = false;
float f9 = 1.0F;
List list = world.getEntities(entityhuman, entityhuman.boundingBox.a(vec3d2.a * d3, vec3d2.b * d3, vec3d2.c * d3).grow((double) f9, (double) f9, (double) f9));
+ Iterator iterator = list.iterator();
- for (int i = 0; i < list.size(); ++i) {
- Entity entity = (Entity) list.get(i);
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
- if (entity.o_()) {
- float f10 = entity.j_();
+ if (entity.L()) {
+ float f10 = entity.Y();
AxisAlignedBB axisalignedbb = entity.boundingBox.grow((double) f10, (double) f10, (double) f10);
if (axisalignedbb.a(vec3d)) {
@@ -52,24 +55,24 @@ public class ItemBoat extends Item {
return itemstack;
} else {
if (movingobjectposition.type == EnumMovingObjectType.TILE) {
- int j = movingobjectposition.b;
- int k = movingobjectposition.c;
- int l = movingobjectposition.d;
+ int 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, j, k, l, movingobjectposition.face, itemstack);
+ 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 (world.getTypeId(j, k, l) == Block.SNOW.id) {
- --k;
+ if (world.getTypeId(i, j, k) == Block.SNOW.id) {
+ --j;
}
- world.addEntity(new EntityBoat(world, (double) ((float) j + 0.5F), (double) ((float) k + 1.0F), (double) ((float) l + 0.5F)));
+ world.addEntity(new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.0F), (double) ((float) k + 0.5F)));
}
if (!entityhuman.abilities.canInstantlyBuild) {
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
index fa664ffc..9ef4285a 100644
--- a/src/main/java/net/minecraft/server/ItemBow.java
+++ b/src/main/java/net/minecraft/server/ItemBow.java
@@ -1,19 +1,19 @@
package net.minecraft.server;
-
public class ItemBow extends Item {
public ItemBow(int i) {
super(i);
this.maxStackSize = 1;
this.setMaxDurability(384);
+ this.a(CreativeModeTab.j);
}
public void a(ItemStack itemstack, World world, EntityHuman entityhuman, int i) {
boolean flag = entityhuman.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0;
- if (flag || entityhuman.inventory.d(Item.ARROW.id)) {
- int j = this.c(itemstack) - i;
+ if (flag || entityhuman.inventory.e(Item.ARROW.id)) {
+ int j = this.a(itemstack) - i;
float f = (float) j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
@@ -28,19 +28,19 @@ public class ItemBow extends Item {
EntityArrow entityarrow = new EntityArrow(world, entityhuman, f * 2.0F);
if (f == 1.0F) {
- entityarrow.d = true;
+ entityarrow.d(true);
}
int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack);
if (k > 0) {
- entityarrow.a(entityarrow.k() + (double) k * 0.5D + 0.5D);
+ entityarrow.b(entityarrow.d() + (double) k * 0.5D + 0.5D);
}
int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack);
if (l > 0) {
- entityarrow.b(l);
+ entityarrow.a(l);
}
if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) {
@@ -60,12 +60,13 @@ public class ItemBow extends Item {
// CraftBukkit end
itemstack.damage(1, entityhuman);
- world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (c.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
- if (!flag) {
- entityhuman.inventory.c(Item.ARROW.id);
+ world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (d.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
+ if (flag) {
+ entityarrow.fromPlayer = 2;
} else {
- entityarrow.fromPlayer = false;
+ entityhuman.inventory.d(Item.ARROW.id);
}
+ // CraftBukkit - moved addEntity up
}
}
@@ -73,23 +74,23 @@ public class ItemBow extends Item {
return itemstack;
}
- public int c(ItemStack itemstack) {
+ public int a(ItemStack itemstack) {
return 72000;
}
- public EnumAnimation d(ItemStack itemstack) {
+ public EnumAnimation b(ItemStack itemstack) {
return EnumAnimation.e;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.d(Item.ARROW.id)) {
- entityhuman.a(itemstack, this.c(itemstack));
+ if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.e(Item.ARROW.id)) {
+ entityhuman.a(itemstack, this.a(itemstack));
}
return itemstack;
}
- public int c() {
+ public int b() {
return 1;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index 2de28f5a..4d1e2fcc 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java
+++ b/src/main/java/net/minecraft/server/ItemBucket.java
@@ -15,6 +15,7 @@ public class ItemBucket extends Item {
super(i);
this.maxStackSize = 1;
this.a = j;
+ this.a(CreativeModeTab.f);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
@@ -38,7 +39,7 @@ public class ItemBucket extends Item {
}
if (this.a == 0) {
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return itemstack;
}
@@ -49,13 +50,22 @@ public class ItemBucket extends Item {
if (event.isCancelled()) {
return itemstack;
}
+ // CraftBukkit end
world.setTypeId(i, j, k, 0);
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
- // CraftBukkit end
- return CraftItemStack.createNMSItemStack(event.getItemStack()); // CraftBukkit
+ ItemStack result = CraftItemStack.createNMSItemStack(event.getItemStack()); // CraftBukkit - TODO: Check this stuff later... Not sure how this behavior should work
+ if (--itemstack.count <= 0) {
+ return result; // CraftBukkit
+ }
+
+ if (!entityhuman.inventory.pickup(result)) { // CraftBukkit
+ entityhuman.drop(CraftItemStack.createNMSItemStack(event.getItemStack())); // CraftBukkit
+ }
+
+ return itemstack;
}
if (world.getMaterial(i, j, k) == Material.LAVA && world.getData(i, j, k) == 0) {
@@ -65,13 +75,22 @@ public class ItemBucket extends Item {
if (event.isCancelled()) {
return itemstack;
}
+ // CraftBukkit end
world.setTypeId(i, j, k, 0);
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
- // CraftBukkit end
- return CraftItemStack.createNMSItemStack(event.getItemStack()); // CraftBukkit
+ ItemStack result = CraftItemStack.createNMSItemStack(event.getItemStack()); // CraftBukkit - TODO: Check this stuff later... Not sure how this behavior should work
+ if (--itemstack.count <= 0) {
+ return result; // CraftBukkit
+ }
+
+ if (!entityhuman.inventory.pickup(result)) { // CraftBukkit
+ entityhuman.drop(CraftItemStack.createNMSItemStack(event.getItemStack())); // CraftBukkit
+ }
+
+ return itemstack;
}
} else {
if (this.a < 0) {
@@ -112,11 +131,11 @@ public class ItemBucket extends Item {
++i;
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return itemstack;
}
- if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) {
+ if (this.a(world, d0, d1, d2, i, j, k) && !entityhuman.abilities.canInstantlyBuild) {
// CraftBukkit start
PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clickedX, clickedY, clickedZ, movingobjectposition.face, itemstack);
@@ -124,21 +143,7 @@ public class ItemBucket extends Item {
return itemstack;
}
// CraftBukkit end
-
- if (world.worldProvider.d && this.a == Block.WATER.id) {
- world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
-
- for (int l = 0; l < 8; ++l) {
- world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
- }
- } else {
- world.setTypeIdAndData(i, j, k, this.a, 0);
- }
-
- if (entityhuman.abilities.canInstantlyBuild) {
- return itemstack;
- }
-
+ // CraftBukkit TODO: look for all the stuff that disappeared here, and make sure this is still where it should be
// CraftBukkit start
return CraftItemStack.createNMSItemStack(event.getItemStack());
// CraftBukkit end
@@ -160,4 +165,24 @@ public class ItemBucket extends Item {
return itemstack;
}
}
+
+ public boolean a(World world, double d0, double d1, double d2, int i, int j, int k) {
+ if (this.a <= 0) {
+ return false;
+ } else if (!world.isEmpty(i, j, k) && world.getMaterial(i, j, k).isBuildable()) {
+ return false;
+ } else {
+ if (world.worldProvider.d && this.a == Block.WATER.id) {
+ world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
+
+ for (int l = 0; l < 8; ++l) {
+ world.a("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
+ }
+ } else {
+ world.setTypeIdAndData(i, j, k, this.a, 0);
+ }
+
+ return true;
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java
index 050388e5..ddc014c5 100644
--- a/src/main/java/net/minecraft/server/ItemDoor.java
+++ b/src/main/java/net/minecraft/server/ItemDoor.java
@@ -10,9 +10,10 @@ public class ItemDoor extends Item {
super(i);
this.a = material;
this.maxStackSize = 1;
+ this.a(CreativeModeTab.d);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ 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) {
return false;
} else {
@@ -25,7 +26,7 @@ public class ItemDoor extends Item {
block = Block.IRON_DOOR_BLOCK;
}
- if (entityhuman.d(i, j, k) && entityhuman.d(i, j + 1, k)) {
+ if (entityhuman.e(i, j, k) && entityhuman.e(i, j + 1, k)) {
if (!block.canPlace(world, i, j, k)) {
return false;
} else {
@@ -72,8 +73,8 @@ public class ItemDoor extends Item {
b0 = 1;
}
- int i1 = (world.e(i - b0, j, k - b1) ? 1 : 0) + (world.e(i - b0, j + 1, k - b1) ? 1 : 0);
- int j1 = (world.e(i + b0, j, k + b1) ? 1 : 0) + (world.e(i + b0, j + 1, k + b1) ? 1 : 0);
+ 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);
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 59a787ce..7ac00233 100644
--- a/src/main/java/net/minecraft/server/ItemDye.java
+++ b/src/main/java/net/minecraft/server/ItemDye.java
@@ -14,21 +14,24 @@ public class ItemDye extends Item {
super(i);
this.a(true);
this.setMaxDurability(0);
+ this.a(CreativeModeTab.l);
}
- public String a(ItemStack itemstack) {
+ public String c(ItemStack itemstack) {
int i = MathHelper.a(itemstack.getData(), 0, 15);
return super.getName() + "." + a[i];
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
- if (!entityhuman.d(i, j, k)) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else {
- if (itemstack.getData() == 15) {
- int i1 = world.getTypeId(i, j, k);
+ int i1;
+ int j1;
+ if (itemstack.getData() == 15) {
+ i1 = world.getTypeId(i, j, k);
if (i1 == Block.SAPLING.id) {
if (!world.isStatic) {
// CraftBukkit start
@@ -54,8 +57,12 @@ public class ItemDye extends Item {
}
if (i1 == Block.MELON_STEM.id || i1 == Block.PUMPKIN_STEM.id) {
+ if (world.getData(i, j, k) == 7) {
+ return false;
+ }
+
if (!world.isStatic) {
- ((BlockStem) Block.byId[i1]).g(world, i, j, k);
+ ((BlockStem) Block.byId[i1]).l(world, i, j, k);
--itemstack.count;
}
@@ -63,8 +70,21 @@ public class ItemDye extends Item {
}
if (i1 == Block.CROPS.id) {
+ if (world.getData(i, j, k) == 7) {
+ return false;
+ }
+
+ if (!world.isStatic) {
+ ((BlockCrops) Block.CROPS).c_(world, i, j, k);
+ --itemstack.count;
+ }
+
+ return true;
+ }
+
+ if (i1 == Block.COCOA.id) {
if (!world.isStatic) {
- ((BlockCrops) Block.CROPS).g(world, i, j, k);
+ world.setData(i, j, k, 8 | BlockDirectional.d(world.getData(i, j, k)));
--itemstack.count;
}
@@ -75,27 +95,31 @@ public class ItemDye extends Item {
if (!world.isStatic) {
--itemstack.count;
- label73:
- for (int j1 = 0; j1 < 128; ++j1) {
+ label135:
+ for (j1 = 0; j1 < 128; ++j1) {
int k1 = i;
int l1 = j + 1;
int i2 = k;
for (int j2 = 0; j2 < j1 / 16; ++j2) {
- k1 += c.nextInt(3) - 1;
- l1 += (c.nextInt(3) - 1) * c.nextInt(3) / 2;
- i2 += c.nextInt(3) - 1;
- if (world.getTypeId(k1, l1 - 1, i2) != Block.GRASS.id || world.e(k1, l1, i2)) {
- continue label73;
+ 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 label135;
}
}
if (world.getTypeId(k1, l1, i2) == 0) {
- if (c.nextInt(10) != 0) {
- world.setTypeIdAndData(k1, l1, i2, Block.LONG_GRASS.id, 1);
- } else if (c.nextInt(3) != 0) {
- world.setTypeId(k1, l1, i2, Block.YELLOW_FLOWER.id);
- } else {
+ if (d.nextInt(10) != 0) {
+ if (Block.LONG_GRASS.d(world, k1, l1, i2)) {
+ world.setTypeIdAndData(k1, l1, i2, Block.LONG_GRASS.id, 1);
+ }
+ } else if (d.nextInt(3) != 0) {
+ if (Block.YELLOW_FLOWER.d(world, k1, l1, i2)) {
+ world.setTypeId(k1, l1, i2, Block.YELLOW_FLOWER.id);
+ }
+ } else if (Block.RED_ROSE.d(world, k1, l1, i2)) {
world.setTypeId(k1, l1, i2, Block.RED_ROSE.id);
}
}
@@ -104,25 +128,66 @@ public class ItemDye extends Item {
return true;
}
+ } else if (itemstack.getData() == 3) {
+ i1 = world.getTypeId(i, j, k);
+ j1 = world.getData(i, j, k);
+ if (i1 == Block.LOG.id && BlockLog.e(j1) == 3) {
+ if (l == 0) {
+ return false;
+ }
+
+ if (l == 1) {
+ return false;
+ }
+
+ if (l == 2) {
+ --k;
+ }
+
+ if (l == 3) {
+ ++k;
+ }
+
+ if (l == 4) {
+ --i;
+ }
+
+ if (l == 5) {
+ ++i;
+ }
+
+ 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);
+ }
+
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ }
+ }
+
+ return true;
+ }
}
return false;
}
}
- public void a(ItemStack itemstack, EntityLiving entityliving) {
+ public boolean a(ItemStack itemstack, EntityLiving entityliving) {
if (entityliving instanceof EntitySheep) {
EntitySheep entitysheep = (EntitySheep) entityliving;
- int i = BlockCloth.d(itemstack.getData());
+ int i = BlockCloth.e_(itemstack.getData());
if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
// CraftBukkit start
- byte bColor = new Integer(i).byteValue();
+ byte bColor = (byte) i;
SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
entitysheep.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
- return;
+ return false;
}
i = (byte) event.getColor().getData();
@@ -131,6 +196,10 @@ public class ItemDye extends Item {
entitysheep.setColor(i);
--itemstack.count;
}
+
+ return true;
+ } else {
+ return false;
}
}
}
diff --git a/src/main/java/net/minecraft/server/ItemFireball.java b/src/main/java/net/minecraft/server/ItemFireball.java
index 3f01d931..8719b443 100644
--- a/src/main/java/net/minecraft/server/ItemFireball.java
+++ b/src/main/java/net/minecraft/server/ItemFireball.java
@@ -9,9 +9,10 @@ public class ItemFireball extends Item {
public ItemFireball(int i) {
super(i);
+ this.a(CreativeModeTab.f);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
} else {
@@ -39,7 +40,7 @@ public class ItemFireball extends Item {
++i;
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else {
int i1 = world.getTypeId(i, j, k);
@@ -60,7 +61,7 @@ public class ItemFireball extends Item {
}
// CraftBukkit end
- world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, c.nextFloat() * 0.4F + 0.8F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, d.nextFloat() * 0.4F + 0.8F);
world.setTypeId(i, j, k, Block.FIRE.id);
}
diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java
index aca1c54d..5d5bba35 100644
--- a/src/main/java/net/minecraft/server/ItemFishingRod.java
+++ b/src/main/java/net/minecraft/server/ItemFishingRod.java
@@ -7,15 +7,16 @@ public class ItemFishingRod extends Item {
public ItemFishingRod(int i) {
super(i);
this.setMaxDurability(64);
- this.e(1);
+ this.d(1);
+ this.a(CreativeModeTab.i);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.hookedFish != null) {
- int i = entityhuman.hookedFish.k();
+ int i = entityhuman.hookedFish.d();
itemstack.damage(i, entityhuman);
- entityhuman.C_();
+ entityhuman.i();
} else {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
@@ -26,12 +27,12 @@ public class ItemFishingRod extends Item {
}
// CraftBukkit end
- world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (c.nextFloat() * 0.4F + 0.8F));
+ world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (d.nextFloat() * 0.4F + 0.8F));
if (!world.isStatic) {
world.addEntity(new EntityFishingHook(world, entityhuman));
}
- entityhuman.C_();
+ entityhuman.i();
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
index 13e80416..385a88ad 100644
--- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
@@ -12,9 +12,10 @@ public class ItemFlintAndSteel extends Item {
super(i);
this.maxStackSize = 1;
this.setMaxDurability(64);
+ this.a(CreativeModeTab.i);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (l == 0) {
@@ -41,7 +42,7 @@ public class ItemFlintAndSteel extends Item {
++i;
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else {
int i1 = world.getTypeId(i, j, k);
@@ -62,7 +63,7 @@ public class ItemFlintAndSteel extends Item {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
// CraftBukkit end
- world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, c.nextFloat() * 0.4F + 0.8F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, d.nextFloat() * 0.4F + 0.8F);
world.setTypeId(i, j, k, Block.FIRE.id);
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java
index 28d1d630..287ce36f 100644
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ b/src/main/java/net/minecraft/server/ItemFood.java
@@ -4,20 +4,21 @@ public class ItemFood extends Item {
public final int a;
private final int b;
- private final float bU;
- private final boolean bV;
- private boolean bW;
- private int bX;
- private int bY;
- private int bZ;
- private float ca;
+ private final float c;
+ private final boolean bY;
+ private boolean bZ;
+ private int ca;
+ private int cb;
+ private int cc;
+ private float cd;
public ItemFood(int i, int j, float f, boolean flag) {
super(i);
this.a = 32;
this.b = j;
- this.bV = flag;
- this.bU = f;
+ this.bY = flag;
+ this.c = f;
+ this.a(CreativeModeTab.h);
}
public ItemFood(int i, int j, boolean flag) {
@@ -37,24 +38,27 @@ public class ItemFood extends Item {
// CraftBukkit end
world.makeSound(entityhuman, "random.burp", 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
- if (!world.isStatic && this.bX > 0 && world.random.nextFloat() < this.ca) {
- entityhuman.addEffect(new MobEffect(this.bX, this.bY * 20, this.bZ));
- }
-
+ this.c(itemstack, world, entityhuman);
return itemstack;
}
- public int c(ItemStack itemstack) {
+ protected void c(ItemStack itemstack, World world, EntityHuman entityhuman) {
+ if (!world.isStatic && this.ca > 0 && world.random.nextFloat() < this.cd) {
+ entityhuman.addEffect(new MobEffect(this.ca, this.cb * 20, this.cc));
+ }
+ }
+
+ public int a(ItemStack itemstack) {
return 32;
}
- public EnumAnimation d(ItemStack itemstack) {
+ public EnumAnimation b(ItemStack itemstack) {
return EnumAnimation.b;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (entityhuman.b(this.bW)) {
- entityhuman.a(itemstack, this.c(itemstack));
+ if (entityhuman.e(this.bZ)) {
+ entityhuman.a(itemstack, this.a(itemstack));
}
return itemstack;
@@ -65,27 +69,23 @@ public class ItemFood extends Item {
}
public float getSaturationModifier() {
- return this.bU;
+ return this.c;
}
- public boolean q() {
- return this.bV;
+ public boolean h() {
+ return this.bY;
}
public ItemFood a(int i, int j, int k, float f) {
- this.bX = i;
- this.bY = j;
- this.bZ = k;
- this.ca = f;
+ this.ca = i;
+ this.cb = j;
+ this.cc = k;
+ this.cd = f;
return this;
}
- public ItemFood r() {
- this.bW = true;
+ public ItemFood i() {
+ this.bZ = true;
return this;
}
-
- public Item a(String s) {
- return super.a(s);
- }
}
diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java
index 839911d9..bad137e3 100644
--- a/src/main/java/net/minecraft/server/ItemHoe.java
+++ b/src/main/java/net/minecraft/server/ItemHoe.java
@@ -4,14 +4,18 @@ import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit
public class ItemHoe extends Item {
+ protected EnumToolMaterial a;
+
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
super(i);
+ this.a = enumtoolmaterial;
this.maxStackSize = 1;
this.setMaxDurability(enumtoolmaterial.a());
+ this.a(CreativeModeTab.i);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
- if (!entityhuman.d(i, j, k)) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else {
int i1 = world.getTypeId(i, j, k);
@@ -45,4 +49,8 @@ public class ItemHoe extends Item {
}
}
}
+
+ public String f() {
+ return this.a.toString();
+ }
}
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java
index bd41a1f3..e163a2c0 100644
--- a/src/main/java/net/minecraft/server/ItemInWorldManager.java
+++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java
@@ -11,9 +11,9 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class ItemInWorldManager {
public World world;
- public EntityHuman player;
- private int c = -1;
- private float d = 0.0F;
+ public EntityPlayer player;
+ private EnumGamemode gamemode;
+ private boolean d;
private int lastDigTick;
private int f;
private int g;
@@ -24,65 +24,86 @@ public class ItemInWorldManager {
private int l;
private int m;
private int n;
+ private int o;
public ItemInWorldManager(World world) {
+ this.gamemode = EnumGamemode.NONE;
+ this.o = -1;
this.world = world;
}
// CraftBukkit start - keep this for backwards compatibility
public ItemInWorldManager(WorldServer world) {
- this.world = world;
+ this((World) world);
}
// CraftBukkit end
- public void setGameMode(int i) {
- this.c = i;
- if (i == 0) {
- this.player.abilities.canFly = false;
- this.player.abilities.isFlying = false;
- this.player.abilities.canInstantlyBuild = false;
- this.player.abilities.isInvulnerable = false;
- } else {
- this.player.abilities.canFly = true;
- this.player.abilities.canInstantlyBuild = true;
- this.player.abilities.isInvulnerable = true;
- }
-
+ public void setGameMode(EnumGamemode enumgamemode) {
+ this.gamemode = enumgamemode;
+ enumgamemode.a(this.player.abilities);
this.player.updateAbilities();
}
- public int getGameMode() {
- return this.c;
+ public EnumGamemode getGameMode() {
+ return this.gamemode;
}
public boolean isCreative() {
- return this.c == 1;
+ return this.gamemode.d();
}
- public void b(int i) {
- if (this.c == -1) {
- this.c = i;
+ public void b(EnumGamemode enumgamemode) {
+ if (this.gamemode == EnumGamemode.NONE) {
+ this.gamemode = enumgamemode;
}
- this.setGameMode(this.c);
+ this.setGameMode(this.gamemode);
}
- public void c() {
+ public void a() {
this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
+ int i;
+ float f;
+ int j;
+
if (this.j) {
- int i = this.currentTick - this.n;
- int j = this.world.getTypeId(this.k, this.l, this.m);
+ i = this.currentTick - this.n;
+ int k = this.world.getTypeId(this.k, this.l, this.m);
- if (j != 0) {
- Block block = Block.byId[j];
- float f = block.getDamage(this.player) * (float) (i + 1);
+ if (k == 0) {
+ this.j = false;
+ } else {
+ Block block = Block.byId[k];
+
+ f = block.getDamage(this.player, this.player.world, this.k, this.l, this.m) * (float) (i + 1);
+ j = (int) (f * 10.0F);
+ if (j != this.o) {
+ this.world.f(this.player.id, this.k, this.l, this.m, j);
+ this.o = j;
+ }
if (f >= 1.0F) {
this.j = false;
this.breakBlock(this.k, this.l, this.m);
}
+ }
+ } else if (this.d) {
+ i = this.world.getTypeId(this.f, this.g, this.h);
+ Block block1 = Block.byId[i];
+
+ if (block1 == null) {
+ this.world.f(this.player.id, this.f, this.g, this.h, -1);
+ this.o = -1;
+ this.d = false;
} else {
- this.j = false;
+ int l = this.currentTick - this.lastDigTick;
+
+ f = block1.getDamage(this.player, this.player.world, this.f, this.g, this.h) * (float) (l + 1);
+ j = (int) (f * 10.0F);
+ if (j != this.o) {
+ this.world.f(this.player.id, this.f, this.g, this.h, j);
+ this.o = j;
+ }
}
}
}
@@ -92,7 +113,7 @@ public class ItemInWorldManager {
// CraftBukkit
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
- if (this.isCreative()) {
+ if (!this.gamemode.isAdventure()) {
// CraftBukkit start
if (event.isCancelled()) {
// Let the client know the block still exists
@@ -100,62 +121,70 @@ public class ItemInWorldManager {
return;
}
// CraftBukkit end
- if (!this.world.douseFire((EntityHuman) null, i, j, k, l)) {
- this.breakBlock(i, j, k);
- }
- } else {
- this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
- int i1 = this.world.getTypeId(i, j, k);
+ if (this.isCreative()) {
+ if (!this.world.douseFire((EntityHuman) null, i, j, k, l)) {
+ this.breakBlock(i, j, k);
+ }
+ } else {
+ this.world.douseFire(this.player, i, j, k, l);
+ this.lastDigTick = this.currentTick;
+ float f = 1.0F;
+ int i1 = this.world.getTypeId(i, j, k);
+ // CraftBukkit start - Swings at air do *NOT* exist.
+ if (i1 <= 0) {
+ return;
+ }
- // CraftBukkit start - Swings at air do *NOT* exist.
- if (i1 <= 0) {
- return;
- }
+ if (event.useInteractedBlock() == Event.Result.DENY) {
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
+ if (i1 == Block.WOODEN_DOOR.id) {
+ // For some reason *BOTH* the bottom/top part have to be marked updated.
+ boolean bottom = (this.world.getData(i, j, k) & 8) == 0;
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
+ } else if (i1 == Block.TRAP_DOOR.id) {
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ }
+ } else {
+ Block.byId[i1].attack(this.world, i, j, k, this.player);
+ // Allow fire punching to be blocked
+ this.world.douseFire((EntityHuman) null, i, j, k, l);
+ }
- if (event.useInteractedBlock() == Event.Result.DENY) {
- // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
- if (i1 == Block.WOODEN_DOOR.id) {
- // For some reason *BOTH* the bottom/top part have to be marked updated.
- boolean bottom = (this.world.getData(i, j, k) & 8) == 0;
- ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
- ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
- } else if (i1 == Block.TRAP_DOOR.id) {
- ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ // Handle hitting a block
+ float toolDamage = Block.byId[i1].getDamage(this.player, this.world, i, j, k);
+ if (event.useItemInHand() == Event.Result.DENY) {
+ // If we 'insta destroyed' then the client needs to be informed.
+ if (toolDamage > 1.0f) {
+ ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ }
+ return;
}
- } else {
- Block.byId[i1].attack(this.world, i, j, k, this.player);
- // Allow fire punching to be blocked
- this.world.douseFire((EntityHuman) null, i, j, k, l);
- }
+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, i, j, k, this.player.inventory.getItemInHand(), toolDamage >= 1.0f);
- // Handle hitting a block
- float toolDamage = Block.byId[i1].getDamage(this.player);
- if (event.useItemInHand() == Event.Result.DENY) {
- // If we 'insta destroyed' then the client needs to be informed.
- if (toolDamage > 1.0f) {
+ if (blockEvent.isCancelled()) {
+ // Let the client know the block still exists
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ return;
}
- return;
- }
- org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, i, j, k, this.player.inventory.getItemInHand(), toolDamage >= 1.0f);
-
- if (blockEvent.isCancelled()) {
- // Let the client know the block still exists
- ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
- return;
- }
- if (blockEvent.getInstaBreak()) {
- toolDamage = 2.0f;
- }
+ if (blockEvent.getInstaBreak()) {
+ toolDamage = 2.0f;
+ }
- if (toolDamage >= 1.0F) {
- // CraftBukkit end
- this.breakBlock(i, j, k);
- } else {
- this.f = i;
- this.g = j;
- this.h = k;
+ if (toolDamage >= 1.0F) {
+ // CraftBukkit end
+ this.breakBlock(i, j, k);
+ } else {
+ this.d = true;
+ this.f = i;
+ this.g = j;
+ this.h = k;
+ int j1 = (int) (f * 10.0F);
+
+ this.world.f(this.player.id, i, j, k, j1);
+ this.o = j1;
+ }
}
}
}
@@ -168,11 +197,14 @@ public class ItemInWorldManager {
if (i1 != 0) {
Block block = Block.byId[i1];
- float f = block.getDamage(this.player) * (float) (l + 1);
+ float f = block.getDamage(this.player, this.player.world, i, j, k) * (float) (l + 1);
if (f >= 0.7F) {
+ this.d = false;
+ this.world.f(this.player.id, i, j, k, -1);
this.breakBlock(i, j, k);
} else if (!this.j) {
+ this.d = false;
this.j = true;
this.k = i;
this.l = j;
@@ -185,13 +217,21 @@ public class ItemInWorldManager {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
// CraftBukkit end
}
+ }
- this.d = 0.0F;
+ public void c(int i, int j, int k) {
+ this.d = false;
+ this.world.f(this.player.id, this.f, this.g, this.h, -1);
}
- public boolean b(int i, int j, int k) {
+ private boolean d(int i, int j, int k) {
Block block = Block.byId[this.world.getTypeId(i, j, k)];
int l = this.world.getData(i, j, k);
+
+ if (block != null) {
+ block.a(this.world, i, j, k, l, this.player);
+ }
+
boolean flag = this.world.setTypeId(i, j, k, 0);
if (block != null && flag) {
@@ -216,6 +256,7 @@ public class ItemInWorldManager {
}
BlockBreakEvent event = new BlockBreakEvent(block, (org.bukkit.entity.Player) this.player.getBukkitEntity());
+ event.setCancelled(this.gamemode.isAdventure()); // Adventure mode pre-cancel
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -224,34 +265,37 @@ public class ItemInWorldManager {
return false;
}
}
- // CraftBukkit end
- int l = this.world.getTypeId(i, j, k);
- int i1 = this.world.getData(i, j, k);
+ if (false) { // Never trigger
+ // CraftBukkit end
+ return false;
+ } else {
+ int l = this.world.getTypeId(i, j, k);
+ int i1 = this.world.getData(i, j, k);
- this.world.a(this.player, 2001, i, j, k, l + (this.world.getData(i, j, k) << 12));
- boolean flag = this.b(i, j, k);
+ this.world.a(this.player, 2001, i, j, k, l + (this.world.getData(i, j, k) << 12));
+ boolean flag = this.d(i, j, k);
- if (this.isCreative()) {
- ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
- } else {
- ItemStack itemstack = this.player.U();
- boolean flag1 = this.player.b(Block.byId[l]);
-
- if (itemstack != null) {
- itemstack.a(l, i, j, k, this.player);
- if (itemstack.count == 0) {
- itemstack.a(this.player);
- this.player.V();
+ if (this.isCreative()) {
+ this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ } else {
+ ItemStack itemstack = this.player.bC();
+ 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.bD();
+ }
}
- }
- if (flag && flag1) {
- Block.byId[l].a(this.world, this.player, i, j, k, i1);
+ if (flag && flag1) {
+ Block.byId[l].a(this.world, this.player, i, j, k, i1);
+ }
}
- }
- return flag;
+ return flag;
+ }
}
public boolean useItem(EntityHuman entityhuman, World world, ItemStack itemstack) {
@@ -259,7 +303,7 @@ public class ItemInWorldManager {
int j = itemstack.getData();
ItemStack itemstack1 = itemstack.a(world, entityhuman);
- if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i) && (itemstack1 == null || itemstack1.l() <= 0)) {
+ if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i) && (itemstack1 == null || itemstack1.m() <= 0)) {
return false;
} else {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1;
@@ -277,7 +321,7 @@ 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) {
+ 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);
// CraftBukkit start - Interact
@@ -292,14 +336,14 @@ public class ItemInWorldManager {
}
result = (event.useItemInHand() != Event.Result.ALLOW);
} else {
- result = Block.byId[i1].interact(world, i, j, k, entityhuman);
+ result = Block.byId[i1].interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
if (itemstack != null && !result) {
int j1 = itemstack.getData();
int k1 = itemstack.count;
- result = itemstack.placeItem(entityhuman, world, i, j, k, l);
+ result = itemstack.placeItem(entityhuman, world, i, j, k, l, f, f1, f2);
// The item count should not decrement in Creative mode.
if (this.isCreative()) {
diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java
index 2a86b00d..a0c1d88d 100644
--- a/src/main/java/net/minecraft/server/ItemMinecart.java
+++ b/src/main/java/net/minecraft/server/ItemMinecart.java
@@ -8,9 +8,10 @@ public class ItemMinecart extends Item {
super(i);
this.maxStackSize = 1;
this.a = j;
+ this.a(CreativeModeTab.e);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int i1 = world.getTypeId(i, j, k);
if (BlockMinecartTrack.d(i1)) {
diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index 93cfe76c..7302e072 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -5,9 +5,10 @@ public class ItemMonsterEgg extends Item {
public ItemMonsterEgg(int i) {
super(i);
this.a(true);
+ this.a(CreativeModeTab.f);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63) { // CraftBukkit
return true;
} else {
@@ -38,8 +39,16 @@ public class ItemMonsterEgg extends Item {
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
entity.setPositionRotation(d0, d1, d2, world.random.nextFloat() * 360.0F, 0.0F);
+ if (entity instanceof EntityVillager) {
+ EntityVillager entityvillager = (EntityVillager) entity;
+
+ entityvillager.setProfession(entityvillager.au().nextInt(5));
+ world.addEntity(entityvillager);
+ return true;
+ }
+
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
- ((EntityLiving) entity).az();
+ ((EntityLiving) entity).aH();
}
return entity != null;
diff --git a/src/main/java/net/minecraft/server/ItemPainting.java b/src/main/java/net/minecraft/server/ItemPainting.java
index 085286cf..46b7ac7c 100644
--- a/src/main/java/net/minecraft/server/ItemPainting.java
+++ b/src/main/java/net/minecraft/server/ItemPainting.java
@@ -9,9 +9,10 @@ public class ItemPainting extends Item {
public ItemPainting(int i) {
super(i);
+ this.a(CreativeModeTab.c);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ 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 == 0) {
return false;
} else if (l == 1) {
@@ -31,7 +32,7 @@ public class ItemPainting extends Item {
b0 = 3;
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else {
EntityPainting entitypainting = new EntityPainting(world, i, j, k, b0);
diff --git a/src/main/java/net/minecraft/server/ItemRedstone.java b/src/main/java/net/minecraft/server/ItemRedstone.java
index 38f205da..c0df7cd8 100644
--- a/src/main/java/net/minecraft/server/ItemRedstone.java
+++ b/src/main/java/net/minecraft/server/ItemRedstone.java
@@ -6,9 +6,10 @@ public class ItemRedstone extends Item {
public ItemRedstone(int i) {
super(i);
+ this.a(CreativeModeTab.d);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (world.getTypeId(i, j, k) != Block.SNOW.id) {
@@ -41,7 +42,7 @@ public class ItemRedstone extends Item {
}
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else {
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
diff --git a/src/main/java/net/minecraft/server/ItemReed.java b/src/main/java/net/minecraft/server/ItemReed.java
index b272261f..896f5121 100644
--- a/src/main/java/net/minecraft/server/ItemReed.java
+++ b/src/main/java/net/minecraft/server/ItemReed.java
@@ -11,7 +11,7 @@ public class ItemReed extends Item {
this.id = block.id;
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k);
@@ -43,17 +43,17 @@ public class ItemReed extends Item {
}
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else if (itemstack.count == 0) {
return false;
} else {
- if (world.mayPlace(this.id, i, j, k, false, l)) {
+ if (world.mayPlace(this.id, i, j, k, false, l, (Entity) null)) {
Block block = Block.byId[this.id];
// CraftBukkit start - This executes the placement of the block
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
- /**
+ /*
* @see net.minecraft.server.World#setTypeId(int i, int j, int k, int l)
*
* This replaces world.setTypeId(IIII), we're doing this because we need to
@@ -77,7 +77,7 @@ 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);
+ Block.byId[this.id].postPlace(world, i, j, k, l, f, f1, f2);
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
}
diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java
index ca023859..82e6cf4e 100644
--- a/src/main/java/net/minecraft/server/ItemSeeds.java
+++ b/src/main/java/net/minecraft/server/ItemSeeds.java
@@ -11,12 +11,13 @@ public class ItemSeeds extends Item {
super(i);
this.id = j;
this.b = k;
+ this.a(CreativeModeTab.l);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ 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) {
return false;
- } else if (entityhuman.d(i, j, k) && entityhuman.d(i, j + 1, k)) {
+ } else if (entityhuman.e(i, j, k) && entityhuman.e(i, j + 1, k)) {
int i1 = world.getTypeId(i, j, k);
if (i1 == this.b && world.isEmpty(i, j + 1, k)) {
diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java
index 5a63dc27..c195a85f 100644
--- a/src/main/java/net/minecraft/server/ItemSign.java
+++ b/src/main/java/net/minecraft/server/ItemSign.java
@@ -6,10 +6,11 @@ public class ItemSign extends Item {
public ItemSign(int i) {
super(i);
- this.maxStackSize = 1;
+ this.maxStackSize = 16;
+ this.a(CreativeModeTab.c);
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ 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 == 0) {
return false;
} else if (!world.getMaterial(i, j, k).isBuildable()) {
@@ -37,7 +38,7 @@ public class ItemSign extends Item {
++i;
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return false;
} else if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
return false;
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index a444c713..efe82d34 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -49,6 +49,7 @@ public final class ItemStack {
}
this.tag.set("ench", enchantments.clone()); // modify this part to use passed in enchantments list
+ // TODO Books
}
}
// CraftBukkit end
@@ -79,8 +80,8 @@ public final class ItemStack {
return Item.byId[this.id];
}
- public boolean placeItem(EntityHuman entityhuman, World world, int i, int j, int k, int l) {
- boolean flag = this.getItem().interactWith(this, entityhuman, world, i, j, k, l);
+ public boolean placeItem(EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ boolean flag = this.getItem().interactWith(this, entityhuman, world, i, j, k, l, f, f1, f2);
if (flag) {
entityhuman.a(StatisticList.E[this.id], 1);
@@ -126,22 +127,22 @@ public final class ItemStack {
}
public boolean isStackable() {
- return this.getMaxStackSize() > 1 && (!this.d() || !this.f());
+ return this.getMaxStackSize() > 1 && (!this.f() || !this.h());
}
- public boolean d() {
+ public boolean f() {
return Item.byId[this.id].getMaxDurability() > 0;
}
public boolean usesData() {
- return Item.byId[this.id].e();
+ return Item.byId[this.id].k();
}
- public boolean f() {
- return this.d() && this.damage > 0;
+ public boolean h() {
+ return this.f() && this.damage > 0;
}
- public int g() {
+ public int i() {
return this.damage;
}
@@ -153,12 +154,12 @@ public final class ItemStack {
this.damage = (this.id > 0) && (this.id < 256) ? Item.byId[this.id].filterData(i) : i; // CraftBukkit
}
- public int i() {
+ public int k() {
return Item.byId[this.id].getMaxDurability();
}
public void damage(int i, EntityLiving entityliving) {
- if (this.d()) {
+ if (this.f()) {
if (i > 0 && entityliving instanceof EntityHuman) {
int j = EnchantmentManager.getDurabilityEnchantmentLevel(((EntityHuman) entityliving).inventory);
@@ -167,9 +168,12 @@ public final class ItemStack {
}
}
- this.damage += i;
- if (this.damage > this.i()) {
- entityliving.c(this);
+ if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
+ this.damage += i;
+ }
+
+ if (this.damage > this.k()) {
+ entityliving.a(this);
if (entityliving instanceof EntityHuman) {
((EntityHuman) entityliving).a(StatisticList.F[this.id], 1);
}
@@ -198,8 +202,8 @@ public final class ItemStack {
}
}
- public void a(int i, int j, int k, int l, EntityHuman entityhuman) {
- boolean flag = Item.byId[this.id].a(this, i, j, k, l, entityhuman);
+ public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
+ boolean flag = Item.byId[this.id].a(this, world, i, j, k, l, entityhuman);
if (flag) {
entityhuman.a(StatisticList.E[this.id], 1);
@@ -214,10 +218,8 @@ public final class ItemStack {
return Item.byId[this.id].canDestroySpecialBlock(block);
}
- public void a(EntityHuman entityhuman) {}
-
- public void a(EntityLiving entityliving) {
- Item.byId[this.id].a(this, entityliving);
+ public boolean a(EntityLiving entityliving) {
+ return Item.byId[this.id].a(this, entityliving);
}
public ItemStack cloneItemStack() {
@@ -225,9 +227,6 @@ public final class ItemStack {
if (this.tag != null) {
itemstack.tag = (NBTTagCompound) this.tag.clone();
- if (!itemstack.tag.equals(this.tag)) {
- return itemstack;
- }
}
return itemstack;
@@ -249,8 +248,8 @@ public final class ItemStack {
return this.id == itemstack.id && this.damage == itemstack.damage;
}
- public String k() {
- return Item.byId[this.id].a(this);
+ public String a() {
+ return Item.byId[this.id].c(this);
}
public static ItemStack b(ItemStack itemstack) {
@@ -278,12 +277,12 @@ public final class ItemStack {
return this.id == itemstack.id && this.count == itemstack.count && this.damage == itemstack.damage;
}
- public int l() {
- return this.getItem().c(this);
+ public int m() {
+ return this.getItem().a(this);
}
- public EnumAnimation m() {
- return this.getItem().d(this);
+ public EnumAnimation n() {
+ return this.getItem().b(this);
}
public void b(World world, EntityHuman entityhuman, int i) {
@@ -306,8 +305,8 @@ public final class ItemStack {
this.tag = nbttagcompound;
}
- public boolean q() {
- return !this.getItem().f(this) ? false : !this.hasEnchantments();
+ public boolean u() {
+ return !this.getItem().k(this) ? false : !this.hasEnchantments();
}
public void addEnchantment(Enchantment enchantment, int i) {
diff --git a/src/main/java/net/minecraft/server/ItemStep.java b/src/main/java/net/minecraft/server/ItemStep.java
index b1bf231c..5da4a455 100644
--- a/src/main/java/net/minecraft/server/ItemStep.java
+++ b/src/main/java/net/minecraft/server/ItemStep.java
@@ -2,8 +2,15 @@ package net.minecraft.server;
public class ItemStep extends ItemBlock {
- public ItemStep(int i) {
+ private final boolean a;
+ private final BlockStepAbstract b;
+ private final BlockStepAbstract c;
+
+ public ItemStep(int i, BlockStepAbstract blockstepabstract, BlockStepAbstract blockstepabstract1, boolean flag) {
super(i);
+ this.b = blockstepabstract;
+ this.c = blockstepabstract1;
+ this.a = flag;
this.setMaxDurability(0);
this.a(true);
}
@@ -12,20 +19,16 @@ public class ItemStep extends ItemBlock {
return i;
}
- public String a(ItemStack itemstack) {
- int i = itemstack.getData();
-
- if (i < 0 || i >= BlockStep.a.length) {
- i = 0;
- }
-
- return super.getName() + "." + BlockStep.a[i];
+ public String c(ItemStack itemstack) {
+ return this.b.d(itemstack.getData());
}
- public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
- if (itemstack.count == 0) {
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ if (this.a) {
+ return super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2);
+ } else if (itemstack.count == 0) {
return false;
- } else if (!entityhuman.d(i, j, k)) {
+ } else if (!entityhuman.e(i, j, k)) {
return false;
} else {
int i1 = world.getTypeId(i, j, k);
@@ -33,15 +36,15 @@ public class ItemStep extends ItemBlock {
int k1 = j1 & 7;
boolean flag = (j1 & 8) != 0;
- if ((l == 1 && !flag || l == 0 && flag) && i1 == Block.STEP.id && k1 == itemstack.getData()) {
- return super.interactWith(itemstack, entityhuman, world, i, j, k, -1); // CraftBukkit - handle this in super
+ if ((l == 1 && !flag || l == 0 && flag) && i1 == this.b.id && k1 == itemstack.getData()) {
+ return super.interactWith(itemstack, entityhuman, world, i, j, k, -1, f, f1, f2); // CraftBukkit - handle this in super
} else {
- return b(itemstack, entityhuman, world, i, j, k, l) ? true : super.interactWith(itemstack, entityhuman, world, i, j, k, l);
+ return this.a(itemstack, entityhuman, world, i, j, k, l) ? true : super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2);
}
}
}
- private static boolean b(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
+ private boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l == 0) {
--j;
}
@@ -70,9 +73,9 @@ public class ItemStep extends ItemBlock {
int j1 = world.getData(i, j, k);
int k1 = j1 & 7;
- if (i1 == Block.STEP.id && k1 == itemstack.getData()) {
- if (world.containsEntity(Block.DOUBLE_STEP.e(world, i, j, k)) && world.setTypeIdAndData(i, j, k, Block.DOUBLE_STEP.id, k1)) {
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), Block.DOUBLE_STEP.stepSound.getName(), (Block.DOUBLE_STEP.stepSound.getVolume1() + 1.0F) / 2.0F, Block.DOUBLE_STEP.stepSound.getVolume2() * 0.8F);
+ 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);
--itemstack.count;
}
diff --git a/src/main/java/net/minecraft/server/ItemWaterLily.java b/src/main/java/net/minecraft/server/ItemWaterLily.java
index 05910a54..5532bc2e 100644
--- a/src/main/java/net/minecraft/server/ItemWaterLily.java
+++ b/src/main/java/net/minecraft/server/ItemWaterLily.java
@@ -2,7 +2,7 @@ package net.minecraft.server;
import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit
-public class ItemWaterLily extends ItemColoredBlock {
+public class ItemWaterLily extends ItemWithAuxData {
public ItemWaterLily(int i) {
super(i, false);
@@ -23,7 +23,7 @@ public class ItemWaterLily extends ItemColoredBlock {
return itemstack;
}
- if (!entityhuman.d(i, j, k)) {
+ if (!entityhuman.e(i, j, k)) {
return itemstack;
}
diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java
index 0e6cc64a..7c1f926d 100644
--- a/src/main/java/net/minecraft/server/ItemWorldMap.java
+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java
@@ -9,7 +9,8 @@ public class ItemWorldMap extends ItemWorldMapBase {
protected ItemWorldMap(int i) {
super(i);
- this.e(1);
+ this.d(1);
+ this.a(CreativeModeTab.f);
}
public WorldMap getSavedMap(ItemStack itemstack, World world) {
@@ -52,10 +53,10 @@ public class ItemWorldMap extends ItemWorldMapBase {
j1 /= 2;
}
- ++worldmap.g;
+ ++worldmap.f;
for (int k1 = l - j1 + 1; k1 < l + j1; ++k1) {
- if ((k1 & 15) == (worldmap.g & 15)) {
+ if ((k1 & 15) == (worldmap.f & 15)) {
int l1 = 255;
int i2 = 0;
double d0 = 0.0D;
@@ -72,130 +73,135 @@ public class ItemWorldMap extends ItemWorldMapBase {
byte b2 = 0;
int[] aint = new int[256];
Chunk chunk = world.getChunkAtWorldCoords(i3, j3);
- if (chunk.isEmpty()) continue; // CraftBukkit - fixes maps erasing themselves on low chunk visibility.
- int k3 = i3 & 15;
- int l3 = j3 & 15;
- int i4 = 0;
- double d1 = 0.0D;
- int j4;
- int k4;
- int l4;
- int i5;
-
- if (world.worldProvider.e) {
- l4 = i3 + j3 * 231871;
- l4 = l4 * l4 * 31287121 + l4 * 11;
- if ((l4 >> 20 & 1) == 0) {
- aint[Block.DIRT.id] += 10;
- } else {
- aint[Block.STONE.id] += 10;
- }
-
- d1 = 100.0D;
- } else {
- for (l4 = 0; l4 < i; ++l4) {
- for (j4 = 0; j4 < i; ++j4) {
- k4 = chunk.b(l4 + k3, j4 + l3) + 1;
- int j5 = 0;
-
- if (k4 > 1) {
- boolean flag1 = false;
-
- do {
- flag1 = true;
- j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
- if (j5 == 0) {
- flag1 = false;
- } else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.F == MaterialMapColor.b) {
- flag1 = false;
- }
- if (!flag1) {
- --k4;
- if (k4 <= 0) break; // CraftBukkit
- j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
- }
- } while (k4 > 0 && !flag1);
+ if (!chunk.isEmpty()) {
+ int k3 = i3 & 15;
+ int l3 = j3 & 15;
+ int i4 = 0;
+ double d1 = 0.0D;
+ int j4;
+ int k4;
+ int l4;
+ int i5;
+
+ if (world.worldProvider.e) {
+ l4 = i3 + j3 * 231871;
+ l4 = l4 * l4 * 31287121 + l4 * 11;
+ if ((l4 >> 20 & 1) == 0) {
+ aint[Block.DIRT.id] += 10;
+ } else {
+ aint[Block.STONE.id] += 10;
+ }
- if (k4 > 0 && j5 != 0 && Block.byId[j5].material.isLiquid()) {
- i5 = k4 - 1;
- boolean flag2 = false;
+ d1 = 100.0D;
+ } else {
+ for (l4 = 0; l4 < i; ++l4) {
+ for (j4 = 0; j4 < i; ++j4) {
+ k4 = chunk.b(l4 + k3, j4 + l3) + 1;
+ int j5 = 0;
- int k5;
+ if (k4 > 1) {
+ boolean flag1 = false;
do {
- k5 = chunk.getTypeId(l4 + k3, i5--, j4 + l3);
- ++i4;
- } while (i5 > 0 && k5 != 0 && Block.byId[k5].material.isLiquid());
+ flag1 = true;
+ j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
+ if (j5 == 0) {
+ flag1 = false;
+ } else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.F == MaterialMapColor.b) {
+ flag1 = false;
+ }
+
+ if (!flag1) {
+ --k4;
+ if (k4 <= 0) {
+ break;
+ }
+
+ j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
+ }
+ } while (k4 > 0 && !flag1);
+
+ if (k4 > 0 && j5 != 0 && Block.byId[j5].material.isLiquid()) {
+ i5 = k4 - 1;
+ boolean flag2 = false;
+
+ int k5;
+
+ do {
+ k5 = chunk.getTypeId(l4 + k3, i5--, j4 + l3);
+ ++i4;
+ } while (i5 > 0 && k5 != 0 && Block.byId[k5].material.isLiquid());
+ }
}
- }
- d1 += (double) k4 / (double) (i * i);
- ++aint[j5];
+ d1 += (double) k4 / (double) (i * i);
+ ++aint[j5];
+ }
}
}
- }
- i4 /= i * i;
- int l5 = b0 / (i * i);
+ i4 /= i * i;
+ int l5 = b0 / (i * i);
- l5 = b1 / (i * i);
- l5 = b2 / (i * i);
- l4 = 0;
- j4 = 0;
+ l5 = b1 / (i * i);
+ l5 = b2 / (i * i);
+ l4 = 0;
+ j4 = 0;
- for (k4 = 0; k4 < 256; ++k4) {
- if (aint[k4] > l4) {
- j4 = k4;
- l4 = aint[k4];
+ for (k4 = 0; k4 < 256; ++k4) {
+ if (aint[k4] > l4) {
+ j4 = k4;
+ l4 = aint[k4];
+ }
}
- }
- double d2 = (d1 - d0) * 4.0D / (double) (i + 4) + ((double) (k1 + j2 & 1) - 0.5D) * 0.4D;
- byte b3 = 1;
+ double d2 = (d1 - d0) * 4.0D / (double) (i + 4) + ((double) (k1 + j2 & 1) - 0.5D) * 0.4D;
+ byte b3 = 1;
- if (d2 > 0.6D) {
- b3 = 2;
- }
+ if (d2 > 0.6D) {
+ b3 = 2;
+ }
- if (d2 < -0.6D) {
- b3 = 0;
- }
+ if (d2 < -0.6D) {
+ b3 = 0;
+ }
- i5 = 0;
- if (j4 > 0) {
- MaterialMapColor materialmapcolor = Block.byId[j4].material.F;
+ i5 = 0;
+ if (j4 > 0) {
+ MaterialMapColor materialmapcolor = Block.byId[j4].material.F;
- if (materialmapcolor == MaterialMapColor.n) {
- d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
- b3 = 1;
- if (d2 < 0.5D) {
- b3 = 2;
- }
+ if (materialmapcolor == MaterialMapColor.n) {
+ d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
+ b3 = 1;
+ if (d2 < 0.5D) {
+ b3 = 2;
+ }
- if (d2 > 0.9D) {
- b3 = 0;
+ if (d2 > 0.9D) {
+ b3 = 0;
+ }
}
+
+ i5 = materialmapcolor.q;
}
- i5 = materialmapcolor.q;
- }
+ d0 = d1;
+ if (j2 >= 0 && k2 * k2 + l2 * l2 < j1 * j1 && (!flag || (k1 + j2 & 1) != 0)) {
+ byte b4 = worldmap.colors[k1 + j2 * short1];
+ byte b5 = (byte) (i5 * 4 + b3);
- d0 = d1;
- if (j2 >= 0 && k2 * k2 + l2 * l2 < j1 * j1 && (!flag || (k1 + j2 & 1) != 0)) {
- byte b4 = worldmap.colors[k1 + j2 * short1];
- byte b5 = (byte) (i5 * 4 + b3);
+ if (b4 != b5) {
+ if (l1 > j2) {
+ l1 = j2;
+ }
- if (b4 != b5) {
- if (l1 > j2) {
- l1 = j2;
- }
+ if (i2 < j2) {
+ i2 = j2;
+ }
- if (i2 < j2) {
- i2 = j2;
+ worldmap.colors[k1 + j2 * short1] = b5;
}
-
- worldmap.colors[k1 + j2 * short1] = b5;
}
}
}
diff --git a/src/main/java/net/minecraft/server/MinecartTrackLogic.java b/src/main/java/net/minecraft/server/MinecartTrackLogic.java
index 9a41ce11..f0d143b6 100644
--- a/src/main/java/net/minecraft/server/MinecartTrackLogic.java
+++ b/src/main/java/net/minecraft/server/MinecartTrackLogic.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit - We import this because the compiler hates package-private methods in an external jar
@@ -83,35 +84,43 @@ class MinecartTrackLogic {
}
private boolean a(int i, int j, int k) {
- return BlockMinecartTrack.g(this.b, i, j, k) ? true : (BlockMinecartTrack.g(this.b, i, j + 1, k) ? true : BlockMinecartTrack.g(this.b, i, j - 1, k));
+ return BlockMinecartTrack.d_(this.b, i, j, k) ? true : (BlockMinecartTrack.d_(this.b, i, j + 1, k) ? true : BlockMinecartTrack.d_(this.b, i, j - 1, k));
}
private MinecartTrackLogic a(ChunkPosition chunkposition) {
- return BlockMinecartTrack.g(this.b, chunkposition.x, chunkposition.y, chunkposition.z) ? new MinecartTrackLogic(this.a, this.b, chunkposition.x, chunkposition.y, chunkposition.z) : (BlockMinecartTrack.g(this.b, chunkposition.x, chunkposition.y + 1, chunkposition.z) ? new MinecartTrackLogic(this.a, this.b, chunkposition.x, chunkposition.y + 1, chunkposition.z) : (BlockMinecartTrack.g(this.b, chunkposition.x, chunkposition.y - 1, chunkposition.z) ? new MinecartTrackLogic(this.a, this.b, chunkposition.x, chunkposition.y - 1, chunkposition.z) : null));
+ return BlockMinecartTrack.d_(this.b, chunkposition.x, chunkposition.y, chunkposition.z) ? new MinecartTrackLogic(this.a, this.b, chunkposition.x, chunkposition.y, chunkposition.z) : (BlockMinecartTrack.d_(this.b, chunkposition.x, chunkposition.y + 1, chunkposition.z) ? new MinecartTrackLogic(this.a, this.b, chunkposition.x, chunkposition.y + 1, chunkposition.z) : (BlockMinecartTrack.d_(this.b, chunkposition.x, chunkposition.y - 1, chunkposition.z) ? new MinecartTrackLogic(this.a, this.b, chunkposition.x, chunkposition.y - 1, chunkposition.z) : null));
}
private boolean b(MinecartTrackLogic minecarttracklogic) {
- for (int i = 0; i < this.g.size(); ++i) {
- ChunkPosition chunkposition = (ChunkPosition) this.g.get(i);
+ Iterator iterator = this.g.iterator();
+
+ ChunkPosition chunkposition;
- if (chunkposition.x == minecarttracklogic.c && chunkposition.z == minecarttracklogic.e) {
- return true;
+ do {
+ if (!iterator.hasNext()) {
+ return false;
}
- }
- return false;
+ chunkposition = (ChunkPosition) iterator.next();
+ } while (chunkposition.x != minecarttracklogic.c || chunkposition.z != minecarttracklogic.e);
+
+ return true;
}
private boolean b(int i, int j, int k) {
- for (int l = 0; l < this.g.size(); ++l) {
- ChunkPosition chunkposition = (ChunkPosition) this.g.get(l);
+ Iterator iterator = this.g.iterator();
- if (chunkposition.x == i && chunkposition.z == k) {
- return true;
+ ChunkPosition chunkposition;
+
+ do {
+ if (!iterator.hasNext()) {
+ return false;
}
- }
- return false;
+ chunkposition = (ChunkPosition) iterator.next();
+ } while (chunkposition.x != i || chunkposition.z != k);
+
+ return true;
}
private int b() {
@@ -141,12 +150,12 @@ class MinecartTrackLogic {
return true;
} else if (this.g.size() == 2) {
return false;
- } else if (this.g.size() == 0) {
+ } else if (this.g.isEmpty()) {
return true;
} else {
ChunkPosition chunkposition = (ChunkPosition) this.g.get(0);
- return minecarttracklogic.d == this.d && chunkposition.y == this.d ? true : true;
+ return true;
}
}
@@ -185,21 +194,21 @@ class MinecartTrackLogic {
}
if (b0 == 0) {
- if (BlockMinecartTrack.g(this.b, this.c, this.d + 1, this.e - 1)) {
+ if (BlockMinecartTrack.d_(this.b, this.c, this.d + 1, this.e - 1)) {
b0 = 4;
}
- if (BlockMinecartTrack.g(this.b, this.c, this.d + 1, this.e + 1)) {
+ if (BlockMinecartTrack.d_(this.b, this.c, this.d + 1, this.e + 1)) {
b0 = 5;
}
}
if (b0 == 1) {
- if (BlockMinecartTrack.g(this.b, this.c + 1, this.d + 1, this.e)) {
+ if (BlockMinecartTrack.d_(this.b, this.c + 1, this.d + 1, this.e)) {
b0 = 2;
}
- if (BlockMinecartTrack.g(this.b, this.c - 1, this.d + 1, this.e)) {
+ if (BlockMinecartTrack.d_(this.b, this.c - 1, this.d + 1, this.e)) {
b0 = 3;
}
}
@@ -308,21 +317,21 @@ class MinecartTrackLogic {
}
if (b0 == 0) {
- if (BlockMinecartTrack.g(this.b, this.c, this.d + 1, this.e - 1)) {
+ if (BlockMinecartTrack.d_(this.b, this.c, this.d + 1, this.e - 1)) {
b0 = 4;
}
- if (BlockMinecartTrack.g(this.b, this.c, this.d + 1, this.e + 1)) {
+ if (BlockMinecartTrack.d_(this.b, this.c, this.d + 1, this.e + 1)) {
b0 = 5;
}
}
if (b0 == 1) {
- if (BlockMinecartTrack.g(this.b, this.c + 1, this.d + 1, this.e)) {
+ if (BlockMinecartTrack.d_(this.b, this.c + 1, this.d + 1, this.e)) {
b0 = 2;
}
- if (BlockMinecartTrack.g(this.b, this.c - 1, this.d + 1, this.e)) {
+ if (BlockMinecartTrack.d_(this.b, this.c - 1, this.d + 1, this.e)) {
b0 = 3;
}
}
@@ -340,9 +349,11 @@ class MinecartTrackLogic {
if (flag1 || this.b.getData(this.c, this.d, this.e) != i) {
this.b.setData(this.c, this.d, this.e, i);
+ Iterator iterator = this.g.iterator();
- for (int j = 0; j < this.g.size(); ++j) {
- MinecartTrackLogic minecarttracklogic = this.a((ChunkPosition) this.g.get(j));
+ while (iterator.hasNext()) {
+ ChunkPosition chunkposition = (ChunkPosition) iterator.next();
+ MinecartTrackLogic minecarttracklogic = this.a(chunkposition);
if (minecarttracklogic != null) {
minecarttracklogic.a();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c58551ee..a5928505 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,68 +1,73 @@
package net.minecraft.server;
-// import java.awt.GraphicsEnvironment; // CraftBukkit
+import java.awt.GraphicsEnvironment;
import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
+import java.security.KeyPair;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
+import java.util.Date;
import java.util.Iterator;
import java.util.List;
-import java.util.Random;
+import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
// CraftBukkit start
-import java.io.PrintStream;
import jline.console.ConsoleReader;
import joptsimple.OptionSet;
import org.bukkit.World.Environment;
-import org.bukkit.craftbukkit.LoggerOutputStream;
-import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.event.server.RemoteServerCommandEvent;
import org.bukkit.event.world.WorldSaveEvent;
// CraftBukkit end
-public class MinecraftServer implements Runnable, ICommandListener, IMinecraftServer {
+public abstract class MinecraftServer implements Runnable, IMojangStatistics, ICommandListener {
public static Logger log = Logger.getLogger("Minecraft");
- public static HashMap trackerList = new HashMap();
- private String y;
- private int z;
- public NetworkListenThread networkListenThread;
- public PropertyManager propertyManager;
+ private static MinecraftServer l = null;
+ public Convertable convertable; // CraftBukkit - private final -> public
+ private final MojangStatisticsGenerator n = new MojangStatisticsGenerator("server", this);
+ public File universe; // CraftBukkit - private final -> public
+ private final List p = new ArrayList();
+ private final ICommandHandler q;
+ public final MethodProfiler methodProfiler = new MethodProfiler();
+ private String serverIp;
+ private int s = -1;
// public WorldServer[] worldServer; // CraftBukkit - removed!
- public long[] f = new long[100];
- public long[][] g;
- public ServerConfigurationManager serverConfigurationManager;
- public ConsoleCommandHandler consoleCommandHandler; // CraftBukkit - made public
+ private ServerConfigurationManagerAbstract t;
private boolean isRunning = true;
- public boolean isStopped = false;
- int ticks = 0;
- public String k;
- public int l;
- private List C = new ArrayList();
- private List D = Collections.synchronizedList(new ArrayList());
- // public EntityTracker[] tracker = new EntityTracker[3]; // CraftBukkit - removed!
- public boolean onlineMode;
- public boolean spawnAnimals;
- public boolean spawnNPCs;
- public boolean pvpMode;
- public boolean allowFlight;
- public String motd;
- public int t;
+ private boolean isStopped = false;
+ private int ticks = 0;
+ public String d;
+ public int e;
+ private boolean onlineMode;
+ private boolean spawnAnimals;
+ private boolean spawnNPCs;
+ private boolean pvpMode;
+ private boolean allowFlight;
+ private String motd;
+ private int D;
private long E;
private long F;
private long G;
private long H;
- public long[] u = new long[100];
- public long[] v = new long[100];
- public long[] w = new long[100];
- public long[] x = new long[100];
- private RemoteStatusListener I;
- private RemoteControlListener J;
+ public final long[] f = new long[100];
+ public final long[] g = new long[100];
+ public final long[] h = new long[100];
+ public final long[] i = new long[100];
+ public final long[] j = new long[100];
+ public long[][] k;
+ private KeyPair I;
+ private String J;
+ private String K;
+ private boolean demoMode;
+ private boolean N;
+ private boolean O;
+ private String P = "";
+ private boolean Q = false;
+ private long R;
+ private String S;
+ private boolean T;
// CraftBukkit start
public List<WorldServer> worlds = new ArrayList<WorldServer>();
@@ -75,8 +80,11 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
public final Thread primaryThread;
// CraftBukkit end
- public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
- new ThreadSleepForever(this);
+ public MinecraftServer(OptionSet options) { // CraftBukkit - signature file -> OptionSet
+ l = this;
+ // this.universe = file1; // CraftBukkit
+ this.q = new CommandDispatcher();
+ // this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved to DedicatedServer.init
// CraftBukkit start
this.options = options;
@@ -91,160 +99,55 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
org.bukkit.craftbukkit.Main.useJline = false;
this.reader = new ConsoleReader(System.in, System.out);
this.reader.setExpandEvents(false);
- } catch (IOException ex) {
+ } catch (java.io.IOException ex) {
Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex);
}
}
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
- primaryThread = new ThreadServerApplication("Server thread", this); // Moved from main
- // CraftBukkit end
+ primaryThread = new ThreadServerApplication(this, "Server thread"); // Moved from main
}
- private boolean init() throws java.net.UnknownHostException { // CraftBukkit - added throws UnknownHostException
- this.consoleCommandHandler = new ConsoleCommandHandler(this);
- ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
-
- threadcommandreader.setDaemon(true);
- threadcommandreader.start();
- ConsoleLogManager.init(this); // CraftBukkit
-
- // CraftBukkit start
- System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
- System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
- // CraftBukkit end
-
- log.info("Starting minecraft server version 1.2.5");
- if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
- log.warning("**** NOT ENOUGH RAM!");
- log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
- }
-
- log.info("Loading properties");
- this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
- this.y = this.propertyManager.getString("server-ip", "");
- this.onlineMode = this.propertyManager.getBoolean("online-mode", true);
- this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
- this.spawnNPCs = this.propertyManager.getBoolean("spawn-npcs", true);
- this.pvpMode = this.propertyManager.getBoolean("pvp", true);
- this.allowFlight = this.propertyManager.getBoolean("allow-flight", false);
- this.motd = this.propertyManager.getString("motd", "A Minecraft Server");
- this.motd.replace('\u00a7', '$');
- InetAddress inetaddress = null;
-
- if (this.y.length() > 0) {
- inetaddress = InetAddress.getByName(this.y);
- }
-
- this.z = this.propertyManager.getInt("server-port", 25565);
- log.info("Starting Minecraft server on " + (this.y.length() == 0 ? "*" : this.y) + ":" + this.z);
-
- try {
- this.networkListenThread = new NetworkListenThread(this, inetaddress, this.z);
- } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
- log.warning("**** FAILED TO BIND TO PORT!");
- log.log(Level.WARNING, "The exception was: " + ioexception.toString());
- log.warning("Perhaps a server is already running on that port?");
- return false;
- }
-
- if (!this.onlineMode) {
- log.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
- log.warning("The server will make no attempt to authenticate usernames. Beware.");
- log.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
- log.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file."); // CraftBukkit - type. Seriously. :D
- }
-
- this.serverConfigurationManager = new ServerConfigurationManager(this);
- // CraftBukkit - removed trackers
- long i = System.nanoTime();
- String s = this.propertyManager.getString("level-name", "world");
- String s1 = this.propertyManager.getString("level-seed", "");
- String s2 = this.propertyManager.getString("level-type", "DEFAULT");
- long j = (new Random()).nextLong();
-
- if (s1.length() > 0) {
- try {
- long k = Long.parseLong(s1);
-
- if (k != 0L) {
- j = k;
- }
- } catch (NumberFormatException numberformatexception) {
- j = (long) s1.hashCode();
- }
- }
-
- WorldType worldtype = WorldType.getType(s2);
-
- if (worldtype == null) {
- worldtype = WorldType.NORMAL;
- }
-
- this.t = this.propertyManager.getInt("max-build-height", 256);
- this.t = (this.t + 8) / 16 * 16;
- this.t = MathHelper.a(this.t, 64, 256);
- this.propertyManager.a("max-build-height", Integer.valueOf(this.t));
- log.info("Preparing level \"" + s + "\"");
- this.a(new WorldLoaderServer(server.getWorldContainer()), s, j, worldtype); // CraftBukkit - world container
- long l = System.nanoTime() - i;
- String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) l / 1.0E9D)});
-
- log.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
- if (this.propertyManager.getBoolean("enable-query", false)) {
- log.info("Starting GS4 status listener");
- this.I = new RemoteStatusListener(this);
- this.I.a();
- }
+ public abstract PropertyManager getPropertyManager(); // protected -> public
+ // CraftBukkit end
- if (this.propertyManager.getBoolean("enable-rcon", false)) {
- log.info("Starting remote control listener");
- this.J = new RemoteControlListener(this);
- this.J.a();
- this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
- }
+ protected abstract boolean init() throws java.net.UnknownHostException; // CraftBukkit - throws UnknownHostException
- // CraftBukkit start
- if (this.propertyManager.properties.containsKey("spawn-protection")) {
- log.info("'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you.");
- this.server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16));
- this.propertyManager.properties.remove("spawn-protection");
- this.propertyManager.savePropertiesFile();
+ protected void c(String s) {
+ if (this.getConvertable().isConvertable(s)) {
+ log.info("Converting map!");
+ this.d("menu.convertingLevel");
+ this.getConvertable().convert(s, new ConvertProgressUpdater(this));
}
- // CraftBukkit end
-
- return true;
}
- private void a(Convertable convertable, String s, long i, WorldType worldtype) {
- if (convertable.isConvertable(s)) {
- log.info("Converting map!");
- convertable.convert(s, new ConvertProgressUpdater(this));
- }
+ protected synchronized void d(String s) {
+ this.S = s;
+ }
+ protected void a(String s, String s1, long i, WorldType worldtype) {
+ this.c(s);
+ this.d("menu.loadingLevel");
// CraftBukkit - removed world and ticktime arrays
- int j = this.propertyManager.getInt("gamemode", 0);
-
- j = WorldSettings.a(j);
- log.info("Default game type: " + j);
- // CraftBukkit start (+ removed worldsettings and servernbtmanager)
- boolean generateStructures = this.propertyManager.getBoolean("generate-structures", true);
+ IDataManager idatamanager = this.convertable.a(s, true);
+ WorldData worlddata = idatamanager.getWorldData();
+ // CraftBukkit start - removed worldsettings
int worldCount = 3;
- for (int k = 0; k < worldCount; ++k) {
+ for (int j = 0; j < worldCount; ++j) {
WorldServer world;
int dimension = 0;
- if (k == 1) {
- if (this.propertyManager.getBoolean("allow-nether", true)) {
+ if (j == 1) {
+ if (this.getAllowNether()) {
dimension = -1;
} else {
continue;
}
}
- if (k == 2) {
- // CraftBukkit - (+ don't do this in server.properties, do it in bukkit.yml)
+ if (j == 2) {
+ // don't do this in server.properties, do it in bukkit.yml
if (this.server.getAllowEnd()) {
dimension = 1;
} else {
@@ -256,10 +159,16 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
String name = (dimension == 0) ? s : s + "_" + worldType;
org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
- WorldSettings settings = new WorldSettings(i, j, generateStructures, false, worldtype);
+ WorldSettings worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), false, worldtype);
- if (k == 0) {
- world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
+ if (j == 0) {
+ if (this.L()) { // Strip out DEMO?
+ // CraftBukkit
+ world = new DemoWorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, this.methodProfiler);
+ } else {
+ // CraftBukkit
+ world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, worldsettings, this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen);
+ }
} else {
String dim = "DIM" + dimension;
@@ -289,62 +198,64 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
}
- if (convertable.isConvertable(name)) {
- log.info("Converting map!");
- convertable.convert(name, new ConvertProgressUpdater(this));
- }
+ this.c(name);
- world = new SecondaryWorldServer(this, new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, settings, this.worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
+ // CraftBukkit
+ world = new SecondaryWorldServer(this, new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, worldsettings, this.worlds.get(0), this.methodProfiler, org.bukkit.World.Environment.getEnvironment(dimension), gen);
}
if (gen != null) {
world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld()));
}
- this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
-
- world.tracker = new EntityTracker(this, world); // CraftBukkit
world.addIWorldAccess(new WorldManager(this, world));
- world.difficulty = this.propertyManager.getInt("difficulty", 1);
- world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
- world.getWorldData().setGameType(j);
+ if (!this.H()) {
+ world.getWorldData().setGameType(this.getGamemode());
+ }
this.worlds.add(world);
- this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0]));
+ this.t.setPlayerFileData(this.worlds.toArray(new WorldServer[this.worlds.size()]));
+ // CraftBukkit end
}
- // CraftBukkit end
+ this.c(this.getDifficulty());
+ this.d();
+ }
+
+ protected void d() {
short short1 = 196;
- long l = System.currentTimeMillis();
+ long i = System.currentTimeMillis();
+
+ this.d("menu.generatingTerrain");
// CraftBukkit start
- for (int i1 = 0; i1 < this.worlds.size(); ++i1) {
- WorldServer worldserver = this.worlds.get(i1);
- log.info("Preparing start region for level " + i1 + " (Seed: " + worldserver.getSeed() + ")");
+ for (int j = 0; j < this.worlds.size(); ++j) {
+ WorldServer worldserver = this.worlds.get(j);
+ log.info("Preparing start region for level " + j + " (Seed: " + worldserver.getSeed() + ")");
if (!worldserver.getWorld().getKeepSpawnInMemory()) {
continue;
}
// CraftBukkit end
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
- for (int j1 = -short1; j1 <= short1 && this.isRunning; j1 += 16) {
- for (int k1 = -short1; k1 <= short1 && this.isRunning; k1 += 16) {
- long l1 = System.currentTimeMillis();
+ for (int k = -short1; k <= short1 && this.isRunning(); k += 16) {
+ for (int l = -short1; l <= short1 && this.isRunning(); l += 16) {
+ long i1 = System.currentTimeMillis();
- if (l1 < l) {
- l = l1;
+ if (i1 < i) {
+ i = i1;
}
- if (l1 > l + 1000L) {
- int i2 = (short1 * 2 + 1) * (short1 * 2 + 1);
- int j2 = (j1 + short1) * (short1 * 2 + 1) + k1 + 1;
+ if (i1 > i + 1000L) {
+ int j1 = (short1 * 2 + 1) * (short1 * 2 + 1);
+ int k1 = (k + short1) * (short1 * 2 + 1) + l + 1;
- this.b("Preparing spawn area", j2 * 100 / i2);
- l = l1;
+ this.a_("Preparing spawn area", k1 * 100 / j1);
+ i = i1;
}
- worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4);
+ worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + k >> 4, chunkcoordinates.z + l >> 4);
- while (worldserver.updateLights() && this.isRunning) {
+ while (worldserver.updateLights() && this.isRunning()) {
;
}
}
@@ -357,62 +268,103 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
// CraftBukkit end
- this.t();
+ this.i();
}
- private void b(String s, int i) {
- this.k = s;
- this.l = i;
+ public abstract boolean getGenerateStructures();
+
+ public abstract EnumGamemode getGamemode();
+
+ public abstract int getDifficulty();
+
+ public abstract boolean isHardcore();
+
+ protected void a_(String s, int i) {
+ this.d = s;
+ this.e = i;
log.info(s + ": " + i + "%");
}
- private void t() {
- this.k = null;
- this.l = 0;
+ protected void i() {
+ this.d = null;
+ this.e = 0;
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); // CraftBukkit
}
- void saveChunks() { // CraftBukkit - private -> default
- log.info("Saving chunks");
+ protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws
+ if (!this.O) {
+ // CraftBukkit start
+ for (int j = 0; j < this.worlds.size(); ++j) {
+ WorldServer worldserver = this.worlds.get(j);
- // CraftBukkit start
- for (int i = 0; i < this.worlds.size(); ++i) {
- WorldServer worldserver = this.worlds.get(i);
+ if (worldserver != null) {
+ if (!flag) {
+ log.info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider);
+ }
- worldserver.save(true, (IProgressUpdate) null);
- worldserver.saveLevel();
+ worldserver.save(true, (IProgressUpdate) null);
+ worldserver.saveLevel();
- WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld());
- this.server.getPluginManager().callEvent(event);
- }
+ WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld());
+ this.server.getPluginManager().callEvent(event);
+ }
+ }
- WorldServer world = this.worlds.get(0);
- if (!world.savingDisabled) {
- this.serverConfigurationManager.savePlayers();
+ if (!this.worlds.get(0).savingDisabled) {
+ this.getServerConfigurationManager().savePlayers();
+ }
+ // CraftBukkit end
}
- // CraftBukkit end
}
- public void stop() { // CraftBukkit - private -> public
- log.info("Stopping server");
- // CraftBukkit start
- if (this.server != null) {
- this.server.disablePlugins();
- }
- // CraftBukkit end
+ public void stop() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ if (!this.O) {
+ log.info("Stopping server");
+ // CraftBukkit start
+ if (this.server != null) {
+ this.server.disablePlugins();
+ }
+ // CraftBukkit end
- if (this.serverConfigurationManager != null) {
- this.serverConfigurationManager.savePlayers();
- }
+ if (this.ac() != null) {
+ this.ac().a();
+ }
- // for (int i = 0; i < this.worldServer.length; ++i) { // CraftBukkit - multiworld is handled in saveChunks() already.
- WorldServer worldserver = this.worlds.get(0); // CraftBukkit
+ if (this.t != null) {
+ log.info("Saving players");
+ this.t.savePlayers();
+ this.t.r();
+ }
- if (worldserver != null) {
- this.saveChunks();
+ 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];
+
+ worldserver.saveLevel();
+ }
+ // CraftBukkit end */
+ if (this.n != null && this.n.d()) {
+ this.n.e();
}
- // } // CraftBukkit
+ }
+ }
+
+ public String getServerIp() {
+ return this.serverIp;
+ }
+
+ public void e(String s) {
+ this.serverIp = s;
+ }
+
+ public boolean isRunning() {
+ return this.isRunning;
}
public void safeShutdown() {
@@ -424,14 +376,15 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
if (this.init()) {
long i = System.currentTimeMillis();
- for (long j = 0L; this.isRunning; Thread.sleep(1L)) {
+ for (long j = 0L; this.isRunning; this.Q = true) {
long k = System.currentTimeMillis();
long l = k - i;
- if (l > 2000L) {
- if (this.server.getWarnOnOverload()) // CraftBukkit - Adding an option to suppress these warning messages
+ if (l > 2000L && i - this.R >= 15000L) {
+ if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages
log.warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
l = 2000L;
+ this.R = i;
}
if (l < 0L) {
@@ -442,192 +395,299 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
j += l;
i = k;
if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
- this.w();
+ this.p();
j = 0L;
} else {
while (j > 50L) {
MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
j -= 50L;
- this.w();
+ this.p();
}
}
- }
- } else {
- while (this.isRunning) {
- this.b();
- try {
- Thread.sleep(10L);
- } catch (InterruptedException interruptedexception) {
- interruptedexception.printStackTrace();
- }
+ Thread.sleep(1L);
}
+ } else {
+ this.a((CrashReport) null);
}
} catch (Throwable throwable) {
throwable.printStackTrace();
- log.log(Level.SEVERE, "Unexpected exception", throwable);
+ log.log(Level.SEVERE, "Encountered an unexpected exception " + throwable.getClass().getSimpleName(), throwable);
+ CrashReport crashreport = null;
+
+ if (throwable instanceof ReportedException) {
+ crashreport = this.b(((ReportedException) throwable).a());
+ } else {
+ crashreport = this.b(new CrashReport("Exception in server tick loop", throwable));
+ }
- while (this.isRunning) {
- this.b();
+ File file1 = new File(new File(this.n(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
- try {
- Thread.sleep(10L);
- } catch (InterruptedException interruptedexception1) {
- interruptedexception1.printStackTrace();
- }
+ if (crashreport.a(file1)) {
+ log.severe("This crash report has been saved to: " + file1.getAbsolutePath());
+ } else {
+ log.severe("We were unable to save this crash report to disk.");
}
+
+ this.a(crashreport);
} finally {
try {
this.stop();
this.isStopped = true;
+ } catch (Throwable throwable1) {
+ throwable1.printStackTrace();
+ } finally {
// CraftBukkit start - restore terminal to original settings
try {
this.reader.getTerminal().restore();
} catch (Exception e) {
}
// CraftBukkit end
- } catch (Throwable throwable1) {
- throwable1.printStackTrace();
- } finally {
- System.exit(0);
+ this.o();
}
}
}
- private void w() {
+ protected File n() {
+ return new File(".");
+ }
+
+ protected void a(CrashReport crashreport) {}
+
+ protected void o() {}
+
+ protected void p() throws ExceptionWorldConflict { // CraftBukkit - added throws
long i = System.nanoTime();
- ArrayList arraylist = new ArrayList();
- Iterator iterator = trackerList.keySet().iterator();
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
- int j = ((Integer) trackerList.get(s)).intValue();
+ AxisAlignedBB.a().a();
+ Vec3D.a().a();
+ ++this.ticks;
+ if (this.T) {
+ this.T = false;
+ // this.methodProfiler.a = true; // CraftBukkit - not in production code
+ // this.methodProfiler.a(); // CraftBukkit - not in production code
+ }
- if (j > 0) {
- trackerList.put(s, Integer.valueOf(j - 1));
- } else {
- arraylist.add(s);
- }
+ // this.methodProfiler.a("root"); // CraftBukkit - not in production code
+ this.q();
+ if (this.ticks % 900 == 0) {
+ // this.methodProfiler.a("save"); // CraftBukkit - not in production code
+ this.t.savePlayers();
+ this.saveChunks(true);
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
}
- int k;
+ // this.methodProfiler.a("tallying"); // CraftBukkit - not in production code
+ this.j[this.ticks % 100] = System.nanoTime() - i;
+ this.f[this.ticks % 100] = Packet.p - this.E;
+ this.E = Packet.p;
+ this.g[this.ticks % 100] = Packet.q - this.F;
+ this.F = Packet.q;
+ this.h[this.ticks % 100] = Packet.n - this.G;
+ this.G = Packet.n;
+ this.i[this.ticks % 100] = Packet.o - this.H;
+ this.H = Packet.o;
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.methodProfiler.a("snooper"); // CraftBukkit - not in production code
+ if (!this.n.d() && this.ticks > 100) {
+ this.n.a();
+ }
- for (k = 0; k < arraylist.size(); ++k) {
- trackerList.remove(arraylist.get(k));
+ if (this.ticks % 6000 == 0) {
+ this.n.b();
}
- AxisAlignedBB.a();
- Vec3D.a();
- ++this.ticks;
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ }
- // CraftBukkit start - only send timeupdates to the people in that world
+ public void q() {
+ // this.methodProfiler.a("levels"); // CraftBukkit - not in production code
- ((org.bukkit.craftbukkit.scheduler.CraftScheduler) this.server.getScheduler()).mainThreadHeartbeat(this.ticks);
+ // CraftBukkit start - only send timeupdates to the people in that world
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks);
// Send timeupdates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) {
- for (k = 0; k < this.serverConfigurationManager.players.size(); ++k) {
- EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(k);
+ for (int i = 0; i < this.getServerConfigurationManager().players.size(); ++i) {
+ EntityPlayer entityplayer = (EntityPlayer) this.getServerConfigurationManager().players.get(i);
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time
}
}
- for (k = 0; k < this.worlds.size(); ++k) {
- long l = System.nanoTime();
- // if (k == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
- WorldServer worldserver = this.worlds.get(k);
+ for (int i = 0; i < this.worlds.size(); ++i) {
+ long j = System.nanoTime();
+
+ // if (i == 0 || this.getAllowNether()) {
+ WorldServer worldserver = this.worlds.get(i);
/* Drop global timeupdates
+ this.b.a(worldserver.getWorldData().j());
if (this.ticks % 20 == 0) {
- this.serverConfigurationManager.a(new Packet4UpdateTime(worldserver.getTime()), worldserver.worldProvider.dimension);
+ this.b.a("timeSync");
+ this.t.a(new Packet4UpdateTime(worldserver.getTime()), worldserver.worldProvider.dimension);
+ this.b.b();
}
// CraftBukkit end */
+ // this.methodProfiler.a("tick"); // CraftBukkit - not in production code
worldserver.doTick();
+ // this.methodProfiler.c("lights"); // CraftBukkit - not in production code
while (true) {
if (!worldserver.updateLights()) {
- worldserver.tickEntities();
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ if (!worldserver.players.isEmpty()) {
+ worldserver.tickEntities();
+ }
+
+ // this.methodProfiler.a("tracker"); // CraftBukkit - not in production code
+ worldserver.getTracker().updatePlayers();
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
break;
}
}
- }
-
- // this.g[k][this.ticks % 100] = System.nanoTime() - l; // CraftBukkit
- // } // CraftBukkit
+ // } // CraftBukkit
- this.networkListenThread.a();
- this.serverConfigurationManager.tick();
-
- // CraftBukkit start
- for (k = 0; k < this.worlds.size(); ++k) {
- this.worlds.get(k).tracker.updatePlayers();
+ // this.k[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
}
- // CraftBukkit end
- for (k = 0; k < this.C.size(); ++k) {
- ((IUpdatePlayerListBox) this.C.get(k)).a();
- }
+ // this.methodProfiler.c("connection"); // CraftBukkit - not in production code
+ this.ac().b();
+ // this.methodProfiler.c("players"); // CraftBukkit - not in production code
+ this.t.tick();
+ // this.methodProfiler.c("tickables"); // CraftBukkit - not in production code
+ Iterator iterator = this.p.iterator();
- try {
- this.b();
- } catch (Exception exception) {
- log.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
- }
+ while (iterator.hasNext()) {
+ IUpdatePlayerListBox iupdateplayerlistbox = (IUpdatePlayerListBox) iterator.next();
- this.f[this.ticks % 100] = System.nanoTime() - i;
- this.u[this.ticks % 100] = Packet.n - this.E;
- this.E = Packet.n;
- this.v[this.ticks % 100] = Packet.o - this.F;
- this.F = Packet.o;
- this.w[this.ticks % 100] = Packet.l - this.G;
- this.G = Packet.l;
- this.x[this.ticks % 100] = Packet.m - this.H;
- this.H = Packet.m;
- }
+ iupdateplayerlistbox.a();
+ }
- public void issueCommand(String s, ICommandListener icommandlistener) {
- this.D.add(new ServerCommand(s, icommandlistener));
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
}
- public void b() {
- while (this.D.size() > 0) {
- ServerCommand servercommand = (ServerCommand) this.D.remove(0);
-
- // CraftBukkit start - ServerCommand for preprocessing
- ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
- this.server.getPluginManager().callEvent(event);
- servercommand = new ServerCommand(event.getCommand(), servercommand.source);
- // CraftBukkit end
-
- // this.consoleCommandHandler.handle(servercommand); // CraftBukkit - Removed its now called in server.dispatchServerCommand
- this.server.dispatchServerCommand(this.console, servercommand); // CraftBukkit
- }
+ public boolean getAllowNether() {
+ return true;
}
public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
- this.C.add(iupdateplayerlistbox);
+ this.p.add(iupdateplayerlistbox);
}
- public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[])
+ public static void main(final OptionSet options) { // CraftBukkit - replaces main(String[] astring)
StatisticList.a();
try {
- MinecraftServer minecraftserver = new MinecraftServer(options); // CraftBukkit - pass in the options
+ /* CraftBukkit start - replace everything
+ boolean flag = false;
+ String s = null;
+ String s1 = ".";
+ String s2 = null;
+ boolean flag1 = false;
+ boolean flag2 = false;
+ int i = -1;
+
+ for (int j = 0; j < astring.length; ++j) {
+ String s3 = astring[j];
+ String s4 = j == astring.length - 1 ? null : astring[j + 1];
+ boolean flag3 = false;
+
+ if (!s3.equals("nogui") && !s3.equals("--nogui")) {
+ if (s3.equals("--port") && s4 != null) {
+ flag3 = true;
+
+ try {
+ i = Integer.parseInt(s4);
+ } catch (NumberFormatException numberformatexception) {
+ ;
+ }
+ } else if (s3.equals("--singleplayer") && s4 != null) {
+ flag3 = true;
+ s = s4;
+ } else if (s3.equals("--universe") && s4 != null) {
+ flag3 = true;
+ s1 = s4;
+ } else if (s3.equals("--world") && s4 != null) {
+ flag3 = true;
+ s2 = s4;
+ } else if (s3.equals("--demo")) {
+ flag1 = true;
+ } else if (s3.equals("--bonusChest")) {
+ flag2 = true;
+ }
+ } else {
+ flag = false;
+ }
+
+ if (flag3) {
+ ++j;
+ }
+ }
+ // */
- // CraftBukkit - remove gui
+ DedicatedServer dedicatedserver = new DedicatedServer(options);
+
+ if (options.has("port")) {
+ int port = (Integer) options.valueOf("port");
+ if (port > 0) {
+ dedicatedserver.setPort(port);
+ }
+ }
+
+ if (options.has("universe")) {
+ dedicatedserver.universe = (File) options.valueOf("universe");
+ }
+
+ if (options.has("world")) {
+ dedicatedserver.m((String) options.valueOf("world"));
+ }
+
+ /*
+ if (s != null) {
+ dedicatedserver.l(s);
+ }
+
+ if (s2 != null) {
+ dedicatedserver.m(s2);
+ }
- minecraftserver.primaryThread.start(); // CraftBukkit - let MinecraftServer construct the thread
+ if (i >= 0) {
+ dedicatedserver.setPort(i);
+ }
+
+ if (flag1) {
+ dedicatedserver.b(true);
+ }
+
+ if (flag2) {
+ dedicatedserver.c(true);
+ }
+
+ if (flag) {
+ dedicatedserver.aj();
+ }
+ */
+
+ dedicatedserver.primaryThread.start();
+ // Runtime.getRuntime().addShutdownHook(new ThreadShutdown(dedicatedserver));
+ // CraftBukkit end
} catch (Exception exception) {
log.log(Level.SEVERE, "Failed to start the minecraft server", exception);
}
}
- public File a(String s) {
- return new File(s);
+ public void s() {
+ // (new ThreadServerApplication(this, "Server thread")).start(); // CraftBukkit - prevent abuse
}
- public void sendMessage(String s) {
+ public File f(String s) {
+ return new File(this.n(), s);
+ }
+
+ public void info(String s) {
log.info(s);
}
@@ -635,10 +695,6 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
log.warning(s);
}
- public String getName() {
- return "CONSOLE";
- }
-
public WorldServer getWorldServer(int i) {
// CraftBukkit start
for (WorldServer world : this.worlds) {
@@ -651,62 +707,32 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
// CraftBukkit end
}
- public EntityTracker getTracker(int i) {
- return this.getWorldServer(i).tracker; // CraftBukkit
- }
-
- public int getProperty(String s, int i) {
- return this.propertyManager.getInt(s, i);
- }
-
- public String a(String s, String s1) {
- return this.propertyManager.getString(s, s1);
- }
-
- public void a(String s, Object object) {
- this.propertyManager.a(s, object);
+ public String t() {
+ return this.serverIp;
}
- public void c() {
- this.propertyManager.savePropertiesFile();
+ public int u() {
+ return this.s;
}
- public String getPropertiesFile() {
- File file1 = this.propertyManager.c();
-
- return file1 != null ? file1.getAbsolutePath() : "No settings file";
- }
-
- public String getMotd() {
- return this.y;
- }
-
- public int getPort() {
- return this.z;
- }
-
- public String getServerAddress() {
+ public String v() {
return this.motd;
}
public String getVersion() {
- return "1.2.5";
+ return "1.3.1";
}
- public int getPlayerCount() {
- return this.serverConfigurationManager.getPlayerCount();
+ public int x() {
+ return this.t.getPlayerCount();
}
- public int getMaxPlayers() {
- return this.serverConfigurationManager.getMaxPlayers();
+ public int y() {
+ return this.t.getMaxPlayers();
}
public String[] getPlayers() {
- return this.serverConfigurationManager.d();
- }
-
- public String getWorldName() {
- return this.propertyManager.getString("level-name", "world");
+ return this.t.d();
}
public String getPlugins() {
@@ -736,47 +762,373 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
// CraftBukkit end
}
- public void o() {}
-
- public String d(String s) {
- RemoteControlCommandListener.instance.a();
+ public String i(String s) {
+ RemoteControlCommandListener.instance.b();
// CraftBukkit start
RemoteServerCommandEvent event = new RemoteServerCommandEvent(this.remoteConsole, s);
this.server.getPluginManager().callEvent(event);
ServerCommand servercommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.instance);
- // this.consoleCommandHandler.handle(new ServerCommand(s, RemoteControlCommandListener.instance)); // CraftBukkit - removed
+ // this.q.a(RemoteControlCommandListener.instance, s);
this.server.dispatchServerCommand(this.remoteConsole, servercommand); // CraftBukkit
// CraftBukkit end
- return RemoteControlCommandListener.instance.b();
+ return RemoteControlCommandListener.instance.c();
}
public boolean isDebugging() {
- return this.propertyManager.getBoolean("debug", false); // CraftBukkit - don't hardcode
+ return this.getPropertyManager().getBoolean("debug", false); // CraftBukkit - don't hardcode
}
- public void severe(String s) {
+ public void j(String s) {
log.log(Level.SEVERE, s);
}
- public void debug(String s) {
+ public void k(String s) {
if (this.isDebugging()) {
log.log(Level.INFO, s);
}
}
- public String[] q() {
- return (String[]) this.serverConfigurationManager.getBannedAddresses().toArray(new String[0]);
+ public String getServerModName() {
+ return "craftbukkit"; // CraftBukkit - cb > vanilla!
+ }
+
+ 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)));
+ }
+
+ // 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);
+ }
+ }
+ }
+
+ return crashreport;
+ }
+
+ public List a(ICommandListener icommandlistener, String s) {
+ ArrayList arraylist = new ArrayList();
+
+ if (s.startsWith("/")) {
+ s = s.substring(1);
+ boolean flag = !s.contains(" ");
+ List list = this.q.b(icommandlistener, s);
+
+ if (list != null) {
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ String s1 = (String) iterator.next();
+
+ if (flag) {
+ arraylist.add("/" + s1);
+ } else {
+ arraylist.add(s1);
+ }
+ }
+ }
+
+ return arraylist;
+ } else {
+ String[] astring = s.split(" ", -1);
+ String s2 = astring[astring.length - 1];
+ String[] astring1 = this.t.d();
+ int i = astring1.length;
+
+ for (int j = 0; j < i; ++j) {
+ String s3 = astring1[j];
+
+ if (CommandAbstract.a(s2, s3)) {
+ arraylist.add(s3);
+ }
+ }
+
+ return arraylist;
+ }
}
- public String[] r() {
- return (String[]) this.serverConfigurationManager.getBannedPlayers().toArray(new String[0]);
+ public static MinecraftServer getServer() {
+ return l;
}
- public String getServerModName() {
- return "craftbukkit"; // CraftBukkit - cb > vanilla!
+ public String getName() {
+ return "Server";
+ }
+
+ public void sendMessage(String s) {
+ log.info(StripColor.a(s));
+ }
+
+ public boolean b(String s) {
+ return true;
+ }
+
+ public String a(String s, Object... aobject) {
+ return LocaleLanguage.a().a(s, aobject);
+ }
+
+ public ICommandHandler getCommandHandler() {
+ return this.q;
+ }
+
+ public KeyPair E() {
+ return this.I;
+ }
+
+ public int F() {
+ return this.s;
+ }
+
+ public void setPort(int i) {
+ this.s = i;
+ }
+
+ public String G() {
+ return this.J;
+ }
+
+ public void l(String s) {
+ this.J = s;
+ }
+
+ public boolean H() {
+ return this.J != null;
+ }
+
+ public String I() {
+ return this.K;
+ }
+
+ public void m(String s) {
+ this.K = s;
+ }
+
+ public void a(KeyPair keypair) {
+ this.I = keypair;
+ }
+
+ public void c(int i) {
+ // CraftBukkit start
+ for (int j = 0; j < this.worlds.size(); ++j) {
+ WorldServer worldserver = this.worlds.get(j);
+ // CraftBukkit end
+
+ if (worldserver != null) {
+ if (worldserver.getWorldData().isHardcore()) {
+ worldserver.difficulty = 3;
+ worldserver.setSpawnFlags(true, true);
+ } else if (this.H()) {
+ worldserver.difficulty = i;
+ worldserver.setSpawnFlags(worldserver.difficulty > 0, true);
+ } else {
+ worldserver.difficulty = i;
+ worldserver.setSpawnFlags(this.getSpawnMonsters(), this.spawnAnimals);
+ }
+ }
+ }
+ }
+
+ protected boolean getSpawnMonsters() {
+ return true;
+ }
+
+ public boolean L() {
+ return this.demoMode;
+ }
+
+ public void b(boolean flag) {
+ this.demoMode = flag;
+ }
+
+ public void c(boolean flag) {
+ this.N = flag;
+ }
+
+ public Convertable getConvertable() {
+ return this.convertable;
+ }
+
+ public void O() {
+ this.O = true;
+ this.getConvertable().d();
+
+ // CraftBukkit start - This needs review, what does it do? (it's new)
+ for (int i = 0; i < this.worlds.size(); ++i) {
+ WorldServer worldserver = this.worlds.get(i);
+ // CraftBukkit end
+
+ if (worldserver != null) {
+ worldserver.saveLevel();
+ }
+ }
+
+ this.getConvertable().e(this.worlds.get(0).getDataManager().g());
+ this.safeShutdown();
+ }
+
+ public String getTexturePack() {
+ return this.P;
+ }
+
+ public void setTexturePack(String s) {
+ this.P = s;
+ }
+
+ public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
+ mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(false));
+ mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(0));
+ mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.x()));
+ mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.y()));
+ mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.t.getSeenPlayers().length));
+ mojangstatisticsgenerator.a("uses_auth", Boolean.valueOf(this.onlineMode));
+ mojangstatisticsgenerator.a("gui_state", this.ae() ? "enabled" : "disabled");
+ mojangstatisticsgenerator.a("avg_tick_ms", Integer.valueOf((int) (MathHelper.a(this.j) * 1.0E-6D)));
+ mojangstatisticsgenerator.a("avg_sent_packet_count", Integer.valueOf((int) MathHelper.a(this.f)));
+ mojangstatisticsgenerator.a("avg_sent_packet_size", Integer.valueOf((int) MathHelper.a(this.g)));
+ mojangstatisticsgenerator.a("avg_rec_packet_count", Integer.valueOf((int) MathHelper.a(this.h)));
+ mojangstatisticsgenerator.a("avg_rec_packet_size", Integer.valueOf((int) MathHelper.a(this.i)));
+ int i = 0;
+
+ // CraftBukkit start
+ for (int j = 0; j < this.worlds.size(); ++j) {
+ // if (this.worldServer[j] != null) {
+ WorldServer worldserver = this.worlds.get(j);
+ // CraftBukkit end
+ WorldData worlddata = worldserver.getWorldData();
+
+ mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.dimension));
+ mojangstatisticsgenerator.a("world[" + i + "][mode]", worlddata.getGameType());
+ mojangstatisticsgenerator.a("world[" + i + "][difficulty]", Integer.valueOf(worldserver.difficulty));
+ mojangstatisticsgenerator.a("world[" + i + "][hardcore]", Boolean.valueOf(worlddata.isHardcore()));
+ 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.F().getLoadedChunks()));
+ ++i;
+ // } // CraftBukkit
+ }
+
+ mojangstatisticsgenerator.a("worlds", Integer.valueOf(i));
+ }
+
+ public void b(MojangStatisticsGenerator mojangstatisticsgenerator) {
+ mojangstatisticsgenerator.a("singleplayer", Boolean.valueOf(this.H()));
+ mojangstatisticsgenerator.a("server_brand", this.getServerModName());
+ mojangstatisticsgenerator.a("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
+ mojangstatisticsgenerator.a("dedicated", Boolean.valueOf(this.S()));
+ }
+
+ public boolean getSnooperEnabled() {
+ return true;
+ }
+
+ public int R() {
+ return 16;
+ }
+
+ public abstract boolean S();
+
+ public boolean getOnlineMode() {
+ return this.onlineMode;
+ }
+
+ public void setOnlineMode(boolean flag) {
+ this.onlineMode = flag;
+ }
+
+ public boolean getSpawnAnimals() {
+ return this.spawnAnimals;
+ }
+
+ public void setSpawnAnimals(boolean flag) {
+ this.spawnAnimals = flag;
+ }
+
+ public boolean getSpawnNPCs() {
+ return this.spawnNPCs;
+ }
+
+ public void setSpawnNPCs(boolean flag) {
+ this.spawnNPCs = flag;
+ }
+
+ public boolean getPvP() {
+ return this.pvpMode;
+ }
+
+ public void setPvP(boolean flag) {
+ this.pvpMode = flag;
+ }
+
+ public boolean getAllowFlight() {
+ return this.allowFlight;
+ }
+
+ public void setAllowFlight(boolean flag) {
+ this.allowFlight = flag;
+ }
+
+ public String getMotd() {
+ return this.motd;
+ }
+
+ public void setMotd(String s) {
+ this.motd = s;
+ }
+
+ public int getMaxBuildHeight() {
+ return this.D;
+ }
+
+ public void d(int i) {
+ this.D = i;
+ }
+
+ public boolean isStopped() {
+ return this.isStopped;
+ }
+
+ public ServerConfigurationManagerAbstract getServerConfigurationManager() {
+ return this.t;
+ }
+
+ public void a(ServerConfigurationManagerAbstract serverconfigurationmanagerabstract) {
+ this.t = serverconfigurationmanagerabstract;
+ }
+
+ public void a(EnumGamemode enumgamemode) {
+ // CraftBukkit start
+ for (int i = 0; i < this.worlds.size(); ++i) {
+ getServer().worlds.get(i).getWorldData().setGameType(enumgamemode);
+ // CraftBukkit end
+ }
+ }
+
+ public abstract ServerConnection ac();
+
+ public boolean ae() {
+ return false;
+ }
+
+ public abstract String a(EnumGamemode enumgamemode, boolean flag);
+
+ public int af() {
+ return this.ticks;
+ }
+
+ public void ag() {
+ this.T = true;
}
- public static boolean isRunning(MinecraftServer minecraftserver) {
- return minecraftserver.isRunning;
+ public static ServerConfigurationManagerAbstract a(MinecraftServer minecraftserver) {
+ return minecraftserver.t;
}
}
diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java
index 5907ebe7..28785a01 100644
--- a/src/main/java/net/minecraft/server/MobEffectList.java
+++ b/src/main/java/net/minecraft/server/MobEffectList.java
@@ -10,25 +10,25 @@ public class MobEffectList {
public static final MobEffectList[] byId = new MobEffectList[32];
public static final MobEffectList b = null;
- public static final MobEffectList FASTER_MOVEMENT = (new MobEffectList(1, false, 8171462)).a("potion.moveSpeed").a(0, 0);
- public static final MobEffectList SLOWER_MOVEMENT = (new MobEffectList(2, true, 5926017)).a("potion.moveSlowdown").a(1, 0);
- public static final MobEffectList FASTER_DIG = (new MobEffectList(3, false, 14270531)).a("potion.digSpeed").a(2, 0).a(1.5D);
- public static final MobEffectList SLOWER_DIG = (new MobEffectList(4, true, 4866583)).a("potion.digSlowDown").a(3, 0);
- public static final MobEffectList INCREASE_DAMAGE = (new MobEffectList(5, false, 9643043)).a("potion.damageBoost").a(4, 0);
- public static final MobEffectList HEAL = (new InstantMobEffect(6, false, 16262179)).a("potion.heal");
- public static final MobEffectList HARM = (new InstantMobEffect(7, true, 4393481)).a("potion.harm");
- public static final MobEffectList JUMP = (new MobEffectList(8, false, 7889559)).a("potion.jump").a(2, 1);
- public static final MobEffectList CONFUSION = (new MobEffectList(9, true, 5578058)).a("potion.confusion").a(3, 1).a(0.25D);
- public static final MobEffectList REGENERATION = (new MobEffectList(10, false, 13458603)).a("potion.regeneration").a(7, 0).a(0.25D);
- public static final MobEffectList RESISTANCE = (new MobEffectList(11, false, 10044730)).a("potion.resistance").a(6, 1);
- public static final MobEffectList FIRE_RESISTANCE = (new MobEffectList(12, false, 14981690)).a("potion.fireResistance").a(7, 1);
- public static final MobEffectList WATER_BREATHING = (new MobEffectList(13, false, 3035801)).a("potion.waterBreathing").a(0, 2);
- public static final MobEffectList INVISIBILITY = (new MobEffectList(14, false, 8356754)).a("potion.invisibility").a(0, 1).e();
- public static final MobEffectList BLINDNESS = (new MobEffectList(15, true, 2039587)).a("potion.blindness").a(5, 1).a(0.25D);
- public static final MobEffectList NIGHT_VISION = (new MobEffectList(16, false, 2039713)).a("potion.nightVision").a(4, 1).e();
- public static final MobEffectList HUNGER = (new MobEffectList(17, true, 5797459)).a("potion.hunger").a(1, 1);
- public static final MobEffectList WEAKNESS = (new MobEffectList(18, true, 4738376)).a("potion.weakness").a(5, 0);
- public static final MobEffectList POISON = (new MobEffectList(19, true, 5149489)).a("potion.poison").a(6, 0).a(0.25D);
+ public static final MobEffectList FASTER_MOVEMENT = (new MobEffectList(1, false, 8171462)).b("potion.moveSpeed").b(0, 0);
+ public static final MobEffectList SLOWER_MOVEMENT = (new MobEffectList(2, true, 5926017)).b("potion.moveSlowdown").b(1, 0);
+ public static final MobEffectList FASTER_DIG = (new MobEffectList(3, false, 14270531)).b("potion.digSpeed").b(2, 0).a(1.5D);
+ public static final MobEffectList SLOWER_DIG = (new MobEffectList(4, true, 4866583)).b("potion.digSlowDown").b(3, 0);
+ public static final MobEffectList INCREASE_DAMAGE = (new MobEffectList(5, false, 9643043)).b("potion.damageBoost").b(4, 0);
+ public static final MobEffectList HEAL = (new InstantMobEffect(6, false, 16262179)).b("potion.heal");
+ public static final MobEffectList HARM = (new InstantMobEffect(7, true, 4393481)).b("potion.harm");
+ public static final MobEffectList JUMP = (new MobEffectList(8, false, 7889559)).b("potion.jump").b(2, 1);
+ public static final MobEffectList CONFUSION = (new MobEffectList(9, true, 5578058)).b("potion.confusion").b(3, 1).a(0.25D);
+ public static final MobEffectList REGENERATION = (new MobEffectList(10, false, 13458603)).b("potion.regeneration").b(7, 0).a(0.25D);
+ public static final MobEffectList RESISTANCE = (new MobEffectList(11, false, 10044730)).b("potion.resistance").b(6, 1);
+ public static final MobEffectList FIRE_RESISTANCE = (new MobEffectList(12, false, 14981690)).b("potion.fireResistance").b(7, 1);
+ public static final MobEffectList WATER_BREATHING = (new MobEffectList(13, false, 3035801)).b("potion.waterBreathing").b(0, 2);
+ public static final MobEffectList INVISIBILITY = (new MobEffectList(14, false, 8356754)).b("potion.invisibility").b(0, 1).h();
+ public static final MobEffectList BLINDNESS = (new MobEffectList(15, true, 2039587)).b("potion.blindness").b(5, 1).a(0.25D);
+ public static final MobEffectList NIGHT_VISION = (new MobEffectList(16, false, 2039713)).b("potion.nightVision").b(4, 1).h();
+ public static final MobEffectList HUNGER = (new MobEffectList(17, true, 5797459)).b("potion.hunger").b(1, 1);
+ public static final MobEffectList WEAKNESS = (new MobEffectList(18, true, 4738376)).b("potion.weakness").b(5, 0);
+ public static final MobEffectList POISON = (new MobEffectList(19, true, 5149489)).b("potion.poison").b(6, 0).a(0.25D);
public static final MobEffectList v = null;
public static final MobEffectList w = null;
public static final MobEffectList x = null;
@@ -64,7 +64,7 @@ public class MobEffectList {
org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType(this)); // CraftBukkit
}
- protected MobEffectList a(int i, int j) {
+ protected MobEffectList b(int i, int j) {
this.J = i + j * 8;
return this;
}
@@ -89,9 +89,9 @@ public class MobEffectList {
// CraftBukkit end
}
} else if (this.id == HUNGER.id && entityliving instanceof EntityHuman) {
- ((EntityHuman) entityliving).c(0.025F * (float) (i + 1));
- } else if ((this.id != HEAL.id || entityliving.aN()) && (this.id != HARM.id || !entityliving.aN())) {
- if (this.id == HARM.id && !entityliving.aN() || this.id == HEAL.id && entityliving.aN()) {
+ ((EntityHuman) entityliving).j(0.025F * (float) (i + 1));
+ } else if ((this.id != HEAL.id || entityliving.br()) && (this.id != HARM.id || !entityliving.br())) {
+ if (this.id == HARM.id && !entityliving.br() || this.id == HEAL.id && entityliving.br()) {
// CraftBukkit start
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, entityliving, EntityDamageEvent.DamageCause.MAGIC, 6 << i);
@@ -114,10 +114,9 @@ public class MobEffectList {
// CraftBukkit end
int j;
- if ((this.id != HEAL.id || entityliving1.aN()) && (this.id != HARM.id || !entityliving1.aN())) {
- if (this.id == HARM.id && !entityliving1.aN() || this.id == HEAL.id && entityliving1.aN()) {
+ if ((this.id != HEAL.id || entityliving1.br()) && (this.id != HARM.id || !entityliving1.br())) {
+ if (this.id == HARM.id && !entityliving1.br() || this.id == HEAL.id && entityliving1.br()) {
j = (int) (d0 * (double) (6 << i) + 0.5D);
-
if (entityliving == null) {
entityliving1.damageEntity(DamageSource.MAGIC, j);
} else {
@@ -135,7 +134,7 @@ public class MobEffectList {
return false;
}
- public boolean b(int i, int j) {
+ public boolean a(int i, int j) {
if (this.id != REGENERATION.id && this.id != POISON.id) {
return this.id == HUNGER.id;
} else {
@@ -145,12 +144,12 @@ public class MobEffectList {
}
}
- public MobEffectList a(String s) {
+ public MobEffectList b(String s) {
this.I = s;
return this;
}
- public String c() {
+ public String a() {
return this.I;
}
@@ -163,16 +162,16 @@ public class MobEffectList {
return this.L;
}
- public MobEffectList e() {
+ public MobEffectList h() {
this.M = true;
return this;
}
- public boolean f() {
+ public boolean i() {
return this.M;
}
- public int g() {
+ public int j() {
return this.N;
}
}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index 834d2724..cd264824 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -32,14 +32,13 @@ public class NBTTagCompound extends NBTBase {
try {
dataoutput.writeByte(0);
} catch (java.io.IOException ex) {
- java.util.logging.Logger.getLogger(NBTTagCompound.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ ex.printStackTrace();
}
}
public void remove(String name) {
map.remove(name);
}
-
// CraftBukkit end
void load(DataInput datainput) {
@@ -52,7 +51,7 @@ public class NBTTagCompound extends NBTBase {
}
}
- public Collection d() {
+ public Collection c() {
return this.map.values();
}
diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java
index 89404afd..2532c754 100644
--- a/src/main/java/net/minecraft/server/NetLoginHandler.java
+++ b/src/main/java/net/minecraft/server/NetLoginHandler.java
@@ -1,42 +1,47 @@
package net.minecraft.server;
+import java.net.InetAddress;
import java.net.Socket;
-import java.util.Iterator;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.util.Arrays;
import java.util.Random;
import java.util.logging.Logger;
+import javax.crypto.SecretKey;
public class NetLoginHandler extends NetHandler {
+ private byte[] d;
public static Logger logger = Logger.getLogger("Minecraft");
private static Random random = new Random();
public NetworkManager networkManager;
public boolean c = false;
private MinecraftServer server;
- private int f = 0;
- private String g = null;
- private Packet1Login h = null;
+ private int g = 0;
+ private String h = null;
+ private volatile boolean i = false;
private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix
+ private SecretKey k = null;
public String hostname = ""; // CraftBukkit - add field
public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) {
this.server = minecraftserver;
- this.networkManager = new NetworkManager(socket, s, this);
- this.networkManager.f = 0;
+ this.networkManager = new NetworkManager(socket, s, this, minecraftserver.E().getPrivate());
+ this.networkManager.e = 0;
}
// CraftBukkit start
public Socket getSocket() {
- return this.networkManager.socket;
+ return this.networkManager.getSocket();
}
// CraftBukkit end
- public void a() {
- if (this.h != null) {
- this.b(this.h);
- this.h = null;
+ public void c() {
+ if (this.i) {
+ this.d();
}
- if (this.f++ == 600) {
+ if (this.g++ == 600) {
this.disconnect("Took too long to log in");
} else {
this.networkManager.b();
@@ -55,90 +60,66 @@ public class NetLoginHandler extends NetHandler {
}
public void a(Packet2Handshake packet2handshake) {
- // CraftBukkit start - 1.3 detection
- if (packet2handshake.a == null) {
- disconnect("Outdated server!");
- return;
- }
- // CraftBukkit end
// CraftBukkit start
- int i = packet2handshake.a.indexOf(';');
- if (i == -1) {
- this.hostname = "";
- } else this.hostname = packet2handshake.a.substring(i + 1);
+ this.hostname = packet2handshake.c == null ? "" : packet2handshake.c;
// CraftBukkit end
- if (this.server.onlineMode) {
- this.loginKey = Long.toString(random.nextLong(), 16);
- this.networkManager.queue(new Packet2Handshake(this.loginKey));
+ this.h = packet2handshake.f();
+ if (!this.h.equals(StripColor.a(this.h))) {
+ this.disconnect("Invalid username!");
} else {
- this.networkManager.queue(new Packet2Handshake("-"));
- }
- }
+ PublicKey publickey = this.server.E().getPublic();
- public void a(Packet1Login packet1login) {
- this.g = packet1login.name;
- if (packet1login.a != 29) {
- if (packet1login.a > 29) {
- this.disconnect("Outdated server!");
- } else {
- this.disconnect("Outdated client!");
- }
- } else {
- if (!this.server.onlineMode) {
- // CraftBukkit start - disallow colour in names
- if (!packet1login.name.equals(org.bukkit.ChatColor.stripColor(packet1login.name))) {
- this.disconnect("Colourful names are not permitted!");
- return;
+ if (packet2handshake.d() != 39) {
+ if (packet2handshake.d() > 39) {
+ this.disconnect("Outdated server!");
+ } else {
+ this.disconnect("Outdated client!");
}
- // CraftBukkit end
- this.b(packet1login);
} else {
- (new ThreadLoginVerifier(this, packet1login, this.server.server)).start(); // CraftBukkit
+ this.loginKey = this.server.getOnlineMode() ? Long.toString(random.nextLong(), 16) : "-";
+ this.d = new byte[4];
+ random.nextBytes(this.d);
+ this.networkManager.queue(new Packet253KeyRequest(this.loginKey, publickey, this.d));
}
}
}
- public void b(Packet1Login packet1login) {
- EntityPlayer entityplayer = this.server.serverConfigurationManager.attemptLogin(this, packet1login.name, this.hostname); // CraftBukkit - add hostname parameter
+ public void a(Packet252KeyResponse packet252keyresponse) {
+ PrivateKey privatekey = this.server.E().getPrivate();
- if (entityplayer != null) {
- //this.server.serverConfigurationManager.b(entityplayer); // CraftBukkit - Moved to attemptLogin
- // entityplayer.a((World) this.server.a(entityplayer.dimension)); // CraftBukkit - set by Entity
- entityplayer.itemInWorldManager.a((WorldServer) entityplayer.world);
- // CraftBukkit - add world and location to 'logged in' message.
- logger.info(this.getName() + " logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.name + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
- WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit
- ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
+ this.k = packet252keyresponse.a(privatekey);
+ if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) {
+ this.disconnect("Invalid client reply");
+ }
- entityplayer.itemInWorldManager.b(worldserver.getWorldData().getGameType());
- NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer);
+ this.networkManager.queue(new Packet252KeyResponse());
+ }
- // CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly.
- int maxPlayers = this.server.serverConfigurationManager.getMaxPlayers();
- if (maxPlayers > 60) {
- maxPlayers = 60;
+ public void a(Packet205ClientCommand packet205clientcommand) {
+ if (packet205clientcommand.a == 0) {
+ if (this.server.getOnlineMode()) {
+ (new ThreadLoginVerifier(this, server.server)).start(); // CraftBukkit - add CraftServer
+ } else {
+ this.i = true;
}
- netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, worldserver.getWorldData().getType(), entityplayer.itemInWorldManager.getGameMode(), worldserver.worldProvider.dimension, (byte) worldserver.difficulty, (byte) worldserver.getHeight(), (byte) maxPlayers));
- entityplayer.getBukkitEntity().sendSupportedChannels();
- // CraftBukkit end
+ }
+ }
- netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
- netserverhandler.sendPacket(new Packet202Abilities(entityplayer.abilities));
- this.server.serverConfigurationManager.a(entityplayer, worldserver);
- // this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
- this.server.serverConfigurationManager.c(entityplayer);
- netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
- this.server.networkListenThread.a(netserverhandler);
- netserverhandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // CraftBukkit - add support for player specific time
- Iterator iterator = entityplayer.getEffects().iterator();
+ public void a(Packet1Login packet1login) {}
- while (iterator.hasNext()) {
- MobEffect mobeffect = (MobEffect) iterator.next();
+ public void d() {
+ // CraftBukkit start
+ EntityPlayer s = this.server.getServerConfigurationManager().attemptLogin(this, this.h, this.hostname);
- netserverhandler.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect));
- }
+ if (s == null) {
+ return;
+ // CraftBukkit end
+ } else {
+ EntityPlayer entityplayer = this.server.getServerConfigurationManager().processLogin(s); // CraftBukkit - this.h -> s
- entityplayer.syncInventory();
+ if (entityplayer != null) {
+ this.server.getServerConfigurationManager().a((INetworkManager) this.networkManager, entityplayer);
+ }
}
this.c = true;
@@ -153,14 +134,22 @@ public class NetLoginHandler extends NetHandler {
if (this.networkManager.getSocket() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
try {
// CraftBukkit start
- org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.motd, this.server.serverConfigurationManager.getPlayerCount(), this.server.serverConfigurationManager.getMaxPlayers());
- String s = pingEvent.getMotd() + "\u00A7" + this.server.serverConfigurationManager.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
+ org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), this.server.getServerConfigurationManager().getPlayerCount(), this.server.getServerConfigurationManager().getMaxPlayers());
+ String s = pingEvent.getMotd() + "\u00A7" + this.server.getServerConfigurationManager().getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
// CraftBukkit end
- this.server.networkListenThread.a(this.networkManager.getSocket()); // CraftBukkit - cleanup before killing connection
+ InetAddress inetaddress = null;
+
+ if (this.networkManager.getSocket() != null) {
+ inetaddress = this.networkManager.getSocket().getInetAddress();
+ }
+
this.networkManager.queue(new Packet255KickDisconnect(s));
this.networkManager.d();
- // this.server.networkListenThread.a(this.networkManager.getSocket()); // CraftBukkit - moved up
+ if (inetaddress != null && this.server.ac() instanceof DedicatedServerConnection) {
+ ((DedicatedServerConnection) this.server.ac()).a(inetaddress);
+ }
+
this.c = true;
} catch (Exception exception) {
exception.printStackTrace();
@@ -172,10 +161,10 @@ public class NetLoginHandler extends NetHandler {
}
public String getName() {
- return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
+ return this.h != null ? this.h + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
}
- public boolean c() {
+ public boolean a() {
return true;
}
@@ -183,7 +172,19 @@ public class NetLoginHandler extends NetHandler {
return netloginhandler.loginKey;
}
- static Packet1Login a(NetLoginHandler netloginhandler, Packet1Login packet1login) {
- return netloginhandler.h = packet1login;
+ static MinecraftServer b(NetLoginHandler netloginhandler) {
+ return netloginhandler.server;
+ }
+
+ static SecretKey c(NetLoginHandler netloginhandler) {
+ return netloginhandler.k;
+ }
+
+ static String d(NetLoginHandler netloginhandler) {
+ return netloginhandler.h;
+ }
+
+ static boolean a(NetLoginHandler netloginhandler, boolean flag) {
+ return netloginhandler.i = flag;
}
}
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index afead300..b6d1f298 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -1,6 +1,10 @@
package net.minecraft.server;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.Random;
import java.util.logging.Logger;
@@ -10,7 +14,6 @@ import java.util.logging.Level;
import java.util.HashSet;
import org.bukkit.Location;
-import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.entity.CraftPlayer;
@@ -29,7 +32,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent;
-import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.inventory.*;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.player.PlayerToggleFlightEvent;
@@ -37,10 +39,10 @@ import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.InventoryView;
// CraftBukkit end
-public class NetServerHandler extends NetHandler implements ICommandListener {
+public class NetServerHandler extends NetHandler {
public static Logger logger = Logger.getLogger("Minecraft");
- public NetworkManager networkManager;
+ public INetworkManager networkManager;
public boolean disconnected = false;
private MinecraftServer minecraftServer;
public EntityPlayer player; // CraftBukkit - private -> public
@@ -56,13 +58,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
private double y;
private double z;
private double q;
- private boolean checkMovement = true;
+ public boolean checkMovement = true; // CraftBukkit - private -> public
private IntHashMap s = new IntHashMap();
- public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
+ public NetServerHandler(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
- this.networkManager = networkmanager;
- networkmanager.a((NetHandler) this);
+ this.networkManager = inetworkmanager;
+ inetworkmanager.a(this);
this.player = entityplayer;
entityplayer.netServerHandler = this;
@@ -96,10 +98,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
private final static HashSet<Integer> invalidItems = new HashSet<Integer>(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 51, 52, 55, 59, 60, 63, 64, 68, 71, 75, 78, 83, 90, 92, 93, 94, 95));
// CraftBukkit end
- public void a() {
+ public void d() {
this.h = false;
++this.f;
+ // this.minecraftServer.methodProfiler.a("packetflow"); // CraftBukkit - not in production code
this.networkManager.b();
+ // this.minecraftServer.methodProfiler.c("keepAlive"); // CraftBukkit - not in production code
if ((long) this.f - this.l > 20L) {
this.l = (long) this.f;
this.j = System.nanoTime() / 1000000L;
@@ -114,6 +118,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (this.x > 0) {
--this.x;
}
+
+ // this.minecraftServer.methodProfiler.c("playerTick"); // CraftBukkit - not in production code
+ if (!this.h && !this.player.viewingCredits) {
+ this.player.g();
+ }
+
+ // this.minecraftServer.methodProfiler.b(); // CraftBukkit - not in production code
}
public void disconnect(String s) {
@@ -132,19 +143,19 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
s = event.getReason();
// CraftBukkit end
- this.player.I();
+ this.player.m();
this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d();
// CraftBukkit start
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null && leaveMessage.length() > 0) {
- this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(leaveMessage));
+ this.minecraftServer.getServerConfigurationManager().sendAll(new Packet3Chat(leaveMessage));
}
getPlayer().disconnect(s);
// CraftBukkit end
- this.minecraftServer.serverConfigurationManager.disconnect(this.player);
+ this.minecraftServer.getServerConfigurationManager().disconnect(this.player);
this.disconnected = true;
}
}
@@ -238,7 +249,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
float f = this.player.yaw;
float f1 = this.player.pitch;
- this.player.vehicle.i_();
+ this.player.vehicle.V();
d1 = this.player.locX;
d2 = this.player.locY;
d3 = this.player.locZ;
@@ -258,12 +269,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
// CraftBukkit end
+
d5 = packet10flying.x;
d4 = packet10flying.z;
}
this.player.onGround = packet10flying.g;
- this.player.a(true);
+ this.player.g();
this.player.move(d5, 0.0D, d4);
this.player.setLocation(d1, d2, d3, f, f1);
this.player.motX = d5;
@@ -273,10 +285,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
if (this.player.vehicle != null) {
- this.player.vehicle.i_();
+ this.player.vehicle.V();
}
- this.minecraftServer.serverConfigurationManager.d(this.player);
+ this.minecraftServer.getServerConfigurationManager().d(this.player);
this.y = this.player.locX;
this.z = this.player.locY;
this.q = this.player.locZ;
@@ -285,7 +297,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
if (this.player.isSleeping()) {
- this.player.a(true);
+ this.player.g();
this.player.setLocation(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
worldserver.playerJoinedWorld(this.player);
return;
@@ -327,8 +339,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
f3 = packet10flying.pitch;
}
- this.player.a(true);
- this.player.bO = 0.0F;
+ this.player.g();
+ this.player.V = 0.0F;
this.player.setLocation(this.y, this.z, this.q, f2, f3);
if (!this.checkMovement) {
return;
@@ -337,25 +349,31 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
d4 = d1 - this.player.locX;
double d6 = d2 - this.player.locY;
double d7 = d3 - this.player.locZ;
- double d8 = d4 * d4 + d6 * d6 + d7 * d7;
-
- if (d8 > 100.0D && this.checkMovement) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
- logger.warning(this.player.name + " moved too quickly!");
+ double d8 = Math.min(Math.abs(d4), Math.abs(this.player.motX));
+ double d9 = Math.min(Math.abs(d6), Math.abs(this.player.motY));
+ double d10 = Math.min(Math.abs(d7), Math.abs(this.player.motZ));
+ double d11 = d8 * d8 + d9 * d9 + d10 * d10;
+
+ if (d11 > 100.0D && this.checkMovement && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(this.player.name))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
+ logger.warning(this.player.name + " moved too quickly! " + d4 + "," + d6 + "," + d7 + " (" + d8 + ", " + d9 + ", " + d10 + ")");
+ // CraftBukkit start - temporarily switch back to kicking
+ // this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
this.disconnect("You moved too quickly :( (Hacking?)");
+ // CraftBukkit end
return;
}
float f4 = 0.0625F;
- boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
+ boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
if (this.player.onGround && !packet10flying.g && d6 > 0.0D) {
- this.player.c(0.2F);
+ this.player.j(0.2F);
}
this.player.move(d4, d6, d7);
this.player.onGround = packet10flying.g;
this.player.checkMovement(d4, d6, d7);
- double d9 = d6;
+ double d12 = d6;
d4 = d1 - this.player.locX;
d6 = d2 - this.player.locY;
@@ -364,18 +382,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
d7 = d3 - this.player.locZ;
- d8 = d4 * d4 + d6 * d6 + d7 * d7;
+ d11 = d4 * d4 + d6 * d6 + d7 * d7;
boolean flag1 = false;
- if (d8 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.isCreative()) {
+ if (d11 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.isCreative()) {
flag1 = true;
logger.warning(this.player.name + " moved wrongly!");
- System.out.println("Got position " + d1 + ", " + d2 + ", " + d3);
- System.out.println("Expected " + this.player.locX + ", " + this.player.locY + ", " + this.player.locZ);
}
this.player.setLocation(d1, d2, d3, f2, f3);
- boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
+ boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
if (flag && (flag1 || !flag2) && !this.player.isSleeping()) {
this.a(this.y, this.z, this.q, f2, f3);
@@ -384,8 +400,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().grow((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D);
- if (!this.minecraftServer.allowFlight && !this.player.abilities.canFly && !worldserver.b(axisalignedbb)) { // CraftBukkit - check abilities instead of creative mode
- if (d9 >= -0.03125D) {
+ if (!this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !worldserver.c(axisalignedbb)) { // CraftBukkit - check abilities instead of creative mode
+ if (d12 >= -0.03125D) {
++this.g;
if (this.g > 80) {
logger.warning(this.player.name + " was kicked for floating too long!");
@@ -398,7 +414,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
this.player.onGround = packet10flying.g;
- this.minecraftServer.serverConfigurationManager.d(this.player);
+ this.minecraftServer.getServerConfigurationManager().d(this.player);
if (this.player.itemInWorldManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
this.player.b(this.player.locY - d0, packet10flying.g);
}
@@ -475,11 +491,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
// CraftBukkit end
- this.player.S();
+ this.player.bB();
} else if (packet14blockdig.e == 5) {
- this.player.N();
+ this.player.by();
} else {
- boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
+ boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || this.minecraftServer.H(); // CraftBukkit
boolean flag1 = false;
if (packet14blockdig.e == 0) {
@@ -504,7 +520,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
- if (j >= this.minecraftServer.t) {
+ if (j >= this.minecraftServer.getMaxBuildHeight()) {
return;
}
}
@@ -531,6 +547,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (worldserver.getTypeId(i, j, k) != 0) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
}
+ } else if (packet14blockdig.e == 1) {
+ this.player.itemInWorldManager.c(i, j, k);
+ if (worldserver.getTypeId(i, j, k) != 0) {
+ this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
+ }
} else if (packet14blockdig.e == 3) {
double d4 = this.player.locX - ((double) i + 0.5D);
double d5 = this.player.locY - ((double) j + 0.5D);
@@ -560,13 +581,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// second one. This sadly has to remain until Mojang makes their packets saner. :(
// -- Grum
- if (packet15place.face == 255) {
- if (packet15place.itemstack != null && packet15place.itemstack.id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) {
+ if (packet15place.getFace() == 255) {
+ if (packet15place.getItemStack() != null && packet15place.getItemStack().id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) {
this.lastPacket = null;
return;
}
} else {
- this.lastMaterial = packet15place.itemstack == null ? -1 : packet15place.itemstack.id;
+ this.lastMaterial = packet15place.getItemStack() == null ? -1 : packet15place.getItemStack().id;
this.lastPacket = packet15place.timestamp;
}
@@ -579,13 +600,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
ItemStack itemstack = this.player.inventory.getItemInHand();
boolean flag = false;
- int i = packet15place.a;
- int j = packet15place.b;
- int k = packet15place.c;
- int l = packet15place.face;
- boolean flag1 = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
+ int i = packet15place.d();
+ int j = packet15place.f();
+ int k = packet15place.g();
+ int l = packet15place.getFace();
+ boolean flag1 = worldserver.weirdIsOpCache = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || this.minecraftServer.H();
- if (packet15place.face == 255) {
+ if (packet15place.getFace() == 255) {
if (itemstack == null) {
return;
}
@@ -602,8 +623,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// inventory update packet to get sent
always = (itemstack.count != itemstackAmount);
// CraftBukkit end
- } else if (packet15place.b >= this.minecraftServer.t - 1 && (packet15place.face == 1 || packet15place.b >= this.minecraftServer.t)) {
- this.player.netServerHandler.sendPacket(new Packet3Chat("\u00A77Height limit for building is " + this.minecraftServer.t));
+ } else if (packet15place.f() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packet15place.getFace() == 1 || packet15place.f() >= this.minecraftServer.getMaxBuildHeight())) {
+ this.player.netServerHandler.sendPacket(new Packet3Chat("\u00A77Height limit for building is " + this.minecraftServer.getMaxBuildHeight()));
flag = true;
} else {
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
@@ -620,10 +641,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
flag1 = true; // spawn protection moved to ItemBlock!!!
- // CraftBukkit end
-
if (j1 > 16 || flag1) {
- this.player.itemInWorldManager.interact(this.player, worldserver, itemstack, i, j, k, l);
+ // CraftBukkit end
+ this.player.itemInWorldManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.l(), packet15place.m());
}
flag = true;
@@ -664,16 +684,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
itemstack = null;
}
- if (itemstack == null || itemstack.l() == 0) {
+ if (itemstack == null || itemstack.m() == 0) {
this.player.h = true;
this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]);
Slot slot = this.player.activeContainer.a((IInventory) this.player.inventory, this.player.inventory.itemInHandIndex);
- this.player.activeContainer.a();
+ this.player.activeContainer.b();
this.player.h = false;
// CraftBukkit - TODO CHECK IF NEEDED -- new if structure might not need 'always'. Kept it in for now, but may be able to remove in future
- if (!ItemStack.matches(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
- this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.c, this.player.inventory.getItemInHand()));
+ if (!ItemStack.matches(this.player.inventory.getItemInHand(), packet15place.getItemStack()) || always) {
+ this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.d, this.player.inventory.getItemInHand()));
}
}
@@ -685,12 +705,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
logger.info(this.player.name + " lost connection: " + s);
// CraftBukkit start - we need to handle custom quit messages
- String quitMessage = this.minecraftServer.serverConfigurationManager.disconnect(this.player);
+ String quitMessage = this.minecraftServer.getServerConfigurationManager().disconnect(this.player);
if ((quitMessage != null) && (quitMessage.length() > 0)) {
- this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(quitMessage));
+ this.minecraftServer.getServerConfigurationManager().sendAll(new Packet3Chat(quitMessage));
}
// CraftBukkit end
this.disconnected = true;
+ if (this.minecraftServer.H() && this.player.name.equals(this.minecraftServer.G())) {
+ logger.info("Stopping singleplayer server as player logged out");
+ this.minecraftServer.safeShutdown();
+ }
}
public void onUnhandledPacket(Packet packet) {
@@ -700,23 +724,41 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void sendPacket(Packet packet) {
- // CraftBukkit start
- 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 instanceof Packet3Chat) {
- String message = ((Packet3Chat) packet).message;
+ if (packet instanceof Packet3Chat) {
+ Packet3Chat packet3chat = (Packet3Chat) packet;
+ int i = this.player.getChatFlags();
+
+ if (i == 2) {
+ return;
+ }
+
+ if (i == 1 && !packet3chat.isServer()) {
+ return;
+ }
+
+ // CraftBukkit start
+ String message = packet3chat.message;
for (final String line : org.bukkit.craftbukkit.TextWrapper.wrapText(message)) {
this.networkManager.queue(new Packet3Chat(line));
}
- packet = null;
- } else if (packet != null && packet.lowPriority == true) {
+ return;
+ // CraftBukkit end
+ }
+
+ // CraftBukkit start
+ if (packet == null) {
+ return;
+ } 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);
- packet = null;
+ return;
}
- if (packet != null) this.networkManager.queue(packet);
// CraftBukkit end
+
+ this.networkManager.queue(packet);
}
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
@@ -736,22 +778,31 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void a(Packet3Chat packet3chat) {
- String s = packet3chat.message;
-
- if (s.length() > 100) {
- this.disconnect("Chat message too long");
+ if (this.player.getChatFlags() == 2) {
+ this.sendPacket(new Packet3Chat("Cannot send chat message."));
} else {
- s = s.trim();
+ String s = packet3chat.message;
+
+ if (s.length() > 100) {
+ this.disconnect("Chat message too long");
+ } else {
+ s = s.trim();
+
+ for (int i = 0; i < s.length(); ++i) {
+ if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
+ this.disconnect("Illegal characters in chat");
+ return;
+ }
+ }
- for (int i = 0; i < s.length(); ++i) {
- if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
- this.disconnect("Illegal characters in chat");
+ // CraftBukkit start
+ if (this.player.getChatFlags() == 1) {
+ this.sendPacket(new Packet3Chat("Cannot send chat message."));
return;
}
- }
- // CraftBukkit start
- this.chat(s);
+ this.chat(s);
+ }
}
}
@@ -784,17 +835,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
for (Player recipient : event.getRecipients()) {
recipient.sendMessage(s);
}
- // CraftBukkit end
}
this.m += 20;
- if (this.m > 200) {
+ if (this.m > 200 && !this.minecraftServer.getServerConfigurationManager().isOp(this.player.name)) {
this.disconnect("disconnect.spam");
}
}
- return false; // CraftBukkit
+ return false;
}
+ // CraftBukkit end
private void handleCommand(String s) {
// CraftBukkit start
@@ -819,35 +870,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end
/* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above.
- if (s.toLowerCase().startsWith("/me ")) {
- s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim();
- logger.info(s);
- this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s));
- } else if (s.toLowerCase().startsWith("/kill")) {
- this.player.damageEntity(DamageSource.GENERIC, 1000);
- } else if (s.toLowerCase().startsWith("/tell ")) {
- String[] astring = s.split(" ");
-
- if (astring.length >= 3) {
- s = s.substring(s.indexOf(" ")).trim();
- s = s.substring(s.indexOf(" ")).trim();
- s = "\u00A77" + this.player.name + " whispers " + s;
- logger.info(s + " to " + astring[1]);
- if (!this.minecraftServer.serverConfigurationManager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
- this.sendPacket(new Packet3Chat("\u00A7cThere\'s no player by that name online."));
- }
- }
- } else {
- String s1;
-
- if (this.minecraftServer.serverConfigurationManager.isOp(this.player.name)) {
- s1 = s.substring(1);
- logger.info(this.player.name + " issued server command: " + s1);
- this.minecraftServer.issueCommand(s1, this);
- } else {
- s1 = s.substring(1);
- logger.info(this.player.name + " tried command: " + s1);
- }
+ if (this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || "/seed".equals(s)) {
+ logger.info(this.player.name + " issued server command: " + s);
+ this.minecraftServer.getCommandHandler().a(this.player, s);
}
// CraftBukkit end */
}
@@ -863,7 +888,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f;
double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D - (double) this.player.height;
double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f;
- Vec3D vec3d = Vec3D.create(d0, d1, d2);
+ Vec3D vec3d = Vec3D.a().create(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
@@ -886,7 +911,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (event.isCancelled()) return;
// CraftBukkit end
- this.player.C_();
+ this.player.i();
}
}
@@ -914,15 +939,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end
if (packet19entityaction.animation == 1) {
- this.player.setSneak(true);
+ this.player.setSneaking(true);
} else if (packet19entityaction.animation == 2) {
- this.player.setSneak(false);
+ this.player.setSneaking(false);
} else if (packet19entityaction.animation == 4) {
this.player.setSprinting(true);
} else if (packet19entityaction.animation == 5) {
this.player.setSprinting(false);
} else if (packet19entityaction.animation == 3) {
- if (this.player.fauxSleeping && !this.player.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
this.player.a(false, true, true);
this.checkMovement = false;
}
@@ -939,14 +963,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return this.networkManager.e();
}
- public void sendMessage(String s) {
- this.sendPacket(new Packet3Chat("\u00A77" + s));
- }
-
- public String getName() {
- return this.player.name;
- }
-
public void a(Packet7UseEntity packet7useentity) {
if (this.player.dead) return; // CraftBukkit
@@ -954,14 +970,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
Entity entity = worldserver.getEntity(packet7useentity.target);
if (entity != null) {
- boolean flag = this.player.h(entity);
+ boolean flag = this.player.l(entity);
double d0 = 36.0D;
if (!flag) {
d0 = 9.0D;
}
- if (this.player.j(entity) < d0) {
+ if (this.player.e(entity) < d0) {
ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit
if (packet7useentity.action == 0) {
// CraftBukkit start
@@ -972,7 +988,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
// CraftBukkit end
- this.player.e(entity);
+ this.player.m(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);
@@ -996,57 +1012,45 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
- public void a(Packet9Respawn packet9respawn) {
- if (this.player.viewingCredits) {
- // CraftBukkit start
- org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent();
- Location toLocation;
-
- if (this.player.getBukkitEntity().getBedSpawnLocation() == null) {
- CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0);
- ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn();
- toLocation = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
- this.player.netServerHandler.sendPacket(new Packet70Bed(0, 0));
- } else {
- toLocation = this.player.getBukkitEntity().getBedSpawnLocation();
- toLocation = new Location(toLocation.getWorld(), toLocation.getX() + 0.5, toLocation.getY(), toLocation.getZ() + 0.5);
- }
+ public void a(Packet205ClientCommand packet205clientcommand) {
+ if (packet205clientcommand.a == 1) {
+ if (this.player.viewingCredits) {
+ this.player = this.minecraftServer.getServerConfigurationManager().moveToWorld(this.player, 0, true);
+ } else if (this.player.q().getWorldData().isHardcore()) {
+ if (this.minecraftServer.H() && this.player.name.equals(this.minecraftServer.G())) {
+ this.player.netServerHandler.disconnect("You have died. Game over, man, it\'s game over!");
+ this.minecraftServer.O();
+ } else {
+ BanEntry banentry = new BanEntry(this.player.name);
- PlayerPortalEvent event = new PlayerPortalEvent(this.player.getBukkitEntity(), this.player.getBukkitEntity().getLocation(), toLocation, pta, PlayerPortalEvent.TeleportCause.END_PORTAL);
- event.useTravelAgent(false);
+ banentry.setReason("Death in Hardcore");
+ this.minecraftServer.getServerConfigurationManager().getNameBans().add(banentry);
+ this.player.netServerHandler.disconnect("You have died. Game over, man, it\'s game over!");
+ }
+ } else {
+ if (this.player.getHealth() > 0) {
+ return;
+ }
- org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
- this.player = this.minecraftServer.serverConfigurationManager.moveToWorld(this.player, 0, true, event.getTo());
- // CraftBukkit end
- } else {
- if (this.player.getHealth() > 0) {
- return;
+ this.player = this.minecraftServer.getServerConfigurationManager().moveToWorld(this.player, 0, false);
}
-
- this.player = this.minecraftServer.serverConfigurationManager.moveToWorld(this.player, 0, false);
}
- // CraftBukkit start
- this.getPlayer().setHandle(this.player);
- this.player.viewingCredits = false; // allow the player to receive movement packets again.
- // CraftBukkit end
}
- public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
- if (this.player.dead) return; // CraftBukkit
+ public boolean b() {
+ return true;
+ }
- // CraftBukkit start - INVENTORY_CLOSE hook
- InventoryCloseEvent event = new InventoryCloseEvent(this.player.activeContainer.getBukkitView());
- server.getPluginManager().callEvent(event);
- this.player.activeContainer.transferTo(this.player.defaultContainer, getPlayer());
- // CraftBukkit end
+ public void a(Packet9Respawn packet9respawn) {}
- this.player.H();
+ public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
+ this.player.l();
}
public void a(Packet102WindowClick packet102windowclick) {
if (this.player.dead) return; // CraftBukkit
- if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
+ if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.b(this.player)) {
// CraftBukkit start - fire InventoryClickEvent
InventoryView inventory = this.player.activeContainer.getBukkitView();
SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot);
@@ -1093,10 +1097,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
// CraftBukkit end
- if (defaultBehaviour && ItemStack.matches(packet102windowclick.item, itemstack)) { // CraftBukkit - additional condition added
- this.player.netServerHandler.sendPacket((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)));
+ if (ItemStack.matches(packet102windowclick.item, itemstack)) {
+ this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
this.player.h = true;
- this.player.activeContainer.a();
+ this.player.activeContainer.b();
this.player.broadcastCarriedItem();
this.player.h = false;
} else {
@@ -1105,8 +1109,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList();
- for (int i = 0; i < this.player.activeContainer.e.size(); ++i) {
- arraylist.add(((Slot) this.player.activeContainer.e.get(i)).getItem());
+ for (int i = 0; i < this.player.activeContainer.b.size(); ++i) {
+ arraylist.add(((Slot) this.player.activeContainer.b.get(i)).getItem());
}
this.player.a(this.player.activeContainer, arraylist);
@@ -1120,9 +1124,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void a(Packet108ButtonClick packet108buttonclick) {
- if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) {
+ if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.b(this.player)) {
this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b);
- this.player.activeContainer.a();
+ this.player.activeContainer.b();
}
}
@@ -1130,7 +1134,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (this.player.itemInWorldManager.isCreative()) {
boolean flag = packet107setcreativeslot.slot < 0;
ItemStack itemstack = packet107setcreativeslot.b;
- boolean flag1 = packet107setcreativeslot.slot >= 36 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize();
+ boolean flag1 = packet107setcreativeslot.slot >= 1 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize();
// CraftBukkit
boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id);
boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;
@@ -1186,7 +1190,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
EntityItem entityitem = this.player.drop(itemstack);
if (entityitem != null) {
- entityitem.k();
+ entityitem.d();
}
}
}
@@ -1196,7 +1200,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
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.c(this.player)) {
+ if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.b(this.player)) {
this.player.activeContainer.a(this.player, true);
}
}
@@ -1212,7 +1216,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (tileentity instanceof TileEntitySign) {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
- if (!tileentitysign.c()) {
+ if (!tileentitysign.a()) {
this.minecraftServer.warning("Player " + this.player.name + " just tried to change non-editable sign");
this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines)); // CraftBukkit
return;
@@ -1274,17 +1278,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
- public boolean c() {
+ public boolean a() {
return true;
}
public void a(Packet202Abilities packet202abilities) {
// CraftBukkit start
- if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.b) {
- PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.b);
+ if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.f()) {
+ PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.f());
this.server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.player.abilities.isFlying = packet202abilities.b; // Actually set the player's flying status
+ this.player.abilities.isFlying = packet202abilities.f(); // Actually set the player's flying status
}
else {
this.player.updateAbilities(); // Tell the player their ability was reverted
@@ -1293,21 +1297,90 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end
}
- // CraftBukkit start
- @Override
- public void a(Packet250CustomPayload packet) {
- if (packet.tag.equals("REGISTER")) {
+ public void a(Packet203TabComplete packet203tabcomplete) {
+ StringBuilder stringbuilder = new StringBuilder();
+
+ String s;
+
+ for (Iterator iterator = this.minecraftServer.a((ICommandListener) this.player, packet203tabcomplete.d()).iterator(); iterator.hasNext(); stringbuilder.append(s)) {
+ s = (String) iterator.next();
+ if (stringbuilder.length() > 0) {
+ stringbuilder.append('\0'); // CraftBukkit - fix decompile issue
+ }
+ }
+
+ this.player.netServerHandler.sendPacket(new Packet203TabComplete(stringbuilder.toString()));
+ }
+
+ public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
+ this.player.a(packet204localeandviewdistance);
+ }
+
+ public void a(Packet250CustomPayload packet250custompayload) {
+ DataInputStream datainputstream;
+ ItemStack itemstack;
+ ItemStack itemstack1;
+
+ if ("MC|BEdit".equals(packet250custompayload.tag)) {
+ try {
+ datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
+ itemstack = Packet.c(datainputstream);
+ if (!ItemBookAndQuill.a(itemstack.getTag())) {
+ throw new IOException("Invalid book tag!");
+ }
+
+ itemstack1 = this.player.inventory.getItemInHand();
+ if (itemstack != null && itemstack.id == Item.BOOK_AND_QUILL.id && itemstack.id == itemstack1.id) {
+ itemstack1.setTag(itemstack.getTag());
+ }
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ } else if ("MC|BSign".equals(packet250custompayload.tag)) {
try {
- String channels = new String(packet.data, "UTF8");
+ datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
+ itemstack = Packet.c(datainputstream);
+ if (!ItemWrittenBook.a(itemstack.getTag())) {
+ throw new IOException("Invalid book tag!");
+ }
+
+ itemstack1 = this.player.inventory.getItemInHand();
+ if (itemstack != null && itemstack.id == Item.WRITTEN_BOOK.id && itemstack1.id == Item.BOOK_AND_QUILL.id) {
+ itemstack1.setTag(itemstack.getTag());
+ itemstack1.id = Item.WRITTEN_BOOK.id;
+ }
+ } catch (Exception exception1) {
+ // CraftBukkit start
+ // exception1.printStackTrace();
+ // CraftBukkit end
+ }
+ } else if ("MC|TrSel".equals(packet250custompayload.tag)) {
+ try {
+ datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
+ int i = datainputstream.readInt();
+ Container container = this.player.activeContainer;
+
+ if (container instanceof ContainerMerchant) {
+ ((ContainerMerchant) container).c(i);
+ }
+ } catch (Exception exception2) {
+ exception2.printStackTrace();
+ }
+ }
+
+ // CraftBukkit start
+ else if (packet250custompayload.tag.equals("REGISTER")) {
+ try {
+ String channels = new String(packet250custompayload.data, "UTF8");
for (String channel : channels.split("\0")) {
getPlayer().addChannel(channel);
}
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, "Could not parse REGISTER payload in plugin message packet", ex);
}
- } else if (packet.tag.equals("UNREGISTER")) {
+ } else if (packet250custompayload.tag.equals("UNREGISTER")) {
try {
- String channels = new String(packet.data, "UTF8");
+ String channels = new String(packet250custompayload.data, "UTF8");
for (String channel : channels.split("\0")) {
getPlayer().removeChannel(channel);
}
@@ -1315,8 +1388,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, "Could not parse UNREGISTER payload in plugin message packet", ex);
}
} else {
- server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet.tag, packet.data);
+ server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data);
}
+ // CraftBukkit end
}
- // CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/NetworkAcceptThread.java b/src/main/java/net/minecraft/server/NetworkAcceptThread.java
deleted file mode 100644
index 97590561..00000000
--- a/src/main/java/net/minecraft/server/NetworkAcceptThread.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package net.minecraft.server;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Socket;
-
-class NetworkAcceptThread extends Thread {
-
- final MinecraftServer a;
-
- final NetworkListenThread listenThread;
-
- long connectionThrottle; // CraftBukkit
-
- NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) {
- super(s);
- this.listenThread = networklistenthread;
- this.a = minecraftserver;
- }
-
- public void run() {
- while (this.listenThread.b) {
- try {
- Socket socket = NetworkListenThread.a(this.listenThread).accept();
-
- if (socket != null) {
- synchronized (NetworkListenThread.getRecentConnectionAttempts(this.listenThread)) {
- InetAddress inetaddress = socket.getInetAddress();
- // CraftBukkit start
- if (this.a.server == null) {
- socket.close();
- continue;
- }
- connectionThrottle = this.a.server.getConnectionThrottle();
- // CraftBukkit end
-
- // CraftBukkit
- if (NetworkListenThread.getRecentConnectionAttempts(this.listenThread).containsKey(inetaddress) && !"127.0.0.1".equals(inetaddress.getHostAddress()) && System.currentTimeMillis() - ((Long) NetworkListenThread.getRecentConnectionAttempts(this.listenThread).get(inetaddress)).longValue() < connectionThrottle) {
- NetworkListenThread.getRecentConnectionAttempts(this.listenThread).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
- socket.close();
- continue;
- }
-
- NetworkListenThread.getRecentConnectionAttempts(this.listenThread).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
- }
-
- NetLoginHandler netloginhandler = new NetLoginHandler(this.a, socket, "Connection #" + NetworkListenThread.c(this.listenThread));
-
- NetworkListenThread.a(this.listenThread, netloginhandler);
- }
- } catch (IOException ioexception) {
- ioexception.printStackTrace();
- }
- }
- }
-}
diff --git a/src/main/java/net/minecraft/server/NetworkListenThread.java b/src/main/java/net/minecraft/server/NetworkListenThread.java
deleted file mode 100644
index 13b10f18..00000000
--- a/src/main/java/net/minecraft/server/NetworkListenThread.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package net.minecraft.server;
-
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-// CraftBukkit start
-import java.util.List;
-import java.util.Collections;
-// CraftBukkit end
-
-public class NetworkListenThread {
-
- public static Logger a = Logger.getLogger("Minecraft");
- private ServerSocket d;
- private Thread e;
- public volatile boolean b = false;
- private int f = 0;
- private List g = Collections.synchronizedList(new ArrayList()); // CraftBukkit - Synchronized
- private List h = Collections.synchronizedList(new ArrayList()); // CraftBukkit - Synchronized
- public MinecraftServer c;
- private HashMap i = new HashMap();
-
- public NetworkListenThread(MinecraftServer minecraftserver, InetAddress inetaddress, int i) throws java.io.IOException { // CraftBukkit
- this.c = minecraftserver;
- this.d = new ServerSocket(i, 0, inetaddress);
- this.d.setPerformancePreferences(0, 2, 1);
- this.b = true;
- this.e = new NetworkAcceptThread(this, "Listen thread", minecraftserver);
- this.e.start();
- }
-
- public void a(Socket socket) {
- InetAddress inetaddress = socket.getInetAddress();
- HashMap hashmap = this.i;
-
- synchronized (this.i) {
- this.i.remove(inetaddress);
- }
- }
-
- public void a(NetServerHandler netserverhandler) {
- this.h.add(netserverhandler);
- }
-
- private void a(NetLoginHandler netloginhandler) {
- if (netloginhandler == null) {
- throw new IllegalArgumentException("Got null pendingconnection!");
- } else {
- this.g.add(netloginhandler);
- }
- }
-
- public void a() {
- int i;
-
- for (i = 0; i < this.g.size(); ++i) {
- NetLoginHandler netloginhandler = (NetLoginHandler) this.g.get(i);
-
- try {
- netloginhandler.a();
- } catch (Exception exception) {
- netloginhandler.disconnect("Internal server error");
- a.log(Level.WARNING, "Failed to handle packet: " + exception, exception);
- }
-
- if (netloginhandler.c) {
- this.g.remove(i--);
- }
-
- netloginhandler.networkManager.a();
- }
-
- for (i = 0; i < this.h.size(); ++i) {
- NetServerHandler netserverhandler = (NetServerHandler) this.h.get(i);
-
- try {
- netserverhandler.a();
- } catch (Exception exception1) {
- a.log(Level.WARNING, "Failed to handle packet: " + exception1, exception1);
- netserverhandler.disconnect("Internal server error");
- }
-
- if (netserverhandler.disconnected) {
- this.h.remove(i--);
- }
-
- netserverhandler.networkManager.a();
- }
- }
-
- static ServerSocket a(NetworkListenThread networklistenthread) {
- return networklistenthread.d;
- }
-
- static HashMap getRecentConnectionAttempts(NetworkListenThread networklistenthread) {
- return networklistenthread.i;
- }
-
- static int c(NetworkListenThread networklistenthread) {
- return networklistenthread.f++;
- }
-
- static void a(NetworkListenThread networklistenthread, NetLoginHandler netloginhandler) {
- networklistenthread.a(netloginhandler);
- }
-}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 58a4f813..21cd9f2a 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -5,56 +5,60 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;
import java.net.SocketAddress;
-import java.net.SocketException;
+import java.security.PrivateKey;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.crypto.SecretKey;
-public class NetworkManager {
+import java.io.IOException; // CraftBukkit
- public static final Object a = new Object();
- public static int b;
- public static int c;
- private Object g = new Object();
+public class NetworkManager implements INetworkManager {
+
+ public static AtomicInteger a = new AtomicInteger();
+ public static AtomicInteger b = new AtomicInteger();
+ private Object h = new Object();
public Socket socket; // CraftBukkit - private -> public
- private final SocketAddress i;
- private DataInputStream input;
- private DataOutputStream output;
- private boolean l = true;
- private java.util.Queue m = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit - Concurrent linked queue
+ private final SocketAddress j;
+ private volatile DataInputStream input;
+ private volatile DataOutputStream output;
+ private volatile boolean m = true;
+ private volatile boolean n = false;
+ private java.util.Queue inboundQueue = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit - Concurrent linked queue
private List highPriorityQueue = Collections.synchronizedList(new ArrayList());
private List lowPriorityQueue = Collections.synchronizedList(new ArrayList());
private NetHandler packetListener;
- private boolean q = false;
- private Thread r;
- private Thread s;
- private boolean t = false;
- private String u = "";
- private Object[] v;
- private int w = 0;
+ private boolean s = false;
+ private Thread t;
+ private Thread u;
+ private String v = "";
+ private Object[] w;
private int x = 0;
+ private int y = 0;
+ public static int[] c = new int[256];
public static int[] d = new int[256];
- public static int[] e = new int[256];
- public int f = 0;
+ public int e = 0;
+ boolean f = false;
+ boolean g = false;
+ private SecretKey z = null;
+ private PrivateKey A = null;
private int lowPriorityQueueDelay = 50;
- public NetworkManager(Socket socket, String s, NetHandler nethandler) {
+ public NetworkManager(Socket socket, String s, NetHandler nethandler, PrivateKey privatekey) {
+ this.A = privatekey;
this.socket = socket;
- this.i = socket.getRemoteSocketAddress();
+ this.j = socket.getRemoteSocketAddress();
this.packetListener = nethandler;
- // CraftBukkit start - IPv6 stack in Java on BSD/OSX doesn't support setTrafficClass
- try {
- socket.setTrafficClass(24);
- } catch (SocketException e) {}
- // CraftBukkit end
-
try {
- // CraftBukkit start - cant compile these outside the try
socket.setSoTimeout(30000);
- this.input = new DataInputStream(new java.io.BufferedInputStream(socket.getInputStream(), 2)); // Remove buffered input after 1.3
+ socket.setTrafficClass(24);
+ // CraftBukkit start - initialize these in try-catch
+ this.input = new DataInputStream(socket.getInputStream());
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
- } catch (java.io.IOException socketexception) {
+ } catch (IOException socketexception) {
// CraftBukkit end
System.err.println(socketexception.getMessage());
}
@@ -63,10 +67,10 @@ public class NetworkManager {
this.input = new DataInputStream(socket.getInputStream());
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
// CraftBukkit end */
- this.s = new NetworkReaderThread(this, s + " read thread");
- this.r = new NetworkWriterThread(this, s + " write thread");
- this.s.start();
- this.r.start();
+ this.u = new NetworkReaderThread(this, s + " read thread");
+ this.t = new NetworkWriterThread(this, s + " write thread");
+ this.u.start();
+ this.t.start();
}
public void a(NetHandler nethandler) {
@@ -74,11 +78,11 @@ public class NetworkManager {
}
public void queue(Packet packet) {
- if (!this.q) {
- Object object = this.g;
+ if (!this.s) {
+ Object object = this.h;
- synchronized (this.g) {
- this.x += packet.a() + 1;
+ synchronized (this.h) {
+ this.y += packet.a() + 1;
if (packet.lowPriority) {
this.lowPriorityQueue.add(packet);
} else {
@@ -88,48 +92,49 @@ public class NetworkManager {
}
}
- private boolean g() {
+ private boolean h() {
boolean flag = false;
try {
- Object object;
Packet packet;
int i;
int[] aint;
- if (!this.highPriorityQueue.isEmpty() && (this.f == 0 || System.currentTimeMillis() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.f)) {
- object = this.g;
- synchronized (this.g) {
- packet = (Packet) this.highPriorityQueue.remove(0);
- this.x -= packet.a() + 1;
+ if (this.e == 0 || System.currentTimeMillis() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.e) {
+ packet = this.a(false);
+ if (packet != null) {
+ Packet.a(packet, this.output);
+ if (packet instanceof Packet252KeyResponse && !this.g) {
+ if (!this.packetListener.a()) {
+ this.z = ((Packet252KeyResponse) packet).d();
+ }
+
+ this.k();
+ }
+
+ aint = d;
+ i = packet.k();
+ aint[i] += packet.a() + 1;
+ flag = true;
}
-
- Packet.a(packet, this.output);
- aint = e;
- i = packet.b();
- aint[i] += packet.a() + 1;
- flag = true;
}
- // CraftBukkit - don't allow low priority packet to be sent unless it was placed in the queue before the first packet on the high priority queue
+ // CraftBukkit - don't allow low priority packet to be sent unless it was placed in the queue before the first packet on the high priority queue TODO: is this still right?
if ((flag || this.lowPriorityQueueDelay-- <= 0) && !this.lowPriorityQueue.isEmpty() && (this.highPriorityQueue.isEmpty() || ((Packet) this.highPriorityQueue.get(0)).timestamp > ((Packet) this.lowPriorityQueue.get(0)).timestamp)) {
- object = this.g;
- synchronized (this.g) {
- packet = (Packet) this.lowPriorityQueue.remove(0);
- this.x -= packet.a() + 1;
+ packet = this.a(true);
+ if (packet != null) {
+ Packet.a(packet, this.output);
+ aint = d;
+ i = packet.k();
+ aint[i] += packet.a() + 1;
+ this.lowPriorityQueueDelay = 0;
+ flag = true;
}
-
- Packet.a(packet, this.output);
- aint = e;
- i = packet.b();
- aint[i] += packet.a() + 1;
- this.lowPriorityQueueDelay = 0;
- flag = true;
}
return flag;
} catch (Exception exception) {
- if (!this.t) {
+ if (!this.n) {
this.a(exception);
}
@@ -137,41 +142,81 @@ public class NetworkManager {
}
}
+ private Packet a(boolean flag) {
+ Packet packet = null;
+ List list = flag ? this.lowPriorityQueue : this.highPriorityQueue;
+ Object object = this.h;
+
+ synchronized (this.h) {
+ while (!list.isEmpty() && packet == null) {
+ packet = (Packet) list.remove(0);
+ this.y -= packet.a() + 1;
+ if (this.a(packet, flag)) {
+ packet = null;
+ }
+ }
+
+ return packet;
+ }
+ }
+
+ private boolean a(Packet packet, boolean flag) {
+ if (!packet.e()) {
+ return false;
+ } else {
+ List list = flag ? this.lowPriorityQueue : this.highPriorityQueue;
+ Iterator iterator = list.iterator();
+
+ Packet packet1;
+
+ do {
+ if (!iterator.hasNext()) {
+ return false;
+ }
+
+ packet1 = (Packet) iterator.next();
+ } while (packet1.k() != packet.k());
+
+ return packet.a(packet1);
+ }
+ }
+
public void a() {
- this.s.interrupt();
- this.r.interrupt();
+ if (this.u != null) {
+ this.u.interrupt();
+ }
+
+ if (this.t != null) {
+ this.t.interrupt();
+ }
}
- private boolean h() {
+ private boolean i() {
boolean flag = false;
try {
- // CraftBukkit start - 1.3 detection
- this.input.mark(2);
- if (this.input.read() == 2 && this.input.read() != 0) {
- Packet.a(this.input, 16);
- Packet.a(this.input, 255);
- this.input.readInt();
-
- if (this.q) {
- return true;
- }
-
- this.m.clear();
- this.m.add(new Packet2Handshake(null));
- return true;
- }
- this.input.reset();
- // CraftBukkit end
- Packet packet = Packet.a(this.input, this.packetListener.c());
+ Packet packet = Packet.a(this.input, this.packetListener.a());
if (packet != null) {
- int[] aint = d;
- int i = packet.b();
+ if (packet instanceof Packet252KeyResponse && !this.f) {
+ if (this.packetListener.a()) {
+ this.z = ((Packet252KeyResponse) packet).a(this.A);
+ }
+
+ this.j();
+ }
+
+ int[] aint = c;
+ int i = packet.k();
aint[i] += packet.a() + 1;
- if (!this.q) {
- this.m.add(packet);
+ if (!this.s) {
+ if (packet.a_() && this.packetListener.b()) {
+ this.x = 0;
+ packet.handle(this.packetListener);
+ } else {
+ this.inboundQueue.add(packet);
+ }
}
flag = true;
@@ -181,7 +226,7 @@ public class NetworkManager {
return flag;
} catch (Exception exception) {
- if (!this.t) {
+ if (!this.n) {
this.a(exception);
}
@@ -195,76 +240,77 @@ public class NetworkManager {
}
public void a(String s, Object... aobject) {
- if (this.l) {
- this.t = true;
- this.u = s;
- this.v = aobject;
+ if (this.m) {
+ this.n = true;
+ this.v = s;
+ this.w = aobject;
+ this.m = false;
(new NetworkMasterThread(this)).start();
- this.l = false;
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 throwable2) {
+ } catch (Throwable throwable) {
;
}
}
}
public void b() {
- if (this.x > 1048576) {
+ if (this.y > 2097152) {
this.a("disconnect.overflow", new Object[0]);
}
- if (this.m.isEmpty()) {
- if (this.w++ == 1200) {
+ if (this.inboundQueue.isEmpty()) {
+ if (this.x++ == 1200) {
this.a("disconnect.timeout", new Object[0]);
}
} else {
- this.w = 0;
+ this.x = 0;
}
int i = 1000;
- while (!this.m.isEmpty() && i-- >= 0) {
- Packet packet = (Packet) this.m.poll(); // CraftBukkit - remove -> poll
+ while (!this.inboundQueue.isEmpty() && i-- >= 0) {
+ Packet packet = (Packet) this.inboundQueue.poll(); // CraftBukkit - remove -> poll
- if (!this.q) packet.handle(this.packetListener); // CraftBukkit
+ packet.handle(this.packetListener);
}
this.a();
- if (this.t && this.m.isEmpty()) {
- this.packetListener.a(this.u, this.v);
+ if (this.n && this.inboundQueue.isEmpty()) {
+ this.packetListener.a(this.v, this.w);
}
}
public SocketAddress getSocketAddress() {
- return this.i;
+ return this.j;
}
public void d() {
- if (!this.q) {
+ if (!this.s) {
this.a();
- this.q = true;
- this.s.interrupt();
+ this.s = true;
+ this.u.interrupt();
(new NetworkMonitorThread(this)).start();
}
}
+ private void j() throws IOException { // CraftBukkit - throws IOException
+ this.f = true;
+ this.input = new DataInputStream(MinecraftEncryption.a(this.z, this.socket.getInputStream()));
+ }
+
+ 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));
+ }
+
public int e() {
return this.lowPriorityQueue.size();
}
@@ -274,19 +320,19 @@ public class NetworkManager {
}
static boolean a(NetworkManager networkmanager) {
- return networkmanager.l;
+ return networkmanager.m;
}
static boolean b(NetworkManager networkmanager) {
- return networkmanager.q;
+ return networkmanager.s;
}
static boolean c(NetworkManager networkmanager) {
- return networkmanager.h();
+ return networkmanager.i();
}
static boolean d(NetworkManager networkmanager) {
- return networkmanager.g();
+ return networkmanager.h();
}
static DataOutputStream e(NetworkManager networkmanager) {
@@ -294,7 +340,7 @@ public class NetworkManager {
}
static boolean f(NetworkManager networkmanager) {
- return networkmanager.t;
+ return networkmanager.n;
}
static void a(NetworkManager networkmanager, Exception exception) {
@@ -302,10 +348,10 @@ public class NetworkManager {
}
static Thread g(NetworkManager networkmanager) {
- return networkmanager.s;
+ return networkmanager.u;
}
static Thread h(NetworkManager networkmanager) {
- return networkmanager.r;
+ return networkmanager.t;
}
}
diff --git a/src/main/java/net/minecraft/server/NetworkWriterThread.java b/src/main/java/net/minecraft/server/NetworkWriterThread.java
index 140fcd2d..68d84deb 100644
--- a/src/main/java/net/minecraft/server/NetworkWriterThread.java
+++ b/src/main/java/net/minecraft/server/NetworkWriterThread.java
@@ -12,28 +12,18 @@ class NetworkWriterThread extends Thread {
}
public void run() {
- Object object = NetworkManager.a;
+ NetworkManager.b.getAndIncrement();
- synchronized (NetworkManager.a) {
- ++NetworkManager.c;
- }
-
- while (true) {
- boolean flag = false;
+ try {
+ while (NetworkManager.a(this.a)) {
+ boolean flag;
- try {
- flag = true;
- if (!NetworkManager.a(this.a)) {
- flag = false;
- break;
- }
-
- while (NetworkManager.d(this.a)) {
+ for (flag = false; NetworkManager.d(this.a); flag = true) {
;
}
try {
- if (NetworkManager.e(this.a) != null) {
+ if (flag && NetworkManager.e(this.a) != null) {
NetworkManager.e(this.a).flush();
}
} catch (IOException ioexception) {
@@ -49,20 +39,9 @@ class NetworkWriterThread extends Thread {
} catch (InterruptedException interruptedexception) {
;
}
- } finally {
- if (flag) {
- Object object1 = NetworkManager.a;
-
- synchronized (NetworkManager.a) {
- --NetworkManager.c;
- }
- }
}
- }
-
- object = NetworkManager.a;
- synchronized (NetworkManager.a) {
- --NetworkManager.c;
+ } finally {
+ NetworkManager.b.getAndDecrement();
}
}
}
diff --git a/src/main/java/net/minecraft/server/NoteDataList.java b/src/main/java/net/minecraft/server/NoteDataList.java
new file mode 100644
index 00000000..79d09b48
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NoteDataList.java
@@ -0,0 +1,14 @@
+package net.minecraft.server;
+
+import java.util.ArrayList;
+
+// CraftBukkit - imported class because the constructor is package private
+
+class NoteDataList extends ArrayList {
+
+ private NoteDataList() {}
+
+ NoteDataList(EmptyClass2 emptyclass2) {
+ this();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index bd828ac4..65ac4095 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -11,26 +11,26 @@ import java.util.Set;
public abstract class Packet {
- public static IntHashMap j = new IntHashMap();
+ public static IntHashMap l = new IntHashMap();
private static Map a = new HashMap();
private static Set b = new HashSet();
private static Set c = new HashSet();
public final long timestamp = System.currentTimeMillis();
- public static long l;
- public static long m;
public static long n;
public static long o;
+ public static long p;
+ public static long q;
public boolean lowPriority = false;
public Packet() {}
static void a(int i, boolean flag, boolean flag1, Class oclass) {
- if (j.b(i)) {
+ if (l.b(i)) {
throw new IllegalArgumentException("Duplicate packet id:" + i);
} else if (a.containsKey(oclass)) {
throw new IllegalArgumentException("Duplicate packet class:" + oclass);
} else {
- j.a(i, oclass);
+ l.a(i, oclass);
a.put(oclass, Integer.valueOf(i));
if (flag) {
b.add(Integer.valueOf(i));
@@ -42,9 +42,9 @@ public abstract class Packet {
}
}
- public static Packet a(int i) {
+ public static Packet d(int i) {
try {
- Class oclass = (Class) j.get(i);
+ Class oclass = (Class) l.get(i);
return oclass == null ? null : (Packet) oclass.newInstance();
} catch (Exception exception) {
@@ -54,12 +54,29 @@ public abstract class Packet {
}
}
- public final int b() {
+ public static void a(DataOutputStream dataoutputstream, byte[] abyte) throws IOException { // CraftBukkit - throws IOException
+ dataoutputstream.writeShort(abyte.length);
+ dataoutputstream.write(abyte);
+ }
+
+ public static byte[] b(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
+ short short1 = datainputstream.readShort();
+
+ if (short1 < 0) {
+ throw new IOException("Key was smaller than nothing! Weird key!");
+ } else {
+ byte[] abyte = new byte[short1];
+
+ datainputstream.read(abyte);
+ return abyte;
+ }
+ }
+
+ public final int k() {
return ((Integer) a.get(this.getClass())).intValue();
}
- // CraftBukkit - throws IOException
- public static Packet a(DataInputStream datainputstream, boolean flag) throws IOException {
+ public static Packet a(DataInputStream datainputstream, boolean flag) throws IOException { // CraftBukkit - throws IOException
boolean flag1 = false;
Packet packet = null;
@@ -75,14 +92,14 @@ public abstract class Packet {
throw new IOException("Bad packet id " + i);
}
- packet = a(i);
+ packet = d(i);
if (packet == null) {
throw new IOException("Bad packet id " + i);
}
packet.a(datainputstream);
- ++l;
- m += (long) packet.a();
+ ++n;
+ o += (long) packet.a();
} catch (EOFException eofexception) {
System.out.println("Reached end of stream");
return null;
@@ -98,22 +115,21 @@ public abstract class Packet {
}
// CraftBukkit end
+
PacketCounter.a(i, (long) packet.a());
- ++l;
- m += (long) packet.a();
+ ++n;
+ o += (long) packet.a();
return packet;
}
- // CraftBukkit - throws IOException
- public static void a(Packet packet, DataOutputStream dataoutputstream) throws IOException {
- dataoutputstream.write(packet.b());
+ public static void a(Packet packet, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ dataoutputstream.write(packet.k());
packet.a(dataoutputstream);
- ++n;
- o += (long) packet.a();
+ ++p;
+ q += (long) packet.a();
}
- // CraftBukkit - throws IOException
- public static void a(String s, DataOutputStream dataoutputstream) throws IOException {
+ public static void a(String s, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
if (s.length() > 32767) {
throw new IOException("String too big");
} else {
@@ -122,8 +138,7 @@ public abstract class Packet {
}
}
- // CraftBukkit - throws IOException
- public static String a(DataInputStream datainputstream, int i) throws IOException {
+ public static String a(DataInputStream datainputstream, int i) throws IOException { // CraftBukkit - throws IOException
short short1 = datainputstream.readShort();
if (short1 > i) {
@@ -141,15 +156,33 @@ public abstract class Packet {
}
}
- public abstract void a(DataInputStream datainputstream) throws IOException; // CraftBukkit
+ public abstract void a(DataInputStream datainputstream) throws IOException; // CraftBukkit - throws IOException
- public abstract void a(DataOutputStream dataoutputstream) throws IOException; // CraftBukkit
+ public abstract void a(DataOutputStream dataoutputstream) throws IOException; // CraftBukkit - throws IOException
public abstract void handle(NetHandler nethandler);
public abstract int a();
- protected ItemStack b(DataInputStream datainputstream) throws IOException { // CraftBukkit
+ public boolean e() {
+ return false;
+ }
+
+ public boolean a(Packet packet) {
+ return false;
+ }
+
+ public boolean a_() {
+ return false;
+ }
+
+ public String toString() {
+ String s = this.getClass().getSimpleName();
+
+ return s;
+ }
+
+ public static ItemStack c(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
ItemStack itemstack = null;
short short1 = datainputstream.readShort();
@@ -158,28 +191,30 @@ public abstract class Packet {
short short2 = datainputstream.readShort();
itemstack = new ItemStack(short1, b0, short2);
- if (Item.byId[short1].g() || Item.byId[short1].i()) {
- itemstack.tag = this.c(datainputstream);
- }
+ itemstack.tag = d(datainputstream);
}
return itemstack;
}
- protected void a(ItemStack itemstack, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
- if (itemstack == null || itemstack.id <= 0) { // CraftBukkit
+ public static void a(ItemStack itemstack, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ if (itemstack == null) {
dataoutputstream.writeShort(-1);
} else {
dataoutputstream.writeShort(itemstack.id);
dataoutputstream.writeByte(itemstack.count);
dataoutputstream.writeShort(itemstack.getData());
- if (itemstack.getItem().g() || itemstack.getItem().i()) {
- this.a(itemstack.tag, dataoutputstream);
+ NBTTagCompound nbttagcompound = null;
+
+ if (itemstack.getItem().m() || itemstack.getItem().p()) {
+ nbttagcompound = itemstack.tag;
}
+
+ a(nbttagcompound, dataoutputstream);
}
}
- protected NBTTagCompound c(DataInputStream datainputstream) throws IOException { // CraftBukkit
+ public static NBTTagCompound d(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
short short1 = datainputstream.readShort();
if (short1 < 0) {
@@ -192,7 +227,7 @@ public abstract class Packet {
}
}
- protected void a(NBTTagCompound nbttagcompound, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
+ protected static void a(NBTTagCompound nbttagcompound, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
if (nbttagcompound == null) {
dataoutputstream.writeShort(-1);
} else {
@@ -206,7 +241,7 @@ public abstract class Packet {
static {
a(0, true, true, Packet0KeepAlive.class);
a(1, true, true, Packet1Login.class);
- a(2, true, true, Packet2Handshake.class);
+ a(2, false, true, Packet2Handshake.class);
a(3, true, true, Packet3Chat.class);
a(4, true, false, Packet4UpdateTime.class);
a(5, true, false, Packet5EntityEquipment.class);
@@ -245,13 +280,15 @@ public abstract class Packet {
a(41, true, false, Packet41MobEffect.class);
a(42, true, false, Packet42RemoveMobEffect.class);
a(43, true, false, Packet43SetExperience.class);
- a(50, true, false, Packet50PreChunk.class);
a(51, true, false, Packet51MapChunk.class);
a(52, true, false, Packet52MultiBlockChange.class);
a(53, true, false, Packet53BlockChange.class);
a(54, true, false, Packet54PlayNoteBlock.class);
+ a(55, true, false, Packet55BlockBreakAnimation.class);
+ a(56, true, false, Packet56MapChunkBulk.class);
a(60, true, false, Packet60Explosion.class);
a(61, true, false, Packet61WorldEvent.class);
+ a(62, true, false, Packet62NamedSoundEffect.class);
a(70, true, false, Packet70Bed.class);
a(71, true, false, Packet71Weather.class);
a(100, true, false, Packet100OpenWindow.class);
@@ -269,7 +306,12 @@ public abstract class Packet {
a(200, true, false, Packet200Statistic.class);
a(201, true, false, Packet201PlayerInfo.class);
a(202, true, true, Packet202Abilities.class);
+ a(203, true, true, Packet203TabComplete.class);
+ a(204, false, true, Packet204LocaleAndViewDistance.class);
+ a(205, false, true, Packet205ClientCommand.class);
a(250, true, true, Packet250CustomPayload.class);
+ a(252, true, true, Packet252KeyResponse.class);
+ a(253, true, false, Packet253KeyRequest.class);
a(254, false, true, Packet254GetInfo.class);
a(255, true, true, Packet255KickDisconnect.class);
}
diff --git a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java b/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
index d32795c9..25d4ab8c 100644
--- a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
+++ b/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
import java.io.DataInputStream;
import java.io.DataOutputStream;
+import java.util.List;
+
import java.io.IOException; // CraftBukkit
public class Packet20NamedEntitySpawn extends Packet {
@@ -14,6 +16,8 @@ public class Packet20NamedEntitySpawn extends Packet {
public byte f;
public byte g;
public int h;
+ private DataWatcher i;
+ private List j;
public Packet20NamedEntitySpawn() {}
@@ -36,6 +40,7 @@ public class Packet20NamedEntitySpawn extends Packet {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
this.h = itemstack == null ? 0 : itemstack.id;
+ this.i = entityhuman.getDataWatcher();
}
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
@@ -47,6 +52,7 @@ public class Packet20NamedEntitySpawn extends Packet {
this.f = datainputstream.readByte();
this.g = datainputstream.readByte();
this.h = datainputstream.readShort();
+ this.j = DataWatcher.a(datainputstream);
}
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
@@ -58,6 +64,7 @@ public class Packet20NamedEntitySpawn extends Packet {
dataoutputstream.writeByte(this.f);
dataoutputstream.writeByte(this.g);
dataoutputstream.writeShort(this.h);
+ this.i.a(dataoutputstream);
}
public void handle(NetHandler nethandler) {
diff --git a/src/main/java/net/minecraft/server/Packet24MobSpawn.java b/src/main/java/net/minecraft/server/Packet24MobSpawn.java
deleted file mode 100644
index a4029ce5..00000000
--- a/src/main/java/net/minecraft/server/Packet24MobSpawn.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package net.minecraft.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.util.List;
-
-import java.io.IOException; // CraftBukkit
-
-public class Packet24MobSpawn extends Packet {
-
- public int a;
- public int b;
- public int c;
- public int d;
- public int e;
- public byte f;
- public byte g;
- public byte h;
- private DataWatcher i;
- private List q;
-
- public Packet24MobSpawn() {}
-
- public Packet24MobSpawn(EntityLiving entityliving) {
- this.a = entityliving.id;
- this.b = (byte) EntityTypes.a((Entity) entityliving);
- // CraftBukkit start - floors to new intelligence
- this.c = entityliving.size.getXZCoord(entityliving.locX);
- this.d = org.bukkit.util.NumberConversions.floor(entityliving.locY * 32.0D);
- this.e = entityliving.size.getXZCoord(entityliving.locZ);
- // CraftBukkit end
- this.f = (byte) ((int) (entityliving.yaw * 256.0F / 360.0F));
- this.g = (byte) ((int) (entityliving.pitch * 256.0F / 360.0F));
- this.h = (byte) ((int) (entityliving.X * 256.0F / 360.0F));
- this.i = entityliving.getDataWatcher();
- }
-
- public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
- this.a = datainputstream.readInt();
- this.b = datainputstream.readByte() & 255;
- this.c = datainputstream.readInt();
- this.d = datainputstream.readInt();
- this.e = datainputstream.readInt();
- this.f = datainputstream.readByte();
- this.g = datainputstream.readByte();
- this.h = datainputstream.readByte();
- this.q = DataWatcher.a(datainputstream);
- }
-
- public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
- dataoutputstream.writeInt(this.a);
- dataoutputstream.writeByte(this.b & 255);
- dataoutputstream.writeInt(this.c);
- dataoutputstream.writeInt(this.d);
- dataoutputstream.writeInt(this.e);
- dataoutputstream.writeByte(this.f);
- dataoutputstream.writeByte(this.g);
- dataoutputstream.writeByte(this.h);
- this.i.a(dataoutputstream);
- }
-
- public void handle(NetHandler nethandler) {
- nethandler.a(this);
- }
-
- public int a() {
- return 20;
- }
-}
diff --git a/src/main/java/net/minecraft/server/Packet2Handshake.java b/src/main/java/net/minecraft/server/Packet2Handshake.java
new file mode 100644
index 00000000..81ce9c0f
--- /dev/null
+++ b/src/main/java/net/minecraft/server/Packet2Handshake.java
@@ -0,0 +1,46 @@
+package net.minecraft.server;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+
+import java.io.IOException; // CraftBukkit
+
+public class Packet2Handshake extends Packet {
+
+ private int a;
+ private String b;
+ public String c; // CraftBukkit private -> public
+ private int d;
+
+ public Packet2Handshake() {}
+
+ public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
+ this.a = datainputstream.readByte();
+ this.b = a(datainputstream, 16);
+ this.c = a(datainputstream, 255);
+ this.d = datainputstream.readInt();
+ }
+
+ public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ dataoutputstream.writeByte(this.a);
+ a(this.b, dataoutputstream);
+ a(this.c, dataoutputstream);
+ dataoutputstream.writeInt(this.d);
+ }
+
+ public void handle(NetHandler nethandler) {
+ nethandler.a(this);
+ }
+
+ public int a() {
+ return 3 + 2 * this.b.length();
+ }
+
+ public int d() {
+ return this.a;
+ }
+
+ public String f() {
+ return this.b;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Packet3Chat.java b/src/main/java/net/minecraft/server/Packet3Chat.java
index 1627c85e..7c0205b6 100644
--- a/src/main/java/net/minecraft/server/Packet3Chat.java
+++ b/src/main/java/net/minecraft/server/Packet3Chat.java
@@ -7,12 +7,21 @@ import java.io.IOException; // CraftBukkit
public class Packet3Chat extends Packet {
- public static int b = 119;
+ public static int a = 119;
public String message;
+ private boolean c;
- public Packet3Chat() {}
+ public Packet3Chat() {
+ this.c = true;
+ }
public Packet3Chat(String s) {
+ this(s, true);
+ }
+
+ public Packet3Chat(String s, boolean flag) {
+ this.c = true;
+
/* CraftBukkit start - handle this later
if (s.length() > b) {
s = s.substring(0, b);
@@ -20,10 +29,11 @@ public class Packet3Chat extends Packet {
// CraftBukkit end */
this.message = s;
+ this.c = flag;
}
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
- this.message = a(datainputstream, b);
+ this.message = a(datainputstream, a);
}
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
@@ -37,4 +47,12 @@ public class Packet3Chat extends Packet {
public int a() {
return 2 + this.message.length() * 2;
}
+
+ public boolean isServer() {
+ return this.c;
+ }
+
+ public boolean a_() {
+ return !this.message.startsWith("/");
+ }
}
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
index a054615e..b3bb3a8c 100644
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
+++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java
@@ -4,7 +4,7 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.zip.DataFormatException;
-// import java.util.zip.Deflater; // CraftBukkit
+import java.util.zip.Deflater;
import java.util.zip.Inflater;
public class Packet51MapChunk extends Packet {
@@ -13,11 +13,13 @@ public class Packet51MapChunk extends Packet {
public int b;
public int c;
public int d;
+ // CraftBukkit start - private -> public
public byte[] buffer;
- public boolean f;
- public int size; // CraftBukkit - private -> public
- private int h;
- public byte[] rawData = new byte[0]; // CraftBukkit
+ public byte[] inflatedBuffer;
+ public boolean e;
+ public int size;
+ // CraftBukkit end
+ private static byte[] buildBuffer = new byte[196864];
public Packet51MapChunk() {
this.lowPriority = true;
@@ -27,124 +29,40 @@ public class Packet51MapChunk extends Packet {
this.lowPriority = true;
this.a = chunk.x;
this.b = chunk.z;
- this.f = flag;
- if (flag) {
- i = '\uffff';
- chunk.seenByPlayer = true;
- }
+ this.e = flag;
+ ChunkMap chunkmap = a(chunk, flag, i);
+ // Deflater deflater = new Deflater(-1); // CraftBukkit
- ChunkSection[] achunksection = chunk.h();
- int j = 0;
- int k = 0;
-
- int l;
-
- for (l = 0; l < achunksection.length; ++l) {
- if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
- this.c |= 1 << l;
- ++j;
- if (achunksection[l].h() != null) {
- this.d |= 1 << l;
- ++k;
- }
- }
- }
-
- l = 2048 * (5 * j + k);
- if (flag) {
- l += 256;
- }
-
- if (rawData.length < l) {
- rawData = new byte[l];
- }
-
- byte[] abyte = rawData;
- int i1 = 0;
-
- int j1;
-
- for (j1 = 0; j1 < achunksection.length; ++j1) {
- if (achunksection[j1] != null && (!flag || !achunksection[j1].a()) && (i & 1 << j1) != 0) {
- byte[] abyte1 = achunksection[j1].g();
-
- System.arraycopy(abyte1, 0, abyte, i1, abyte1.length);
- i1 += abyte1.length;
- }
- }
-
- NibbleArray nibblearray;
-
- for (j1 = 0; j1 < achunksection.length; ++j1) {
- if (achunksection[j1] != null && (!flag || !achunksection[j1].a()) && (i & 1 << j1) != 0) {
- nibblearray = achunksection[j1].i();
- System.arraycopy(nibblearray.a, 0, abyte, i1, nibblearray.a.length);
- i1 += nibblearray.a.length;
- }
- }
-
- for (j1 = 0; j1 < achunksection.length; ++j1) {
- if (achunksection[j1] != null && (!flag || !achunksection[j1].a()) && (i & 1 << j1) != 0) {
- nibblearray = achunksection[j1].j();
- System.arraycopy(nibblearray.a, 0, abyte, i1, nibblearray.a.length);
- i1 += nibblearray.a.length;
- }
- }
-
- for (j1 = 0; j1 < achunksection.length; ++j1) {
- if (achunksection[j1] != null && (!flag || !achunksection[j1].a()) && (i & 1 << j1) != 0) {
- nibblearray = achunksection[j1].k();
- System.arraycopy(nibblearray.a, 0, abyte, i1, nibblearray.a.length);
- i1 += nibblearray.a.length;
- }
- }
-
- if (k > 0) {
- for (j1 = 0; j1 < achunksection.length; ++j1) {
- if (achunksection[j1] != null && (!flag || !achunksection[j1].a()) && achunksection[j1].h() != null && (i & 1 << j1) != 0) {
- nibblearray = achunksection[j1].h();
- System.arraycopy(nibblearray.a, 0, abyte, i1, nibblearray.a.length);
- i1 += nibblearray.a.length;
- }
- }
- }
-
- if (flag) {
- byte[] abyte2 = chunk.l();
-
- System.arraycopy(abyte2, 0, abyte, i1, abyte2.length);
- i1 += abyte2.length;
- }
-
- /* CraftBukkit start - Moved compression into its own method.
- byte[] abyte = data; // CraftBukkit - uses data from above constructor
- Deflater deflater = new Deflater(-1);
+ this.d = chunkmap.c;
+ this.c = chunkmap.b;
+ /* CraftBukkit start - compression moved to new thread
try {
- deflater.setInput(abyte, 0, i1);
+ this.inflatedBuffer = chunkmap.a;
+ deflater.setInput(chunkmap.a, 0, chunkmap.a.length);
deflater.finish();
- this.buffer = new byte[i1];
+ this.buffer = new byte[chunkmap.a.length];
this.size = deflater.deflate(this.buffer);
} finally {
deflater.end();
- } */
- this.rawData = abyte;
+ }
+ */
+ this.inflatedBuffer = chunkmap.a;
// CraftBukkit end
}
- public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOEXception
+ public void a(DataInputStream datainputstream) throws IOException {
this.a = datainputstream.readInt();
this.b = datainputstream.readInt();
- this.f = datainputstream.readBoolean();
+ this.e = datainputstream.readBoolean();
this.c = datainputstream.readShort();
this.d = datainputstream.readShort();
this.size = datainputstream.readInt();
- this.h = datainputstream.readInt();
- if (rawData.length < this.size) {
- rawData = new byte[this.size];
+ if (buildBuffer.length < this.size) {
+ buildBuffer = new byte[this.size];
}
- datainputstream.readFully(rawData, 0, this.size);
+ datainputstream.readFully(buildBuffer, 0, this.size);
int i = 0;
int j;
@@ -154,17 +72,17 @@ public class Packet51MapChunk extends Packet {
}
j = 12288 * i;
- if (this.f) {
+ if (this.e) {
j += 256;
}
- this.buffer = new byte[j];
+ this.inflatedBuffer = new byte[j];
Inflater inflater = new Inflater();
- inflater.setInput(rawData, 0, this.size);
+ inflater.setInput(buildBuffer, 0, this.size);
try {
- inflater.inflate(this.buffer);
+ inflater.inflate(this.inflatedBuffer);
} catch (DataFormatException dataformatexception) {
throw new IOException("Bad compressed data format");
} finally {
@@ -175,11 +93,10 @@ public class Packet51MapChunk extends Packet {
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
dataoutputstream.writeInt(this.a);
dataoutputstream.writeInt(this.b);
- dataoutputstream.writeBoolean(this.f);
+ dataoutputstream.writeBoolean(this.e);
dataoutputstream.writeShort((short) (this.c & '\uffff'));
dataoutputstream.writeShort((short) (this.d & '\uffff'));
dataoutputstream.writeInt(this.size);
- dataoutputstream.writeInt(this.h);
dataoutputstream.write(this.buffer, 0, this.size);
}
@@ -190,4 +107,84 @@ public class Packet51MapChunk extends Packet {
public int a() {
return 17 + this.size;
}
+
+ public static ChunkMap a(Chunk chunk, boolean flag, int i) {
+ int j = 0;
+ ChunkSection[] achunksection = chunk.i();
+ int k = 0;
+ ChunkMap chunkmap = new ChunkMap();
+ byte[] abyte = buildBuffer;
+
+ if (flag) {
+ chunk.seenByPlayer = true;
+ }
+
+ int l;
+
+ for (l = 0; l < achunksection.length; ++l) {
+ if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
+ chunkmap.b |= 1 << l;
+ if (achunksection[l].i() != null) {
+ chunkmap.c |= 1 << l;
+ ++k;
+ }
+ }
+ }
+
+ for (l = 0; l < achunksection.length; ++l) {
+ if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
+ byte[] abyte1 = achunksection[l].g();
+
+ System.arraycopy(abyte1, 0, abyte, j, abyte1.length);
+ j += abyte1.length;
+ }
+ }
+
+ NibbleArray nibblearray;
+
+ for (l = 0; l < achunksection.length; ++l) {
+ if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
+ nibblearray = achunksection[l].j();
+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
+ j += nibblearray.a.length;
+ }
+ }
+
+ for (l = 0; l < achunksection.length; ++l) {
+ if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
+ nibblearray = achunksection[l].k();
+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
+ j += nibblearray.a.length;
+ }
+ }
+
+ for (l = 0; l < achunksection.length; ++l) {
+ if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
+ nibblearray = achunksection[l].l();
+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
+ j += nibblearray.a.length;
+ }
+ }
+
+ if (k > 0) {
+ for (l = 0; l < achunksection.length; ++l) {
+ if (achunksection[l] != null && (!flag || !achunksection[l].a()) && achunksection[l].i() != null && (i & 1 << l) != 0) {
+ nibblearray = achunksection[l].i();
+ System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
+ j += nibblearray.a.length;
+ }
+ }
+ }
+
+ if (flag) {
+ byte[] abyte2 = chunk.m();
+
+ System.arraycopy(abyte2, 0, abyte, j, abyte2.length);
+ j += abyte2.length;
+ }
+
+ chunkmap.a = new byte[j];
+ System.arraycopy(abyte, 0, chunkmap.a, 0, j);
+ return chunkmap;
+ }
}
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
new file mode 100644
index 00000000..ae8a0f68
--- /dev/null
+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
@@ -0,0 +1,149 @@
+package net.minecraft.server;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.zip.DataFormatException;
+import java.util.zip.Deflater;
+import java.util.zip.Inflater;
+
+public class Packet56MapChunkBulk extends Packet {
+
+ private int[] c;
+ private int[] d;
+ public int[] a;
+ public int[] b;
+ // CraftBukkit start - private -> public
+ public byte[] buffer;
+ private byte[][] inflatedBuffers;
+ public int size;
+ public byte[] buildBuffer = new byte[0]; // - static
+ // CraftBukkit end
+
+ public Packet56MapChunkBulk() {}
+
+ public Packet56MapChunkBulk(List list) {
+ int i = list.size();
+
+ this.c = new int[i];
+ this.d = new int[i];
+ this.a = new int[i];
+ this.b = new int[i];
+ this.inflatedBuffers = new byte[i][];
+ int j = 0;
+
+ for (int k = 0; k < i; ++k) {
+ Chunk chunk = (Chunk) list.get(k);
+ ChunkMap chunkmap = Packet51MapChunk.a(chunk, true, '\uffff');
+
+ if (buildBuffer.length < j + chunkmap.a.length) {
+ byte[] abyte = new byte[j + chunkmap.a.length];
+
+ System.arraycopy(buildBuffer, 0, abyte, 0, buildBuffer.length);
+ buildBuffer = abyte;
+ }
+
+ System.arraycopy(chunkmap.a, 0, buildBuffer, j, chunkmap.a.length);
+ j += chunkmap.a.length;
+ this.c[k] = chunk.x;
+ this.d[k] = chunk.z;
+ this.a[k] = chunkmap.b;
+ this.b[k] = chunkmap.c;
+ this.inflatedBuffers[k] = chunkmap.a;
+ }
+
+ /* CraftBukkit start
+ Deflater deflater = new Deflater(-1);
+
+ try {
+ deflater.setInput(buildBuffer, 0, j);
+ deflater.finish();
+ this.buffer = new byte[j];
+ this.size = deflater.deflate(this.buffer);
+ } finally {
+ deflater.end();
+ }
+ */
+ this.lowPriority = true;
+ // CraftBukkit end
+ }
+
+ public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
+ short short1 = datainputstream.readShort();
+
+ this.size = datainputstream.readInt();
+ this.c = new int[short1];
+ this.d = new int[short1];
+ this.a = new int[short1];
+ this.b = new int[short1];
+ this.inflatedBuffers = new byte[short1][];
+ if (buildBuffer.length < this.size) {
+ buildBuffer = new byte[this.size];
+ }
+
+ datainputstream.readFully(buildBuffer, 0, this.size);
+ byte[] abyte = new byte[196864 * short1];
+ Inflater inflater = new Inflater();
+
+ inflater.setInput(buildBuffer, 0, this.size);
+
+ try {
+ inflater.inflate(abyte);
+ } catch (DataFormatException dataformatexception) {
+ throw new IOException("Bad compressed data format");
+ } finally {
+ inflater.end();
+ }
+
+ int i = 0;
+
+ for (int j = 0; j < short1; ++j) {
+ this.c[j] = datainputstream.readInt();
+ this.d[j] = datainputstream.readInt();
+ this.a[j] = datainputstream.readShort();
+ this.b[j] = datainputstream.readShort();
+ int k = 0;
+
+ int l;
+
+ for (l = 0; l < 16; ++l) {
+ k += this.a[j] >> l & 1;
+ }
+
+ l = 2048 * 5 * k + 256;
+ this.inflatedBuffers[j] = new byte[l];
+ System.arraycopy(abyte, i, this.inflatedBuffers[j], 0, l);
+ i += l;
+ }
+ }
+
+ public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ dataoutputstream.writeShort(this.c.length);
+ dataoutputstream.writeInt(this.size);
+ dataoutputstream.write(this.buffer, 0, this.size);
+
+ for (int i = 0; i < this.c.length; ++i) {
+ dataoutputstream.writeInt(this.c[i]);
+ dataoutputstream.writeInt(this.d[i]);
+ dataoutputstream.writeShort((short) (this.a[i] & '\uffff'));
+ dataoutputstream.writeShort((short) (this.b[i] & '\uffff'));
+ }
+ }
+
+ public void handle(NetHandler nethandler) {
+ nethandler.a(this);
+ }
+
+ public int a() {
+ return 6 + this.size + 12 * this.d();
+ }
+
+ public int d() {
+ return this.c.length;
+ }
+
+ public boolean a_() {
+ return true;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Path.java b/src/main/java/net/minecraft/server/Path.java
index 28b01672..530cf09b 100644
--- a/src/main/java/net/minecraft/server/Path.java
+++ b/src/main/java/net/minecraft/server/Path.java
@@ -29,7 +29,7 @@ public class Path {
this.b = 0;
}
- public PathPoint b() {
+ public PathPoint c() {
PathPoint pathpoint = this.a[0];
this.a[0] = this.a[--this.b];
@@ -122,7 +122,7 @@ public class Path {
pathpoint.d = i;
}
- public boolean c() {
+ public boolean e() {
return this.b == 0;
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
index 2db851ea..c4838c4f 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
@@ -23,7 +23,7 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
}
public boolean a() {
- EntityLiving entityliving = this.b.at();
+ EntityLiving entityliving = this.b.az();
if (entityliving == null) {
return false;
@@ -34,10 +34,10 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
}
public boolean b() {
- return this.a() || !this.b.al().e();
+ return this.a() || !this.b.getNavigation().f();
}
- public void d() {
+ public void c() {
// CraftBukkit start
EntityTargetEvent.TargetReason reason = this.c.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
@@ -45,10 +45,10 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
this.c = null;
}
- public void e() {
+ public void d() {
double d0 = 100.0D;
double d1 = this.b.e(this.c.locX, this.c.boundingBox.b, this.c.locZ);
- boolean flag = this.b.am().canSee(this.c);
+ boolean flag = this.b.at().canSee(this.c);
if (flag) {
++this.f;
@@ -57,9 +57,9 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
}
if (d1 <= d0 && this.f >= 20) {
- this.b.al().f();
+ this.b.getNavigation().g();
} else {
- this.b.al().a(this.c, this.e);
+ this.b.getNavigation().a(this.c, this.e);
}
this.b.getControllerLook().a(this.c, 30.0F, 30.0F);
@@ -76,7 +76,7 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
if (this.g == 1) {
EntityArrow entityarrow = new EntityArrow(this.a, this.b, this.c, 1.6F, 12.0F);
- this.a.makeSound(this.b, "random.bow", 1.0F, 1.0F / (this.b.an().nextFloat() * 0.4F + 0.8F));
+ this.a.makeSound(this.b, "random.bow", 1.0F, 1.0F / (this.b.au().nextFloat() * 0.4F + 0.8F));
this.a.addEntity(entityarrow);
} else if (this.g == 2) {
EntitySnowball entitysnowball = new EntitySnowball(this.a, this.b);
@@ -85,8 +85,8 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
double d2 = this.c.locZ - this.b.locZ;
float f = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
- entitysnowball.a(d0, d1 + (double) f, d2, 1.6F, 12.0F);
- this.a.makeSound(this.b, "random.bow", 1.0F, 1.0F / (this.b.an().nextFloat() * 0.4F + 0.8F));
+ entitysnowball.c(d0, d1 + (double) f, d2, 1.6F, 12.0F);
+ this.a.makeSound(this.b, "random.bow", 1.0F, 1.0F / (this.b.au().nextFloat() * 0.4F + 0.8F));
this.a.addEntity(entitysnowball);
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
index d97834b5..b9620ecb 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
@@ -3,39 +3,54 @@ package net.minecraft.server;
public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
private int i;
+ private int j = -1;
public PathfinderGoalBreakDoor(EntityLiving entityliving) {
super(entityliving);
}
public boolean a() {
- return !super.a() ? false : !this.e.d(this.a.world, this.b, this.c, this.d);
+ return !super.a() ? false : !this.e.a_(this.a.world, this.b, this.c, this.d);
}
- public void c() {
- super.c();
- this.i = 240;
+ public void e() {
+ super.e();
+ this.i = 0;
}
public boolean b() {
double d0 = this.a.e((double) this.b, (double) this.c, (double) this.d);
- return this.i >= 0 && !this.e.d(this.a.world, this.b, this.c, this.d) && d0 < 4.0D;
+ return this.i <= 240 && !this.e.a_(this.a.world, this.b, this.c, this.d) && d0 < 4.0D;
}
- public void e() {
- super.e();
- if (this.a.an().nextInt(20) == 0) {
+ public void c() {
+ super.c();
+ this.a.world.f(this.a.id, this.b, this.c, this.d, -1);
+ }
+
+ public void d() {
+ super.d();
+ if (this.a.au().nextInt(20) == 0) {
this.a.world.triggerEffect(1010, this.b, this.c, this.d, 0);
}
- if (--this.i == 0 && this.a.world.difficulty == 3) {
+ ++this.i;
+ int i = (int) ((float) this.i / 240.0F * 10.0F);
+
+ if (i != this.j) {
+ this.a.world.f(this.a.id, this.b, this.c, this.d, i);
+ this.j = i;
+ }
+
+ if (this.i == 240 && this.a.world.difficulty == 3) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.a, this.b, this.c, this.d).isCancelled()) {
- this.c();
+ this.e();
return;
}
// CraftBukkit end
+
this.a.world.setTypeId(this.b, this.c, this.d, 0);
this.a.world.triggerEffect(1012, this.b, this.c, this.d, 0);
this.a.world.triggerEffect(2001, this.b, this.c, this.d, this.e.id);
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index f744bea5..50631387 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
@@ -20,7 +20,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public boolean a() {
- if (!this.d.r_()) {
+ if (!this.d.s()) {
return false;
} else {
this.e = this.f();
@@ -29,17 +29,17 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public boolean b() {
- return this.e.isAlive() && this.e.r_() && this.b < 60;
+ return this.e.isAlive() && this.e.s() && this.b < 60;
}
- public void d() {
+ public void c() {
this.e = null;
this.b = 0;
}
- public void e() {
- this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.D());
- this.d.al().a((EntityLiving) this.e, this.c);
+ public void d() {
+ this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bf());
+ this.d.getNavigation().a((EntityLiving) this.e, this.c);
++this.b;
if (this.b == 60) {
this.i();
@@ -58,9 +58,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
return null;
}
- Entity entity = (Entity) iterator.next();
-
- entityanimal = (EntityAnimal) entity;
+ entityanimal = (EntityAnimal) iterator.next();
} while (!this.d.mate(entityanimal));
return entityanimal;
@@ -72,12 +70,12 @@ public class PathfinderGoalBreed extends PathfinderGoal {
if (entityanimal != null) {
this.d.setAge(6000);
this.e.setAge(6000);
- this.d.s_();
- this.e.s_();
+ this.d.t();
+ this.e.t();
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.an();
+ this.a.addEntity(entityanimal, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
+ Random random = this.d.au();
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 8d9ffd21..05a12080 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.an().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
+ if (this.b.au().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
return false;
} else {
int i = MathHelper.floor(this.b.locX);
@@ -29,13 +29,13 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
}
}
- public void c() {
+ public void e() {
this.a = 40;
this.c.broadcastEntityEffect(this.b, (byte) 10);
- this.b.al().f();
+ this.b.getNavigation().g();
}
- public void d() {
+ public void c() {
this.a = 0;
}
@@ -47,7 +47,7 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
return this.a;
}
- public void e() {
+ public void d() {
this.a = Math.max(0, this.a - 1);
if (this.a == 4) {
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.z();
+ this.b.aA();
}
// 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.z();
+ this.b.aA();
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
index d5f6cb29..cca9c7a1 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.at();
+ EntityLiving entityliving = this.b.az();
if (entityliving == null) {
return false;
@@ -37,36 +37,37 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
return false;
} else {
this.c = entityliving;
- this.g = this.b.al().a(this.c);
+ this.g = this.b.getNavigation().a(this.c);
return this.g != null;
}
}
public boolean b() {
- EntityLiving entityliving = this.b.at();
+ EntityLiving entityliving = this.b.az();
- return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.al().e() : this.b.e(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ))));
+ return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.getNavigation().f() : this.b.d(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ))));
}
- public void c() {
- this.b.al().a(this.g, this.e);
+ public void e() {
+ this.b.getNavigation().a(this.g, this.e);
this.i = 0;
}
- public void d() {
+ public void c() {
// CraftBukkit start
EntityTargetEvent.TargetReason reason = this.c.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
// CraftBukkit end
+
this.c = null;
- this.b.al().f();
+ this.b.getNavigation().g();
}
- public void e() {
+ public void d() {
this.b.getControllerLook().a(this.c, 30.0F, 30.0F);
- if ((this.f || this.b.am().canSee(this.c)) && --this.i <= 0) {
- this.i = 4 + this.b.an().nextInt(7);
- this.b.al().a(this.c, this.e);
+ if ((this.f || this.b.at().canSee(this.c)) && --this.i <= 0) {
+ this.i = 4 + this.b.au().nextInt(7);
+ this.b.getNavigation().a(this.c, this.e);
}
this.d = Math.max(this.d - 1, 0);
@@ -75,7 +76,7 @@ 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;
- this.b.a((Entity) this.c);
+ this.b.k(this.c);
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
deleted file mode 100644
index d35f1647..00000000
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package net.minecraft.server;
-
-//import java.util.ArrayList; // CraftBukkit
-import java.util.Iterator;
-
-import org.bukkit.craftbukkit.util.UnsafeList; // CraftBukkit
-
-public class PathfinderGoalSelector {
-
- // CraftBukkit start - use UnsafeList
- private UnsafeList a = new UnsafeList(16);
- private UnsafeList b = new UnsafeList(16);
- // CraftBukkit end
-
- public PathfinderGoalSelector() {}
-
- public void a(int i, PathfinderGoal pathfindergoal) {
- this.a.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal));
- }
-
- public void a() {
- //ArrayList arraylist = new ArrayList(); // CraftBukkit - removed usage
-
- // CraftBukkit start - don't use iterators for private fields
- for (int i = 0; i < this.a.size(); i++) {
- PathfinderGoalSelectorItem pathfindergoalselectoritem = (PathfinderGoalSelectorItem) this.a.unsafeGet(i);
- // CraftBukkit end
- boolean flag = this.b.contains(pathfindergoalselectoritem);
-
- if (flag) {
- if (this.a(pathfindergoalselectoritem) && pathfindergoalselectoritem.a.b()) {
- continue;
- }
-
- pathfindergoalselectoritem.a.d();
- this.b.remove(pathfindergoalselectoritem);
- }
-
- if (this.a(pathfindergoalselectoritem) && pathfindergoalselectoritem.a.a()) {
- // CraftBukkit start - call method now
- // arraylist.add(pathfindergoalselectoritem);
- pathfindergoalselectoritem.a.c();
- // CraftBukkit end
- this.b.add(pathfindergoalselectoritem);
- }
- }
-
- boolean flag1 = false;
-
- /* CraftBukkit start - removed usage of arraylist
- if (flag1 && arraylist.size() > 0) {
- System.out.println("Starting: ");
- }
- // CraftBukkit end */
-
- Iterator iterator1;
- PathfinderGoalSelectorItem pathfindergoalselectoritem1;
-
- /* CraftBukkit start - removed usage of arraylist
- for (iterator1 = arraylist.iterator(); iterator1.hasNext(); pathfindergoalselectoritem1.a.c()) {
- pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) iterator1.next();
- if (flag1) {
- System.out.println(pathfindergoalselectoritem1.a.toString() + ", ");
- }
- }
- // CraftBukkit end */
-
- if (flag1 && this.b.size() > 0) {
- System.out.println("Running: ");
- }
-
- // CraftBukkit start - don't use iterators for private fields
- for (int i = 0; i < this.b.size(); i++) {
- pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) this.b.unsafeGet(i); // CraftBukkit - use unsafeGet
- pathfindergoalselectoritem1.a.e();
- if (flag1) {
- System.out.println(pathfindergoalselectoritem1.a.toString());
- }
- }
- // CraftBukkit end
- }
-
- private boolean a(PathfinderGoalSelectorItem pathfindergoalselectoritem) {
- // CraftBukkit start - don't use iterators for private fields
- for (int i = 0; i < this.a.size(); i++) {
- PathfinderGoalSelectorItem pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) this.a.unsafeGet(i); // CraftBukkit - use unsafeGet
-
- if (pathfindergoalselectoritem1 != pathfindergoalselectoritem) {
- if (pathfindergoalselectoritem.b >= pathfindergoalselectoritem1.b) {
- if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.b.contains(pathfindergoalselectoritem1)) { // CraftBukkit - switch order
- return false;
- }
- } else if (!pathfindergoalselectoritem1.a.g() && this.b.contains(pathfindergoalselectoritem1)) { // CraftBukkit - switch order
- return false;
- }
- }
- }
- // CraftBukkit end
-
- return true;
- }
-
- private boolean a(PathfinderGoalSelectorItem pathfindergoalselectoritem, PathfinderGoalSelectorItem pathfindergoalselectoritem1) {
- return (pathfindergoalselectoritem.a.h() & pathfindergoalselectoritem1.a.h()) == 0;
- }
-}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
index 32d8dab7..2c59ef6d 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
@@ -4,12 +4,12 @@ import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
public abstract class PathfinderGoalTarget extends PathfinderGoal {
- protected EntityLiving c;
- protected float d;
- protected boolean e;
+ protected EntityLiving d;
+ protected float e;
+ protected boolean f;
private boolean a;
private int b;
- private int f;
+ private int c;
private int g;
public PathfinderGoalTarget(EntityLiving entityliving, float f, boolean flag) {
@@ -18,31 +18,29 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
public PathfinderGoalTarget(EntityLiving entityliving, float f, boolean flag, boolean flag1) {
this.b = 0;
- this.f = 0;
+ this.c = 0;
this.g = 0;
- this.c = entityliving;
- this.d = f;
- this.e = flag;
+ this.d = entityliving;
+ this.e = f;
+ this.f = flag;
this.a = flag1;
}
public boolean b() {
- EntityLiving entityliving = this.c.at();
+ EntityLiving entityliving = this.d.az();
if (entityliving == null) {
return false;
} else if (!entityliving.isAlive()) {
return false;
- } else if (this.c.j(entityliving) > (double) (this.d * this.d)) {
+ } else if (this.d.e(entityliving) > (double) (this.e * this.e)) {
return false;
} else {
- if (this.e) {
- if (!this.c.am().canSee(entityliving)) {
- if (++this.g > 60) {
- return false;
- }
- } else {
+ if (this.f) {
+ if (this.d.at().canSee(entityliving)) {
this.g = 0;
+ } else if (++this.g > 60) {
+ return false;
}
}
@@ -50,46 +48,46 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
}
- public void c() {
+ public void e() {
this.b = 0;
- this.f = 0;
+ this.c = 0;
this.g = 0;
}
- public void d() {
- this.c.b((EntityLiving) null);
+ public void c() {
+ this.d.b((EntityLiving) null);
}
protected boolean a(EntityLiving entityliving, boolean flag) {
if (entityliving == null) {
return false;
- } else if (entityliving == this.c) {
+ } else if (entityliving == this.d) {
return false;
} else if (!entityliving.isAlive()) {
return false;
- } else if (entityliving.boundingBox.e > this.c.boundingBox.b && entityliving.boundingBox.b < this.c.boundingBox.e) {
- if (!this.c.a(entityliving.getClass())) {
+ } else if (entityliving.boundingBox.e > this.d.boundingBox.b && entityliving.boundingBox.b < this.d.boundingBox.e) {
+ if (!this.d.a(entityliving.getClass())) {
return false;
} else {
- if (this.c instanceof EntityTameableAnimal && ((EntityTameableAnimal) this.c).isTamed()) {
+ if (this.d instanceof EntityTameableAnimal && ((EntityTameableAnimal) this.d).isTamed()) {
if (entityliving instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityliving).isTamed()) {
return false;
}
- if (entityliving == ((EntityTameableAnimal) this.c).getOwner()) {
+ if (entityliving == ((EntityTameableAnimal) this.d).getOwner()) {
return false;
}
} else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
return false;
}
- if (!this.c.e(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
+ if (!this.d.d(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
return false;
- } else if (this.e && !this.c.am().canSee(entityliving)) {
+ } else if (this.f && !this.d.at().canSee(entityliving)) {
return false;
} else {
if (this.a) {
- if (--this.f <= 0) {
+ if (--this.c <= 0) {
this.b = 0;
}
@@ -102,7 +100,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
}
- // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET
+ // CraftBukkit start - check all the different target goals for the reason, default to RANDOM_TARGET
EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET;
if (this instanceof PathfinderGoalDefendVillage) {
@@ -119,11 +117,11 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
}
- org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(c, entityliving, reason);
+ org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.d, entityliving, reason);
if (event.isCancelled() || event.getTarget() == null) {
return false;
} else if (entityliving.getBukkitEntity() != event.getTarget()) {
- this.c.b((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle());
+ this.d.b((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle());
}
// CraftBukkit end
@@ -136,8 +134,8 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
private boolean a(EntityLiving entityliving) {
- this.f = 10 + this.c.an().nextInt(5);
- PathEntity pathentity = this.c.al().a(entityliving);
+ this.c = 10 + this.d.au().nextInt(5);
+ PathEntity pathentity = this.d.getNavigation().a(entityliving);
if (pathentity == null) {
return false;
diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java
index 671df47d..359df829 100644
--- a/src/main/java/net/minecraft/server/PlayerInstance.java
+++ b/src/main/java/net/minecraft/server/PlayerInstance.java
@@ -1,17 +1,16 @@
package net.minecraft.server;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
class PlayerInstance {
- private List b;
- private int chunkX;
- private int chunkZ;
- private ChunkCoordIntPair location;
+ private final List b;
+ private final ChunkCoordIntPair location;
private short[] dirtyBlocks;
private int dirtyCount;
- private int h;
+ private int f;
final PlayerManager playerManager;
@@ -20,22 +19,14 @@ class PlayerInstance {
this.b = new ArrayList();
this.dirtyBlocks = new short[64];
this.dirtyCount = 0;
- this.chunkX = i;
- this.chunkZ = j;
this.location = new ChunkCoordIntPair(i, j);
playermanager.a().chunkProviderServer.getChunkAt(i, j);
}
public void a(EntityPlayer entityplayer) {
if (this.b.contains(entityplayer)) {
- throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.chunkX + ", " + this.chunkZ);
+ throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.location.x + ", " + this.location.z);
} else {
- // CraftBukkit start
- if (entityplayer.playerChunkCoordIntPairs.add(this.location)) {
- entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.location.x, this.location.z, true));
- }
- // CraftBukkit end
-
this.b.add(entityplayer);
entityplayer.chunkCoordIntPairQueue.add(this.location);
}
@@ -43,32 +34,28 @@ class PlayerInstance {
public void b(EntityPlayer entityplayer) {
if (this.b.contains(entityplayer)) {
+ entityplayer.netServerHandler.sendPacket(new Packet51MapChunk(PlayerManager.a(this.playerManager).getChunkAt(this.location.x, this.location.z), true, 0));
this.b.remove(entityplayer);
- if (this.b.size() == 0) {
- long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32;
+ entityplayer.chunkCoordIntPairQueue.remove(this.location);
+ if (this.b.isEmpty()) {
+ long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32;
- PlayerManager.a(this.playerManager).remove(i);
+ PlayerManager.b(this.playerManager).remove(i);
if (this.dirtyCount > 0) {
- PlayerManager.b(this.playerManager).remove(this);
+ PlayerManager.c(this.playerManager).remove(this);
}
- this.playerManager.a().chunkProviderServer.queueUnload(this.chunkX, this.chunkZ);
- }
-
- entityplayer.chunkCoordIntPairQueue.remove(this.location);
- // CraftBukkit - contains -> remove -- TODO VERIFY!!!!
- if (entityplayer.playerChunkCoordIntPairs.remove(this.location)) {
- entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.chunkX, this.chunkZ, false));
+ this.playerManager.a().chunkProviderServer.queueUnload(this.location.x, this.location.z);
}
}
}
public void a(int i, int j, int k) {
if (this.dirtyCount == 0) {
- PlayerManager.b(this.playerManager).add(this);
+ PlayerManager.c(this.playerManager).add(this);
}
- this.h |= 1 << (j >> 4);
+ this.f |= 1 << (j >> 4);
if (this.dirtyCount < 64) {
short short1 = (short) (i << 12 | k << 8 | j);
@@ -83,75 +70,86 @@ class PlayerInstance {
}
public void sendAll(Packet packet) {
- for (int i = 0; i < this.b.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
+ Iterator iterator = this.b.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- if (entityplayer.playerChunkCoordIntPairs.contains(this.location) && !entityplayer.chunkCoordIntPairQueue.contains(this.location)) {
+ if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) {
entityplayer.netServerHandler.sendPacket(packet);
}
}
}
public void a() {
- WorldServer worldserver = this.playerManager.a();
-
if (this.dirtyCount != 0) {
int i;
int j;
int k;
if (this.dirtyCount == 1) {
- i = this.chunkX * 16 + (this.dirtyBlocks[0] >> 12 & 15);
+ i = this.location.x * 16 + (this.dirtyBlocks[0] >> 12 & 15);
j = this.dirtyBlocks[0] & 255;
- k = this.chunkZ * 16 + (this.dirtyBlocks[0] >> 8 & 15);
- this.sendAll(new Packet53BlockChange(i, j, k, worldserver));
- if (worldserver.isTileEntity(i, j, k)) {
- this.sendTileEntity(worldserver.getTileEntity(i, j, k));
+ k = this.location.z * 16 + (this.dirtyBlocks[0] >> 8 & 15);
+ this.sendAll(new Packet53BlockChange(i, j, k, PlayerManager.a(this.playerManager)));
+ if (PlayerManager.a(this.playerManager).isTileEntity(i, j, k)) {
+ this.sendTileEntity(PlayerManager.a(this.playerManager).getTileEntity(i, j, k));
}
} else {
int l;
if (this.dirtyCount == 64) {
- i = this.chunkX * 16;
- j = this.chunkZ * 16;
- this.sendAll(new Packet51MapChunk(worldserver.getChunkAt(this.chunkX, this.chunkZ), (this.h == 0xFFFF), this.h)); // CraftBukkit - send everything (including biome) if all sections flagged
+ i = this.location.x * 16;
+ j = this.location.z * 16;
+ this.sendAll(new Packet51MapChunk(PlayerManager.a(this.playerManager).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
for (k = 0; k < 16; ++k) {
- if ((this.h & 1 << k) != 0) {
+ if ((this.f & 1 << k) != 0) {
l = k << 4;
- List list = worldserver.getTileEntities(i, l, j, i + 16, l + 16, j + 16);
+ 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();
- for (int i1 = 0; i1 < list.size(); ++i1) {
- this.sendTileEntity((TileEntity) list.get(i1));
+ this.sendTileEntity(tileentity);
}
}
}
} else {
- this.sendAll(new Packet52MultiBlockChange(this.chunkX, this.chunkZ, this.dirtyBlocks, this.dirtyCount, worldserver));
+ this.sendAll(new Packet52MultiBlockChange(this.location.x, this.location.z, this.dirtyBlocks, this.dirtyCount, PlayerManager.a(this.playerManager)));
for (i = 0; i < this.dirtyCount; ++i) {
- j = this.chunkX * 16 + (this.dirtyBlocks[i] >> 12 & 15);
+ j = this.location.x * 16 + (this.dirtyBlocks[i] >> 12 & 15);
k = this.dirtyBlocks[i] & 255;
- l = this.chunkZ * 16 + (this.dirtyBlocks[i] >> 8 & 15);
- if (worldserver.isTileEntity(j, k, l)) {
- this.sendTileEntity(worldserver.getTileEntity(j, k, l));
+ l = this.location.z * 16 + (this.dirtyBlocks[i] >> 8 & 15);
+ if (PlayerManager.a(this.playerManager).isTileEntity(j, k, l)) {
+ this.sendTileEntity(PlayerManager.a(this.playerManager).getTileEntity(j, k, l));
}
}
}
}
this.dirtyCount = 0;
- this.h = 0;
+ this.f = 0;
}
}
private void sendTileEntity(TileEntity tileentity) {
if (tileentity != null) {
- Packet packet = tileentity.d();
+ Packet packet = tileentity.e();
if (packet != null) {
this.sendAll(packet);
}
}
}
+
+ static ChunkCoordIntPair a(PlayerInstance playerinstance) {
+ return playerinstance.location;
+ }
+
+ static List b(PlayerInstance playerinstance) {
+ return playerinstance.b;
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
index a5e2c4d2..88566f49 100644
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
@@ -13,7 +13,7 @@ public class PlayerInventory implements IInventory {
public ItemStack[] armor = new ItemStack[4];
public int itemInHandIndex = 0;
public EntityHuman player;
- private ItemStack f;
+ private ItemStack g;
public boolean e = false;
// CraftBukkit start
@@ -61,7 +61,7 @@ public class PlayerInventory implements IInventory {
return 9;
}
- private int f(int i) {
+ private int h(int i) {
for (int j = 0; j < this.items.length; ++j) {
if (this.items[j] != null && this.items[j].id == i) {
return j;
@@ -97,7 +97,7 @@ public class PlayerInventory implements IInventory {
}
// CraftBukkit end
- private int m() {
+ public int i() {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] == null) {
return i;
@@ -113,7 +113,7 @@ public class PlayerInventory implements IInventory {
int k;
if (itemstack.getMaxStackSize() == 1) {
- k = this.m();
+ k = this.i();
if (k < 0) {
return j;
} else {
@@ -126,7 +126,7 @@ public class PlayerInventory implements IInventory {
} else {
k = this.firstPartial(itemstack);
if (k < 0) {
- k = this.m();
+ k = this.i();
}
if (k < 0) {
@@ -161,7 +161,7 @@ public class PlayerInventory implements IInventory {
}
}
- public void i() {
+ public void k() {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] != null) {
this.items[i].a(this.player.world, this.player, i, this.itemInHandIndex == i);
@@ -169,8 +169,8 @@ public class PlayerInventory implements IInventory {
}
}
- public boolean c(int i) {
- int j = this.f(i);
+ public boolean d(int i) {
+ int j = this.h(i);
if (j < 0) {
return false;
@@ -183,8 +183,8 @@ public class PlayerInventory implements IInventory {
}
}
- public boolean d(int i) {
- int j = this.f(i);
+ public boolean e(int i) {
+ int j = this.h(i);
return j >= 0;
}
@@ -192,8 +192,8 @@ public class PlayerInventory implements IInventory {
public boolean pickup(ItemStack itemstack) {
int i;
- if (itemstack.f()) {
- i = this.m();
+ if (itemstack.h()) {
+ i = this.i();
if (i >= 0) {
this.items[i] = ItemStack.b(itemstack);
this.items[i].b = 5;
@@ -353,7 +353,7 @@ public class PlayerInventory implements IInventory {
}
public int getMaxStackSize() {
- return maxStack; // CraftBukkit
+ return maxStack;
}
public int a(Entity entity) {
@@ -378,21 +378,25 @@ public class PlayerInventory implements IInventory {
}
}
- public int j() {
+ public int l() {
int i = 0;
+ ItemStack[] aitemstack = this.armor;
+ int j = aitemstack.length;
- 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;
+ for (int k = 0; k < j; ++k) {
+ ItemStack itemstack = aitemstack[k];
+
+ if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
+ int l = ((ItemArmor) itemstack.getItem()).b;
- i += k;
+ i += l;
}
}
return i;
}
- public void e(int i) {
+ public void g(int i) {
i /= 4;
if (i < 1) {
i = 1;
@@ -402,14 +406,13 @@ public class PlayerInventory implements IInventory {
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
this.armor[j].damage(i, this.player);
if (this.armor[j].count == 0) {
- this.armor[j].a(this.player);
this.armor[j] = null;
}
}
}
}
- public void k() {
+ public void m() {
int i;
for (i = 0; i < this.items.length; ++i) {
@@ -432,34 +435,42 @@ public class PlayerInventory implements IInventory {
}
public void setCarried(ItemStack itemstack) {
- this.f = itemstack;
- this.player.carriedChanged(itemstack);
+ this.g = itemstack;
}
public ItemStack getCarried() {
// CraftBukkit start
- if (this.f != null && this.f.count == 0) {
+ if (this.g != null && this.g.count == 0) {
this.setCarried(null);
}
// CraftBukkit end
- return this.f;
+ return this.g;
}
public boolean a(EntityHuman entityhuman) {
- return this.player.dead ? false : entityhuman.j(this.player) <= 64.0D;
+ return this.player.dead ? false : entityhuman.e(this.player) <= 64.0D;
}
public boolean c(ItemStack itemstack) {
- int i;
+ ItemStack[] aitemstack = this.armor;
+ int i = aitemstack.length;
- for (i = 0; i < this.armor.length; ++i) {
- if (this.armor[i] != null && this.armor[i].c(itemstack)) {
+ int j;
+ ItemStack itemstack1;
+
+ for (j = 0; j < i; ++j) {
+ itemstack1 = aitemstack[j];
+ if (itemstack1 != null && itemstack1.c(itemstack)) {
return true;
}
}
- for (i = 0; i < this.items.length; ++i) {
- if (this.items[i] != null && this.items[i].c(itemstack)) {
+ aitemstack = this.items;
+ i = aitemstack.length;
+
+ for (j = 0; j < i; ++j) {
+ itemstack1 = aitemstack[j];
+ if (itemstack1 != null && itemstack1.c(itemstack)) {
return true;
}
}
@@ -467,11 +478,11 @@ public class PlayerInventory implements IInventory {
return false;
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
- public void a(PlayerInventory playerinventory) {
+ public void b(PlayerInventory playerinventory) {
int i;
for (i = 0; i < this.items.length; ++i) {
diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java
index aaadfefb..0f4e678e 100644
--- a/src/main/java/net/minecraft/server/PlayerManager.java
+++ b/src/main/java/net/minecraft/server/PlayerManager.java
@@ -1,48 +1,50 @@
package net.minecraft.server;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
public class PlayerManager {
- public List managedPlayers = new ArrayList();
- private LongHashMap b = new LongHashMap();
- private List c = new ArrayList();
- private MinecraftServer server;
- private int e;
- private int f;
- private final int[][] g = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
+ private final WorldServer world;
+ private final List managedPlayers = new ArrayList();
+ private final LongHashMap c = new LongHashMap();
+ private final List d = new ArrayList();
+ private final int e;
+ private final int[][] f = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
private boolean wasNotEmpty; // CraftBukkit
- public PlayerManager(MinecraftServer minecraftserver, int i, int j) {
- if (j > 15) {
+ public PlayerManager(WorldServer worldserver, int i) {
+ if (i > 15) {
throw new IllegalArgumentException("Too big view radius!");
- } else if (j < 3) {
+ } else if (i < 3) {
throw new IllegalArgumentException("Too small view radius!");
} else {
- this.f = j;
- this.server = minecraftserver;
this.e = i;
+ this.world = worldserver;
}
}
public WorldServer a() {
- return this.server.getWorldServer(this.e);
+ return this.world;
}
public void flush() {
- for (int i = 0; i < this.c.size(); ++i) {
- ((PlayerInstance) this.c.get(i)).a();
+ Iterator iterator = this.d.iterator();
+
+ while (iterator.hasNext()) {
+ PlayerInstance playerinstance = (PlayerInstance) iterator.next();
+
+ playerinstance.a();
}
- this.c.clear();
+ this.d.clear();
if (this.managedPlayers.isEmpty()) {
if (!wasNotEmpty) return; // CraftBukkit - only do unload when we go from non-empty to empty
- WorldServer worldserver = this.server.getWorldServer(this.e);
- WorldProvider worldprovider = worldserver.worldProvider;
+ WorldProvider worldprovider = this.world.worldProvider;
- if (!worldprovider.c()) {
- worldserver.chunkProviderServer.c();
+ if (!worldprovider.e()) {
+ this.world.chunkProviderServer.a();
}
// CraftBukkit start
wasNotEmpty = false;
@@ -54,11 +56,11 @@ public class PlayerManager {
private PlayerInstance a(int i, int j, boolean flag) {
long k = (long) i + 2147483647L | (long) j + 2147483647L << 32;
- PlayerInstance playerinstance = (PlayerInstance) this.b.getEntry(k);
+ PlayerInstance playerinstance = (PlayerInstance) this.c.getEntry(k);
if (playerinstance == null && flag) {
playerinstance = new PlayerInstance(this, i, j);
- this.b.put(k, playerinstance);
+ this.c.put(k, playerinstance);
}
return playerinstance;
@@ -80,44 +82,67 @@ public class PlayerManager {
entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ;
- int k = 0;
- int l = this.f;
+
+ for (int k = i - this.e; k <= i + this.e; ++k) {
+ for (int l = j - this.e; l <= j + this.e; ++l) {
+ this.a(k, l, true).a(entityplayer);
+ }
+ }
+
+ this.managedPlayers.add(entityplayer);
+ this.b(entityplayer);
+ }
+
+ public void b(EntityPlayer entityplayer) {
+ ArrayList arraylist = new ArrayList(entityplayer.chunkCoordIntPairQueue);
+ int i = 0;
+ int j = this.e;
+ int k = (int) entityplayer.locX >> 4;
+ int l = (int) entityplayer.locZ >> 4;
int i1 = 0;
int j1 = 0;
+ ChunkCoordIntPair chunkcoordintpair = PlayerInstance.a(this.a(k, l, true));
- this.a(i, j, true).a(entityplayer);
+ entityplayer.chunkCoordIntPairQueue.clear();
+ if (arraylist.contains(chunkcoordintpair)) {
+ entityplayer.chunkCoordIntPairQueue.add(chunkcoordintpair);
+ }
int k1;
- for (k1 = 1; k1 <= l * 2; ++k1) {
+ for (k1 = 1; k1 <= j * 2; ++k1) {
for (int l1 = 0; l1 < 2; ++l1) {
- int[] aint = this.g[k++ % 4];
+ int[] aint = this.f[i++ % 4];
for (int i2 = 0; i2 < k1; ++i2) {
i1 += aint[0];
j1 += aint[1];
- this.a(i + i1, j + j1, true).a(entityplayer);
+ chunkcoordintpair = PlayerInstance.a(this.a(k + i1, l + j1, true));
+ if (arraylist.contains(chunkcoordintpair)) {
+ entityplayer.chunkCoordIntPairQueue.add(chunkcoordintpair);
+ }
}
}
}
- k %= 4;
+ i %= 4;
- for (k1 = 0; k1 < l * 2; ++k1) {
- i1 += this.g[k][0];
- j1 += this.g[k][1];
- this.a(i + i1, j + j1, true).a(entityplayer);
+ for (k1 = 0; k1 < j * 2; ++k1) {
+ i1 += this.f[i][0];
+ j1 += this.f[i][1];
+ chunkcoordintpair = PlayerInstance.a(this.a(k + i1, l + j1, true));
+ if (arraylist.contains(chunkcoordintpair)) {
+ entityplayer.chunkCoordIntPairQueue.add(chunkcoordintpair);
+ }
}
-
- this.managedPlayers.add(entityplayer);
}
public void removePlayer(EntityPlayer entityplayer) {
int i = (int) entityplayer.d >> 4;
int j = (int) entityplayer.e >> 4;
- for (int k = i - this.f; k <= i + this.f; ++k) {
- for (int l = j - this.f; l <= j + this.f; ++l) {
+ for (int k = i - this.e; k <= i + this.e; ++k) {
+ for (int l = j - this.e; l <= j + this.e; ++l) {
PlayerInstance playerinstance = this.a(k, l, false);
if (playerinstance != null) {
@@ -129,11 +154,11 @@ public class PlayerManager {
this.managedPlayers.remove(entityplayer);
}
- private boolean a(int i, int j, int k, int l) {
- int i1 = i - k;
- int j1 = j - l;
+ private boolean a(int i, int j, int k, int l, int i1) {
+ int j1 = i - k;
+ int k1 = j - l;
- return i1 >= -this.f && i1 <= this.f ? j1 >= -this.f && j1 <= this.f : false;
+ return j1 >= -i1 && j1 <= i1 ? k1 >= -i1 && k1 <= i1 : false;
}
public void movePlayer(EntityPlayer entityplayer) {
@@ -146,18 +171,19 @@ public class PlayerManager {
if (d2 >= 64.0D) {
int k = (int) entityplayer.d >> 4;
int l = (int) entityplayer.e >> 4;
- int i1 = i - k;
- int j1 = j - l;
-
- if (i1 != 0 || j1 != 0) {
- for (int k1 = i - this.f; k1 <= i + this.f; ++k1) {
- for (int l1 = j - this.f; l1 <= j + this.f; ++l1) {
- if (!this.a(k1, l1, k, l)) {
- this.a(k1, l1, true).a(entityplayer);
+ int i1 = this.e;
+ int j1 = i - k;
+ int k1 = j - l;
+
+ if (j1 != 0 || k1 != 0) {
+ for (int l1 = i - i1; l1 <= i + i1; ++l1) {
+ for (int i2 = j - i1; i2 <= j + i1; ++i2) {
+ if (!this.a(l1, i2, k, l, i1)) {
+ this.a(l1, i2, true).a(entityplayer);
}
- if (!this.a(k1 - i1, l1 - j1, i, j)) {
- PlayerInstance playerinstance = this.a(k1 - i1, l1 - j1, false);
+ if (!this.a(l1 - j1, i2 - k1, i, j, i1)) {
+ PlayerInstance playerinstance = this.a(l1 - j1, i2 - k1, false);
if (playerinstance != null) {
playerinstance.b(entityplayer);
@@ -166,6 +192,7 @@ public class PlayerManager {
}
}
+ this.b(entityplayer);
entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ;
@@ -186,15 +213,25 @@ public class PlayerManager {
}
}
- public int getFurthestViewableBlock() {
- return this.f * 16 - 16;
+ public boolean a(EntityPlayer entityplayer, int i, int j) {
+ PlayerInstance playerinstance = this.a(i, j, false);
+
+ return playerinstance == null ? false : PlayerInstance.b(playerinstance).contains(entityplayer);
}
- static LongHashMap a(PlayerManager playermanager) {
- return playermanager.b;
+ public static int getFurthestViewableBlock(int i) {
+ return i * 16 - 16;
}
- static List b(PlayerManager playermanager) {
+ static WorldServer a(PlayerManager playermanager) {
+ return playermanager.world;
+ }
+
+ static LongHashMap b(PlayerManager playermanager) {
return playermanager.c;
}
+
+ static List c(PlayerManager playermanager) {
+ return playermanager.d;
+ }
}
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index e75220af..40c7b894 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -66,7 +66,7 @@ public class PortalTravelAgent {
for (int k1 = i1 - short1; k1 <= i1 + short1; ++k1) {
double d3 = (double) k1 + 0.5D - entity.locZ;
- for (int l1 = 127; l1 >= 0; --l1) {
+ for (int l1 = world.L() - 1; l1 >= 0; --l1) {
if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
--l1;
@@ -150,7 +150,7 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - entity.locZ;
label274:
- for (l2 = 127; l2 >= 0; --l2) {
+ for (l2 = world.L() - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@@ -201,7 +201,7 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - entity.locZ;
label222:
- for (l2 = 127; l2 >= 0; --l2) {
+ for (l2 = world.L() - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@@ -257,8 +257,8 @@ public class PortalTravelAgent {
i1 = 70;
}
- if (i1 > 118) {
- i1 = 118;
+ if (i1 > world.L() - 10) {
+ i1 = world.L() - 10;
}
j5 = i1;
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index 20e981c8..af01fd33 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -3,6 +3,7 @@ package net.minecraft.server;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -12,17 +13,28 @@ import joptsimple.OptionSet; // CraftBukkit
public class PropertyManager {
public static Logger a = Logger.getLogger("Minecraft");
- public Properties properties = new Properties(); // CraftBukkit - priv to pub
+ public Properties properties = new Properties(); // CraftBukkit - private -> public
private File c;
public PropertyManager(File file1) {
this.c = file1;
if (file1.exists()) {
+ FileInputStream fileinputstream = null;
+
try {
- this.properties.load(new FileInputStream(file1));
+ fileinputstream = new FileInputStream(file1);
+ this.properties.load(fileinputstream);
} catch (Exception exception) {
a.log(Level.WARNING, "Failed to load " + file1, exception);
this.a();
+ } finally {
+ if (fileinputstream != null) {
+ try {
+ fileinputstream.close();
+ } catch (IOException ioexception) {
+ ;
+ }
+ }
}
} else {
a.log(Level.WARNING, file1 + " does not exist");
@@ -54,11 +66,22 @@ public class PropertyManager {
}
public void savePropertiesFile() {
+ FileOutputStream fileoutputstream = null;
+
try {
- this.properties.store(new FileOutputStream(this.c), "Minecraft server properties");
+ fileoutputstream = new FileOutputStream(this.c);
+ this.properties.store(fileoutputstream, "Minecraft server properties");
} catch (Exception exception) {
a.log(Level.WARNING, "Failed to save " + this.c, exception);
this.a();
+ } finally {
+ if (fileoutputstream != null) {
+ try {
+ fileoutputstream.close();
+ } catch (IOException ioexception) {
+ ;
+ }
+ }
}
}
@@ -99,9 +122,4 @@ public class PropertyManager {
public void a(String s, Object object) {
this.properties.setProperty(s, "" + object);
}
-
- public void setBoolean(String s, boolean flag) {
- this.properties.setProperty(s, "" + flag);
- this.savePropertiesFile();
- }
}
diff --git a/src/main/java/net/minecraft/server/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java
new file mode 100644
index 00000000..b055aab9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/RecipesFurnace.java
@@ -0,0 +1,51 @@
+package net.minecraft.server;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class RecipesFurnace {
+
+ private static final RecipesFurnace a = new RecipesFurnace();
+ public Map recipes = new HashMap(); // CraftBukkit - private -> public
+ private Map c = new HashMap();
+
+ public static final RecipesFurnace getInstance() {
+ return a;
+ }
+
+ public RecipesFurnace() { // CraftBukkit - private -> public
+ this.registerRecipe(Block.IRON_ORE.id, new ItemStack(Item.IRON_INGOT), 0.7F);
+ this.registerRecipe(Block.GOLD_ORE.id, new ItemStack(Item.GOLD_INGOT), 1.0F);
+ this.registerRecipe(Block.DIAMOND_ORE.id, new ItemStack(Item.DIAMOND), 1.0F);
+ this.registerRecipe(Block.SAND.id, new ItemStack(Block.GLASS), 0.1F);
+ this.registerRecipe(Item.PORK.id, new ItemStack(Item.GRILLED_PORK), 0.3F);
+ this.registerRecipe(Item.RAW_BEEF.id, new ItemStack(Item.COOKED_BEEF), 0.3F);
+ this.registerRecipe(Item.RAW_CHICKEN.id, new ItemStack(Item.COOKED_CHICKEN), 0.3F);
+ this.registerRecipe(Item.RAW_FISH.id, new ItemStack(Item.COOKED_FISH), 0.3F);
+ this.registerRecipe(Block.COBBLESTONE.id, new ItemStack(Block.STONE), 0.1F);
+ this.registerRecipe(Item.CLAY_BALL.id, new ItemStack(Item.CLAY_BRICK), 0.2F);
+ this.registerRecipe(Block.CACTUS.id, new ItemStack(Item.INK_SACK, 1, 2), 0.2F);
+ this.registerRecipe(Block.LOG.id, new ItemStack(Item.COAL, 1, 1), 0.1F);
+ this.registerRecipe(Block.EMERALD_ORE.id, new ItemStack(Item.EMERALD), 1.0F);
+ this.registerRecipe(Block.COAL_ORE.id, new ItemStack(Item.COAL), 0.1F);
+ this.registerRecipe(Block.REDSTONE_ORE.id, new ItemStack(Item.REDSTONE), 0.7F);
+ this.registerRecipe(Block.LAPIS_ORE.id, new ItemStack(Item.INK_SACK, 1, 4), 0.2F);
+ }
+
+ public void registerRecipe(int i, ItemStack itemstack, float f) {
+ this.recipes.put(Integer.valueOf(i), itemstack);
+ this.c.put(Integer.valueOf(itemstack.id), Float.valueOf(f));
+ }
+
+ public ItemStack getResult(int i) {
+ return (ItemStack) this.recipes.get(Integer.valueOf(i));
+ }
+
+ public Map getRecipes() {
+ return this.recipes;
+ }
+
+ public float c(int i) {
+ return this.c.containsKey(Integer.valueOf(i)) ? ((Float) this.c.get(Integer.valueOf(i))).floatValue() : 0.0F;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/RemoteControlSession.java b/src/main/java/net/minecraft/server/RemoteControlSession.java
deleted file mode 100644
index 85b424e7..00000000
--- a/src/main/java/net/minecraft/server/RemoteControlSession.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package net.minecraft.server;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.net.Socket;
-import java.net.SocketTimeoutException;
-
-public class RemoteControlSession extends RemoteConnectionThread {
-
- private boolean g = false;
- private Socket h;
- private byte[] i = new byte[1460];
- private String j;
-
- RemoteControlSession(IMinecraftServer iminecraftserver, Socket socket) {
- super(iminecraftserver);
- this.h = socket;
- // CraftBukkit start - set infinite timeout so we sleep until there is data available
- try {
- this.h.setSoTimeout(0);
- } catch (Exception ex) {
- this.running = false;
- }
- // CraftBukkit end
- this.j = iminecraftserver.a("rcon.password", "");
- this.info("Rcon connection from: " + socket.getInetAddress());
- }
-
- public void run() {
- // while (true) { // CraftBukkit - moved down
- try {
- while (true) { // CraftBukkit - moved from above
- if (!this.running) {
- return;
- }
-
- try {
- BufferedInputStream bufferedinputstream = new BufferedInputStream(this.h.getInputStream());
- int i = bufferedinputstream.read(this.i, 0, 1460);
-
- if (10 <= i) {
- byte b0 = 0;
- int j = StatusChallengeUtils.b(this.i, 0, i);
-
- if (j != i - 4) {
- return;
- }
-
- int k = b0 + 4;
- int l = StatusChallengeUtils.b(this.i, k, i);
-
- k += 4;
- int i1 = StatusChallengeUtils.a(this.i, k);
-
- k += 4;
- switch (i1) {
- case 2:
- if (this.g) {
- String s = StatusChallengeUtils.a(this.i, k, i);
-
- try {
- this.a(l, this.server.d(s));
- } catch (Exception exception) {
- this.a(l, "Error executing: " + s + " (" + exception.getMessage() + ")");
- }
- continue;
- }
-
- this.e();
- continue;
-
- case 3:
- String s1 = StatusChallengeUtils.a(this.i, k, i);
- int j1 = k + s1.length();
-
- if (0 != s1.length() && s1.equals(this.j)) {
- this.g = true;
- this.a(l, 2, "");
- continue;
- }
-
- this.g = false;
- this.e();
- continue;
-
- default:
- this.a(l, String.format("Unknown request %s", new Object[] { Integer.toHexString(i1)}));
- continue;
- }
- }
- return; // CraftBukkit - return if we don't get enough data
- } catch (SocketTimeoutException sockettimeoutexception) {
- continue;
- } catch (IOException ioexception) {
- if (this.running) {
- this.info("IO: " + ioexception.getMessage());
- }
- return; // CraftBukkit - shut down the thread after hitting an exception.
- }
- } // CraftBukkit - Loop shift
- } catch (Exception exception1) {
- System.out.println(exception1);
- return;
- } finally {
- this.f();
- }
- // CraftBukkit - Loop shift
- }
-
- private void a(int i, int j, String s) throws IOException { // CraftBukkit - throws IOException
- ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(1248);
- DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
-
- dataoutputstream.writeInt(Integer.reverseBytes(s.length() + 10));
- dataoutputstream.writeInt(Integer.reverseBytes(i));
- dataoutputstream.writeInt(Integer.reverseBytes(j));
- dataoutputstream.writeBytes(s);
- dataoutputstream.write(0);
- dataoutputstream.write(0);
- this.h.getOutputStream().write(bytearrayoutputstream.toByteArray());
- }
-
- private void e() throws IOException { // CraftBukkit - throws IOException
- this.a(-1, 2, "");
- }
-
- private void a(int i, String s) throws IOException { // CraftBukkit - throws IOException
- int j = s.length();
-
- do {
- int k = 4096 <= j ? 4096 : j;
-
- this.a(i, 0, s.substring(0, k));
- s = s.substring(k);
- j = s.length();
- } while (0 != j);
-
- }
-
- private void f() {
- if (null != this.h) {
- try {
- this.h.close();
- this.info("Rcon connection closed."); // CraftBukkit
- } catch (IOException ioexception) {
- this.warning("IO: " + ioexception.getMessage());
- }
-
- this.h = null;
- }
- }
-}
diff --git a/src/main/java/net/minecraft/server/SecondaryWorldServer.java b/src/main/java/net/minecraft/server/SecondaryWorldServer.java
index 0f1bcadc..24e620a4 100644
--- a/src/main/java/net/minecraft/server/SecondaryWorldServer.java
+++ b/src/main/java/net/minecraft/server/SecondaryWorldServer.java
@@ -1,10 +1,13 @@
package net.minecraft.server;
public class SecondaryWorldServer extends WorldServer {
- // CraftBukkit start
- public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, WorldServer worldserver, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(minecraftserver, idatamanager, s, i, worldsettings, env, gen);
+ // CraftBukkit start - Changed signature
+ public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, WorldServer worldserver, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+ super(minecraftserver, idatamanager, s, i, worldsettings, methodprofiler, env, gen);
// CraftBukkit end
this.worldMaps = worldserver.worldMaps;
+ this.worldData = new SecondaryWorldData(worldserver.getWorldData());
}
+
+ protected void a() {}
}
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java
index 97cc93fb..ba248008 100644
--- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java
+++ b/src/main/java/net/minecraft/server/ServerConfigurationManagerAbstract.java
@@ -1,10 +1,8 @@
package net.minecraft.server;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.PrintWriter;
+import java.net.SocketAddress;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -13,8 +11,6 @@ import java.util.Set;
import java.util.logging.Logger;
// CraftBukkit start
-import java.util.LinkedHashSet;
-
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
@@ -29,52 +25,87 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.Bukkit;
// CraftBukkit end
-public class ServerConfigurationManager {
-
- public static Logger a = Logger.getLogger("Minecraft");
- public List players = new ArrayList();
- public MinecraftServer server; // CraftBukkit - private -> public
- // private PlayerManager[] d = new PlayerManager[3]; // CraftBukkit - removed
- public int maxPlayers; // CraftBukkit - private -> public
- public Set banByName = new HashSet(); // CraftBukkit - private -> public
- public Set banByIP = new HashSet(); // CraftBukkit - private -> public
- public Set operators = new HashSet(); // CraftBukkit - private -> public
- private Set whitelist = new LinkedHashSet(); // CraftBukkit - HashSet() -> LinkedHashSet();
- private File j;
- private File k;
- private File l;
- private File m;
- public PlayerFileData playerFileData; // CraftBukkit - private - >public
+public abstract class ServerConfigurationManagerAbstract {
+
+ private static final SimpleDateFormat e = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
+ public static final Logger a = Logger.getLogger("Minecraft");
+ private final MinecraftServer server;
+ public final List players = new ArrayList();
+ private final BanList banByName = new BanList(new File("banned-players.txt"));
+ private final BanList banByIP = new BanList(new File("banned-ips.txt"));
+ private Set operators = new HashSet();
+ private Set whitelist = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet
+ public PlayerFileData playerFileData; // CraftBukkit - private -> public
public boolean hasWhitelist; // CraftBukkit - private -> public
- private int p = 0;
+ protected int maxPlayers;
+ protected int d;
+ private EnumGamemode m;
+ private boolean n;
+ private int o = 0;
// CraftBukkit start
private CraftServer cserver;
- public ServerConfigurationManager(MinecraftServer minecraftserver) {
+ public ServerConfigurationManagerAbstract(MinecraftServer minecraftserver) {
minecraftserver.server = new CraftServer(minecraftserver, this);
minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance();
this.cserver = minecraftserver.server;
// CraftBukkit end
this.server = minecraftserver;
- this.j = minecraftserver.a("banned-players.txt");
- this.k = minecraftserver.a("banned-ips.txt");
- this.l = minecraftserver.a("ops.txt");
- this.m = minecraftserver.a("white-list.txt");
- int i = minecraftserver.propertyManager.getInt("view-distance", 10);
-
- // CraftBukkit - removed playermanagers
- this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
- this.hasWhitelist = minecraftserver.propertyManager.getBoolean("white-list", false);
- this.l();
- this.n();
- this.p();
- this.r();
- this.m();
- this.o();
- this.q();
- this.s();
+ this.banByName.setEnabled(false);
+ this.banByIP.setEnabled(false);
+ this.maxPlayers = 8;
+ }
+
+ public void a(INetworkManager inetworkmanager, EntityPlayer entityplayer) {
+ this.a(entityplayer);
+ entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
+ entityplayer.itemInWorldManager.a((WorldServer) entityplayer.world);
+ String s = "local";
+
+ if (inetworkmanager.getSocketAddress() != null) {
+ s = inetworkmanager.getSocketAddress().toString();
+ }
+
+ // CraftBukkit - add world and location to 'logged in' message.
+ a.info(entityplayer.name + "[" + s + "] logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
+ WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
+ ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
+
+ this.a(entityplayer, (EntityPlayer) null, worldserver);
+ NetServerHandler netserverhandler = new NetServerHandler(this.server, inetworkmanager, entityplayer);
+
+ // CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly.
+ int maxPlayers = this.getMaxPlayers();
+ if (maxPlayers > 60) {
+ maxPlayers = 60;
+ }
+ netserverhandler.sendPacket(new Packet1Login(entityplayer.id, worldserver.getWorldData().getType(), entityplayer.itemInWorldManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, worldserver.getHeight(), maxPlayers));
+ entityplayer.getBukkitEntity().sendSupportedChannels();
+ // CraftBukkit end
+
+ netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
+ netserverhandler.sendPacket(new Packet202Abilities(entityplayer.abilities));
+ this.b(entityplayer, worldserver);
+ // this.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - handled in event
+ this.c(entityplayer);
+ netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
+ this.server.ac().a(netserverhandler);
+ netserverhandler.sendPacket(new Packet4UpdateTime(worldserver.getTime()));
+ if (this.server.getTexturePack().length() > 0) {
+ entityplayer.a(this.server.getTexturePack(), this.server.R());
+ }
+
+ Iterator iterator = entityplayer.getEffects().iterator();
+
+ while (iterator.hasNext()) {
+ MobEffect mobeffect = (MobEffect) iterator.next();
+
+ netserverhandler.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect));
+ }
+
+ entityplayer.syncInventory();
}
public void setPlayerFileData(WorldServer[] aworldserver) {
@@ -82,48 +113,44 @@ public class ServerConfigurationManager {
this.playerFileData = aworldserver[0].getDataManager().getPlayerFileData();
}
- public void a(EntityPlayer entityplayer) {
- // CraftBukkit - removed playermanagers
- for (WorldServer world : this.server.worlds) {
- if (world.manager.managedPlayers.contains(entityplayer)) {
- world.manager.removePlayer(entityplayer);
- break;
- }
+ public void a(EntityPlayer entityplayer, WorldServer worldserver) {
+ WorldServer worldserver1 = entityplayer.q();
+
+ if (worldserver != null) {
+ worldserver.getPlayerManager().removePlayer(entityplayer);
}
- this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
- WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
- worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
+ worldserver1.getPlayerManager().addPlayer(entityplayer);
+ worldserver1.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
}
public int a() {
- // CraftBukkit start
- if (this.server.worlds.size() == 0) {
- return this.server.propertyManager.getInt("view-distance", 10) * 16 - 16;
- }
- return this.server.worlds.get(0).manager.getFurthestViewableBlock();
- // CraftBukkit end
+ return PlayerManager.getFurthestViewableBlock(this.o());
}
- private PlayerManager getPlayerManager(int i) {
- return this.server.getWorldServer(i).manager; // CraftBukkit
+ public void a(EntityPlayer entityplayer) {
+ NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().h(); // CraftBukkit
+
+ if (entityplayer.getName().equals(this.server.G()) && nbttagcompound != null) {
+ entityplayer.e(nbttagcompound);
+ } else {
+ this.playerFileData.load(entityplayer);
+ }
}
- public void b(EntityPlayer entityplayer) {
- this.playerFileData.load(entityplayer);
+ protected void b(EntityPlayer entityplayer) {
+ this.playerFileData.save(entityplayer);
}
public void c(EntityPlayer entityplayer) {
cserver.detectListNameConflict(entityplayer); // CraftBukkit
- //this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, 1000)); // CraftBukkit - replaced with loop below
+ // this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, 1000)); // CraftBukkit - replaced with loop below
this.players.add(entityplayer);
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
- worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
-
// CraftBukkit start
if (!cserver.useExactLoginLocation()) {
- while (worldserver.getCubes(entityplayer, entityplayer.boundingBox).size() != 0) {
+ while (!worldserver.getCubes(entityplayer, entityplayer.boundingBox).isEmpty()) {
entityplayer.setPosition(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
}
} else {
@@ -136,14 +163,14 @@ public class ServerConfigurationManager {
String joinMessage = playerJoinEvent.getJoinMessage();
if ((joinMessage != null) && (joinMessage.length() > 0)) {
- this.server.serverConfigurationManager.sendAll(new Packet3Chat(joinMessage));
+ this.server.getServerConfigurationManager().sendAll(new Packet3Chat(joinMessage));
}
this.cserver.onPlayerJoin(playerJoinEvent.getPlayer());
// CraftBukkit end
worldserver.addEntity(entityplayer);
- this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
- this.u();
+ 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);
@@ -156,8 +183,8 @@ public class ServerConfigurationManager {
}
// CraftBukkit end
- for (int i = 0; i < this.players.size(); ++i) {
- EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer1 = (EntityPlayer) iterator.next();
// CraftBukkit start - .name -> .listName
if (entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
@@ -168,24 +195,24 @@ public class ServerConfigurationManager {
}
public void d(EntityPlayer entityplayer) {
- this.getPlayerManager(entityplayer.dimension).movePlayer(entityplayer);
+ entityplayer.q().getPlayerManager().movePlayer(entityplayer);
}
- public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - changed return type
+ public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
if (entityplayer.netServerHandler.disconnected) return null; // CraftBukkit - exploitsies fix
+ // this.b(entityplayer); // CraftBukkit - Quitting must be before we do final save of data, in case plugins need to modify it
+ WorldServer worldserver = entityplayer.q();
+
+ worldserver.kill(entityplayer);
+ worldserver.getPlayerManager().removePlayer(entityplayer);
+ this.players.remove(entityplayer);
+
// CraftBukkit start
- // Quitting must be before we do final save of data, in case plugins need to modify it
- this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
this.cserver.getPluginManager().callEvent(playerQuitEvent);
- // CraftBukkit end
- this.playerFileData.save(entityplayer);
- this.server.getWorldServer(entityplayer.dimension).kill(entityplayer);
- this.players.remove(entityplayer);
- this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
- // CraftBukkit start - .name -> .listName, replace sendAll with loop
+ // .name -> .listName, replace sendAll with loop
Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, false, 9999);
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
@@ -194,54 +221,99 @@ public class ServerConfigurationManager {
entityplayer1.netServerHandler.sendPacket(packet);
}
}
- // CraftBukkit end
- return playerQuitEvent.getQuitMessage(); // CraftBukkit
+ this.b(entityplayer);
+
+ return playerQuitEvent.getQuitMessage();
+ // CraftBukkit end
}
- public EntityPlayer attemptLogin(NetLoginHandler netloginhandler, String s, String hostname) { // CraftBukkit - add hostname parameter
- // CraftBukkit start - note: this entire method needs to be changed
+ // CraftBukkit start - Whole method and signature
+ public EntityPlayer attemptLogin(NetLoginHandler netloginhandler, String s, String hostname) {
// Instead of kicking then returning, we need to store the kick reason
// in the event, check with plugins to see if it's ok, and THEN kick
- // depending on the outcome. Also change any reference to this.e.c to entity.world
- EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, new ItemInWorldManager(this.server.getWorldServer(0)));
+ // depending on the outcome.
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.L() ? new DemoItemInWorldManager(this.server.getWorldServer(0)) : new ItemInWorldManager(this.server.getWorldServer(0)));
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, netloginhandler.getSocket().getInetAddress());
- String s1 = netloginhandler.networkManager.getSocketAddress().toString();
+ SocketAddress socketaddress = netloginhandler.networkManager.getSocketAddress();
+
+ if (this.banByName.isBanned(s)) {
+ BanEntry banentry = (BanEntry) this.banByName.getEntries().get(s);
+ String s1 = "You are banned from this server!\nReason: " + banentry.getReason();
- s1 = s1.substring(s1.indexOf("/") + 1);
- s1 = s1.substring(0, s1.indexOf(":"));
+ if (banentry.getExpires() != null) {
+ s1 = s1 + "\nYour ban will be removed on " + e.format(banentry.getExpires());
+ }
- if (this.banByName.contains(s.trim().toLowerCase())) {
- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "You are banned from this server!");
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s1);
} else if (!this.isWhitelisted(s)) {
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
- } else if (this.banByIP.contains(s1)) {
- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, "Your IP address is banned from this server!");
- } else if (this.players.size() >= this.maxPlayers) {
- event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
} else {
- event.disallow(PlayerLoginEvent.Result.ALLOWED, s1);
+ String s2 = socketaddress.toString();
+
+ s2 = s2.substring(s2.indexOf("/") + 1);
+ s2 = s2.substring(0, s2.indexOf(":"));
+ if (this.banByIP.isBanned(s2)) {
+ BanEntry banentry1 = (BanEntry) this.banByIP.getEntries().get(s2);
+ String s3 = "Your IP address is banned from this server!\nReason: " + banentry1.getReason();
+
+ if (banentry1.getExpires() != null) {
+ s3 = s3 + "\nYour ban will be removed on " + e.format(banentry1.getExpires());
+ }
+
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s3);
+ } else if (this.players.size() >= this.maxPlayers) {
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
+ } else {
+ event.disallow(PlayerLoginEvent.Result.ALLOWED, s2);
+ }
}
- this.b(entity);
this.cserver.getPluginManager().callEvent(event);
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
netloginhandler.disconnect(event.getKickMessage());
return null;
}
- for (int i = 0; i < this.players.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
+ return entity;
+ // CraftBukkit end
+ }
+
+ 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();
if (entityplayer.name.equalsIgnoreCase(s)) {
- entityplayer.netServerHandler.disconnect("You logged in from another location");
- this.b(entity);
+ arraylist.add(entityplayer);
}
}
- return entity;
+ iterator = arraylist.iterator();
+
+ while (iterator.hasNext()) {
+ entityplayer = (EntityPlayer) iterator.next();
+ entityplayer.netServerHandler.disconnect("You logged in from another location");
+ }
+
+ /* CraftBukkit start
+ Object object;
+
+ if (this.server.L()) {
+ object = new DemoItemInWorldManager(this.server.getWorldServer(0));
+ } else {
+ object = new ItemInWorldManager(this.server.getWorldServer(0));
+ }
+
+ return new EntityPlayer(this.server, this.server.getWorldServer(0), s, (ItemInWorldManager) object);
+ */
+ return player;
// CraftBukkit end
}
@@ -252,9 +324,9 @@ public class ServerConfigurationManager {
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location) {
// CraftBukkit end
- this.server.getTracker(entityplayer.dimension).untrackPlayer(entityplayer);
- // this.server.getTracker(entityplayer.dimension).untrackEntity(entityplayer); // CraftBukkit
- this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
+ entityplayer.q().getTracker().untrackPlayer(entityplayer);
+ // entityplayer.q().getTracker().untrackEntity(entityplayer); // CraftBukkit
+ entityplayer.q().getPlayerManager().removePlayer(entityplayer);
this.players.remove(entityplayer);
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
@@ -262,20 +334,21 @@ public class ServerConfigurationManager {
// CraftBukkit start
EntityPlayer entityplayer1 = entityplayer;
org.bukkit.World fromWorld = entityplayer1.getBukkitEntity().getWorld();
+ entityplayer1.viewingCredits = false;
+ entityplayer1.copyTo(entityplayer, flag);
- if (flag) {
- entityplayer1.copyTo(entityplayer);
- }
+ ChunkCoordinates chunkcoordinates1;
if (location == null) {
boolean isBedSpawn = false;
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
if (cworld != null && chunkcoordinates != null) {
- ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates);
+ chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates);
if (chunkcoordinates1 != null) {
isBedSpawn = true;
location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
} else {
+ entityplayer1.setRespawnPosition(null);
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0, 0));
}
}
@@ -286,7 +359,7 @@ public class ServerConfigurationManager {
location = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
}
- Player respawnPlayer = this.cserver.getPlayer(entityplayer);
+ Player respawnPlayer = this.cserver.getPlayer(entityplayer1);
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
this.cserver.getPluginManager().callEvent(respawnEvent);
@@ -301,25 +374,36 @@ public class ServerConfigurationManager {
worldserver.chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
- while (worldserver.getCubes(entityplayer1, entityplayer1.boundingBox).size() != 0) {
+ while (!worldserver.getCubes(entityplayer1, entityplayer1.boundingBox).isEmpty()) {
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
}
// CraftBukkit start
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
- // Force the client to refresh their chunk cache.
- entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0), (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.itemInWorldManager.getGameMode()));
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.itemInWorldManager.getGameMode()));
entityplayer1.spawnIn(worldserver);
entityplayer1.dead = false;
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
+
+ chunkcoordinates1 = worldserver.getSpawn();
// CraftBukkit end
- this.a(entityplayer1, worldserver);
- this.getPlayerManager(entityplayer1.dimension).addPlayer(entityplayer1);
+ entityplayer1.netServerHandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z));
+ this.b(entityplayer1, worldserver);
+ worldserver.getPlayerManager().addPlayer(entityplayer1);
worldserver.addEntity(entityplayer1);
this.players.add(entityplayer1);
+ // CraftBukkit start - added from changeDimension
this.updateClient(entityplayer1); // CraftBukkit
- entityplayer1.E();
+ Iterator iterator = entityplayer1.getEffects().iterator();
+
+ while (iterator.hasNext()) {
+ MobEffect mobeffect = (MobEffect) iterator.next();
+
+ entityplayer1.netServerHandler.sendPacket(new Packet41MobEffect(entityplayer1.id, mobeffect));
+ }
+ // entityplayer1.syncInventory();
+ // CraftBukkit end
+
// CraftBukkit start - don't fire on respawn
if (fromWorld != location.getWorld()) {
PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld);
@@ -400,39 +484,34 @@ public class ServerConfigurationManager {
}
public void tick() {
- if (++this.p > 200) {
- this.p = 0;
+ if (++this.o > 600) {
+ this.o = 0;
}
- /* CraftBukkit start -- remove updating of lag to players -- it spams way to much on big servers.
- if (this.p < this.players.size()) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.p);
+ /* CraftBukkit start - remove updating of lag to players -- it spams way to much on big servers.
+ if (this.o < this.players.size()) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.o);
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
}
- */
-
- for (int i = 0; i < this.server.worlds.size(); ++i) {
- this.server.worlds.get(i).manager.flush();
- // CraftBukkit end
- }
- }
-
- public void flagDirty(int i, int j, int k, int l) {
- this.getPlayerManager(l).flagDirty(i, j, k);
+ // CraftBukkit end */
}
public void sendAll(Packet packet) {
- for (int i = 0; i < this.players.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
+ Iterator iterator = this.players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
entityplayer.netServerHandler.sendPacket(packet);
}
}
public void a(Packet packet, int i) {
- for (int j = 0; j < this.players.size(); ++j) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
+ Iterator iterator = this.players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
if (entityplayer.dimension == i) {
entityplayer.netServerHandler.sendPacket(packet);
@@ -464,103 +543,16 @@ public class ServerConfigurationManager {
return astring;
}
- public void addUserBan(String s) {
- this.banByName.add(s.toLowerCase());
- this.m();
- }
-
- public void removeUserBan(String s) {
- this.banByName.remove(s.toLowerCase());
- this.m();
- }
-
- private void l() {
- try {
- this.banByName.clear();
- BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
- String s = "";
-
- while ((s = bufferedreader.readLine()) != null) {
- this.banByName.add(s.trim().toLowerCase());
- }
-
- bufferedreader.close();
- } catch (Exception exception) {
- a.warning("Failed to load ban list: " + exception);
- }
- }
-
- private void m() {
- try {
- PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
- Iterator iterator = this.banByName.iterator();
-
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
-
- printwriter.println(s);
- }
-
- printwriter.close();
- } catch (Exception exception) {
- a.warning("Failed to save ban list: " + exception);
- }
- }
-
- public Set getBannedPlayers() {
+ public BanList getNameBans() {
return this.banByName;
}
- public Set getBannedAddresses() {
+ public BanList getIPBans() {
return this.banByIP;
}
- public void addIpBan(String s) {
- this.banByIP.add(s.toLowerCase());
- this.o();
- }
-
- public void removeIpBan(String s) {
- this.banByIP.remove(s.toLowerCase());
- this.o();
- }
-
- private void n() {
- try {
- this.banByIP.clear();
- BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
- String s = "";
-
- while ((s = bufferedreader.readLine()) != null) {
- this.banByIP.add(s.trim().toLowerCase());
- }
-
- bufferedreader.close();
- } catch (Exception exception) {
- a.warning("Failed to load ip ban list: " + exception);
- }
- }
-
- private void o() {
- try {
- PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
- Iterator iterator = this.banByIP.iterator();
-
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
-
- printwriter.println(s);
- }
-
- printwriter.close();
- } catch (Exception exception) {
- a.warning("Failed to save ip ban list: " + exception);
- }
- }
-
public void addOp(String s) {
this.operators.add(s.toLowerCase());
- this.q();
// CraftBukkit start
Player player = server.server.getPlayer(s);
@@ -572,7 +564,6 @@ public class ServerConfigurationManager {
public void removeOp(String s) {
this.operators.remove(s.toLowerCase());
- this.q();
// CraftBukkit start
Player player = server.server.getPlayer(s);
@@ -582,99 +573,30 @@ public class ServerConfigurationManager {
// CraftBukkit end
}
- private void p() {
- try {
- this.operators.clear();
- BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l));
- String s = "";
-
- while ((s = bufferedreader.readLine()) != null) {
- this.operators.add(s.trim().toLowerCase());
- }
-
- bufferedreader.close();
- } catch (Exception exception) {
- a.warning("Failed to load operators list: " + exception);
- }
- }
-
- private void q() {
- try {
- PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false));
- Iterator iterator = this.operators.iterator();
-
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
-
- printwriter.println(s);
- }
-
- printwriter.close();
- } catch (Exception exception) {
- a.warning("Failed to save operators list: " + exception);
- }
- }
-
- private void r() {
- try {
- this.whitelist.clear();
- BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m));
- String s = "";
-
- while ((s = bufferedreader.readLine()) != null) {
- this.whitelist.add(s.trim().toLowerCase());
- }
-
- bufferedreader.close();
- } catch (Exception exception) {
- a.warning("Failed to load white-list: " + exception);
- }
- }
-
- private void s() {
- try {
- PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false));
- Iterator iterator = this.whitelist.iterator();
-
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
-
- printwriter.println(s);
- }
-
- printwriter.close();
- } catch (Exception exception) {
- a.warning("Failed to save white-list: " + exception);
- }
- }
-
public boolean isWhitelisted(String s) {
s = s.trim().toLowerCase();
return !this.hasWhitelist || this.operators.contains(s) || this.whitelist.contains(s);
}
public boolean isOp(String s) {
- return this.operators.contains(s.trim().toLowerCase());
+ // CraftBukkit
+ return this.operators.contains(s.trim().toLowerCase()) || this.server.H() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.G().equalsIgnoreCase(s) || this.n;
}
- public EntityPlayer i(String s) {
- for (int i = 0; i < this.players.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
+ public EntityPlayer f(String s) {
+ Iterator iterator = this.players.iterator();
- if (entityplayer.name.equalsIgnoreCase(s)) {
- return entityplayer;
- }
- }
+ EntityPlayer entityplayer;
- return null;
- }
+ do {
+ if (!iterator.hasNext()) {
+ return null;
+ }
- public void a(String s, String s1) {
- EntityPlayer entityplayer = this.i(s);
+ entityplayer = (EntityPlayer) iterator.next();
+ } while (!entityplayer.name.equalsIgnoreCase(s));
- if (entityplayer != null) {
- entityplayer.netServerHandler.sendPacket(new Packet3Chat(s1));
- }
+ return entityplayer;
}
public void sendPacketNearby(double d0, double d1, double d2, double d3, int i, Packet packet) {
@@ -682,8 +604,10 @@ public class ServerConfigurationManager {
}
public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) {
- for (int j = 0; j < this.players.size(); ++j) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
+ Iterator iterator = this.players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
if (entityplayer != entityhuman && entityplayer.dimension == i) {
double d4 = d0 - entityplayer.locX;
@@ -697,66 +621,44 @@ public class ServerConfigurationManager {
}
}
- public void j(String s) {
- Packet3Chat packet3chat = new Packet3Chat(s);
-
- for (int i = 0; i < this.players.size(); ++i) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
-
- if (this.isOp(entityplayer.name)) {
- entityplayer.netServerHandler.sendPacket(packet3chat);
- }
- }
- }
-
- public boolean a(String s, Packet packet) {
- EntityPlayer entityplayer = this.i(s);
+ public void savePlayers() {
+ Iterator iterator = this.players.iterator();
- if (entityplayer != null) {
- entityplayer.netServerHandler.sendPacket(packet);
- return true;
- } else {
- return false;
- }
- }
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- public void savePlayers() {
- for (int i = 0; i < this.players.size(); ++i) {
- this.playerFileData.save((EntityHuman) this.players.get(i));
+ this.b(entityplayer);
}
}
- public void a(int i, int j, int k, TileEntity tileentity) {}
-
public void addWhitelist(String s) {
this.whitelist.add(s);
- this.s();
}
public void removeWhitelist(String s) {
this.whitelist.remove(s);
- this.s();
}
public Set getWhitelisted() {
return this.whitelist;
}
- public void reloadWhitelist() {
- this.r();
+ public Set getOPs() {
+ return this.operators;
}
- public void a(EntityPlayer entityplayer, WorldServer worldserver) {
+ public void reloadWhitelist() {}
+
+ public void b(EntityPlayer entityplayer, WorldServer worldserver) {
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime()));
- if (worldserver.x()) {
+ if (worldserver.J()) {
entityplayer.netServerHandler.sendPacket(new Packet70Bed(1, 0));
}
}
public void updateClient(EntityPlayer entityplayer) {
entityplayer.updateInventory(entityplayer.defaultContainer);
- entityplayer.D_();
- entityplayer.lastSentExp = -1; // CraftBukkit
+ entityplayer.n();
}
public int getPlayerCount() {
@@ -771,23 +673,54 @@ public class ServerConfigurationManager {
return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers(); // CraftBukkit
}
- private void u() {
- MojangStatisticsGenerator mojangstatisticsgenerator = new MojangStatisticsGenerator("server");
-
- mojangstatisticsgenerator.a("version", this.server.getVersion());
- mojangstatisticsgenerator.a("os_name", System.getProperty("os.name"));
- mojangstatisticsgenerator.a("os_version", System.getProperty("os.version"));
- mojangstatisticsgenerator.a("os_architecture", System.getProperty("os.arch"));
- mojangstatisticsgenerator.a("memory_total", Long.valueOf(Runtime.getRuntime().totalMemory()));
- mojangstatisticsgenerator.a("memory_max", Long.valueOf(Runtime.getRuntime().maxMemory()));
- mojangstatisticsgenerator.a("memory_free", Long.valueOf(Runtime.getRuntime().freeMemory()));
- mojangstatisticsgenerator.a("java_version", System.getProperty("java.version"));
- mojangstatisticsgenerator.a("cpu_cores", Integer.valueOf(Runtime.getRuntime().availableProcessors()));
- mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.getPlayerCount()));
- mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.getMaxPlayers()));
- mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.getSeenPlayers().length));
- mojangstatisticsgenerator.a("uses_auth", Boolean.valueOf(this.server.onlineMode));
- mojangstatisticsgenerator.a("server_brand", this.server.getServerModName());
- mojangstatisticsgenerator.a();
+ public boolean getHasWhitelist() {
+ return this.hasWhitelist;
+ }
+
+ public void setHasWhitelist(boolean flag) {
+ this.hasWhitelist = flag;
+ }
+
+ public List j(String s) {
+ ArrayList arraylist = new ArrayList();
+ Iterator iterator = this.players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+
+ if (entityplayer.r().equals(s)) {
+ arraylist.add(entityplayer);
+ }
+ }
+
+ return arraylist;
+ }
+
+ public int o() {
+ return this.d;
+ }
+
+ public MinecraftServer getServer() {
+ return this.server;
+ }
+
+ public NBTTagCompound q() {
+ return null;
+ }
+
+ private void a(EntityPlayer entityplayer, EntityPlayer entityplayer1, World world) {
+ if (entityplayer1 != null) {
+ entityplayer.itemInWorldManager.setGameMode(entityplayer1.itemInWorldManager.getGameMode());
+ } else if (this.m != null) {
+ entityplayer.itemInWorldManager.setGameMode(this.m);
+ }
+
+ entityplayer.itemInWorldManager.b(world.getWorldData().getGameType());
+ }
+
+ public void r() {
+ while (!this.players.isEmpty()) {
+ ((EntityPlayer) this.players.get(0)).netServerHandler.disconnect("Server closed");
+ }
}
}
diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java
index cf7f1070..ec615441 100644
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
// CraftBukkit end
-public class ShapedRecipes implements CraftingRecipe {
+public class ShapedRecipes implements IRecipe {
private int width;
private int height;
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
index 548d810c..1ff6fdcd 100644
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
@@ -9,7 +9,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
// CraftBukkit end
-public class ShapelessRecipes implements CraftingRecipe {
+public class ShapelessRecipes implements IRecipe {
private final ItemStack result;
private final List ingredients;
diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java
index 649a349d..e260863c 100644
--- a/src/main/java/net/minecraft/server/Slot.java
+++ b/src/main/java/net/minecraft/server/Slot.java
@@ -4,15 +4,15 @@ public class Slot {
public final int index; // CraftBukkit - private -> public
public final IInventory inventory;
- public int c;
public int d;
public int e;
+ public int f;
public Slot(IInventory iinventory, int i, int j, int k) {
this.inventory = iinventory;
this.index = i;
- this.d = j;
- this.e = k;
+ this.e = j;
+ this.f = k;
}
public void a(ItemStack itemstack, ItemStack itemstack1) {
@@ -29,10 +29,10 @@ public class Slot {
protected void a(ItemStack itemstack, int i) {}
- protected void b(ItemStack itemstack) {}
+ protected void c(ItemStack itemstack) {}
- public void c(ItemStack itemstack) {
- this.d();
+ public void b(ItemStack itemstack) {
+ this.e();
}
public boolean isAllowed(ItemStack itemstack) {
@@ -43,16 +43,16 @@ public class Slot {
return this.inventory.getItem(this.index);
}
- public boolean c() {
+ public boolean d() {
return this.getItem() != null;
}
public void set(ItemStack itemstack) {
this.inventory.setItem(this.index, itemstack);
- this.d();
+ this.e();
}
- public void d() {
+ public void e() {
this.inventory.update();
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index d62e9838..a4846225 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -36,18 +36,16 @@ public final class SpawnerCreature {
protected static final Class[] a = new Class[] { EntitySpider.class, EntityZombie.class, EntitySkeleton.class};
- public SpawnerCreature() {}
-
protected static ChunkPosition getRandomPosition(World world, int i, int j) {
Chunk chunk = world.getChunkAt(i, j);
int k = i * 16 + world.random.nextInt(16);
- int l = world.random.nextInt(chunk == null ? 128 : Math.max(128, chunk.g()));
- int i1 = j * 16 + world.random.nextInt(16);
+ int l = j * 16 + world.random.nextInt(16);
+ int i1 = world.random.nextInt(chunk == null ? world.L() : chunk.h() + 16 - 1);
- return new ChunkPosition(k, l, i1);
+ return new ChunkPosition(k, i1, l);
}
- public static final int spawnEntities(World world, boolean flag, boolean flag1) {
+ public static final int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1) {
if (!flag && !flag1) {
return 0;
} else {
@@ -59,8 +57,8 @@ public final class SpawnerCreature {
int i;
int j;
- for (i = 0; i < world.players.size(); ++i) {
- EntityHuman entityhuman = (EntityHuman) world.players.get(i);
+ for (i = 0; i < worldserver.players.size(); ++i) {
+ EntityHuman entityhuman = (EntityHuman) worldserver.players.get(i);
int k = MathHelper.floor(entityhuman.locX / 16.0D);
j = MathHelper.floor(entityhuman.locZ / 16.0D);
@@ -83,7 +81,7 @@ public final class SpawnerCreature {
}
i = 0;
- ChunkCoordinates chunkcoordinates = world.getSpawn();
+ ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
java.util.ArrayList<EntryBase> b = chunkCoords.entries(); // CraftBukkit
EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values();
@@ -96,13 +94,13 @@ public final class SpawnerCreature {
int limit = 0;
switch (enumcreaturetype) {
case MONSTER:
- limit = world.getWorld().getMonsterSpawnLimit();
+ limit = worldserver.getWorld().getMonsterSpawnLimit();
break;
case CREATURE:
- limit = world.getWorld().getAnimalSpawnLimit();
+ limit = worldserver.getWorld().getAnimalSpawnLimit();
break;
case WATER_CREATURE:
- limit = world.getWorld().getWaterAnimalSpawnLimit();
+ limit = worldserver.getWorld().getWaterAnimalSpawnLimit();
break;
}
@@ -111,20 +109,20 @@ public final class SpawnerCreature {
}
// CraftBukkit end
- if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && world.a(enumcreaturetype.a()) <= limit * b.size() / 256) { // CraftBukkit - use per-world limits
+ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && worldserver.a(enumcreaturetype.a()) <= limit * b.size() / 256) { // CraftBukkit - use per-world limits
// CraftBukkit start
label108:
for (EntryBase base : b) {
ChunkEntry entry = (SpawnerCreature.ChunkEntry) base;
if (!entry.spawn) {
- ChunkPosition chunkposition = getRandomPosition(world, entry.getX(), entry.getZ());
+ ChunkPosition chunkposition = getRandomPosition(worldserver, entry.getX(), entry.getZ());
// CraftBukkit end
int k1 = chunkposition.x;
int l1 = chunkposition.y;
int i2 = chunkposition.z;
- if (!world.e(k1, l1, i2) && world.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
+ if (!worldserver.s(k1, l1, i2) && worldserver.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
int j2 = 0;
int k2 = 0;
@@ -139,15 +137,15 @@ public final class SpawnerCreature {
while (true) {
if (k3 < 4) {
label101: {
- l2 += world.random.nextInt(b1) - world.random.nextInt(b1);
- i3 += world.random.nextInt(1) - world.random.nextInt(1);
- j3 += world.random.nextInt(b1) - world.random.nextInt(b1);
- if (a(enumcreaturetype, world, l2, i3, j3)) {
+ l2 += worldserver.random.nextInt(b1) - worldserver.random.nextInt(b1);
+ i3 += worldserver.random.nextInt(1) - worldserver.random.nextInt(1);
+ j3 += worldserver.random.nextInt(b1) - worldserver.random.nextInt(b1);
+ if (a(enumcreaturetype, worldserver, l2, i3, j3)) {
float f = (float) l2 + 0.5F;
float f1 = (float) i3;
float f2 = (float) j3 + 0.5F;
- if (world.findNearbyPlayer((double) f, (double) f1, (double) f2, 24.0D) == null) {
+ if (worldserver.findNearbyPlayer((double) f, (double) f1, (double) f2, 24.0D) == null) {
float f3 = f - (float) chunkcoordinates.x;
float f4 = f1 - (float) chunkcoordinates.y;
float f5 = f2 - (float) chunkcoordinates.z;
@@ -155,7 +153,7 @@ public final class SpawnerCreature {
if (f6 >= 576.0F) {
if (biomemeta == null) {
- biomemeta = world.a(enumcreaturetype, l2, i3, j3);
+ biomemeta = worldserver.a(enumcreaturetype, l2, i3, j3);
if (biomemeta == null) {
break label101;
}
@@ -164,22 +162,19 @@ public final class SpawnerCreature {
EntityLiving entityliving;
try {
- entityliving = (EntityLiving) biomemeta.a.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
+ entityliving = (EntityLiving) biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver});
} catch (Exception exception) {
exception.printStackTrace();
return i;
}
- // CraftBukkit - made slimes spawn less often in FLAT worlds.
- if (entityliving instanceof EntitySlime && world.worldData.getType() == WorldType.FLAT && world.random.nextInt(200) == 0) return 0;
-
- entityliving.setPositionRotation((double) f, (double) f1, (double) f2, world.random.nextFloat() * 360.0F, 0.0F);
+ entityliving.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F);
if (entityliving.canSpawn()) {
++j2;
// CraftBukkit - added a reason for spawning this creature
- world.addEntity(entityliving, SpawnReason.NATURAL);
- a(entityliving, world, f, f1, f2);
- if (j2 >= entityliving.q()) {
+ worldserver.addEntity(entityliving, SpawnReason.NATURAL);
+ a(entityliving, worldserver, f, f1, f2);
+ if (j2 >= entityliving.bl()) {
continue label108;
}
}
@@ -210,11 +205,13 @@ 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.e(i, j + 1, k);
+ return world.getMaterial(i, j, k).isLiquid() && !world.s(i, j + 1, k);
+ } else if (!world.t(i, j - 1, k)) {
+ return false;
} else {
int l = world.getTypeId(i, j - 1, k);
- return Block.g(l) && l != Block.BEDROCK.id && !world.e(i, j, k) && !world.getMaterial(i, j, k).isLiquid() && !world.e(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);
}
}
@@ -235,7 +232,7 @@ public final class SpawnerCreature {
entityocelot.setPositionRotation((double) f, (double) f1, (double) f2, entityliving.yaw, 0.0F);
entityocelot.setAge(-24000);
- world.addEntity(entityocelot, SpawnReason.NATURAL); // CraftBukkit - SpawnReason
+ world.addEntity(entityocelot, SpawnReason.NATURAL); // CraftBukkit - added SpawnReason
}
}
}
@@ -246,7 +243,7 @@ public final class SpawnerCreature {
if (!list.isEmpty()) {
while (random.nextFloat() < biomebase.f()) {
BiomeMeta biomemeta = (BiomeMeta) WeightedRandom.a(world.random, (Collection) list);
- int i1 = biomemeta.b + random.nextInt(1 + biomemeta.c - biomemeta.b);
+ int i1 = biomemeta.c + random.nextInt(1 + biomemeta.d - biomemeta.c);
int j1 = i + random.nextInt(k);
int k1 = j + random.nextInt(l);
int l1 = j1;
@@ -256,7 +253,7 @@ public final class SpawnerCreature {
boolean flag = false;
for (int k2 = 0; !flag && k2 < 4; ++k2) {
- int l2 = world.g(j1, k1);
+ int l2 = world.h(j1, k1);
if (a(EnumCreatureType.CREATURE, world, j1, l2, k1)) {
float f = (float) j1 + 0.5F;
@@ -266,7 +263,7 @@ public final class SpawnerCreature {
EntityLiving entityliving;
try {
- entityliving = (EntityLiving) biomemeta.a.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
+ entityliving = (EntityLiving) biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
} catch (Exception exception) {
exception.printStackTrace();
continue;
diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java
index b6dccdd5..64eaa4ca 100644
--- a/src/main/java/net/minecraft/server/ThreadCommandReader.java
+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java
@@ -6,12 +6,12 @@ import java.io.InputStreamReader;
import static org.bukkit.craftbukkit.Main.*; // CraftBukkit
-public class ThreadCommandReader extends Thread {
+class ThreadCommandReader extends Thread {
- final MinecraftServer server;
+ final DedicatedServer server;
- public ThreadCommandReader(MinecraftServer minecraftserver) {
- this.server = minecraftserver;
+ ThreadCommandReader(DedicatedServer dedicatedserver) {
+ this.server = dedicatedserver;
}
public void run() {
@@ -22,11 +22,11 @@ public class ThreadCommandReader extends Thread {
// CraftBukkit end
jline.console.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
- String s = null;
+ String s;
try {
// CraftBukkit start - JLine disabling compatibility
- while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
+ while (!this.server.isStopped() && this.server.isRunning()) {
if (useJline) {
s = bufferedreader.readLine(">", null);
} else {
@@ -39,7 +39,7 @@ public class ThreadCommandReader extends Thread {
}
} catch (IOException ioexception) {
// CraftBukkit
- java.util.logging.Logger.getLogger(ThreadCommandReader.class.getName()).log(java.util.logging.Level.SEVERE, null, ioexception);
+ MinecraftServer.log.log(java.util.logging.Level.SEVERE, null, ioexception);
}
}
}
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
index 52685c21..fc198b26 100644
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.io.BufferedReader;
import java.io.InputStreamReader;
+import java.math.BigInteger;
import java.net.URL;
import java.net.URLEncoder;
@@ -13,54 +14,51 @@ import org.bukkit.event.player.PlayerPreLoginEvent;
class ThreadLoginVerifier extends Thread {
- final Packet1Login loginPacket;
-
final NetLoginHandler netLoginHandler;
// CraftBukkit start
CraftServer server;
- ThreadLoginVerifier(NetLoginHandler netloginhandler, Packet1Login packet1login, CraftServer server) {
+ ThreadLoginVerifier(NetLoginHandler netloginhandler, CraftServer server) {
this.server = server;
// CraftBukkit end
-
this.netLoginHandler = netloginhandler;
- this.loginPacket = packet1login;
}
public void run() {
try {
- String s = NetLoginHandler.a(this.netLoginHandler);
- URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(this.loginPacket.name, "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
+ String s = (new BigInteger(MinecraftEncryption.a(NetLoginHandler.a(this.netLoginHandler), NetLoginHandler.b(this.netLoginHandler).E().getPublic(), NetLoginHandler.c(this.netLoginHandler)))).toString(16);
+ URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(NetLoginHandler.d(this.netLoginHandler), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
String s1 = bufferedreader.readLine();
bufferedreader.close();
- if (s1.equals("YES")) {
- // CraftBukkit start
- if (this.netLoginHandler.getSocket() == null) {
- return;
- }
+ if (!"YES".equals(s1)) {
+ this.netLoginHandler.disconnect("Failed to verify username!");
+ return;
+ }
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(this.loginPacket.name, this.netLoginHandler.getSocket().getInetAddress());
- this.server.getPluginManager().callEvent(asyncEvent);
+ // CraftBukkit start
+ if (this.netLoginHandler.getSocket() == null) {
+ return;
+ }
- PlayerPreLoginEvent event = new PlayerPreLoginEvent(this.loginPacket.name, this.netLoginHandler.getSocket().getInetAddress());
- if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
- event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
- }
- this.server.getPluginManager().callEvent(event);
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(NetLoginHandler.d(this.netLoginHandler), this.netLoginHandler.getSocket().getInetAddress());
+ this.server.getPluginManager().callEvent(asyncEvent);
- if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
- this.netLoginHandler.disconnect(event.getKickMessage());
- return;
- }
- // CraftBukkit end
+ PlayerPreLoginEvent event = new PlayerPreLoginEvent(NetLoginHandler.d(this.netLoginHandler), this.netLoginHandler.getSocket().getInetAddress());
+ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
+ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
+ }
+ this.server.getPluginManager().callEvent(event);
- NetLoginHandler.a(this.netLoginHandler, this.loginPacket);
- } else {
- this.netLoginHandler.disconnect("Failed to verify username!");
+ if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
+ this.netLoginHandler.disconnect(event.getKickMessage());
+ return;
}
+ // CraftBukkit end
+
+ NetLoginHandler.a(this.netLoginHandler, true);
} catch (Exception exception) {
this.netLoginHandler.disconnect("Failed to verify username! [internal error " + exception + "]");
exception.printStackTrace();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index d569ed8c..869e03c2 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -3,15 +3,13 @@ package net.minecraft.server;
import java.util.HashMap;
import java.util.Map;
-// CraftBukkit start
-import org.bukkit.inventory.InventoryHolder;
-// CraftBukkit end
+import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public class TileEntity {
private static Map a = new HashMap();
private static Map b = new HashMap();
- public World world;
+ protected World world;
public int x;
public int y;
public int z;
@@ -22,7 +20,7 @@ public class TileEntity {
public TileEntity() {}
private static void a(Class oclass, String s) {
- if (b.containsKey(s)) {
+ if (a.containsKey(s)) {
throw new IllegalArgumentException("Duplicate id: " + s);
} else {
a.put(s, oclass);
@@ -30,6 +28,14 @@ public class TileEntity {
}
}
+ public void a(World world) {
+ this.world = world;
+ }
+
+ public boolean m() {
+ return this.world != null;
+ }
+
public void a(NBTTagCompound nbttagcompound) {
this.x = nbttagcompound.getInt("x");
this.y = nbttagcompound.getInt("y");
@@ -49,7 +55,7 @@ public class TileEntity {
}
}
- public void q_() {}
+ public void g() {}
public static TileEntity c(NBTTagCompound nbttagcompound) {
TileEntity tileentity = null;
@@ -73,7 +79,7 @@ public class TileEntity {
return tileentity;
}
- public int k() {
+ public int n() {
if (this.p == -1) {
this.p = this.world.getData(this.x, this.y, this.z);
}
@@ -88,11 +94,11 @@ public class TileEntity {
}
}
- public Packet d() {
+ public Packet e() {
return null;
}
- public boolean l() {
+ public boolean p() {
return this.o;
}
@@ -100,7 +106,7 @@ public class TileEntity {
this.o = true;
}
- public void m() {
+ public void q() {
this.o = false;
}
@@ -114,6 +120,7 @@ public class TileEntity {
static {
a(TileEntityFurnace.class, "Furnace");
a(TileEntityChest.class, "Chest");
+ a(TileEntityEnderChest.class, "EnderChest");
a(TileEntityRecordPlayer.class, "RecordPlayer");
a(TileEntityDispenser.class, "Trap");
a(TileEntitySign.class, "Sign");
@@ -128,7 +135,7 @@ public class TileEntity {
// CraftBukkit start
public InventoryHolder getOwner() {
org.bukkit.block.BlockState state = world.getWorld().getBlockAt(x, y, z).getState();
- if(state instanceof InventoryHolder) return (InventoryHolder) state;
+ if (state instanceof InventoryHolder) return (InventoryHolder) state;
return null;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
index fe3a487c..29c5d28a 100644
--- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
+++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
@@ -50,43 +50,43 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
return this.items.length;
}
- public void q_() {
+ public void g() {
if (this.brewTime > 0) {
--this.brewTime;
if (this.brewTime == 0) {
- this.p();
+ this.r();
this.update();
- } else if (!this.o()) {
+ } else if (!this.k()) {
this.brewTime = 0;
this.update();
} else if (this.d != this.items[3].id) {
this.brewTime = 0;
this.update();
}
- } else if (this.o()) {
+ } else if (this.k()) {
this.brewTime = 400;
this.d = this.items[3].id;
}
- int i = this.n();
+ int i = this.i();
if (i != this.c) {
this.c = i;
this.world.setData(this.x, this.y, this.z, i);
}
- super.q_();
+ super.g();
}
- public int i() {
+ public int t_() {
return this.brewTime;
}
- private boolean o() {
+ private boolean k() {
if (this.items[3] != null && this.items[3].count > 0) {
ItemStack itemstack = this.items[3];
- if (!Item.byId[itemstack.id].n()) {
+ if (!Item.byId[itemstack.id].u()) {
return false;
} else {
boolean flag = false;
@@ -96,13 +96,13 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
int j = this.items[i].getData();
int k = this.b(j, itemstack);
- if (!ItemPotion.c(j) && ItemPotion.c(k)) {
+ if (!ItemPotion.g(j) && ItemPotion.g(k)) {
flag = true;
break;
}
- List list = Item.POTION.b(j);
- List list1 = Item.POTION.b(k);
+ List list = Item.POTION.f(j);
+ List list1 = Item.POTION.f(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
flag = true;
@@ -118,8 +118,8 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
}
- private void p() {
- if (this.o()) {
+ private void r() {
+ if (this.k()) {
ItemStack itemstack = this.items[3];
// CraftBukkit start - fire BREW event
@@ -136,21 +136,21 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
int j = this.items[i].getData();
int k = this.b(j, itemstack);
- List list = Item.POTION.b(j);
- List list1 = Item.POTION.b(k);
+ List list = Item.POTION.f(j);
+ List list1 = Item.POTION.f(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
if (j != k) {
this.items[i].setData(k);
}
- } else if (!ItemPotion.c(j) && ItemPotion.c(k)) {
+ } else if (!ItemPotion.g(j) && ItemPotion.g(k)) {
this.items[i].setData(k);
}
}
}
- if (Item.byId[itemstack.id].k()) {
- this.items[3] = new ItemStack(Item.byId[itemstack.id].j());
+ if (Item.byId[itemstack.id].r()) {
+ this.items[3] = new ItemStack(Item.byId[itemstack.id].q());
} else {
--this.items[3].count;
if (this.items[3].count <= 0) {
@@ -161,7 +161,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
private int b(int i, ItemStack itemstack) {
- return itemstack == null ? i : (Item.byId[itemstack.id].n() ? PotionBrewer.a(i, Item.byId[itemstack.id].m()) : i);
+ return itemstack == null ? i : (Item.byId[itemstack.id].u() ? PotionBrewer.a(i, Item.byId[itemstack.id].t()) : i);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -233,18 +233,18 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
public int getMaxStackSize() {
- return maxStack; // CraftBukkit
+ return this.maxStack; // CraftBukkit
}
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;
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
- public int n() {
+ public int i() {
int i = 0;
for (int j = 0; j < 3; ++j) {
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index f6512f10..1ea52c0a 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -9,7 +9,7 @@ import org.bukkit.entity.HumanEntity;
public class TileEntityChest extends TileEntity implements IInventory {
- private ItemStack[] items = new ItemStack[27]; // CraftBukkit
+ private ItemStack[] items = new ItemStack[27]; // CraftBukkit - 36 -> 27
public boolean a = false;
public TileEntityChest b;
public TileEntityChest c;
@@ -20,6 +20,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
public int h;
private int ticks;
+ public TileEntityChest() {}
+
// CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
private int maxStack = MAX_STACK;
@@ -45,8 +47,6 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
// CraftBukkit end
- public TileEntityChest() {}
-
public int getSize() {
return 27;
}
@@ -190,30 +190,12 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
}
- // CraftBukkit start
- private TileEntityChest getTileEntity(int x, int y, int z) {
- if (this.world == null) return null; // CraftBukkit
- TileEntity entity = this.world.getTileEntity(x, y, z);
-
- if (entity instanceof TileEntityChest) {
- return (TileEntityChest) entity;
- } else {
- String name = "null";
- if (entity != null) {
- name = entity.toString();
- }
- world.getServer().getLogger().severe("Block at " + x + "," + y + "," + z + " is a chest but has a " + name);
- return null;
- }
- }
- // CraftBukkit end
-
- public void q_() {
- super.q_();
+ public void g() {
+ super.g();
if (this.world == null) return; // CraftBukkit
this.i();
if (++this.ticks % (20 * 4) == 0) { // CraftBukkit
- this.world.playNote(this.x, this.y, this.z, 1, this.h);
+ ;
}
this.g = this.f;
@@ -277,16 +259,16 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
}
- public void f() {
+ public void startOpen() {
++this.h;
if (this.world == null) return; // CraftBukkit
- this.world.playNote(this.x, this.y, this.z, 1, this.h);
+ this.world.playNote(this.x, this.y, this.z, Block.CHEST.id, 1, this.h);
}
- public void g() {
+ public void f() {
--this.h;
if (this.world == null) return; // CraftBukkit
- this.world.playNote(this.x, this.y, this.z, 1, this.h);
+ this.world.playNote(this.x, this.y, this.z, Block.CHEST.id, 1, this.h);
}
public void j() {
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index 09045326..7a28e37d 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -83,8 +83,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
}
- // CraftBukkit start - move code out from p_
- public int findDispenseSlot() {
+ public int i() {
int i = -1;
int j = 1;
@@ -94,18 +93,8 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
i = k;
}
}
- return i;
- }
- public ItemStack p_() {
- int i = this.findDispenseSlot();
- // CraftBukkit end
-
- if (i >= 0) {
- return this.splitStack(i, 1);
- } else {
- return null;
- }
+ return i;
}
public void setItem(int i, ItemStack itemstack) {
@@ -117,6 +106,17 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
this.update();
}
+ public int a(ItemStack itemstack) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] == null || this.items[i].id == 0) {
+ this.items[i] = itemstack;
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
public String getName() {
return "container.dispenser";
}
@@ -162,7 +162,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
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;
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index 10db2c76..62bcc828 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -143,7 +143,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
return this.burnTime > 0;
}
- public void q_() {
+ public void g() {
boolean flag = this.burnTime > 0;
boolean flag1 = false;
@@ -189,7 +189,9 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
if (this.items[1] != null) {
--this.items[1].count;
if (this.items[1].count == 0) {
- this.items[1] = null;
+ Item item = this.items[1].getItem().q();
+
+ this.items[1] = item != null ? new ItemStack(item) : null;
}
}
}
@@ -223,7 +225,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
if (this.items[0] == null) {
return false;
} else {
- ItemStack itemstack = FurnaceRecipes.getInstance().getResult(this.items[0].getItem().id);
+ ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0].getItem().id);
// CraftBukkit - consider resultant count instead of current count
return itemstack == null ? false : (this.items[2] == null ? true : (!this.items[2].doMaterialsMatch(itemstack) ? false : (this.items[2].count + itemstack.count <= this.getMaxStackSize() && this.items[2].count < this.items[2].getMaxStackSize() ? true : this.items[2].count + itemstack.count <= itemstack.getMaxStackSize())));
@@ -232,7 +234,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
public void burn() {
if (this.canBurn()) {
- ItemStack itemstack = FurnaceRecipes.getInstance().getResult(this.items[0].getItem().id);
+ ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0].getItem().id);
// CraftBukkit start
CraftItemStack source = new CraftItemStack(this.items[0]);
@@ -269,8 +271,21 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
return 0;
} else {
int i = itemstack.getItem().id;
+ Item item = itemstack.getItem();
+
+ if (i < 256 && Block.byId[i] != null) {
+ Block block = Block.byId[i];
- return i < 256 && Block.byId[i].material == Material.WOOD ? 300 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : (i == Block.SAPLING.id ? 100 : (i == Item.BLAZE_ROD.id ? 2400 : 0)))));
+ if (block == Block.WOOD_STEP) {
+ return 150;
+ }
+
+ if (block.material == Material.WOOD) {
+ return 300;
+ }
+ }
+
+ return item instanceof ItemTool && ((ItemTool) item).e().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword) item).f().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe) item).f().equals("WOOD") ? 200 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : (i == Block.SAPLING.id ? 100 : (i == Item.BLAZE_ROD.id ? 2400 : 0)))))));
}
}
@@ -282,7 +297,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
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;
}
- public void f() {}
+ public void startOpen() {}
- public void g() {}
+ public void f() {}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
index 137ae9cc..faa7ead7 100644
--- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
+++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
@@ -1,13 +1,19 @@
package net.minecraft.server;
+import java.util.Iterator;
+
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit
public class TileEntityMobSpawner extends TileEntity {
public int spawnDelay = -1;
public String mobName = "Pig"; // CraftBukkit - private -> public
+ private NBTTagCompound spawnData = null;
public double b;
public double c = 0.0D;
+ private int minSpawnDelay = 200;
+ private int maxSpawnDelay = 800;
+ private int spawnCount = 4;
public TileEntityMobSpawner() {
this.spawnDelay = 20;
@@ -17,27 +23,24 @@ public class TileEntityMobSpawner extends TileEntity {
this.mobName = s;
}
- public boolean c() {
+ public boolean b() {
return this.world.findNearbyPlayer((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, 16.0D) != null;
}
- public void q_() {
- this.c = this.b;
- if (this.c()) {
- double d0 = (double) ((float) this.x + this.world.random.nextFloat());
- double d1 = (double) ((float) this.y + this.world.random.nextFloat());
- double d2 = (double) ((float) this.z + this.world.random.nextFloat());
-
- this.world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
- this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
-
- for (this.b += (double) (1000.0F / ((float) this.spawnDelay + 200.0F)); this.b > 360.0D; this.c -= 360.0D) {
- this.b -= 360.0D;
- }
-
- if (!this.world.isStatic) {
+ public void g() {
+ if (this.b()) {
+ if (this.world.isStatic) {
+ double d0 = (double) ((float) this.x + this.world.random.nextFloat());
+ double d1 = (double) ((float) this.y + this.world.random.nextFloat());
+ double d2 = (double) ((float) this.z + this.world.random.nextFloat());
+
+ this.world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
+ this.c = this.b % 360.0D;
+ this.b += 4.545454502105713D;
+ } else {
if (this.spawnDelay == -1) {
- this.e();
+ this.f();
}
if (this.spawnDelay > 0) {
@@ -45,70 +48,99 @@ public class TileEntityMobSpawner extends TileEntity {
return;
}
- byte b0 = 4;
-
- for (int i = 0; i < b0; ++i) {
- // CraftBukkit start - bad entity detection
- Entity mob = EntityTypes.createEntityByName(this.mobName, this.world);
+ for (int i = 0; i < this.spawnCount; ++i) {
+ Entity entity = EntityTypes.createEntityByName(this.mobName, this.world);
- if (!(mob instanceof EntityLiving)) {
- mobName = "Pig";
+ if (entity == null) {
return;
}
- EntityLiving entityliving = (EntityLiving) ((EntityLiving) mob);
- // CraftBukkit end
-
- if (entityliving == null) {
- return;
- }
-
- int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).grow(8.0D, 4.0D, 8.0D)).size();
+ int j = this.world.a(entity.getClass(), AxisAlignedBB.a().a((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).grow(8.0D, 4.0D, 8.0D)).size();
if (j >= 6) {
- this.e();
+ this.f();
return;
}
- if (entityliving != null) {
+ if (entity != null) {
double d3 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
double d4 = (double) (this.y + this.world.random.nextInt(3) - 1);
double d5 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
+ EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
- entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
- if (entityliving.canSpawn()) {
- this.world.addEntity(entityliving, SpawnReason.SPAWNER); // CraftBukkit
+ entity.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
+ if (entityliving == null || entityliving.canSpawn()) {
+ this.a(entity);
+ this.world.addEntity(entity, SpawnReason.SPAWNER); // CraftBukkit
this.world.triggerEffect(2004, this.x, this.y, this.z, 0);
- entityliving.aC();
- this.e();
+ if (entityliving != null) {
+ entityliving.aK();
+ }
+
+ this.f();
}
}
}
}
- super.q_();
+ super.g();
}
}
- private void e() {
- this.spawnDelay = 200 + this.world.random.nextInt(600);
+ public void a(Entity entity) {
+ if (this.spawnData != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ entity.c(nbttagcompound);
+ Iterator iterator = this.spawnData.c().iterator();
+
+ while (iterator.hasNext()) {
+ NBTBase nbtbase = (NBTBase) iterator.next();
+
+ nbttagcompound.set(nbtbase.getName(), nbtbase.clone());
+ }
+
+ entity.e(nbttagcompound);
+ }
+ }
+
+ private void f() {
+ this.spawnDelay = this.minSpawnDelay + this.world.random.nextInt(this.maxSpawnDelay - this.minSpawnDelay);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.mobName = nbttagcompound.getString("EntityId");
this.spawnDelay = nbttagcompound.getShort("Delay");
+ if (nbttagcompound.hasKey("SpawnData")) {
+ this.spawnData = nbttagcompound.getCompound("SpawnData");
+ } else {
+ this.spawnData = null;
+ }
+
+ if (nbttagcompound.hasKey("MinSpawnDelay")) {
+ this.minSpawnDelay = nbttagcompound.getShort("MinSpawnDelay");
+ this.maxSpawnDelay = nbttagcompound.getShort("MaxSpawnDelay");
+ this.spawnCount = nbttagcompound.getShort("SpawnCount");
+ }
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setString("EntityId", this.mobName);
nbttagcompound.setShort("Delay", (short) this.spawnDelay);
+ nbttagcompound.setShort("MinSpawnDelay", (short) this.minSpawnDelay);
+ nbttagcompound.setShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
+ nbttagcompound.setShort("SpawnCount", (short) this.spawnCount);
+ if (this.spawnData != null) {
+ nbttagcompound.setCompound("SpawnData", this.spawnData);
+ }
}
- public Packet d() {
- int i = EntityTypes.a(this.mobName);
+ public Packet e() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
- return new Packet132TileEntityData(this.x, this.y, this.z, 1, i);
+ this.b(nbttagcompound);
+ return new Packet132TileEntityData(this.x, this.y, this.z, 1, nbttagcompound);
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityNote.java b/src/main/java/net/minecraft/server/TileEntityNote.java
index 80513603..121efb87 100644
--- a/src/main/java/net/minecraft/server/TileEntityNote.java
+++ b/src/main/java/net/minecraft/server/TileEntityNote.java
@@ -24,7 +24,7 @@ public class TileEntityNote extends TileEntity {
}
}
- public void c() {
+ public void a() {
this.note = (byte) ((this.note + 1) % 25);
this.update();
}
@@ -53,7 +53,7 @@ public class TileEntityNote extends TileEntity {
// CraftBukkit start
org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(this.world, i, j, k, b0, this.note);
if (!event.isCancelled()) {
- this.world.playNote(i, j, k, event.getInstrument().getType(), event.getNote().getId());
+ this.world.playNote(i, j, k, Block.NOTE_BLOCK.id, event.getInstrument().getType(), event.getNote().getId());
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java
index b0e0465b..a5d3246a 100644
--- a/src/main/java/net/minecraft/server/TileEntityPiston.java
+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java
@@ -13,7 +13,7 @@ public class TileEntityPiston extends TileEntity {
private boolean e;
private float f;
private float g;
- private static List h = new ArrayList();
+ private List h = new ArrayList();
public TileEntityPiston() {}
@@ -25,19 +25,19 @@ public class TileEntityPiston extends TileEntity {
this.e = flag1;
}
- public int c() {
+ public int a() {
return this.a;
}
- public int k() {
+ public int n() {
return this.b;
}
- public boolean e() {
+ public boolean b() {
return this.d;
}
- public int f() {
+ public int c() {
return this.c;
}
@@ -50,10 +50,10 @@ public class TileEntityPiston extends TileEntity {
}
private void a(float f, float f1) {
- if (!this.d) {
- --f;
- } else {
+ if (this.d) {
f = 1.0F - f;
+ } else {
+ --f;
}
AxisAlignedBB axisalignedbb = Block.PISTON_MOVING.b(this.world, this.x, this.y, this.z, this.a, f, this.c);
@@ -62,8 +62,8 @@ public class TileEntityPiston extends TileEntity {
List list = this.world.getEntities((Entity) null, axisalignedbb);
if (!list.isEmpty()) {
- h.addAll(list);
- Iterator iterator = h.iterator();
+ this.h.addAll(list);
+ Iterator iterator = this.h.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -71,12 +71,12 @@ public class TileEntityPiston extends TileEntity {
entity.move((double) (f1 * (float) Facing.b[this.c]), (double) (f1 * (float) Facing.c[this.c]), (double) (f1 * (float) Facing.d[this.c]));
}
- h.clear();
+ this.h.clear();
}
}
}
- public void g() {
+ public void i() {
if (this.g < 1.0F && this.world != null) {
this.g = this.f = 1.0F;
this.world.q(this.x, this.y, this.z);
@@ -87,7 +87,7 @@ public class TileEntityPiston extends TileEntity {
}
}
- public void q_() {
+ public void g() {
if (this.world == null) return; // CraftBukkit
this.g = this.f;
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 2b0d4a11..87cf6593 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -4,7 +4,7 @@ public class TileEntitySign extends TileEntity {
public String[] lines = new String[] { "", "", "", ""};
public int b = -1;
- public boolean isEditable = true; // CraftBukkit - priv to public
+ public boolean isEditable = true; // CraftBukkit - privite -> public
public TileEntitySign() {}
@@ -28,23 +28,23 @@ public class TileEntitySign extends TileEntity {
}
}
- public Packet d() {
+ public Packet e() {
String[] astring = new String[4];
+ // CraftBukkit start - limit sign text to 15 chars per line
for (int i = 0; i < 4; ++i) {
astring[i] = this.lines[i];
- // CraftBukkit start - limit sign text to 15 chars per line
if (this.lines[i].length() > 15) {
astring[i] = this.lines[i].substring(0, 15);
}
- // CraftBukkit end
}
+ // CraftBukkit end
return new Packet130UpdateSign(this.x, this.y, this.z, astring);
}
- public boolean c() {
+ public boolean a() {
return this.isEditable;
}
}
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index 273622ed..7b20b169 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -55,7 +55,7 @@ public class Village {
int j2 = k + this.world.random.nextInt(16) - 8;
if (this.a(l1, i2, j2) && this.b(l1, i2, j2, l, i1, j1)) {
- return Vec3D.create((double) l1, (double) i2, (double) j2);
+ return Vec3D.a().create((double) l1, (double) i2, (double) j2);
}
}
@@ -63,7 +63,7 @@ public class Village {
}
private boolean b(int i, int j, int k, int l, int i1, int j1) {
- if (!this.world.e(i, j - 1, k)) {
+ if (!this.world.t(i, j - 1, k)) {
return false;
} else {
int k1 = i - l / 2;
@@ -72,7 +72,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.e(i2, j2, k2)) {
+ if (this.world.s(i2, j2, k2)) {
return false;
}
}
@@ -84,13 +84,13 @@ public class Village {
}
private void countPopulation() {
- List list = this.world.a(EntityIronGolem.class, AxisAlignedBB.b((double) (this.center.x - this.size), (double) (this.center.y - 4), (double) (this.center.z - this.size), (double) (this.center.x + this.size), (double) (this.center.y + 4), (double) (this.center.z + this.size)));
+ List list = this.world.a(EntityIronGolem.class, AxisAlignedBB.a().a((double) (this.center.x - this.size), (double) (this.center.y - 4), (double) (this.center.z - this.size), (double) (this.center.x + this.size), (double) (this.center.y + 4), (double) (this.center.z + this.size)));
this.j = list.size();
}
private void i() {
- List list = this.world.a(EntityVillager.class, AxisAlignedBB.b((double) (this.center.x - this.size), (double) (this.center.y - 4), (double) (this.center.z - this.size), (double) (this.center.x + this.size), (double) (this.center.y + 4), (double) (this.center.z + this.size)));
+ List list = this.world.a(EntityVillager.class, AxisAlignedBB.a().a((double) (this.center.x - this.size), (double) (this.center.y - 4), (double) (this.center.z - this.size), (double) (this.center.x + this.size), (double) (this.center.y + 4), (double) (this.center.z + this.size)));
this.population = list.size();
}
@@ -116,7 +116,7 @@ public class Village {
}
public boolean a(int i, int j, int k) {
- return this.center.c(i, j, k) < (float) (this.size * this.size);
+ return this.center.e(i, j, k) < (float) (this.size * this.size);
}
public List getDoors() {
@@ -130,7 +130,7 @@ public class Village {
while (iterator.hasNext()) {
VillageDoor villagedoor1 = (VillageDoor) iterator.next();
- int i1 = villagedoor1.a(i, j, k);
+ int i1 = villagedoor1.b(i, j, k);
if (i1 < l) {
villagedoor = villagedoor1;
@@ -148,7 +148,7 @@ public class Village {
while (iterator.hasNext()) {
VillageDoor villagedoor1 = (VillageDoor) iterator.next();
- int i1 = villagedoor1.a(i, j, k);
+ int i1 = villagedoor1.b(i, j, k);
if (i1 > 256) {
i1 *= 1000;
@@ -165,8 +165,8 @@ public class Village {
return villagedoor;
}
- public VillageDoor d(int i, int j, int k) {
- if (this.center.c(i, j, k) > (float) (this.size * this.size)) {
+ public VillageDoor e(int i, int j, int k) {
+ if (this.center.e(i, j, k) > (float) (this.size * this.size)) {
return null;
} else {
Iterator iterator = this.doors.iterator();
@@ -201,44 +201,45 @@ public class Village {
public void a(EntityLiving entityliving) {
Iterator iterator = this.i.iterator();
- VillageAgressor villageagressor;
+ VillageAggressor villageaggressor;
do {
if (!iterator.hasNext()) {
- this.i.add(new VillageAgressor(this, entityliving, this.time));
+ this.i.add(new VillageAggressor(this, entityliving, this.time));
return;
}
- villageagressor = (VillageAgressor) iterator.next();
- } while (villageagressor.a != entityliving);
+ villageaggressor = (VillageAggressor) iterator.next();
+ } while (villageaggressor.a != entityliving);
- villageagressor.b = this.time;
+ villageaggressor.b = this.time;
}
public EntityLiving b(EntityLiving entityliving) {
double d0 = Double.MAX_VALUE;
- VillageAgressor villageagressor = null;
+ VillageAggressor villageaggressor = null;
+ Iterator iterator = this.i.iterator();
- for (int i = 0; i < this.i.size(); ++i) {
- VillageAgressor villageagressor1 = (VillageAgressor) this.i.get(i);
- double d1 = villageagressor1.a.j(entityliving);
+ while (iterator.hasNext()) {
+ VillageAggressor villageaggressor1 = (VillageAggressor) iterator.next();
+ double d1 = villageaggressor1.a.e(entityliving);
if (d1 <= d0) {
- villageagressor = villageagressor1;
+ villageaggressor = villageaggressor1;
d0 = d1;
}
}
- return villageagressor != null ? villageagressor.a : null;
+ return villageaggressor != null ? villageaggressor.a : null;
}
private void j() {
Iterator iterator = this.i.iterator();
while (iterator.hasNext()) {
- VillageAgressor villageagressor = (VillageAgressor) iterator.next();
+ VillageAggressor villageaggressor = (VillageAggressor) iterator.next();
- if (!villageagressor.a.isAlive() || Math.abs(this.time - villageagressor.b) > 300) {
+ if (!villageaggressor.a.isAlive() || Math.abs(this.time - villageaggressor.b) > 300) {
iterator.remove();
}
}
@@ -281,15 +282,15 @@ public class Village {
int i = this.doors.size();
if (i == 0) {
- this.center.a(0, 0, 0);
+ this.center.b(0, 0, 0);
this.size = 0;
} else {
- this.center.a(this.c.x / i, this.c.y / i, this.c.z / i);
+ this.center.b(this.c.x / i, this.c.y / i, this.c.z / i);
int j = 0;
VillageDoor villagedoor;
- for (Iterator iterator = this.doors.iterator(); iterator.hasNext(); j = Math.max(villagedoor.a(this.center.x, this.center.y, this.center.z), j)) {
+ for (Iterator iterator = this.doors.iterator(); iterator.hasNext(); j = Math.max(villagedoor.b(this.center.x, this.center.y, this.center.z), j)) {
villagedoor = (VillageDoor) iterator.next();
}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 04597eb0..ebe13e68 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.e()) {
+ if (this.world.r()) {
this.c = 0;
return;
}
@@ -38,7 +38,7 @@ public class VillageSiege {
}
if (this.c == 0) {
- float f = this.world.b(0.0F);
+ float f = this.world.c(0.0F);
if ((double) f < 0.5D || (double) f > 0.501D) {
return;
@@ -160,7 +160,7 @@ public class VillageSiege {
int k1 = k + this.world.random.nextInt(16) - 8;
if (this.f.a(i1, j1, k1) && SpawnerCreature.a(EnumCreatureType.MONSTER, this.world, i1, j1, k1)) {
- return Vec3D.create((double) i1, (double) j1, (double) k1);
+ return Vec3D.a().create((double) i1, (double) j1, (double) k1);
}
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 70cacddb..830ed872 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2,79 +2,70 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.concurrent.Callable;
// CraftBukkit start
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.craftbukkit.util.LongHashset;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.event.CraftEventFactory;
-import org.bukkit.craftbukkit.util.UnsafeList;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
-import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.weather.ThunderChangeEvent;
-import org.bukkit.block.BlockState;
// CraftBukkit end
-public class World implements IBlockAccess {
+public abstract class World implements IBlockAccess {
- public boolean a = false;
+ public boolean e = false;
public List entityList = new ArrayList();
- private List G = new ArrayList();
- private TreeSet H = new TreeSet();
- private Set I = new HashSet();
+ protected List g = new ArrayList();
public List tileEntityList = new ArrayList();
- private List J = new ArrayList();
- private List K = new ArrayList();
+ private List a = new ArrayList();
+ private List b = new ArrayList();
public List players = new ArrayList();
- public UnsafeList e = new UnsafeList(); // CraftBukkit - use UnsafeList
- private long L = 16777215L;
- public int f = 0;
- protected int g = (new Random()).nextInt();
- protected final int h = 1013904223;
- protected float i;
- protected float j;
- protected float k;
- protected float l;
- protected int m = 0;
- public int n = 0;
+ public List j = new ArrayList();
+ private long c = 16777215L;
+ public int k = 0;
+ protected int l = (new Random()).nextInt();
+ protected final int m = 1013904223;
+ protected float n;
+ protected float o;
+ protected float p;
+ protected float q;
+ protected int r = 0;
+ public int s = 0;
public boolean suppressPhysics = false;
- private long M = System.currentTimeMillis();
- protected int p = 40;
public int difficulty;
public Random random = new Random();
- public boolean s = false;
public WorldProvider worldProvider; // CraftBukkit - remove final
- protected List u = new ArrayList();
+ protected List x = new ArrayList();
public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
protected final IDataManager dataManager;
public WorldData worldData; // CraftBukkit - protected -> public
public boolean isLoading;
- private boolean N;
public WorldMapCollection worldMaps;
public final VillageCollection villages = new VillageCollection(this);
- private final VillageSiege O = new VillageSiege(this);
- private ArrayList P = new ArrayList();
- private boolean Q;
- public boolean allowMonsters = true; // CraftBukkit - private -> public
- public boolean allowAnimals = true; // CraftBukkit - private -> public
- private LongHashset chunkTickList; // CraftBukkit
- public long ticksPerAnimalSpawns; // CraftBukkit
- public long ticksPerMonsterSpawns; // CraftBukkit
- private int R;
- int[] E;
- private List S;
+ protected final VillageSiege siegeManager = new VillageSiege(this);
+ public final MethodProfiler methodProfiler;
+ private ArrayList d = new ArrayList();
+ private boolean L;
+ // CraftBukkit start - public, longhashset
+ public boolean allowMonsters = true;
+ public boolean allowAnimals = true;
+ protected LongHashset chunkTickList = new LongHashset();
+ public long ticksPerAnimalSpawns;
+ public long ticksPerMonsterSpawns;
+ // CraftBukkit end
+ private int M;
+ int[] J;
+ private List N;
public boolean isStatic;
public BiomeBase getBiome(int i, int j) {
@@ -103,14 +94,6 @@ public class World implements IBlockAccess {
int lastZAccessed = Integer.MIN_VALUE;
final Object chunkLock = new Object();
- private boolean canSpawn(int x, int z) {
- if (this.generator != null) {
- return this.generator.canSpawn(this.getWorld(), x, z);
- } else {
- return this.worldProvider.canSpawn(x, z);
- }
- }
-
public CraftWorld getWorld() {
return this.world;
}
@@ -119,114 +102,53 @@ public class World implements IBlockAccess {
return (CraftServer) Bukkit.getServer();
}
- // CraftBukkit - changed signature
- public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, ChunkGenerator gen, org.bukkit.World.Environment env) {
+ // Changed signature
+ public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
- // CraftBukkit end
-
- this.chunkTickList = new LongHashset(); // CraftBukkit
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
- this.R = this.random.nextInt(12000);
- this.E = new int['\u8000'];
- this.S = new ArrayList();
+ // CraftBukkit end
+
+ this.M = this.random.nextInt(12000);
+ this.J = new int['\u8000'];
+ this.N = new ArrayList();
this.isStatic = false;
this.dataManager = idatamanager;
+ this.methodProfiler = methodprofiler;
this.worldMaps = new WorldMapCollection(idatamanager);
this.worldData = idatamanager.getWorldData();
- this.s = this.worldData == null;
if (worldprovider != null) {
this.worldProvider = worldprovider;
- } else if (this.worldData != null && this.worldData.g() != 0) {
- this.worldProvider = WorldProvider.byDimension(this.worldData.g());
+ } else if (this.worldData != null && this.worldData.i() != 0) {
+ this.worldProvider = WorldProvider.byDimension(this.worldData.i());
} else {
this.worldProvider = WorldProvider.byDimension(0);
}
- boolean flag = false;
-
if (this.worldData == null) {
this.worldData = new WorldData(worldsettings, s);
- flag = true;
} else {
- this.worldData.a(s);
+ this.worldData.setName(s);
}
this.worldProvider.a(this);
- this.chunkProvider = this.b();
- if (flag) {
- this.c();
+ this.chunkProvider = this.h();
+ if (!this.worldData.isInitialized()) {
+ this.a(worldsettings);
+ this.worldData.d(true);
}
- this.g();
- this.B();
+ this.v();
+ this.a();
this.getServer().addWorld(this.world); // CraftBukkit
}
- protected IChunkProvider b() {
- IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
+ protected abstract IChunkProvider h();
- return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.worldProvider.getChunkProvider());
- }
-
- protected void c() {
- if (!this.worldProvider.c()) {
- this.worldData.setSpawn(0, this.worldProvider.getSeaLevel(), 0);
- } else {
- this.isLoading = true;
- WorldChunkManager worldchunkmanager = this.worldProvider.c;
- List list = worldchunkmanager.a();
- Random random = new Random(this.getSeed());
- ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
- int i = 0;
- int j = this.worldProvider.getSeaLevel();
- int k = 0;
-
- // CraftBukkit start
- if (this.generator != null) {
- Random rand = new Random(this.getSeed());
- org.bukkit.Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
-
- if (spawn != null) {
- if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
- throw new IllegalStateException("Cannot set spawn point for " + this.worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
- } else {
- this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
- this.isLoading = false;
- return;
- }
- }
- }
- // CraftBukkit end
-
- if (chunkposition != null) {
- i = chunkposition.x;
- k = chunkposition.z;
- } else {
- System.out.println("Unable to find spawn biome");
- }
-
- int l = 0;
-
- // CraftBukkit - use our own canSpawn
- while (!this.canSpawn(i, k)) {
- i += random.nextInt(64) - random.nextInt(64);
- k += random.nextInt(64) - random.nextInt(64);
- ++l;
- if (l == 1000) {
- break;
- }
- }
-
- this.worldData.setSpawn(i, j, k);
- this.isLoading = false;
- }
- }
-
- public ChunkCoordinates getDimensionSpawn() {
- return this.worldProvider.e();
+ protected void a(WorldSettings worldsettings) {
+ this.worldData.d(true);
}
public int b(int i, int j) {
@@ -239,32 +161,11 @@ public class World implements IBlockAccess {
return this.getTypeId(i, k, j);
}
- public void save(boolean flag, IProgressUpdate iprogressupdate) {
- if (this.chunkProvider.canSave()) {
- if (iprogressupdate != null) {
- iprogressupdate.a("Saving level");
- }
-
- this.A();
- if (iprogressupdate != null) {
- iprogressupdate.b("Saving chunks");
- }
-
- this.chunkProvider.saveChunks(flag, iprogressupdate);
- }
- }
-
- private void A() {
- this.m();
- this.dataManager.saveWorldData(this.worldData, this.players);
- this.worldMaps.a();
- }
-
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;
}
- public int f(int i, int j, int k) {
+ public int b(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).b(i & 15, j, k & 15))) : 0;
}
@@ -275,7 +176,7 @@ public class World implements IBlockAccess {
public boolean isTileEntity(int i, int j, int k) {
int l = this.getTypeId(i, j, k);
- return Block.byId[l] != null && Block.byId[l].o();
+ return Block.byId[l] != null && Block.byId[l].s();
}
public boolean isLoaded(int i, int j, int k) {
@@ -283,10 +184,10 @@ public class World implements IBlockAccess {
}
public boolean areChunksLoaded(int i, int j, int k, int l) {
- return this.a(i - l, j - l, k - l, i + l, j + l, k + l);
+ return this.c(i - l, j - l, k - l, i + l, j + l, k + l);
}
- public boolean a(int i, int j, int k, int l, int i1, int j1) {
+ public boolean c(int i, int j, int k, int l, int i1, int j1) {
if (i1 >= 0 && j < 256) {
i >>= 4;
k >>= 4;
@@ -307,7 +208,7 @@ public class World implements IBlockAccess {
}
}
- private boolean isChunkLoaded(int i, int j) {
+ protected boolean isChunkLoaded(int i, int j) {
return this.chunkProvider.isChunkLoaded(i, j);
}
@@ -331,6 +232,10 @@ public class World implements IBlockAccess {
// CraftBukkit end
public boolean setRawTypeIdAndData(int i, int j, int k, int l, int i1) {
+ return this.setRawTypeIdAndData(i, j, k, l, i1, true);
+ }
+
+ public boolean setRawTypeIdAndData(int i, int j, int k, int l, int i1, boolean flag) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
@@ -338,12 +243,16 @@ public class World implements IBlockAccess {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- boolean flag = chunk.a(i & 15, j, k & 15, l, i1);
+ boolean flag1 = chunk.a(i & 15, j, k & 15, l, i1);
- // MethodProfiler.a("checkLight"); // CraftBukkit - not in production code
- this.v(i, j, k);
- // MethodProfiler.a(); // CraftBukkit - not in production code
- return flag;
+ // this.methodProfiler.a("checkLight"); // CraftBukkit - not in production code
+ this.x(i, j, k);
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ if (flag && flag1 && (this.isStatic || chunk.seenByPlayer)) {
+ this.notify(i, j, k);
+ }
+
+ return flag1;
}
} else {
return false;
@@ -360,9 +269,13 @@ public class World implements IBlockAccess {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
boolean flag = chunk.a(i & 15, j, k & 15, l);
- // MethodProfiler.a("checkLight"); // CraftBukkit - not in production code
- this.v(i, j, k);
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.methodProfiler.a("checkLight"); // CraftBukkit - not in production code
+ this.x(i, j, k);
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ if (flag && (this.isStatic || chunk.seenByPlayer)) {
+ this.notify(i, j, k);
+ }
+
return flag;
}
} else {
@@ -396,13 +309,7 @@ public class World implements IBlockAccess {
public void setData(int i, int j, int k, int l) {
if (this.setRawData(i, j, k, l)) {
- int i1 = this.getTypeId(i, j, k);
-
- if (Block.r[i1 & 4095]) {
- this.update(i, j, k, i1);
- } else {
- this.applyPhysics(i, j, k, i1);
- }
+ this.update(i, j, k, this.getTypeId(i, j, k));
}
}
@@ -414,10 +321,15 @@ public class World implements IBlockAccess {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
+ int i1 = i & 15;
+ int j1 = k & 15;
+ boolean flag = chunk.b(i1, j, j1, l);
- i &= 15;
- k &= 15;
- return chunk.b(i, j, k, l);
+ if (flag && (this.isStatic || chunk.seenByPlayer && Block.r[chunk.getTypeId(i1, j, j1) & 4095])) {
+ this.notify(i, j, k);
+ }
+
+ return flag;
}
} else {
return false;
@@ -429,11 +341,11 @@ public class World implements IBlockAccess {
int old = this.getTypeId(i, j, k);
if (this.setRawTypeId(i, j, k, l)) {
this.update(i, j, k, l == 0 ? old : l);
+ // CraftBukkit end
return true;
} else {
return false;
}
- // CraftBukkit end
}
public boolean setTypeIdAndData(int i, int j, int k, int l, int i1) {
@@ -446,13 +358,16 @@ public class World implements IBlockAccess {
}
public void notify(int i, int j, int k) {
- for (int l = 0; l < this.u.size(); ++l) {
- ((IWorldAccess) this.u.get(l)).a(i, j, k);
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(i, j, k);
}
}
public void update(int i, int j, int k, int l) {
- this.notify(i, j, k);
this.applyPhysics(i, j, k, l);
}
@@ -467,35 +382,43 @@ public class World implements IBlockAccess {
if (!this.worldProvider.e) {
for (i1 = k; i1 <= l; ++i1) {
- this.b(EnumSkyBlock.SKY, i, i1, j);
+ this.c(EnumSkyBlock.SKY, i, i1, j);
}
}
- this.b(i, k, j, i, l, j);
+ this.d(i, k, j, i, l, j);
}
- public void k(int i, int j, int k) {
- for (int l = 0; l < this.u.size(); ++l) {
- ((IWorldAccess) this.u.get(l)).a(i, j, k, i, j, k);
+ public void i(int i, int j, int k) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(i, j, k, i, j, k);
}
}
- public void b(int i, int j, int k, int l, int i1, int j1) {
- for (int k1 = 0; k1 < this.u.size(); ++k1) {
- ((IWorldAccess) this.u.get(k1)).a(i, j, k, l, i1, j1);
+ public void d(int i, int j, int k, int l, int i1, int j1) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(i, j, k, l, i1, j1);
}
}
public void applyPhysics(int i, int j, int k, int l) {
- this.k(i - 1, j, k, l);
- this.k(i + 1, j, k, l);
- this.k(i, j - 1, k, l);
- this.k(i, j + 1, k, l);
- this.k(i, j, k - 1, l);
- this.k(i, j, k + 1, l);
+ this.m(i - 1, j, k, l);
+ this.m(i + 1, j, k, l);
+ this.m(i, j - 1, k, l);
+ this.m(i, j + 1, k, l);
+ this.m(i, j, k - 1, l);
+ this.m(i, j, k + 1, l);
}
- private void k(int i, int j, int k, int l) {
+ 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)];
@@ -517,11 +440,11 @@ public class World implements IBlockAccess {
}
}
- public boolean isChunkLoaded(int i, int j, int k) {
+ public boolean j(int i, int j, int k) {
return this.getChunkAt(i >> 4, k >> 4).d(i & 15, j, k & 15);
}
- public int m(int i, int j, int k) {
+ public int k(int i, int j, int k) {
if (j < 0) {
return 0;
} else {
@@ -542,7 +465,7 @@ public class World implements IBlockAccess {
if (flag) {
int l = this.getTypeId(i, j, k);
- if (l == Block.STEP.id || l == Block.SOIL.id || l == Block.COBBLESTONE_STAIRS.id || l == Block.WOOD_STAIRS.id) {
+ if (l == Block.STEP.id || l == Block.WOOD_STEP.id || l == Block.SOIL.id || l == Block.COBBLESTONE_STAIRS.id || l == Block.WOOD_STAIRS.id) {
int i1 = this.a(i, j + 1, k, false);
int j1 = this.a(i + 1, j, k, false);
int k1 = this.a(i - 1, j, k, false);
@@ -580,7 +503,7 @@ public class World implements IBlockAccess {
i &= 15;
k &= 15;
- return chunk.c(i, j, k, this.f);
+ return chunk.c(i, j, k, this.k);
}
} else {
return 15;
@@ -601,7 +524,7 @@ public class World implements IBlockAccess {
}
}
- public int a(EnumSkyBlock enumskyblock, int i, int j, int k) {
+ public int b(EnumSkyBlock enumskyblock, int i, int j, int k) {
if (j < 0) {
j = 0;
}
@@ -626,7 +549,7 @@ public class World implements IBlockAccess {
}
}
- public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
+ public void b(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j >= 0) {
if (j < 256) {
@@ -634,9 +557,12 @@ public class World implements IBlockAccess {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
chunk.a(enumskyblock, i & 15, j, k & 15, l);
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
- for (int i1 = 0; i1 < this.u.size(); ++i1) {
- ((IWorldAccess) this.u.get(i1)).b(i, j, k);
+ iworldaccess.b(i, j, k);
}
}
}
@@ -644,18 +570,22 @@ public class World implements IBlockAccess {
}
}
- public void o(int i, int j, int k) {
- for (int l = 0; l < this.u.size(); ++l) {
- ((IWorldAccess) this.u.get(l)).b(i, j, k);
+ public void n(int i, int j, int k) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.b(i, j, k);
}
}
- public float p(int i, int j, int k) {
+ public float o(int i, int j, int k) {
return this.worldProvider.f[this.getLightLevel(i, j, k)];
}
- public boolean e() {
- return this.f < 4;
+ public boolean r() {
+ return this.k < 4;
}
public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) {
@@ -783,7 +713,7 @@ public class World implements IBlockAccess {
vec3d.c = d2;
}
- Vec3D vec3d2 = Vec3D.create(vec3d.a, vec3d.b, vec3d.c);
+ Vec3D vec3d2 = Vec3D.a().create(vec3d.a, vec3d.b, vec3d.c);
l = (int) (vec3d2.a = (double) MathHelper.floor(vec3d.a));
if (b0 == 5) {
@@ -826,31 +756,51 @@ public class World implements IBlockAccess {
}
public void makeSound(Entity entity, String s, float f, float f1) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
+ if (entity != null && s != null) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
+ }
}
}
public void makeSound(double d0, double d1, double d2, String s, float f, float f1) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1);
+ if (s != null) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(s, d0, d1, d2, f, f1);
+ }
}
}
public void a(String s, int i, int j, int k) {
- for (int l = 0; l < this.u.size(); ++l) {
- ((IWorldAccess) this.u.get(l)).a(s, i, j, k);
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(s, i, j, k);
}
}
public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, d3, d4, d5);
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(s, d0, d1, d2, d3, d4, d5);
}
}
public boolean strikeLightning(Entity entity) {
- this.e.add(entity);
+ this.j.add(entity);
return true;
}
@@ -911,20 +861,28 @@ public class World implements IBlockAccess {
this.getChunkAt(i, j).a(entity);
this.entityList.add(entity);
- this.c(entity);
+ this.a(entity);
return true;
}
}
- protected void c(Entity entity) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(entity);
+ protected void a(Entity entity) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(entity);
}
}
- protected void d(Entity entity) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).b(entity);
+ protected void b(Entity entity) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.b(entity);
}
entity.valid = false; // CraftBukkit
@@ -941,7 +899,7 @@ public class World implements IBlockAccess {
entity.die();
if (entity instanceof EntityHuman) {
- this.players.remove((EntityHuman) entity);
+ this.players.remove(entity);
this.everyoneSleeping();
}
}
@@ -949,27 +907,27 @@ public class World implements IBlockAccess {
public void removeEntity(Entity entity) {
entity.die();
if (entity instanceof EntityHuman) {
- this.players.remove((EntityHuman) entity);
+ this.players.remove(entity);
this.everyoneSleeping();
}
- int i = entity.ca;
- int j = entity.cc;
+ int i = entity.ah;
+ int j = entity.aj;
- if (entity.bZ && this.isChunkLoaded(i, j)) {
+ if (entity.ag && this.isChunkLoaded(i, j)) {
this.getChunkAt(i, j).b(entity);
}
this.entityList.remove(entity);
- this.d(entity);
+ this.b(entity);
}
public void addIWorldAccess(IWorldAccess iworldaccess) {
- this.u.add(iworldaccess);
+ this.x.add(iworldaccess);
}
public List getCubes(Entity entity, AxisAlignedBB axisalignedbb) {
- this.P.clear();
+ this.d.clear();
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@@ -984,7 +942,7 @@ public class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, i2, l1)];
if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.P);
+ block.a(this, k1, i2, l1, axisalignedbb, this.d, entity);
}
}
}
@@ -993,25 +951,53 @@ public class World implements IBlockAccess {
double d0 = 0.25D;
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
+ Iterator iterator = list.iterator();
- for (int j2 = 0; j2 < list.size(); ++j2) {
- AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).h();
+ while (iterator.hasNext()) {
+ Entity entity1 = (Entity) iterator.next();
+ AxisAlignedBB axisalignedbb1 = entity1.E();
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
- this.P.add(axisalignedbb1);
+ this.d.add(axisalignedbb1);
}
- axisalignedbb1 = entity.b_((Entity) list.get(j2));
+ axisalignedbb1 = entity.g(entity1);
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
- this.P.add(axisalignedbb1);
+ this.d.add(axisalignedbb1);
}
}
- return this.P;
+ return this.d;
+ }
+
+ public List a(AxisAlignedBB axisalignedbb) {
+ this.d.clear();
+ int i = MathHelper.floor(axisalignedbb.a);
+ int j = MathHelper.floor(axisalignedbb.d + 1.0D);
+ int k = MathHelper.floor(axisalignedbb.b);
+ int l = MathHelper.floor(axisalignedbb.e + 1.0D);
+ int i1 = MathHelper.floor(axisalignedbb.c);
+ int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
+
+ for (int k1 = i; k1 < j; ++k1) {
+ for (int l1 = i1; l1 < j1; ++l1) {
+ if (this.isLoaded(k1, 64, l1)) {
+ for (int i2 = k - 1; i2 < l; ++i2) {
+ Block block = Block.byId[this.getTypeId(k1, i2, l1)];
+
+ if (block != null) {
+ block.a(this, k1, i2, l1, axisalignedbb, this.d, (Entity) null);
+ }
+ }
+ }
+ }
+ }
+
+ return this.d;
}
public int a(float f) {
- float f1 = this.b(f);
+ float f1 = this.c(f);
float f2 = 1.0F - (MathHelper.cos(f1 * 3.1415927F * 2.0F) * 2.0F + 0.5F);
if (f2 < 0.0F) {
@@ -1023,23 +1009,23 @@ public class World implements IBlockAccess {
}
f2 = 1.0F - f2;
- f2 = (float) ((double) f2 * (1.0D - (double) (this.d(f) * 5.0F) / 16.0D));
- f2 = (float) ((double) f2 * (1.0D - (double) (this.c(f) * 5.0F) / 16.0D));
+ f2 = (float) ((double) f2 * (1.0D - (double) (this.j(f) * 5.0F) / 16.0D));
+ f2 = (float) ((double) f2 * (1.0D - (double) (this.i(f) * 5.0F) / 16.0D));
f2 = 1.0F - f2;
return (int) (f2 * 11.0F);
}
- public float b(float f) {
+ public float c(float f) {
return this.worldProvider.a(this.worldData.getTime(), f);
}
- public int f(int i, int j) {
+ public int g(int i, int j) {
return this.getChunkAtWorldCoords(i, j).d(i & 15, j & 15);
}
- public int g(int i, int j) {
+ public int h(int i, int j) {
Chunk chunk = this.getChunkAtWorldCoords(i, j);
- int k = chunk.g() + 16;
+ int k = chunk.h() + 15;
i &= 15;
@@ -1054,86 +1040,55 @@ public class World implements IBlockAccess {
return -1;
}
- public void c(int i, int j, int k, int l, int i1) {
- NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
- byte b0 = 8;
+ public void a(int i, int j, int k, int l, int i1) {}
- if (this.a) {
- if (this.a(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
- int j1 = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
-
- if (j1 == nextticklistentry.d && j1 > 0) {
- Block.byId[j1].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
- }
- }
- } else {
- if (this.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
- if (l > 0) {
- nextticklistentry.a((long) i1 + this.worldData.getTime());
- }
-
- if (!this.I.contains(nextticklistentry)) {
- this.I.add(nextticklistentry);
- this.H.add(nextticklistentry);
- }
- }
- }
- }
-
- public void d(int i, int j, int k, int l, int i1) {
- NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
-
- if (l > 0) {
- nextticklistentry.a((long) i1 + this.worldData.getTime());
- }
-
- if (!this.I.contains(nextticklistentry)) {
- this.I.add(nextticklistentry);
- this.H.add(nextticklistentry);
- }
- }
+ public void b(int i, int j, int k, int l, int i1) {}
public void tickEntities() {
- // MethodProfiler.a("entities"); // CraftBukkit - not in production code
- // MethodProfiler.a("global"); // CraftBukkit - not in production code
+ // this.methodProfiler.a("entities"); // CraftBukkit - not in production code
+ // this.methodProfiler.a("global"); // CraftBukkit - not in production code
int i;
Entity entity;
- for (i = 0; i < this.e.size(); ++i) {
- entity = (Entity) this.e.unsafeGet(i); // CraftBukkit - use unsafeGet
+ for (i = 0; i < this.j.size(); ++i) {
+ entity = (Entity) this.j.get(i);
// CraftBukkit start - fixed an NPE
if (entity == null) {
continue;
}
// CraftBukkit end
- entity.F_();
+ entity.h_();
if (entity.dead) {
- this.e.remove(i--);
+ this.j.remove(i--);
}
}
- // MethodProfiler.b("remove"); // CraftBukkit - not in production code
- this.entityList.removeAll(this.G);
+ // this.methodProfiler.c("remove"); // CraftBukkit - not in production code
+ this.entityList.removeAll(this.g);
+ Iterator iterator = this.g.iterator();
int j;
int k;
- for (i = 0; i < this.G.size(); ++i) {
- entity = (Entity) this.G.get(i);
- j = entity.ca;
- k = entity.cc;
- if (entity.bZ && this.isChunkLoaded(j, k)) {
+ while (iterator.hasNext()) {
+ entity = (Entity) iterator.next();
+ j = entity.ah;
+ k = entity.aj;
+ if (entity.ag && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
}
- for (i = 0; i < this.G.size(); ++i) {
- this.d((Entity) this.G.get(i));
+ iterator = this.g.iterator();
+
+ while (iterator.hasNext()) {
+ entity = (Entity) iterator.next();
+ this.b(entity);
}
- this.G.clear();
- // MethodProfiler.b("regular"); // CraftBukkit - not in production code
+ this.g.clear();
+ // this.methodProfiler.c("regular"); // CraftBukkit - not in production code
for (i = 0; i < this.entityList.size(); ++i) {
entity = (Entity) this.entityList.get(i);
@@ -1146,37 +1101,39 @@ public class World implements IBlockAccess {
entity.vehicle = null;
}
+ // this.methodProfiler.a("tick"); // CraftBukkit - not in production code
if (!entity.dead) {
this.playerJoinedWorld(entity);
}
- // MethodProfiler.a("remove"); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.methodProfiler.a("remove"); // CraftBukkit - not in production code
if (entity.dead) {
- j = entity.ca;
- k = entity.cc;
- if (entity.bZ && this.isChunkLoaded(j, k)) {
+ j = entity.ah;
+ k = entity.aj;
+ if (entity.ag && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
this.entityList.remove(i--);
- this.d(entity);
+ this.b(entity);
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
}
- // MethodProfiler.b("tileEntities"); // CraftBukkit - not in production code
- this.Q = true;
- Iterator iterator = this.tileEntityList.iterator();
+ // this.methodProfiler.c("tileEntities"); // CraftBukkit - not in production code
+ this.L = true;
+ iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
- if (!tileentity.l() && tileentity.world != null && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
- tileentity.q_();
+ if (!tileentity.p() && tileentity.m() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
+ tileentity.g();
}
- if (tileentity.l()) {
+ if (tileentity.p()) {
iterator.remove();
if (this.isChunkLoaded(tileentity.x >> 4, tileentity.z >> 4)) {
Chunk chunk = this.getChunkAt(tileentity.x >> 4, tileentity.z >> 4);
@@ -1188,31 +1145,32 @@ public class World implements IBlockAccess {
}
}
- this.Q = false;
- if (!this.K.isEmpty()) {
- this.tileEntityList.removeAll(this.K);
- this.K.clear();
+ this.L = false;
+ if (!this.b.isEmpty()) {
+ this.tileEntityList.removeAll(this.b);
+ this.b.clear();
}
- // MethodProfiler.b("pendingTileEntities"); // CraftBukkit - not in production code
- if (!this.J.isEmpty()) {
- Iterator iterator1 = this.J.iterator();
+ // this.methodProfiler.c("pendingTileEntities"); // CraftBukkit - not in production code
+ if (!this.a.isEmpty()) {
+ Iterator iterator1 = this.a.iterator();
while (iterator1.hasNext()) {
TileEntity tileentity1 = (TileEntity) iterator1.next();
- if (!tileentity1.l()) {
- // CraftBukkit - order matters, moved down
- /* if (!this.h.contains(tileentity1)) {
- this.h.add(tileentity1);
- } */
+ if (!tileentity1.p()) {
+ /* CraftBukkit start - order matters, moved down
+ if (!this.tileEntityList.contains(tileentity1)) {
+ this.tileEntityList.add(tileentity1);
+ }
+ // CraftBukkit end */
if (this.isChunkLoaded(tileentity1.x >> 4, tileentity1.z >> 4)) {
Chunk chunk1 = this.getChunkAt(tileentity1.x >> 4, tileentity1.z >> 4);
if (chunk1 != null) {
chunk1.a(tileentity1.x & 15, tileentity1.y, tileentity1.z & 15, tileentity1);
- // CraftBukkit start - moved in from above
+ // CraftBukkit start - moved down from above
if (!this.tileEntityList.contains(tileentity1)) {
this.tileEntityList.add(tileentity1);
}
@@ -1224,16 +1182,16 @@ public class World implements IBlockAccess {
}
}
- this.J.clear();
+ this.a.clear();
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
}
public void a(Collection collection) {
- if (this.Q) {
- this.J.addAll(collection);
+ if (this.L) {
+ this.a.addAll(collection);
} else {
this.tileEntityList.addAll(collection);
}
@@ -1248,31 +1206,31 @@ public class World implements IBlockAccess {
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
- if (!flag || this.a(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
- entity.bL = entity.locX;
- entity.bM = entity.locY;
- entity.bN = entity.locZ;
+ if (!flag || this.c(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
+ entity.S = entity.locX;
+ entity.T = entity.locY;
+ entity.U = entity.locZ;
entity.lastYaw = entity.yaw;
entity.lastPitch = entity.pitch;
- if (flag && entity.bZ) {
+ if (flag && entity.ag) {
if (entity.vehicle != null) {
- entity.R();
+ entity.U();
} else {
- entity.F_();
+ entity.h_();
}
}
- // MethodProfiler.a("chunkCheck"); // CraftBukkit - not in production code
+ // this.methodProfiler.a("chunkCheck"); // CraftBukkit - not in production code
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
- entity.locX = entity.bL;
+ entity.locX = entity.S;
}
if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) {
- entity.locY = entity.bM;
+ entity.locY = entity.T;
}
if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) {
- entity.locZ = entity.bN;
+ entity.locZ = entity.U;
}
if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) {
@@ -1287,21 +1245,21 @@ public class World implements IBlockAccess {
int l = MathHelper.floor(entity.locY / 16.0D);
int i1 = MathHelper.floor(entity.locZ / 16.0D);
- if (!entity.bZ || entity.ca != k || entity.cb != l || entity.cc != i1) {
- if (entity.bZ && this.isChunkLoaded(entity.ca, entity.cc)) {
- this.getChunkAt(entity.ca, entity.cc).a(entity, entity.cb);
+ if (!entity.ag || entity.ah != k || entity.ai != l || entity.aj != i1) {
+ if (entity.ag && this.isChunkLoaded(entity.ah, entity.aj)) {
+ this.getChunkAt(entity.ah, entity.aj).a(entity, entity.ai);
}
if (this.isChunkLoaded(k, i1)) {
- entity.bZ = true;
+ entity.ag = true;
this.getChunkAt(k, i1).a(entity);
} else {
- entity.bZ = false;
+ entity.ag = false;
}
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
- if (flag && entity.bZ && entity.passenger != null) {
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ if (flag && entity.ag && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger);
} else {
@@ -1312,21 +1270,28 @@ public class World implements IBlockAccess {
}
}
- public boolean containsEntity(AxisAlignedBB axisalignedbb) {
+ public boolean b(AxisAlignedBB axisalignedbb) {
+ return this.a(axisalignedbb, (Entity) null);
+ }
+
+ public boolean a(AxisAlignedBB axisalignedbb, Entity entity) {
List list = this.getEntities((Entity) null, axisalignedbb);
+ Iterator iterator = list.iterator();
- for (int i = 0; i < list.size(); ++i) {
- Entity entity = (Entity) list.get(i);
+ Entity entity1;
- if (!entity.dead && entity.bf) {
- return false;
+ do {
+ if (!iterator.hasNext()) {
+ return true;
}
- }
- return true;
+ entity1 = (Entity) iterator.next();
+ } while (entity1.dead || !entity1.m || entity1 == entity);
+
+ return false;
}
- public boolean b(AxisAlignedBB axisalignedbb) {
+ public boolean c(AxisAlignedBB axisalignedbb) {
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@@ -1396,7 +1361,7 @@ public class World implements IBlockAccess {
return false;
}
- public boolean d(AxisAlignedBB axisalignedbb) {
+ public boolean e(AxisAlignedBB axisalignedbb) {
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@@ -1404,7 +1369,7 @@ public class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (this.a(i, k, i1, j, l, j1)) {
+ if (this.c(i, k, i1, j, l, j1)) {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
@@ -1429,11 +1394,11 @@ public class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (!this.a(i, k, i1, j, l, j1)) {
+ if (!this.c(i, k, i1, j, l, j1)) {
return false;
} else {
boolean flag = false;
- Vec3D vec3d = Vec3D.create(0.0D, 0.0D, 0.0D);
+ Vec3D vec3d = Vec3D.a().create(0.0D, 0.0D, 0.0D);
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
@@ -1547,7 +1512,7 @@ public class World implements IBlockAccess {
double d4 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) f1;
double d5 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) f2;
- if (this.a(Vec3D.create(d3, d4, d5), vec3d) == null) {
+ if (this.a(Vec3D.a().create(d3, d4, d5), vec3d) == null) {
++i;
}
@@ -1605,12 +1570,12 @@ public class World implements IBlockAccess {
TileEntity tileentity = chunk.e(i & 15, j, k & 15);
if (tileentity == null) {
- Iterator iterator = this.J.iterator();
+ Iterator iterator = this.a.iterator();
while (iterator.hasNext()) {
TileEntity tileentity1 = (TileEntity) iterator.next();
- if (!tileentity1.l() && tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
+ if (!tileentity1.p() && tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
tileentity = tileentity1;
break;
}
@@ -1623,20 +1588,18 @@ public class World implements IBlockAccess {
}
public void setTileEntity(int i, int j, int k, TileEntity tileentity) {
- if (tileentity != null && !tileentity.l()) {
- if (this.Q) {
+ if (tileentity != null && !tileentity.p()) {
+ if (this.L) {
tileentity.x = i;
tileentity.y = j;
tileentity.z = k;
- this.J.add(tileentity);
+ this.a.add(tileentity);
} else {
- // CraftBukkit - order matters, moved down
- // this.tileEntityList.add(tileentity);
+ this.tileEntityList.add(tileentity);
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
if (chunk != null) {
chunk.a(i & 15, j, k & 15, tileentity);
- this.tileEntityList.add(tileentity); // CraftBukkit - moved in from above
}
}
}
@@ -1645,12 +1608,12 @@ public class World implements IBlockAccess {
public void q(int i, int j, int k) {
TileEntity tileentity = this.getTileEntity(i, j, k);
- if (tileentity != null && this.Q) {
+ if (tileentity != null && this.L) {
tileentity.j();
- this.J.remove(tileentity);
+ this.a.remove(tileentity);
} else {
if (tileentity != null) {
- this.J.remove(tileentity);
+ this.a.remove(tileentity);
this.tileEntityList.remove(tileentity);
}
@@ -1663,17 +1626,23 @@ public class World implements IBlockAccess {
}
public void a(TileEntity tileentity) {
- this.K.add(tileentity);
+ this.b.add(tileentity);
}
public boolean r(int i, int j, int k) {
Block block = Block.byId[this.getTypeId(i, j, k)];
- return block == null ? false : block.a();
+ return block == null ? false : block.d();
+ }
+
+ public boolean s(int i, int j, int k) {
+ return Block.i(this.getTypeId(i, j, k));
}
- public boolean e(int i, int j, int k) {
- return Block.g(this.getTypeId(i, j, k));
+ public boolean t(int i, int j, int k) {
+ Block block = Block.byId[this.getTypeId(i, j, k)];
+
+ return block == null ? false : (block.material.k() && block.c() ? true : (block instanceof BlockStairs ? (this.getData(i, j, k) & 4) == 4 : (block instanceof BlockStepAbstract ? (this.getData(i, j, k) & 8) == 8 : false)));
}
public boolean b(int i, int j, int k, boolean flag) {
@@ -1683,7 +1652,7 @@ public class World implements IBlockAccess {
if (chunk != null && !chunk.isEmpty()) {
Block block = Block.byId[this.getTypeId(i, j, k)];
- return block == null ? false : block.material.j() && block.b();
+ return block == null ? false : block.material.k() && block.c();
} else {
return flag;
}
@@ -1692,11 +1661,11 @@ public class World implements IBlockAccess {
}
}
- public void g() {
+ public void v() {
int i = this.a(1.0F);
- if (i != this.f) {
- this.f = i;
+ if (i != this.k) {
+ this.k = i;
}
}
@@ -1706,73 +1675,22 @@ public class World implements IBlockAccess {
}
public void doTick() {
- if (this.getWorldData().isHardcore() && this.difficulty < 3) {
- this.difficulty = 3;
- }
-
- this.worldProvider.c.b();
- this.i();
- long i;
-
- if (this.everyoneDeeplySleeping()) {
- boolean flag = false;
-
- if (this.allowMonsters && this.difficulty >= 1) {
- ;
- }
-
- if (!flag) {
- i = this.worldData.getTime() + 24000L;
- this.worldData.a(i - i % 24000L);
- this.u();
- }
- }
-
- // MethodProfiler.a("mobSpawner"); // CraftBukkit - not in production code
- // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
- long time = this.worldData.getTime();
- if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
- SpawnerCreature.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L));
- }
- // CraftBukkit end
- // MethodProfiler.b("chunkSource"); // CraftBukkit - not in production code
- this.chunkProvider.unloadChunks();
- int j = this.a(1.0F);
-
- if (j != this.f) {
- this.f = j;
- }
-
- i = this.worldData.getTime() + 1L;
- if (i % (long) this.p == 0L) {
- // MethodProfiler.b("save"); // CraftBukkit - not in production code
- this.save(false, (IProgressUpdate) null);
- }
-
- this.worldData.a(i);
- // MethodProfiler.b("tickPending"); // CraftBukkit - not in production code
- this.a(false);
- // MethodProfiler.b("tickTiles"); // CraftBukkit - not in production code
this.l();
- // MethodProfiler.b("village"); // CraftBukkit - not in production code
- this.villages.tick();
- this.O.a();
- // MethodProfiler.a(); // CraftBukkit - not in production code
}
- private void B() {
+ private void a() {
if (this.worldData.hasStorm()) {
- this.j = 1.0F;
+ this.o = 1.0F;
if (this.worldData.isThundering()) {
- this.l = 1.0F;
+ this.q = 1.0F;
}
}
}
- protected void i() {
+ protected void l() {
if (!this.worldProvider.e) {
- if (this.m > 0) {
- --this.m;
+ if (this.r > 0) {
+ --this.r;
}
int i = this.worldData.getThunderDuration();
@@ -1820,63 +1738,45 @@ public class World implements IBlockAccess {
}
}
- this.i = this.j;
+ this.n = this.o;
if (this.worldData.hasStorm()) {
- this.j = (float) ((double) this.j + 0.01D);
+ this.o = (float) ((double) this.o + 0.01D);
} else {
- this.j = (float) ((double) this.j - 0.01D);
+ this.o = (float) ((double) this.o - 0.01D);
}
- if (this.j < 0.0F) {
- this.j = 0.0F;
+ if (this.o < 0.0F) {
+ this.o = 0.0F;
}
- if (this.j > 1.0F) {
- this.j = 1.0F;
+ if (this.o > 1.0F) {
+ this.o = 1.0F;
}
- this.k = this.l;
+ this.p = this.q;
if (this.worldData.isThundering()) {
- this.l = (float) ((double) this.l + 0.01D);
+ this.q = (float) ((double) this.q + 0.01D);
} else {
- this.l = (float) ((double) this.l - 0.01D);
+ this.q = (float) ((double) this.q - 0.01D);
}
- if (this.l < 0.0F) {
- this.l = 0.0F;
+ if (this.q < 0.0F) {
+ this.q = 0.0F;
}
- if (this.l > 1.0F) {
- this.l = 1.0F;
+ if (this.q > 1.0F) {
+ this.q = 1.0F;
}
}
}
- private void C() {
- // CraftBukkit start
- WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
- this.getServer().getPluginManager().callEvent(weather);
-
- ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
- this.getServer().getPluginManager().callEvent(thunder);
- if (!weather.isCancelled()) {
- this.worldData.setWeatherDuration(0);
- this.worldData.setStorm(false);
- }
- if (!thunder.isCancelled()) {
- this.worldData.setThunderDuration(0);
- this.worldData.setThundering(false);
- }
- // CraftBukkit end
- }
-
- public void j() {
+ public void w() {
this.worldData.setWeatherDuration(1);
}
- protected void k() {
+ protected void x() {
// this.chunkTickList.clear(); // CraftBukkit - removed
- // MethodProfiler.a("buildList"); // CraftBukkit - not in production code
+ // this.methodProfiler.a("buildList"); // CraftBukkit - not in production code
int i;
EntityHuman entityhuman;
@@ -1891,17 +1791,17 @@ public class World implements IBlockAccess {
for (int l = -b0; l <= b0; ++l) {
for (int i1 = -b0; i1 <= b0; ++i1) {
- this.chunkTickList.add(LongHash.toLong(l + j, i1 + k)); // CraftBukkit
+ this.chunkTickList.add(org.bukkit.craftbukkit.util.LongHash.toLong(l + j, i1 + k)); // CraftBukkit
}
}
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
- if (this.R > 0) {
- --this.R;
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ if (this.M > 0) {
+ --this.M;
}
- // MethodProfiler.a("playerCheckLight"); // CraftBukkit - not in production code
+ // this.methodProfiler.a("playerCheckLight"); // CraftBukkit - not in production code
if (!this.players.isEmpty()) {
i = this.random.nextInt(this.players.size());
entityhuman = (EntityHuman) this.players.get(i);
@@ -1909,19 +1809,17 @@ public 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.v(j, k, j1);
+ this.x(j, k, j1);
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
}
protected void a(int i, int j, Chunk chunk) {
- // MethodProfiler.b("tickChunk"); // CraftBukkit - not in production code
- chunk.j();
- // MethodProfiler.b("moodSound"); // CraftBukkit - not in production code
- if (this.R == 0) {
- this.g = this.g * 3 + 1013904223;
- int k = this.g >> 2;
+ // this.methodProfiler.c("moodSound"); // CraftBukkit - not in production code
+ if (this.M == 0) {
+ this.l = this.l * 3 + 1013904223;
+ int k = this.l >> 2;
int l = k & 15;
int i1 = k >> 8 & 15;
int j1 = k >> 16 & 255; // CraftBukkit - 127 -> 255
@@ -1929,139 +1827,40 @@ public class World implements IBlockAccess {
l += i;
i1 += j;
- if (k1 == 0 && this.m(l, j1, i1) <= this.random.nextInt(8) && this.a(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
+ if (k1 == 0 && this.k(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) {
this.makeSound((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F);
- this.R = this.random.nextInt(12000) + 6000;
+ this.M = this.random.nextInt(12000) + 6000;
}
}
}
- // MethodProfiler.b("checkLight"); // CraftBukkit - not in production code
- chunk.n();
+ // this.methodProfiler.c("checkLight"); // CraftBukkit - not in production code
+ chunk.o();
}
- protected void l() {
- this.k();
- int i = 0;
- int j = 0;
- // Iterator iterator = this.chunkTickList.iterator(); // CraftBukkit
-
- // CraftBukkit start
- for (long chunkCoord : this.chunkTickList.popAll()) {
- int chunkX = LongHash.msw(chunkCoord);
- int chunkZ = LongHash.lsw(chunkCoord);
- // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
- int k = chunkX * 16;
- int l = chunkZ * 16;
-
- // MethodProfiler.a("getChunk"); // CraftBukkit - not in production code
- Chunk chunk = this.getChunkAt(chunkX, chunkZ);
- // CraftBukkit end
-
- this.a(k, l, chunk);
- // MethodProfiler.b("thunder"); // CraftBukkit - not in production code
- int i1;
- int j1;
- int k1;
- int l1;
-
- if (this.random.nextInt(100000) == 0 && this.x() && this.w()) {
- this.g = this.g * 3 + 1013904223;
- i1 = this.g >> 2;
- j1 = k + (i1 & 15);
- k1 = l + (i1 >> 8 & 15);
- l1 = this.f(j1, k1);
- if (this.y(j1, l1, k1)) {
- this.strikeLightning(new EntityWeatherLighting(this, (double) j1, (double) l1, (double) k1));
- this.m = 2;
- }
- }
-
- // MethodProfiler.b("iceandsnow"); // CraftBukkit - not in production code
- if (this.random.nextInt(16) == 0) {
- this.g = this.g * 3 + 1013904223;
- i1 = this.g >> 2;
- j1 = i1 & 15;
- k1 = i1 >> 8 & 15;
- l1 = this.f(j1 + k, k1 + l);
- if (this.t(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);
-
- BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
- this.getServer().getPluginManager().callEvent(iceBlockForm);
- if (!iceBlockForm.isCancelled()) {
- blockState.update(true);
- }
- // CraftBukkit end
- }
-
- if (this.x() && this.u(j1 + k, l1, k1 + l)) {
- // CraftBukkit start
- BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState();
- blockState.setTypeId(Block.SNOW.id);
-
- BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
- this.getServer().getPluginManager().callEvent(snow);
- if (!snow.isCancelled()) {
- blockState.update(true);
- }
- // CraftBukkit end
- }
- }
-
- // MethodProfiler.b("tickTiles"); // CraftBukkit - not in production code
- ChunkSection[] achunksection = chunk.h();
-
- j1 = achunksection.length;
-
- for (k1 = 0; k1 < j1; ++k1) {
- ChunkSection chunksection = achunksection[k1];
-
- if (chunksection != null && chunksection.b()) {
- for (int i2 = 0; i2 < 3; ++i2) {
- this.g = this.g * 3 + 1013904223;
- int j2 = this.g >> 2;
- int k2 = j2 & 15;
- int l2 = j2 >> 8 & 15;
- int i3 = j2 >> 16 & 15;
- int j3 = chunksection.a(k2, i3, l2);
-
- ++j;
- Block block = Block.byId[j3];
-
- if (block != null && block.n()) {
- ++i;
- block.a(this, k2 + k, i3 + chunksection.c(), l2 + l, this.random);
- }
- }
- }
- }
-
- // MethodProfiler.a(); // CraftBukkit - not in production code
- }
+ protected void g() {
+ this.x();
}
- public boolean s(int i, int j, int k) {
+ public boolean u(int i, int j, int k) {
return this.c(i, j, k, false);
}
- public boolean t(int i, int j, int k) {
+ public boolean v(int i, int j, int k) {
return this.c(i, j, k, true);
}
public boolean c(int i, int j, int k, boolean flag) {
BiomeBase biomebase = this.getBiome(i, k);
- float f = biomebase.i();
+ float f = biomebase.j();
if (f > 0.15F) {
return false;
} else {
- if (j >= 0 && j < 256 && this.a(EnumSkyBlock.BLOCK, i, j, k) < 10) {
+ if (j >= 0 && j < 256 && this.b(EnumSkyBlock.BLOCK, i, j, k) < 10) {
int l = this.getTypeId(i, j, k);
if ((l == Block.STATIONARY_WATER.id || l == Block.WATER.id) && this.getData(i, j, k) == 0) {
@@ -2097,14 +1896,14 @@ public class World implements IBlockAccess {
}
}
- public boolean u(int i, int j, int k) {
+ public boolean w(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
- float f = biomebase.i();
+ float f = biomebase.j();
if (f > 0.15F) {
return false;
} else {
- if (j >= 0 && j < 256 && this.a(EnumSkyBlock.BLOCK, i, j, k) < 10) {
+ if (j >= 0 && j < 256 && this.b(EnumSkyBlock.BLOCK, i, j, k) < 10) {
int l = this.getTypeId(i, j - 1, k);
int i1 = this.getTypeId(i, j, k);
@@ -2117,30 +1916,30 @@ public class World implements IBlockAccess {
}
}
- public void v(int i, int j, int k) {
+ public void x(int i, int j, int k) {
if (!this.worldProvider.e) {
- this.b(EnumSkyBlock.SKY, i, j, k);
+ this.c(EnumSkyBlock.SKY, i, j, k);
}
- this.b(EnumSkyBlock.BLOCK, i, j, k);
+ this.c(EnumSkyBlock.BLOCK, i, j, k);
}
- private int c(int i, int j, int k, int l, int i1, int j1) {
+ private int a(int i, int j, int k, int l, int i1, int j1) {
int k1 = 0;
- if (this.isChunkLoaded(j, k, l)) {
+ if (this.j(j, k, l)) {
k1 = 15;
} else {
if (j1 == 0) {
j1 = 1;
}
- int l1 = this.a(EnumSkyBlock.SKY, j - 1, k, l) - j1;
- int i2 = this.a(EnumSkyBlock.SKY, j + 1, k, l) - j1;
- int j2 = this.a(EnumSkyBlock.SKY, j, k - 1, l) - j1;
- int k2 = this.a(EnumSkyBlock.SKY, j, k + 1, l) - j1;
- int l2 = this.a(EnumSkyBlock.SKY, j, k, l - 1) - j1;
- int i3 = this.a(EnumSkyBlock.SKY, j, k, l + 1) - j1;
+ int l1 = this.b(EnumSkyBlock.SKY, j - 1, k, l) - j1;
+ int i2 = this.b(EnumSkyBlock.SKY, j + 1, k, l) - j1;
+ int j2 = this.b(EnumSkyBlock.SKY, j, k - 1, l) - j1;
+ int k2 = this.b(EnumSkyBlock.SKY, j, k + 1, l) - j1;
+ int l2 = this.b(EnumSkyBlock.SKY, j, k, l - 1) - j1;
+ int i3 = this.b(EnumSkyBlock.SKY, j, k, l + 1) - j1;
if (l1 > k1) {
k1 = l1;
@@ -2170,14 +1969,14 @@ public class World implements IBlockAccess {
return k1;
}
- private int d(int i, int j, int k, int l, int i1, int j1) {
+ private int f(int i, int j, int k, int l, int i1, int j1) {
int k1 = Block.lightEmission[i1];
- int l1 = this.a(EnumSkyBlock.BLOCK, j - 1, k, l) - j1;
- int i2 = this.a(EnumSkyBlock.BLOCK, j + 1, k, l) - j1;
- int j2 = this.a(EnumSkyBlock.BLOCK, j, k - 1, l) - j1;
- int k2 = this.a(EnumSkyBlock.BLOCK, j, k + 1, l) - j1;
- int l2 = this.a(EnumSkyBlock.BLOCK, j, k, l - 1) - j1;
- int i3 = this.a(EnumSkyBlock.BLOCK, j, k, l + 1) - j1;
+ int l1 = this.b(EnumSkyBlock.BLOCK, j - 1, k, l) - j1;
+ int i2 = this.b(EnumSkyBlock.BLOCK, j + 1, k, l) - j1;
+ int j2 = this.b(EnumSkyBlock.BLOCK, j, k - 1, l) - j1;
+ int k2 = this.b(EnumSkyBlock.BLOCK, j, k + 1, l) - j1;
+ int l2 = this.b(EnumSkyBlock.BLOCK, j, k, l - 1) - j1;
+ int i3 = this.b(EnumSkyBlock.BLOCK, j, k, l + 1) - j1;
if (l1 > k1) {
k1 = l1;
@@ -2206,16 +2005,16 @@ public class World implements IBlockAccess {
return k1;
}
- public void b(EnumSkyBlock enumskyblock, int i, int j, int k) {
+ public void c(EnumSkyBlock enumskyblock, int i, int j, int k) {
if (this.areChunksLoaded(i, j, k, 17)) {
int l = 0;
int i1 = 0;
- // MethodProfiler.a("getBrightness"); // CraftBukkit - not in production code
- int j1 = this.a(enumskyblock, i, j, k);
+ // this.methodProfiler.a("getBrightness"); // CraftBukkit - not in production code
+ int j1 = this.b(enumskyblock, i, j, k);
boolean flag = false;
int k1 = this.getTypeId(i, j, k);
- int l1 = this.f(i, j, k);
+ int l1 = this.b(i, j, k);
if (l1 == 0) {
l1 = 1;
@@ -2225,9 +2024,9 @@ public class World implements IBlockAccess {
int i2;
if (enumskyblock == EnumSkyBlock.SKY) {
- i2 = this.c(j1, i, j, k, k1, l1);
+ i2 = this.a(j1, i, j, k, k1, l1);
} else {
- i2 = this.d(j1, i, j, k, k1, l1);
+ i2 = this.f(j1, i, j, k, k1, l1);
}
int j2;
@@ -2236,29 +2035,31 @@ public class World implements IBlockAccess {
int i3;
int j3;
int k3;
+ int l3;
+ int i4;
if (i2 > j1) {
- this.E[i1++] = 133152;
+ this.J[i1++] = 133152;
} else if (i2 < j1) {
if (enumskyblock != EnumSkyBlock.BLOCK) {
;
}
- this.E[i1++] = 133152 + (j1 << 18);
+ this.J[i1++] = 133152 + (j1 << 18);
while (l < i1) {
- j2 = this.E[l++];
- k1 = (j2 & 63) - 32 + i;
- l1 = (j2 >> 6 & 63) - 32 + j;
- i2 = (j2 >> 12 & 63) - 32 + k;
- k2 = j2 >> 18 & 15;
- l2 = this.a(enumskyblock, k1, l1, i2);
+ k1 = this.J[l++];
+ l1 = (k1 & 63) - 32 + i;
+ i2 = (k1 >> 6 & 63) - 32 + j;
+ j2 = (k1 >> 12 & 63) - 32 + k;
+ k2 = k1 >> 18 & 15;
+ l2 = this.b(enumskyblock, l1, i2, j2);
if (l2 == k2) {
- this.a(enumskyblock, k1, l1, i2, 0);
+ this.b(enumskyblock, l1, i2, j2, 0);
if (k2 > 0) {
- i3 = k1 - i;
- k3 = l1 - j;
- j3 = i2 - k;
+ i3 = l1 - i;
+ k3 = i2 - j;
+ j3 = j2 - k;
if (i3 < 0) {
i3 = -i3;
}
@@ -2272,21 +2073,21 @@ public class World implements IBlockAccess {
}
if (i3 + k3 + j3 < 17) {
- for (int l3 = 0; l3 < 6; ++l3) {
- int i4 = l3 % 2 * 2 - 1;
- int j4 = k1 + l3 / 2 % 3 / 2 * i4;
- int k4 = l1 + (l3 / 2 + 1) % 3 / 2 * i4;
- int l4 = i2 + (l3 / 2 + 2) % 3 / 2 * i4;
+ for (i4 = 0; i4 < 6; ++i4) {
+ l3 = i4 % 2 * 2 - 1;
+ int j4 = l1 + i4 / 2 % 3 / 2 * l3;
+ int k4 = i2 + (i4 / 2 + 1) % 3 / 2 * l3;
+ int l4 = j2 + (i4 / 2 + 2) % 3 / 2 * l3;
- l2 = this.a(enumskyblock, j4, k4, l4);
+ l2 = this.b(enumskyblock, j4, k4, l4);
int i5 = Block.lightBlock[this.getTypeId(j4, k4, l4)];
if (i5 == 0) {
i5 = 1;
}
- if (l2 == k2 - i5 && i1 < this.E.length) {
- this.E[i1++] = j4 - i + 32 + (k4 - j + 32 << 6) + (l4 - k + 32 << 12) + (k2 - i5 << 18);
+ if (l2 == k2 - i5 && i1 < this.J.length) {
+ this.J[i1++] = j4 - i + 32 + (k4 - j + 32 << 6) + (l4 - k + 32 << 12) + (k2 - i5 << 18);
}
}
}
@@ -2297,152 +2098,90 @@ public class World implements IBlockAccess {
l = 0;
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
- // MethodProfiler.a("tcp < tcc"); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ // this.methodProfiler.a("tcp < tcc"); // CraftBukkit - not in production code
while (l < i1) {
- j1 = this.E[l++];
- int j5 = (j1 & 63) - 32 + i;
-
- j2 = (j1 >> 6 & 63) - 32 + j;
- k1 = (j1 >> 12 & 63) - 32 + k;
- l1 = this.a(enumskyblock, j5, j2, k1);
- i2 = this.getTypeId(j5, j2, k1);
- k2 = Block.lightBlock[i2];
- if (k2 == 0) {
- k2 = 1;
+ k1 = this.J[l++];
+ l1 = (k1 & 63) - 32 + i;
+ i2 = (k1 >> 6 & 63) - 32 + j;
+ j2 = (k1 >> 12 & 63) - 32 + k;
+ k2 = this.b(enumskyblock, l1, i2, j2);
+ l2 = this.getTypeId(l1, i2, j2);
+ i3 = Block.lightBlock[l2];
+ if (i3 == 0) {
+ i3 = 1;
}
boolean flag2 = false;
if (enumskyblock == EnumSkyBlock.SKY) {
- l2 = this.c(l1, j5, j2, k1, i2, k2);
+ k3 = this.a(k2, l1, i2, j2, l2, i3);
} else {
- l2 = this.d(l1, j5, j2, k1, i2, k2);
+ k3 = this.f(k2, l1, i2, j2, l2, i3);
}
- if (l2 != l1) {
- this.a(enumskyblock, j5, j2, k1, l2);
- if (l2 > l1) {
- i3 = j5 - i;
- k3 = j2 - j;
- j3 = k1 - k;
- if (i3 < 0) {
- i3 = -i3;
+ if (k3 != k2) {
+ this.b(enumskyblock, l1, i2, j2, k3);
+ if (k3 > k2) {
+ j3 = l1 - i;
+ i4 = i2 - j;
+ l3 = j2 - k;
+ if (j3 < 0) {
+ j3 = -j3;
}
- if (k3 < 0) {
- k3 = -k3;
+ if (i4 < 0) {
+ i4 = -i4;
}
- if (j3 < 0) {
- j3 = -j3;
+ if (l3 < 0) {
+ l3 = -l3;
}
- if (i3 + k3 + j3 < 17 && i1 < this.E.length - 6) {
- if (this.a(enumskyblock, j5 - 1, j2, k1) < l2) {
- this.E[i1++] = j5 - 1 - i + 32 + (j2 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (j3 + i4 + l3 < 17 && i1 < this.J.length - 6) {
+ if (this.b(enumskyblock, l1 - 1, i2, j2) < k3) {
+ this.J[i1++] = l1 - 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
}
- if (this.a(enumskyblock, j5 + 1, j2, k1) < l2) {
- this.E[i1++] = j5 + 1 - i + 32 + (j2 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (this.b(enumskyblock, l1 + 1, i2, j2) < k3) {
+ this.J[i1++] = l1 + 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
}
- if (this.a(enumskyblock, j5, j2 - 1, k1) < l2) {
- this.E[i1++] = j5 - i + 32 + (j2 - 1 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (this.b(enumskyblock, l1, i2 - 1, j2) < k3) {
+ this.J[i1++] = l1 - i + 32 + (i2 - 1 - j + 32 << 6) + (j2 - k + 32 << 12);
}
- if (this.a(enumskyblock, j5, j2 + 1, k1) < l2) {
- this.E[i1++] = j5 - i + 32 + (j2 + 1 - j + 32 << 6) + (k1 - k + 32 << 12);
+ if (this.b(enumskyblock, l1, i2 + 1, j2) < k3) {
+ this.J[i1++] = l1 - i + 32 + (i2 + 1 - j + 32 << 6) + (j2 - k + 32 << 12);
}
- if (this.a(enumskyblock, j5, j2, k1 - 1) < l2) {
- this.E[i1++] = j5 - i + 32 + (j2 - j + 32 << 6) + (k1 - 1 - k + 32 << 12);
+ if (this.b(enumskyblock, l1, i2, j2 - 1) < k3) {
+ this.J[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 - 1 - k + 32 << 12);
}
- if (this.a(enumskyblock, j5, j2, k1 + 1) < l2) {
- this.E[i1++] = j5 - i + 32 + (j2 - j + 32 << 6) + (k1 + 1 - k + 32 << 12);
+ if (this.b(enumskyblock, l1, i2, j2 + 1) < k3) {
+ this.J[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 + 1 - k + 32 << 12);
}
}
}
}
}
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
}
}
public boolean a(boolean flag) {
- int i = this.H.size();
-
- if (i != this.I.size()) {
- throw new IllegalStateException("TickNextTick list out of synch");
- } else {
- if (i > 1000) {
- // CraftBukkit start - if the server has too much to process over time, try to alleviate that
- if (i > 20 * 1000) {
- i = i / 20;
- } else {
- i = 1000;
- }
- // CraftBukkit end
- }
-
- for (int j = 0; j < i; ++j) {
- NextTickListEntry nextticklistentry = (NextTickListEntry) this.H.first();
-
- if (!flag && nextticklistentry.e > this.worldData.getTime()) {
- break;
- }
-
- this.H.remove(nextticklistentry);
- this.I.remove(nextticklistentry);
- byte b0 = 8;
-
- if (this.a(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
- int k = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
-
- if (k == nextticklistentry.d && k > 0) {
- Block.byId[k].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
- }
- }
- }
-
- return this.H.size() != 0;
- }
+ return false;
}
public List a(Chunk chunk, boolean flag) {
- ArrayList arraylist = null;
- ChunkCoordIntPair chunkcoordintpair = chunk.k();
- int i = chunkcoordintpair.x << 4;
- int j = i + 16;
- int k = chunkcoordintpair.z << 4;
- int l = k + 16;
- Iterator iterator = this.I.iterator();
-
- while (iterator.hasNext()) {
- NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next();
-
- if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) {
- if (flag) {
- this.H.remove(nextticklistentry);
- iterator.remove();
- }
-
- if (arraylist == null) {
- arraylist = new ArrayList();
- }
-
- arraylist.add(nextticklistentry);
- }
- }
-
- return arraylist;
+ return null;
}
public List getEntities(Entity entity, AxisAlignedBB axisalignedbb) {
- this.S.clear();
+ this.N.clear();
int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D);
int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
@@ -2451,12 +2190,12 @@ public class World implements IBlockAccess {
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
if (this.isChunkLoaded(i1, j1)) {
- this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.S);
+ this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.N);
}
}
}
- return this.S;
+ return this.N;
}
public List a(Class oclass, AxisAlignedBB axisalignedbb) {
@@ -2487,7 +2226,7 @@ public class World implements IBlockAccess {
Entity entity2 = (Entity) iterator.next();
if (entity2 != entity) {
- double d1 = entity.j(entity2);
+ double d1 = entity.e(entity2);
if (d1 <= d0) {
entity1 = entity2;
@@ -2503,10 +2242,6 @@ public class World implements IBlockAccess {
if (this.isLoaded(i, j, k)) {
this.getChunkAtWorldCoords(i, k).e();
}
-
- for (int l = 0; l < this.u.size(); ++l) {
- ((IWorldAccess) this.u.get(l)).a(i, j, k, tileentity);
- }
}
public int a(Class oclass) {
@@ -2533,15 +2268,15 @@ public class World implements IBlockAccess {
}
this.entityList.add(entity);
// CraftBukkit end
- this.c((Entity) list.get(i));
+ this.a((Entity) list.get(i));
}
}
public void b(List list) {
- this.G.addAll(list);
+ this.g.addAll(list);
}
- public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1) {
+ public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1, Entity entity) {
int j1 = this.getTypeId(j, k, l);
Block block = Block.byId[j1];
Block block1 = Block.byId[i];
@@ -2553,14 +2288,14 @@ public class World implements IBlockAccess {
boolean defaultReturn; // CraftBukkit - store the default action
- if (axisalignedbb != null && !this.containsEntity(axisalignedbb)) {
+ if (axisalignedbb != null && !this.a(axisalignedbb, entity)) {
defaultReturn = false; // CraftBukkit
} else {
- if (block != null && (block == Block.WATER || block == Block.STATIONARY_WATER || block == Block.LAVA || block == Block.STATIONARY_LAVA || block == Block.FIRE || block.material.isReplacable())) {
+ if (block != null && (block == Block.WATER || block == Block.STATIONARY_WATER || block == Block.LAVA || block == Block.STATIONARY_LAVA || block == Block.FIRE || block.material.isReplaceable())) {
block = null;
}
- defaultReturn = i > 0 && block == null && block1.canPlace(this, j, k, l, i1); // CraftBukkit
+ defaultReturn = i > 0 && block == null && block1.canPlace(this, j, k, l, i1);
}
// CraftBukkit start
@@ -2572,7 +2307,7 @@ public class World implements IBlockAccess {
}
public PathEntity findPath(Entity entity, Entity entity1, float f, boolean flag, boolean flag1, boolean flag2, boolean flag3) {
- // MethodProfiler.a("pathfind"); // CraftBukkit - not in production code
+ // this.methodProfiler.a("pathfind"); // CraftBukkit - not in production code
int i = MathHelper.floor(entity.locX);
int j = MathHelper.floor(entity.locY + 1.0D);
int k = MathHelper.floor(entity.locZ);
@@ -2586,12 +2321,12 @@ public class World implements IBlockAccess {
ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2);
PathEntity pathentity = (new Pathfinder(chunkcache, flag, flag1, flag2, flag3)).a(entity, entity1, f);
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
return pathentity;
}
public PathEntity a(Entity entity, int i, int j, int k, float f, boolean flag, boolean flag1, boolean flag2, boolean flag3) {
- // MethodProfiler.a("pathfind"); // CraftBukkit - not in production code
+ // this.methodProfiler.a("pathfind"); // CraftBukkit - not in production code
int l = MathHelper.floor(entity.locX);
int i1 = MathHelper.floor(entity.locY);
int j1 = MathHelper.floor(entity.locZ);
@@ -2605,14 +2340,14 @@ public class World implements IBlockAccess {
ChunkCache chunkcache = new ChunkCache(this, l1, i2, j2, k2, l2, i3);
PathEntity pathentity = (new Pathfinder(chunkcache, flag, flag1, flag2, flag3)).a(entity, i, j, k, f);
- // MethodProfiler.a(); // CraftBukkit - not in production code
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
return pathentity;
}
public boolean isBlockFacePowered(int i, int j, int k, int l) {
int i1 = this.getTypeId(i, j, k);
- return i1 == 0 ? false : Block.byId[i1].d(this, i, j, k, l);
+ return i1 == 0 ? false : Block.byId[i1].c(this, i, j, k, l);
}
public boolean isBlockPowered(int i, int j, int k) {
@@ -2620,7 +2355,7 @@ public class World implements IBlockAccess {
}
public boolean isBlockFaceIndirectlyPowered(int i, int j, int k, int l) {
- if (this.e(i, j, k)) {
+ if (this.s(i, j, k)) {
return this.isBlockPowered(i, j, k);
} else {
int i1 = this.getTypeId(i, j, k);
@@ -2659,23 +2394,6 @@ public class World implements IBlockAccess {
return entityhuman;
}
- public EntityHuman a(double d0, double d1, double d2) {
- double d3 = -1.0D;
- EntityHuman entityhuman = null;
-
- for (int i = 0; i < this.players.size(); ++i) {
- EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
- double d4 = entityhuman1.e(d0, entityhuman1.locY, d1);
-
- if ((d2 < 0.0D || d4 < d2 * d2) && (d3 == -1.0D || d4 < d3)) {
- d3 = d4;
- entityhuman = entityhuman1;
- }
- }
-
- return entityhuman;
- }
-
public EntityHuman findNearbyVulnerablePlayer(Entity entity, double d0) {
return this.findNearbyVulnerablePlayer(entity.locX, entity.locY, entity.locZ, d0);
}
@@ -2686,9 +2404,11 @@ public class World implements IBlockAccess {
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
-
- // CraftBukkit - fixed NPE
- if (entityhuman1 == null || entityhuman1.dead) continue;
+ // CraftBukkit start - fixed an NPE
+ if (entityhuman1 == null || entityhuman1.dead) {
+ continue;
+ }
+ // CraftBukkit end
if (!entityhuman1.abilities.isInvulnerable) {
double d5 = entityhuman1.e(d0, d1, d2);
@@ -2713,24 +2433,12 @@ public class World implements IBlockAccess {
return null;
}
- public void m() {
+ public void B() throws ExceptionWorldConflict { // CraftBukkit - added throws
this.dataManager.checkSession();
}
public void setTime(long i) {
- this.worldData.a(i);
- }
-
- public void setTimeAndFixTicklists(long i) {
- long j = i - this.worldData.getTime();
-
- NextTickListEntry nextticklistentry;
-
- for (Iterator iterator = this.I.iterator(); iterator.hasNext(); nextticklistentry.e += j) {
- nextticklistentry = (NextTickListEntry) iterator.next();
- }
-
- this.setTime(i);
+ this.worldData.b(i);
}
public long getSeed() {
@@ -2751,15 +2459,13 @@ public class World implements IBlockAccess {
public void broadcastEntityEffect(Entity entity, byte b0) {}
- public IChunkProvider q() {
+ public IChunkProvider F() {
return this.chunkProvider;
}
- public void playNote(int i, int j, int k, int l, int i1) {
- int j1 = this.getTypeId(i, j, k);
-
- if (j1 > 0) {
- Block.byId[j1].a(this, i, j, k, l, i1);
+ public void playNote(int i, int j, int k, int l, int i1, int j1) {
+ if (l > 0) {
+ Block.byId[l].b(this, i, j, k, i1, j1);
}
}
@@ -2771,22 +2477,9 @@ public class World implements IBlockAccess {
return this.worldData;
}
- public void everyoneSleeping() {
- this.N = !this.players.isEmpty();
- Iterator iterator = this.players.iterator();
-
- while (iterator.hasNext()) {
- EntityHuman entityhuman = (EntityHuman) iterator.next();
+ public void everyoneSleeping() {}
- // CraftBukkit
- if (!entityhuman.isSleeping() && !entityhuman.fauxSleeping) {
- this.N = false;
- break;
- }
- }
- }
-
- // CraftBukkit start
+ // CraftBukkit start
// Calls the method that checks to see if players are sleeping
// Called by CraftPlayer.setPermanentSleeping()
public void checkSleepStatus() {
@@ -2796,72 +2489,28 @@ public class World implements IBlockAccess {
}
// CraftBukkit end
- protected void u() {
- this.N = false;
- Iterator iterator = this.players.iterator();
-
- while (iterator.hasNext()) {
- EntityHuman entityhuman = (EntityHuman) iterator.next();
-
- if (entityhuman.isSleeping()) {
- entityhuman.a(false, false, true);
- }
- }
-
- this.C();
- }
-
- public boolean everyoneDeeplySleeping() {
- if (this.N && !this.isStatic) {
- Iterator iterator = this.players.iterator();
-
- // CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers
- boolean foundActualSleepers = false;
-
- EntityHuman entityhuman;
-
- do {
- if (!iterator.hasNext()) {
- // CraftBukkit
- return foundActualSleepers;
- }
-
- entityhuman = (EntityHuman) iterator.next();
- // CraftBukkit start
- if (entityhuman.isDeeplySleeping()) {
- foundActualSleepers = true;
- }
- } while (entityhuman.isDeeplySleeping() || entityhuman.fauxSleeping);
- // CraftBukkit end
-
- return false;
- } else {
- return false;
- }
- }
-
- public float c(float f) {
- return (this.k + (this.l - this.k) * f) * this.d(f);
+ public float i(float f) {
+ return (this.p + (this.q - this.p) * f) * this.j(f);
}
- public float d(float f) {
- return this.i + (this.j - this.i) * f;
+ public float j(float f) {
+ return this.n + (this.o - this.n) * f;
}
- public boolean w() {
- return (double) this.c(1.0F) > 0.9D;
+ public boolean I() {
+ return (double) this.i(1.0F) > 0.9D;
}
- public boolean x() {
- return (double) this.d(1.0F) > 0.2D;
+ public boolean J() {
+ return (double) this.j(1.0F) > 0.2D;
}
- public boolean y(int i, int j, int k) {
- if (!this.x()) {
+ public boolean B(int i, int j, int k) {
+ if (!this.J()) {
return false;
- } else if (!this.isChunkLoaded(i, j, k)) {
+ } else if (!this.j(i, j, k)) {
return false;
- } else if (this.f(i, k) > j) {
+ } else if (this.g(i, k) > j) {
return false;
} else {
BiomeBase biomebase = this.getBiome(i, k);
@@ -2870,7 +2519,7 @@ public class World implements IBlockAccess {
}
}
- public boolean z(int i, int j, int k) {
+ public boolean C(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
return biomebase.e();
@@ -2893,8 +2542,8 @@ public class World implements IBlockAccess {
}
public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) {
- for (int j1 = 0; j1 < this.u.size(); ++j1) {
- ((IWorldAccess) this.u.get(j1)).a(entityhuman, i, j, k, l, i1);
+ for (int j1 = 0; j1 < this.x.size(); ++j1) {
+ ((IWorldAccess) this.x.get(j1)).a(entityhuman, i, j, k, l, i1);
}
}
@@ -2902,7 +2551,11 @@ public class World implements IBlockAccess {
return 256;
}
- public Random A(int i, int j, int k) {
+ public int L() {
+ return this.worldProvider.e ? 128 : 256;
+ }
+
+ public Random D(int i, int j, int k) {
long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k;
this.random.setSeed(l);
@@ -2913,19 +2566,24 @@ public class World implements IBlockAccess {
return false;
}
- public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
- List list = this.q().getMobsFor(enumcreaturetype, i, j, k);
-
- return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null;
+ public ChunkPosition b(String s, int i, int j, int k) {
+ return this.F().findNearestMapFeature(this, s, i, j, k);
}
- public ChunkPosition b(String s, int i, int j, int k) {
- return this.q().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;
}
- // CraftBukkit start
- public java.util.UUID getUUID() {
- return this.dataManager.getUUID();
+ public void f(int i, int j, int k, int l, int i1) {
+ Iterator iterator = this.x.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.a(i, j, k, l, i1);
+ }
}
- // CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java
deleted file mode 100644
index 6cdb5722..00000000
--- a/src/main/java/net/minecraft/server/WorldData.java
+++ /dev/null
@@ -1,259 +0,0 @@
-package net.minecraft.server;
-
-import java.util.List;
-
-public class WorldData {
-
- private long seed;
- private WorldType type;
- private int spawnX;
- private int spawnY;
- private int spawnZ;
- private long time;
- private long lastPlayed;
- private long sizeOnDisk;
- private NBTTagCompound playerData;
- private int dimension;
- public String name; // CraftBukkit - private -> public
- private int version;
- private boolean isRaining;
- private int rainTicks;
- private boolean isThundering;
- private int thunderTicks;
- private int gameType;
- private boolean useMapFeatures;
- private boolean hardcore;
-
- public WorldData(NBTTagCompound nbttagcompound) {
- this.type = WorldType.NORMAL;
- this.hardcore = false;
- this.seed = nbttagcompound.getLong("RandomSeed");
- if (nbttagcompound.hasKey("generatorName")) {
- String s = nbttagcompound.getString("generatorName");
-
- this.type = WorldType.getType(s);
- if (this.type == null) {
- this.type = WorldType.NORMAL;
- } else if (this.type.c()) {
- int i = 0;
-
- if (nbttagcompound.hasKey("generatorVersion")) {
- i = nbttagcompound.getInt("generatorVersion");
- }
-
- this.type = this.type.a(i);
- }
- }
-
- this.gameType = nbttagcompound.getInt("GameType");
- if (nbttagcompound.hasKey("MapFeatures")) {
- this.useMapFeatures = nbttagcompound.getBoolean("MapFeatures");
- } else {
- this.useMapFeatures = true;
- }
-
- this.spawnX = nbttagcompound.getInt("SpawnX");
- this.spawnY = nbttagcompound.getInt("SpawnY");
- this.spawnZ = nbttagcompound.getInt("SpawnZ");
- this.time = nbttagcompound.getLong("Time");
- this.lastPlayed = nbttagcompound.getLong("LastPlayed");
- this.sizeOnDisk = nbttagcompound.getLong("SizeOnDisk");
- this.name = nbttagcompound.getString("LevelName");
- this.version = nbttagcompound.getInt("version");
- this.rainTicks = nbttagcompound.getInt("rainTime");
- this.isRaining = nbttagcompound.getBoolean("raining");
- this.thunderTicks = nbttagcompound.getInt("thunderTime");
- this.isThundering = nbttagcompound.getBoolean("thundering");
- this.hardcore = nbttagcompound.getBoolean("hardcore");
- if (nbttagcompound.hasKey("Player")) {
- this.playerData = nbttagcompound.getCompound("Player");
- this.dimension = this.playerData.getInt("Dimension");
- }
- }
-
- public WorldData(WorldSettings worldsettings, String s) {
- this.type = WorldType.NORMAL;
- this.hardcore = false;
- this.seed = worldsettings.a();
- this.gameType = worldsettings.b();
- this.useMapFeatures = worldsettings.d();
- this.name = s;
- this.hardcore = worldsettings.c();
- this.type = worldsettings.e();
- }
-
- public WorldData(WorldData worlddata) {
- this.type = WorldType.NORMAL;
- this.hardcore = false;
- this.seed = worlddata.seed;
- this.type = worlddata.type;
- this.gameType = worlddata.gameType;
- this.useMapFeatures = worlddata.useMapFeatures;
- this.spawnX = worlddata.spawnX;
- this.spawnY = worlddata.spawnY;
- this.spawnZ = worlddata.spawnZ;
- this.time = worlddata.time;
- this.lastPlayed = worlddata.lastPlayed;
- this.sizeOnDisk = worlddata.sizeOnDisk;
- this.playerData = worlddata.playerData;
- this.dimension = worlddata.dimension;
- this.name = worlddata.name;
- this.version = worlddata.version;
- this.rainTicks = worlddata.rainTicks;
- this.isRaining = worlddata.isRaining;
- this.thunderTicks = worlddata.thunderTicks;
- this.isThundering = worlddata.isThundering;
- this.hardcore = worlddata.hardcore;
- }
-
- public NBTTagCompound a() {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
-
- this.a(nbttagcompound, this.playerData);
- return nbttagcompound;
- }
-
- public NBTTagCompound a(List list) {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- EntityHuman entityhuman = null;
- NBTTagCompound nbttagcompound1 = null;
-
- if (list.size() > 0) {
- entityhuman = (EntityHuman) list.get(0);
- }
-
- if (entityhuman != null) {
- nbttagcompound1 = new NBTTagCompound();
- entityhuman.d(nbttagcompound1);
- }
-
- this.a(nbttagcompound, nbttagcompound1);
- return nbttagcompound;
- }
-
- private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
- nbttagcompound.setLong("RandomSeed", this.seed);
- nbttagcompound.setString("generatorName", this.type.name());
- nbttagcompound.setInt("generatorVersion", this.type.getVersion());
- nbttagcompound.setInt("GameType", this.gameType);
- nbttagcompound.setBoolean("MapFeatures", this.useMapFeatures);
- nbttagcompound.setInt("SpawnX", this.spawnX);
- nbttagcompound.setInt("SpawnY", this.spawnY);
- nbttagcompound.setInt("SpawnZ", this.spawnZ);
- nbttagcompound.setLong("Time", this.time);
- nbttagcompound.setLong("SizeOnDisk", this.sizeOnDisk);
- nbttagcompound.setLong("LastPlayed", System.currentTimeMillis());
- nbttagcompound.setString("LevelName", this.name);
- nbttagcompound.setInt("version", this.version);
- nbttagcompound.setInt("rainTime", this.rainTicks);
- nbttagcompound.setBoolean("raining", this.isRaining);
- nbttagcompound.setInt("thunderTime", this.thunderTicks);
- nbttagcompound.setBoolean("thundering", this.isThundering);
- nbttagcompound.setBoolean("hardcore", this.hardcore);
- if (nbttagcompound1 != null) {
- nbttagcompound.setCompound("Player", nbttagcompound1);
- }
- }
-
- public long getSeed() {
- return this.seed;
- }
-
- public int c() {
- return this.spawnX;
- }
-
- public int d() {
- return this.spawnY;
- }
-
- public int e() {
- return this.spawnZ;
- }
-
- public long getTime() {
- return this.time;
- }
-
- public int g() {
- return this.dimension;
- }
-
- public void a(long i) {
- this.time = i;
- }
-
- public void setSpawn(int i, int j, int k) {
- this.spawnX = i;
- this.spawnY = j;
- this.spawnZ = k;
- }
-
- public void a(String s) {
- this.name = s;
- }
-
- public int h() {
- return this.version;
- }
-
- public void a(int i) {
- this.version = i;
- }
-
- public boolean isThundering() {
- return this.isThundering;
- }
-
- public void setThundering(boolean flag) {
- this.isThundering = flag;
- }
-
- public int getThunderDuration() {
- return this.thunderTicks;
- }
-
- public void setThunderDuration(int i) {
- this.thunderTicks = i;
- }
-
- public boolean hasStorm() {
- return this.isRaining;
- }
-
- public void setStorm(boolean flag) {
- this.isRaining = flag;
- }
-
- public int getWeatherDuration() {
- return this.rainTicks;
- }
-
- public void setWeatherDuration(int i) {
- this.rainTicks = i;
- }
-
- public int getGameType() {
- return this.gameType;
- }
-
- public boolean shouldGenerateMapFeatures() {
- return this.useMapFeatures;
- }
-
- public void setGameType(int i) {
- this.gameType = i;
- }
-
- public boolean isHardcore() {
- return this.hardcore;
- }
-
- public WorldType getType() {
- return this.type;
- }
-
- public void setType(WorldType worldtype) {
- this.type = worldtype;
- }
-}
diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java
index 5d8a8cd6..f5117f18 100644
--- a/src/main/java/net/minecraft/server/WorldGenBigTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java
@@ -110,9 +110,9 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
k1 = -i1;
while (k1 <= i1) {
- double d0 = Math.sqrt(Math.pow((double) Math.abs(j1) + 0.5D, 2.0D) + Math.pow((double) Math.abs(k1) + 0.5D, 2.0D));
+ double d0 = Math.pow((double) Math.abs(j1) + 0.5D, 2.0D) + Math.pow((double) Math.abs(k1) + 0.5D, 2.0D);
- if (d0 > (double) f) {
+ if (d0 > (double) (f * f)) {
++k1;
} else {
aint1[b2] = aint[b2] + k1;
@@ -337,7 +337,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
+ // CraftBukkit start - moved to generate
// sk: The idea is to have (our) WorldServer implement
// BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
diff --git a/src/main/java/net/minecraft/server/WorldGenForest.java b/src/main/java/net/minecraft/server/WorldGenForest.java
index b8cc6adf..c1c3f0bc 100644
--- a/src/main/java/net/minecraft/server/WorldGenForest.java
+++ b/src/main/java/net/minecraft/server/WorldGenForest.java
@@ -11,11 +11,7 @@ public class WorldGenForest extends WorldGenerator implements BlockSapling.TreeG
}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
- // sk: The idea is to have (our) WorldServer implement
- // BlockChangeDelegate and then we can implicitly cast World to
- // WorldServer (a safe cast, AFAIK) and no code will be broken. This
- // then allows plugins to catch manually-invoked generation events
+ // CraftBukkit start - moved to generate
return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
index b8b55608..88555fb6 100644
--- a/src/main/java/net/minecraft/server/WorldGenGroundBush.java
+++ b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
@@ -4,7 +4,7 @@ import java.util.Random;
import org.bukkit.BlockChangeDelegate; // CraftBukkit
-public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
+public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
private int a;
private int b;
@@ -15,7 +15,7 @@ public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.T
}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
+ // CraftBukkit start - moved to generate
return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
diff --git a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
index bf409754..2d4fd608 100644
--- a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
+++ b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.util.Random;
+
// CraftBukkit start
import org.bukkit.BlockChangeDelegate;
import org.bukkit.block.BlockState;
@@ -20,8 +21,8 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
super(false);
}
- // CraftBukkit start - delegate to generate() and use BlockChangeDelegate
public boolean a(World world, Random random, int i, int j, int k) {
+ // CraftBukkit start - moved to generate
return grow((BlockChangeDelegate) world, random, i, j, k, null, null, null);
}
@@ -49,7 +50,7 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
for (j1 = j; j1 <= j + 1 + i1; ++j1) {
byte b0 = 3;
- if (j1 == j) {
+ if (j1 <= j + 3) {
b0 = 0;
}
@@ -73,9 +74,6 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
j1 = world.getTypeId(i, j - 1, k);
if (j1 != Block.DIRT.id && j1 != Block.GRASS.id && j1 != Block.MYCEL.id) {
return false;
- // CraftBukkit - Adjust canPlace check to handle non-World BlockChangeDelegates (orig check was: !Block.BROWN_MUSHROOM.canPlace(world, i, j, k))
- } else if ((world.getTypeId(i, j, k) != 0 && !Block.byId[world.getTypeId(i, j, k)].material.isReplacable()) || (world instanceof World && !Block.BROWN_MUSHROOM.canPlace((World) world, i, j, k))) {
- return false;
} else {
// CraftBukkit start
if (event == null) {
diff --git a/src/main/java/net/minecraft/server/WorldGenMegaTree.java b/src/main/java/net/minecraft/server/WorldGenMegaTree.java
index 736e63b3..bccccbed 100644
--- a/src/main/java/net/minecraft/server/WorldGenMegaTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenMegaTree.java
@@ -18,7 +18,7 @@ public class WorldGenMegaTree extends WorldGenerator implements BlockSapling.Tre
}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
+ // CraftBukkit start - moved to generate
return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
diff --git a/src/main/java/net/minecraft/server/WorldGenSwampTree.java b/src/main/java/net/minecraft/server/WorldGenSwampTree.java
index cea5cb8c..904a3ade 100644
--- a/src/main/java/net/minecraft/server/WorldGenSwampTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenSwampTree.java
@@ -4,20 +4,20 @@ import java.util.Random;
import org.bukkit.BlockChangeDelegate; // CraftBukkit
-public class WorldGenSwampTree extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
+public class WorldGenSwampTree extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
public WorldGenSwampTree() {}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
- return generate((BlockChangeDelegate) world, random, i, j, k);
+ // CraftBukkit start - moved to generate
+ return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
int l;
- for (l = random.nextInt(4) + 5; world.getTypeId(i, j - 1, k) != 0 && Block.byId[world.getTypeId(i, j - 1, k)].material == Material.WATER; --j) { // CraftBukkit - bypass World.getMaterial
+ for (l = random.nextInt(4) + 5; world.getTypeId(i, j - 1, k) != 0 && Block.byId[world.getTypeId(i, j - 1, k)].material == Material.WATER; --j) { // CraftBukkit - bypass world.getMaterial
;
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga1.java b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
index b8327f0e..ddf0c1e1 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga1.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
@@ -9,11 +9,7 @@ public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeG
public WorldGenTaiga1() {}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
- // sk: The idea is to have (our) WorldServer implement
- // BlockChangeDelegate and then we can implicitly cast World to
- // WorldServer (a safe cast, AFAIK) and no code will be broken. This
- // then allows plugins to catch manually-invoked generation events
+ // CraftBukkit start - moved to generate
return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
index c4b6ba1d..3a37ce2a 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
@@ -11,11 +11,7 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG
}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
- // sk: The idea is to have (our) WorldServer implement
- // BlockChangeDelegate and then we can implicitly cast World to
- // WorldServer (a safe cast, AFAIK) and no code will be broken. This
- // then allows plugins to catch manually-invoked generation events
+ // CraftBukkit start - moved to generate
return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java
index 518ed0dc..71f3fed0 100644
--- a/src/main/java/net/minecraft/server/WorldGenTrees.java
+++ b/src/main/java/net/minecraft/server/WorldGenTrees.java
@@ -24,11 +24,7 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe
}
public boolean a(World world, Random random, int i, int j, int k) {
- // CraftBukkit start
- // sk: The idea is to have (our) WorldServer implement
- // BlockChangeDelegate and then we can implicitly cast World to
- // WorldServer (a safe cast, AFAIK) and no code will be broken. This
- // then allows plugins to catch manually-invoked generation events
+ // CraftBukkit start - moved to generate
return this.generate((BlockChangeDelegate) world, random, i, j, k);
}
@@ -148,6 +144,17 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe
}
}
}
+
+ if (random.nextInt(5) == 0 && l > 5) {
+ for (j1 = 0; j1 < 2; ++j1) {
+ for (k1 = 0; k1 < 4; ++k1) {
+ if (random.nextInt(4 - j1) == 0) {
+ i2 = random.nextInt(3);
+ this.setTypeAndData(world, i + Direction.a[Direction.e[k1]], j + l - 5 + j1, k + Direction.b[Direction.e[k1]], Block.COCOA.id, i2 << 2 | k1);
+ }
+ }
+ }
+ }
}
return true;
diff --git a/src/main/java/net/minecraft/server/WorldGenerator.java b/src/main/java/net/minecraft/server/WorldGenerator.java
index e9e30665..88e29c77 100644
--- a/src/main/java/net/minecraft/server/WorldGenerator.java
+++ b/src/main/java/net/minecraft/server/WorldGenerator.java
@@ -29,10 +29,6 @@ public abstract class WorldGenerator {
protected void setTypeAndData(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
if (this.a) {
world.setTypeIdAndData(i, j, k, l, i1);
- } else if (world instanceof World && ((World)world).getChunkAtWorldCoords(i, k).seenByPlayer) { // CraftBukkit
- if (world.setRawTypeIdAndData(i, j, k, l, i1)) {
- ((World)world).notify(i, j, k); // CraftBukkit - casty
- }
} else {
world.setRawTypeIdAndData(i, j, k, l, i1);
}
diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java
index 98ea4b39..e70e5abb 100644
--- a/src/main/java/net/minecraft/server/WorldManager.java
+++ b/src/main/java/net/minecraft/server/WorldManager.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Iterator;
+
public class WorldManager implements IWorldAccess {
private MinecraftServer server;
@@ -13,30 +15,48 @@ public class WorldManager implements IWorldAccess {
public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) {}
public void a(Entity entity) {
- this.server.getTracker(this.world.dimension).track(entity); // CraftBukkit
+ this.world.getTracker().track(entity);
}
public void b(Entity entity) {
- this.server.getTracker(this.world.dimension).untrackEntity(entity); // CraftBukkit
+ this.world.getTracker().untrackEntity(entity);
}
- public void a(String s, double d0, double d1, double d2, float f, float f1) {}
+ public void a(String s, double d0, double d1, double d2, float f, float f1) {
+ // CraftBukkit - this.world.dimension
+ 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(int i, int j, int k, int l, int i1, int j1) {}
public void a(int i, int j, int k) {
- this.server.serverConfigurationManager.flagDirty(i, j, k, this.world.dimension); // CraftBukkit
+ this.world.getPlayerManager().flagDirty(i, j, k);
}
public void b(int i, int j, int k) {}
public void a(String s, int i, int j, int k) {}
- public void a(int i, int j, int k, TileEntity tileentity) {
- this.server.serverConfigurationManager.a(i, j, k, tileentity);
+ public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) {
+ // CraftBukkit - this.world.dimension
+ this.server.getServerConfigurationManager().sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new Packet61WorldEvent(i, j, k, l, i1));
}
- public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) {
- this.server.serverConfigurationManager.sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new Packet61WorldEvent(i, j, k, l, i1)); // CraftBukkit
+ public void a(int i, int j, int k, int l, int i1) {
+ Iterator iterator = this.server.getServerConfigurationManager().players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+
+ if (entityplayer != null && entityplayer.world == this.world && entityplayer.id != i) {
+ double d0 = (double) j - entityplayer.locX;
+ double d1 = (double) k - entityplayer.locY;
+ double d2 = (double) l - entityplayer.locZ;
+
+ if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
+ entityplayer.netServerHandler.sendPacket(new Packet55BlockBreakAnimation(i, j, k, l, i1));
+ }
+ }
+ }
}
}
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index e4243464..c6aa7d95 100644
--- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -20,8 +20,8 @@ public class WorldMap extends WorldMapBase {
public byte map;
public byte scale;
public byte[] colors = new byte[16384];
- public int g;
- public List h = new ArrayList();
+ public int f;
+ public List g = new ArrayList();
private Map j = new HashMap();
public List decorations = new ArrayList();
@@ -137,13 +137,13 @@ public class WorldMap extends WorldMapBase {
WorldMapHumanTracker worldmaphumantracker = new WorldMapHumanTracker(this, entityhuman);
this.j.put(entityhuman, worldmaphumantracker);
- this.h.add(worldmaphumantracker);
+ this.g.add(worldmaphumantracker);
}
this.decorations.clear();
- for (int i = 0; i < this.h.size(); ++i) {
- WorldMapHumanTracker worldmaphumantracker1 = (WorldMapHumanTracker) this.h.get(i);
+ for (int i = 0; i < this.g.size(); ++i) {
+ WorldMapHumanTracker worldmaphumantracker1 = (WorldMapHumanTracker) this.g.get(i);
if (!worldmaphumantracker1.trackee.dead && worldmaphumantracker1.trackee.inventory.c(itemstack)) {
float f = (float) (worldmaphumantracker1.trackee.locX - (double) this.centerX) / (float) (1 << this.scale);
@@ -155,11 +155,10 @@ public class WorldMap extends WorldMapBase {
byte b2 = 0;
byte b3 = (byte) ((int) ((double) (f * 2.0F) + 0.5D));
byte b4 = (byte) ((int) ((double) (f1 * 2.0F) + 0.5D));
- // CraftBukkit
- byte b5 = (byte) ((int) ((double) (worldmaphumantracker1.trackee.yaw * 16.0F / 360.0F) + 0.5D));
+ byte b5 = (byte) ((int) ((double) worldmaphumantracker1.trackee.yaw * 16.0D / 360.0D));
if (this.map < 0) {
- int j = this.g / 10;
+ int j = this.f / 10;
b5 = (byte) (j * j * 34187121 + j * 121 >> 15 & 15);
}
@@ -170,7 +169,7 @@ public class WorldMap extends WorldMapBase {
}
} else {
this.j.remove(worldmaphumantracker1.trackee);
- this.h.remove(worldmaphumantracker1);
+ this.g.remove(worldmaphumantracker1);
}
}
}
@@ -178,20 +177,14 @@ public class WorldMap extends WorldMapBase {
public byte[] getUpdatePacket(ItemStack itemstack, World world, EntityHuman entityhuman) {
WorldMapHumanTracker worldmaphumantracker = (WorldMapHumanTracker) this.j.get(entityhuman);
- if (worldmaphumantracker == null) {
- return null;
- } else {
- byte[] abyte = worldmaphumantracker.a(itemstack);
-
- return abyte;
- }
+ return worldmaphumantracker == null ? null : worldmaphumantracker.a(itemstack);
}
public void flagDirty(int i, int j, int k) {
super.a();
- for (int l = 0; l < this.h.size(); ++l) {
- WorldMapHumanTracker worldmaphumantracker = (WorldMapHumanTracker) this.h.get(l);
+ for (int l = 0; l < this.g.size(); ++l) {
+ WorldMapHumanTracker worldmaphumantracker = (WorldMapHumanTracker) this.g.get(l);
if (worldmaphumantracker.b[i] < 0 || worldmaphumantracker.b[i] > j) {
worldmaphumantracker.b[i] = j;
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index 78f644f9..ddd979cc 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -8,7 +8,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.List;
import java.util.logging.Logger;
// CraftBukkit start
@@ -17,7 +16,7 @@ import java.util.UUID;
import org.bukkit.craftbukkit.entity.CraftPlayer;
// CraftBukkit end
-public class WorldNBTStorage implements PlayerFileData, IDataManager {
+public class WorldNBTStorage implements IDataManager, PlayerFileData {
private static final Logger log = Logger.getLogger("Minecraft");
private final File baseDir;
@@ -38,10 +37,10 @@ public class WorldNBTStorage implements PlayerFileData, IDataManager {
this.playerDir.mkdirs();
}
- this.f();
+ this.h();
}
- private void f() {
+ private void h() {
try {
File file1 = new File(this.baseDir, "session.lock");
DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1));
@@ -57,24 +56,24 @@ public class WorldNBTStorage implements PlayerFileData, IDataManager {
}
}
- public File getDirectory() { // CraftBukkit - prot to public.
+ public File getDirectory() { // CraftBukkit - protected to public
return this.baseDir;
}
- public void checkSession() {
+ public void checkSession() throws ExceptionWorldConflict { // CraftBukkit - throws ExceptionWorldConflict
try {
File file1 = new File(this.baseDir, "session.lock");
DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));
try {
if (datainputstream.readLong() != this.sessionId) {
- throw new WorldConlictException("The save is being accessed from another location, aborting");
+ throw new ExceptionWorldConflict("The save is being accessed from another location, aborting");
}
} finally {
datainputstream.close();
}
} catch (IOException ioexception) {
- throw new WorldConlictException("Failed to check session lock, aborting");
+ throw new ExceptionWorldConflict("Failed to check session lock, aborting");
}
}
@@ -111,18 +110,18 @@ public class WorldNBTStorage implements PlayerFileData, IDataManager {
return null;
}
- public void saveWorldData(WorldData worlddata, List list) {
- NBTTagCompound nbttagcompound = worlddata.a(list);
- NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+ public void saveWorldData(WorldData worlddata, NBTTagCompound nbttagcompound) {
+ NBTTagCompound nbttagcompound1 = worlddata.a(nbttagcompound);
+ NBTTagCompound nbttagcompound2 = new NBTTagCompound();
- nbttagcompound1.set("Data", nbttagcompound);
+ nbttagcompound2.set("Data", nbttagcompound1);
try {
File file1 = new File(this.baseDir, "level.dat_new");
File file2 = new File(this.baseDir, "level.dat_old");
File file3 = new File(this.baseDir, "level.dat");
- NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) (new FileOutputStream(file1)));
+ NBTCompressedStreamTools.a(nbttagcompound2, (OutputStream) (new FileOutputStream(file1)));
if (file2.exists()) {
file2.delete();
}
@@ -176,7 +175,7 @@ public class WorldNBTStorage implements PlayerFileData, IDataManager {
NBTTagCompound nbttagcompound = new NBTTagCompound();
entityhuman.d(nbttagcompound);
- File file1 = new File(this.playerDir, entityhuman.name + ".dat~"); // CraftBukkit - don't save every player to the same file
+ File file1 = new File(this.playerDir, entityhuman.name + ".dat.tmp");
File file2 = new File(this.playerDir, entityhuman.name + ".dat");
NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file1)));
@@ -223,15 +222,27 @@ public class WorldNBTStorage implements PlayerFileData, IDataManager {
}
public String[] getSeenPlayers() {
- return this.playerDir.list();
+ String[] astring = this.playerDir.list();
+
+ for (int i = 0; i < astring.length; ++i) {
+ if (astring[i].endsWith(".dat")) {
+ astring[i] = astring[i].substring(0, astring[i].length() - 4);
+ }
+ }
+
+ return astring;
}
- public void e() {}
+ public void a() {}
public File getDataFile(String s) {
return new File(this.dataDir, s + ".dat");
}
+ public String g() {
+ return this.f;
+ }
+
// CraftBukkit start
public UUID getUUID() {
if (uuid != null) return uuid;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index a9344efd..ab986043 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1,33 +1,65 @@
package net.minecraft.server;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeSet;
// CraftBukkit start
+import org.bukkit.block.BlockState;
+import org.bukkit.craftbukkit.util.LongHash;
+
+import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.weather.LightningStrikeEvent;
+import org.bukkit.event.weather.ThunderChangeEvent;
+import org.bukkit.event.weather.WeatherChangeEvent;
public class WorldServer extends World implements org.bukkit.BlockChangeDelegate {
// CraftBukkit end
+ private final MinecraftServer server;
+ public EntityTracker tracker; // CraftBukkit - private final -> public
+ private final PlayerManager manager;
+ private Set N;
+ private TreeSet O;
public ChunkProviderServer chunkProviderServer;
public boolean weirdIsOpCache = false;
public boolean savingDisabled;
- public final MinecraftServer server; // CraftBukkit - private -> public final
+ private boolean P;
+ 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 IntHashMap entitiesById;
- // CraftBukkit start - change signature
- public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(idatamanager, s, worldsettings, WorldProvider.byDimension(env.getId()), gen, env);
+ // CraftBukkit start
+ public final int dimension;
+
+ public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+ super(idatamanager, s, worldsettings, WorldProvider.byDimension(i), methodprofiler, gen, env);
+ this.dimension = i;
+ this.pvpMode = minecraftserver.getPvP();
+ // CraftBukkit end
this.server = minecraftserver;
+ this.tracker = new EntityTracker(this);
+ this.manager = new PlayerManager(this, minecraftserver.getServerConfigurationManager().o());
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
- this.dimension = i;
- this.pvpMode = minecraftserver.pvpMode;
- this.manager = new PlayerManager(minecraftserver, this.dimension, minecraftserver.propertyManager.getInt("view-distance", 10));
+ if (this.N == null) {
+ this.N = new HashSet();
+ }
+
+ if (this.O == null) {
+ this.O = new TreeSet();
+ }
}
+ // CraftBukkit start
@Override
public TileEntity getTileEntity(int i, int j, int k) {
TileEntity result = super.getTileEntity(i, j, k);
@@ -61,6 +93,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
if (!(result instanceof TileEntitySign)) {
result = fixTileEntity(i, j, k, type, result);
}
+ } else if (type == Block.ENDER_CHEST.id) {
+ if (!(result instanceof TileEntityEnderChest)) {
+ result = fixTileEntity(i, j, k, type, result);
+ }
}
return result;
@@ -71,7 +107,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
+ "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.");
if (Block.byId[type] instanceof BlockContainer) {
- TileEntity replacement = ((BlockContainer) Block.byId[type]).a_();
+ TileEntity replacement = ((BlockContainer) Block.byId[type]).a(this);
setTileEntity(x, y, z, replacement);
return replacement;
} else {
@@ -80,22 +116,385 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- public final int dimension;
- public EntityTracker tracker;
- public PlayerManager manager;
+ private boolean canSpawn(int x, int z) {
+ if (this.generator != null) {
+ return this.generator.canSpawn(this.getWorld(), x, z);
+ } else {
+ return this.worldProvider.canSpawn(x, z);
+ }
+ }
// CraftBukkit end
+ public void doTick() {
+ super.doTick();
+ if (this.getWorldData().isHardcore() && this.difficulty < 3) {
+ this.difficulty = 3;
+ }
+
+ this.worldProvider.c.b();
+ if (this.everyoneDeeplySleeping()) {
+ boolean flag = false;
+
+ if (this.allowMonsters && this.difficulty >= 1) {
+ ;
+ }
+
+ if (!flag) {
+ long i = this.worldData.getTime() + 24000L;
+
+ this.worldData.b(i - i % 24000L);
+ this.d();
+ }
+ }
+
+ // this.methodProfiler.a("mobSpawner"); // CraftBukkit - not in production code
+ // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
+ long time = this.worldData.getTime();
+ if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
+ SpawnerCreature.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L));
+ }
+ // CraftBukkit end
+ // this.methodProfiler.c("chunkSource"); // CraftBukkit - not in production code
+ this.chunkProvider.unloadChunks();
+ int j = this.a(1.0F);
+
+ if (j != this.k) {
+ this.k = j;
+ }
+
+ this.Q();
+ this.worldData.b(this.worldData.getTime() + 1L);
+ // this.methodProfiler.c("tickPending"); // CraftBukkit - not in production code
+ this.a(false);
+ // this.methodProfiler.c("tickTiles"); // CraftBukkit - not in production code
+ this.g();
+ // this.methodProfiler.c("chunkMap"); // CraftBukkit - not in production code
+ this.manager.flush();
+ // this.methodProfiler.c("village"); // CraftBukkit - not in production code
+ this.villages.tick();
+ this.siegeManager.a();
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ this.Q();
+ }
+
+ public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
+ List list = this.F().getMobsFor(enumcreaturetype, i, j, k);
+
+ return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null;
+ }
+
+ public void everyoneSleeping() {
+ this.P = !this.players.isEmpty();
+ Iterator iterator = this.players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ if (!entityhuman.isSleeping() && !entityhuman.fauxSleeping) { // CraftBukkit
+ this.P = false;
+ break;
+ }
+ }
+ }
+
+ protected void d() {
+ this.P = false;
+ Iterator iterator = this.players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ if (entityhuman.isSleeping()) {
+ entityhuman.a(false, false, true);
+ }
+ }
+
+ this.P();
+ }
+
+ private void P() {
+ // CraftBukkit start
+ WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
+ this.getServer().getPluginManager().callEvent(weather);
+
+ ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
+ this.getServer().getPluginManager().callEvent(thunder);
+ if (!weather.isCancelled()) {
+ this.worldData.setWeatherDuration(0);
+ this.worldData.setStorm(false);
+ }
+ if (!thunder.isCancelled()) {
+ this.worldData.setThunderDuration(0);
+ this.worldData.setThundering(false);
+ }
+ // CraftBukkit end
+ }
+
+ public boolean everyoneDeeplySleeping() {
+ if (this.P && !this.isStatic) {
+ Iterator iterator = this.players.iterator();
+
+ // CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers
+ boolean foundActualSleepers = false;
+
+ EntityHuman entityhuman;
+
+ do {
+ if (!iterator.hasNext()) {
+ return foundActualSleepers; // CraftBukkit
+ }
+
+ entityhuman = (EntityHuman) iterator.next();
+ // CraftBukkit start
+ if (entityhuman.isDeeplySleeping()) {
+ foundActualSleepers = true;
+ }
+ } while (entityhuman.isDeeplySleeping() || entityhuman.fauxSleeping);
+ // CraftBukkit end
+
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ protected void g() {
+ super.g();
+ int i = 0;
+ int j = 0;
+ // Iterator iterator = this.chunkTickList.iterator(); // CraftBukkit
+
+ // CraftBukkit start
+ for (long chunkCoord : this.chunkTickList.popAll()) {
+ int chunkX = LongHash.msw(chunkCoord);
+ int chunkZ = LongHash.lsw(chunkCoord);
+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
+ int k = chunkX * 16;
+ int l = chunkZ * 16;
+
+ // this.methodProfiler.a("getChunk"); // CraftBukkit - not in production code
+ Chunk chunk = this.getChunkAt(chunkX, chunkZ);
+ // CraftBukkit end
+
+ this.a(k, l, chunk);
+ // this.methodProfiler.c("tickChunk"); // CraftBukkit - not in production code
+ chunk.k();
+ // this.methodProfiler.c("thunder"); // CraftBukkit - not in production code
+ int i1;
+ int j1;
+ int k1;
+ int l1;
+
+ if (this.random.nextInt(100000) == 0 && this.J() && this.I()) {
+ this.l = this.l * 3 + 1013904223;
+ i1 = this.l >> 2;
+ j1 = k + (i1 & 15);
+ k1 = l + (i1 >> 8 & 15);
+ l1 = this.g(j1, k1);
+ if (this.B(j1, l1, k1)) {
+ this.strikeLightning(new EntityLightning(this, (double) j1, (double) l1, (double) k1));
+ this.r = 2;
+ }
+ }
+
+ // this.methodProfiler.c("iceandsnow"); // CraftBukkit - not in production code
+ int i2;
+
+ if (this.random.nextInt(16) == 0) {
+ this.l = this.l * 3 + 1013904223;
+ i1 = this.l >> 2;
+ j1 = i1 & 15;
+ k1 = i1 >> 8 & 15;
+ l1 = this.g(j1 + k, k1 + l);
+ if (this.v(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);
+
+ BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
+ this.getServer().getPluginManager().callEvent(iceBlockForm);
+ if (!iceBlockForm.isCancelled()) {
+ blockState.update(true);
+ }
+ // CraftBukkit end
+ }
+
+ if (this.J() && this.w(j1 + k, l1, k1 + l)) {
+ // CraftBukkit start
+ BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState();
+ blockState.setTypeId(Block.SNOW.id);
+
+ BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
+ this.getServer().getPluginManager().callEvent(snow);
+ if (!snow.isCancelled()) {
+ blockState.update(true);
+ }
+ // CraftBukkit end
+ }
+
+ if (this.J()) {
+ BiomeBase biomebase = this.getBiome(j1 + k, k1 + l);
+
+ if (biomebase.d()) {
+ i2 = this.getTypeId(j1 + k, l1 - 1, k1 + l);
+ if (i2 != 0) {
+ Block.byId[i2].f(this, j1 + k, l1 - 1, k1 + l);
+ }
+ }
+ }
+ }
+
+ // this.methodProfiler.c("tickTiles"); // CraftBukkit - not in production code
+ ChunkSection[] achunksection = chunk.i();
+
+ j1 = achunksection.length;
+
+ for (k1 = 0; k1 < j1; ++k1) {
+ ChunkSection chunksection = achunksection[k1];
+
+ if (chunksection != null && chunksection.b()) {
+ for (int j2 = 0; j2 < 3; ++j2) {
+ this.l = this.l * 3 + 1013904223;
+ i2 = this.l >> 2;
+ int k2 = i2 & 15;
+ int l2 = i2 >> 8 & 15;
+ int i3 = i2 >> 16 & 15;
+ int j3 = chunksection.a(k2, i3, l2);
+
+ ++j;
+ Block block = Block.byId[j3];
+
+ if (block != null && block.r()) {
+ ++i;
+ block.b(this, k2 + k, i3 + chunksection.d(), l2 + l, this.random);
+ }
+ }
+ }
+ }
+
+ // this.methodProfiler.b(); // CraftBukkit - not in production code
+ }
+ }
+
+ public void a(int i, int j, int k, int l, int i1) {
+ NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+ byte b0 = 8;
+
+ if (this.e) {
+ if (this.c(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
+ int j1 = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
+
+ if (j1 == nextticklistentry.d && j1 > 0) {
+ Block.byId[j1].b(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
+ }
+ }
+ } else {
+ if (this.c(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ if (l > 0) {
+ nextticklistentry.a((long) i1 + this.worldData.getTime());
+ }
+
+ if (!this.N.contains(nextticklistentry)) {
+ this.N.add(nextticklistentry);
+ this.O.add(nextticklistentry);
+ }
+ }
+ }
+ }
+
+ public void b(int i, int j, int k, int l, int i1) {
+ NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+
+ if (l > 0) {
+ nextticklistentry.a((long) i1 + this.worldData.getTime());
+ }
+
+ if (!this.N.contains(nextticklistentry)) {
+ this.N.add(nextticklistentry);
+ this.O.add(nextticklistentry);
+ }
+ }
+
+ public boolean a(boolean flag) {
+ int i = this.O.size();
+
+ if (i != this.N.size()) {
+ throw new IllegalStateException("TickNextTick list out of synch");
+ } else {
+ if (i > 1000) {
+ // CraftBukkit start - if the server has too much to process over time, try to alleviate that
+ if (i > 20 * 1000) {
+ i = i / 20;
+ } else {
+ i = 1000;
+ }
+ // CraftBukkit end
+ }
+
+ for (int j = 0; j < i; ++j) {
+ NextTickListEntry nextticklistentry = (NextTickListEntry) this.O.first();
+
+ if (!flag && nextticklistentry.e > this.worldData.getTime()) {
+ break;
+ }
+
+ this.O.remove(nextticklistentry);
+ this.N.remove(nextticklistentry);
+ byte b0 = 8;
+
+ if (this.c(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
+ 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);
+ }
+ }
+ }
+
+ return !this.O.isEmpty();
+ }
+ }
+
+ public List a(Chunk chunk, boolean flag) {
+ ArrayList arraylist = null;
+ ChunkCoordIntPair chunkcoordintpair = chunk.l();
+ int i = chunkcoordintpair.x << 4;
+ int j = i + 16;
+ int k = chunkcoordintpair.z << 4;
+ int l = k + 16;
+ Iterator iterator = this.O.iterator();
+
+ while (iterator.hasNext()) {
+ NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next();
+
+ if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) {
+ if (flag) {
+ this.N.remove(nextticklistentry);
+ iterator.remove();
+ }
+
+ if (arraylist == null) {
+ arraylist = new ArrayList();
+ }
+
+ arraylist.add(nextticklistentry);
+ }
+ }
+
+ return arraylist;
+ }
+
public void entityJoinedWorld(Entity entity, boolean flag) {
/* CraftBukkit start - We prevent spawning in general, so this butchering is not needed
- if (!this.server.spawnAnimals && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
+ if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
}
// CraftBukkit end */
- if (!this.server.spawnNPCs && entity instanceof NPC) {
+ if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
entity.die();
}
- if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
+ if (!(entity.passenger instanceof EntityHuman)) {
super.entityJoinedWorld(entity, flag);
}
}
@@ -104,7 +503,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
super.entityJoinedWorld(entity, flag);
}
- protected IChunkProvider b() {
+ protected IChunkProvider h() {
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
// CraftBukkit start
@@ -128,9 +527,10 @@ 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();
+ Iterator iterator = this.tileEntityList.iterator();
- for (int k1 = 0; k1 < this.tileEntityList.size(); ++k1) {
- TileEntity tileentity = (TileEntity) this.tileEntityList.get(k1);
+ while (iterator.hasNext()) {
+ TileEntity tileentity = (TileEntity) iterator.next();
if (tileentity.x >= i && tileentity.y >= j && tileentity.z >= k && tileentity.x < l && tileentity.y < i1 && tileentity.z < j1) {
arraylist.add(tileentity);
@@ -149,37 +549,152 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
// CraftBukkit - Configurable spawn protection
- return i1 > this.getServer().getSpawnRadius() || this.server.serverConfigurationManager.isOp(entityhuman.name);
+ return i1 > this.getServer().getSpawnRadius() || this.server.getServerConfigurationManager().isOp(entityhuman.name) || this.server.H();
}
- protected void c() {
+ protected void a(WorldSettings worldsettings) {
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
- super.c();
+ if (this.N == null) {
+ this.N = new HashSet();
+ }
+
+ if (this.O == null) {
+ this.O = new TreeSet();
+ }
+
+ this.b(worldsettings);
+ super.a(worldsettings);
+ }
+
+ protected void b(WorldSettings worldsettings) {
+ if (!this.worldProvider.e()) {
+ this.worldData.setSpawn(0, this.worldProvider.getSeaLevel(), 0);
+ } else {
+ this.isLoading = true;
+ WorldChunkManager worldchunkmanager = this.worldProvider.c;
+ List list = worldchunkmanager.a();
+ Random random = new Random(this.getSeed());
+ ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
+ int i = 0;
+ int j = this.worldProvider.getSeaLevel();
+ int k = 0;
+
+ // CraftBukkit start
+ if (this.generator != null) {
+ Random rand = new Random(this.getSeed());
+ org.bukkit.Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
+
+ if (spawn != null) {
+ if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
+ throw new IllegalStateException("Cannot set spawn point for " + this.worldData.getName() + " to be in another world (" + spawn.getWorld().getName() + ")");
+ } else {
+ this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
+ this.isLoading = false;
+ return;
+ }
+ }
+ }
+ // CraftBukkit end
+
+ if (chunkposition != null) {
+ i = chunkposition.x;
+ k = chunkposition.z;
+ } else {
+ System.out.println("Unable to find spawn biome");
+ }
+
+ int l = 0;
+
+ // CraftBukkit - use our own canSpawn
+ while (!this.canSpawn(i, k)) {
+ i += random.nextInt(64) - random.nextInt(64);
+ k += random.nextInt(64) - random.nextInt(64);
+ ++l;
+ if (l == 1000) {
+ break;
+ }
+ }
+
+ this.worldData.setSpawn(i, j, k);
+ this.isLoading = false;
+ if (worldsettings.c()) {
+ this.i();
+ }
+ }
+ }
+
+ protected void i() {
+ WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(S, 10);
+
+ for (int i = 0; i < 10; ++i) {
+ int j = this.worldData.c() + this.random.nextInt(6) - this.random.nextInt(6);
+ int k = this.worldData.e() + this.random.nextInt(6) - this.random.nextInt(6);
+ int l = this.h(j, k) + 1;
+
+ if (worldgenbonuschest.a(this, this.random, j, l, k)) {
+ break;
+ }
+ }
}
- protected void c(Entity entity) {
- super.c(entity);
+ public ChunkCoordinates getDimensionSpawn() {
+ return this.worldProvider.h();
+ }
+
+ public void save(boolean flag, IProgressUpdate iprogressupdate) throws ExceptionWorldConflict { // CraftBukkit - added throws
+ if (this.chunkProvider.canSave()) {
+ if (iprogressupdate != null) {
+ iprogressupdate.a("Saving level");
+ }
+
+ this.a();
+ if (iprogressupdate != null) {
+ iprogressupdate.c("Saving chunks");
+ }
+
+ this.chunkProvider.saveChunks(flag, iprogressupdate);
+ }
+ }
+
+ protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ this.B();
+ this.dataManager.saveWorldData(this.worldData, this.server.getServerConfigurationManager().q());
+ this.worldMaps.a();
+ }
+
+ protected void a(Entity entity) {
+ super.a(entity);
this.entitiesById.a(entity.id, entity);
- Entity[] aentity = entity.bb();
+ Entity[] aentity = entity.al();
if (aentity != null) {
- for (int i = 0; i < aentity.length; ++i) {
- this.entitiesById.a(aentity[i].id, aentity[i]);
+ Entity[] aentity1 = aentity;
+ int i = aentity.length;
+
+ for (int j = 0; j < i; ++j) {
+ Entity entity1 = aentity1[j];
+
+ this.entitiesById.a(entity1.id, entity1);
}
}
}
- protected void d(Entity entity) {
- super.d(entity);
+ protected void b(Entity entity) {
+ super.b(entity);
this.entitiesById.d(entity.id);
- Entity[] aentity = entity.bb();
+ Entity[] aentity = entity.al();
if (aentity != null) {
- for (int i = 0; i < aentity.length; ++i) {
- this.entitiesById.d(aentity[i].id);
+ Entity[] aentity1 = aentity;
+ int i = aentity.length;
+
+ for (int j = 0; j < i; ++j) {
+ Entity entity1 = aentity1[j];
+
+ this.entitiesById.d(entity1.id);
}
}
}
@@ -198,7 +713,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
if (super.strikeLightning(entity)) {
- this.server.serverConfigurationManager.sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new Packet71Weather(entity));
+ this.server.getServerConfigurationManager().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new Packet71Weather(entity));
// CraftBukkit end
return true;
} else {
@@ -209,8 +724,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public void broadcastEntityEffect(Entity entity, byte b0) {
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
- // CraftBukkit
- this.server.getTracker(this.dimension).sendPacketToEntity(entity, packet38entitystatus);
+ this.getTracker().sendPacketToEntity(entity, packet38entitystatus);
}
public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
@@ -226,26 +740,76 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
explosion.a();
explosion.a(false);
*/
- this.server.serverConfigurationManager.sendPacketNearby(d0, d1, d2, 64.0D, this.dimension, new Packet60Explosion(d0, d1, d2, f, explosion.blocks));
// CraftBukkit end
+ Iterator iterator = this.players.iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ if (entityhuman.e(d0, d1, d2) < 4096.0D) {
+ ((EntityPlayer) entityhuman).netServerHandler.sendPacket(new Packet60Explosion(d0, d1, d2, f, explosion.blocks, (Vec3D) explosion.b().get(entityhuman)));
+ }
+ }
+
return explosion;
}
- public void playNote(int i, int j, int k, int l, int i1) {
- super.playNote(i, j, k, l, i1);
- // CraftBukkit
- this.server.serverConfigurationManager.sendPacketNearby((double) i, (double) j, (double) k, 64.0D, this.dimension, new Packet54PlayNoteBlock(i, j, k, l, i1));
+ 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();
+
+ NoteBlockData noteblockdata1;
+
+ do {
+ if (!iterator.hasNext()) {
+ this.Q[this.R].add(noteblockdata);
+ return;
+ }
+
+ noteblockdata1 = (NoteBlockData) iterator.next();
+ } while (!noteblockdata1.equals(noteblockdata));
+
+ }
+
+ private void Q() {
+ while (!this.Q[this.R].isEmpty()) {
+ int i = this.R;
+
+ this.R ^= 1;
+ Iterator iterator = this.Q[i].iterator();
+
+ while (iterator.hasNext()) {
+ NoteBlockData noteblockdata = (NoteBlockData) iterator.next();
+
+ if (this.a(noteblockdata)) {
+ this.server.getServerConfigurationManager().sendPacketNearby((double) noteblockdata.a(), (double) noteblockdata.b(), (double) noteblockdata.c(), 64.0D, this.worldProvider.dimension, new Packet54PlayNoteBlock(noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.f(), noteblockdata.d(), noteblockdata.e()));
+ }
+ }
+
+ this.Q[i].clear();
+ }
+ }
+
+ private boolean a(NoteBlockData noteblockdata) {
+ int i = this.getTypeId(noteblockdata.a(), noteblockdata.b(), noteblockdata.c());
+
+ if (i == noteblockdata.f()) {
+ Block.byId[i].b(this, noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.d(), noteblockdata.e());
+ return true;
+ } else {
+ return false;
+ }
}
public void saveLevel() {
- this.dataManager.e();
+ this.dataManager.a();
}
- protected void i() {
- boolean flag = this.x();
+ protected void l() {
+ boolean flag = this.J();
- super.i();
- if (flag != this.x()) {
+ super.l();
+ if (flag != this.J()) {
// 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) {
@@ -255,4 +819,39 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
}
+
+ public MinecraftServer getMinecraftServer() {
+ return this.server;
+ }
+
+ public EntityTracker getTracker() {
+ return this.tracker;
+ }
+
+ public void setTimeAndFixTicklists(long i) {
+ long j = i - this.worldData.getTime();
+
+ NextTickListEntry nextticklistentry;
+
+ for (Iterator iterator = this.N.iterator(); iterator.hasNext(); nextticklistentry.e += j) {
+ nextticklistentry = (NextTickListEntry) iterator.next();
+ }
+
+ Block[] ablock = Block.byId;
+ int k = ablock.length;
+
+ for (int l = 0; l < k; ++l) {
+ Block block = ablock[l];
+
+ if (block != null) {
+ block.a(this, j, i);
+ }
+ }
+
+ this.setTime(i);
+ }
+
+ public PlayerManager getPlayerManager() {
+ return this.manager;
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java b/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java
index 4303c60b..cfd9715f 100644
--- a/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java
@@ -8,6 +8,7 @@ import java.util.zip.Deflater;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.Packet;
import net.minecraft.server.Packet51MapChunk;
+import net.minecraft.server.Packet56MapChunkBulk;
public final class ChunkCompressionThread implements Runnable {
@@ -46,29 +47,56 @@ public final class ChunkCompressionThread implements Runnable {
private void handleQueuedPacket(QueuedPacket queuedPacket) {
addToPlayerQueueSize(queuedPacket.player, -1);
- // Compress the packet if necessary.
- if (queuedPacket.compress) {
- handleMapChunk(queuedPacket);
+
+ // Compress the packet if necessary
+ if (queuedPacket.compress == 1) {
+ handleMapChunk((Packet51MapChunk) queuedPacket.packet);
+ } else if (queuedPacket.compress == 2) {
+ handleMapChunkBulk((Packet56MapChunkBulk) queuedPacket.packet);
}
+
sendToNetworkQueue(queuedPacket);
}
- private void handleMapChunk(QueuedPacket queuedPacket) {
- Packet51MapChunk packet = (Packet51MapChunk) queuedPacket.packet;
+ private void handleMapChunkBulk(Packet56MapChunkBulk packet) {
+ if (packet.buffer != null) {
+ return;
+ }
- // If 'packet.g' is set then this packet has already been compressed.
+ int dataSize = packet.buildBuffer.length;
+ if (deflateBuffer.length < dataSize + 100) {
+ deflateBuffer = new byte[dataSize + 100];
+ }
+
+ deflater.reset();
+ deflater.setLevel(dataSize < REDUCED_DEFLATE_THRESHOLD ? DEFLATE_LEVEL_PARTS : DEFLATE_LEVEL_CHUNKS);
+ deflater.setInput(packet.buildBuffer);
+ deflater.finish();
+ int size = deflater.deflate(deflateBuffer);
+ if (size == 0) {
+ size = deflater.deflate(deflateBuffer);
+ }
+
+ // copy compressed data to packet
+ packet.buffer = new byte[size];
+ packet.size = size;
+ System.arraycopy(deflateBuffer, 0, packet.buffer, 0, size);
+ }
+
+ private void handleMapChunk(Packet51MapChunk packet) {
+ // If 'packet.buffer' is set then this packet has already been compressed.
if (packet.buffer != null) {
return;
}
- int dataSize = packet.rawData.length;
+ int dataSize = packet.inflatedBuffer.length;
if (deflateBuffer.length < dataSize + 100) {
deflateBuffer = new byte[dataSize + 100];
}
deflater.reset();
deflater.setLevel(dataSize < REDUCED_DEFLATE_THRESHOLD ? DEFLATE_LEVEL_PARTS : DEFLATE_LEVEL_CHUNKS);
- deflater.setInput(packet.rawData);
+ deflater.setInput(packet.inflatedBuffer);
deflater.finish();
int size = deflater.deflate(deflateBuffer);
if (size == 0) {
@@ -86,13 +114,15 @@ public final class ChunkCompressionThread implements Runnable {
}
public static void sendPacket(EntityPlayer player, Packet packet) {
+ int compressType = 0;
+
if (packet instanceof Packet51MapChunk) {
- // MapChunk Packets need compressing.
- instance.addQueuedPacket(new QueuedPacket(player, packet, true));
- } else {
- // Other Packets don't.
- instance.addQueuedPacket(new QueuedPacket(player, packet, false));
+ compressType = 1;
+ } else if (packet instanceof Packet56MapChunkBulk) {
+ compressType = 2;
}
+
+ instance.addQueuedPacket(new QueuedPacket(player, packet, compressType));
}
private void addToPlayerQueueSize(EntityPlayer player, int amount) {
@@ -129,9 +159,9 @@ public final class ChunkCompressionThread implements Runnable {
private static class QueuedPacket {
final EntityPlayer player;
final Packet packet;
- final boolean compress;
+ final int compress;
- QueuedPacket(EntityPlayer player, Packet packet, boolean compress) {
+ QueuedPacket(EntityPlayer player, Packet packet, int compress) {
this.player = player;
this.packet = packet;
this.compress = compress;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 61af6dde..4f9ac887 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -150,7 +150,7 @@ public class CraftChunk implements Chunk {
public ChunkSnapshot getChunkSnapshot(boolean includeMaxBlockY, boolean includeBiome, boolean includeBiomeTempRain) {
net.minecraft.server.Chunk chunk = getHandle();
- ChunkSection[] cs = chunk.h(); /* Get sections */
+ ChunkSection[] cs = chunk.i(); /* Get sections */
short[][] sectionBlockIDs = new short[cs.length][];
byte[][] sectionBlockData = new byte[cs.length][];
byte[][] sectionSkyLights = new byte[cs.length][];
@@ -173,8 +173,8 @@ public class CraftChunk implements Chunk {
blockids[j] = (short) (baseids[j] & 0xFF);
}
- if (cs[i].h() != null) { /* If we've got extended IDs */
- byte[] extids = cs[i].h().a;
+ if (cs[i].i() != null) { /* If we've got extended IDs */
+ byte[] extids = cs[i].i().a;
for (int j = 0; j < 2048; j++) {
short b = (short) (extids[j] & 0xFF);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index 349d8d2a..4a0d8dcb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -4,9 +4,12 @@ import java.io.File;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+
+import net.minecraft.server.BanEntry;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.WorldNBTStorage;
+
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
@@ -56,15 +59,18 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
}
public boolean isBanned() {
- return server.getHandle().banByName.contains(name.toLowerCase());
+ return server.getHandle().getNameBans().isBanned(name.toLowerCase());
}
public void setBanned(boolean value) {
if (value) {
- server.getHandle().addUserBan(name.toLowerCase());
+ BanEntry entry = new BanEntry(name.toLowerCase());
+ server.getHandle().getNameBans().add(entry);
} else {
- server.getHandle().removeUserBan(name.toLowerCase());
+ server.getHandle().getNameBans().remove(name.toLowerCase());
}
+
+ server.getHandle().getNameBans().save();
}
public boolean isWhitelisted() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 43f197de..7b755418 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -17,14 +17,18 @@ import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
+import net.minecraft.server.BanEntry;
import net.minecraft.server.ChunkCoordinates;
-import net.minecraft.server.ConvertProgressUpdater;
import net.minecraft.server.Convertable;
+import net.minecraft.server.ConvertProgressUpdater;
import net.minecraft.server.CraftingManager;
+import net.minecraft.server.DedicatedServer;
import net.minecraft.server.Enchantment;
import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityTracker;
-import net.minecraft.server.FurnaceRecipes;
+import net.minecraft.server.EnumGamemode;
+import net.minecraft.server.ExceptionWorldConflict;
+import net.minecraft.server.RecipesFurnace;
import net.minecraft.server.IProgressUpdate;
import net.minecraft.server.IWorldAccess;
import net.minecraft.server.Item;
@@ -33,6 +37,7 @@ import net.minecraft.server.MobEffectList;
import net.minecraft.server.PropertyManager;
import net.minecraft.server.ServerCommand;
import net.minecraft.server.ServerConfigurationManager;
+import net.minecraft.server.ServerConfigurationManagerAbstract;
import net.minecraft.server.ServerNBTManager;
import net.minecraft.server.WorldLoaderServer;
import net.minecraft.server.WorldManager;
@@ -128,7 +133,7 @@ public final class CraftServer implements Server {
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final ServicesManager servicesManager = new SimpleServicesManager();
- private final BukkitScheduler scheduler = new CraftScheduler();
+ private final CraftScheduler scheduler = new CraftScheduler();
private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
private final SimpleHelpMap helpMap = new SimpleHelpMap(this);
private final StandardMessenger messenger = new StandardMessenger();
@@ -146,14 +151,15 @@ public final class CraftServer implements Server {
private int monsterSpawn = -1;
private int animalSpawn = -1;
private int waterAnimalSpawn = -1;
+ private File container;
static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
}
- public CraftServer(MinecraftServer console, ServerConfigurationManager server) {
+ public CraftServer(MinecraftServer console, ServerConfigurationManagerAbstract server) {
this.console = console;
- this.server = server;
+ this.server = (ServerConfigurationManager) server;
this.serverVersion = CraftServer.class.getPackage().getImplementationVersion();
Bukkit.setServer(this);
@@ -355,7 +361,7 @@ public final class CraftServer implements Server {
}
public int getMaxPlayers() {
- return server.maxPlayers;
+ return server.getMaxPlayers();
}
// NOTE: These are dependent on the corrisponding call in MinecraftServer
@@ -410,15 +416,15 @@ public final class CraftServer implements Server {
// NOTE: Temporary calls through to server.properies until its replaced
private String getConfigString(String variable, String defaultValue) {
- return this.console.propertyManager.getString(variable, defaultValue);
+ return this.console.getPropertyManager().getString(variable, defaultValue);
}
private int getConfigInt(String variable, int defaultValue) {
- return this.console.propertyManager.getInt(variable, defaultValue);
+ return this.console.getPropertyManager().getInt(variable, defaultValue);
}
private boolean getConfigBoolean(String variable, boolean defaultValue) {
- return this.console.propertyManager.getBoolean(variable, defaultValue);
+ return this.console.getPropertyManager().getBoolean(variable, defaultValue);
}
// End Temporary calls
@@ -451,7 +457,7 @@ public final class CraftServer implements Server {
return pluginManager;
}
- public BukkitScheduler getScheduler() {
+ public CraftScheduler getScheduler() {
return scheduler;
}
@@ -467,7 +473,7 @@ public final class CraftServer implements Server {
return server;
}
- // NOTE: Should only be called from MinecraftServer.b()
+ // NOTE: Should only be called from DedicatedServer.ah()
public boolean dispatchServerCommand(CommandSender sender, ServerCommand serverCommand) {
if (sender instanceof Conversable) {
Conversable conversable = (Conversable)sender;
@@ -494,17 +500,17 @@ public final class CraftServer implements Server {
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
PropertyManager config = new PropertyManager(console.options);
- console.propertyManager = config;
+ ((DedicatedServer) console).propertyManager = config;
- boolean animals = config.getBoolean("spawn-animals", console.spawnAnimals);
+ boolean animals = config.getBoolean("spawn-animals", console.getSpawnAnimals());
boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).difficulty > 0);
int difficulty = config.getInt("difficulty", console.worlds.get(0).difficulty);
- console.onlineMode = config.getBoolean("online-mode", console.onlineMode);
- console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals);
- console.pvpMode = config.getBoolean("pvp", console.pvpMode);
- console.allowFlight = config.getBoolean("allow-flight", console.allowFlight);
- console.motd = config.getString("motd", console.motd);
+ console.setOnlineMode(config.getBoolean("online-mode", console.getOnlineMode()));
+ console.setSpawnAnimals(config.getBoolean("spawn-animals", console.getSpawnAnimals()));
+ console.setPvP(config.getBoolean("pvp", console.getPvP()));
+ console.setAllowFlight(config.getBoolean("allow-flight", console.getAllowFlight()));
+ console.setMotd(config.getString("motd", console.getMotd()));
monsterSpawn = configuration.getInt("spawn-limits.monsters");
animalSpawn = configuration.getInt("spawn-limits.animals");
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
@@ -669,7 +675,7 @@ public final class CraftServer implements Server {
} while(used);
boolean hardcore = false;
- WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), getDefaultGameMode().getValue(), generateStructures, hardcore, type), creator.environment(), generator);
+ WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(getDefaultGameMode().getValue()), generateStructures, hardcore, type), console.methodProfiler, creator.environment(), generator);
if (!(worlds.containsKey(name.toLowerCase()))) {
return null;
@@ -677,7 +683,7 @@ public final class CraftServer implements Server {
internal.worldMaps = console.worlds.get(0).worldMaps;
- internal.tracker = new EntityTracker(console, internal); // CraftBukkit
+ internal.tracker = new EntityTracker(internal); // CraftBukkit
internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal));
internal.difficulty = 1;
internal.setSpawnFlags(true, true);
@@ -753,10 +759,14 @@ public final class CraftServer implements Server {
}
if (save) {
- handle.save(true, (IProgressUpdate) null);
- handle.saveLevel();
- WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
- getPluginManager().callEvent(event);
+ try {
+ handle.save(true, (IProgressUpdate) null);
+ handle.saveLevel();
+ WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
+ getPluginManager().callEvent(event);
+ } catch (ExceptionWorldConflict ex) {
+ getLogger().log(Level.SEVERE, null, ex);
+ }
}
worlds.remove(world.getName().toLowerCase());
@@ -870,13 +880,13 @@ public final class CraftServer implements Server {
}
public void clearRecipes() {
- CraftingManager.getInstance().recipies.clear();
- FurnaceRecipes.getInstance().recipies.clear();
+ CraftingManager.getInstance().recipes.clear();
+ RecipesFurnace.getInstance().recipes.clear();
}
public void resetRecipes() {
- CraftingManager.getInstance().recipies = new CraftingManager().recipies;
- FurnaceRecipes.getInstance().recipies = new FurnaceRecipes().recipies;
+ CraftingManager.getInstance().recipes = new CraftingManager().recipes;
+ RecipesFurnace.getInstance().recipes = new RecipesFurnace().recipes;
}
public Map<String, String[]> getCommandAliases() {
@@ -910,11 +920,11 @@ public final class CraftServer implements Server {
}
public boolean getOnlineMode() {
- return this.console.onlineMode;
+ return console.getOnlineMode();
}
public boolean getAllowFlight() {
- return this.console.allowFlight;
+ return console.getAllowFlight();
}
public boolean useExactLoginLocation() {
@@ -1004,21 +1014,24 @@ public final class CraftServer implements Server {
@SuppressWarnings("unchecked")
public Set<String> getIPBans() {
- return new HashSet<String>(server.banByIP);
+ return server.getIPBans().getEntries().keySet();
}
public void banIP(String address) {
- server.addIpBan(address);
+ BanEntry entry = new BanEntry(address);
+ server.getIPBans().add(entry);
+ server.getIPBans().save();
}
public void unbanIP(String address) {
- server.removeIpBan(address);
+ server.getIPBans().remove(address);
+ server.getIPBans().save();
}
public Set<OfflinePlayer> getBannedPlayers() {
Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();
- for (Object name : server.banByName) {
+ for (Object name : server.getNameBans().getEntries().keySet()) {
result.add(getOfflinePlayer((String) name));
}
@@ -1027,7 +1040,7 @@ public final class CraftServer implements Server {
public void setWhitelist(boolean value) {
server.hasWhitelist = value;
- console.propertyManager.setBoolean("white-list", value);
+ console.getPropertyManager().a("white-list", value);
}
public Set<OfflinePlayer> getWhitelistedPlayers() {
@@ -1046,7 +1059,7 @@ public final class CraftServer implements Server {
public Set<OfflinePlayer> getOperators() {
Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();
- for (Object name : server.operators) {
+ for (Object name : server.getOPs()) {
result.add(getOfflinePlayer((String) name));
}
@@ -1058,7 +1071,7 @@ public final class CraftServer implements Server {
}
public GameMode getDefaultGameMode() {
- return GameMode.getByValue(console.worlds.get(0).worldData.getGameType());
+ return GameMode.getByValue(console.worlds.get(0).getWorldData().getGameType().a());
}
public void setDefaultGameMode(GameMode mode) {
@@ -1067,7 +1080,7 @@ public final class CraftServer implements Server {
}
for (World world : getWorlds()) {
- ((CraftWorld) world).getHandle().worldData.setGameType(mode.getValue());
+ ((CraftWorld) world).getHandle().worldData.setGameType(EnumGamemode.a(mode.getValue()));
}
}
@@ -1109,7 +1122,15 @@ public final class CraftServer implements Server {
}
public File getWorldContainer() {
- return new File(configuration.getString("settings.world-container", "."));
+ if (this.getServer().universe != null) {
+ return this.getServer().universe;
+ }
+
+ if (container == null) {
+ container = new File(configuration.getString("settings.world-container", "."));
+ }
+
+ return container;
}
public OfflinePlayer[] getOfflinePlayers() {
@@ -1197,6 +1218,6 @@ public final class CraftServer implements Server {
}
public String getMotd() {
- return console.motd;
+ return console.getMotd();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c153911d..c68767f5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -257,7 +257,6 @@ public class CraftWorld implements World {
world.chunkProviderServer.chunks.put(x, z, chunk);
world.chunkProviderServer.chunkList.add(chunk);
- chunk.loadNOP();
chunk.addEntities();
if (!chunk.done && world.chunkProviderServer.isChunkLoaded(x + 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
@@ -338,13 +337,13 @@ public class CraftWorld implements World {
}
public LightningStrike strikeLightning(Location loc) {
- EntityWeatherLighting lightning = new EntityWeatherLighting(world, loc.getX(), loc.getY(), loc.getZ());
+ EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ());
world.strikeLightning(lightning);
return new CraftLightningStrike(server, lightning);
}
public LightningStrike strikeLightningEffect(Location loc) {
- EntityWeatherLighting lightning = new EntityWeatherLighting(world, loc.getX(), loc.getY(), loc.getZ(), true);
+ EntityLightning lightning = new EntityLightning(world, loc.getX(), loc.getY(), loc.getZ(), true);
world.strikeLightning(lightning);
return new CraftLightningStrike(server, lightning);
}
@@ -400,7 +399,7 @@ public class CraftWorld implements World {
}
public String getName() {
- return world.worldData.name;
+ return world.worldData.getName();
}
@Deprecated
@@ -409,7 +408,7 @@ public class CraftWorld implements World {
}
public UUID getUID() {
- return world.getUUID();
+ return world.getDataManager().getUUID();
}
@Override
@@ -514,18 +513,18 @@ public class CraftWorld implements World {
net.minecraft.server.Chunk chunk = this.world.getChunkAtWorldCoords(x, z);
if (chunk != null) {
- byte[] biomevals = chunk.l();
+ byte[] biomevals = chunk.m();
biomevals[((z & 0xF) << 4) | (x & 0xF)] = (byte)bb.id;
}
}
}
public double getTemperature(int x, int z) {
- return this.world.getBiome(x, z).F;
+ return this.world.getBiome(x, z).temperature;
}
public double getHumidity(int x, int z) {
- return this.world.getBiome(x, z).G;
+ return this.world.getBiome(x, z).humidity;
}
public List<Entity> getEntities() {
@@ -636,12 +635,16 @@ public class CraftWorld implements World {
}
public void save() {
- boolean oldSave = world.savingDisabled;
+ try {
+ boolean oldSave = world.savingDisabled;
- world.savingDisabled = false;
- world.save(true, null);
+ world.savingDisabled = false;
+ world.save(true, null);
- world.savingDisabled = oldSave;
+ world.savingDisabled = oldSave;
+ } catch (ExceptionWorldConflict ex) {
+ ex.printStackTrace();
+ }
}
public boolean isAutoSave() {
@@ -806,8 +809,6 @@ public class CraftWorld implements World {
entity = new EntitySnowball(world, x, y, z);
} else if (Egg.class.isAssignableFrom(clazz)) {
entity = new EntityEgg(world, x, y, z);
- } else if (EnderPearl.class.isAssignableFrom(clazz)) {
- entity = new EntityEnderPearl(world, x, y, z);
} else if (Arrow.class.isAssignableFrom(clazz)) {
entity = new EntityArrow(world);
entity.setPositionRotation(x, y, z, 0, 0);
@@ -946,7 +947,7 @@ public class CraftWorld implements World {
entity = new EntityExperienceOrb(world, x, y, z, 0);
} else if (Weather.class.isAssignableFrom(clazz)) {
// not sure what this can do
- entity = new EntityWeatherLighting(world, x, y, z);
+ entity = new EntityLightning(world, x, y, z);
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
// what is this, I don't even
} else if (Fish.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a30daaf2..c6fa9ab8 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -38,10 +38,15 @@ public class Main {
.ofType(String.class)
.describedAs("Hostname or IP");
- acceptsAll(asList("w", "world", "level-name"), "World directory")
+ acceptsAll(asList("W", "world-dir", "universe", "world-container"), "World container")
+ .withRequiredArg()
+ .ofType(File.class)
+ .describedAs("Directory containing worlds");
+
+ acceptsAll(asList("w", "world", "level-name"), "World name")
.withRequiredArg()
.ofType(String.class)
- .describedAs("World dir");
+ .describedAs("World name");
acceptsAll(asList("p", "port", "server-port"), "Port to listen on")
.withRequiredArg()
@@ -100,6 +105,8 @@ public class Main {
acceptsAll(asList("noconsole"), "Disables the console");
acceptsAll(asList("v", "version"), "Show the CraftBukkit Version");
+
+ acceptsAll(asList("demo"), "Demo mode");
}
};
diff --git a/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java b/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java
index 495c586a..f1d2cd3a 100644
--- a/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java
+++ b/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java
@@ -87,7 +87,7 @@ public class PortalTravelAgent implements TravelAgent {
for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) {
double d3 = (double) k1 + 0.5D - location.getZ();
- for (int l1 = 127; l1 >= 0; --l1) {
+ for (int l1 = world.L() - 1; l1 >= 0; --l1) {
if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
--l1;
@@ -194,7 +194,7 @@ public class PortalTravelAgent implements TravelAgent {
d2 = (double) j2 + 0.5D - location.getZ();
label271:
- for (l2 = 127; l2 >= 0; --l2) {
+ for (l2 = world.L() - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@@ -245,7 +245,7 @@ public class PortalTravelAgent implements TravelAgent {
d2 = (double) j2 + 0.5D - location.getZ();
label219:
- for (l2 = 127; l2 >= 0; --l2) {
+ for (l2 = world.L() - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2;
@@ -306,8 +306,8 @@ public class PortalTravelAgent implements TravelAgent {
i1 = 70;
}
- if (i1 > 118) {
- i1 = 118;
+ if (i1 > world.L() - 10) {
+ i1 = world.L() - 10;
}
j5 = i1;
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
index 0851ad31..6beaa23b 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java
@@ -54,7 +54,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
synchronized (block) {
if (block.getType() == Material.NOTE_BLOCK) {
- world.getHandle().playNote(getX(), getY(), getZ(), instrument, note);
+ world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument, note);
return true;
} else {
return false;
@@ -67,7 +67,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
synchronized (block) {
if (block.getType() == Material.NOTE_BLOCK) {
- world.getHandle().playNote(getX(), getY(), getZ(), instrument.getType(), note.getId());
+ world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId());
return true;
} else {
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java
index 0422cee9..c42d9687 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java
@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.command;
import java.lang.reflect.Method;
import net.minecraft.server.ICommandListener;
+import net.minecraft.server.LocaleLanguage;
import org.bukkit.command.CommandSender;
@@ -33,4 +34,12 @@ public class ServerCommandListener implements ICommandListener {
return this.prefix;
}
+
+ public String a(String s, Object... aobject) {
+ return LocaleLanguage.a().a(s, aobject);
+ }
+
+ public boolean b(String s) {
+ return true;
+ }
} \ No newline at end of file
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 9ab1e669..67304366 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -124,7 +124,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
else if (entity instanceof EntityFishingHook) { return new CraftFish(server, (EntityFishingHook) entity); }
else if (entity instanceof EntityItem) { return new CraftItem(server, (EntityItem) entity); }
else if (entity instanceof EntityWeather) {
- if (entity instanceof EntityWeatherLighting) { return new CraftLightningStrike(server, (EntityWeatherLighting) entity); }
+ if (entity instanceof EntityLightning) { return new CraftLightningStrike(server, (EntityLightning) entity); }
else { return new CraftWeather(server, (EntityWeather) entity); }
}
else if (entity instanceof EntityMinecart) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 18da3121..67ad8a83 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -301,7 +301,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
public boolean isBlocking() {
- return getHandle().P();
+ return getHandle().aY();
}
public boolean setWindowProperty(InventoryView.Property prop, int value) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
index e8a8a6ba..684a38a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java
@@ -21,11 +21,11 @@ public class CraftIronGolem extends CraftGolem implements IronGolem {
}
public boolean isPlayerCreated() {
- return getHandle().n_();
+ return getHandle().q();
}
public void setPlayerCreated(boolean playerCreated) {
- getHandle().b(playerCreated);
+ getHandle().f(playerCreated);
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
index 6142b470..64e346d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
@@ -1,22 +1,22 @@
package org.bukkit.craftbukkit.entity;
-import net.minecraft.server.EntityWeatherLighting;
+import net.minecraft.server.EntityLightning;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LightningStrike;
public class CraftLightningStrike extends CraftEntity implements LightningStrike {
- public CraftLightningStrike(final CraftServer server, final EntityWeatherLighting entity) {
+ public CraftLightningStrike(final CraftServer server, final EntityLightning entity) {
super(server, entity);
}
public boolean isEffect() {
- return ((EntityWeatherLighting) super.getHandle()).isEffect;
+ return ((EntityLightning) super.getHandle()).isEffect;
}
@Override
- public EntityWeatherLighting getHandle() {
- return (EntityWeatherLighting) entity;
+ public EntityLightning getHandle() {
+ return (EntityLightning) entity;
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index e500b230..8f9b565c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -244,7 +244,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void removePotionEffect(PotionEffectType type) {
getHandle().effects.remove(type.getId());
- getHandle().e = true; // Should be called updateEffects
+ getHandle().updateEffects = true;
if (getHandle() instanceof EntityPlayer) {
if (((EntityPlayer) getHandle()).netServerHandler == null) return;
((EntityPlayer) getHandle()).netServerHandler.sendPacket(new Packet42RemoveMobEffect(getHandle().id, new MobEffect(type.getId(), 0, 0)));
@@ -300,6 +300,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
public boolean hasLineOfSight(Entity other) {
- return getHandle().am().canSee(((CraftEntity) other).getHandle()); // am should be getEntitySenses
+ return getHandle().at().canSee(((CraftEntity) other).getHandle()); // am should be getEntitySenses
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index c2f38d0a..dd82cb32 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -239,13 +239,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void playNote(Location loc, byte instrument, byte note) {
if (getHandle().netServerHandler == null) return;
- getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), instrument, note));
+ int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
+ getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument, note));
}
public void playNote(Location loc, Instrument instrument, Note note) {
if (getHandle().netServerHandler == null) return;
- getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), instrument.getType(), note.getId()));
+ int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
+ getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument.getType(), note.getId()));
}
public void playEffect(Location loc, Effect effect, int data) {
@@ -368,7 +370,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setSneaking(boolean sneak) {
- getHandle().setSneak(sneak);
+ getHandle().setSneaking(sneak);
}
public boolean isSneaking() {
@@ -470,15 +472,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public boolean isBanned() {
- return server.getHandle().banByName.contains(getName().toLowerCase());
+ return server.getHandle().getNameBans().isBanned(getName().toLowerCase());
}
public void setBanned(boolean value) {
if (value) {
- server.getHandle().addUserBan(getName().toLowerCase());
+ BanEntry entry = new BanEntry(getName().toLowerCase());
+ server.getHandle().getNameBans().add(entry);
} else {
- server.getHandle().removeUserBan(getName().toLowerCase());
+ server.getHandle().getNameBans().remove(getName().toLowerCase());
}
+
+ server.getHandle().getNameBans().save();
}
public boolean isWhitelisted() {
@@ -508,14 +513,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return;
}
- getHandle().itemInWorldManager.setGameMode(mode.getValue());
+ getHandle().itemInWorldManager.setGameMode(EnumGamemode.a(mode.getValue()));
getHandle().netServerHandler.sendPacket(new Packet70Bed(3, mode.getValue()));
}
}
@Override
public GameMode getGameMode() {
- return GameMode.getByValue(getHandle().itemInWorldManager.getGameMode());
+ return GameMode.getByValue(getHandle().itemInWorldManager.getGameMode().a());
}
public void giveExp(int exp) {
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index f0652c6f..23f33043 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
@@ -63,7 +63,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
if (xbtypes != null) {
chunk = new Chunk(this.world, x, z);
- ChunkSection[] csect = chunk.h();
+ ChunkSection[] csect = chunk.i();
int scnt = Math.min(csect.length, xbtypes.length);
// Loop through returned sections
@@ -100,7 +100,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
if (btypes != null) {
chunk = new Chunk(this.world, x, z);
- ChunkSection[] csect = chunk.h();
+ ChunkSection[] csect = chunk.i();
int scnt = Math.min(csect.length, btypes.length);
for (int sec = 0; sec < scnt; sec++) {
@@ -118,7 +118,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
chunk = new Chunk(this.world, x, z); // Create empty chunk
- ChunkSection[] csect = chunk.h();
+ ChunkSection[] csect = chunk.i();
scnt = Math.min(scnt, csect.length);
// Loop through sections
@@ -153,7 +153,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
}
}
// Set biome grid
- byte[] biomeIndex = chunk.l();
+ byte[] biomeIndex = chunk.m();
for (int i = 0; i < biomeIndex.length; i++) {
biomeIndex[i] = (byte) (biomegrid.biome[i].id & 0xFF);
}
@@ -215,4 +215,12 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
public ChunkPosition findNearestMapFeature(World world, String type, int x, int y, int z) {
return "Stronghold".equals(type) && this.strongholdGen != null ? this.strongholdGen.getNearestGeneratedFeature(world, x, y, z) : null;
}
+
+ public int getLoadedChunks() {
+ return 0;
+ }
+
+ public String getName() {
+ return "CustomChunkGenerator";
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
index 202b3ab2..c5c3346d 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java
@@ -68,4 +68,12 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
public ChunkPosition findNearestMapFeature(World world, String string, int i, int i1, int i2) {
return provider.findNearestMapFeature(world, string, i, i1, i2);
}
+
+ public int getLoadedChunks() {
+ return 0;
+ }
+
+ public String getName() {
+ return "NormalWorldGenerator";
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
index 52696e32..dfc15a4a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
@@ -79,8 +79,8 @@ public class CraftContainer extends Container {
int type = getNotchInventoryType(cachedType);
IInventory top = ((CraftInventory)view.getTopInventory()).getInventory();
IInventory bottom = ((CraftInventory)view.getBottomInventory()).getInventory();
- this.d.clear();
- this.e.clear();
+ this.a.clear();
+ this.b.clear();
if (typeChanged) {
setupSlots(top, bottom);
}
@@ -275,4 +275,7 @@ public class CraftContainer extends Container {
// End copy from ContainerBrewingStand
}
+ public boolean c(EntityHuman entity) {
+ return true;
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java
index 8f67b6f1..0df39891 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java
@@ -1,6 +1,6 @@
package org.bukkit.craftbukkit.inventory;
-import net.minecraft.server.FurnaceRecipes;
+import net.minecraft.server.RecipesFurnace;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.ItemStack;
@@ -20,6 +20,6 @@ public class CraftFurnaceRecipe extends FurnaceRecipe implements CraftRecipe {
public void addToCraftingManager() {
ItemStack result = this.getResult();
ItemStack input = this.getInput();
- FurnaceRecipes.getInstance().registerRecipe(input.getTypeId(), CraftItemStack.createNMSItemStack(result));
+ RecipesFurnace.getInstance().registerRecipe(input.getTypeId(), CraftItemStack.createNMSItemStack(result), 0.1f);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index 0216f9dd..c8f25b02 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -1,6 +1,5 @@
package org.bukkit.craftbukkit.inventory;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
@@ -8,6 +7,8 @@ import java.util.ListIterator;
import net.minecraft.server.ContainerEnchantTableInventory;
import net.minecraft.server.IInventory;
import net.minecraft.server.InventoryCrafting;
+import net.minecraft.server.InventoryEnderChest;
+import net.minecraft.server.InventoryMerchant;
import net.minecraft.server.PlayerInventory;
import net.minecraft.server.TileEntityBrewingStand;
import net.minecraft.server.TileEntityDispenser;
@@ -411,6 +412,10 @@ public class CraftInventory implements Inventory {
return InventoryType.BREWING;
} else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) {
return ((CraftInventoryCustom.MinecraftInventory) inventory).getType();
+ } else if (inventory instanceof InventoryEnderChest) {
+ return InventoryType.ENDER_CHEST;
+ } else if (inventory instanceof InventoryMerchant) {
+ return InventoryType.MERCHANT;
} else {
return InventoryType.CHEST;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java
index 0a64d772..92e1ae9f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCrafting.java
@@ -1,6 +1,6 @@
package org.bukkit.craftbukkit.inventory;
-import net.minecraft.server.CraftingRecipe;
+import net.minecraft.server.IRecipe;
import net.minecraft.server.IInventory;
import net.minecraft.server.InventoryCrafting;
@@ -132,7 +132,7 @@ public class CraftInventoryCrafting extends CraftInventory implements CraftingIn
}
public Recipe getRecipe() {
- CraftingRecipe recipe = ((InventoryCrafting)getInventory()).currentRecipe;
+ IRecipe recipe = ((InventoryCrafting)getInventory()).currentRecipe;
return recipe == null ? null : recipe.toBukkitRecipe();
}
} \ No newline at end of file
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
index a53a5c2d..7299a168 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
@@ -139,5 +139,7 @@ public class CraftInventoryCustom extends CraftInventory {
public InventoryHolder getOwner() {
return owner;
}
+
+ public void startOpen() {}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java
new file mode 100644
index 00000000..7f89c2ad
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryMerchant.java
@@ -0,0 +1,10 @@
+package org.bukkit.craftbukkit.inventory;
+
+import net.minecraft.server.InventoryMerchant;
+import org.bukkit.inventory.MerchantInventory;
+
+public class CraftInventoryMerchant extends CraftInventory implements MerchantInventory {
+ public CraftInventoryMerchant(InventoryMerchant merchant) {
+ super(merchant);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index c26cc412..9f7f0045 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -228,6 +228,8 @@ public class CraftItemStack extends ItemStack {
public static net.minecraft.server.ItemStack createNMSItemStack(ItemStack original) {
if (original == null || original.getTypeId() <= 0) {
return null;
+ } else if (original instanceof CraftItemStack) {
+ return ((CraftItemStack) original).getHandle();
}
return new CraftItemStack(original).getHandle();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
index 85e9c8c6..c1f21936 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java
@@ -6,17 +6,17 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import net.minecraft.server.CraftingManager;
-import net.minecraft.server.CraftingRecipe;
-import net.minecraft.server.FurnaceRecipes;
+import net.minecraft.server.IRecipe;
+import net.minecraft.server.RecipesFurnace;
public class RecipeIterator implements Iterator<Recipe> {
- private Iterator<CraftingRecipe> recipes;
+ private Iterator<IRecipe> recipes;
private Iterator<Integer> smelting;
private Iterator<?> removeFrom = null;
public RecipeIterator() {
- this.recipes = CraftingManager.getInstance().getRecipies().iterator();
- this.smelting = FurnaceRecipes.getInstance().getRecipies().keySet().iterator();
+ this.recipes = CraftingManager.getInstance().getRecipes().iterator();
+ this.smelting = RecipesFurnace.getInstance().getRecipes().keySet().iterator();
}
public boolean hasNext() {
@@ -34,7 +34,7 @@ public class RecipeIterator implements Iterator<Recipe> {
} else {
removeFrom = smelting;
int id = smelting.next();
- CraftItemStack stack = new CraftItemStack(FurnaceRecipes.getInstance().getResult(id));
+ CraftItemStack stack = new CraftItemStack(RecipesFurnace.getInstance().getResult(id));
CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1));
return recipe;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index ab6d992f..ae3481ba 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.util;
+import net.minecraft.server.ExceptionWorldConflict;
import net.minecraft.server.MinecraftServer;
public class ServerShutdownThread extends Thread {
@@ -11,6 +12,15 @@ public class ServerShutdownThread extends Thread {
@Override
public void run() {
- server.stop();
+ try {
+ server.stop();
+ } catch (ExceptionWorldConflict ex) {
+ ex.printStackTrace();
+ } finally {
+ try {
+ server.reader.getTerminal().restore();
+ } catch (Exception e) {
+ }
+ }
}
}