diff --git a/pom.xml b/pom.xml
index b56b26cb4f..2afdff4e47 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.bukkit
craftbukkit
jar
- 1.6.4-R2.1-SNAPSHOT
+ 1.7.2-R0.1-SNAPSHOT
CraftBukkit
http://www.bukkit.org
@@ -12,8 +12,8 @@
UTF-8
unknown
4.11
- 1.6.4
- 1_6_R3
+ 1.7.2
+ 1_7_R1
git-Bukkit-
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 2a85c1c1a6..dca832f6fa 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -1,199 +1,36 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
import java.util.Random;
public class Block {
+ public static final RegistryMaterials REGISTRY = new RegistryBlocks("air");
private CreativeModeTab creativeTab;
- protected String f;
- public static final StepSound g = new StepSound("stone", 1.0F, 1.0F);
- public static final StepSound h = new StepSound("wood", 1.0F, 1.0F);
- public static final StepSound i = new StepSound("gravel", 1.0F, 1.0F);
- public static final StepSound j = new StepSound("grass", 1.0F, 1.0F);
- public static final StepSound k = new StepSound("stone", 1.0F, 1.0F);
- public static final StepSound l = new StepSound("stone", 1.0F, 1.5F);
- public static final StepSound m = new StepSoundStone("stone", 1.0F, 1.0F);
- public static final StepSound n = new StepSound("cloth", 1.0F, 1.0F);
- public static final StepSound o = new StepSound("sand", 1.0F, 1.0F);
- public static final StepSound p = new StepSound("snow", 1.0F, 1.0F);
- public static final StepSound q = new StepSoundLadder("ladder", 1.0F, 1.0F);
- public static final StepSound r = new StepSoundAnvil("anvil", 0.3F, 1.0F);
- public static final Block[] byId = new Block[4096];
- public static final boolean[] t = new boolean[4096];
- public static final int[] lightBlock = new int[4096];
- public static final boolean[] v = new boolean[4096];
- public static final int[] lightEmission = new int[4096];
- public static boolean[] x = new boolean[4096];
- public static final Block STONE = (new BlockStone(1)).c(1.5F).b(10.0F).a(k).c("stone").d("stone");
- public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(j).c("grass").d("grass");
- public static final Block DIRT = (new BlockDirt(3)).c(0.5F).a(i).c("dirt").d("dirt");
- public static final Block COBBLESTONE = (new Block(4, Material.STONE)).c(2.0F).b(10.0F).a(k).c("stonebrick").a(CreativeModeTab.b).d("cobblestone");
- public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(h).c("wood").d("planks");
- public static final Block SAPLING = (new BlockSapling(6)).c(0.0F).a(j).c("sapling").d("sapling");
- public static final Block BEDROCK = (new Block(7, Material.STONE)).r().b(6000000.0F).a(k).c("bedrock").C().a(CreativeModeTab.b).d("bedrock");
- public static final BlockFluids WATER = (BlockFluids) (new BlockFlowing(8, Material.WATER)).c(100.0F).k(3).c("water").C().d("water_flow");
- public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).k(3).c("water").C().d("water_still");
- public static final BlockFluids LAVA = (BlockFluids) (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).c("lava").C().d("lava_flow");
- public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).c("lava").C().d("lava_still");
- public static final Block SAND = (new BlockSand(12)).c(0.5F).a(o).c("sand").d("sand");
- public static final Block GRAVEL = (new BlockGravel(13)).c(0.6F).a(i).c("gravel").d("gravel");
- public static final Block GOLD_ORE = (new BlockOre(14)).c(3.0F).b(5.0F).a(k).c("oreGold").d("gold_ore");
- public static final Block IRON_ORE = (new BlockOre(15)).c(3.0F).b(5.0F).a(k).c("oreIron").d("iron_ore");
- public static final Block COAL_ORE = (new BlockOre(16)).c(3.0F).b(5.0F).a(k).c("oreCoal").d("coal_ore");
- public static final Block LOG = (new BlockLog(17)).c(2.0F).a(h).c("log").d("log");
- public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18)).c(0.2F).k(1).a(j).c("leaves").d("leaves");
- public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(j).c("sponge").d("sponge");
- public static final Block GLASS = (new BlockGlass(20, Material.SHATTERABLE, false)).c(0.3F).a(m).c("glass").d("glass");
- public static final Block LAPIS_ORE = (new BlockOre(21)).c(3.0F).b(5.0F).a(k).c("oreLapis").d("lapis_ore");
- public static final Block LAPIS_BLOCK = (new Block(22, Material.STONE)).c(3.0F).b(5.0F).a(k).c("blockLapis").a(CreativeModeTab.b).d("lapis_block");
- public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(k).c("dispenser").d("dispenser");
- public static final Block SANDSTONE = (new BlockSandStone(24)).a(k).c(0.8F).c("sandStone").d("sandstone");
- public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).c("musicBlock").d("noteblock");
- public static final Block BED = (new BlockBed(26)).c(0.2F).c("bed").C().d("bed");
- public static final Block GOLDEN_RAIL = (new BlockPoweredRail(27)).c(0.7F).a(l).c("goldenRail").d("rail_golden");
- public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28)).c(0.7F).a(l).c("detectorRail").d("rail_detector");
- public static final BlockPiston PISTON_STICKY = (BlockPiston) (new BlockPiston(29, true)).c("pistonStickyBase");
- public static final Block WEB = (new BlockWeb(30)).k(1).c(4.0F).c("web").d("web");
- public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31)).c(0.0F).a(j).c("tallgrass");
- public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32)).c(0.0F).a(j).c("deadbush").d("deadbush");
- public static final BlockPiston PISTON = (BlockPiston) (new BlockPiston(33, false)).c("pistonBase");
- public static final BlockPistonExtension PISTON_EXTENSION = new BlockPistonExtension(34);
- public static final Block WOOL = (new BlockCloth(35, Material.CLOTH)).c(0.8F).a(n).c("cloth").d("wool_colored");
- public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
- public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37)).c(0.0F).a(j).c("flower").d("flower_dandelion");
- public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38)).c(0.0F).a(j).c("rose").d("flower_rose");
- public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39)).c(0.0F).a(j).a(0.125F).c("mushroom").d("mushroom_brown");
- public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40)).c(0.0F).a(j).c("mushroom").d("mushroom_red");
- public static final Block GOLD_BLOCK = (new BlockOreBlock(41)).c(3.0F).b(10.0F).a(l).c("blockGold").d("gold_block");
- public static final Block IRON_BLOCK = (new BlockOreBlock(42)).c(5.0F).b(10.0F).a(l).c("blockIron").d("iron_block");
- public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(k).c("stoneSlab");
- public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(k).c("stoneSlab");
- public static final Block BRICK = (new Block(45, Material.STONE)).c(2.0F).b(10.0F).a(k).c("brick").a(CreativeModeTab.b).d("brick");
- public static final Block TNT = (new BlockTNT(46)).c(0.0F).a(j).c("tnt").d("tnt");
- public static final Block BOOKSHELF = (new BlockBookshelf(47)).c(1.5F).a(h).c("bookshelf").d("bookshelf");
- public static final Block MOSSY_COBBLESTONE = (new Block(48, Material.STONE)).c(2.0F).b(10.0F).a(k).c("stoneMoss").a(CreativeModeTab.b).d("cobblestone_mossy");
- public static final Block OBSIDIAN = (new BlockObsidian(49)).c(50.0F).b(2000.0F).a(k).c("obsidian").d("obsidian");
- public static final Block TORCH = (new BlockTorch(50)).c(0.0F).a(0.9375F).a(h).c("torch").d("torch_on");
- public static final BlockFire FIRE = (BlockFire) (new BlockFire(51)).c(0.0F).a(1.0F).a(h).c("fire").C().d("fire");
- public static final Block MOB_SPAWNER = (new BlockMobSpawner(52)).c(5.0F).a(l).c("mobSpawner").C().d("mob_spawner");
- public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).c("stairsWood");
- public static final BlockChest CHEST = (BlockChest) (new BlockChest(54, 0)).c(2.5F).a(h).c("chest");
- public static final BlockRedstoneWire REDSTONE_WIRE = (BlockRedstoneWire) (new BlockRedstoneWire(55)).c(0.0F).a(g).c("redstoneDust").C().d("redstone_dust");
- public static final Block DIAMOND_ORE = (new BlockOre(56)).c(3.0F).b(5.0F).a(k).c("oreDiamond").d("diamond_ore");
- public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57)).c(5.0F).b(10.0F).a(l).c("blockDiamond").d("diamond_block");
- public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(h).c("workbench").d("crafting_table");
- public static final Block CROPS = (new BlockCrops(59)).c("crops").d("wheat");
- public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(i).c("farmland").d("farmland");
- public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(k).c("furnace").a(CreativeModeTab.c);
- public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(k).a(0.875F).c("furnace");
- public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(h).c("sign").C();
- public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(h).c("doorWood").C().d("door_wood");
- public static final Block LADDER = (new BlockLadder(65)).c(0.4F).a(q).c("ladder").d("ladder");
- public static final Block RAILS = (new BlockMinecartTrack(66)).c(0.7F).a(l).c("rail").d("rail_normal");
- public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).c("stairsStone");
- public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(h).c("sign").C();
- public static final Block LEVER = (new BlockLever(69)).c(0.5F).a(h).c("lever").d("lever");
- public static final Block STONE_PLATE = (new BlockPressurePlateBinary(70, "stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(k).c("pressurePlate");
- public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(l).c("doorIron").C().d("door_iron");
- public static final Block WOOD_PLATE = (new BlockPressurePlateBinary(72, "planks_oak", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(h).c("pressurePlate");
- public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, false)).c(3.0F).b(5.0F).a(k).c("oreRedstone").a(CreativeModeTab.b).d("redstone_ore");
- public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, true)).a(0.625F).c(3.0F).b(5.0F).a(k).c("oreRedstone").d("redstone_ore");
- public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, false)).c(0.0F).a(h).c("notGate").d("redstone_torch_off");
- public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, true)).c(0.0F).a(0.5F).a(h).c("notGate").a(CreativeModeTab.d).d("redstone_torch_on");
- public static final Block STONE_BUTTON = (new BlockStoneButton(77)).c(0.5F).a(k).c("button");
- public static final Block SNOW = (new BlockSnow(78)).c(0.1F).a(p).c("snow").k(0).d("snow");
- public static final Block ICE = (new BlockIce(79)).c(0.5F).k(3).a(m).c("ice").d("ice");
- public static final Block SNOW_BLOCK = (new BlockSnowBlock(80)).c(0.2F).a(p).c("snow").d("snow");
- public static final Block CACTUS = (new BlockCactus(81)).c(0.4F).a(n).c("cactus").d("cactus");
- public static final Block CLAY = (new BlockClay(82)).c(0.6F).a(i).c("clay").d("clay");
- public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83)).c(0.0F).a(j).c("reeds").C().d("reeds");
- public static final Block JUKEBOX = (new BlockJukeBox(84)).c(2.0F).b(10.0F).a(k).c("jukebox").d("jukebox");
- public static final Block FENCE = (new BlockFence(85, "planks_oak", Material.WOOD)).c(2.0F).b(5.0F).a(h).c("fence");
- public static final Block PUMPKIN = (new BlockPumpkin(86, false)).c(1.0F).a(h).c("pumpkin").d("pumpkin");
- public static final Block NETHERRACK = (new BlockBloodStone(87)).c(0.4F).a(k).c("hellrock").d("netherrack");
- public static final Block SOUL_SAND = (new BlockSlowSand(88)).c(0.5F).a(o).c("hellsand").d("soul_sand");
- public static final Block GLOWSTONE = (new BlockLightStone(89, Material.SHATTERABLE)).c(0.3F).a(m).a(1.0F).c("lightgem").d("glowstone");
- public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90)).c(-1.0F).a(m).a(0.75F).c("portal").d("portal");
- public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, true)).c(1.0F).a(h).a(1.0F).c("litpumpkin").d("pumpkin");
- public static final Block CAKE_BLOCK = (new BlockCake(92)).c(0.5F).a(n).c("cake").C().d("cake");
- public static final BlockRepeater DIODE_OFF = (BlockRepeater) (new BlockRepeater(93, false)).c(0.0F).a(h).c("diode").C().d("repeater_off");
- public static final BlockRepeater DIODE_ON = (BlockRepeater) (new BlockRepeater(94, true)).c(0.0F).a(0.625F).a(h).c("diode").C().d("repeater_on");
- public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(h).c("lockedchest").b(true);
- public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(h).c("trapdoor").C().d("trapdoor");
- public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).c("monsterStoneEgg");
- public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(k).c("stonebricksmooth").d("stonebrick");
- public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 0)).c(0.2F).a(h).c("mushroom").d("mushroom_block");
- public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 1)).c(0.2F).a(h).c("mushroom").d("mushroom_block");
- public static final Block IRON_FENCE = (new BlockThinFence(101, "iron_bars", "iron_bars", Material.ORE, true)).c(5.0F).b(10.0F).a(l).c("fenceIron");
- public static final Block THIN_GLASS = (new BlockThinFence(102, "glass", "glass_pane_top", Material.SHATTERABLE, false)).c(0.3F).a(m).c("thinGlass");
- public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(h).c("melon").d("melon");
- public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(h).c("pumpkinStem").d("pumpkin_stem");
- public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(h).c("pumpkinStem").d("melon_stem");
- public static final Block VINE = (new BlockVine(106)).c(0.2F).a(j).c("vine").d("vine");
- public static final Block FENCE_GATE = (new BlockFenceGate(107)).c(2.0F).b(5.0F).a(h).c("fenceGate");
- public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).c("stairsBrick");
- public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).c("stairsStoneBrickSmooth");
- public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(j).c("mycel").d("mycelium");
- public static final Block WATER_LILY = (new BlockWaterLily(111)).c(0.0F).a(j).c("waterlily").d("waterlily");
- public static final Block NETHER_BRICK = (new Block(112, Material.STONE)).c(2.0F).b(10.0F).a(k).c("netherBrick").a(CreativeModeTab.b).d("nether_brick");
- public static final Block NETHER_FENCE = (new BlockFence(113, "nether_brick", Material.STONE)).c(2.0F).b(10.0F).a(k).c("netherFence");
- public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).c("stairsNetherBrick");
- public static final Block NETHER_WART = (new BlockNetherWart(115)).c("netherStalk").d("nether_wart");
- public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).c("enchantmentTable").d("enchanting_table");
- public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).c("brewingStand").d("brewing_stand");
- public static final BlockCauldron CAULDRON = (BlockCauldron) (new BlockCauldron(118)).c(2.0F).c("cauldron").d("cauldron");
- 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(m).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c).d("endframe");
- public static final Block WHITESTONE = (new Block(121, Material.STONE)).c(3.0F).b(15.0F).a(k).c("whiteStone").a(CreativeModeTab.b).d("end_stone");
- public static final Block DRAGON_EGG = (new BlockDragonEgg(122)).c(3.0F).b(15.0F).a(k).a(0.125F).c("dragonEgg").d("dragon_egg");
- public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(m).c("redstoneLight").a(CreativeModeTab.d).d("redstone_lamp_off");
- public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(m).c("redstoneLight").d("redstone_lamp_on");
- public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(h).c("woodSlab");
- public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(h).c("woodSlab");
- public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(h).c("cocoa").d("cocoa");
- public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).c("stairsSandStone");
- public static final Block EMERALD_ORE = (new BlockOre(129)).c(3.0F).b(5.0F).a(k).c("oreEmerald").d("emerald_ore");
- public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(k).c("enderChest").a(0.5F);
- public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).c("tripWireSource").d("trip_wire_source");
- public static final Block TRIPWIRE = (new BlockTripwire(132)).c("tripWire").d("trip_wire");
- public static final Block EMERALD_BLOCK = (new BlockOreBlock(133)).c(5.0F).b(10.0F).a(l).c("blockEmerald").d("emerald_block");
- public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).c("stairsWoodSpruce");
- public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).c("stairsWoodBirch");
- public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).c("stairsWoodJungle");
- public static final Block COMMAND = (new BlockCommand(137)).r().b(6000000.0F).c("commandBlock").d("command_block");
- public static final BlockBeacon BEACON = (BlockBeacon) (new BlockBeacon(138)).c("beacon").a(1.0F).d("beacon");
- public static final Block COBBLE_WALL = (new BlockCobbleWall(139, COBBLESTONE)).c("cobbleWall");
- public static final Block FLOWER_POT = (new BlockFlowerPot(140)).c(0.0F).a(g).c("flowerPot").d("flower_pot");
- public static final Block CARROTS = (new BlockCarrots(141)).c("carrots").d("carrots");
- public static final Block POTATOES = (new BlockPotatoes(142)).c("potatoes").d("potatoes");
- public static final Block WOOD_BUTTON = (new BlockWoodButton(143)).c(0.5F).a(h).c("button");
- public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(k).c("skull").d("skull");
- public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(r).b(2000.0F).c("anvil");
- public static final Block TRAPPED_CHEST = (new BlockChest(146, 1)).c(2.5F).a(h).c("chestTrap");
- public static final Block GOLD_PLATE = (new BlockPressurePlateWeighted(147, "gold_block", Material.ORE, 64)).c(0.5F).a(h).c("weightedPlate_light");
- public static final Block IRON_PLATE = (new BlockPressurePlateWeighted(148, "iron_block", Material.ORE, 640)).c(0.5F).a(h).c("weightedPlate_heavy");
- public static final BlockRedstoneComparator REDSTONE_COMPARATOR_OFF = (BlockRedstoneComparator) (new BlockRedstoneComparator(149, false)).c(0.0F).a(h).c("comparator").C().d("comparator_off");
- public static final BlockRedstoneComparator REDSTONE_COMPARATOR_ON = (BlockRedstoneComparator) (new BlockRedstoneComparator(150, true)).c(0.0F).a(0.625F).a(h).c("comparator").C().d("comparator_on");
- public static final BlockDaylightDetector DAYLIGHT_DETECTOR = (BlockDaylightDetector) (new BlockDaylightDetector(151)).c(0.2F).a(h).c("daylightDetector").d("daylight_detector");
- public static final Block REDSTONE_BLOCK = (new BlockRedstone(152)).c(5.0F).b(10.0F).a(l).c("blockRedstone").d("redstone_block");
- public static final Block QUARTZ_ORE = (new BlockOre(153)).c(3.0F).b(5.0F).a(k).c("netherquartz").d("quartz_ore");
- public static final BlockHopper HOPPER = (BlockHopper) (new BlockHopper(154)).c(3.0F).b(8.0F).a(h).c("hopper").d("hopper");
- public static final Block QUARTZ_BLOCK = (new BlockQuartz(155)).a(k).c(0.8F).c("quartzBlock").d("quartz_block");
- public static final Block QUARTZ_STAIRS = (new BlockStairs(156, QUARTZ_BLOCK, 0)).c("stairsQuartz");
- public static final Block ACTIVATOR_RAIL = (new BlockPoweredRail(157)).c(0.7F).a(l).c("activatorRail").d("rail_activator");
- public static final Block DROPPER = (new BlockDropper(158)).c(3.5F).a(k).c("dropper").d("dropper");
- public static final Block STAINED_HARDENED_CLAY = (new BlockCloth(159, Material.STONE)).c(1.25F).b(7.0F).a(k).c("clayHardenedStained").d("hardened_clay_stained");
- public static final Block HAY_BLOCK = (new BlockHay(170)).c(0.5F).a(j).c("hayBlock").a(CreativeModeTab.b).d("hay_block");
- public static final Block WOOL_CARPET = (new BlockCarpet(171)).c(0.1F).a(n).c("woolCarpet").k(0);
- public static final Block HARDENED_CLAY = (new Block(172, Material.STONE)).c(1.25F).b(7.0F).a(k).c("clayHardened").a(CreativeModeTab.b).d("hardened_clay");
- public static final Block COAL_BLOCK = (new Block(173, Material.STONE)).c(5.0F).b(10.0F).a(k).c("blockCoal").a(CreativeModeTab.b).d("coal_block");
- public final int id;
+ protected String d;
+ public static final StepSound e = new StepSound("stone", 1.0F, 1.0F);
+ public static final StepSound f = new StepSound("wood", 1.0F, 1.0F);
+ public static final StepSound g = new StepSound("gravel", 1.0F, 1.0F);
+ public static final StepSound h = new StepSound("grass", 1.0F, 1.0F);
+ public static final StepSound i = new StepSound("stone", 1.0F, 1.0F);
+ public static final StepSound j = new StepSound("stone", 1.0F, 1.5F);
+ public static final StepSound k = new StepSoundStone("stone", 1.0F, 1.0F);
+ public static final StepSound l = new StepSound("cloth", 1.0F, 1.0F);
+ public static final StepSound m = new StepSound("sand", 1.0F, 1.0F);
+ public static final StepSound n = new StepSound("snow", 1.0F, 1.0F);
+ public static final StepSound o = new StepSoundLadder("ladder", 1.0F, 1.0F);
+ public static final StepSound p = new StepSoundAnvil("anvil", 0.3F, 1.0F);
+ protected boolean q;
+ protected int r;
+ protected boolean s;
+ protected int t;
+ protected boolean u;
protected float strength;
protected float durability;
- protected boolean cI = true;
- protected boolean cJ = true;
- protected boolean cK;
+ protected boolean x = true;
+ protected boolean y = true;
+ protected boolean z;
protected boolean isTileEntity;
protected double minX;
protected double minY;
@@ -202,42 +39,298 @@ public class Block {
protected double maxY;
protected double maxZ;
public StepSound stepSound;
- public float cT;
- public final Material material;
+ public float I;
+ protected final Material material;
public float frictionFactor;
private String name;
- protected Block(int i, Material material) {
- this.stepSound = g;
- this.cT = 1.0F;
- this.frictionFactor = 0.6F;
- if (byId[i] != null) {
- throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
+ public static int b(Block block) {
+ return REGISTRY.b(block);
+ }
+
+ public static Block e(int i) {
+ return (Block) REGISTRY.a(i);
+ }
+
+ public static Block a(Item item) {
+ return e(Item.b(item));
+ }
+
+ public static Block b(String s) {
+ if (REGISTRY.b(s)) {
+ return (Block) REGISTRY.a(s);
} else {
- this.material = material;
- byId[i] = this;
- this.id = i;
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- t[i] = this.c();
- lightBlock[i] = this.c() ? 255 : 0;
- v[i] = !material.blocksLight();
+ try {
+ return (Block) REGISTRY.a(Integer.parseInt(s));
+ } catch (NumberFormatException numberformatexception) {
+ return null;
+ }
}
}
- protected void s_() {}
+ public boolean j() {
+ return this.q;
+ }
+
+ public int k() {
+ return this.r;
+ }
+
+ public int m() {
+ return this.t;
+ }
+
+ public boolean n() {
+ return this.u;
+ }
+
+ public Material getMaterial() {
+ return this.material;
+ }
+
+ public MaterialMapColor f(int i) {
+ return this.getMaterial().r();
+ }
+
+ public static void p() {
+ REGISTRY.a(0, "air", (new BlockAir()).c("air"));
+ REGISTRY.a(1, "stone", (new BlockStone()).c(1.5F).b(10.0F).a(i).c("stone").d("stone"));
+ REGISTRY.a(2, "grass", (new BlockGrass()).c(0.6F).a(h).c("grass").d("grass"));
+ REGISTRY.a(3, "dirt", (new BlockDirt()).c(0.5F).a(g).c("dirt").d("dirt"));
+ Block block = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("stonebrick").a(CreativeModeTab.b).d("cobblestone");
+
+ REGISTRY.a(4, "cobblestone", block);
+ Block block1 = (new BlockWood()).c(2.0F).b(5.0F).a(f).c("wood").d("planks");
+
+ REGISTRY.a(5, "planks", block1);
+ REGISTRY.a(6, "sapling", (new BlockSapling()).c(0.0F).a(h).c("sapling").d("sapling"));
+ REGISTRY.a(7, "bedrock", (new Block(Material.STONE)).s().b(6000000.0F).a(i).c("bedrock").H().a(CreativeModeTab.b).d("bedrock"));
+ REGISTRY.a(8, "flowing_water", (new BlockFlowing(Material.WATER)).c(100.0F).g(3).c("water").H().d("water_flow"));
+ REGISTRY.a(9, "water", (new BlockStationary(Material.WATER)).c(100.0F).g(3).c("water").H().d("water_still"));
+ REGISTRY.a(10, "flowing_lava", (new BlockFlowing(Material.LAVA)).c(100.0F).a(1.0F).c("lava").H().d("lava_flow"));
+ REGISTRY.a(11, "lava", (new BlockStationary(Material.LAVA)).c(100.0F).a(1.0F).c("lava").H().d("lava_still"));
+ REGISTRY.a(12, "sand", (new BlockSand()).c(0.5F).a(m).c("sand").d("sand"));
+ REGISTRY.a(13, "gravel", (new BlockGravel()).c(0.6F).a(g).c("gravel").d("gravel"));
+ REGISTRY.a(14, "gold_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreGold").d("gold_ore"));
+ REGISTRY.a(15, "iron_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreIron").d("iron_ore"));
+ REGISTRY.a(16, "coal_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreCoal").d("coal_ore"));
+ REGISTRY.a(17, "log", (new BlockLog1()).c("log").d("log"));
+ REGISTRY.a(18, "leaves", (new BlockLeaves1()).c("leaves").d("leaves"));
+ REGISTRY.a(19, "sponge", (new BlockSponge()).c(0.6F).a(h).c("sponge").d("sponge"));
+ REGISTRY.a(20, "glass", (new BlockGlass(Material.SHATTERABLE, false)).c(0.3F).a(k).c("glass").d("glass"));
+ REGISTRY.a(21, "lapis_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreLapis").d("lapis_ore"));
+ REGISTRY.a(22, "lapis_block", (new BlockOreBlock(MaterialMapColor.H)).c(3.0F).b(5.0F).a(i).c("blockLapis").a(CreativeModeTab.b).d("lapis_block"));
+ REGISTRY.a(23, "dispenser", (new BlockDispenser()).c(3.5F).a(i).c("dispenser").d("dispenser"));
+ Block block2 = (new BlockSandStone()).a(i).c(0.8F).c("sandStone").d("sandstone");
+
+ REGISTRY.a(24, "sandstone", block2);
+ REGISTRY.a(25, "noteblock", (new BlockNote()).c(0.8F).c("musicBlock").d("noteblock"));
+ REGISTRY.a(26, "bed", (new BlockBed()).c(0.2F).c("bed").H().d("bed"));
+ REGISTRY.a(27, "golden_rail", (new BlockPoweredRail()).c(0.7F).a(j).c("goldenRail").d("rail_golden"));
+ REGISTRY.a(28, "detector_rail", (new BlockMinecartDetector()).c(0.7F).a(j).c("detectorRail").d("rail_detector"));
+ REGISTRY.a(29, "sticky_piston", (new BlockPiston(true)).c("pistonStickyBase"));
+ REGISTRY.a(30, "web", (new BlockWeb()).g(1).c(4.0F).c("web").d("web"));
+ REGISTRY.a(31, "tallgrass", (new BlockLongGrass()).c(0.0F).a(h).c("tallgrass"));
+ REGISTRY.a(32, "deadbush", (new BlockDeadBush()).c(0.0F).a(h).c("deadbush").d("deadbush"));
+ REGISTRY.a(33, "piston", (new BlockPiston(false)).c("pistonBase"));
+ REGISTRY.a(34, "piston_head", new BlockPistonExtension());
+ REGISTRY.a(35, "wool", (new BlockCloth(Material.CLOTH)).c(0.8F).a(l).c("cloth").d("wool_colored"));
+ REGISTRY.a(36, "piston_extension", new BlockPistonMoving());
+ REGISTRY.a(37, "yellow_flower", (new BlockFlowers(0)).c(0.0F).a(h).c("flower1").d("flower_dandelion"));
+ REGISTRY.a(38, "red_flower", (new BlockFlowers(1)).c(0.0F).a(h).c("flower2").d("flower_rose"));
+ REGISTRY.a(39, "brown_mushroom", (new BlockMushroom()).c(0.0F).a(h).a(0.125F).c("mushroom").d("mushroom_brown"));
+ REGISTRY.a(40, "red_mushroom", (new BlockMushroom()).c(0.0F).a(h).c("mushroom").d("mushroom_red"));
+ REGISTRY.a(41, "gold_block", (new BlockOreBlock(MaterialMapColor.F)).c(3.0F).b(10.0F).a(j).c("blockGold").d("gold_block"));
+ REGISTRY.a(42, "iron_block", (new BlockOreBlock(MaterialMapColor.h)).c(5.0F).b(10.0F).a(j).c("blockIron").d("iron_block"));
+ REGISTRY.a(43, "double_stone_slab", (new BlockStep(true)).c(2.0F).b(10.0F).a(i).c("stoneSlab"));
+ REGISTRY.a(44, "stone_slab", (new BlockStep(false)).c(2.0F).b(10.0F).a(i).c("stoneSlab"));
+ Block block3 = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("brick").a(CreativeModeTab.b).d("brick");
+
+ REGISTRY.a(45, "brick_block", block3);
+ REGISTRY.a(46, "tnt", (new BlockTNT()).c(0.0F).a(h).c("tnt").d("tnt"));
+ REGISTRY.a(47, "bookshelf", (new BlockBookshelf()).c(1.5F).a(f).c("bookshelf").d("bookshelf"));
+ REGISTRY.a(48, "mossy_cobblestone", (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("stoneMoss").a(CreativeModeTab.b).d("cobblestone_mossy"));
+ REGISTRY.a(49, "obsidian", (new BlockObsidian()).c(50.0F).b(2000.0F).a(i).c("obsidian").d("obsidian"));
+ REGISTRY.a(50, "torch", (new BlockTorch()).c(0.0F).a(0.9375F).a(f).c("torch").d("torch_on"));
+ REGISTRY.a(51, "fire", (new BlockFire()).c(0.0F).a(1.0F).a(f).c("fire").H().d("fire"));
+ REGISTRY.a(52, "mob_spawner", (new BlockMobSpawner()).c(5.0F).a(j).c("mobSpawner").H().d("mob_spawner"));
+ REGISTRY.a(53, "oak_stairs", (new BlockStairs(block1, 0)).c("stairsWood"));
+ REGISTRY.a(54, "chest", (new BlockChest(0)).c(2.5F).a(f).c("chest"));
+ REGISTRY.a(55, "redstone_wire", (new BlockRedstoneWire()).c(0.0F).a(e).c("redstoneDust").H().d("redstone_dust"));
+ REGISTRY.a(56, "diamond_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreDiamond").d("diamond_ore"));
+ REGISTRY.a(57, "diamond_block", (new BlockOreBlock(MaterialMapColor.G)).c(5.0F).b(10.0F).a(j).c("blockDiamond").d("diamond_block"));
+ REGISTRY.a(58, "crafting_table", (new BlockWorkbench()).c(2.5F).a(f).c("workbench").d("crafting_table"));
+ REGISTRY.a(59, "wheat", (new BlockCrops()).c("crops").d("wheat"));
+ Block block4 = (new BlockSoil()).c(0.6F).a(g).c("farmland").d("farmland");
+
+ REGISTRY.a(60, "farmland", block4);
+ REGISTRY.a(61, "furnace", (new BlockFurnace(false)).c(3.5F).a(i).c("furnace").a(CreativeModeTab.c));
+ REGISTRY.a(62, "lit_furnace", (new BlockFurnace(true)).c(3.5F).a(i).a(0.875F).c("furnace"));
+ REGISTRY.a(63, "standing_sign", (new BlockSign(TileEntitySign.class, true)).c(1.0F).a(f).c("sign").H());
+ REGISTRY.a(64, "wooden_door", (new BlockDoor(Material.WOOD)).c(3.0F).a(f).c("doorWood").H().d("door_wood"));
+ REGISTRY.a(65, "ladder", (new BlockLadder()).c(0.4F).a(o).c("ladder").d("ladder"));
+ REGISTRY.a(66, "rail", (new BlockMinecartTrack()).c(0.7F).a(j).c("rail").d("rail_normal"));
+ REGISTRY.a(67, "stone_stairs", (new BlockStairs(block, 0)).c("stairsStone"));
+ REGISTRY.a(68, "wall_sign", (new BlockSign(TileEntitySign.class, false)).c(1.0F).a(f).c("sign").H());
+ REGISTRY.a(69, "lever", (new BlockLever()).c(0.5F).a(f).c("lever").d("lever"));
+ REGISTRY.a(70, "stone_pressure_plate", (new BlockPressurePlateBinary("stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(i).c("pressurePlate"));
+ REGISTRY.a(71, "iron_door", (new BlockDoor(Material.ORE)).c(5.0F).a(j).c("doorIron").H().d("door_iron"));
+ REGISTRY.a(72, "wooden_pressure_plate", (new BlockPressurePlateBinary("planks_oak", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(f).c("pressurePlate"));
+ REGISTRY.a(73, "redstone_ore", (new BlockRedstoneOre(false)).c(3.0F).b(5.0F).a(i).c("oreRedstone").a(CreativeModeTab.b).d("redstone_ore"));
+ REGISTRY.a(74, "lit_redstone_ore", (new BlockRedstoneOre(true)).a(0.625F).c(3.0F).b(5.0F).a(i).c("oreRedstone").d("redstone_ore"));
+ REGISTRY.a(75, "unlit_redstone_torch", (new BlockRedstoneTorch(false)).c(0.0F).a(f).c("notGate").d("redstone_torch_off"));
+ REGISTRY.a(76, "redstone_torch", (new BlockRedstoneTorch(true)).c(0.0F).a(0.5F).a(f).c("notGate").a(CreativeModeTab.d).d("redstone_torch_on"));
+ REGISTRY.a(77, "stone_button", (new BlockStoneButton()).c(0.5F).a(i).c("button"));
+ REGISTRY.a(78, "snow_layer", (new BlockSnow()).c(0.1F).a(n).c("snow").g(0).d("snow"));
+ REGISTRY.a(79, "ice", (new BlockIce()).c(0.5F).g(3).a(k).c("ice").d("ice"));
+ REGISTRY.a(80, "snow", (new BlockSnowBlock()).c(0.2F).a(n).c("snow").d("snow"));
+ REGISTRY.a(81, "cactus", (new BlockCactus()).c(0.4F).a(l).c("cactus").d("cactus"));
+ REGISTRY.a(82, "clay", (new BlockClay()).c(0.6F).a(g).c("clay").d("clay"));
+ REGISTRY.a(83, "reeds", (new BlockReed()).c(0.0F).a(h).c("reeds").H().d("reeds"));
+ REGISTRY.a(84, "jukebox", (new BlockJukeBox()).c(2.0F).b(10.0F).a(i).c("jukebox").d("jukebox"));
+ REGISTRY.a(85, "fence", (new BlockFence("planks_oak", Material.WOOD)).c(2.0F).b(5.0F).a(f).c("fence"));
+ Block block5 = (new BlockPumpkin(false)).c(1.0F).a(f).c("pumpkin").d("pumpkin");
+
+ REGISTRY.a(86, "pumpkin", block5);
+ REGISTRY.a(87, "netherrack", (new BlockBloodStone()).c(0.4F).a(i).c("hellrock").d("netherrack"));
+ REGISTRY.a(88, "soul_sand", (new BlockSlowSand()).c(0.5F).a(m).c("hellsand").d("soul_sand"));
+ REGISTRY.a(89, "glowstone", (new BlockLightStone(Material.SHATTERABLE)).c(0.3F).a(k).a(1.0F).c("lightgem").d("glowstone"));
+ REGISTRY.a(90, "portal", (new BlockPortal()).c(-1.0F).a(k).a(0.75F).c("portal").d("portal"));
+ REGISTRY.a(91, "lit_pumpkin", (new BlockPumpkin(true)).c(1.0F).a(f).a(1.0F).c("litpumpkin").d("pumpkin"));
+ REGISTRY.a(92, "cake", (new BlockCake()).c(0.5F).a(l).c("cake").H().d("cake"));
+ REGISTRY.a(93, "unpowered_repeater", (new BlockRepeater(false)).c(0.0F).a(f).c("diode").H().d("repeater_off"));
+ REGISTRY.a(94, "powered_repeater", (new BlockRepeater(true)).c(0.0F).a(0.625F).a(f).c("diode").H().d("repeater_on"));
+ REGISTRY.a(95, "stained_glass", (new BlockStainedGlass(Material.SHATTERABLE)).c(0.3F).a(k).c("stainedGlass").d("glass"));
+ REGISTRY.a(96, "trapdoor", (new BlockTrapdoor(Material.WOOD)).c(3.0F).a(f).c("trapdoor").H().d("trapdoor"));
+ REGISTRY.a(97, "monster_egg", (new BlockMonsterEggs()).c(0.75F).c("monsterStoneEgg"));
+ Block block6 = (new BlockSmoothBrick()).c(1.5F).b(10.0F).a(i).c("stonebricksmooth").d("stonebrick");
+
+ REGISTRY.a(98, "stonebrick", block6);
+ REGISTRY.a(99, "brown_mushroom_block", (new BlockHugeMushroom(Material.WOOD, 0)).c(0.2F).a(f).c("mushroom").d("mushroom_block"));
+ REGISTRY.a(100, "red_mushroom_block", (new BlockHugeMushroom(Material.WOOD, 1)).c(0.2F).a(f).c("mushroom").d("mushroom_block"));
+ REGISTRY.a(101, "iron_bars", (new BlockThin("iron_bars", "iron_bars", Material.ORE, true)).c(5.0F).b(10.0F).a(j).c("fenceIron"));
+ REGISTRY.a(102, "glass_pane", (new BlockThin("glass", "glass_pane_top", Material.SHATTERABLE, false)).c(0.3F).a(k).c("thinGlass"));
+ Block block7 = (new BlockMelon()).c(1.0F).a(f).c("melon").d("melon");
+
+ REGISTRY.a(103, "melon_block", block7);
+ REGISTRY.a(104, "pumpkin_stem", (new BlockStem(block5)).c(0.0F).a(f).c("pumpkinStem").d("pumpkin_stem"));
+ REGISTRY.a(105, "melon_stem", (new BlockStem(block7)).c(0.0F).a(f).c("pumpkinStem").d("melon_stem"));
+ REGISTRY.a(106, "vine", (new BlockVine()).c(0.2F).a(h).c("vine").d("vine"));
+ REGISTRY.a(107, "fence_gate", (new BlockFenceGate()).c(2.0F).b(5.0F).a(f).c("fenceGate"));
+ REGISTRY.a(108, "brick_stairs", (new BlockStairs(block3, 0)).c("stairsBrick"));
+ REGISTRY.a(109, "stone_brick_stairs", (new BlockStairs(block6, 0)).c("stairsStoneBrickSmooth"));
+ REGISTRY.a(110, "mycelium", (new BlockMycel()).c(0.6F).a(h).c("mycel").d("mycelium"));
+ REGISTRY.a(111, "waterlily", (new BlockWaterLily()).c(0.0F).a(h).c("waterlily").d("waterlily"));
+ Block block8 = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("netherBrick").a(CreativeModeTab.b).d("nether_brick");
+
+ REGISTRY.a(112, "nether_brick", block8);
+ REGISTRY.a(113, "nether_brick_fence", (new BlockFence("nether_brick", Material.STONE)).c(2.0F).b(10.0F).a(i).c("netherFence"));
+ REGISTRY.a(114, "nether_brick_stairs", (new BlockStairs(block8, 0)).c("stairsNetherBrick"));
+ REGISTRY.a(115, "nether_wart", (new BlockNetherWart()).c("netherStalk").d("nether_wart"));
+ REGISTRY.a(116, "enchanting_table", (new BlockEnchantmentTable()).c(5.0F).b(2000.0F).c("enchantmentTable").d("enchanting_table"));
+ REGISTRY.a(117, "brewing_stand", (new BlockBrewingStand()).c(0.5F).a(0.125F).c("brewingStand").d("brewing_stand"));
+ REGISTRY.a(118, "cauldron", (new BlockCauldron()).c(2.0F).c("cauldron").d("cauldron"));
+ REGISTRY.a(119, "end_portal", (new BlockEnderPortal(Material.PORTAL)).c(-1.0F).b(6000000.0F));
+ REGISTRY.a(120, "end_portal_frame", (new BlockEnderPortalFrame()).a(k).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c).d("endframe"));
+ REGISTRY.a(121, "end_stone", (new Block(Material.STONE)).c(3.0F).b(15.0F).a(i).c("whiteStone").a(CreativeModeTab.b).d("end_stone"));
+ REGISTRY.a(122, "dragon_egg", (new BlockDragonEgg()).c(3.0F).b(15.0F).a(i).a(0.125F).c("dragonEgg").d("dragon_egg"));
+ REGISTRY.a(123, "redstone_lamp", (new BlockRedstoneLamp(false)).c(0.3F).a(k).c("redstoneLight").a(CreativeModeTab.d).d("redstone_lamp_off"));
+ REGISTRY.a(124, "lit_redstone_lamp", (new BlockRedstoneLamp(true)).c(0.3F).a(k).c("redstoneLight").d("redstone_lamp_on"));
+ REGISTRY.a(125, "double_wooden_slab", (new BlockWoodStep(true)).c(2.0F).b(5.0F).a(f).c("woodSlab"));
+ REGISTRY.a(126, "wooden_slab", (new BlockWoodStep(false)).c(2.0F).b(5.0F).a(f).c("woodSlab"));
+ REGISTRY.a(127, "cocoa", (new BlockCocoa()).c(0.2F).b(5.0F).a(f).c("cocoa").d("cocoa"));
+ REGISTRY.a(128, "sandstone_stairs", (new BlockStairs(block2, 0)).c("stairsSandStone"));
+ REGISTRY.a(129, "emerald_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreEmerald").d("emerald_ore"));
+ REGISTRY.a(130, "ender_chest", (new BlockEnderChest()).c(22.5F).b(1000.0F).a(i).c("enderChest").a(0.5F));
+ REGISTRY.a(131, "tripwire_hook", (new BlockTripwireHook()).c("tripWireSource").d("trip_wire_source"));
+ REGISTRY.a(132, "tripwire", (new BlockTripwire()).c("tripWire").d("trip_wire"));
+ REGISTRY.a(133, "emerald_block", (new BlockOreBlock(MaterialMapColor.I)).c(5.0F).b(10.0F).a(j).c("blockEmerald").d("emerald_block"));
+ REGISTRY.a(134, "spruce_stairs", (new BlockStairs(block1, 1)).c("stairsWoodSpruce"));
+ REGISTRY.a(135, "birch_stairs", (new BlockStairs(block1, 2)).c("stairsWoodBirch"));
+ REGISTRY.a(136, "jungle_stairs", (new BlockStairs(block1, 3)).c("stairsWoodJungle"));
+ REGISTRY.a(137, "command_block", (new BlockCommand()).s().b(6000000.0F).c("commandBlock").d("command_block"));
+ REGISTRY.a(138, "beacon", (new BlockBeacon()).c("beacon").a(1.0F).d("beacon"));
+ REGISTRY.a(139, "cobblestone_wall", (new BlockCobbleWall(block)).c("cobbleWall"));
+ REGISTRY.a(140, "flower_pot", (new BlockFlowerPot()).c(0.0F).a(e).c("flowerPot").d("flower_pot"));
+ REGISTRY.a(141, "carrots", (new BlockCarrots()).c("carrots").d("carrots"));
+ REGISTRY.a(142, "potatoes", (new BlockPotatoes()).c("potatoes").d("potatoes"));
+ REGISTRY.a(143, "wooden_button", (new BlockWoodButton()).c(0.5F).a(f).c("button"));
+ REGISTRY.a(144, "skull", (new BlockSkull()).c(1.0F).a(i).c("skull").d("skull"));
+ REGISTRY.a(145, "anvil", (new BlockAnvil()).c(5.0F).a(p).b(2000.0F).c("anvil"));
+ REGISTRY.a(146, "trapped_chest", (new BlockChest(1)).c(2.5F).a(f).c("chestTrap"));
+ REGISTRY.a(147, "light_weighted_pressure_plate", (new BlockPressurePlateWeighted("gold_block", Material.ORE, 15)).c(0.5F).a(f).c("weightedPlate_light"));
+ REGISTRY.a(148, "heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted("iron_block", Material.ORE, 150)).c(0.5F).a(f).c("weightedPlate_heavy"));
+ REGISTRY.a(149, "unpowered_comparator", (new BlockRedstoneComparator(false)).c(0.0F).a(f).c("comparator").H().d("comparator_off"));
+ REGISTRY.a(150, "powered_comparator", (new BlockRedstoneComparator(true)).c(0.0F).a(0.625F).a(f).c("comparator").H().d("comparator_on"));
+ REGISTRY.a(151, "daylight_detector", (new BlockDaylightDetector()).c(0.2F).a(f).c("daylightDetector").d("daylight_detector"));
+ REGISTRY.a(152, "redstone_block", (new BlockRedstone(MaterialMapColor.f)).c(5.0F).b(10.0F).a(j).c("blockRedstone").d("redstone_block"));
+ REGISTRY.a(153, "quartz_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("netherquartz").d("quartz_ore"));
+ REGISTRY.a(154, "hopper", (new BlockHopper()).c(3.0F).b(8.0F).a(f).c("hopper").d("hopper"));
+ Block block9 = (new BlockQuartz()).a(i).c(0.8F).c("quartzBlock").d("quartz_block");
+
+ REGISTRY.a(155, "quartz_block", block9);
+ REGISTRY.a(156, "quartz_stairs", (new BlockStairs(block9, 0)).c("stairsQuartz"));
+ REGISTRY.a(157, "activator_rail", (new BlockPoweredRail()).c(0.7F).a(j).c("activatorRail").d("rail_activator"));
+ REGISTRY.a(158, "dropper", (new BlockDropper()).c(3.5F).a(i).c("dropper").d("dropper"));
+ REGISTRY.a(159, "stained_hardened_clay", (new BlockCloth(Material.STONE)).c(1.25F).b(7.0F).a(i).c("clayHardenedStained").d("hardened_clay_stained"));
+ REGISTRY.a(160, "stained_glass_pane", (new BlockStainedGlassPane()).c(0.3F).a(k).c("thinStainedGlass").d("glass"));
+ REGISTRY.a(161, "leaves2", (new BlockLeaves2()).c("leaves").d("leaves"));
+ REGISTRY.a(162, "log2", (new BlockLog2()).c("log").d("log"));
+ REGISTRY.a(163, "acacia_stairs", (new BlockStairs(block1, 4)).c("stairsWoodAcacia"));
+ REGISTRY.a(164, "dark_oak_stairs", (new BlockStairs(block1, 5)).c("stairsWoodDarkOak"));
+ REGISTRY.a(170, "hay_block", (new BlockHay()).c(0.5F).a(h).c("hayBlock").a(CreativeModeTab.b).d("hay_block"));
+ REGISTRY.a(171, "carpet", (new BlockCarpet()).c(0.1F).a(l).c("woolCarpet").g(0));
+ REGISTRY.a(172, "hardened_clay", (new BlockHardenedClay()).c(1.25F).b(7.0F).a(i).c("clayHardened").d("hardened_clay"));
+ REGISTRY.a(173, "coal_block", (new Block(Material.STONE)).c(5.0F).b(10.0F).a(i).c("blockCoal").a(CreativeModeTab.b).d("coal_block"));
+ REGISTRY.a(174, "packed_ice", (new BlockPackedIce()).c(0.5F).a(k).c("icePacked").d("ice_packed"));
+ REGISTRY.a(175, "double_plant", new BlockTallPlant());
+ Iterator iterator = REGISTRY.iterator();
+
+ while (iterator.hasNext()) {
+ Block block10 = (Block) iterator.next();
+
+ if (block10.material == Material.AIR) {
+ block10.u = false;
+ } else {
+ boolean flag = false;
+ boolean flag1 = block10.b() == 10;
+ boolean flag2 = block10 instanceof BlockStepAbstract;
+ boolean flag3 = block10 == block4;
+ boolean flag4 = block10.s;
+ boolean flag5 = block10.r == 0;
+
+ if (flag1 || flag2 || flag3 || flag4 || flag5) {
+ flag = true;
+ }
+
+ block10.u = flag;
+ }
+ }
+ }
+
+ protected Block(Material material) {
+ this.stepSound = e;
+ this.I = 1.0F;
+ this.frictionFactor = 0.6F;
+ this.material = material;
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ this.q = this.c();
+ this.r = this.c() ? 255 : 0;
+ this.s = !material.blocksLight();
+ }
protected Block a(StepSound stepsound) {
this.stepSound = stepsound;
return this;
}
- protected Block k(int i) {
- lightBlock[this.id] = i;
+ protected Block g(int i) {
+ this.r = i;
return this;
}
protected Block a(float f) {
- lightEmission[this.id] = (int) (15.0F * f);
+ this.t = (int) (15.0F * f);
return this;
}
@@ -246,13 +339,11 @@ public class Block {
return this;
}
- public static boolean l(int i) {
- Block block = byId[i];
-
- return block == null ? false : block.material.k() && block.b() && !block.isPowerSource();
+ public boolean r() {
+ return this.material.k() && this.d() && !this.isPowerSource();
}
- public boolean b() {
+ public boolean d() {
return true;
}
@@ -260,7 +351,7 @@ public class Block {
return !this.material.isSolid();
}
- public int d() {
+ public int b() {
return 0;
}
@@ -273,25 +364,25 @@ public class Block {
return this;
}
- protected Block r() {
+ protected Block s() {
this.c(-1.0F);
return this;
}
- public float l(World world, int i, int j, int k) {
+ public float f(World world, int i, int j, int k) {
return this.strength;
}
- protected Block b(boolean flag) {
- this.cK = flag;
+ protected Block a(boolean flag) {
+ this.z = flag;
return this;
}
public boolean isTicking() {
- return this.cK;
+ return this.z;
}
- public boolean t() {
+ public boolean isTileEntity() {
return this.isTileEntity;
}
@@ -304,19 +395,19 @@ public class Block {
this.maxZ = (double) f5;
}
- public boolean a_(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return iblockaccess.getMaterial(i, j, k).isBuildable();
+ public boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return iblockaccess.getType(i, j, k).getMaterial().isBuildable();
}
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
- AxisAlignedBB axisalignedbb1 = this.b(world, i, j, k);
+ AxisAlignedBB axisalignedbb1 = this.a(world, i, j, k);
if (axisalignedbb1 != null && axisalignedbb.b(axisalignedbb1)) {
list.add(axisalignedbb1);
}
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
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);
}
@@ -325,10 +416,10 @@ public class Block {
}
public boolean a(int i, boolean flag) {
- return this.m();
+ return this.v();
}
- public boolean m() {
+ public boolean v() {
return true;
}
@@ -336,7 +427,7 @@ public class Block {
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 void doPhysics(World world, int i, int j, int k, Block block) {}
public int a(World world) {
return 10;
@@ -344,23 +435,23 @@ public class Block {
public void onPlace(World world, int i, int j, int k) {}
- public void remove(World world, int i, int j, int k, int l, int i1) {}
+ public void remove(World world, int i, int j, int k, Block block, int l) {}
public int a(Random random) {
return 1;
}
- public int getDropType(int i, Random random, int j) {
- return this.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Item.getItemOf(this);
}
public float getDamage(EntityHuman entityhuman, World world, int i, int j, int k) {
- float f = this.l(world, i, j, k);
+ float f = this.f(world, i, j, k);
return f < 0.0F ? 0.0F : (!entityhuman.a(this) ? entityhuman.a(this, false) / f / 100.0F : entityhuman.a(this, true) / f / 30.0F);
}
- public final void c(World world, int i, int j, int k, int l, int i1) {
+ public final void b(World world, int i, int j, int k, int l, int i1) {
this.dropNaturally(world, i, j, k, l, 1.0F, i1);
}
@@ -371,17 +462,17 @@ public class Block {
for (int k1 = 0; k1 < j1; ++k1) {
// CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
if (world.random.nextFloat() < f) {
- int l1 = this.getDropType(l, world.random, i1);
+ Item item = this.getDropType(l, world.random, i1);
- if (l1 > 0) {
- this.b(world, i, j, k, new ItemStack(l1, 1, this.getDropData(l)));
+ if (item != null) {
+ this.a(world, i, j, k, new ItemStack(item, 1, this.getDropData(l)));
}
}
}
}
}
- protected void b(World world, int i, int j, int k, ItemStack itemstack) {
+ protected void a(World world, int i, int j, int k, ItemStack itemstack) {
if (!world.isStatic && world.getGameRules().getBoolean("doTileDrops")) {
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
@@ -394,7 +485,7 @@ public class Block {
}
}
- protected void j(World world, int i, int j, int k, int l) {
+ protected void dropExperience(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
while (l > 0) {
int i1 = EntityExperienceOrb.getOrbValue(l);
@@ -530,9 +621,7 @@ 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.isReplaceable();
+ return world.getType(i, j, k).material.isReplaceable();
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
@@ -551,27 +640,27 @@ public class Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {}
- public final double u() {
+ public final double x() {
return this.minX;
}
- public final double v() {
+ public final double y() {
return this.maxX;
}
- public final double w() {
+ public final double z() {
return this.minY;
}
- public final double x() {
+ public final double A() {
return this.maxY;
}
- public final double y() {
+ public final double B() {
return this.minZ;
}
- public final double z() {
+ public final double C() {
return this.maxZ;
}
@@ -592,40 +681,41 @@ public class Block {
public void g() {}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- entityhuman.a(StatisticList.C[this.id], 1);
+ entityhuman.a(StatisticList.C[b(this)], 1);
entityhuman.a(0.025F);
- if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
- ItemStack itemstack = this.d_(l);
+ if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
+ ItemStack itemstack = this.j(l);
if (itemstack != null) {
- this.b(world, i, j, k, itemstack);
+ this.a(world, i, j, k, itemstack);
}
} else {
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
- this.c(world, i, j, k, l, i1);
+ this.b(world, i, j, k, l, i1);
}
}
- protected boolean r_() {
- return this.b() && !this.isTileEntity;
+ protected boolean E() {
+ return this.d() && !this.isTileEntity;
}
- protected ItemStack d_(int i) {
+ protected ItemStack j(int i) {
int j = 0;
+ Item item = Item.getItemOf(this);
- if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].n()) {
+ if (item != null && item.n()) {
j = i;
}
- return new ItemStack(this.id, 1, j);
+ return new ItemStack(item, 1, j);
}
public int getDropCount(int i, Random random) {
return this.a(random);
}
- public boolean f(World world, int i, int j, int k) {
+ public boolean j(World world, int i, int j, int k) {
return true;
}
@@ -646,16 +736,16 @@ public class Block {
return "tile." + this.name;
}
- public boolean b(World world, int i, int j, int k, int l, int i1) {
+ public boolean a(World world, int i, int j, int k, int l, int i1) {
return false;
}
- public boolean B() {
- return this.cJ;
+ public boolean G() {
+ return this.y;
}
- protected Block C() {
- this.cJ = false;
+ protected Block H() {
+ this.y = false;
return this;
}
@@ -676,11 +766,11 @@ public class Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
- public void l(World world, int i, int j, int k, int l) {}
+ public void f(World world, int i, int j, int k, int l) {}
- public void g(World world, int i, int j, int k) {}
+ public void l(World world, int i, int j, int k) {}
- public boolean l() {
+ public boolean L() {
return true;
}
@@ -688,94 +778,27 @@ public class Block {
return true;
}
- public boolean i(int i) {
- return this.id == i;
+ public boolean c(Block block) {
+ return this == block;
}
- public static boolean b(int i, int j) {
- return i == j ? true : (i != 0 && j != 0 && byId[i] != null && byId[j] != null ? byId[i].i(j) : false);
+ public static boolean a(Block block, Block block1) {
+ return block != null && block1 != null ? (block == block1 ? true : block.c(block1)) : false;
}
- public boolean q_() {
+ public boolean M() {
return false;
}
- public int b_(World world, int i, int j, int k, int l) {
+ public int g(World world, int i, int j, int k, int l) {
return 0;
}
protected Block d(String s) {
- this.f = s;
+ this.d = s;
return this;
}
- static {
- Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
- Item.byId[STAINED_HARDENED_CLAY.id] = (new ItemCloth(STAINED_HARDENED_CLAY.id - 256)).b("clayHardenedStained");
- Item.byId[WOOL_CARPET.id] = (new ItemCloth(WOOL_CARPET.id - 256)).b("woolCarpet");
- Item.byId[LOG.id] = (new ItemMultiTexture(LOG.id - 256, LOG, BlockLog.b)).b("log");
- Item.byId[WOOD.id] = (new ItemMultiTexture(WOOD.id - 256, WOOD, BlockWood.a)).b("wood");
- Item.byId[MONSTER_EGGS.id] = (new ItemMultiTexture(MONSTER_EGGS.id - 256, MONSTER_EGGS, BlockMonsterEggs.a)).b("monsterStoneEgg");
- Item.byId[SMOOTH_BRICK.id] = (new ItemMultiTexture(SMOOTH_BRICK.id - 256, SMOOTH_BRICK, BlockSmoothBrick.a)).b("stonebricksmooth");
- Item.byId[SANDSTONE.id] = (new ItemMultiTexture(SANDSTONE.id - 256, SANDSTONE, BlockSandStone.a)).b("sandStone");
- Item.byId[QUARTZ_BLOCK.id] = (new ItemMultiTexture(QUARTZ_BLOCK.id - 256, QUARTZ_BLOCK, BlockQuartz.a)).b("quartzBlock");
- 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 ItemMultiTexture(SAPLING.id - 256, SAPLING, BlockSapling.a)).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[SNOW.id] = new ItemSnow(SNOW.id - 256, SNOW);
- 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[COBBLE_WALL.id] = (new ItemMultiTexture(COBBLE_WALL.id - 256, COBBLE_WALL, BlockCobbleWall.a)).b("cobbleWall");
- Item.byId[ANVIL.id] = (new ItemAnvil(ANVIL)).b("anvil");
- // CraftBukkit start
- Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, true);
- Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, true);
- Item.byId[MOB_SPAWNER.id] = new ItemWithAuxData(MOB_SPAWNER.id - 256, true);
- // CraftBukkit end
-
- 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].s_();
- }
-
- boolean flag = false;
-
- if (i > 0 && byId[i].d() == 10) {
- flag = true;
- }
-
- if (i > 0 && byId[i] instanceof BlockStepAbstract) {
- flag = true;
- }
-
- if (i == SOIL.id) {
- flag = true;
- }
-
- if (v[i]) {
- flag = true;
- }
-
- if (lightBlock[i] == 0) {
- flag = true;
- }
-
- x[i] = flag;
- }
- }
-
- v[0] = true;
- StatisticList.b();
- }
-
// CraftBukkit start
public int getExpDrop(World world, int data, int enchantmentLevel) {
return 0;
diff --git a/src/main/java/net/minecraft/server/BlockBloodStone.java b/src/main/java/net/minecraft/server/BlockBloodStone.java
index 91be87e1bf..f10f9dda42 100644
--- a/src/main/java/net/minecraft/server/BlockBloodStone.java
+++ b/src/main/java/net/minecraft/server/BlockBloodStone.java
@@ -4,14 +4,18 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockBloodStone extends Block {
- public BlockBloodStone(int i) {
- super(i, Material.STONE);
+ public BlockBloodStone() {
+ super(Material.STONE);
this.a(CreativeModeTab.b);
}
+ public MaterialMapColor f(int i) {
+ return MaterialMapColor.K;
+ }
+
// CraftBukkit start
public void doPhysics(World world, int i, int j, int k, int l) {
- if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
+ if (net.minecraft.server.Block.e(l) != null && net.minecraft.server.Block.e(l).isPowerSource()) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
int power = block.getBlockPower();
diff --git a/src/main/java/net/minecraft/server/BlockButtonAbstract.java b/src/main/java/net/minecraft/server/BlockButtonAbstract.java
index bdc48ffd43..bb358850f9 100644
--- a/src/main/java/net/minecraft/server/BlockButtonAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockButtonAbstract.java
@@ -12,14 +12,14 @@ public abstract class BlockButtonAbstract extends Block {
private final boolean a;
- protected BlockButtonAbstract(int i, boolean flag) {
- super(i, Material.ORIENTABLE);
- this.b(true);
+ protected BlockButtonAbstract(boolean flag) {
+ super(Material.ORIENTABLE);
+ this.a(true);
this.a(CreativeModeTab.d);
this.a = flag;
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -31,16 +31,16 @@ public abstract class BlockButtonAbstract extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)));
+ return l == 2 && world.getType(i, j, k + 1).r() ? true : (l == 3 && world.getType(i, j, k - 1).r() ? true : (l == 4 && world.getType(i + 1, j, k).r() ? true : l == 5 && world.getType(i - 1, j, k).r()));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : world.u(i, j, k + 1)));
+ return world.getType(i - 1, j, k).r() ? true : (world.getType(i + 1, j, k).r() ? true : (world.getType(i, j, k - 1).r() ? true : world.getType(i, j, k + 1).r()));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@@ -48,48 +48,48 @@ public abstract class BlockButtonAbstract extends Block {
int k1 = j1 & 8;
j1 &= 7;
- if (l == 2 && world.u(i, j, k + 1)) {
+ if (l == 2 && world.getType(i, j, k + 1).r()) {
j1 = 4;
- } else if (l == 3 && world.u(i, j, k - 1)) {
+ } else if (l == 3 && world.getType(i, j, k - 1).r()) {
j1 = 3;
- } else if (l == 4 && world.u(i + 1, j, k)) {
+ } else if (l == 4 && world.getType(i + 1, j, k).r()) {
j1 = 2;
- } else if (l == 5 && world.u(i - 1, j, k)) {
+ } else if (l == 5 && world.getType(i - 1, j, k).r()) {
j1 = 1;
} else {
- j1 = this.k(world, i, j, k);
+ j1 = this.e(world, i, j, k);
}
return j1 + k1;
}
- private int k(World world, int i, int j, int k) {
- return world.u(i - 1, j, k) ? 1 : (world.u(i + 1, j, k) ? 2 : (world.u(i, j, k - 1) ? 3 : (world.u(i, j, k + 1) ? 4 : 1)));
+ private int e(World world, int i, int j, int k) {
+ return world.getType(i - 1, j, k).r() ? 1 : (world.getType(i + 1, j, k).r() ? 2 : (world.getType(i, j, k - 1).r() ? 3 : (world.getType(i, j, k + 1).r() ? 4 : 1)));
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
if (this.m(world, i, j, k)) {
- int i1 = world.getData(i, j, k) & 7;
+ int l = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.u(i - 1, j, k) && i1 == 1) {
+ if (!world.getType(i - 1, j, k).r() && l == 1) {
flag = true;
}
- if (!world.u(i + 1, j, k) && i1 == 2) {
+ if (!world.getType(i + 1, j, k).r() && l == 2) {
flag = true;
}
- if (!world.u(i, j, k - 1) && i1 == 3) {
+ if (!world.getType(i, j, k - 1).r() && l == 3) {
flag = true;
}
- if (!world.u(i, j, k + 1) && i1 == 4) {
+ if (!world.getType(i, j, k + 1).r() && l == 4) {
flag = true;
}
if (flag) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
@@ -97,7 +97,7 @@ public abstract class BlockButtonAbstract extends Block {
private boolean m(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@@ -108,10 +108,10 @@ public abstract class BlockButtonAbstract extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- this.d(l);
+ this.b(l);
}
- private void d(int i) {
+ private void b(int i) {
int j = i & 7;
boolean flag = (i & 8) > 0;
float f = 0.375F;
@@ -158,22 +158,22 @@ public abstract class BlockButtonAbstract extends Block {
// CraftBukkit end
world.setData(i, j, k, j1 + k1, 3);
- world.g(i, j, k, i, j, k);
+ world.c(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);
- this.d(world, i, j, k, j1);
- world.a(i, j, k, this.id, this.a(world));
+ this.a(world, i, j, k, j1);
+ world.a(i, j, k, this, this.a(world));
return true;
}
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
- if ((i1 & 8) > 0) {
- int j1 = i1 & 7;
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ if ((l & 8) > 0) {
+ int i1 = l & 7;
- this.d(world, i, j, k, j1);
+ this.a(world, i, j, k, i1);
}
- super.remove(world, i, j, k, l, i1);
+ super.remove(world, i, j, k, block, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@@ -218,9 +218,9 @@ public abstract class BlockButtonAbstract extends Block {
world.setData(i, j, k, l & 7, 3);
int i1 = l & 7;
- this.d(world, i, j, k, i1);
+ this.a(world, i, j, k, i1);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
- world.g(i, j, k, i, j, k);
+ world.c(i, j, k, i, j, k);
}
}
}
@@ -249,7 +249,7 @@ public abstract class BlockButtonAbstract extends Block {
int i1 = l & 7;
boolean flag = (l & 8) != 0;
- this.d(l);
+ this.b(l);
List list = world.a(EntityArrow.class, 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));
boolean flag1 = !list.isEmpty();
@@ -279,35 +279,35 @@ public abstract class BlockButtonAbstract extends Block {
if (flag1 && !flag) {
world.setData(i, j, k, i1 | 8, 3);
- this.d(world, i, j, k, i1);
- world.g(i, j, k, i, j, k);
+ this.a(world, i, j, k, i1);
+ world.c(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);
}
if (!flag1 && flag) {
world.setData(i, j, k, i1, 3);
- this.d(world, i, j, k, i1);
- world.g(i, j, k, i, j, k);
+ this.a(world, i, j, k, i1);
+ world.c(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.5F);
}
if (flag1) {
- world.a(i, j, k, this.id, this.a(world));
+ world.a(i, j, k, this, this.a(world));
}
}
- private void d(World world, int i, int j, int k, int l) {
- world.applyPhysics(i, j, k, this.id);
+ private void a(World world, int i, int j, int k, int l) {
+ world.applyPhysics(i, j, k, this);
if (l == 1) {
- world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this);
} else if (l == 2) {
- world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this);
} else if (l == 3) {
- world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this);
} else if (l == 4) {
- world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this);
} else {
- world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this);
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index 03eece78f1..421af0449d 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -6,9 +6,9 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent; // CraftBukkit
public class BlockCactus extends Block {
- protected BlockCactus(int i) {
- super(i, Material.CACTUS);
- this.b(true);
+ protected BlockCactus() {
+ super(Material.CACTUS);
+ this.a(true);
this.a(CreativeModeTab.c);
}
@@ -16,7 +16,7 @@ public class BlockCactus extends Block {
if (world.isEmpty(i, j + 1, k)) {
int l;
- for (l = 1; world.getTypeId(i, j - l, k) == this.id; ++l) {
+ for (l = 1; world.getType(i, j - l, k) == this; ++l) {
;
}
@@ -24,9 +24,9 @@ public class BlockCactus extends Block {
int i1 = world.getData(i, j, k);
if (i1 == 15) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
world.setData(i, j, k, 0, 4);
- this.doPhysics(world, i, j + 1, k, this.id);
+ this.doPhysics(world, i, j + 1, k, this);
} else {
world.setData(i, j, k, i1 + 1, 4);
}
@@ -34,13 +34,13 @@ public class BlockCactus extends Block {
}
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
float f = 0.0625F;
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 boolean b() {
+ public boolean d() {
return false;
}
@@ -48,33 +48,33 @@ public class BlockCactus extends Block {
return false;
}
- public int d() {
+ 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.j(world, i, j, k);
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.f(world, i, j, k)) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!this.j(world, i, j, k)) {
world.setAir(i, j, k, true);
}
}
- public boolean f(World world, int i, int j, int k) {
- if (world.getMaterial(i - 1, j, k).isBuildable()) {
+ public boolean j(World world, int i, int j, int k) {
+ if (world.getType(i - 1, j, k).getMaterial().isBuildable()) {
return false;
- } else if (world.getMaterial(i + 1, j, k).isBuildable()) {
+ } else if (world.getType(i + 1, j, k).getMaterial().isBuildable()) {
return false;
- } else if (world.getMaterial(i, j, k - 1).isBuildable()) {
+ } else if (world.getType(i, j, k - 1).getMaterial().isBuildable()) {
return false;
- } else if (world.getMaterial(i, j, k + 1).isBuildable()) {
+ } else if (world.getType(i, j, k + 1).getMaterial().isBuildable()) {
return false;
} else {
- int l = world.getTypeId(i, j - 1, k);
+ Block block = world.getType(i, j - 1, k);
- return l == Block.CACTUS.id || l == Block.SAND.id;
+ return block == Blocks.CACTUS || block == Blocks.SAND;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCake.java b/src/main/java/net/minecraft/server/BlockCake.java
index 2c850b8a44..df2ae3225b 100644
--- a/src/main/java/net/minecraft/server/BlockCake.java
+++ b/src/main/java/net/minecraft/server/BlockCake.java
@@ -4,9 +4,9 @@ import java.util.Random;
public class BlockCake extends Block {
- protected BlockCake(int i) {
- super(i, Material.CAKE);
- this.b(true);
+ protected BlockCake() {
+ super(Material.CAKE);
+ this.a(true);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
@@ -25,7 +25,7 @@ public class BlockCake extends Block {
this.a(f, 0.0F, f, 1.0F - f, f1, 1.0F - f);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
float f = 0.0625F;
float f1 = (float) (1 + l * 2) / 16.0F;
@@ -34,7 +34,7 @@ public class BlockCake extends Block {
return AxisAlignedBB.a().a((double) ((float) i + f1), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) j + f2 - f), (double) ((float) (k + 1) - f));
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -55,14 +55,14 @@ public class BlockCake extends Block {
if (entityhuman.g(false)) {
// CraftBukkit start
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
-
+
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, 2 + oldFoodLevel);
-
+
if (!event.isCancelled()) {
entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 0.1F);
}
-
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet8UpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
+
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
// CraftBukkit end
int l = world.getData(i, j, k) + 1;
@@ -75,24 +75,24 @@ public class BlockCake extends Block {
}
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.j(world, i, j, k);
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.f(world, i, j, k)) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!this.j(world, i, j, k)) {
world.setAir(i, j, k);
}
}
- public boolean f(World world, int i, int j, int k) {
- return world.getMaterial(i, j - 1, k).isBuildable();
+ public boolean j(World world, int i, int j, int k) {
+ return world.getType(i, j - 1, k).getMaterial().isBuildable();
}
public int a(Random random) {
return 0;
}
- public int getDropType(int i, Random random, int j) {
- return 0;
+ public Item getDropType(int i, Random random, int j) {
+ return null;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCocoa.java b/src/main/java/net/minecraft/server/BlockCocoa.java
index 2ed2bdab35..7084c880cc 100644
--- a/src/main/java/net/minecraft/server/BlockCocoa.java
+++ b/src/main/java/net/minecraft/server/BlockCocoa.java
@@ -2,45 +2,44 @@ package net.minecraft.server;
import java.util.Random;
-public class BlockCocoa extends BlockDirectional {
+public class BlockCocoa extends BlockDirectional implements IBlockFragilePlantElement {
- public static final String[] a = new String[] { "cocoa_0", "cocoa_1", "cocoa_2"};
-
- public BlockCocoa(int i) {
- super(i, Material.PLANT);
- this.b(true);
+ public BlockCocoa() {
+ super(Material.PLANT);
+ this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
- if (!this.f(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeIdAndData(i, j, k, 0, 0, 2);
+ if (!this.j(world, i, j, k)) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setTypeAndData(i, j, k, e(0), 0, 2);
} else if (world.random.nextInt(5) == 0) {
int l = world.getData(i, j, k);
int i1 = c(l);
if (i1 < 2) {
++i1;
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, i1 << 2 | j(l)); // CraftBukkit
+ // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, i1 << 2 | l(l));
}
}
}
- public boolean f(World world, int i, int j, int k) {
- int l = j(world.getData(i, j, k));
+ public boolean j(World world, int i, int j, int k) {
+ int l = l(world.getData(i, j, k));
i += Direction.a[l];
k += Direction.b[l];
- int i1 = world.getTypeId(i, j, k);
+ Block block = world.getType(i, j, k);
- return i1 == Block.LOG.id && BlockLog.f(world.getData(i, j, k)) == 3;
+ return block == Blocks.LOG && BlockLogAbstract.c(world.getData(i, j, k)) == 3;
}
- public int d() {
+ public int b() {
return 28;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -48,14 +47,14 @@ public class BlockCocoa extends BlockDirectional {
return false;
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.b(world, i, j, k);
+ return super.a(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- int i1 = j(l);
+ int i1 = l(l);
int j1 = c(l);
int k1 = 4 + j1 * 2;
int l1 = 5 + j1 * 2;
@@ -93,10 +92,10 @@ public class BlockCocoa extends BlockDirectional {
return Direction.f[Direction.e[l]];
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.f(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeIdAndData(i, j, k, 0, 0, 2);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!this.j(world, i, j, k)) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setTypeAndData(i, j, k, e(0), 0, 2);
}
}
@@ -113,11 +112,31 @@ public class BlockCocoa extends BlockDirectional {
}
for (int k1 = 0; k1 < b0; ++k1) {
- this.b(world, i, j, k, new ItemStack(Item.INK_SACK, 1, 3));
+ this.a(world, i, j, k, new ItemStack(Items.INK_SACK, 1, 3));
}
}
public int getDropData(World world, int i, int j, int k) {
return 3;
}
+
+ public boolean a(World world, int i, int j, int k, boolean flag) {
+ int l = world.getData(i, j, k);
+ int i1 = c(l);
+
+ return i1 < 2;
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ return true;
+ }
+
+ public void b(World world, Random random, int i, int j, int k) {
+ int l = world.getData(i, j, k);
+ int i1 = BlockDirectional.l(l);
+ int j1 = c(l);
+
+ ++j1;
+ world.setData(i, j, k, j1 << 2 | i1, 2);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java
index d5b2df7e57..b09f23b744 100644
--- a/src/main/java/net/minecraft/server/BlockCommand.java
+++ b/src/main/java/net/minecraft/server/BlockCommand.java
@@ -6,34 +6,34 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockCommand extends BlockContainer {
- public BlockCommand(int i) {
- super(i, Material.ORE);
+ public BlockCommand() {
+ super(Material.ORE);
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntityCommand();
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
boolean flag = world.isBlockIndirectlyPowered(i, j, k);
- int i1 = world.getData(i, j, k);
- boolean flag1 = (i1 & 1) != 0;
+ int l = world.getData(i, j, k);
+ boolean flag1 = (l & 1) != 0;
// CraftBukkit start
- org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
int old = flag1 ? 15 : 0;
int current = flag ? 15 : 0;
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
// CraftBukkit end
if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
- world.setData(i, j, k, i1 | 1, 4);
- world.a(i, j, k, this.id, this.a(world));
+ world.setData(i, j, k, l | 1, 4);
+ world.a(i, j, k, this, this.a(world));
} else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
- world.setData(i, j, k, i1 & -2, 4);
+ world.setData(i, j, k, l & -2, 4);
}
}
}
@@ -42,10 +42,10 @@ public class BlockCommand extends BlockContainer {
TileEntity tileentity = world.getTileEntity(i, j, k);
if (tileentity != null && tileentity instanceof TileEntityCommand) {
- TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
+ CommandBlockListenerAbstract commandblocklistenerabstract = ((TileEntityCommand) tileentity).a();
- tileentitycommand.a(tileentitycommand.a(world));
- world.m(i, j, k, this.id);
+ commandblocklistenerabstract.a(world);
+ world.f(i, j, k, this);
}
}
@@ -63,21 +63,21 @@ public class BlockCommand extends BlockContainer {
return true;
}
- public boolean q_() {
+ public boolean M() {
return true;
}
- public int b_(World world, int i, int j, int k, int l) {
+ public int g(World world, int i, int j, int k, int l) {
TileEntity tileentity = world.getTileEntity(i, j, k);
- return tileentity != null && tileentity instanceof TileEntityCommand ? ((TileEntityCommand) tileentity).f() : 0;
+ return tileentity != null && tileentity instanceof TileEntityCommand ? ((TileEntityCommand) tileentity).a().g() : 0;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
TileEntityCommand tileentitycommand = (TileEntityCommand) world.getTileEntity(i, j, k);
if (itemstack.hasName()) {
- tileentitycommand.b(itemstack.getName());
+ tileentitycommand.a().b(itemstack.getName());
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
index e157fbef89..942d6ab203 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -2,22 +2,21 @@ package net.minecraft.server;
import java.util.Random;
-public class BlockCrops extends BlockFlower {
+public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
- protected BlockCrops(int i) {
- super(i);
- this.b(true);
+ protected BlockCrops() {
+ this.a(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);
this.c(0.0F);
- this.a(j);
- this.C();
+ this.a(h);
+ this.H();
}
- protected boolean g_(int i) {
- return i == Block.SOIL.id;
+ protected boolean a(Block block) {
+ return block == Blocks.SOIL;
}
public void a(World world, int i, int j, int k, Random random) {
@@ -26,16 +25,17 @@ public class BlockCrops extends BlockFlower {
int l = world.getData(i, j, k);
if (l < 7) {
- float f = this.k(world, i, j, k);
+ float f = this.n(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
+ ++l;
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
}
}
}
}
- public void e_(World world, int i, int j, int k) {
+ public void m(World world, int i, int j, int k) {
int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
if (l > 7) {
@@ -45,33 +45,32 @@ public class BlockCrops extends BlockFlower {
world.setData(i, j, k, l, 2);
}
- private float k(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);
- int j1 = world.getTypeId(i - 1, j, k);
- int k1 = world.getTypeId(i + 1, j, k);
- int l1 = world.getTypeId(i - 1, j, k - 1);
- int i2 = world.getTypeId(i + 1, j, k - 1);
- int j2 = world.getTypeId(i + 1, j, k + 1);
- int k2 = world.getTypeId(i - 1, j, k + 1);
- boolean flag = j1 == this.id || k1 == this.id;
- boolean flag1 = l == this.id || i1 == this.id;
- boolean flag2 = l1 == this.id || i2 == this.id || j2 == this.id || k2 == this.id;
+ Block block = world.getType(i, j, k - 1);
+ Block block1 = world.getType(i, j, k + 1);
+ Block block2 = world.getType(i - 1, j, k);
+ Block block3 = world.getType(i + 1, j, k);
+ Block block4 = world.getType(i - 1, j, k - 1);
+ Block block5 = world.getType(i + 1, j, k - 1);
+ Block block6 = world.getType(i + 1, j, k + 1);
+ Block block7 = world.getType(i - 1, j, k + 1);
+ boolean flag = block2 == this || block3 == this;
+ boolean flag1 = block == this || block1 == this;
+ boolean flag2 = block4 == this || block5 == this || block6 == this || block7 == this;
- for (int l2 = i - 1; l2 <= i + 1; ++l2) {
- for (int i3 = k - 1; i3 <= k + 1; ++i3) {
- int j3 = world.getTypeId(l2, j - 1, i3);
+ for (int l = i - 1; l <= i + 1; ++l) {
+ for (int i1 = k - 1; i1 <= k + 1; ++i1) {
float f1 = 0.0F;
- if (j3 == Block.SOIL.id) {
+ if (world.getType(l, j - 1, i1) == Blocks.SOIL) {
f1 = 1.0F;
- if (world.getData(l2, j - 1, i3) > 0) {
+ if (world.getData(l, j - 1, i1) > 0) {
f1 = 3.0F;
}
}
- if (l2 != i || i3 != k) {
+ if (l != i || i1 != k) {
f1 /= 4.0F;
}
@@ -86,16 +85,16 @@ public class BlockCrops extends BlockFlower {
return f;
}
- public int d() {
+ public int b() {
return 6;
}
- protected int j() {
- return Item.SEEDS.id;
+ protected Item i() {
+ return Items.SEEDS;
}
- protected int k() {
- return Item.WHEAT.id;
+ protected Item P() {
+ return Items.WHEAT;
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
@@ -106,18 +105,30 @@ public class BlockCrops extends BlockFlower {
for (int k1 = 0; k1 < j1; ++k1) {
if (world.random.nextInt(15) <= l) {
- this.b(world, i, j, k, new ItemStack(this.j(), 1, 0));
+ this.a(world, i, j, k, new ItemStack(this.i(), 1, 0));
}
}
}
}
}
- public int getDropType(int i, Random random, int j) {
- return i == 7 ? this.k() : this.j();
+ public Item getDropType(int i, Random random, int j) {
+ return i == 7 ? this.P() : this.i();
}
public int a(Random random) {
return 1;
}
+
+ public boolean a(World world, int i, int j, int k, boolean flag) {
+ return world.getData(i, j, k) != 7;
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ return true;
+ }
+
+ public void b(World world, Random random, int i, int j, int k) {
+ this.m(world, i, j, k);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
index 9a62eb7ebb..96e9c37e3a 100644
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
@@ -6,8 +6,8 @@ public class BlockDaylightDetector extends BlockContainer {
private IIcon[] a = new IIcon[2];
- public BlockDaylightDetector(int i) {
- super(i, Material.WOOD);
+ public BlockDaylightDetector() {
+ super(Material.WOOD);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F);
this.a(CreativeModeTab.d);
}
@@ -22,11 +22,11 @@ public class BlockDaylightDetector extends BlockContainer {
public void a(World world, int i, int j, int k, Random random) {}
- public void doPhysics(World world, int i, int j, int k, int l) {}
+ public void doPhysics(World world, int i, int j, int k, Block block) {}
public void onPlace(World world, int i, int j, int k) {}
- public void i_(World world, int i, int j, int k) {
+ public void e(World world, int i, int j, int k) {
if (!world.worldProvider.g) {
int l = world.getData(i, j, k);
int i1 = world.b(EnumSkyBlock.SKY, i, j, k) - world.j;
@@ -54,7 +54,7 @@ public class BlockDaylightDetector extends BlockContainer {
}
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -66,7 +66,7 @@ public class BlockDaylightDetector extends BlockContainer {
return true;
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntityLightDetector();
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
index 6d205d9180..474c011770 100644
--- a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
@@ -8,29 +8,29 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
protected final boolean a;
- protected BlockDiodeAbstract(int i, boolean flag) {
- super(i, Material.ORIENTABLE);
+ protected BlockDiodeAbstract(boolean flag) {
+ super(Material.ORIENTABLE);
this.a = flag;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
- public boolean b() {
+ public boolean d() {
return false;
}
public boolean canPlace(World world, int i, int j, int k) {
- return !world.w(i, j - 1, k) ? false : super.canPlace(world, i, j, k);
+ return !World.a((IBlockAccess) world, i, j - 1, k) ? false : super.canPlace(world, i, j, k);
}
- public boolean f(World world, int i, int j, int k) {
- return !world.w(i, j - 1, k) ? false : super.f(world, i, j, k);
+ public boolean j(World world, int i, int j, int k) {
+ return !World.a((IBlockAccess) world, i, j - 1, k) ? false : super.j(world, i, j, k);
}
public void a(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
- if (!this.e((IBlockAccess) world, i, j, k, l)) {
- boolean flag = this.d(world, i, j, k, l);
+ if (!this.g((IBlockAccess) world, i, j, k, l)) { // CraftBukkit - Cast world to IBlockAccess to call the right method.
+ boolean flag = this.a(world, i, j, k, l);
if (this.a && !flag) {
// CraftBukkit start
@@ -39,7 +39,7 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, this.j().id, l, 2);
+ world.setTypeAndData(i, j, k, this.i(), l, 2);
} else if (!this.a) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
@@ -47,15 +47,15 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, this.i().id, l, 2);
+ world.setTypeAndData(i, j, k, this.e(), l, 2);
if (!flag) {
- world.a(i, j, k, this.i().id, this.h(l), -1);
+ world.a(i, j, k, this.e(), this.k(l), -1);
}
}
}
}
- public int d() {
+ public int b() {
return 36;
}
@@ -73,85 +73,85 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
if (!this.c(i1)) {
return 0;
} else {
- int j1 = j(i1);
+ int j1 = l(i1);
- return j1 == 0 && l == 3 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 1 && l == 4 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 2 && l == 2 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 3 && l == 5 ? this.d(iblockaccess, i, j, k, i1) : 0)));
+ return j1 == 0 && l == 3 ? this.f(iblockaccess, i, j, k, i1) : (j1 == 1 && l == 4 ? this.f(iblockaccess, i, j, k, i1) : (j1 == 2 && l == 2 ? this.f(iblockaccess, i, j, k, i1) : (j1 == 3 && l == 5 ? this.f(iblockaccess, i, j, k, i1) : 0)));
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.f(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!this.j(world, i, j, k)) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i - 1, j, k, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
+ world.applyPhysics(i + 1, j, k, this);
+ world.applyPhysics(i - 1, j, k, this);
+ world.applyPhysics(i, j, k + 1, this);
+ world.applyPhysics(i, j, k - 1, this);
+ world.applyPhysics(i, j - 1, k, this);
+ world.applyPhysics(i, j + 1, k, this);
} else {
- this.f(world, i, j, k, l);
+ this.b(world, i, j, k, block);
}
}
- protected void f(World world, int i, int j, int k, int l) {
- int i1 = world.getData(i, j, k);
+ protected void b(World world, int i, int j, int k, Block block) {
+ int l = world.getData(i, j, k);
- if (!this.e((IBlockAccess) world, i, j, k, i1)) {
- boolean flag = this.d(world, i, j, k, i1);
+ if (!this.g((IBlockAccess) world, i, j, k, l)) {
+ boolean flag = this.a(world, i, j, k, l);
- if ((this.a && !flag || !this.a && flag) && !world.a(i, j, k, this.id)) {
+ if ((this.a && !flag || !this.a && flag) && !world.a(i, j, k, (Block) this)) {
byte b0 = -1;
- if (this.h(world, i, j, k, i1)) {
+ if (this.i(world, i, j, k, l)) {
b0 = -3;
} else if (this.a) {
b0 = -2;
}
- world.a(i, j, k, this.id, this.k_(i1), b0);
+ world.a(i, j, k, this, this.b(l), b0);
}
}
}
- public boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public boolean g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
- protected boolean d(World world, int i, int j, int k, int l) {
- return this.e(world, i, j, k, l) > 0;
+ protected boolean a(World world, int i, int j, int k, int l) {
+ return this.h(world, i, j, k, l) > 0;
}
- protected int e(World world, int i, int j, int k, int l) {
- int i1 = j(l);
+ protected int h(World world, int i, int j, int k, int l) {
+ int i1 = l(l);
int j1 = i + Direction.a[i1];
int k1 = k + Direction.b[i1];
int l1 = world.getBlockFacePower(j1, j, k1, Direction.d[i1]);
- return l1 >= 15 ? l1 : Math.max(l1, world.getTypeId(j1, j, k1) == Block.REDSTONE_WIRE.id ? world.getData(j1, j, k1) : 0);
+ return l1 >= 15 ? l1 : Math.max(l1, world.getType(j1, j, k1) == Blocks.REDSTONE_WIRE ? world.getData(j1, j, k1) : 0);
}
- protected int f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- int i1 = j(l);
+ protected int h(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ int i1 = l(l);
switch (i1) {
case 0:
case 2:
- return Math.max(this.g(iblockaccess, i - 1, j, k, 4), this.g(iblockaccess, i + 1, j, k, 5));
+ return Math.max(this.i(iblockaccess, i - 1, j, k, 4), this.i(iblockaccess, i + 1, j, k, 5));
case 1:
case 3:
- return Math.max(this.g(iblockaccess, i, j, k + 1, 3), this.g(iblockaccess, i, j, k - 1, 2));
+ return Math.max(this.i(iblockaccess, i, j, k + 1, 3), this.i(iblockaccess, i, j, k - 1, 2));
default:
return 0;
}
}
- protected int g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- int i1 = iblockaccess.getTypeId(i, j, k);
+ protected int i(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ Block block = iblockaccess.getType(i, j, k);
- return this.e(i1) ? (i1 == Block.REDSTONE_WIRE.id ? iblockaccess.getData(i, j, k) : iblockaccess.getBlockPower(i, j, k, l)) : 0;
+ return this.a(block) ? (block == Blocks.REDSTONE_WIRE ? iblockaccess.getData(i, j, k) : iblockaccess.getBlockPower(i, j, k, l)) : 0;
}
public boolean isPowerSource() {
@@ -162,49 +162,49 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
world.setData(i, j, k, l, 3);
- boolean flag = this.d(world, i, j, k, l);
+ boolean flag = this.a(world, i, j, k, l);
if (flag) {
- world.a(i, j, k, this.id, 1);
+ world.a(i, j, k, this, 1);
}
}
public void onPlace(World world, int i, int j, int k) {
- this.h_(world, i, j, k);
+ this.e(world, i, j, k);
}
- protected void h_(World world, int i, int j, int k) {
- int l = j(world.getData(i, j, k));
+ protected void e(World world, int i, int j, int k) {
+ int l = l(world.getData(i, j, k));
if (l == 1) {
- world.g(i + 1, j, k, this.id);
- world.c(i + 1, j, k, this.id, 4);
+ world.e(i + 1, j, k, this);
+ world.b(i + 1, j, k, this, 4);
}
if (l == 3) {
- world.g(i - 1, j, k, this.id);
- world.c(i - 1, j, k, this.id, 5);
+ world.e(i - 1, j, k, this);
+ world.b(i - 1, j, k, this, 5);
}
if (l == 2) {
- world.g(i, j, k + 1, this.id);
- world.c(i, j, k + 1, this.id, 2);
+ world.e(i, j, k + 1, this);
+ world.b(i, j, k + 1, this, 2);
}
if (l == 0) {
- world.g(i, j, k - 1, this.id);
- world.c(i, j, k - 1, this.id, 3);
+ world.e(i, j, k - 1, this);
+ world.b(i, j, k - 1, this, 3);
}
}
public void postBreak(World world, int i, int j, int k, int l) {
if (this.a) {
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i - 1, j, k, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
+ world.applyPhysics(i + 1, j, k, this);
+ world.applyPhysics(i - 1, j, k, this);
+ world.applyPhysics(i, j, k + 1, this);
+ world.applyPhysics(i, j, k - 1, this);
+ world.applyPhysics(i, j - 1, k, this);
+ world.applyPhysics(i, j + 1, k, this);
}
super.postBreak(world, i, j, k, l);
@@ -214,30 +214,28 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
return false;
}
- protected boolean e(int i) {
- Block block = Block.byId[i];
-
- return block != null && block.isPowerSource();
+ protected boolean a(Block block) {
+ return block.isPowerSource();
}
- protected int d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ protected int f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return 15;
}
- public static boolean f(int i) {
- return Block.DIODE_OFF.g(i) || Block.REDSTONE_COMPARATOR_OFF.g(i);
+ public static boolean d(Block block) {
+ return Blocks.DIODE_OFF.e(block) || Blocks.REDSTONE_COMPARATOR_OFF.e(block);
}
- public boolean g(int i) {
- return i == this.i().id || i == this.j().id;
+ public boolean e(Block block) {
+ return block == this.e() || block == this.i();
}
- public boolean h(World world, int i, int j, int k, int l) {
- int i1 = j(l);
+ public boolean i(World world, int i, int j, int k, int l) {
+ int i1 = l(l);
- if (f(world.getTypeId(i - Direction.a[i1], j, k - Direction.b[i1]))) {
+ if (d(world.getType(i - Direction.a[i1], j, k - Direction.b[i1]))) {
int j1 = world.getData(i - Direction.a[i1], j, k - Direction.b[i1]);
- int k1 = j(j1);
+ int k1 = l(j1);
return k1 != i1;
} else {
@@ -245,17 +243,17 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
}
}
- protected int h(int i) {
- return this.k_(i);
+ protected int k(int i) {
+ return this.b(i);
}
- protected abstract int k_(int i);
+ protected abstract int b(int i);
+
+ protected abstract BlockDiodeAbstract e();
protected abstract BlockDiodeAbstract i();
- protected abstract BlockDiodeAbstract j();
-
- public boolean i(int i) {
- return this.g(i);
+ public boolean c(Block block) {
+ return this.e(block);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java
index 9bf82b8f94..c68d183452 100644
--- a/src/main/java/net/minecraft/server/BlockDispenser.java
+++ b/src/main/java/net/minecraft/server/BlockDispenser.java
@@ -8,8 +8,8 @@ public class BlockDispenser extends BlockContainer {
protected Random b = new Random();
public static boolean eventFired = false; // CraftBukkit
- protected BlockDispenser(int i) {
- super(i, Material.STONE);
+ protected BlockDispenser() {
+ super(Material.STONE);
this.a(CreativeModeTab.d);
}
@@ -19,30 +19,30 @@ public class BlockDispenser extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
- this.k(world, i, j, k);
+ this.m(world, i, j, k);
}
- private void k(World world, int i, int j, int k) {
+ private void m(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);
- int j1 = world.getTypeId(i - 1, j, k);
- int k1 = world.getTypeId(i + 1, j, k);
+ Block block = world.getType(i, j, k - 1);
+ Block block1 = world.getType(i, j, k + 1);
+ Block block2 = world.getType(i - 1, j, k);
+ Block block3 = world.getType(i + 1, j, k);
byte b0 = 3;
- if (Block.t[l] && !Block.t[i1]) {
+ if (block.j() && !block1.j()) {
b0 = 3;
}
- if (Block.t[i1] && !Block.t[l]) {
+ if (block1.j() && !block.j()) {
b0 = 2;
}
- if (Block.t[j1] && !Block.t[k1]) {
+ if (block2.j() && !block3.j()) {
b0 = 5;
}
- if (Block.t[k1] && !Block.t[j1]) {
+ if (block3.j() && !block2.j()) {
b0 = 4;
}
@@ -64,13 +64,13 @@ public class BlockDispenser extends BlockContainer {
}
}
- // CraftBukkit - private -> public
+ // CraftBukkit - protected -> public
public void dispense(World world, int i, int j, int k) {
SourceBlock sourceblock = new SourceBlock(world, i, j, k);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
if (tileentitydispenser != null) {
- int l = tileentitydispenser.j();
+ int l = tileentitydispenser.i();
if (l < 0) {
world.triggerEffect(1001, i, j, k, 0);
@@ -92,16 +92,16 @@ public class BlockDispenser extends BlockContainer {
return (IDispenseBehavior) a.a(itemstack.getItem());
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
- int i1 = world.getData(i, j, k);
- boolean flag1 = (i1 & 8) != 0;
+ int l = world.getData(i, j, k);
+ boolean flag1 = (l & 8) != 0;
if (flag && !flag1) {
- world.a(i, j, k, this.id, this.a(world));
- world.setData(i, j, k, i1 | 8, 4);
+ world.a(i, j, k, this, this.a(world));
+ world.setData(i, j, k, l | 8, 4);
} else if (!flag && flag1) {
- world.setData(i, j, k, i1 & -9, 4);
+ world.setData(i, j, k, l & -9, 4);
}
}
@@ -111,7 +111,7 @@ public class BlockDispenser extends BlockContainer {
}
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntityDispenser();
}
@@ -124,12 +124,12 @@ public class BlockDispenser extends BlockContainer {
}
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
+ public void remove(World world, int i, int j, int k, Block block, int l) {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
if (tileentitydispenser != null) {
- for (int j1 = 0; j1 < tileentitydispenser.getSize(); ++j1) {
- ItemStack itemstack = tileentitydispenser.getItem(j1);
+ for (int i1 = 0; i1 < tileentitydispenser.getSize(); ++i1) {
+ ItemStack itemstack = tileentitydispenser.getItem(i1);
if (itemstack != null) {
float f = this.b.nextFloat() * 0.8F + 0.1F;
@@ -137,14 +137,14 @@ public class BlockDispenser extends BlockContainer {
float f2 = this.b.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
- int k1 = this.b.nextInt(21) + 10;
+ int j1 = this.b.nextInt(21) + 10;
- if (k1 > itemstack.count) {
- k1 = itemstack.count;
+ if (j1 > itemstack.count) {
+ j1 = itemstack.count;
}
- 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()));
+ itemstack.count -= j1;
+ EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
@@ -160,14 +160,14 @@ public class BlockDispenser extends BlockContainer {
}
}
- world.m(i, j, k, l);
+ world.f(i, j, k, block);
}
- super.remove(world, i, j, k, l, i1);
+ super.remove(world, i, j, k, block, l);
}
public static IPosition a(ISourceBlock isourceblock) {
- EnumFacing enumfacing = l_(isourceblock.h());
+ EnumFacing enumfacing = b(isourceblock.h());
double d0 = isourceblock.getX() + 0.7D * (double) enumfacing.c();
double d1 = isourceblock.getY() + 0.7D * (double) enumfacing.d();
double d2 = isourceblock.getZ() + 0.7D * (double) enumfacing.e();
@@ -175,15 +175,15 @@ public class BlockDispenser extends BlockContainer {
return new Position(d0, d1, d2);
}
- public static EnumFacing l_(int i) {
+ public static EnumFacing b(int i) {
return EnumFacing.a(i & 7);
}
- public boolean q_() {
+ public boolean M() {
return true;
}
- public int b_(World world, int i, int j, int k, int l) {
+ public int g(World world, int i, int j, int k, int l) {
return Container.b((IInventory) world.getTileEntity(i, j, k));
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java
index dea7614539..046ffb8ddf 100644
--- a/src/main/java/net/minecraft/server/BlockDoor.java
+++ b/src/main/java/net/minecraft/server/BlockDoor.java
@@ -6,8 +6,8 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockDoor extends Block {
- protected BlockDoor(int i, Material material) {
- super(i, material);
+ protected BlockDoor(Material material) {
+ super(material);
float f = 0.5F;
float f1 = 1.0F;
@@ -19,37 +19,37 @@ public class BlockDoor extends Block {
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
- int l = this.c_(iblockaccess, i, j, k);
+ int l = this.g(iblockaccess, i, j, k);
return (l & 4) != 0;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 7;
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.b(world, i, j, k);
+ return super.a(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.d(this.c_(iblockaccess, i, j, k));
+ this.b(this.g(iblockaccess, i, j, k));
}
- public int d(IBlockAccess iblockaccess, int i, int j, int k) {
- return this.c_(iblockaccess, i, j, k) & 3;
+ public int e(IBlockAccess iblockaccess, int i, int j, int k) {
+ return this.g(iblockaccess, i, j, k) & 3;
}
- public boolean b_(IBlockAccess iblockaccess, int i, int j, int k) {
- return (this.c_(iblockaccess, i, j, k) & 4) != 0;
+ public boolean f(IBlockAccess iblockaccess, int i, int j, int k) {
+ return (this.g(iblockaccess, i, j, k) & 4) != 0;
}
- private void d(int i) {
+ private void b(int i) {
float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
@@ -106,16 +106,16 @@ public class BlockDoor extends Block {
if (this.material == Material.ORE) {
return true;
} else {
- int i1 = this.c_(world, i, j, k);
+ int i1 = this.g(world, i, j, k);
int j1 = i1 & 7;
j1 ^= 4;
if ((i1 & 8) == 0) {
world.setData(i, j, k, j1, 2);
- world.g(i, j, k, i, j, k);
+ world.c(i, j, k, i, j, k);
} else {
world.setData(i, j - 1, k, j1, 2);
- world.g(i, j - 1, k, i, j, k);
+ world.c(i, j - 1, k, i, j, k);
}
world.a(entityhuman, 1003, i, j, k, 0);
@@ -124,7 +124,7 @@ public class BlockDoor extends Block {
}
public void setDoor(World world, int i, int j, int k, boolean flag) {
- int l = this.c_(world, i, j, k);
+ int l = this.g(world, i, j, k);
boolean flag1 = (l & 4) != 0;
if (flag1 != flag) {
@@ -133,52 +133,52 @@ public class BlockDoor extends Block {
i1 ^= 4;
if ((l & 8) == 0) {
world.setData(i, j, k, i1, 2);
- world.g(i, j, k, i, j, k);
+ world.c(i, j, k, i, j, k);
} else {
world.setData(i, j - 1, k, i1, 2);
- world.g(i, j - 1, k, i, j, k);
+ world.c(i, j - 1, k, i, j, k);
}
world.a((EntityHuman) null, 1003, i, j, k, 0);
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- int i1 = world.getData(i, j, k);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ int l = world.getData(i, j, k);
- if ((i1 & 8) == 0) {
+ if ((l & 8) == 0) {
boolean flag = false;
- if (world.getTypeId(i, j + 1, k) != this.id) {
+ if (world.getType(i, j + 1, k) != this) {
world.setAir(i, j, k);
flag = true;
}
- if (!world.w(i, j - 1, k)) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k)) {
world.setAir(i, j, k);
flag = true;
- if (world.getTypeId(i, j + 1, k) == this.id) {
+ if (world.getType(i, j + 1, k) == this) {
world.setAir(i, j + 1, k);
}
}
if (flag) {
if (!world.isStatic) {
- this.c(world, i, j, k, i1, 0);
+ this.b(world, i, j, k, l, 0);
}
// CraftBukkit start
- } else if (l > 0 && Block.byId[l].isPowerSource()) {
+ } else if (l > 0 && Block.e(l).isPowerSource()) {
org.bukkit.World bworld = world.getWorld();
- org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(i, j, k);
org.bukkit.block.Block blockTop = bworld.getBlockAt(i, j + 1, k);
- int power = block.getBlockPower();
+ int power = bukkitBlock.getBlockPower();
int powerTop = blockTop.getBlockPower();
if (powerTop > power) power = powerTop;
int oldPower = (world.getData(i, j, k) & 4) > 0 ? 15 : 0;
if (oldPower == 0 ^ power == 0) {
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
this.setDoor(world, i, j, k, eventRedstone.getNewCurrent() > 0);
@@ -186,18 +186,18 @@ public class BlockDoor extends Block {
// CraftBukkit end
}
} else {
- if (world.getTypeId(i, j - 1, k) != this.id) {
+ if (world.getType(i, j - 1, k) != this) {
world.setAir(i, j, k);
}
- else if (l > 0 && l != this.id) { // CraftBukkit
- this.doPhysics(world, i, j - 1, k, l);
+ if (block != this) {
+ this.doPhysics(world, i, j - 1, k, block);
}
}
}
- public int getDropType(int i, Random random, int j) {
- return (i & 8) != 0 ? 0 : (this.material == Material.ORE ? Item.IRON_DOOR.id : Item.WOOD_DOOR.id);
+ public Item getDropType(int i, Random random, int j) {
+ return (i & 8) != 0 ? null : (this.material == Material.ORE ? Items.IRON_DOOR : Items.WOOD_DOOR);
}
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
@@ -206,14 +206,14 @@ public class BlockDoor extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return j >= 255 ? false : world.w(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
+ return j >= 255 ? false : World.a((IBlockAccess) world, i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
public int h() {
return 1;
}
- public int c_(IBlockAccess iblockaccess, int i, int j, int k) {
+ public int g(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
boolean flag = (l & 8) != 0;
int i1;
@@ -233,7 +233,7 @@ public class BlockDoor extends Block {
}
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
- if (entityhuman.abilities.canInstantlyBuild && (l & 8) != 0 && world.getTypeId(i, j - 1, k) == this.id) {
+ if (entityhuman.abilities.canInstantlyBuild && (l & 8) != 0 && world.getType(i, j - 1, k) == this) {
world.setAir(i, j - 1, k);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
index a27a6c07d3..b1c3f10e50 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -6,41 +6,41 @@ import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
public class BlockDragonEgg extends Block {
- public BlockDragonEgg(int i) {
- super(i, Material.DRAGON_EGG);
+ public BlockDragonEgg() {
+ super(Material.DRAGON_EGG);
this.a(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
}
public void onPlace(World world, int i, int j, int k) {
- world.a(i, j, k, this.id, this.a(world));
+ world.a(i, j, k, this, this.a(world));
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- world.a(i, j, k, this.id, this.a(world));
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ world.a(i, j, k, this, this.a(world));
}
public void a(World world, int i, int j, int k, Random random) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
}
- private void k(World world, int i, int j, int k) {
- if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
+ private void e(World world, int i, int j, int k) {
+ if (BlockFalling.canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
- if (!BlockSand.instaFall && world.e(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ if (!BlockFalling.instaFall && world.b(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));
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this, world.getData(i, j, k));
world.addEntity(entityfallingblock);
} else {
world.setAir(i, j, k);
- while (BlockSand.canFall(world, i, j - 1, k) && j > 0) {
+ while (BlockFalling.canFall(world, i, j - 1, k) && j > 0) {
--j;
}
if (j > 0) {
- world.setTypeIdAndData(i, j, k, this.id, 0, 2);
+ world.setTypeAndData(i, j, k, this, 0, 2);
}
}
}
@@ -56,13 +56,13 @@ public class BlockDragonEgg extends Block {
}
private void m(World world, int i, int j, int k) {
- if (world.getTypeId(i, j, k) == this.id) {
+ if (world.getType(i, j, k) == this) {
for (int l = 0; l < 1000; ++l) {
int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
int j1 = j + world.random.nextInt(8) - world.random.nextInt(8);
int k1 = k + world.random.nextInt(16) - world.random.nextInt(16);
- if (world.getTypeId(i1, j1, k1) == 0) {
+ if (world.getType(i1, j1, k1).material == Material.AIR) {
// CraftBukkit start
org.bukkit.block.Block from = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block to = world.getWorld().getBlockAt(i1, j1, k1);
@@ -79,7 +79,7 @@ public class BlockDragonEgg extends Block {
// CraftBukkit end
if (!world.isStatic) {
- world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k), 2);
+ world.setTypeAndData(i1, j1, k1, this, world.getData(i, j, k), 2);
world.setAir(i, j, k);
} else {
short short1 = 128;
@@ -111,11 +111,11 @@ public class BlockDragonEgg extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 27;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java
index d3dc56350a..039afd3937 100644
--- a/src/main/java/net/minecraft/server/BlockDropper.java
+++ b/src/main/java/net/minecraft/server/BlockDropper.java
@@ -7,17 +7,15 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent;
public class BlockDropper extends BlockDispenser {
- private final IDispenseBehavior cX = new DispenseBehaviorItem();
+ private final IDispenseBehavior P = new DispenseBehaviorItem();
- protected BlockDropper(int i) {
- super(i);
- }
+ public BlockDropper() {}
protected IDispenseBehavior a(ItemStack itemstack) {
- return this.cX;
+ return this.P;
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntityDropper();
}
@@ -26,7 +24,7 @@ public class BlockDropper extends BlockDispenser {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
if (tileentitydispenser != null) {
- int l = tileentitydispenser.j();
+ int l = tileentitydispenser.i();
if (l < 0) {
world.triggerEffect(1001, i, j, k, 0);
@@ -64,7 +62,7 @@ public class BlockDropper extends BlockDispenser {
itemstack1 = itemstack.cloneItemStack();
}
} else {
- itemstack1 = this.cX.a(sourceblock, itemstack);
+ itemstack1 = this.P.a(sourceblock, itemstack);
if (itemstack1 != null && itemstack1.count == 0) {
itemstack1 = null;
}
diff --git a/src/main/java/net/minecraft/server/BlockEnderPortal.java b/src/main/java/net/minecraft/server/BlockEnderPortal.java
index b0d2d1e3db..0b24c153d2 100644
--- a/src/main/java/net/minecraft/server/BlockEnderPortal.java
+++ b/src/main/java/net/minecraft/server/BlockEnderPortal.java
@@ -9,12 +9,12 @@ public class BlockEnderPortal extends BlockContainer {
public static boolean a;
- protected BlockEnderPortal(int i, Material material) {
- super(i, material);
+ protected BlockEnderPortal(Material material) {
+ super(material);
this.a(1.0F);
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntityEnderPortal();
}
@@ -30,7 +30,7 @@ public class BlockEnderPortal extends BlockContainer {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -48,7 +48,7 @@ public class BlockEnderPortal extends BlockContainer {
}
}
- public int d() {
+ public int b() {
return -1;
}
@@ -59,4 +59,8 @@ public class BlockEnderPortal extends BlockContainer {
}
}
}
+
+ public MaterialMapColor f(int i) {
+ return MaterialMapColor.J;
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index a063b2f039..331589a034 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -13,37 +13,43 @@ public class BlockFire extends Block {
private int[] a = new int[256];
private int[] b = new int[256];
- protected BlockFire(int i) {
- super(i, Material.FIRE);
- this.b(true);
+ protected BlockFire() {
+ super(Material.FIRE);
+ this.a(true);
}
- public void s_() {
- 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);
- this.a(Block.TNT.id, 15, 100);
- this.a(Block.LONG_GRASS.id, 60, 100);
- this.a(Block.WOOL.id, 30, 60);
- this.a(Block.VINE.id, 15, 100);
- this.a(Block.COAL_BLOCK.id, 5, 5);
- this.a(Block.HAY_BLOCK.id, 60, 20);
+ public static void e() {
+ Blocks.FIRE.a(b(Blocks.WOOD), 5, 20);
+ Blocks.FIRE.a(b(Blocks.WOOD_DOUBLE_STEP), 5, 20);
+ Blocks.FIRE.a(b(Blocks.WOOD_STEP), 5, 20);
+ Blocks.FIRE.a(b(Blocks.FENCE), 5, 20);
+ Blocks.FIRE.a(b(Blocks.WOOD_STAIRS), 5, 20);
+ Blocks.FIRE.a(b(Blocks.BIRCH_WOOD_STAIRS), 5, 20);
+ Blocks.FIRE.a(b(Blocks.SPRUCE_WOOD_STAIRS), 5, 20);
+ Blocks.FIRE.a(b(Blocks.JUNGLE_WOOD_STAIRS), 5, 20);
+ Blocks.FIRE.a(b(Blocks.LOG), 5, 5);
+ Blocks.FIRE.a(b(Blocks.LOG2), 5, 5);
+ Blocks.FIRE.a(b(Blocks.LEAVES), 30, 60);
+ Blocks.FIRE.a(b(Blocks.LEAVES2), 30, 60);
+ Blocks.FIRE.a(b(Blocks.BOOKSHELF), 30, 20);
+ Blocks.FIRE.a(b(Blocks.TNT), 15, 100);
+ Blocks.FIRE.a(b(Blocks.LONG_GRASS), 60, 100);
+ Blocks.FIRE.a(b(Blocks.DOUBLE_PLANT), 60, 100);
+ Blocks.FIRE.a(b(Blocks.YELLOW_FLOWER), 60, 100);
+ Blocks.FIRE.a(b(Blocks.RED_ROSE), 60, 100);
+ Blocks.FIRE.a(b(Blocks.WOOL), 30, 60);
+ Blocks.FIRE.a(b(Blocks.VINE), 15, 100);
+ Blocks.FIRE.a(b(Blocks.COAL_BLOCK), 5, 5);
+ Blocks.FIRE.a(b(Blocks.HAY_BLOCK), 60, 20);
+ Blocks.FIRE.a(b(Blocks.WOOL_CARPET), 60, 20);
}
- private void a(int i, int j, int k) {
+ public void a(int i, int j, int k) {
this.a[i] = j;
this.b[i] = k;
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -51,11 +57,11 @@ public class BlockFire extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 3;
}
@@ -69,9 +75,9 @@ public class BlockFire extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (world.getGameRules().getBoolean("doFireTick")) {
- boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
+ boolean flag = world.getType(i, j - 1, k) == Blocks.NETHERRACK;
- if (world.worldProvider instanceof WorldProviderTheEnd && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
+ if (world.worldProvider instanceof WorldProviderTheEnd && world.getType(i, j - 1, k) == Blocks.BEDROCK) {
flag = true;
}
@@ -79,7 +85,7 @@ public class BlockFire extends Block {
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
- if (!flag && world.Q() && (world.isRainingAt(i, j, k) || world.isRainingAt(i - 1, j, k) || world.isRainingAt(i + 1, j, k) || world.isRainingAt(i, j, k - 1) || world.isRainingAt(i, j, k + 1))) {
+ if (!flag && world.P() && (world.isRainingAt(i, j, k) || world.isRainingAt(i - 1, j, k) || world.isRainingAt(i + 1, j, k) || world.isRainingAt(i, j, k - 1) || world.isRainingAt(i, j, k + 1))) {
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
} else {
int l = world.getData(i, j, k);
@@ -88,15 +94,15 @@ public class BlockFire extends Block {
world.setData(i, j, k, l + random.nextInt(3) / 2, 4);
}
- world.a(i, j, k, this.id, this.a(world) + random.nextInt(10));
- if (!flag && !this.k(world, i, j, k)) {
- if (!world.w(i, j - 1, k) || l > 3) {
+ world.a(i, j, k, this, this.a(world) + random.nextInt(10));
+ if (!flag && !this.e(world, i, j, k)) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k) || l > 3) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out of inflammable block
}
- } else if (!flag && !this.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
+ } else if (!flag && !this.e((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
} else {
- boolean flag1 = world.G(i, j, k);
+ boolean flag1 = world.z(i, j, k);
byte b0 = 0;
if (flag1) {
@@ -123,13 +129,13 @@ public class BlockFire extends Block {
int i2 = this.m(world, i1, k1, j1);
if (i2 > 0) {
- int j2 = (i2 + 40 + world.difficulty * 7) / (l + 30);
+ int j2 = (i2 + 40 + world.difficulty.a() * 7) / (l + 30);
if (flag1) {
j2 /= 2;
}
- if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.Q() || !world.isRainingAt(i1, k1, j1)) && !world.isRainingAt(i1 - 1, k1, k) && !world.isRainingAt(i1 + 1, k1, j1) && !world.isRainingAt(i1, k1, j1 - 1) && !world.isRainingAt(i1, k1, j1 + 1)) {
+ if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.P() || !world.isRainingAt(i1, k1, j1)) && !world.isRainingAt(i1 - 1, k1, k) && !world.isRainingAt(i1 + 1, k1, j1) && !world.isRainingAt(i1, k1, j1 - 1) && !world.isRainingAt(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) {
@@ -137,7 +143,7 @@ public class BlockFire extends Block {
}
// CraftBukkit start - Call to stop spread of fire
- if (world.getTypeId(i1, k1, j1) != Block.FIRE.id) {
+ if (world.getType(i1, k1, j1) != Blocks.FIRE) {
if (CraftEventFactory.callBlockIgniteEvent(world, i1, k1, j1, i, j, k).isCancelled()) {
continue;
}
@@ -145,8 +151,8 @@ public class BlockFire extends Block {
org.bukkit.Server server = world.getServer();
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
- blockState.setTypeId(this.id);
- blockState.setData(new org.bukkit.material.MaterialData(this.id, (byte) k2));
+ blockState.setTypeId(Block.b(this));
+ blockState.setData(new org.bukkit.material.MaterialData(Block.b(this), (byte) k2));
BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
server.getPluginManager().callEvent(spreadEvent);
@@ -167,15 +173,15 @@ public class BlockFire extends Block {
}
}
- public boolean l() {
+ public boolean L() {
return false;
}
private void a(World world, int i, int j, int k, int l, Random random, int i1) {
- int j1 = this.b[world.getTypeId(i, j, k)];
+ int j1 = this.b[Block.b(world.getType(i, j, k))];
if (random.nextInt(l) < j1) {
- boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
+ boolean flag = world.getType(i, j, k) == Blocks.TNT;
// CraftBukkit start
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);
@@ -195,19 +201,19 @@ public class BlockFire extends Block {
k1 = 15;
}
- world.setTypeIdAndData(i, j, k, this.id, k1, 3);
+ world.setTypeAndData(i, j, k, this, k1, 3);
} else {
world.setAir(i, j, k);
}
if (flag) {
- Block.TNT.postBreak(world, i, j, k, 1);
+ Blocks.TNT.postBreak(world, i, j, k, 1);
}
}
}
- private boolean k(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 boolean e(World world, int i, int j, int k) {
+ return this.e((IBlockAccess) world, i + 1, j, k) ? true : (this.e((IBlockAccess) world, i - 1, j, k) ? true : (this.e((IBlockAccess) world, i, j - 1, k) ? true : (this.e((IBlockAccess) world, i, j + 1, k) ? true : (this.e((IBlockAccess) world, i, j, k - 1) ? true : this.e((IBlockAccess) world, i, j, k + 1)))));
}
private int m(World world, int i, int j, int k) {
@@ -216,54 +222,58 @@ public class BlockFire extends Block {
if (!world.isEmpty(i, j, k)) {
return 0;
} else {
- int l = this.d(world, i + 1, j, k, b0);
+ int l = this.a(world, i + 1, j, k, b0);
- l = this.d(world, i - 1, j, k, l);
- l = this.d(world, i, j - 1, k, l);
- l = this.d(world, i, j + 1, k, l);
- l = this.d(world, i, j, k - 1, l);
- l = this.d(world, i, j, k + 1, l);
+ l = this.a(world, i - 1, j, k, l);
+ l = this.a(world, i, j - 1, k, l);
+ l = this.a(world, i, j + 1, k, l);
+ l = this.a(world, i, j, k - 1, l);
+ l = this.a(world, i, j, k + 1, l);
return l;
}
}
- public boolean m() {
+ public boolean v() {
return false;
}
- public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
- return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
+ public boolean e(IBlockAccess iblockaccess, int i, int j, int k) {
+ return this.a[Block.b(iblockaccess.getType(i, j, k))] > 0;
}
- public int d(World world, int i, int j, int k, int l) {
- int i1 = this.a[world.getTypeId(i, j, k)];
+ public int a(World world, int i, int j, int k, int l) {
+ int i1 = this.a[Block.b(world.getType(i, j, k))];
return i1 > l ? i1 : l;
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.w(i, j - 1, k) || this.k(world, i, j, k);
+ return World.a((IBlockAccess) world, i, j - 1, k) || this.e(world, i, j, k);
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k) && !this.e(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.o_(world, i, j, k)) {
- if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
+ if (world.worldProvider.dimension > 0 || !Blocks.PORTAL.e(world, i, j, k)) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k) && !this.e(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
} else {
- world.a(i, j, k, this.id, this.a(world) + world.random.nextInt(10));
+ world.a(i, j, k, this, this.a(world) + world.random.nextInt(10));
}
}
}
+ public MaterialMapColor f(int i) {
+ return MaterialMapColor.f;
+ }
+
// CraftBukkit start
private void fireExtinguished(World world, int x, int y, int z) {
- if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled()) {
+ if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), Blocks.AIR).isCancelled()) {
world.setAir(x, y, z);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index a98dadadff..5ebba1e3b9 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -11,20 +11,16 @@ public class BlockFlowing extends BlockFluids {
int a;
boolean[] b = new boolean[4];
- int[] c = new int[4];
+ int[] M = new int[4];
- protected BlockFlowing(int i, Material material) {
- super(i, material);
+ protected BlockFlowing(Material material) {
+ super(material);
}
- private void k(World world, int i, int j, int k) {
+ private void n(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- world.setTypeIdAndData(i, j, k, this.id + 1, l, 2);
- }
-
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
- return this.material != Material.LAVA;
+ world.setTypeAndData(i, j, k, Block.e(Block.b((Block) this) + 1), l, 2);
}
public void a(World world, int i, int j, int k, Random random) {
@@ -34,7 +30,7 @@ public class BlockFlowing extends BlockFluids {
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
// CraftBukkit end
- int l = this.l_(world, i, j, k);
+ int l = this.e(world, i, j, k);
byte b0 = 1;
if (this.material == Material.LAVA && !world.worldProvider.f) {
@@ -49,18 +45,18 @@ public class BlockFlowing extends BlockFluids {
byte b1 = -100;
this.a = 0;
- int k1 = this.d(world, i - 1, j, k, b1);
+ int k1 = this.a(world, i - 1, j, k, b1);
- k1 = this.d(world, i + 1, j, k, k1);
- k1 = this.d(world, i, j, k - 1, k1);
- k1 = this.d(world, i, j, k + 1, k1);
+ k1 = this.a(world, i + 1, j, k, k1);
+ k1 = this.a(world, i, j, k - 1, k1);
+ k1 = this.a(world, i, j, k + 1, k1);
j1 = k1 + b0;
if (j1 >= 8 || k1 < 0) {
j1 = -1;
}
- if (this.l_(world, i, j + 1, k) >= 0) {
- int l1 = this.l_(world, i, j + 1, k);
+ if (this.e(world, i, j + 1, k) >= 0) {
+ int l1 = this.e(world, i, j + 1, k);
if (l1 >= 8) {
j1 = l1;
@@ -70,9 +66,9 @@ public class BlockFlowing extends BlockFluids {
}
if (this.a >= 2 && this.material == Material.WATER) {
- if (world.getMaterial(i, j - 1, k).isBuildable()) {
+ if (world.getType(i, j - 1, k).getMaterial().isBuildable()) {
j1 = 0;
- } else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j - 1, k) == 0) {
+ } else if (world.getType(i, j - 1, k).getMaterial() == this.material && world.getData(i, j - 1, k) == 0) {
j1 = 0;
}
}
@@ -83,7 +79,7 @@ public class BlockFlowing extends BlockFluids {
if (j1 == l) {
if (flag) {
- this.k(world, i, j, k);
+ this.n(world, i, j, k);
}
} else {
l = j1;
@@ -91,15 +87,15 @@ public class BlockFlowing extends BlockFluids {
world.setAir(i, j, k);
} else {
world.setData(i, j, k, j1, 2);
- world.a(i, j, k, this.id, i1);
- world.applyPhysics(i, j, k, this.id);
+ world.a(i, j, k, this, i1);
+ world.applyPhysics(i, j, k, this);
}
}
} else {
- this.k(world, i, j, k);
+ this.n(world, i, j, k);
}
- if (this.o(world, i, j - 1, k)) {
+ if (this.q(world, i, j - 1, k)) {
// CraftBukkit start - Send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
if (server != null) {
@@ -107,8 +103,8 @@ public class BlockFlowing extends BlockFluids {
}
if (!event.isCancelled()) {
- if (this.material == Material.LAVA && world.getMaterial(i, j - 1, k) == Material.WATER) {
- world.setTypeIdUpdate(i, j - 1, k, Block.STONE.id);
+ if (this.material == Material.LAVA && world.getType(i, j - 1, k).getMaterial() == Material.WATER) {
+ world.setTypeUpdate(i, j - 1, k, Blocks.STONE);
this.fizz(world, i, j - 1, k);
return;
}
@@ -120,8 +116,8 @@ public class BlockFlowing extends BlockFluids {
}
}
// CraftBukkit end
- } else if (l >= 0 && (l == 0 || this.n(world, i, j - 1, k))) {
- boolean[] aboolean = this.m(world, i, j, k);
+ } else if (l >= 0 && (l == 0 || this.p(world, i, j - 1, k))) {
+ boolean[] aboolean = this.o(world, i, j, k);
j1 = l + b0;
if (l >= 8) {
@@ -155,22 +151,20 @@ public class BlockFlowing extends BlockFluids {
}
private void flow(World world, int i, int j, int k, int l) {
- if (this.o(world, i, j, k)) {
- int i1 = world.getTypeId(i, j, k);
+ if (this.q(world, i, j, k)) {
+ Block block = world.getType(i, j, k);
- if (i1 > 0) {
- if (this.material == Material.LAVA) {
- this.fizz(world, i, j, k);
- } else {
- Block.byId[i1].c(world, i, j, k, world.getData(i, j, k), 0);
- }
+ if (this.material == Material.LAVA) {
+ this.fizz(world, i, j, k);
+ } else {
+ block.b(world, i, j, k, world.getData(i, j, k), 0);
}
- world.setTypeIdAndData(i, j, k, this.id, l, 3);
+ world.setTypeAndData(i, j, k, this, l, 3);
}
}
- private int d(World world, int i, int j, int k, int l, int i1) {
+ private int c(World world, int i, int j, int k, int l, int i1) {
int j1 = 1000;
for (int k1 = 0; k1 < 4; ++k1) {
@@ -194,13 +188,13 @@ public class BlockFlowing extends BlockFluids {
++i2;
}
- if (!this.n(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
- if (!this.n(world, l1, j - 1, i2)) {
+ if (!this.p(world, l1, j, i2) && (world.getType(l1, j, i2).getMaterial() != this.material || world.getData(l1, j, i2) != 0)) {
+ if (!this.p(world, l1, j - 1, i2)) {
return l;
}
if (l < 4) {
- int j2 = this.d(world, l1, j, i2, l + 1, k1);
+ int j2 = this.c(world, l1, j, i2, l + 1, k1);
if (j2 < j1) {
j1 = j2;
@@ -213,12 +207,12 @@ public class BlockFlowing extends BlockFluids {
return j1;
}
- private boolean[] m(World world, int i, int j, int k) {
+ private boolean[] o(World world, int i, int j, int k) {
int l;
int i1;
for (l = 0; l < 4; ++l) {
- this.c[l] = 1000;
+ this.M[l] = 1000;
i1 = i;
int j1 = k;
@@ -238,48 +232,38 @@ public class BlockFlowing extends BlockFluids {
++j1;
}
- if (!this.n(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
- if (this.n(world, i1, j - 1, j1)) {
- this.c[l] = this.d(world, i1, j, j1, 1, l);
+ if (!this.p(world, i1, j, j1) && (world.getType(i1, j, j1).getMaterial() != this.material || world.getData(i1, j, j1) != 0)) {
+ if (this.p(world, i1, j - 1, j1)) {
+ this.M[l] = this.c(world, i1, j, j1, 1, l);
} else {
- this.c[l] = 0;
+ this.M[l] = 0;
}
}
}
- l = this.c[0];
+ l = this.M[0];
for (i1 = 1; i1 < 4; ++i1) {
- if (this.c[i1] < l) {
- l = this.c[i1];
+ if (this.M[i1] < l) {
+ l = this.M[i1];
}
}
for (i1 = 0; i1 < 4; ++i1) {
- this.b[i1] = this.c[i1] == l;
+ this.b[i1] = this.M[i1] == l;
}
return this.b;
}
- private boolean n(World world, int i, int j, int k) {
- int l = world.getTypeId(i, j, k);
+ private boolean p(World world, int i, int j, int k) {
+ Block block = world.getType(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) {
- if (l == 0) {
- return false;
- } else {
- Material material = Block.byId[l].material;
-
- return material == Material.PORTAL ? true : material.isSolid();
- }
- } else {
- return true;
- }
+ return block != Blocks.WOODEN_DOOR && block != Blocks.IRON_DOOR_BLOCK && block != Blocks.SIGN_POST && block != Blocks.LADDER && block != Blocks.SUGAR_CANE_BLOCK ? (block.material == Material.PORTAL ? true : block.material.isSolid()) : true;
}
- protected int d(World world, int i, int j, int k, int l) {
- int i1 = this.l_(world, i, j, k);
+ protected int a(World world, int i, int j, int k, int l) {
+ int i1 = this.e(world, i, j, k);
if (i1 < 0) {
return l;
@@ -296,20 +280,20 @@ public class BlockFlowing extends BlockFluids {
}
}
- private boolean o(World world, int i, int j, int k) {
- Material material = world.getMaterial(i, j, k);
+ private boolean q(World world, int i, int j, int k) {
+ Material material = world.getType(i, j, k).getMaterial();
- return material == this.material ? false : (material == Material.LAVA ? false : !this.n(world, i, j, k));
+ return material == this.material ? false : (material == Material.LAVA ? false : !this.p(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.a(i, j, k, this.id, this.a(world));
+ if (world.getType(i, j, k) == this) {
+ world.a(i, j, k, this, this.a(world));
}
}
- public boolean l() {
+ public boolean L() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
index 6f9301de78..7b785792a6 100644
--- a/src/main/java/net/minecraft/server/BlockGrass.java
+++ b/src/main/java/net/minecraft/server/BlockGrass.java
@@ -2,27 +2,32 @@ package net.minecraft.server;
import java.util.Random;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import org.bukkit.block.BlockState;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.BlockFadeEvent;
// CraftBukkit end
-public class BlockGrass extends Block {
+public class BlockGrass extends Block implements IBlockFragilePlantElement {
- protected BlockGrass(int i) {
- super(i, Material.GRASS);
- this.b(true);
+ private static final Logger a = LogManager.getLogger();
+
+ protected BlockGrass() {
+ super(Material.GRASS);
+ this.a(true);
this.a(CreativeModeTab.b);
}
public void a(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) {
+ if (world.getLightLevel(i, j + 1, k) < 4 && world.getType(i, j + 1, k).k() > 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i, j, k).getState();
- blockState.setTypeId(Block.DIRT.id);
+ blockState.setTypeId(Block.b(Blocks.DIRT));
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
@@ -36,13 +41,13 @@ public class BlockGrass extends Block {
int i1 = i + random.nextInt(3) - 1;
int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1;
- int l1 = world.getTypeId(i1, j1 + 1, k1);
+ Block block = world.getType(i1, j1 + 1, k1);
- if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.lightBlock[l1] <= 2) {
+ if (world.getType(i1, j1, k1) == Blocks.DIRT && world.getData(i1, j1, k1) == 0 && world.getLightLevel(i1, j1 + 1, k1) >= 4 && block.k() <= 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
- blockState.setTypeId(Block.GRASS.id);
+ blockState.setTypeId(Block.b(Blocks.GRASS));
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
@@ -57,7 +62,58 @@ public class BlockGrass extends Block {
}
}
- public int getDropType(int i, Random random, int j) {
- return Block.DIRT.getDropType(0, random, j);
+ public Item getDropType(int i, Random random, int j) {
+ return Blocks.DIRT.getDropType(0, random, j);
+ }
+
+ public boolean a(World world, int i, int j, int k, boolean flag) {
+ return true;
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ return true;
+ }
+
+ public void b(World world, Random random, int i, int j, int k) {
+ int l = 0;
+
+ while (l < 128) {
+ int i1 = i;
+ int j1 = j + 1;
+ int k1 = k;
+ int l1 = 0;
+
+ while (true) {
+ if (l1 < l / 16) {
+ i1 += random.nextInt(3) - 1;
+ j1 += (random.nextInt(3) - 1) * random.nextInt(3) / 2;
+ k1 += random.nextInt(3) - 1;
+ if (world.getType(i1, j1 - 1, k1) == Blocks.GRASS && !world.getType(i1, j1, k1).r()) {
+ ++l1;
+ continue;
+ }
+ } else if (world.getType(i1, j1, k1).material == Material.AIR) {
+ if (random.nextInt(8) != 0) {
+ if (Blocks.LONG_GRASS.j(world, i1, j1, k1)) {
+ world.setTypeAndData(i1, j1, k1, Blocks.LONG_GRASS, 1, 3);
+ }
+ } else {
+ String s = world.getBiome(i1, k1).a(random, i1, j1, k1);
+
+ a.debug("Flower in " + world.getBiome(i1, k1).af + ": " + s);
+ BlockFlowers blockflowers = BlockFlowers.e(s);
+
+ if (blockflowers != null && blockflowers.j(world, i1, j1, k1)) {
+ int i2 = BlockFlowers.f(s);
+
+ world.setTypeAndData(i1, j1, k1, blockflowers, i2, 3);
+ }
+ }
+ }
+
+ ++l;
+ break;
+ }
+ }
}
}
diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java
index d1fd0755b9..9e64702be9 100644
--- a/src/main/java/net/minecraft/server/BlockHopper.java
+++ b/src/main/java/net/minecraft/server/BlockHopper.java
@@ -7,8 +7,8 @@ public class BlockHopper extends BlockContainer {
private final Random a = new Random();
- public BlockHopper(int i) {
- super(i, Material.ORE);
+ public BlockHopper() {
+ super(Material.ORE);
this.a(CreativeModeTab.d);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@@ -43,14 +43,14 @@ public class BlockHopper extends BlockContainer {
return j1;
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntityHopper();
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
super.postPlace(world, i, j, k, entityliving, itemstack);
if (itemstack.hasName()) {
- TileEntityHopper tileentityhopper = d(world, i, j, k);
+ TileEntityHopper tileentityhopper = e((IBlockAccess) world, i, j, k);
tileentityhopper.a(itemstack.getName());
}
@@ -58,14 +58,14 @@ public class BlockHopper extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
- this.k(world, i, j, k);
+ this.e(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) {
if (world.isStatic) {
return true;
} else {
- TileEntityHopper tileentityhopper = d(world, i, j, k);
+ TileEntityHopper tileentityhopper = e((IBlockAccess) world, i, j, k);
if (tileentityhopper != null) {
entityhuman.openHopper(tileentityhopper);
@@ -75,27 +75,27 @@ public class BlockHopper extends BlockContainer {
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- this.k(world, i, j, k);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ this.e(world, i, j, k);
}
- private void k(World world, int i, int j, int k) {
+ private void e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- int i1 = c(l);
+ int i1 = b(l);
boolean flag = !world.isBlockIndirectlyPowered(i, j, k);
- boolean flag1 = d(l);
+ boolean flag1 = c(l);
if (flag != flag1) {
world.setData(i, j, k, i1 | (flag ? 0 : 8), 4);
}
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
+ public void remove(World world, int i, int j, int k, Block block, int l) {
TileEntityHopper tileentityhopper = (TileEntityHopper) world.getTileEntity(i, j, k);
if (tileentityhopper != null) {
- for (int j1 = 0; j1 < tileentityhopper.getSize(); ++j1) {
- ItemStack itemstack = tileentityhopper.getItem(j1);
+ for (int i1 = 0; i1 < tileentityhopper.getSize(); ++i1) {
+ ItemStack itemstack = tileentityhopper.getItem(i1);
if (itemstack != null) {
float f = this.a.nextFloat() * 0.8F + 0.1F;
@@ -103,14 +103,14 @@ public class BlockHopper extends BlockContainer {
float f2 = this.a.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
- int k1 = this.a.nextInt(21) + 10;
+ int j1 = this.a.nextInt(21) + 10;
- if (k1 > itemstack.count) {
- k1 = itemstack.count;
+ if (j1 > itemstack.count) {
+ j1 = itemstack.count;
}
- 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()));
+ itemstack.count -= j1;
+ EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
@@ -126,17 +126,17 @@ public class BlockHopper extends BlockContainer {
}
}
- world.m(i, j, k, l);
+ world.f(i, j, k, block);
}
- super.remove(world, i, j, k, l, i1);
+ super.remove(world, i, j, k, block, l);
}
- public int d() {
+ public int b() {
return 38;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -144,23 +144,23 @@ public class BlockHopper extends BlockContainer {
return false;
}
- public static int c(int i) {
+ public static int b(int i) {
return Math.min(i & 7, 5); // CraftBukkit - Fix AIOOBE in callers
}
- public static boolean d(int i) {
+ public static boolean c(int i) {
return (i & 8) != 8;
}
- public boolean q_() {
+ public boolean M() {
return true;
}
- public int b_(World world, int i, int j, int k, int l) {
- return Container.b((IInventory) d(world, i, j, k));
+ public int g(World world, int i, int j, int k, int l) {
+ return Container.b((IInventory) e((IBlockAccess) world, i, j, k));
}
- public static TileEntityHopper d(IBlockAccess iblockaccess, int i, int j, int k) {
+ public static TileEntityHopper e(IBlockAccess iblockaccess, int i, int j, int k) {
return (TileEntityHopper) iblockaccess.getTileEntity(i, j, k);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockIce.java b/src/main/java/net/minecraft/server/BlockIce.java
index 29563056b9..e7de2e1829 100644
--- a/src/main/java/net/minecraft/server/BlockIce.java
+++ b/src/main/java/net/minecraft/server/BlockIce.java
@@ -2,23 +2,23 @@ package net.minecraft.server;
import java.util.Random;
-public class BlockIce extends BlockHalfTransparant {
+public class BlockIce extends BlockHalfTransparent {
- public BlockIce(int i) {
- super(i, "ice", Material.ICE, false);
+ public BlockIce() {
+ super("ice", Material.ICE, false);
this.frictionFactor = 0.98F;
- this.b(true);
+ this.a(true);
this.a(CreativeModeTab.b);
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- entityhuman.a(StatisticList.C[this.id], 1);
+ entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
entityhuman.a(0.025F);
- if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
- ItemStack itemstack = this.d_(l);
+ if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
+ ItemStack itemstack = this.j(l);
if (itemstack != null) {
- this.b(world, i, j, k, itemstack);
+ this.a(world, i, j, k, itemstack);
}
} else {
if (world.worldProvider.f) {
@@ -28,11 +28,11 @@ public class BlockIce extends BlockHalfTransparant {
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
- this.c(world, i, j, k, l, i1);
- Material material = world.getMaterial(i, j - 1, k);
+ this.b(world, i, j, k, l, i1);
+ Material material = world.getType(i, j - 1, k).getMaterial();
if (material.isSolid() || material.isLiquid()) {
- world.setTypeIdUpdate(i, j, k, Block.WATER.id);
+ world.setTypeUpdate(i, j, k, Blocks.WATER);
}
}
}
@@ -42,9 +42,9 @@ public class BlockIce extends BlockHalfTransparant {
}
public void a(World world, int i, int j, int k, Random random) {
- if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
+ if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - this.k()) {
// CraftBukkit start
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Blocks.STATIONARY_WATER).isCancelled()) {
return;
}
// CraftBukkit end
@@ -54,8 +54,8 @@ public class BlockIce extends BlockHalfTransparant {
return;
}
- this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeIdUpdate(i, j, k, Block.STATIONARY_WATER.id);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setTypeUpdate(i, j, k, Blocks.STATIONARY_WATER);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java
index 0cf3a0ef45..34e803376b 100644
--- a/src/main/java/net/minecraft/server/BlockLeaves.java
+++ b/src/main/java/net/minecraft/server/BlockLeaves.java
@@ -4,33 +4,32 @@ import java.util.Random;
import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
-public class BlockLeaves extends BlockTransparant {
+public abstract class BlockLeaves extends BlockTransparent {
- public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
- public static final String[][] b = new String[][] { { "leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, { "leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}};
- private IIcon[][] cX = new IIcon[2][];
- int[] c;
+ int[] a;
+ protected IIcon[][] M = new IIcon[2][];
- protected BlockLeaves(int i) {
- super(i, Material.LEAVES, false);
- this.b(true);
+ public BlockLeaves() {
+ super(Material.LEAVES, false);
+ this.a(true);
this.a(CreativeModeTab.c);
+ this.c(0.2F);
+ this.g(1);
+ this.a(h);
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
+ public void remove(World world, int i, int j, int k, Block block, int l) {
byte b0 = 1;
- int j1 = b0 + 1;
+ int i1 = b0 + 1;
- if (world.e(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 (world.b(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
+ for (int j1 = -b0; j1 <= b0; ++j1) {
+ for (int k1 = -b0; k1 <= b0; ++k1) {
+ for (int l1 = -b0; l1 <= b0; ++l1) {
+ if (world.getType(i + j1, j + k1, k + l1).getMaterial() == Material.LEAVES) {
+ int i2 = world.getData(i + j1, j + k1, k + l1);
- if (j2 == Block.LEAVES.id) {
- int k2 = world.getData(i + k1, j + l1, k + i2);
-
- world.setData(i + k1, j + l1, k + i2, k2 | 8, 4);
+ world.setData(i + j1, j + k1, k + l1, i2 | 8, 4);
}
}
}
@@ -49,27 +48,29 @@ public class BlockLeaves extends BlockTransparant {
int j1 = b1 * b1;
int k1 = b1 / 2;
- if (this.c == null) {
- this.c = new int[b1 * b1 * b1];
+ if (this.a == null) {
+ this.a = new int[b1 * b1 * b1];
}
int l1;
- if (world.e(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
+ if (world.b(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
int i2;
int j2;
- int k2;
for (l1 = -b0; l1 <= b0; ++l1) {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
- k2 = world.getTypeId(i + l1, j + i2, k + j2);
- if (k2 == Block.LOG.id) {
- this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
- } else if (k2 == Block.LEAVES.id) {
- this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
+ Block block = world.getType(i + l1, j + i2, k + j2);
+
+ if (block != Blocks.LOG && block != Blocks.LOG2) {
+ if (block.getMaterial() == Material.LEAVES) {
+ this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
+ } else {
+ this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
+ }
} else {
- this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
+ this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
}
}
}
@@ -78,30 +79,30 @@ public class BlockLeaves extends BlockTransparant {
for (l1 = 1; l1 <= 4; ++l1) {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
- for (k2 = -b0; k2 <= b0; ++k2) {
- if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
- if (this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
- this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
+ for (int 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.c[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
- this.c[(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.c[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
- this.c[(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.c[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
- this.c[(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.c[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
- this.c[(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.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
- this.c[(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;
}
}
}
@@ -110,17 +111,17 @@ public class BlockLeaves extends BlockTransparant {
}
}
- l1 = this.c[k1 * j1 + k1 * b1 + k1];
+ l1 = this.a[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) {
world.setData(i, j, k, l & -9, 4);
} else {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
}
}
}
}
- private void k(World world, int i, int j, int k) {
+ private void e(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);
@@ -130,7 +131,7 @@ public class BlockLeaves extends BlockTransparant {
}
// CraftBukkit end
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
@@ -138,17 +139,13 @@ public class BlockLeaves extends BlockTransparant {
return random.nextInt(20) == 0 ? 1 : 0;
}
- public int getDropType(int i, Random random, int j) {
- return Block.SAPLING.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Item.getItemOf(Blocks.SAPLING);
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) {
- int j1 = 20;
-
- if ((l & 3) == 3) {
- j1 = 40;
- }
+ int j1 = this.b(l);
if (i1 > 0) {
j1 -= 2 << i1;
@@ -158,9 +155,9 @@ public class BlockLeaves extends BlockTransparant {
}
if (world.random.nextInt(j1) == 0) {
- int k1 = this.getDropType(l, world.random, i1);
+ Item item = this.getDropType(l, world.random, i1);
- this.b(world, i, j, k, new ItemStack(k1, 1, this.getDropData(l)));
+ this.a(world, i, j, k, new ItemStack(item, 1, this.getDropData(l)));
}
j1 = 200;
@@ -171,16 +168,20 @@ public class BlockLeaves extends BlockTransparant {
}
}
- if ((l & 3) == 0 && world.random.nextInt(j1) == 0) {
- this.b(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
- }
+ this.c(world, i, j, k, l, j1);
}
}
+ protected void c(World world, int i, int j, int k, int l, int i1) {}
+
+ protected int b(int i) {
+ return 20;
+ }
+
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- if (!world.isStatic && entityhuman.by() != null && entityhuman.by().id == Item.SHEARS.id) {
- entityhuman.a(StatisticList.C[this.id], 1);
- this.b(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
+ if (!world.isStatic && entityhuman.bD() != null && entityhuman.bD().getItem() == Items.SHEARS) {
+ entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
+ this.a(world, i, j, k, new ItemStack(Item.getItemOf(this), 1, l & 3));
} else {
super.a(world, entityhuman, i, j, k, l);
}
@@ -191,10 +192,12 @@ public class BlockLeaves extends BlockTransparant {
}
public boolean c() {
- return !this.d;
+ return !this.P;
}
- protected ItemStack d_(int i) {
- return new ItemStack(this.id, 1, i & 3);
+ protected ItemStack j(int i) {
+ return new ItemStack(Item.getItemOf(this), 1, i & 3);
}
+
+ public abstract String[] e();
}
diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java
index a225d28386..e00cea3d0b 100644
--- a/src/main/java/net/minecraft/server/BlockLever.java
+++ b/src/main/java/net/minecraft/server/BlockLever.java
@@ -4,12 +4,12 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockLever extends Block {
- protected BlockLever(int i) {
- super(i, Material.ORIENTABLE);
+ protected BlockLever() {
+ super(Material.ORIENTABLE);
this.a(CreativeModeTab.d);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -17,20 +17,20 @@ public class BlockLever extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 12;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 0 && world.u(i, j + 1, k) ? true : (l == 1 && world.w(i, j - 1, k) ? true : (l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)))));
+ return l == 0 && world.getType(i, j + 1, k).r() ? true : (l == 1 && World.a((IBlockAccess) world, i, j - 1, k) ? true : (l == 2 && world.getType(i, j, k + 1).r() ? true : (l == 3 && world.getType(i, j, k - 1).r() ? true : (l == 4 && world.getType(i + 1, j, k).r() ? true : l == 5 && world.getType(i - 1, j, k).r()))));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : (world.u(i, j, k + 1) ? true : (world.w(i, j - 1, k) ? true : world.u(i, j + 1, k)))));
+ return world.getType(i - 1, j, k).r() ? true : (world.getType(i + 1, j, k).r() ? true : (world.getType(i, j, k - 1).r() ? true : (world.getType(i, j, k + 1).r() ? true : (World.a((IBlockAccess) world, i, j - 1, k) ? true : world.getType(i, j + 1, k).r()))));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@@ -38,27 +38,27 @@ public class BlockLever extends Block {
int k1 = i1 & 7;
byte b0 = -1;
- if (l == 0 && world.u(i, j + 1, k)) {
+ if (l == 0 && world.getType(i, j + 1, k).r()) {
b0 = 0;
}
- if (l == 1 && world.w(i, j - 1, k)) {
+ if (l == 1 && World.a((IBlockAccess) world, i, j - 1, k)) {
b0 = 5;
}
- if (l == 2 && world.u(i, j, k + 1)) {
+ if (l == 2 && world.getType(i, j, k + 1).r()) {
b0 = 4;
}
- if (l == 3 && world.u(i, j, k - 1)) {
+ if (l == 3 && world.getType(i, j, k - 1).r()) {
b0 = 3;
}
- if (l == 4 && world.u(i + 1, j, k)) {
+ if (l == 4 && world.getType(i + 1, j, k).r()) {
b0 = 2;
}
- if (l == 5 && world.u(i - 1, j, k)) {
+ if (l == 5 && world.getType(i - 1, j, k).r()) {
b0 = 1;
}
@@ -70,13 +70,13 @@ public class BlockLever extends Block {
int i1 = l & 7;
int j1 = l & 8;
- if (i1 == d(1)) {
+ if (i1 == b(1)) {
if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
world.setData(i, j, k, 5 | j1, 2);
} else {
world.setData(i, j, k, 6 | j1, 2);
}
- } else if (i1 == d(0)) {
+ } else if (i1 == b(0)) {
if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
world.setData(i, j, k, 7 | j1, 2);
} else {
@@ -85,7 +85,7 @@ public class BlockLever extends Block {
}
}
- public static int d(int i) {
+ public static int b(int i) {
switch (i) {
case 0:
return 0;
@@ -110,53 +110,53 @@ public class BlockLever extends Block {
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (this.k(world, i, j, k)) {
- int i1 = world.getData(i, j, k) & 7;
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (this.e(world, i, j, k)) {
+ int l = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.u(i - 1, j, k) && i1 == 1) {
+ if (!world.getType(i - 1, j, k).r() && l == 1) {
flag = true;
}
- if (!world.u(i + 1, j, k) && i1 == 2) {
+ if (!world.getType(i + 1, j, k).r() && l == 2) {
flag = true;
}
- if (!world.u(i, j, k - 1) && i1 == 3) {
+ if (!world.getType(i, j, k - 1).r() && l == 3) {
flag = true;
}
- if (!world.u(i, j, k + 1) && i1 == 4) {
+ if (!world.getType(i, j, k + 1).r() && l == 4) {
flag = true;
}
- if (!world.w(i, j - 1, k) && i1 == 5) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k) && l == 5) {
flag = true;
}
- if (!world.w(i, j - 1, k) && i1 == 6) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k) && l == 6) {
flag = true;
}
- if (!world.u(i, j + 1, k) && i1 == 0) {
+ if (!world.getType(i, j + 1, k).r() && l == 0) {
flag = true;
}
- if (!world.u(i, j + 1, k) && i1 == 7) {
+ if (!world.getType(i, j + 1, k).r() && l == 7) {
flag = true;
}
if (flag) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
}
- private boolean k(World world, int i, int j, int k) {
+ private boolean e(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@@ -210,50 +210,50 @@ public class BlockLever extends Block {
world.setData(i, j, k, j1 + k1, 3);
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);
+ world.applyPhysics(i, j, k, this);
if (j1 == 1) {
- world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this);
} else if (j1 == 2) {
- world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this);
} else if (j1 == 3) {
- world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this);
} else if (j1 == 4) {
- world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this);
} else if (j1 != 5 && j1 != 6) {
if (j1 == 0 || j1 == 7) {
- world.applyPhysics(i, j + 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this);
}
} else {
- world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this);
}
return true;
}
}
- 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 j1 = i1 & 7;
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ if ((l & 8) > 0) {
+ world.applyPhysics(i, j, k, this);
+ int i1 = l & 7;
- if (j1 == 1) {
- world.applyPhysics(i - 1, j, k, this.id);
- } else if (j1 == 2) {
- world.applyPhysics(i + 1, j, k, this.id);
- } else if (j1 == 3) {
- world.applyPhysics(i, j, k - 1, this.id);
- } 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);
+ if (i1 == 1) {
+ world.applyPhysics(i - 1, j, k, this);
+ } else if (i1 == 2) {
+ world.applyPhysics(i + 1, j, k, this);
+ } else if (i1 == 3) {
+ world.applyPhysics(i, j, k - 1, this);
+ } else if (i1 == 4) {
+ world.applyPhysics(i, j, k + 1, this);
+ } else if (i1 != 5 && i1 != 6) {
+ if (i1 == 0 || i1 == 7) {
+ world.applyPhysics(i, j + 1, k, this);
}
} else {
- world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j - 1, k, this);
}
}
- super.remove(world, i, j, k, l, i1);
+ super.remove(world, i, j, k, block, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
diff --git a/src/main/java/net/minecraft/server/BlockMinecartDetector.java b/src/main/java/net/minecraft/server/BlockMinecartDetector.java
index 3469207eb6..1278285545 100644
--- a/src/main/java/net/minecraft/server/BlockMinecartDetector.java
+++ b/src/main/java/net/minecraft/server/BlockMinecartDetector.java
@@ -7,9 +7,9 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
- public BlockMinecartDetector(int i) {
- super(i, true);
- this.b(true);
+ public BlockMinecartDetector() {
+ super(true);
+ this.a(true);
}
public int a(World world) {
@@ -25,7 +25,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
int l = world.getData(i, j, k);
if ((l & 8) == 0) {
- this.d(world, i, j, k, l);
+ this.a(world, i, j, k, l);
}
}
}
@@ -35,7 +35,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
int l = world.getData(i, j, k);
if ((l & 8) != 0) {
- this.d(world, i, j, k, l);
+ this.a(world, i, j, k, l);
}
}
}
@@ -48,7 +48,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
return (iblockaccess.getData(i, j, k) & 8) == 0 ? 0 : (l == 1 ? 15 : 0);
}
- private void d(World world, int i, int j, int k, int l) {
+ private void a(World world, int i, int j, int k, int l) {
boolean flag = (l & 8) != 0;
boolean flag1 = false;
float f = 0.125F;
@@ -71,41 +71,47 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
if (flag1 && !flag) {
world.setData(i, j, k, l | 8, 3);
- world.applyPhysics(i, j, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.g(i, j, k, i, j, k);
+ world.applyPhysics(i, j, k, this);
+ world.applyPhysics(i, j - 1, k, this);
+ world.c(i, j, k, i, j, k);
}
if (!flag1 && flag) {
world.setData(i, j, k, l & 7, 3);
- world.applyPhysics(i, j, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.g(i, j, k, i, j, k);
+ world.applyPhysics(i, j, k, this);
+ world.applyPhysics(i, j - 1, k, this);
+ world.c(i, j, k, i, j, k);
}
if (flag1) {
- world.a(i, j, k, this.id, this.a(world));
+ world.a(i, j, k, this, this.a(world));
}
- world.m(i, j, k, this.id);
+ world.f(i, j, k, this);
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
- this.d(world, i, j, k, world.getData(i, j, k));
+ this.a(world, i, j, k, world.getData(i, j, k));
}
- public boolean q_() {
+ public boolean M() {
return true;
}
- public int b_(World world, int i, int j, int k, int l) {
+ public int g(World world, int i, int j, int k, int l) {
if ((world.getData(i, j, k) & 8) > 0) {
float f = 0.125F;
- List list = world.a(EntityMinecartAbstract.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)), IEntitySelector.b);
+ List list = world.a(EntityMinecartCommandBlock.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) {
- return Container.b((IInventory) list.get(0));
+ return ((EntityMinecartCommandBlock) list.get(0)).e().g();
+ }
+
+ List list1 = world.a(EntityMinecartAbstract.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)), IEntitySelector.b);
+
+ if (list1.size() > 0) {
+ return Container.b((IInventory) list1.get(0));
}
}
diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java
index 27f0dab958..c32db8f6ec 100644
--- a/src/main/java/net/minecraft/server/BlockMobSpawner.java
+++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java
@@ -4,16 +4,16 @@ import java.util.Random;
public class BlockMobSpawner extends BlockContainer {
- protected BlockMobSpawner(int i) {
- super(i, Material.STONE);
+ protected BlockMobSpawner() {
+ super(Material.STONE);
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntityMobSpawner();
}
- public int getDropType(int i, Random random, int j) {
- return 0;
+ public Item getDropType(int i, Random random, int j) {
+ return null;
}
public int a(Random random) {
@@ -25,7 +25,7 @@ public class BlockMobSpawner extends BlockContainer {
/* CraftBukkit start - Delegate to getExpDrop
int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15);
- this.j(world, i, j, k, j1);*/
+ this.dropExperience(world, i, j, k, j1)*/
}
public int getExpDrop(World world, int data, int enchantmentLevel) {
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
index 796527da24..54a399f1ef 100644
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java
@@ -12,14 +12,13 @@ import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.world.StructureGrowEvent;
// CraftBukkit end
-public class BlockMushroom extends BlockFlower {
+public class BlockMushroom extends BlockPlant implements IBlockFragilePlantElement {
- protected BlockMushroom(int i) {
- super(i);
+ protected BlockMushroom() {
float f = 0.2F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
- this.b(true);
+ this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
@@ -35,7 +34,7 @@ public class BlockMushroom extends BlockFlower {
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
- if (world.getTypeId(i1, k1, j1) == this.id) {
+ if (world.getType(i1, k1, j1) == this) {
--l;
if (l <= 0) {
return;
@@ -50,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.j(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
@@ -61,11 +60,11 @@ 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.j(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
- blockState.setTypeId(this.id); // nms: this.id, 0, 2
+ blockState.setTypeId(Block.b(this)); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
@@ -79,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.j(world, i, j, k);
}
- protected boolean g_(int i) {
- return Block.t[i];
+ protected boolean a(Block block) {
+ return block.j();
}
- public boolean f(World world, int i, int j, int k) {
+ public boolean j(World world, int i, int j, int k) {
if (j >= 0 && j < 256) {
- int l = world.getTypeId(i, j - 1, k);
+ Block block = world.getType(i, j - 1, k);
- return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.g_(l);
+ return block == Blocks.MYCEL || block == Blocks.DIRT && world.getData(i, j - 1, k) == 2 || world.j(i, j, k) < 13 && this.a(block);
} else {
return false;
}
@@ -107,25 +106,37 @@ public class BlockMushroom extends BlockFlower {
Location location = new Location(world.getWorld(), i, j, k);
WorldGenHugeMushroom worldgenhugemushroom = null;
- if (this.id == Block.BROWN_MUSHROOM.id) {
+ if (this == Blocks.BROWN_MUSHROOM) {
event = new StructureGrowEvent(location, TreeType.BROWN_MUSHROOM, bonemeal, player, new ArrayList());
worldgenhugemushroom = new WorldGenHugeMushroom(0);
- } else if (this.id == Block.RED_MUSHROOM.id) {
+ } else if (this == Blocks.RED_MUSHROOM) {
event = new StructureGrowEvent(location, TreeType.RED_MUSHROOM, bonemeal, player, new ArrayList());
worldgenhugemushroom = new WorldGenHugeMushroom(1);
}
if (worldgenhugemushroom != null && event != null) {
- grown = worldgenhugemushroom.grow((org.bukkit.BlockChangeDelegate)world, random, i, j, k, event, itemstack, world.getWorld());
+ grown = worldgenhugemushroom.grow(new org.bukkit.craftbukkit.CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k, event, itemstack, world.getWorld());
if (event.isFromBonemeal() && itemstack != null) {
--itemstack.count;
}
}
if (!grown || event.isCancelled()) {
- world.setTypeIdAndData(i, j, k, this.id, l, 3);
+ world.setTypeAndData(i, j, k, this, l, 3);
return false;
}
return true;
// CraftBukkit end
}
+
+ public boolean a(World world, int i, int j, int k, boolean flag) {
+ return true;
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ return (double) random.nextFloat() < 0.4D;
+ }
+
+ public void b(World world, Random random, int i, int j, int k) {
+ this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - Add bonemeal, player, and itemstack
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java
index 1de8c83e75..6ac6d94316 100644
--- a/src/main/java/net/minecraft/server/BlockMycel.java
+++ b/src/main/java/net/minecraft/server/BlockMycel.java
@@ -10,19 +10,19 @@ import org.bukkit.event.block.BlockSpreadEvent;
public class BlockMycel extends Block {
- protected BlockMycel(int i) {
- super(i, Material.GRASS);
- this.b(true);
+ protected BlockMycel() {
+ super(Material.GRASS);
+ this.a(true);
this.a(CreativeModeTab.b);
}
public void a(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) {
+ if (world.getLightLevel(i, j + 1, k) < 4 && world.getType(i, j + 1, k).k() > 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i, j, k).getState();
- blockState.setTypeId(Block.DIRT.id);
+ blockState.setTypeId(Block.b(Blocks.DIRT));
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
@@ -36,13 +36,13 @@ public class BlockMycel extends Block {
int i1 = i + random.nextInt(3) - 1;
int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1;
- int l1 = world.getTypeId(i1, j1 + 1, k1);
+ Block block = world.getType(i1, j1 + 1, k1);
- if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.lightBlock[l1] <= 2) {
+ if (world.getType(i1, j1, k1) == Blocks.DIRT && world.getData(i1, j1, k1) == 0 && world.getLightLevel(i1, j1 + 1, k1) >= 4 && block.k() <= 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
- blockState.setTypeId(this.id);
+ blockState.setTypeId(Block.b(this));
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
@@ -57,7 +57,7 @@ public class BlockMycel extends Block {
}
}
- public int getDropType(int i, Random random, int j) {
- return Block.DIRT.getDropType(0, random, j);
+ public Item getDropType(int i, Random random, int j) {
+ return Blocks.DIRT.getDropType(0, random, j);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java
index e90a5881c6..ea12b91724 100644
--- a/src/main/java/net/minecraft/server/BlockNetherWart.java
+++ b/src/main/java/net/minecraft/server/BlockNetherWart.java
@@ -2,36 +2,36 @@ package net.minecraft.server;
import java.util.Random;
-public class BlockNetherWart extends BlockFlower {
+public class BlockNetherWart extends BlockPlant {
- protected BlockNetherWart(int i) {
- super(i);
- this.b(true);
+ protected BlockNetherWart() {
+ this.a(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 g_(int i) {
- return i == Block.SOUL_SAND.id;
+ protected boolean a(Block block) {
+ return block == Blocks.SOUL_SAND;
}
- public boolean f(World world, int i, int j, int k) {
- return this.g_(world.getTypeId(i, j - 1, k));
+ public boolean j(World world, int i, int j, int k) {
+ return this.a(world.getType(i, j - 1, k));
}
public void a(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
if (l < 3 && random.nextInt(10) == 0) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
+ ++l;
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
}
super.a(world, i, j, k, random);
}
- public int d() {
+ public int b() {
return 6;
}
@@ -47,13 +47,13 @@ public class BlockNetherWart extends BlockFlower {
}
for (int k1 = 0; k1 < j1; ++k1) {
- this.b(world, i, j, k, new ItemStack(Item.NETHER_STALK));
+ this.a(world, i, j, k, new ItemStack(Items.NETHER_STALK));
}
}
}
- public int getDropType(int i, Random random, int j) {
- return 0;
+ public Item getDropType(int i, Random random, int j) {
+ return null;
}
public int a(Random random) {
diff --git a/src/main/java/net/minecraft/server/BlockOre.java b/src/main/java/net/minecraft/server/BlockOre.java
index 2f406ba6a0..42f44006d5 100644
--- a/src/main/java/net/minecraft/server/BlockOre.java
+++ b/src/main/java/net/minecraft/server/BlockOre.java
@@ -4,21 +4,21 @@ import java.util.Random;
public class BlockOre extends Block {
- public BlockOre(int i) {
- super(i, Material.STONE);
+ public BlockOre() {
+ super(Material.STONE);
this.a(CreativeModeTab.b);
}
- public int getDropType(int i, Random random, int j) {
- return this.id == Block.COAL_ORE.id ? Item.COAL.id : (this.id == Block.DIAMOND_ORE.id ? Item.DIAMOND.id : (this.id == Block.LAPIS_ORE.id ? Item.INK_SACK.id : (this.id == Block.EMERALD_ORE.id ? Item.EMERALD.id : (this.id == Block.QUARTZ_ORE.id ? Item.QUARTZ.id : this.id))));
+ public Item getDropType(int i, Random random, int j) {
+ return this == Blocks.COAL_ORE ? Items.COAL : (this == Blocks.DIAMOND_ORE ? Items.DIAMOND : (this == Blocks.LAPIS_ORE ? Items.INK_SACK : (this == Blocks.EMERALD_ORE ? Items.EMERALD : (this == Blocks.QUARTZ_ORE ? Items.QUARTZ : Item.getItemOf(this)))));
}
public int a(Random random) {
- return this.id == Block.LAPIS_ORE.id ? 4 + random.nextInt(5) : 1;
+ return this == Blocks.LAPIS_ORE ? 4 + random.nextInt(5) : 1;
}
public int getDropCount(int i, Random random) {
- if (i > 0 && this.id != this.getDropType(0, random, i)) {
+ if (i > 0 && Item.getItemOf(this) != this.getDropType(0, random, i)) {
int j = random.nextInt(i + 2) - 1;
if (j < 0) {
@@ -34,38 +34,39 @@ public class BlockOre extends Block {
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);
/* CraftBukkit start - Delegated to getExpDrop
- if (this.getDropType(l, world.random, i1) != this.id) {
+ if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 0;
- if (this.id == Block.COAL_ORE.id) {
+ if (this == Blocks.COAL_ORE) {
j1 = MathHelper.nextInt(world.random, 0, 2);
- } else if (this.id == Block.DIAMOND_ORE.id) {
+ } else if (this == Blocks.DIAMOND_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
- } else if (this.id == Block.EMERALD_ORE.id) {
+ } else if (this == Blocks.EMERALD_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
- } else if (this.id == Block.LAPIS_ORE.id) {
+ } else if (this == Blocks.LAPIS_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
- } else if (this.id == Block.QUARTZ_ORE.id) {
+ } else if (this == Blocks.QUARTZ_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
}
- this.j(world, i, j, k, j1);
- } */
+ this.dropExperience(world, i, j, k, j1);
+ }
+ // */
}
public int getExpDrop(World world, int l, int i1) {
- if (this.getDropType(l, world.random, i1) != this.id) {
+ if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 0;
- if (this.id == Block.COAL_ORE.id) {
+ if (this == Blocks.COAL_ORE) {
j1 = MathHelper.nextInt(world.random, 0, 2);
- } else if (this.id == Block.DIAMOND_ORE.id) {
+ } else if (this == Blocks.DIAMOND_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
- } else if (this.id == Block.EMERALD_ORE.id) {
+ } else if (this == Blocks.EMERALD_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
- } else if (this.id == Block.LAPIS_ORE.id) {
+ } else if (this == Blocks.LAPIS_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
- } else if (this.id == Block.QUARTZ_ORE.id) {
+ } else if (this == Blocks.QUARTZ_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
}
@@ -77,6 +78,6 @@ public class BlockOre extends Block {
}
public int getDropData(int i) {
- return this.id == Block.LAPIS_ORE.id ? 4 : 0;
+ return this == Blocks.LAPIS_ORE ? 4 : 0;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 2d9e76693b..7822de7d80 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -12,15 +12,15 @@ public class BlockPiston extends Block {
private final boolean a;
- public BlockPiston(int i, boolean flag) {
- super(i, Material.PISTON);
+ public BlockPiston(boolean flag) {
+ super(Material.PISTON);
this.a = flag;
- this.a(k);
+ this.a(i);
this.c(0.5F);
this.a(CreativeModeTab.d);
}
- public int d() {
+ public int b() {
return 16;
}
@@ -37,32 +37,32 @@ public class BlockPiston extends Block {
world.setData(i, j, k, l, 2);
if (!world.isStatic) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
}
}
public void onPlace(World world, int i, int j, int k) {
if (!world.isStatic && world.getTileEntity(i, j, k) == null) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
}
}
- private void k(World world, int i, int j, int k) {
+ private void e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- int i1 = d(l);
+ int i1 = b(l);
if (i1 != 7) {
- boolean flag = this.d(world, i, j, k, i1);
+ boolean flag = this.a(world, i, j, k, i1);
- if (flag && !e(l)) {
+ if (flag && !c(l)) {
// CraftBukkit start
- int length = e(world, i, j, k, i1);
+ int length = h(world, i, j, k, i1);
if (length >= 0) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonExtendEvent event = new BlockPistonExtendEvent(block, length, CraftBlock.notchToBlockFace(i1));
@@ -73,9 +73,9 @@ public class BlockPiston extends Block {
}
// CraftBukkit end
- world.playNote(i, j, k, this.id, 0, i1);
+ world.playNote(i, j, k, this, 0, i1);
}
- } else if (!flag && e(l)) {
+ } else if (!flag && c(l)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, CraftBlock.notchToBlockFace(i1));
@@ -87,18 +87,18 @@ public class BlockPiston extends Block {
// CraftBukkit end
world.setData(i, j, k, i1, 2);
- world.playNote(i, j, k, this.id, 1, i1);
+ world.playNote(i, j, k, this, 1, i1);
}
}
}
- private boolean d(World world, int i, int j, int k, int l) {
+ private boolean a(World world, int i, int j, int k, int l) {
return l != 0 && world.isBlockFacePowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFacePowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFacePowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFacePowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFacePowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFacePowered(i - 1, j, k, 4) ? true : (world.isBlockFacePowered(i, j, k, 0) ? true : (world.isBlockFacePowered(i, j + 2, k, 1) ? true : (world.isBlockFacePowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFacePowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFacePowered(i - 1, j + 1, k, 4) ? true : world.isBlockFacePowered(i + 1, j + 1, k, 5)))))))))));
}
- public boolean b(World world, int i, int j, int k, int l, int i1) {
+ public boolean a(World world, int i, int j, int k, int l, int i1) {
if (!world.isStatic) {
- boolean flag = this.d(world, i, j, k, i1);
+ boolean flag = this.a(world, i, j, k, i1);
if (flag && l == 1) {
world.setData(i, j, k, i1 | 8, 2);
@@ -111,7 +111,7 @@ public class BlockPiston extends Block {
}
if (l == 0) {
- if (!this.f(world, i, j, k, i1)) {
+ if (!this.i(world, i, j, k, i1)) {
return false;
}
@@ -124,17 +124,17 @@ public class BlockPiston extends Block {
((TileEntityPiston) tileentity).f();
}
- world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1, 3);
- world.setTileEntity(i, j, k, BlockPistonMoving.a(this.id, i1, i1, false, true));
+ world.setTypeAndData(i, j, k, Blocks.PISTON_MOVING, i1, 3);
+ world.setTileEntity(i, j, k, BlockPistonMoving.a(this, i1, i1, false, true));
if (this.a) {
int j1 = i + Facing.b[i1] * 2;
int k1 = j + Facing.c[i1] * 2;
int l1 = k + Facing.d[i1] * 2;
- int i2 = world.getTypeId(j1, k1, l1);
- int j2 = world.getData(j1, k1, l1);
+ Block block = world.getType(j1, k1, l1);
+ int i2 = world.getData(j1, k1, l1);
boolean flag1 = false;
- if (i2 == Block.PISTON_MOVING.id) {
+ if (block == Blocks.PISTON_MOVING) {
TileEntity tileentity1 = world.getTileEntity(j1, k1, l1);
if (tileentity1 instanceof TileEntityPiston) {
@@ -142,19 +142,19 @@ public class BlockPiston extends Block {
if (tileentitypiston.c() == i1 && tileentitypiston.b()) {
tileentitypiston.f();
- i2 = tileentitypiston.a();
- j2 = tileentitypiston.p();
+ block = tileentitypiston.a();
+ i2 = tileentitypiston.p();
flag1 = true;
}
}
}
- if (!flag1 && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].h() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
+ if (!flag1 && block.getMaterial() != Material.AIR && a(block, world, j1, k1, l1, false) && (block.h() == 0 || block == Blocks.PISTON || block == Blocks.PISTON_STICKY)) {
i += Facing.b[i1];
j += Facing.c[i1];
k += Facing.d[i1];
- world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2, 3);
- world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
+ world.setTypeAndData(i, j, k, Blocks.PISTON_MOVING, i2, 3);
+ world.setTileEntity(i, j, k, BlockPistonMoving.a(block, i2, i1, false, false));
world.setAir(j1, k1, l1);
} else if (!flag1) {
world.setAir(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
@@ -172,10 +172,10 @@ public class BlockPiston extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- if (e(l)) {
+ if (c(l)) {
float f = 0.25F;
- switch (d(l)) {
+ switch (b(l)) {
case 0:
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
@@ -213,21 +213,21 @@ public class BlockPiston extends Block {
super.a(world, i, j, k, axisalignedbb, list, entity);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.b(world, i, j, k);
+ return super.a(world, i, j, k);
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public static int d(int i) {
+ public static int b(int i) {
if ((i & 7) >= Facing.OPPOSITE_FACING.length) return 7; // CraftBukkit - check for AIOOB on piston data
return i & 7;
}
- public static boolean e(int i) {
+ public static boolean c(int i) {
return (i & 8) != 0;
}
@@ -249,36 +249,36 @@ public class BlockPiston extends Block {
return l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
}
- private static boolean a(int i, World world, int j, int k, int l, boolean flag) {
- if (i == Block.OBSIDIAN.id) {
+ private static boolean a(Block block, World world, int i, int j, int k, boolean flag) {
+ if (block == Blocks.OBSIDIAN) {
return false;
} else {
- if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) {
- if (Block.byId[i].l(world, j, k, l) == -1.0F) {
+ if (block != Blocks.PISTON && block != Blocks.PISTON_STICKY) {
+ if (block.f(world, i, j, k) == -1.0F) {
return false;
}
- if (Block.byId[i].h() == 2) {
+ if (block.h() == 2) {
return false;
}
- if (Block.byId[i].h() == 1) {
+ if (block.h() == 1) {
if (!flag) {
return false;
}
return true;
}
- } else if (e(world.getData(j, k, l))) {
+ } else if (c(world.getData(i, j, k))) {
return false;
}
- return !(Block.byId[i] instanceof IContainer);
+ return !(block instanceof IContainer);
}
}
// CraftBukkit - boolean -> int return
- private static int e(World world, int i, int j, int k, int l) {
+ private static int h(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];
@@ -290,14 +290,14 @@ public class BlockPiston extends Block {
return -1; // CraftBukkit
}
- int i2 = world.getTypeId(i1, j1, k1);
+ Block block = world.getType(i1, j1, k1);
- if (i2 != 0) {
- if (!a(i2, world, i1, j1, k1, true)) {
+ if (block.getMaterial() != Material.AIR) {
+ if (!a(block, world, i1, j1, k1, true)) {
return -1; // CraftBukkit
}
- if (Block.byId[i2].h() != 1) {
+ if (block.h() != 1) {
if (l1 == 12) {
return -1; // CraftBukkit
}
@@ -315,27 +315,26 @@ public class BlockPiston extends Block {
}
}
- private boolean f(World world, int i, int j, int k, int l) {
+ private boolean 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];
int l1 = 0;
while (true) {
- int i2;
-
if (l1 < 13) {
if (j1 <= 0 || j1 >= 255) {
return false;
}
- i2 = world.getTypeId(i1, j1, k1);
- if (i2 != 0) {
- if (!a(i2, world, i1, j1, k1, true)) {
+ Block block = world.getType(i1, j1, k1);
+
+ if (block.getMaterial() != Material.AIR) {
+ if (!a(block, world, i1, j1, k1, true)) {
return false;
}
- if (Block.byId[i2].h() != 1) {
+ if (block.h() != 1) {
if (l1 == 12) {
return false;
}
@@ -347,37 +346,37 @@ public class BlockPiston extends Block {
continue;
}
- Block.byId[i2].c(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
+ block.b(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
world.setAir(i1, j1, k1);
}
}
l1 = i1;
- i2 = j1;
+ int i2 = j1;
int j2 = k1;
int k2 = 0;
- int[] aint;
+ Block[] ablock;
int l2;
int i3;
int j3;
- for (aint = new int[13]; i1 != i || j1 != j || k1 != k; k1 = j3) {
+ for (ablock = new Block[13]; i1 != i || j1 != j || k1 != k; k1 = j3) {
l2 = i1 - Facing.b[l];
i3 = j1 - Facing.c[l];
j3 = k1 - Facing.d[l];
- int k3 = world.getTypeId(l2, i3, j3);
- int l3 = world.getData(l2, i3, j3);
+ Block block1 = world.getType(l2, i3, j3);
+ int k3 = world.getData(l2, i3, j3);
- if (k3 == this.id && l2 == i && i3 == j && j3 == k) {
- world.setTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0), 4);
- world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(Block.PISTON_EXTENSION.id, l | (this.a ? 8 : 0), l, true, false));
+ if (block1 == this && l2 == i && i3 == j && j3 == k) {
+ world.setTypeAndData(i1, j1, k1, Blocks.PISTON_MOVING, l | (this.a ? 8 : 0), 4);
+ world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(Blocks.PISTON_EXTENSION, l | (this.a ? 8 : 0), l, true, false));
} else {
- world.setTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l3, 4);
- world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k3, l3, l, true, false));
+ world.setTypeAndData(i1, j1, k1, Blocks.PISTON_MOVING, k3, 4);
+ world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(block1, k3, l, true, false));
}
- aint[k2++] = k3;
+ ablock[k2++] = block1;
i1 = l2;
j1 = i3;
}
@@ -390,7 +389,7 @@ public class BlockPiston extends Block {
l2 = i1 - Facing.b[l];
i3 = j1 - Facing.c[l];
j3 = k1 - Facing.d[l];
- world.applyPhysics(l2, i3, j3, aint[k2++]);
+ world.applyPhysics(l2, i3, j3, ablock[k2++]);
i1 = l2;
j1 = i3;
}
diff --git a/src/main/java/net/minecraft/server/BlockPistonExtension.java b/src/main/java/net/minecraft/server/BlockPistonExtension.java
index 06173b234a..c432640bfd 100644
--- a/src/main/java/net/minecraft/server/BlockPistonExtension.java
+++ b/src/main/java/net/minecraft/server/BlockPistonExtension.java
@@ -5,18 +5,18 @@ import java.util.Random;
public class BlockPistonExtension extends Block {
- public BlockPistonExtension(int i) {
- super(i, Material.PISTON);
- this.a(k);
+ public BlockPistonExtension() {
+ super(Material.PISTON);
+ this.a(i);
this.c(0.5F);
}
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild) {
- int i1 = d(l);
- int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
+ int i1 = b(l);
+ Block block = world.getType(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
- if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) {
+ if (block == Blocks.PISTON || block == Blocks.PISTON_STICKY) {
world.setAir(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
}
}
@@ -24,26 +24,26 @@ public class BlockPistonExtension extends Block {
super.a(world, i, j, k, l, entityhuman);
}
- 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 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
- int j1 = Facing.OPPOSITE_FACING[d(i1)];
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ super.remove(world, i, j, k, block, l);
+ if ((l & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
+ int i1 = Facing.OPPOSITE_FACING[b(l)];
- i += Facing.b[j1];
- j += Facing.c[j1];
- k += Facing.d[j1];
- int k1 = world.getTypeId(i, j, k);
+ i += Facing.b[i1];
+ j += Facing.c[i1];
+ k += Facing.d[i1];
+ Block block1 = world.getType(i, j, k);
- if (k1 == Block.PISTON.id || k1 == Block.PISTON_STICKY.id) {
- i1 = world.getData(i, j, k);
- if (BlockPiston.e(i1)) {
- Block.byId[k1].c(world, i, j, k, i1, 0);
+ if (block1 == Blocks.PISTON || block1 == Blocks.PISTON_STICKY) {
+ l = world.getData(i, j, k);
+ if (BlockPiston.c(l)) {
+ block1.b(world, i, j, k, l, 0);
world.setAir(i, j, k);
}
}
}
- public int d() {
+ public int b() {
return 17;
}
@@ -51,7 +51,7 @@ public class BlockPistonExtension extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -75,7 +75,7 @@ public class BlockPistonExtension extends Block {
float f3 = 0.25F;
float f4 = 0.75F;
- switch (d(l)) {
+ switch (b(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
super.a(world, i, j, k, axisalignedbb, list, entity);
@@ -125,7 +125,7 @@ public class BlockPistonExtension extends Block {
int l = iblockaccess.getData(i, j, k);
float f = 0.25F;
- switch (d(l)) {
+ switch (b(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
break;
@@ -151,19 +151,19 @@ public class BlockPistonExtension extends Block {
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- int i1 = d(world.getData(i, j, k));
- if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
- int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ int l = b(world.getData(i, j, k));
+ if ((l & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
+ Block block1 = world.getType(i - Facing.b[l], j - Facing.c[l], k - Facing.d[l]);
- if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
+ if (block1 != Blocks.PISTON && block1 != Blocks.PISTON_STICKY) {
world.setAir(i, j, k);
} else {
- Block.byId[j1].doPhysics(world, i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1], l);
+ block1.doPhysics(world, i - Facing.b[l], j - Facing.c[l], k - Facing.d[l], block);
}
}
- public static int d(int i) {
+ public static int b(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 4f297f89c6..75b833af45 100644
--- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -2,175 +2,101 @@ package net.minecraft.server;
import java.util.Random;
-// CraftBukkit start
-import org.bukkit.event.entity.EntityPortalEnterEvent;
-import org.bukkit.event.world.PortalCreateEvent;
-// CraftBukkit end
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
-public class BlockPortal extends BlockHalfTransparant {
+public class BlockPortal extends BlockHalfTransparent {
- public BlockPortal(int i) {
- super(i, "portal", Material.PORTAL, false);
- this.b(true);
+ public static final int[][] a = new int[][] { new int[0], { 3, 1}, { 2, 0}};
+
+ public BlockPortal() {
+ super("portal", Material.PORTAL, false);
+ this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
super.a(world, i, j, k, random);
- if (world.worldProvider.d() && random.nextInt(2000) < world.difficulty) {
+ if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) {
int l;
- for (l = j; !world.w(i, l, k) && l > 0; --l) {
+ for (l = j; !World.a((IBlockAccess) world, i, l, k) && l > 0; --l) {
;
}
- if (l > 0 && !world.u(i, l + 1, k)) {
+ if (l > 0 && !world.getType(i, l + 1, k).r()) {
Entity entity = ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
if (entity != null) {
- entity.portalCooldown = entity.ac();
+ entity.portalCooldown = entity.ai();
}
}
}
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- float f;
- float f1;
+ int l = b(iblockaccess.getData(i, j, k));
- if (iblockaccess.getTypeId(i - 1, j, k) != this.id && iblockaccess.getTypeId(i + 1, j, k) != this.id) {
- f = 0.125F;
- f1 = 0.5F;
- this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
- } else {
- f = 0.5F;
- f1 = 0.125F;
- this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
- }
- }
-
- public boolean c() {
- return false;
- }
-
- public boolean b() {
- return false;
- }
-
- public boolean o_(World world, int i, int j, int k) {
- byte b0 = 0;
- byte b1 = 0;
-
- if (world.getTypeId(i - 1, j, k) == Block.OBSIDIAN.id || world.getTypeId(i + 1, j, k) == Block.OBSIDIAN.id) {
- b0 = 1;
- }
-
- if (world.getTypeId(i, j, k - 1) == Block.OBSIDIAN.id || world.getTypeId(i, j, k + 1) == Block.OBSIDIAN.id) {
- b1 = 1;
- }
-
- if (b0 == b1) {
- return false;
- } else {
- // CraftBukkit start
- java.util.Collection blocks = new java.util.HashSet();
- org.bukkit.World bworld = world.getWorld();
- // CraftBukkit end
-
- if (world.getTypeId(i - b0, j, k - b1) == 0) {
- i -= b0;
- k -= b1;
- }
-
- int l;
- int i1;
-
- for (l = -1; l <= 2; ++l) {
- for (i1 = -1; i1 <= 3; ++i1) {
- boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;
-
- if (l != -1 && l != 2 || i1 != -1 && i1 != 3) {
- int j1 = world.getTypeId(i + b0 * l, j + i1, k + b1 * l);
-
- if (flag) {
- if (j1 != Block.OBSIDIAN.id) {
- return false;
- } else { // CraftBukkit
- blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); // CraftBukkit
- }
- } else if (j1 != 0 && j1 != Block.FIRE.id) {
- return false;
- }
- }
- }
- }
-
- // CraftBukkit start
- for (l = 0; l < 2; ++l) {
- for (i1 = 0; i1 < 3; ++i1) {
- blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l));
- }
- }
-
- PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
- world.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
- return false;
- }
- // CraftBukkit end
-
- for (l = 0; l < 2; ++l) {
- for (i1 = 0; i1 < 3; ++i1) {
- world.setTypeIdAndData(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id, 0, 2);
- }
- }
-
- return true;
- }
- }
-
- public void doPhysics(World world, int i, int j, int k, int l) {
- byte b0 = 0;
- byte b1 = 1;
-
- if (world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id) {
- b0 = 1;
- b1 = 0;
- }
-
- int i1;
-
- for (i1 = j; world.getTypeId(i, i1 - 1, k) == this.id; --i1) {
- ;
- }
-
- if (world.getTypeId(i, i1 - 1, k) != Block.OBSIDIAN.id) {
- world.setAir(i, j, k);
- } else {
- int j1;
-
- for (j1 = 1; j1 < 4 && world.getTypeId(i, i1 + j1, k) == this.id; ++j1) {
- ;
- }
-
- if (j1 == 3 && world.getTypeId(i, i1 + j1, k) == Block.OBSIDIAN.id) {
- boolean flag = world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id;
- boolean flag1 = world.getTypeId(i, j, k - 1) == this.id || world.getTypeId(i, j, k + 1) == this.id;
-
- if (flag && flag1) {
- world.setAir(i, j, k);
- } 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.setAir(i, j, k);
- }
- }
+ if (l == 0) {
+ if (iblockaccess.getType(i - 1, j, k) != this && iblockaccess.getType(i + 1, j, k) != this) {
+ l = 2;
} else {
- world.setAir(i, j, k);
+ l = 1;
}
+
+ if (iblockaccess instanceof World && !((World) iblockaccess).isStatic) {
+ ((World) iblockaccess).setData(i, j, k, l, 2);
+ }
+ }
+
+ float f = 0.125F;
+ float f1 = 0.125F;
+
+ if (l == 1) {
+ f = 0.5F;
+ }
+
+ if (l == 2) {
+ f1 = 0.5F;
+ }
+
+ this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
+ }
+
+ public boolean d() {
+ return false;
+ }
+
+ public boolean e(World world, int i, int j, int k) {
+ PortalCreator portalcreator = new PortalCreator(world, i, j, k, 1);
+ PortalCreator portalcreator1 = new PortalCreator(world, i, j, k, 2);
+
+ if (portalcreator.b() && PortalCreator.a(portalcreator) == 0) {
+ // CraftBukkit start - return portalcreator
+ return portalcreator.c();
+ // return true;
+ } else if (portalcreator1.b() && PortalCreator.a(portalcreator1) == 0) {
+ return portalcreator1.c();
+ // return true;
+ // CraftBukkit end
+ } else {
+ return false;
+ }
+ }
+
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ int l = b(world.getData(i, j, k));
+ PortalCreator portalcreator = new PortalCreator(world, i, j, k, 1);
+ PortalCreator portalcreator1 = new PortalCreator(world, i, j, k, 2);
+
+ if (l == 1 && (!portalcreator.b() || PortalCreator.a(portalcreator) < PortalCreator.b(portalcreator) * PortalCreator.c(portalcreator))) {
+ world.setTypeUpdate(i, j, k, Blocks.AIR);
+ } else if (l == 2 && (!portalcreator1.b() || PortalCreator.a(portalcreator1) < PortalCreator.b(portalcreator1) * PortalCreator.c(portalcreator1))) {
+ world.setTypeUpdate(i, j, k, Blocks.AIR);
+ } else if (l == 0 && !portalcreator.b() && !portalcreator1.b()) {
+ world.setTypeUpdate(i, j, k, Blocks.AIR);
}
}
@@ -185,7 +111,11 @@ public class BlockPortal extends BlockHalfTransparant {
world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
- entity.ab();
+ entity.ah();
}
}
+
+ public static int b(int i) {
+ return i & 3;
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java b/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
index 9c330f9cef..2809e163a0 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
@@ -8,19 +8,19 @@ public abstract class BlockPressurePlateAbstract extends Block {
private String a;
- protected BlockPressurePlateAbstract(int i, String s, Material material) {
- super(i, material);
+ protected BlockPressurePlateAbstract(String s, Material material) {
+ super(material);
this.a = s;
this.a(CreativeModeTab.d);
- this.b(true);
- this.c_(this.d(15));
+ this.a(true);
+ this.b(this.d(15));
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.c_(iblockaccess.getData(i, j, k));
+ this.b(iblockaccess.getData(i, j, k));
}
- protected void c_(int i) {
+ protected void b(int i) {
boolean flag = this.c(i) > 0;
float f = 0.0625F;
@@ -35,7 +35,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
return 20;
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -43,7 +43,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -52,18 +52,18 @@ public abstract class BlockPressurePlateAbstract extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.w(i, j - 1, k) || BlockFence.n_(world.getTypeId(i, j - 1, k));
+ return World.a((IBlockAccess) world, i, j - 1, k) || BlockFence.a(world.getType(i, j - 1, k));
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
boolean flag = false;
- if (!world.w(i, j - 1, k) && !BlockFence.n_(world.getTypeId(i, j - 1, k))) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k) && !BlockFence.a(world.getType(i, j - 1, k))) {
flag = true;
}
if (flag) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
@@ -73,7 +73,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
int l = this.c(world.getData(i, j, k));
if (l > 0) {
- this.b(world, i, j, k, l);
+ this.a(world, i, j, k, l);
}
}
}
@@ -83,12 +83,12 @@ public abstract class BlockPressurePlateAbstract extends Block {
int l = this.c(world.getData(i, j, k));
if (l == 0) {
- this.b(world, i, j, k, l);
+ this.a(world, i, j, k, l);
}
}
}
- protected void b(World world, int i, int j, int k, int l) {
+ protected void a(World world, int i, int j, int k, int l) {
int i1 = this.e(world, i, j, k);
boolean flag = l > 0;
boolean flag1 = i1 > 0;
@@ -108,8 +108,8 @@ public abstract class BlockPressurePlateAbstract extends Block {
if (l != i1) {
world.setData(i, j, k, this.d(i1), 2);
- this.b_(world, i, j, k);
- world.g(i, j, k, i, j, k);
+ this.a_(world, i, j, k);
+ world.c(i, j, k, i, j, k);
}
if (!flag1 && flag) {
@@ -119,7 +119,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
}
if (flag1) {
- world.a(i, j, k, this.id, this.a(world));
+ world.a(i, j, k, this, this.a(world));
}
}
@@ -129,17 +129,17 @@ public abstract class BlockPressurePlateAbstract extends Block {
return 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));
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
- if (this.c(i1) > 0) {
- this.b_(world, i, j, k);
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ if (this.c(l) > 0) {
+ this.a_(world, i, j, k);
}
- super.remove(world, i, j, k, l, i1);
+ super.remove(world, i, j, k, block, l);
}
- protected void b_(World world, int i, int j, int k) {
- world.applyPhysics(i, j, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
+ protected void a_(World world, int i, int j, int k) {
+ world.applyPhysics(i, j, k, this);
+ world.applyPhysics(i, j - 1, k, this);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
index 23c6f874c1..25ef883d56 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
@@ -9,8 +9,8 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
private EnumMobType a;
- protected BlockPressurePlateBinary(int i, String s, Material material, EnumMobType enummobtype) {
- super(i, s, material);
+ protected BlockPressurePlateBinary(String s, Material material, EnumMobType enummobtype) {
+ super(s, material);
this.a = enummobtype;
}
@@ -63,7 +63,7 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
}
// CraftBukkit end
- if (!entity.au()) {
+ if (!entity.az()) {
return 15;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java
index 74df20a02a..52ec255b96 100644
--- a/src/main/java/net/minecraft/server/BlockPumpkin.java
+++ b/src/main/java/net/minecraft/server/BlockPumpkin.java
@@ -10,16 +10,16 @@ public class BlockPumpkin extends BlockDirectional {
private boolean a;
- protected BlockPumpkin(int i, boolean flag) {
- super(i, Material.PUMPKIN);
- this.b(true);
+ protected BlockPumpkin(boolean flag) {
+ super(Material.PUMPKIN);
+ this.a(true);
this.a = flag;
this.a(CreativeModeTab.b);
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
- if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
+ if (world.getType(i, j - 1, k) == Blocks.SNOW_BLOCK && world.getType(i, j - 2, k) == Blocks.SNOW_BLOCK) {
if (!world.isStatic) {
// CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
@@ -27,22 +27,20 @@ public class BlockPumpkin extends BlockDirectional {
blockList.setTypeId(i, j, k, 0);
blockList.setTypeId(i, j - 1, k, 0);
blockList.setTypeId(i, j - 2, k, 0);
-
EntitySnowman entitysnowman = new EntitySnowman(world);
entitysnowman.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
if (world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
blockList.updateList();
}
- // CraftBukkit end
}
for (int l = 0; l < 120; ++l) {
world.addParticle("snowshovel", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 2.5D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
}
- } else if (world.getTypeId(i, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.IRON_BLOCK.id) {
- boolean flag = world.getTypeId(i - 1, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i + 1, j - 1, k) == Block.IRON_BLOCK.id;
- boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id;
+ } else if (world.getType(i, j - 1, k) == Blocks.IRON_BLOCK && world.getType(i, j - 2, k) == Blocks.IRON_BLOCK) {
+ boolean flag = world.getType(i - 1, j - 1, k) == Blocks.IRON_BLOCK && world.getType(i + 1, j - 1, k) == Blocks.IRON_BLOCK;
+ boolean flag1 = world.getType(i, j - 1, k - 1) == Blocks.IRON_BLOCK && world.getType(i, j - 1, k + 1) == Blocks.IRON_BLOCK;
if (flag || flag1) {
// CraftBukkit start - Use BlockStateListPopulator
@@ -51,7 +49,6 @@ public class BlockPumpkin extends BlockDirectional {
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);
@@ -77,9 +74,7 @@ public class BlockPumpkin extends BlockDirectional {
}
public boolean canPlace(World world, int i, int j, int k) {
- int l = world.getTypeId(i, j, k);
-
- return (l == 0 || Block.byId[l].material.isReplaceable()) && world.w(i, j - 1, k);
+ return world.getType(i, j, k).material.isReplaceable() && World.a((IBlockAccess) world, i, j - 1, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
@@ -89,12 +84,12 @@ public class BlockPumpkin extends BlockDirectional {
}
// CraftBukkit start
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
- org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- int power = block.getBlockPower();
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (block != null && block.isPowerSource()) {
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
+ int power = bukkitBlock.getBlockPower();
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneLamp.java b/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
index e527e7fa17..cb802e8026 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
@@ -8,8 +8,8 @@ public class BlockRedstoneLamp extends Block {
private final boolean a;
- public BlockRedstoneLamp(int i, boolean flag) {
- super(i, Material.BUILDABLE_GLASS);
+ public BlockRedstoneLamp(boolean flag) {
+ super(Material.BUILDABLE_GLASS);
this.a = flag;
if (flag) {
this.a(1.0F);
@@ -19,7 +19,7 @@ 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.a(i, j, k, this.id, 4);
+ world.a(i, j, k, this, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
@@ -27,15 +27,15 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
+ world.setTypeAndData(i, j, k, Blocks.REDSTONE_LAMP_ON, 0, 2);
}
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
- world.a(i, j, k, this.id, 4);
+ world.a(i, j, k, this, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
@@ -43,7 +43,7 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
+ world.setTypeAndData(i, j, k, Blocks.REDSTONE_LAMP_ON, 0, 2);
}
}
}
@@ -56,11 +56,15 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_OFF.id, 0, 2);
+ world.setTypeAndData(i, j, k, Blocks.REDSTONE_LAMP_OFF, 0, 2);
}
}
- public int getDropType(int i, Random random, int j) {
- return Block.REDSTONE_LAMP_OFF.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Item.getItemOf(Blocks.REDSTONE_LAMP_OFF);
+ }
+
+ protected ItemStack j(int i) {
+ return new ItemStack(Blocks.REDSTONE_LAMP_OFF);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneOre.java b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
index 8e2a2bf0af..d5ed37e06c 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneOre.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
@@ -8,10 +8,10 @@ public class BlockRedstoneOre extends Block {
private boolean a;
- public BlockRedstoneOre(int i, boolean flag) {
- super(i, Material.STONE);
+ public BlockRedstoneOre(boolean flag) {
+ super(Material.STONE);
if (flag) {
- this.b(true);
+ this.a(true);
}
this.a = flag;
@@ -22,7 +22,7 @@ public class BlockRedstoneOre extends Block {
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
super.attack(world, i, j, k, entityhuman);
}
@@ -31,14 +31,14 @@ 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.k(world, i, j, k);
+ this.e(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.k(world, i, j, k);
+ this.e(world, i, j, k);
super.b(world, i, j, k, entity);
}
}
@@ -46,25 +46,25 @@ public class BlockRedstoneOre extends Block {
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
- private void k(World world, int i, int j, int k) {
+ private void e(World world, int i, int j, int k) {
this.m(world, i, j, k);
- if (this.id == Block.REDSTONE_ORE.id) {
- world.setTypeIdUpdate(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
+ if (this == Blocks.REDSTONE_ORE) {
+ world.setTypeUpdate(i, j, k, Blocks.GLOWING_REDSTONE_ORE);
}
}
public void a(World world, int i, int j, int k, Random random) {
- if (this.id == Block.GLOWING_REDSTONE_ORE.id) {
- world.setTypeIdUpdate(i, j, k, Block.REDSTONE_ORE.id);
+ if (this == Blocks.GLOWING_REDSTONE_ORE) {
+ world.setTypeUpdate(i, j, k, Blocks.REDSTONE_ORE);
}
}
- public int getDropType(int i, Random random, int j) {
- return Item.REDSTONE.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Items.REDSTONE;
}
public int getDropCount(int i, Random random) {
@@ -78,15 +78,16 @@ public class BlockRedstoneOre extends Block {
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);
/* CraftBukkit start - Delegated to getExpDrop
- if (this.getDropType(l, world.random, i1) != this.id) {
+ if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 1 + world.random.nextInt(5);
- this.j(world, i, j, k, j1);
- } */
+ this.dropExperience(world, i, j, k, j1);
+ }
+ // */
}
public int getExpDrop(World world, int l, int i1) {
- if (this.getDropType(l, world.random, i1) != this.id) {
+ if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 1 + world.random.nextInt(5);
return j1;
@@ -105,27 +106,27 @@ public class BlockRedstoneOre extends Block {
double d2 = (double) ((float) j + random.nextFloat());
double d3 = (double) ((float) k + random.nextFloat());
- if (l == 0 && !world.t(i, j + 1, k)) {
+ if (l == 0 && !world.getType(i, j + 1, k).c()) {
d2 = (double) (j + 1) + d0;
}
- if (l == 1 && !world.t(i, j - 1, k)) {
+ if (l == 1 && !world.getType(i, j - 1, k).c()) {
d2 = (double) (j + 0) - d0;
}
- if (l == 2 && !world.t(i, j, k + 1)) {
+ if (l == 2 && !world.getType(i, j, k + 1).c()) {
d3 = (double) (k + 1) + d0;
}
- if (l == 3 && !world.t(i, j, k - 1)) {
+ if (l == 3 && !world.getType(i, j, k - 1).c()) {
d3 = (double) (k + 0) - d0;
}
- if (l == 4 && !world.t(i + 1, j, k)) {
+ if (l == 4 && !world.getType(i + 1, j, k).c()) {
d1 = (double) (i + 1) + d0;
}
- if (l == 5 && !world.t(i - 1, j, k)) {
+ if (l == 5 && !world.getType(i - 1, j, k).c()) {
d1 = (double) (i + 0) - d0;
}
@@ -135,7 +136,7 @@ public class BlockRedstoneOre extends Block {
}
}
- protected ItemStack d_(int i) {
- return new ItemStack(Block.REDSTONE_ORE);
+ protected ItemStack j(int i) {
+ return new ItemStack(Blocks.REDSTONE_ORE);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index f176e666bb..8e014149bf 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -40,10 +40,9 @@ public class BlockRedstoneTorch extends BlockTorch {
return false;
}
- protected BlockRedstoneTorch(int i, boolean flag) {
- super(i);
+ protected BlockRedstoneTorch(boolean flag) {
this.isOn = flag;
- this.b(true);
+ this.a(true);
this.a((CreativeModeTab) null);
}
@@ -57,23 +56,23 @@ public class BlockRedstoneTorch extends BlockTorch {
}
if (this.isOn) {
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
- world.applyPhysics(i - 1, j, k, this.id);
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j - 1, k, this);
+ world.applyPhysics(i, j + 1, k, this);
+ world.applyPhysics(i - 1, j, k, this);
+ world.applyPhysics(i + 1, j, k, this);
+ world.applyPhysics(i, j, k - 1, this);
+ world.applyPhysics(i, j, k + 1, this);
}
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
+ public void remove(World world, int i, int j, int k, Block block, int l) {
if (this.isOn) {
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
- world.applyPhysics(i - 1, j, k, this.id);
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j - 1, k, this);
+ world.applyPhysics(i, j + 1, k, this);
+ world.applyPhysics(i - 1, j, k, this);
+ world.applyPhysics(i + 1, j, k, this);
+ world.applyPhysics(i, j, k - 1, this);
+ world.applyPhysics(i, j, k + 1, this);
}
}
@@ -121,7 +120,7 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k), 3);
+ world.setTypeAndData(i, j, k, Blocks.REDSTONE_TORCH_OFF, world.getData(i, j, k), 3);
if (this.a(world, i, j, k, true)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
@@ -145,16 +144,16 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k), 3);
+ world.setTypeAndData(i, j, k, Blocks.REDSTONE_TORCH_ON, world.getData(i, j, k), 3);
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.d(world, i, j, k, l)) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!this.b(world, i, j, k, block)) {
boolean flag = this.m(world, i, j, k);
if (this.isOn && flag || !this.isOn && !flag) {
- world.a(i, j, k, this.id, this.a(world));
+ world.a(i, j, k, this, this.a(world));
}
}
}
@@ -163,15 +162,15 @@ public class BlockRedstoneTorch extends BlockTorch {
return l == 0 ? this.b(iblockaccess, i, j, k, l) : 0;
}
- public int getDropType(int i, Random random, int j) {
- return Block.REDSTONE_TORCH_ON.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Item.getItemOf(Blocks.REDSTONE_TORCH_ON);
}
public boolean isPowerSource() {
return true;
}
- public boolean i(int i) {
- return i == Block.REDSTONE_TORCH_OFF.id || i == Block.REDSTONE_TORCH_ON.id;
+ public boolean c(Block block) {
+ return block == Blocks.REDSTONE_TORCH_OFF || block == Blocks.REDSTONE_TORCH_ON;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index 856df909f8..3cec378966 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -12,12 +12,12 @@ public class BlockRedstoneWire extends Block {
private boolean a = true;
private Set b = new HashSet();
- public BlockRedstoneWire(int i) {
- super(i, Material.ORIENTABLE);
+ public BlockRedstoneWire() {
+ super(Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -25,19 +25,19 @@ public class BlockRedstoneWire extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 5;
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.w(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
+ return World.a((IBlockAccess) world, i, j - 1, k) || world.getType(i, j - 1, k) == Blocks.GLOWSTONE;
}
- private void k(World world, int i, int j, int k) {
+ private void e(World world, int i, int j, int k) {
this.a(world, i, j, k, i, j, k);
ArrayList arraylist = new ArrayList(this.b);
@@ -46,7 +46,7 @@ public class BlockRedstoneWire extends Block {
for (int l = 0; l < arraylist.size(); ++l) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
- world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this.id);
+ world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this);
}
}
@@ -89,11 +89,11 @@ public class BlockRedstoneWire extends Block {
j2 = this.getPower(world, l2, j, i3, j2);
}
- if (world.u(l2, j, i3) && !world.u(i, j + 1, k)) {
+ if (world.getType(l2, j, i3).r() && !world.getType(i, j + 1, k).r()) {
if ((l2 != l || i3 != j1) && j >= i1) {
j2 = this.getPower(world, l2, j + 1, i3, j2);
}
- } else if (!world.u(l2, j, i3) && (l2 != l || i3 != j1) && j <= i1) {
+ } else if (!world.getType(l2, j, i3).r() && (l2 != l || i3 != j1) && j <= i1) {
j2 = this.getPower(world, l2, j - 1, i3, j2);
}
}
@@ -118,7 +118,6 @@ public class BlockRedstoneWire extends Block {
l1 = event.getNewCurrent();
}
// CraftBukkit end
-
if (k1 != l1) {
world.setData(i, j, k, l1, 2);
this.b.add(new ChunkPosition(i, j, k));
@@ -132,46 +131,46 @@ public class BlockRedstoneWire extends Block {
}
private void m(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);
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
+ if (world.getType(i, j, k) == this) {
+ world.applyPhysics(i, j, k, this);
+ world.applyPhysics(i - 1, j, k, this);
+ world.applyPhysics(i + 1, j, k, this);
+ world.applyPhysics(i, j, k - 1, this);
+ world.applyPhysics(i, j, k + 1, this);
+ world.applyPhysics(i, j - 1, k, this);
+ world.applyPhysics(i, j + 1, k, this);
}
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (!world.isStatic) {
- this.k(world, i, j, k);
- world.applyPhysics(i, j + 1, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
+ this.e(world, i, j, k);
+ world.applyPhysics(i, j + 1, k, this);
+ world.applyPhysics(i, j - 1, k, this);
this.m(world, i - 1, j, k);
this.m(world, i + 1, j, k);
this.m(world, i, j, k - 1);
this.m(world, i, j, k + 1);
- if (world.u(i - 1, j, k)) {
+ if (world.getType(i - 1, j, k).r()) {
this.m(world, i - 1, j + 1, k);
} else {
this.m(world, i - 1, j - 1, k);
}
- if (world.u(i + 1, j, k)) {
+ if (world.getType(i + 1, j, k).r()) {
this.m(world, i + 1, j + 1, k);
} else {
this.m(world, i + 1, j - 1, k);
}
- if (world.u(i, j, k - 1)) {
+ if (world.getType(i, j, k - 1).r()) {
this.m(world, i, j + 1, k - 1);
} else {
this.m(world, i, j - 1, k - 1);
}
- if (world.u(i, j, k + 1)) {
+ if (world.getType(i, j, k + 1).r()) {
this.m(world, i, j + 1, k + 1);
} else {
this.m(world, i, j - 1, k + 1);
@@ -179,39 +178,39 @@ public class BlockRedstoneWire extends Block {
}
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
- super.remove(world, i, j, k, l, i1);
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ super.remove(world, i, j, k, block, l);
if (!world.isStatic) {
- world.applyPhysics(i, j + 1, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i + 1, j, k, this.id);
- 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.k(world, i, j, k);
+ world.applyPhysics(i, j + 1, k, this);
+ world.applyPhysics(i, j - 1, k, this);
+ world.applyPhysics(i + 1, j, k, this);
+ world.applyPhysics(i - 1, j, k, this);
+ world.applyPhysics(i, j, k + 1, this);
+ world.applyPhysics(i, j, k - 1, this);
+ this.e(world, i, j, k);
this.m(world, i - 1, j, k);
this.m(world, i + 1, j, k);
this.m(world, i, j, k - 1);
this.m(world, i, j, k + 1);
- if (world.u(i - 1, j, k)) {
+ if (world.getType(i - 1, j, k).r()) {
this.m(world, i - 1, j + 1, k);
} else {
this.m(world, i - 1, j - 1, k);
}
- if (world.u(i + 1, j, k)) {
+ if (world.getType(i + 1, j, k).r()) {
this.m(world, i + 1, j + 1, k);
} else {
this.m(world, i + 1, j - 1, k);
}
- if (world.u(i, j, k - 1)) {
+ if (world.getType(i, j, k - 1).r()) {
this.m(world, i, j + 1, k - 1);
} else {
this.m(world, i, j - 1, k - 1);
}
- if (world.u(i, j, k + 1)) {
+ if (world.getType(i, j, k + 1).r()) {
this.m(world, i, j + 1, k + 1);
} else {
this.m(world, i, j - 1, k + 1);
@@ -221,7 +220,7 @@ public class BlockRedstoneWire extends Block {
// CraftBukkit - private -> public
public int getPower(World world, int i, int j, int k, int l) {
- if (world.getTypeId(i, j, k) != this.id) {
+ if (world.getType(i, j, k) != this) {
return l;
} else {
int i1 = world.getData(i, j, k);
@@ -230,23 +229,23 @@ public class BlockRedstoneWire extends Block {
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
boolean flag = this.canPlace(world, i, j, k);
if (flag) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
} else {
- this.c(world, i, j, k, 0, 0);
+ this.b(world, i, j, k, 0, 0);
world.setAir(i, j, k);
}
- super.doPhysics(world, i, j, k, l);
+ super.doPhysics(world, i, j, k, block);
}
}
- public int getDropType(int i, Random random, int j) {
- return Item.REDSTONE.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Items.REDSTONE;
}
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@@ -264,25 +263,25 @@ public class BlockRedstoneWire extends Block {
} else if (l == 1) {
return i1;
} else {
- boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.u(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
- boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.u(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
- boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.u(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
- boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.u(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
+ boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.getType(i - 1, j, k).r() && g(iblockaccess, i - 1, j - 1, k, -1);
+ boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.getType(i + 1, j, k).r() && g(iblockaccess, i + 1, j - 1, k, -1);
+ boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.getType(i, j, k - 1).r() && g(iblockaccess, i, j - 1, k - 1, -1);
+ boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.getType(i, j, k + 1).r() && g(iblockaccess, i, j - 1, k + 1, -1);
- if (!iblockaccess.u(i, j + 1, k)) {
- if (iblockaccess.u(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
+ if (!iblockaccess.getType(i, j + 1, k).r()) {
+ if (iblockaccess.getType(i - 1, j, k).r() && g(iblockaccess, i - 1, j + 1, k, -1)) {
flag = true;
}
- if (iblockaccess.u(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
+ if (iblockaccess.getType(i + 1, j, k).r() && g(iblockaccess, i + 1, j + 1, k, -1)) {
flag1 = true;
}
- if (iblockaccess.u(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
+ if (iblockaccess.getType(i, j, k - 1).r() && g(iblockaccess, i, j + 1, k - 1, -1)) {
flag2 = true;
}
- if (iblockaccess.u(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
+ if (iblockaccess.getType(i, j, k + 1).r() && g(iblockaccess, i, j + 1, k + 1, -1)) {
flag3 = true;
}
}
@@ -297,34 +296,28 @@ public class BlockRedstoneWire extends Block {
}
public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- int i1 = iblockaccess.getTypeId(i, j, k);
+ Block block = iblockaccess.getType(i, j, k);
- if (i1 == Block.REDSTONE_WIRE.id) {
+ if (block == Blocks.REDSTONE_WIRE) {
return true;
- } else if (i1 == 0) {
- return false;
- } else if (!Block.DIODE_OFF.g(i1)) {
- return Block.byId[i1].isPowerSource() && l != -1;
+ } else if (!Blocks.DIODE_OFF.e(block)) {
+ return block.isPowerSource() && l != -1;
} else {
- int j1 = iblockaccess.getData(i, j, k);
+ int i1 = iblockaccess.getData(i, j, k);
- return l == (j1 & 3) || l == Direction.f[j1 & 3];
+ return l == (i1 & 3) || l == Direction.f[i1 & 3];
}
}
public static boolean g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (f(iblockaccess, i, j, k, l)) {
return true;
+ } else if (iblockaccess.getType(i, j, k) == Blocks.DIODE_ON) {
+ int i1 = iblockaccess.getData(i, j, k);
+
+ return l == (i1 & 3);
} else {
- int i1 = iblockaccess.getTypeId(i, j, k);
-
- if (i1 == Block.DIODE_ON.id) {
- int j1 = iblockaccess.getData(i, j, k);
-
- return l == (j1 & 3);
- } else {
- return false;
- }
+ return false;
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 8657860125..a1350f6216 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -4,73 +4,78 @@ import java.util.Random;
public class BlockReed extends Block {
- protected BlockReed(int i) {
- super(i, Material.PLANT);
+ protected BlockReed() {
+ super(Material.PLANT);
float f = 0.375F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
- this.b(true);
+ this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
- if (world.isEmpty(i, j + 1, k)) {
- int l;
+ if (world.getType(i, j - 1, k) == Blocks.SUGAR_CANE_BLOCK || this.e(world, i, j, k)) {
+ if (world.isEmpty(i, j + 1, k)) {
+ int l;
- for (l = 1; world.getTypeId(i, j - l, k) == this.id; ++l) {
- ;
- }
+ for (l = 1; world.getType(i, j - l, k) == this; ++l) {
+ ;
+ }
- if (l < 3) {
- int i1 = world.getData(i, j, k);
+ if (l < 3) {
+ int i1 = world.getData(i, j, k);
- if (i1 == 15) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
- world.setData(i, j, k, 0, 4);
- } else {
- world.setData(i, j, k, i1 + 1, 4);
+ if (i1 == 15) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
+ world.setData(i, j, k, 0, 4);
+ } else {
+ world.setData(i, j, k, i1 + 1, 4);
+ }
}
}
}
}
public boolean canPlace(World world, int i, int j, int k) {
- int l = world.getTypeId(i, j - 1, k);
+ Block block = world.getType(i, j - 1, k);
- return l == this.id ? true : (l != Block.GRASS.id && l != Block.DIRT.id && l != Block.SAND.id ? false : (world.getMaterial(i - 1, j - 1, k) == Material.WATER ? true : (world.getMaterial(i + 1, j - 1, k) == Material.WATER ? true : (world.getMaterial(i, j - 1, k - 1) == Material.WATER ? true : world.getMaterial(i, j - 1, k + 1) == Material.WATER))));
+ return block == this ? true : (block != Blocks.GRASS && block != Blocks.DIRT && block != Blocks.SAND ? false : (world.getType(i - 1, j - 1, k).getMaterial() == Material.WATER ? true : (world.getType(i + 1, j - 1, k).getMaterial() == Material.WATER ? true : (world.getType(i, j - 1, k - 1).getMaterial() == Material.WATER ? true : world.getType(i, j - 1, k + 1).getMaterial() == Material.WATER))));
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- this.p_(world, i, j, k);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ this.e(world, i, j, k);
}
- protected final void p_(World world, int i, int j, int k) {
- if (!this.f(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ protected final boolean e(World world, int i, int j, int k) {
+ if (!this.j(world, i, j, k)) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
+ return false;
+ } else {
+ return true;
}
}
- public boolean f(World world, int i, int j, int k) {
+ public boolean j(World world, int i, int j, int k) {
return this.canPlace(world, i, j, k);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
- public int getDropType(int i, Random random, int j) {
- return Item.SUGAR_CANE.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Items.SUGAR_CANE;
}
public boolean c() {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 1;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 706d6c9bd7..830eb65dc0 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -5,17 +5,18 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.TreeType;
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate;
import org.bukkit.craftbukkit.util.StructureGrowDelegate;
import org.bukkit.entity.Player;
import org.bukkit.event.world.StructureGrowEvent;
// CraftBukkit end
-public class BlockSapling extends BlockFlower {
+public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
- public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
+ public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle", "acacia", "roofed_oak"};
+ private static final IIcon[] b = new IIcon[a.length];
- protected BlockSapling(int i) {
- super(i);
+ protected BlockSapling() {
float f = 0.4F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
@@ -44,64 +45,113 @@ public class BlockSapling extends BlockFlower {
// CraftBukkit - Added bonemeal, player and itemstack
public void d(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
- int l = world.getData(i, j, k) & 3;
- Object object = null;
- int i1 = 0;
- int j1 = 0;
- boolean flag = false;
+ int l = world.getData(i, j, k) & 7;
// CraftBukkit start - Records tree generation and calls StructureGrowEvent
StructureGrowDelegate delegate = new StructureGrowDelegate(world);
TreeType treeType = null;
- TreeGenerator gen = null;
boolean grownTree = false;
-
- if (l == 1) {
- treeType = TreeType.REDWOOD;
- gen = new WorldGenTaiga2(false);
- } else if (l == 2) {
- treeType = TreeType.BIRCH;
- gen = new WorldGenForest(false);
- } else if (l == 3) {
- for (i1 = 0; i1 >= -1; --i1) {
- for (j1 = 0; j1 >= -1; --j1) {
- if (this.d(world, i + i1, j, k + j1, 3) && this.d(world, i + i1 + 1, j, k + j1, 3) && this.d(world, i + i1, j, k + j1 + 1, 3) && this.d(world, i + i1 + 1, j, k + j1 + 1, 3)) {
- treeType = TreeType.JUNGLE;
- gen = new WorldGenMegaTree(false, 10 + random.nextInt(20), 3, 3);
- flag = true;
- break;
- }
- }
-
- if (gen != null) {
- break;
- }
- }
-
- if (gen == null) {
- j1 = 0;
- i1 = 0;
- treeType = TreeType.SMALL_JUNGLE;
- gen = new WorldGenTrees(false, 4 + random.nextInt(7), 3, 3, false);
- }
+ // Turn ternary operator into if statement to set treeType
+ //Object object = random.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
+ TreeGenerator object; // Changed to TreeGenerator
+ if (random.nextInt(10) == 0) {
+ treeType = TreeType.BIG_TREE;
+ object = new WorldGenBigTree(true);
} else {
treeType = TreeType.TREE;
- gen = new WorldGenTrees(false);
- if (random.nextInt(10) == 0) {
- treeType = TreeType.BIG_TREE;
- gen = new WorldGenBigTree(false);
+ object = new WorldGenTrees(true);
+ }
+ // CraftBukkit end
+ int i1 = 0;
+ int j1 = 0;
+ boolean flag = false;
+
+ switch (l) {
+ case 0:
+ default:
+ break;
+
+ case 1:
+ treeType = TreeType.REDWOOD; // CraftBukkit
+ label78:
+ for (i1 = 0; i1 >= -1; --i1) {
+ for (j1 = 0; j1 >= -1; --j1) {
+ if (this.a(world, i + i1, j, k + j1, 1) && this.a(world, i + i1 + 1, j, k + j1, 1) && this.a(world, i + i1, j, k + j1 + 1, 1) && this.a(world, i + i1 + 1, j, k + j1 + 1, 1)) {
+ object = new WorldGenMegaTree(false, random.nextBoolean());
+ flag = true;
+ break label78;
+ }
+ }
+ }
+
+ if (!flag) {
+ j1 = 0;
+ i1 = 0;
+ object = new WorldGenTaiga2(true);
+ }
+ break;
+
+ case 2:
+ treeType = TreeType.BIRCH; // CraftBukkit
+ object = new WorldGenForest(true, false);
+ break;
+
+ case 3:
+ label93:
+ for (i1 = 0; i1 >= -1; --i1) {
+ for (j1 = 0; j1 >= -1; --j1) {
+ if (this.a(world, i + i1, j, k + j1, 3) && this.a(world, i + i1 + 1, j, k + j1, 3) && this.a(world, i + i1, j, k + j1 + 1, 3) && this.a(world, i + i1 + 1, j, k + j1 + 1, 3)) {
+ treeType = TreeType.JUNGLE; // CraftBukkit
+ object = new WorldGenJungleTree(true, 10, 20, 3, 3);
+ flag = true;
+ break label93;
+ }
+ }
+ }
+
+ if (!flag) {
+ j1 = 0;
+ i1 = 0;
+ treeType = TreeType.SMALL_JUNGLE; // CraftBukkit
+ object = new WorldGenTrees(true, 4 + random.nextInt(7), 3, 3, false);
+ }
+ break;
+
+ case 4:
+ treeType = TreeType.ACACIA; // CraftBukkit
+ object = new WorldGenAcaciaTree(true);
+ break;
+
+ case 5:
+ label108:
+ for (i1 = 0; i1 >= -1; --i1) {
+ for (j1 = 0; j1 >= -1; --j1) {
+ if (this.a(world, i + i1, j, k + j1, 5) && this.a(world, i + i1 + 1, j, k + j1, 5) && this.a(world, i + i1, j, k + j1 + 1, 5) && this.a(world, i + i1 + 1, j, k + j1 + 1, 5)) {
+ object = new WorldGenForestTree(true);
+ treeType = TreeType.DARK_OAK; // CraftBukkit
+ flag = true;
+ break label108;
+ }
+ }
+ }
+
+ if (!flag) {
+ return;
}
}
+ Block block = Blocks.AIR;
+
if (flag) {
- world.setTypeIdAndData(i + i1, j, k + j1, 0, 0, 4);
- world.setTypeIdAndData(i + i1 + 1, j, k + j1, 0, 0, 4);
- world.setTypeIdAndData(i + i1, j, k + j1 + 1, 0, 0, 4);
- world.setTypeIdAndData(i + i1 + 1, j, k + j1 + 1, 0, 0, 4);
+ world.setTypeAndData(i + i1, j, k + j1, block, 0, 4);
+ world.setTypeAndData(i + i1 + 1, j, k + j1, block, 0, 4);
+ world.setTypeAndData(i + i1, j, k + j1 + 1, block, 0, 4);
+ world.setTypeAndData(i + i1 + 1, j, k + j1 + 1, block, 0, 4);
} else {
- world.setTypeIdAndData(i, j, k, 0, 0, 4);
+ world.setTypeAndData(i, j, k, block, 0, 4);
}
- grownTree = gen.generate(delegate, random, i + i1, j, k + j1);
+ // CraftBukkit start
+ grownTree = object.generate(new CraftBlockChangeDelegate(delegate), random, i + i1, j, k + j1);
if (grownTree) {
Location location = new Location(world.getWorld(), i, j, k);
StructureGrowEvent event = new StructureGrowEvent(location, treeType, bonemeal, player, delegate.getBlocks());
@@ -120,26 +170,38 @@ public class BlockSapling extends BlockFlower {
// We always consume bonemeal when trying to grow
--itemstack.count;
}
-
+ // No need to generate the tree again.
if (!grownTree) {
+ // CraftBukkit end
if (flag) {
- world.setTypeIdAndData(i + i1, j, k + j1, this.id, l, 4);
- world.setTypeIdAndData(i + i1 + 1, j, k + j1, this.id, l, 4);
- world.setTypeIdAndData(i + i1, j, k + j1 + 1, this.id, l, 4);
- world.setTypeIdAndData(i + i1 + 1, j, k + j1 + 1, this.id, l, 4);
+ world.setTypeAndData(i + i1, j, k + j1, this, l, 4);
+ world.setTypeAndData(i + i1 + 1, j, k + j1, this, l, 4);
+ world.setTypeAndData(i + i1, j, k + j1 + 1, this, l, 4);
+ world.setTypeAndData(i + i1 + 1, j, k + j1 + 1, this, l, 4);
} else {
- world.setTypeIdAndData(i, j, k, this.id, l, 4);
+ world.setTypeAndData(i, j, k, this, l, 4);
}
}
- // CraftBukkit end
}
- public boolean d(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;
+ public boolean a(World world, int i, int j, int k, int l) {
+ return world.getType(i, j, k) == this && (world.getData(i, j, k) & 7) == l;
}
public int getDropData(int i) {
- return i & 3;
+ return MathHelper.a(i & 7, 0, 5);
+ }
+
+ public boolean a(World world, int i, int j, int k, boolean flag) {
+ return true;
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ return (double) world.random.nextFloat() < 0.45D;
+ }
+
+ public void b(World world, Random random, int i, int j, int k) {
+ this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
}
// CraftBukkit start
@@ -147,7 +209,7 @@ public class BlockSapling extends BlockFlower {
public boolean a(World world, Random random, int i, int j, int k);
- public boolean generate(org.bukkit.BlockChangeDelegate world, Random random, int i, int j, int k);
+ public boolean generate(org.bukkit.craftbukkit.CraftBlockChangeDelegate world, Random random, int i, int j, int k);
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java
index 33dd19c13c..4ee331976e 100644
--- a/src/main/java/net/minecraft/server/BlockSign.java
+++ b/src/main/java/net/minecraft/server/BlockSign.java
@@ -9,8 +9,8 @@ public class BlockSign extends BlockContainer {
private Class a;
private boolean b;
- protected BlockSign(int i, Class oclass, boolean flag) {
- super(i, Material.WOOD);
+ protected BlockSign(Class oclass, boolean flag) {
+ super(Material.WOOD);
this.b = flag;
this.a = oclass;
float f = 0.25F;
@@ -19,7 +19,7 @@ public class BlockSign extends BlockContainer {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -51,11 +51,11 @@ public class BlockSign extends BlockContainer {
}
}
- public int d() {
+ public int b() {
return -1;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -67,7 +67,7 @@ public class BlockSign extends BlockContainer {
return false;
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
try {
return (TileEntity) this.a.newInstance();
} catch (Exception exception) {
@@ -75,51 +75,51 @@ public class BlockSign extends BlockContainer {
}
}
- public int getDropType(int i, Random random, int j) {
- return Item.SIGN.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Items.SIGN;
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
boolean flag = false;
if (this.b) {
- if (!world.getMaterial(i, j - 1, k).isBuildable()) {
+ if (!world.getType(i, j - 1, k).getMaterial().isBuildable()) {
flag = true;
}
} else {
- int i1 = world.getData(i, j, k);
+ int l = world.getData(i, j, k);
flag = true;
- if (i1 == 2 && world.getMaterial(i, j, k + 1).isBuildable()) {
+ if (l == 2 && world.getType(i, j, k + 1).getMaterial().isBuildable()) {
flag = false;
}
- if (i1 == 3 && world.getMaterial(i, j, k - 1).isBuildable()) {
+ if (l == 3 && world.getType(i, j, k - 1).getMaterial().isBuildable()) {
flag = false;
}
- if (i1 == 4 && world.getMaterial(i + 1, j, k).isBuildable()) {
+ if (l == 4 && world.getType(i + 1, j, k).getMaterial().isBuildable()) {
flag = false;
}
- if (i1 == 5 && world.getMaterial(i - 1, j, k).isBuildable()) {
+ if (l == 5 && world.getType(i - 1, j, k).getMaterial().isBuildable()) {
flag = false;
}
}
if (flag) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
- super.doPhysics(world, i, j, k, l);
+ super.doPhysics(world, i, j, k, block);
// CraftBukkit start
- if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
- org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- int power = block.getBlockPower();
+ if (block != null && block.isPowerSource()) {
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
+ int power = bukkitBlock.getBlockPower();
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/BlockSkull.java b/src/main/java/net/minecraft/server/BlockSkull.java
index 0e39332786..8e58157b7d 100644
--- a/src/main/java/net/minecraft/server/BlockSkull.java
+++ b/src/main/java/net/minecraft/server/BlockSkull.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.Random;
// CraftBukkit start
@@ -9,12 +10,12 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
public class BlockSkull extends BlockContainer {
- protected BlockSkull(int i) {
- super(i, Material.ORIENTABLE);
+ protected BlockSkull() {
+ super(Material.ORIENTABLE);
this.a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
}
- public int d() {
+ public int b() {
return -1;
}
@@ -22,7 +23,7 @@ public class BlockSkull extends BlockContainer {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -52,9 +53,9 @@ public class BlockSkull extends BlockContainer {
}
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.b(world, i, j, k);
+ return super.a(world, i, j, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
@@ -63,7 +64,7 @@ public class BlockSkull extends BlockContainer {
world.setData(i, j, k, l, 2);
}
- public TileEntity b(World world) {
+ public TileEntity a(World world, int i) {
return new TileEntitySkull();
}
@@ -80,7 +81,7 @@ public class BlockSkull extends BlockContainer {
// CraftBukkit start - Special case dropping so we can get info from the tile entity
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (world.random.nextFloat() < f) {
- ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k));
+ ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, i, j, k));
TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k);
if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) {
@@ -88,7 +89,7 @@ public class BlockSkull extends BlockContainer {
itemstack.getTag().setString("SkullOwner", tileentityskull.getExtraType());
}
- this.b(world, i, j, k, itemstack);
+ this.a(world, i, j, k, itemstack);
}
}
// CraftBukkit end
@@ -102,11 +103,13 @@ public class BlockSkull extends BlockContainer {
super.a(world, i, j, k, l, entityhuman);
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
+ public void remove(World world, int i, int j, int k, Block block, int l) {
if (!world.isStatic) {
- /* CraftBukkit start - Drop item in code above, not here
- if ((i1 & 8) == 0) {
- ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k));
+ // CraftBukkit start - Drop item in code above, not here
+ // if ((l & 8) == 0) {
+ if (false) {
+ // CraftBukkit end
+ ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, i, j, k));
TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k);
if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) {
@@ -114,92 +117,106 @@ public class BlockSkull extends BlockContainer {
itemstack.getTag().setString("SkullOwner", tileentityskull.getExtraType());
}
- this.b(world, i, j, k, itemstack);
+ this.a(world, i, j, k, itemstack);
}
- // CraftBukkit end */
- super.remove(world, i, j, k, l, i1);
+ super.remove(world, i, j, k, block, l);
}
}
- public int getDropType(int i, Random random, int j) {
- return Item.SKULL.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Items.SKULL;
}
public void a(World world, int i, int j, int k, TileEntitySkull tileentityskull) {
- if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty > 0 && !world.isStatic) {
- int l = Block.SOUL_SAND.id;
-
- int i1;
+ if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty != EnumDifficulty.PEACEFUL && !world.isStatic) {
+ int l;
EntityWither entitywither;
- int j1;
+ Iterator iterator;
+ EntityHuman entityhuman;
+ int i1;
- for (i1 = -2; i1 <= 0; ++i1) {
- if (world.getTypeId(i, j - 1, k + i1) == l && world.getTypeId(i, j - 1, k + i1 + 1) == l && world.getTypeId(i, j - 2, k + i1 + 1) == l && world.getTypeId(i, j - 1, k + i1 + 2) == l && this.d(world, i, j, k + i1, 1) && this.d(world, i, j, k + i1 + 1, 1) && this.d(world, i, j, k + i1 + 2, 1)) {
+ for (l = -2; l <= 0; ++l) {
+ if (world.getType(i, j - 1, k + l) == Blocks.SOUL_SAND && world.getType(i, j - 1, k + l + 1) == Blocks.SOUL_SAND && world.getType(i, j - 2, k + l + 1) == Blocks.SOUL_SAND && world.getType(i, j - 1, k + l + 2) == Blocks.SOUL_SAND && this.a(world, i, j, k + l, 1) && this.a(world, i, j, k + l + 1, 1) && this.a(world, i, j, k + l + 2, 1)) {
// CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
- world.setData(i, j, k + i1, 8, 2);
- world.setData(i, j, k + i1 + 1, 8, 2);
- world.setData(i, j, k + i1 + 2, 8, 2);
+ world.setData(i, j, k + l, 8, 2);
+ world.setData(i, j, k + l + 1, 8, 2);
+ world.setData(i, j, k + l + 2, 8, 2);
- blockList.setTypeId(i, j, k + i1, 0);
- blockList.setTypeId(i, j, k + i1 + 1, 0);
- blockList.setTypeId(i, j, k + i1 + 2, 0);
- blockList.setTypeId(i, j - 1, k + i1, 0);
- blockList.setTypeId(i, j - 1, k + i1 + 1, 0);
- blockList.setTypeId(i, j - 1, k + i1 + 2, 0);
- blockList.setTypeId(i, j - 2, k + i1 + 1, 0);
+ blockList.setTypeAndData(i, j, k + l, e(0), 0, 2);
+ blockList.setTypeAndData(i, j, k + l + 1, e(0), 0, 2);
+ blockList.setTypeAndData(i, j, k + l + 2, e(0), 0, 2);
+ blockList.setTypeAndData(i, j - 1, k + l, e(0), 0, 2);
+ blockList.setTypeAndData(i, j - 1, k + l + 1, e(0), 0, 2);
+ blockList.setTypeAndData(i, j - 1, k + l + 2, e(0), 0, 2);
+ blockList.setTypeAndData(i, j - 2, k + l + 1, e(0), 0, 2);
if (!world.isStatic) {
entitywither = new EntityWither(world);
- entitywither.setPositionRotation((double) i + 0.5D, (double) j - 1.45D, (double) (k + i1) + 1.5D, 90.0F, 0.0F);
+ entitywither.setPositionRotation((double) i + 0.5D, (double) j - 1.45D, (double) (k + l) + 1.5D, 90.0F, 0.0F);
entitywither.aN = 90.0F;
- entitywither.bT();
+ entitywither.bX();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ if (!world.isStatic) {
+ iterator = world.a(EntityHuman.class, entitywither.boundingBox.grow(50.0D, 50.0D, 50.0D)).iterator();
+
+ while (iterator.hasNext()) {
+ entityhuman = (EntityHuman) iterator.next();
+ entityhuman.a((Statistic) AchievementList.I);
+ }
+ }
+
blockList.updateList();
}
}
- for (j1 = 0; j1 < 120; ++j1) {
- world.addParticle("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) (k + i1 + 1) + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
+ for (i1 = 0; i1 < 120; ++i1) {
+ world.addParticle("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) (k + l + 1) + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
}
// CraftBukkit end
-
return;
}
}
- for (i1 = -2; i1 <= 0; ++i1) {
- if (world.getTypeId(i + i1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 2, k) == l && world.getTypeId(i + i1 + 2, j - 1, k) == l && this.d(world, i + i1, j, k, 1) && this.d(world, i + i1 + 1, j, k, 1) && this.d(world, i + i1 + 2, j, k, 1)) {
+ for (l = -2; l <= 0; ++l) {
+ if (world.getType(i + l, j - 1, k) == Blocks.SOUL_SAND && world.getType(i + l + 1, j - 1, k) == Blocks.SOUL_SAND && world.getType(i + l + 1, j - 2, k) == Blocks.SOUL_SAND && world.getType(i + l + 2, j - 1, k) == Blocks.SOUL_SAND && this.a(world, i + l, j, k, 1) && this.a(world, i + l + 1, j, k, 1) && this.a(world, i + l + 2, j, k, 1)) {
// CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
- world.setData(i + i1, j, k, 8, 2);
- world.setData(i + i1 + 1, j, k, 8, 2);
- world.setData(i + i1 + 2, j, k, 8, 2);
-
- blockList.setTypeId(i + i1, j, k, 0);
- blockList.setTypeId(i + i1 + 1, j, k, 0);
- blockList.setTypeId(i + i1 + 2, j, k, 0);
- blockList.setTypeId(i + i1, j - 1, k, 0);
- blockList.setTypeId(i + i1 + 1, j - 1, k, 0);
- blockList.setTypeId(i + i1 + 2, j - 1, k, 0);
- blockList.setTypeId(i + i1 + 1, j - 2, k, 0);
+ world.setData(i + l, j, k, 8, 2);
+ world.setData(i + l + 1, j, k, 8, 2);
+ world.setData(i + l + 2, j, k, 8, 2);
+ blockList.setTypeAndData(i + l, j, k, e(0), 0, 2);
+ blockList.setTypeAndData(i + l + 1, j, k, e(0), 0, 2);
+ blockList.setTypeAndData(i + l + 2, j, k, e(0), 0, 2);
+ blockList.setTypeAndData(i + l, j - 1, k, e(0), 0, 2);
+ blockList.setTypeAndData(i + l + 1, j - 1, k, e(0), 0, 2);
+ blockList.setTypeAndData(i + l + 2, j - 1, k, e(0), 0, 2);
+ blockList.setTypeAndData(i + l + 1, j - 2, k, e(0), 0, 2);
if (!world.isStatic) {
entitywither = new EntityWither(world);
- entitywither.setPositionRotation((double) (i + i1) + 1.5D, (double) j - 1.45D, (double) k + 0.5D, 0.0F, 0.0F);
- entitywither.bT();
+ entitywither.setPositionRotation((double) (i + l) + 1.5D, (double) j - 1.45D, (double) k + 0.5D, 0.0F, 0.0F);
+ entitywither.bX();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ if (!world.isStatic) {
+ iterator = world.a(EntityHuman.class, entitywither.boundingBox.grow(50.0D, 50.0D, 50.0D)).iterator();
+
+ while (iterator.hasNext()) {
+ entityhuman = (EntityHuman) iterator.next();
+ entityhuman.a((Statistic) AchievementList.I);
+ }
+ }
blockList.updateList();
}
}
- for (j1 = 0; j1 < 120; ++j1) {
- world.addParticle("snowballpoof", (double) (i + i1 + 1) + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
+ for (i1 = 0; i1 < 120; ++i1) {
+ world.addParticle("snowballpoof", (double) (i + l + 1) + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
}
// CraftBukkit end
@@ -209,8 +226,8 @@ public class BlockSkull extends BlockContainer {
}
}
- private boolean d(World world, int i, int j, int k, int l) {
- if (world.getTypeId(i, j, k) != this.id) {
+ private boolean a(World world, int i, int j, int k, int l) {
+ if (world.getType(i, j, k) != this) {
return false;
} else {
TileEntity tileentity = world.getTileEntity(i, j, k);
diff --git a/src/main/java/net/minecraft/server/BlockSnow.java b/src/main/java/net/minecraft/server/BlockSnow.java
index 5b913cb246..37a811ab82 100644
--- a/src/main/java/net/minecraft/server/BlockSnow.java
+++ b/src/main/java/net/minecraft/server/BlockSnow.java
@@ -4,15 +4,15 @@ import java.util.Random;
public class BlockSnow extends Block {
- protected BlockSnow(int i) {
- super(i, Material.SNOW_LAYER);
+ protected BlockSnow() {
+ super(Material.PACKED_ICE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
- this.b(true);
+ this.a(true);
this.a(CreativeModeTab.c);
- this.d(0);
+ this.b(0);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
int l = world.getData(i, j, k) & 7;
float f = 0.125F;
@@ -23,19 +23,19 @@ public class BlockSnow extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
public void g() {
- this.d(0);
+ this.b(0);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.d(iblockaccess.getData(i, j, k));
+ this.b(iblockaccess.getData(i, j, k));
}
- protected void d(int i) {
+ protected void b(int i) {
int j = i & 7;
float f = (float) (2 * (1 + j)) / 16.0F;
@@ -43,18 +43,18 @@ public class BlockSnow extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- int l = world.getTypeId(i, j - 1, k);
+ Block block = world.getType(i, j - 1, k);
- return l == 0 ? false : (l == this.id && (world.getData(i, j - 1, k) & 7) == 7 ? true : (l != Block.LEAVES.id && !Block.byId[l].c() ? false : world.getMaterial(i, j - 1, k).isSolid()));
+ return block != Blocks.ICE && block != Blocks.PACKED_ICE ? (block.getMaterial() == Material.LEAVES ? true : (block == this && (world.getData(i, j - 1, k) & 7) == 7 ? true : block.c() && block.material.isSolid())) : false;
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
this.m(world, i, j, k);
}
private boolean m(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@@ -63,16 +63,15 @@ public class BlockSnow extends Block {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- int i1 = Item.SNOW_BALL.id;
- int j1 = l & 7;
+ int i1 = l & 7;
- this.b(world, i, j, k, new ItemStack(i1, j1 + 1, 0));
+ this.a(world, i, j, k, new ItemStack(Items.SNOW_BALL, i1 + 1, 0));
world.setAir(i, j, k);
- entityhuman.a(StatisticList.C[this.id], 1);
+ entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
}
- public int getDropType(int i, Random random, int j) {
- return Item.SNOW_BALL.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Items.SNOW_BALL;
}
public int a(Random random) {
@@ -82,12 +81,12 @@ public class BlockSnow extends Block {
public void a(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()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Blocks.AIR).isCancelled()) {
return;
}
// CraftBukkit end
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
index 98611262be..b62cbd8da4 100644
--- a/src/main/java/net/minecraft/server/BlockSoil.java
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
@@ -9,14 +9,14 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
public class BlockSoil extends Block {
- protected BlockSoil(int i) {
- super(i, Material.EARTH);
- this.b(true);
+ protected BlockSoil() {
+ super(Material.EARTH);
+ this.a(true);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
- this.k(255);
+ this.g(255);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return AxisAlignedBB.a().a((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
}
@@ -24,7 +24,7 @@ public class BlockSoil extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -34,15 +34,15 @@ public class BlockSoil extends Block {
if (l > 0) {
world.setData(i, j, k, l - 1, 2);
- } else if (!this.k(world, i, j, k)) {
+ } else if (!this.e(world, i, j, k)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- if (CraftEventFactory.callBlockFadeEvent(block, Block.DIRT.id).isCancelled()) {
+ if (CraftEventFactory.callBlockFadeEvent(block, Blocks.DIRT).isCancelled()) {
return;
}
// CraftBukkit end
- world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
+ world.setTypeUpdate(i, j, k, Blocks.DIRT);
}
} else {
world.setData(i, j, k, 7, 2);
@@ -69,18 +69,18 @@ public class BlockSoil extends Block {
}
// CraftBukkit end
- world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
+ world.setTypeUpdate(i, j, k, Blocks.DIRT);
}
}
- private boolean k(World world, int i, int j, int k) {
+ private boolean e(World world, int i, int j, int k) {
byte b0 = 0;
for (int l = i - b0; l <= i + b0; ++l) {
for (int i1 = k - b0; i1 <= k + b0; ++i1) {
- int j1 = world.getTypeId(l, j + 1, i1);
+ Block block = world.getType(l, j + 1, i1);
- if (j1 == Block.CROPS.id || j1 == Block.MELON_STEM.id || j1 == Block.PUMPKIN_STEM.id || j1 == Block.POTATOES.id || j1 == Block.CARROTS.id) {
+ if (block == Blocks.CROPS || block == Blocks.MELON_STEM || block == Blocks.PUMPKIN_STEM || block == Blocks.POTATOES || block == Blocks.CARROTS) {
return true;
}
}
@@ -93,7 +93,7 @@ public class BlockSoil extends Block {
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) {
- if (world.getMaterial(l, i1, j1) == Material.WATER) {
+ if (world.getType(l, i1, j1).getMaterial() == Material.WATER) {
return true;
}
}
@@ -103,16 +103,16 @@ public class BlockSoil extends Block {
return false;
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- super.doPhysics(world, i, j, k, l);
- Material material = world.getMaterial(i, j + 1, k);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ super.doPhysics(world, i, j, k, block);
+ Material material = world.getType(i, j + 1, k).getMaterial();
if (material.isBuildable()) {
- world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
+ world.setTypeUpdate(i, j, k, Blocks.DIRT);
}
}
- public int getDropType(int i, Random random, int j) {
- return Block.DIRT.getDropType(0, random, j);
+ public Item getDropType(int i, Random random, int j) {
+ return Blocks.DIRT.getDropType(0, random, j);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java
index ca051d42d7..0de0c5b8d8 100644
--- a/src/main/java/net/minecraft/server/BlockStationary.java
+++ b/src/main/java/net/minecraft/server/BlockStationary.java
@@ -6,30 +6,26 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockStationary extends BlockFluids {
- protected BlockStationary(int i, Material material) {
- super(i, material);
- this.b(false);
+ protected BlockStationary(Material material) {
+ super(material);
+ this.a(false);
if (material == Material.LAVA) {
- this.b(true);
+ this.a(true);
}
}
- public boolean b(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.k(world, i, j, k);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ super.doPhysics(world, i, j, k, block);
+ if (world.getType(i, j, k) == this) {
+ this.n(world, i, j, k);
}
}
- private void k(World world, int i, int j, int k) {
+ private void n(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- world.setTypeIdAndData(i, j, k, this.id - 1, l, 2);
- world.a(i, j, k, this.id - 1, this.a(world));
+ world.setTypeAndData(i, j, k, Block.e(Block.b((Block) this) - 1), l, 2);
+ world.a(i, j, k, Block.e(Block.b((Block) this) - 1), this.a(world));
}
public void a(World world, int i, int j, int k, Random random) {
@@ -37,7 +33,6 @@ public class BlockStationary extends BlockFluids {
int l = random.nextInt(3);
int i1;
- int j1;
// CraftBukkit start - Prevent lava putting something on fire, remember igniter block coords
int x = i;
@@ -49,49 +44,50 @@ public class BlockStationary extends BlockFluids {
i += random.nextInt(3) - 1;
++j;
k += random.nextInt(3) - 1;
- j1 = world.getTypeId(i, j, k);
- if (j1 == 0) {
- if (this.m(world, i - 1, j, k) || this.m(world, i + 1, j, k) || this.m(world, i, j, k - 1) || this.m(world, i, j, k + 1) || this.m(world, i, j - 1, k) || this.m(world, i, j + 1, k)) {
+ Block block = world.getType(i, j, k);
+
+ if (block.material == Material.AIR) {
+ if (this.o(world, i - 1, j, k) || this.o(world, i + 1, j, k) || this.o(world, i, j, k - 1) || this.o(world, i, j, k + 1) || this.o(world, i, j - 1, k) || this.o(world, i, j + 1, k)) {
// CraftBukkit start - Prevent lava putting something on fire
- if (world.getTypeId(i, j, k) != Block.FIRE.id) {
+ if (world.getType(i, j, k) != Blocks.FIRE) {
if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, x, y, z).isCancelled()) {
continue;
}
}
// CraftBukkit end
- world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ world.setTypeUpdate(i, j, k, Blocks.FIRE);
return;
}
- } else if (Block.byId[j1].material.isSolid()) {
+ } else if (block.material.isSolid()) {
return;
}
}
if (l == 0) {
i1 = i;
- j1 = k;
+ int j1 = k;
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.m(world, i, j, k)) {
+ if (world.isEmpty(i, j + 1, k) && this.o(world, i, j, k)) {
// CraftBukkit start - Prevent lava putting something on fire
- if (world.getTypeId(i, j + 1, k) != Block.FIRE.id) {
+ if (world.getType(i, j + 1, k) != Blocks.FIRE) {
if (CraftEventFactory.callBlockIgniteEvent(world, i, j + 1, k, x, y, z).isCancelled()) {
continue;
}
}
// CraftBukkit end
- world.setTypeIdUpdate(i, j + 1, k, Block.FIRE.id);
+ world.setTypeUpdate(i, j + 1, k, Blocks.FIRE);
}
}
}
}
}
- private boolean m(World world, int i, int j, int k) {
- return world.getMaterial(i, j, k).isBurnable();
+ private boolean o(World world, int i, int j, int k) {
+ return world.getType(i, j, k).getMaterial().isBurnable();
}
}
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
index f2d4e5780e..4fae805bff 100644
--- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -4,48 +4,48 @@ import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
-public class BlockStem extends BlockFlower {
+public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
private final Block blockFruit;
- protected BlockStem(int i, Block block) {
- super(i);
+ protected BlockStem(Block block) {
this.blockFruit = block;
- this.b(true);
+ this.a(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 g_(int i) {
- return i == Block.SOIL.id;
+ protected boolean a(Block block) {
+ return block == Blocks.SOIL;
}
public void a(World world, int i, int j, int k, Random random) {
super.a(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9) {
- float f = this.m(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);
if (l < 7) {
- CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
+ ++l;
+ CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
} else {
- if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
+ if (world.getType(i - 1, j, k) == this.blockFruit) {
return;
}
- if (world.getTypeId(i + 1, j, k) == this.blockFruit.id) {
+ if (world.getType(i + 1, j, k) == this.blockFruit) {
return;
}
- if (world.getTypeId(i, j, k - 1) == this.blockFruit.id) {
+ if (world.getType(i, j, k - 1) == this.blockFruit) {
return;
}
- if (world.getTypeId(i, j, k + 1) == this.blockFruit.id) {
+ if (world.getType(i, j, k + 1) == this.blockFruit) {
return;
}
@@ -69,17 +69,17 @@ public class BlockStem extends BlockFlower {
++k1;
}
- int l1 = world.getTypeId(j1, j - 1, k1);
+ Block block = world.getType(j1, j - 1, k1);
- if (world.getTypeId(j1, j, k1) == 0 && (l1 == Block.SOIL.id || l1 == Block.DIRT.id || l1 == Block.GRASS.id)) {
- CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit.id, 0); // CraftBukkit
+ if (world.getType(j1, j, k1).material == Material.AIR && (block == Blocks.SOIL || block == Blocks.DIRT || block == Blocks.GRASS)) {
+ CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit, 0); // CraftBukkit
}
}
}
}
}
- public void k(World world, int i, int j, int k) {
+ public void m(World world, int i, int j, int k) {
int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
if (l > 7) {
@@ -89,33 +89,33 @@ public class BlockStem extends BlockFlower {
world.setData(i, j, k, l, 2);
}
- private float m(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);
- int j1 = world.getTypeId(i - 1, j, k);
- int k1 = world.getTypeId(i + 1, j, k);
- int l1 = world.getTypeId(i - 1, j, k - 1);
- int i2 = world.getTypeId(i + 1, j, k - 1);
- int j2 = world.getTypeId(i + 1, j, k + 1);
- int k2 = world.getTypeId(i - 1, j, k + 1);
- boolean flag = j1 == this.id || k1 == this.id;
- boolean flag1 = l == this.id || i1 == this.id;
- boolean flag2 = l1 == this.id || i2 == this.id || j2 == this.id || k2 == this.id;
+ Block block = world.getType(i, j, k - 1);
+ Block block1 = world.getType(i, j, k + 1);
+ Block block2 = world.getType(i - 1, j, k);
+ Block block3 = world.getType(i + 1, j, k);
+ Block block4 = world.getType(i - 1, j, k - 1);
+ Block block5 = world.getType(i + 1, j, k - 1);
+ Block block6 = world.getType(i + 1, j, k + 1);
+ Block block7 = world.getType(i - 1, j, k + 1);
+ boolean flag = block2 == this || block3 == this;
+ boolean flag1 = block == this || block1 == this;
+ boolean flag2 = block4 == this || block5 == this || block6 == this || block7 == this;
- for (int l2 = i - 1; l2 <= i + 1; ++l2) {
- for (int i3 = k - 1; i3 <= k + 1; ++i3) {
- int j3 = world.getTypeId(l2, j - 1, i3);
+ for (int l = i - 1; l <= i + 1; ++l) {
+ for (int i1 = k - 1; i1 <= k + 1; ++i1) {
+ Block block8 = world.getType(l, j - 1, i1);
float f1 = 0.0F;
- if (j3 == Block.SOIL.id) {
+ if (block8 == Blocks.SOIL) {
f1 = 1.0F;
- if (world.getData(l2, j - 1, i3) > 0) {
+ if (world.getData(l, j - 1, i1) > 0) {
f1 = 3.0F;
}
}
- if (l2 != i || i3 != k) {
+ if (l != i || i1 != k) {
f1 /= 4.0F;
}
@@ -143,7 +143,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 d() {
+ public int b() {
return 19;
}
@@ -152,27 +152,39 @@ public class BlockStem extends BlockFlower {
if (!world.isStatic) {
Item item = null;
- if (this.blockFruit == Block.PUMPKIN) {
- item = Item.PUMPKIN_SEEDS;
+ if (this.blockFruit == Blocks.PUMPKIN) {
+ item = Items.PUMPKIN_SEEDS;
}
- if (this.blockFruit == Block.MELON) {
- item = Item.MELON_SEEDS;
+ if (this.blockFruit == Blocks.MELON) {
+ item = Items.MELON_SEEDS;
}
for (int j1 = 0; j1 < 3; ++j1) {
if (world.random.nextInt(15) <= l) {
- this.b(world, i, j, k, new ItemStack(item));
+ this.a(world, i, j, k, new ItemStack(item));
}
}
}
}
- public int getDropType(int i, Random random, int j) {
- return -1;
+ public Item getDropType(int i, Random random, int j) {
+ return null;
}
public int a(Random random) {
return 1;
}
+
+ public boolean a(World world, int i, int j, int k, boolean flag) {
+ return world.getData(i, j, k) != 7;
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ return true;
+ }
+
+ public void b(World world, Random random, int i, int j, int k) {
+ this.m(world, i, j, k);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockTrapdoor.java b/src/main/java/net/minecraft/server/BlockTrapdoor.java
index 37e321d5a2..ecc429ea91 100644
--- a/src/main/java/net/minecraft/server/BlockTrapdoor.java
+++ b/src/main/java/net/minecraft/server/BlockTrapdoor.java
@@ -4,8 +4,8 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTrapdoor extends Block {
- protected BlockTrapdoor(int i, Material material) {
- super(i, material);
+ protected BlockTrapdoor(Material material) {
+ super(material);
float f = 0.5F;
float f1 = 1.0F;
@@ -17,25 +17,25 @@ public class BlockTrapdoor extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
- return !f(iblockaccess.getData(i, j, k));
+ return !d(iblockaccess.getData(i, j, k));
}
- public int d() {
+ public int b() {
return 0;
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.b(world, i, j, k);
+ return super.a(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.d(iblockaccess.getData(i, j, k));
+ this.b(iblockaccess.getData(i, j, k));
}
public void g() {
@@ -44,7 +44,7 @@ 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 b(int i) {
float f = 0.1875F;
if ((i & 8) != 0) {
@@ -53,7 +53,7 @@ public class BlockTrapdoor extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
}
- if (f(i)) {
+ if (d(i)) {
if ((i & 3) == 0) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
@@ -96,48 +96,51 @@ public class BlockTrapdoor extends Block {
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
+ public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
- int i1 = world.getData(i, j, k);
- int j1 = i;
- int k1 = k;
+ int l = world.getData(i, j, k);
+ int i1 = i;
+ int j1 = k;
- if ((i1 & 3) == 0) {
- k1 = k + 1;
+ if ((l & 3) == 0) {
+ j1 = k + 1;
}
- if ((i1 & 3) == 1) {
- --k1;
- }
-
- if ((i1 & 3) == 2) {
- j1 = i + 1;
- }
-
- if ((i1 & 3) == 3) {
+ if ((l & 3) == 1) {
--j1;
}
- if (!g(world.getTypeId(j1, j, k1))) {
- world.setAir(i, j, k);
- this.c(world, i, j, k, i1, 0);
+ if ((l & 3) == 2) {
+ i1 = i + 1;
}
- // CraftBukkit start
- if (l == 0 || l > 0 && Block.byId[l] != null && Block.byId[l].isPowerSource()) {
- org.bukkit.World bworld = world.getWorld();
- org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
+ if ((l & 3) == 3) {
+ --i1;
+ }
- int power = block.getBlockPower();
+ if (!a(world.getType(i1, j, j1))) {
+ world.setAir(i, j, k);
+ this.b(world, i, j, k, l, 0);
+ }
+
+ boolean flag = world.isBlockIndirectlyPowered(i, j, k);
+
+ if (flag || block.isPowerSource()) {
+ // CraftBukkit start
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.block.Block bblock = bworld.getBlockAt(i, j, k);
+
+ int power = bblock.getBlockPower();
int oldPower = (world.getData(i, j, k) & 4) > 0 ? 15 : 0;
- if (oldPower == 0 ^ power == 0 || (Block.byId[l] != null && Block.byId[l].isPowerSource())) {
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power);
+ if (oldPower == 0 ^ power == 0 || block.isPowerSource()) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
-
- this.setOpen(world, i, j, k, eventRedstone.getNewCurrent() > 0);
+ flag = eventRedstone.getNewCurrent() > 0;
}
// CraftBukkit end
+
+ this.setOpen(world, i, j, k, flag);
}
}
}
@@ -195,21 +198,15 @@ public class BlockTrapdoor extends Block {
--i;
}
- return g(world.getTypeId(i, j, k));
+ return a(world.getType(i, j, k));
}
}
- public static boolean f(int i) {
+ public static boolean d(int i) {
return (i & 4) != 0;
}
- private static boolean g(int i) {
- if (i <= 0) {
- return false;
- } else {
- Block block = Block.byId[i];
-
- return block != null && block.material.k() && block.b() || block == Block.GLOWSTONE || block instanceof BlockStepAbstract || block instanceof BlockStairs;
- }
+ private static boolean a(Block block) {
+ return block.material.k() && block.d() || block == Blocks.GLOWSTONE || block instanceof BlockStepAbstract || block instanceof BlockStairs;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTripwire.java b/src/main/java/net/minecraft/server/BlockTripwire.java
index 4239889124..347a0aeb68 100644
--- a/src/main/java/net/minecraft/server/BlockTripwire.java
+++ b/src/main/java/net/minecraft/server/BlockTripwire.java
@@ -8,17 +8,17 @@ import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
public class BlockTripwire extends Block {
- public BlockTripwire(int i) {
- super(i, Material.ORIENTABLE);
+ public BlockTripwire() {
+ super(Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
- this.b(true);
+ this.a(true);
}
public int a(World world) {
return 10;
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -26,25 +26,25 @@ public class BlockTripwire extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 30;
}
- public int getDropType(int i, Random random, int j) {
- return Item.STRING.id;
+ public Item getDropType(int i, Random random, int j) {
+ return Items.STRING;
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- int i1 = world.getData(i, j, k);
- boolean flag = (i1 & 2) == 2;
- boolean flag1 = !world.w(i, j - 1, k);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ int l = world.getData(i, j, k);
+ boolean flag = (l & 2) == 2;
+ boolean flag1 = !World.a((IBlockAccess) world, i, j - 1, k);
if (flag != flag1) {
- this.c(world, i, j, k, i1, 0);
+ this.b(world, i, j, k, l, 0);
world.setAir(i, j, k);
}
}
@@ -64,25 +64,25 @@ public class BlockTripwire extends Block {
}
public void onPlace(World world, int i, int j, int k) {
- int l = world.w(i, j - 1, k) ? 0 : 2;
+ int l = World.a((IBlockAccess) world, i, j - 1, k) ? 0 : 2;
world.setData(i, j, k, l, 3);
- this.d(world, i, j, k, l);
+ this.a(world, i, j, k, l);
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
- this.d(world, i, j, k, i1 | 1);
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ this.a(world, i, j, k, l | 1);
}
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (!world.isStatic) {
- if (entityhuman.by() != null && entityhuman.by().id == Item.SHEARS.id) {
+ if (entityhuman.bD() != null && entityhuman.bD().getItem() == Items.SHEARS) {
world.setData(i, j, k, l | 8, 4);
}
}
}
- private void d(World world, int i, int j, int k, int l) {
+ private void a(World world, int i, int j, int k, int l) {
int i1 = 0;
while (i1 < 2) {
@@ -92,15 +92,15 @@ public class BlockTripwire extends Block {
if (j1 < 42) {
int k1 = i + Direction.a[i1] * j1;
int l1 = k + Direction.b[i1] * j1;
- int i2 = world.getTypeId(k1, j, l1);
+ Block block = world.getType(k1, j, l1);
- if (i2 == Block.TRIPWIRE_SOURCE.id) {
- int j2 = world.getData(k1, j, l1) & 3;
+ if (block == Blocks.TRIPWIRE_SOURCE) {
+ int i2 = world.getData(k1, j, l1) & 3;
- if (j2 == Direction.f[i1]) {
- Block.TRIPWIRE_SOURCE.a(world, k1, j, l1, i2, world.getData(k1, j, l1), true, j1, l);
+ if (i2 == Direction.f[i1]) {
+ Blocks.TRIPWIRE_SOURCE.a(world, k1, j, l1, false, world.getData(k1, j, l1), true, j1, l);
}
- } else if (i2 == Block.TRIPWIRE.id) {
+ } else if (block == Blocks.TRIPWIRE) {
++j1;
continue;
}
@@ -115,7 +115,7 @@ public class BlockTripwire 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) != 1) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
}
}
}
@@ -123,12 +123,12 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if ((world.getData(i, j, k) & 1) == 1) {
- this.k(world, i, j, k);
+ this.e(world, i, j, k);
}
}
}
- private void k(World world, int i, int j, int k) {
+ private void e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
boolean flag = (l & 1) == 1;
boolean flag1 = false;
@@ -140,7 +140,7 @@ public class BlockTripwire extends Block {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- if (!entity.au()) {
+ if (!entity.az()) {
flag1 = true;
break;
}
@@ -191,11 +191,11 @@ public class BlockTripwire extends Block {
if (flag1 != flag) {
world.setData(i, j, k, l, 3);
- this.d(world, i, j, k, l);
+ this.a(world, i, j, k, l);
}
if (flag1) {
- world.a(i, j, k, this.id, this.a(world));
+ world.a(i, j, k, this, this.a(world));
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTripwireHook.java b/src/main/java/net/minecraft/server/BlockTripwireHook.java
index 5f70c3897b..c23426583e 100644
--- a/src/main/java/net/minecraft/server/BlockTripwireHook.java
+++ b/src/main/java/net/minecraft/server/BlockTripwireHook.java
@@ -6,13 +6,13 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTripwireHook extends Block {
- public BlockTripwireHook(int i) {
- super(i, Material.ORIENTABLE);
+ public BlockTripwireHook() {
+ super(Material.ORIENTABLE);
this.a(CreativeModeTab.d);
- this.b(true);
+ this.a(true);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@@ -20,11 +20,11 @@ public class BlockTripwireHook extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
- public int d() {
+ public int b() {
return 29;
}
@@ -33,11 +33,11 @@ public class BlockTripwireHook extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)));
+ return l == 2 && world.getType(i, j, k + 1).r() ? true : (l == 3 && world.getType(i, j, k - 1).r() ? true : (l == 4 && world.getType(i + 1, j, k).r() ? true : l == 5 && world.getType(i - 1, j, k).r()));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : world.u(i, j, k + 1)));
+ return world.getType(i - 1, j, k).r() ? true : (world.getType(i + 1, j, k).r() ? true : (world.getType(i, j, k - 1).r() ? true : world.getType(i, j, k + 1).r()));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@@ -63,100 +63,102 @@ public class BlockTripwireHook extends Block {
}
public void postPlace(World world, int i, int j, int k, int l) {
- this.a(world, i, j, k, this.id, l, false, -1, 0);
+ this.a(world, i, j, k, false, l, false, -1, 0);
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (l != this.id) {
- if (this.k(world, i, j, k)) {
- int i1 = world.getData(i, j, k);
- int j1 = i1 & 3;
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (block != this) {
+ if (this.e(world, i, j, k)) {
+ int l = world.getData(i, j, k);
+ int i1 = l & 3;
boolean flag = false;
- if (!world.u(i - 1, j, k) && j1 == 3) {
+ if (!world.getType(i - 1, j, k).r() && i1 == 3) {
flag = true;
}
- if (!world.u(i + 1, j, k) && j1 == 1) {
+ if (!world.getType(i + 1, j, k).r() && i1 == 1) {
flag = true;
}
- if (!world.u(i, j, k - 1) && j1 == 0) {
+ if (!world.getType(i, j, k - 1).r() && i1 == 0) {
flag = true;
}
- if (!world.u(i, j, k + 1) && j1 == 2) {
+ if (!world.getType(i, j, k + 1).r() && i1 == 2) {
flag = true;
}
if (flag) {
- this.c(world, i, j, k, i1, 0);
+ this.b(world, i, j, k, l, 0);
world.setAir(i, j, k);
}
}
}
}
- public void a(World world, int i, int j, int k, int l, int i1, boolean flag, int j1, int k1) {
- int l1 = i1 & 3;
- boolean flag1 = (i1 & 4) == 4;
- boolean flag2 = (i1 & 8) == 8;
- boolean flag3 = l == Block.TRIPWIRE_SOURCE.id;
- boolean flag4 = false;
- boolean flag5 = !world.w(i, j - 1, k);
- int i2 = Direction.a[l1];
- int j2 = Direction.b[l1];
- int k2 = 0;
+ public void a(World world, int i, int j, int k, boolean flag, int l, boolean flag1, int i1, int j1) {
+ int k1 = l & 3;
+ boolean flag2 = (l & 4) == 4;
+ boolean flag3 = (l & 8) == 8;
+ boolean flag4 = !flag;
+ boolean flag5 = false;
+ boolean flag6 = !World.a((IBlockAccess) world, i, j - 1, k);
+ int l1 = Direction.a[k1];
+ int i2 = Direction.b[k1];
+ int j2 = 0;
int[] aint = new int[42];
+ int k2;
int l2;
int i3;
int j3;
- int k3;
- int l3;
- for (i3 = 1; i3 < 42; ++i3) {
- l2 = i + i2 * i3;
- k3 = k + j2 * i3;
- j3 = world.getTypeId(l2, j, k3);
- if (j3 == Block.TRIPWIRE_SOURCE.id) {
- l3 = world.getData(l2, j, k3);
- if ((l3 & 3) == Direction.f[l1]) {
- k2 = i3;
+ for (l2 = 1; l2 < 42; ++l2) {
+ k2 = i + l1 * l2;
+ i3 = k + i2 * l2;
+ Block block = world.getType(k2, j, i3);
+
+ if (block == Blocks.TRIPWIRE_SOURCE) {
+ j3 = world.getData(k2, j, i3);
+ if ((j3 & 3) == Direction.f[k1]) {
+ j2 = l2;
}
break;
}
- if (j3 != Block.TRIPWIRE.id && i3 != j1) {
- aint[i3] = -1;
- flag3 = false;
+ if (block != Blocks.TRIPWIRE && l2 != i1) {
+ aint[l2] = -1;
+ flag4 = false;
} else {
- l3 = i3 == j1 ? k1 : world.getData(l2, j, k3);
- boolean flag6 = (l3 & 8) != 8;
- boolean flag7 = (l3 & 1) == 1;
- boolean flag8 = (l3 & 2) == 2;
+ j3 = l2 == i1 ? j1 : world.getData(k2, j, i3);
+ boolean flag7 = (j3 & 8) != 8;
+ boolean flag8 = (j3 & 1) == 1;
+ boolean flag9 = (j3 & 2) == 2;
- flag3 &= flag8 == flag5;
- flag4 |= flag6 && flag7;
- aint[i3] = l3;
- if (i3 == j1) {
- world.a(i, j, k, l, this.a(world));
- flag3 &= flag6;
+ flag4 &= flag9 == flag6;
+ flag5 |= flag7 && flag8;
+ aint[l2] = j3;
+ if (l2 == i1) {
+ world.a(i, j, k, this, this.a(world));
+ flag4 &= flag7;
}
}
}
- flag3 &= k2 > 1;
- flag4 &= flag3;
- i3 = (flag3 ? 4 : 0) | (flag4 ? 8 : 0);
- i1 = l1 | i3;
- if (k2 > 0) {
- l2 = i + i2 * k2;
- k3 = k + j2 * k2;
- j3 = Direction.f[l1];
- world.setData(l2, j, k3, j3 | i3, 3);
- this.d(world, l2, j, k3, j3);
- this.a(world, l2, j, k3, flag3, flag4, flag1, flag2);
+ flag4 &= j2 > 1;
+ flag5 &= flag4;
+ l2 = (flag4 ? 4 : 0) | (flag5 ? 8 : 0);
+ l = k1 | l2;
+ int k3;
+
+ if (j2 > 0) {
+ k2 = i + l1 * j2;
+ i3 = k + i2 * j2;
+ k3 = Direction.f[k1];
+ world.setData(k2, j, i3, k3 | l2, 3);
+ this.a(world, k2, j, i3, k3);
+ this.a(world, k2, j, i3, flag4, flag5, flag2, flag3);
}
// CraftBukkit start
@@ -170,34 +172,34 @@ public class BlockTripwireHook extends Block {
}
// CraftBukkit end
- this.a(world, i, j, k, flag3, flag4, flag1, flag2);
- if (l > 0) {
- world.setData(i, j, k, i1, 3);
- if (flag) {
- this.d(world, i, j, k, l1);
+ this.a(world, i, j, k, flag4, flag5, flag2, flag3);
+ if (!flag) {
+ world.setData(i, j, k, l, 3);
+ if (flag1) {
+ this.a(world, i, j, k, k1);
}
}
- if (flag1 != flag3) {
- for (l2 = 1; l2 < k2; ++l2) {
- k3 = i + i2 * l2;
- j3 = k + j2 * l2;
- l3 = aint[l2];
- if (l3 >= 0) {
- if (flag3) {
- l3 |= 4;
+ if (flag2 != flag4) {
+ for (k2 = 1; k2 < j2; ++k2) {
+ i3 = i + l1 * k2;
+ k3 = k + i2 * k2;
+ j3 = aint[k2];
+ if (j3 >= 0) {
+ if (flag4) {
+ j3 |= 4;
} else {
- l3 &= -5;
+ j3 &= -5;
}
- world.setData(k3, j, j3, l3, 3);
+ world.setData(i3, j, k3, j3, 3);
}
}
}
}
public void a(World world, int i, int j, int k, Random random) {
- this.a(world, i, j, k, this.id, world.getData(i, j, k), true, -1, 0);
+ this.a(world, i, j, k, false, world.getData(i, j, k), true, -1, 0);
}
private void a(World world, int i, int j, int k, boolean flag, boolean flag1, boolean flag2, boolean flag3) {
@@ -212,22 +214,22 @@ public class BlockTripwireHook extends Block {
}
}
- private void d(World world, int i, int j, int k, int l) {
- world.applyPhysics(i, j, k, this.id);
+ private void a(World world, int i, int j, int k, int l) {
+ world.applyPhysics(i, j, k, this);
if (l == 3) {
- world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this);
} else if (l == 1) {
- world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i + 1, j, k, this);
} else if (l == 0) {
- world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j, k - 1, this);
} else if (l == 2) {
- world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k + 1, this);
}
}
- private boolean k(World world, int i, int j, int k) {
+ private boolean e(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@@ -250,30 +252,30 @@ public class BlockTripwireHook extends Block {
}
}
- public void remove(World world, int i, int j, int k, int l, int i1) {
- boolean flag = (i1 & 4) == 4;
- boolean flag1 = (i1 & 8) == 8;
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ boolean flag = (l & 4) == 4;
+ boolean flag1 = (l & 8) == 8;
if (flag || flag1) {
- this.a(world, i, j, k, 0, i1, false, -1, 0);
+ this.a(world, i, j, k, true, l, false, -1, 0);
}
if (flag1) {
- world.applyPhysics(i, j, k, this.id);
- int j1 = i1 & 3;
+ world.applyPhysics(i, j, k, this);
+ int i1 = l & 3;
- if (j1 == 3) {
- world.applyPhysics(i - 1, j, k, this.id);
- } else if (j1 == 1) {
- world.applyPhysics(i + 1, j, k, this.id);
- } else if (j1 == 0) {
- world.applyPhysics(i, j, k - 1, this.id);
- } else if (j1 == 2) {
- world.applyPhysics(i, j, k + 1, this.id);
+ if (i1 == 3) {
+ world.applyPhysics(i - 1, j, k, this);
+ } else if (i1 == 1) {
+ world.applyPhysics(i + 1, j, k, this);
+ } else if (i1 == 0) {
+ world.applyPhysics(i, j, k - 1, this);
+ } else if (i1 == 2) {
+ world.applyPhysics(i, j, k + 1, this);
}
}
- super.remove(world, i, j, k, l, i1);
+ super.remove(world, i, j, k, block, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
diff --git a/src/main/java/net/minecraft/server/BlockVine.java b/src/main/java/net/minecraft/server/BlockVine.java
index 22c50bd4eb..5033a10cf9 100644
--- a/src/main/java/net/minecraft/server/BlockVine.java
+++ b/src/main/java/net/minecraft/server/BlockVine.java
@@ -6,9 +6,9 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockVine extends Block {
- public BlockVine(int i) {
- super(i, Material.REPLACEABLE_PLANT);
- this.b(true);
+ public BlockVine() {
+ super(Material.REPLACEABLE_PLANT);
+ this.a(true);
this.a(CreativeModeTab.c);
}
@@ -16,7 +16,7 @@ public class BlockVine extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
- public int d() {
+ public int b() {
return 20;
}
@@ -24,7 +24,7 @@ public class BlockVine extends Block {
return false;
}
- public boolean b() {
+ public boolean d() {
return false;
}
@@ -79,7 +79,7 @@ public class BlockVine extends Block {
flag = true;
}
- if (!flag && this.d(iblockaccess.getTypeId(i, j + 1, k))) {
+ if (!flag && this.a(iblockaccess.getType(i, j + 1, k))) {
f2 = Math.min(f2, 0.9375F);
f5 = 1.0F;
f1 = 0.0F;
@@ -91,43 +91,37 @@ public class BlockVine extends Block {
this.a(f1, f2, f3, f4, f5, f6);
}
- public AxisAlignedBB b(World world, int i, int j, int k) {
+ public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
switch (l) {
case 1:
- return this.d(world.getTypeId(i, j + 1, k));
+ return this.a(world.getType(i, j + 1, k));
case 2:
- return this.d(world.getTypeId(i, j, k + 1));
+ return this.a(world.getType(i, j, k + 1));
case 3:
- return this.d(world.getTypeId(i, j, k - 1));
+ return this.a(world.getType(i, j, k - 1));
case 4:
- return this.d(world.getTypeId(i + 1, j, k));
+ return this.a(world.getType(i + 1, j, k));
case 5:
- return this.d(world.getTypeId(i - 1, j, k));
+ return this.a(world.getType(i - 1, j, k));
default:
return false;
}
}
- private boolean d(int i) {
- if (i == 0) {
- return false;
- } else {
- Block block = Block.byId[i];
-
- return block.b() && block.material.isSolid();
- }
+ private boolean a(Block block) {
+ return block.d() && block.material.isSolid();
}
- private boolean k(World world, int i, int j, int k) {
+ private boolean e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = l;
@@ -135,13 +129,13 @@ public class BlockVine extends Block {
for (int j1 = 0; j1 <= 3; ++j1) {
int k1 = 1 << j1;
- if ((l & k1) != 0 && !this.d(world.getTypeId(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getTypeId(i, j + 1, k) != this.id || (world.getData(i, j + 1, k) & k1) == 0)) {
+ if ((l & k1) != 0 && !this.a(world.getType(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getType(i, j + 1, k) != this || (world.getData(i, j + 1, k) & k1) == 0)) {
i1 &= ~k1;
}
}
}
- if (i1 == 0 && !this.d(world.getTypeId(i, j + 1, k))) {
+ if (i1 == 0 && !this.a(world.getType(i, j + 1, k))) {
return false;
} else {
if (i1 != l) {
@@ -152,9 +146,9 @@ public class BlockVine extends Block {
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!world.isStatic && !this.k(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!world.isStatic && !this.e(world, i, j, k)) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
@@ -169,15 +163,15 @@ public class BlockVine extends Block {
int j1;
int k1;
- label138:
+ label134:
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
- if (world.getTypeId(i1, k1, j1) == this.id) {
+ if (world.getType(i1, k1, j1) == this) {
--l;
if (l <= 0) {
flag = true;
- break label138;
+ break label134;
}
}
}
@@ -188,30 +182,31 @@ public class BlockVine extends Block {
j1 = world.random.nextInt(6);
k1 = Direction.e[j1];
int l1;
- int i2;
if (j1 == 1 && j < 255 && world.isEmpty(i, j + 1, k)) {
if (flag) {
return;
}
- l1 = world.random.nextInt(16) & i1;
- if (l1 > 0) {
- for (i2 = 0; i2 <= 3; ++i2) {
- if (!this.d(world.getTypeId(i + Direction.a[i2], j + 1, k + Direction.b[i2]))) {
- l1 &= ~(1 << i2);
+ int i2 = world.random.nextInt(16) & i1;
+
+ if (i2 > 0) {
+ for (l1 = 0; l1 <= 3; ++l1) {
+ if (!this.a(world.getType(i + Direction.a[l1], j + 1, k + Direction.b[l1]))) {
+ i2 &= ~(1 << l1);
}
}
- if (l1 > 0) {
+ if (i2 > 0) {
// CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j + 1, k);
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1);
+ CraftEventFactory.handleBlockSpreadEvent(block, source, this, l1);
// CraftBukkit end
}
}
} else {
+ Block block;
int j2;
if (j1 >= 2 && j1 <= 5 && (i1 & 1 << k1) == 0) {
@@ -219,49 +214,47 @@ public class BlockVine extends Block {
return;
}
- l1 = world.getTypeId(i + Direction.a[k1], j, k + Direction.b[k1]);
- if (l1 != 0 && Block.byId[l1] != null) {
- if (Block.byId[l1].material.k() && Block.byId[l1].b()) {
- world.setData(i, j, k, i1 | 1 << k1, 2);
- }
- } else {
- i2 = k1 + 1 & 3;
+ block = world.getType(i + Direction.a[k1], j, k + Direction.b[k1]);
+ if (block.material == Material.AIR) {
+ l1 = k1 + 1 & 3;
j2 = k1 + 3 & 3;
// CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
- org.bukkit.block.Block block = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]);
- if ((i1 & 1 << i2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) {
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << i2);
- } else if ((i1 & 1 << j2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) {
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << j2);
- } else if ((i1 & 1 << i2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]) && this.d(world.getTypeId(i + Direction.a[i2], j, k + Direction.b[i2]))) {
- block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]);
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3));
- } else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.d(world.getTypeId(i + Direction.a[j2], j, k + Direction.b[j2]))) {
- block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]);
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3));
- } else if (this.d(world.getTypeId(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 0);
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]);
+ if ((i1 & 1 << l1) != 0 && this.a(world.getType(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]))) {
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << l1);
+ } else if ((i1 & 1 << j2) != 0 && this.a(world.getType(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) {
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << j2);
+ } else if ((i1 & 1 << l1) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]) && this.a(world.getType(i + Direction.a[l1], j, k + Direction.b[l1]))) {
+ bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
+ } else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.a(world.getType(i + Direction.a[j2], j, k + Direction.b[j2]))) {
+ bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
+ } else if (this.a(world.getType(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 0);
}
// CraftBukkit end
+ } else if (block.material.k() && block.d()) {
+ world.setData(i, j, k, i1 | 1 << k1, 2);
}
} else if (j > 1) {
- l1 = world.getTypeId(i, j - 1, k);
- if (l1 == 0) {
- i2 = world.random.nextInt(16) & i1;
- if (i2 > 0) {
+ block = world.getType(i, j - 1, k);
+ if (block.material == Material.AIR) {
+ l1 = world.random.nextInt(16) & i1;
+ if (l1 > 0) {
// CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
- org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j - 1, k);
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2);
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j - 1, k);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, l1);
// CraftBukkit end
}
- } else if (l1 == this.id) {
- i2 = world.random.nextInt(16) & i1;
+ } else if (block == this) {
+ l1 = world.random.nextInt(16) & i1;
j2 = world.getData(i, j - 1, k);
- if (j2 != (j2 | i2)) {
- world.setData(i, j - 1, k, j2 | i2, 2);
+ if (j2 != (j2 | l1)) {
+ world.setData(i, j - 1, k, j2 | l1, 2);
}
}
}
@@ -292,8 +285,8 @@ public class BlockVine extends Block {
return b0 != 0 ? b0 : i1;
}
- public int getDropType(int i, Random random, int j) {
- return 0;
+ public Item getDropType(int i, Random random, int j) {
+ return null;
}
public int a(Random random) {
@@ -301,9 +294,9 @@ public class BlockVine extends Block {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- if (!world.isStatic && entityhuman.by() != null && entityhuman.by().id == Item.SHEARS.id) {
- entityhuman.a(StatisticList.C[this.id], 1);
- this.b(world, i, j, k, new ItemStack(Block.VINE, 1, 0));
+ if (!world.isStatic && entityhuman.bD() != null && entityhuman.bD().getItem() == Items.SHEARS) {
+ entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
+ this.a(world, i, j, k, new ItemStack(Blocks.VINE, 1, 0));
} else {
super.a(world, entityhuman, i, j, k, l);
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3fa774ff26..95b4704959 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -7,44 +7,51 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.concurrent.Callable;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit; // CraftBukkit
public class Chunk {
+ private static final Logger t = LogManager.getLogger();
public static boolean a;
private ChunkSection[] sections;
- private byte[] s;
+ private byte[] v;
public int[] b;
public boolean[] c;
public boolean d;
public World world;
public int[] heightMap;
- public final int x;
- public final int z;
- private boolean t;
+ public final int locX;
+ public final int locZ;
+ private boolean w;
public Map tileEntities;
public List[] entitySlices;
public boolean done;
- public boolean l;
+ public boolean lit;
public boolean m;
- public long n;
- public boolean seenByPlayer;
- public int p;
- public long q;
- private int u;
+ public boolean n;
+ public boolean o;
+ public long p;
+ public boolean q;
+ public int r;
+ public long s;
+ private int x;
public Chunk(World world, int i, int j) {
this.sections = new ChunkSection[16];
- this.s = new byte[256];
+ this.v = new byte[256];
this.b = new int[256];
this.c = new boolean[256];
this.tileEntities = new HashMap();
- this.u = 4096;
+ this.x = 4096;
this.entitySlices = new List[16];
this.world = world;
- this.x = i;
- this.z = j;
+ this.locX = i;
+ this.locZ = j;
this.heightMap = new int[256];
for (int k = 0; k < this.entitySlices.length; ++k) {
@@ -52,7 +59,7 @@ public class Chunk {
}
Arrays.fill(this.b, -999);
- Arrays.fill(this.s, (byte) -1);
+ Arrays.fill(this.v, (byte) -1);
// CraftBukkit start
if (!(this instanceof EmptyChunk)) {
@@ -64,23 +71,50 @@ public class Chunk {
public boolean mustSave;
// CraftBukkit end
- public Chunk(World world, byte[] abyte, int i, int j) {
+ public Chunk(World world, Block[] ablock, int i, int j) {
this(world, i, j);
- int k = abyte.length / 256;
+ int k = ablock.length / 256;
+ boolean flag = !world.worldProvider.g;
for (int l = 0; l < 16; ++l) {
for (int i1 = 0; i1 < 16; ++i1) {
for (int j1 = 0; j1 < k; ++j1) {
- byte b0 = abyte[l << 11 | i1 << 7 | j1];
+ Block block = ablock[l << 11 | i1 << 7 | j1];
- if (b0 != 0) {
+ if (block != null && block.getMaterial() != Material.AIR) {
int k1 = j1 >> 4;
if (this.sections[k1] == null) {
- this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.g);
+ this.sections[k1] = new ChunkSection(k1 << 4, flag);
}
- this.sections[k1].setTypeId(l, j1 & 15, i1, b0);
+ this.sections[k1].setTypeId(l, j1 & 15, i1, block);
+ }
+ }
+ }
+ }
+ }
+
+ public Chunk(World world, Block[] ablock, byte[] abyte, int i, int j) {
+ this(world, i, j);
+ int k = ablock.length / 256;
+ boolean flag = !world.worldProvider.g;
+
+ for (int l = 0; l < 16; ++l) {
+ for (int i1 = 0; i1 < 16; ++i1) {
+ for (int j1 = 0; j1 < k; ++j1) {
+ int k1 = l * k * 16 | i1 * k | j1;
+ Block block = ablock[k1];
+
+ if (block != null && block != Blocks.AIR) {
+ int l1 = j1 >> 4;
+
+ if (this.sections[l1] == null) {
+ this.sections[l1] = new ChunkSection(l1 << 4, flag);
+ }
+
+ this.sections[l1].setTypeId(l, j1 & 15, i1, block);
+ this.sections[l1].setData(l, j1 & 15, i1, abyte[k1]);
}
}
}
@@ -88,7 +122,7 @@ public class Chunk {
}
public boolean a(int i, int j) {
- return i == this.x && j == this.z;
+ return i == this.locX && j == this.locZ;
}
public int b(int i, int j) {
@@ -112,13 +146,10 @@ public class Chunk {
public void initLighting() {
int i = this.h();
- this.p = Integer.MAX_VALUE;
+ this.r = Integer.MAX_VALUE;
- int j;
- int k;
-
- for (j = 0; j < 16; ++j) {
- k = 0;
+ for (int j = 0; j < 16; ++j) {
+ int k = 0;
while (k < 16) {
this.b[j + (k << 4)] = -999;
@@ -132,8 +163,8 @@ public class Chunk {
}
this.heightMap[k << 4 | j] = l;
- if (l < this.p) {
- this.p = l;
+ if (l < this.r) {
+ this.r = l;
}
}
@@ -142,13 +173,19 @@ public class Chunk {
int i1 = i + 16 - 1;
do {
- l -= this.b(j, i1, k);
+ int j1 = this.b(j, i1, k);
+
+ if (j1 == 0 && l != 15) {
+ j1 = 1;
+ }
+
+ l -= j1;
if (l > 0) {
ChunkSection chunksection = this.sections[i1 >> 4];
if (chunksection != null) {
chunksection.setSkyLight(j, i1 & 15, k, l);
- this.world.p((this.x << 4) + j, i1, (this.z << 4) + k);
+ this.world.m((this.locX << 4) + j, i1, (this.locZ << 4) + k);
}
}
@@ -162,30 +199,24 @@ public class Chunk {
}
}
- this.l = true;
-
- for (j = 0; j < 16; ++j) {
- for (k = 0; k < 16; ++k) {
- this.e(j, k);
- }
- }
+ this.n = true;
}
private void e(int i, int j) {
this.c[i + j * 16] = true;
- this.t = true;
+ this.w = true;
}
- private void q() {
+ private void c(boolean flag) {
this.world.methodProfiler.a("recheckGaps");
- if (this.world.areChunksLoaded(this.x * 16 + 8, 0, this.z * 16 + 8, 16)) {
+ if (this.world.areChunksLoaded(this.locX * 16 + 8, 0, this.locZ * 16 + 8, 16)) {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
if (this.c[i + j * 16]) {
this.c[i + j * 16] = false;
int k = this.b(i, j);
- int l = this.x * 16 + i;
- int i1 = this.z * 16 + j;
+ int l = this.locX * 16 + i;
+ int i1 = this.locZ * 16 + j;
int j1 = this.world.g(l - 1, i1);
int k1 = this.world.g(l + 1, i1);
int l1 = this.world.g(l, i1 - 1);
@@ -208,11 +239,15 @@ public class Chunk {
this.g(l + 1, i1, k);
this.g(l, i1 - 1, k);
this.g(l, i1 + 1, k);
+ if (flag) {
+ this.world.methodProfiler.b();
+ return;
+ }
}
}
}
- this.t = false;
+ this.w = false;
}
this.world.methodProfiler.b();
@@ -222,19 +257,19 @@ public class Chunk {
int l = this.world.getHighestBlockYAt(i, j);
if (l > k) {
- this.d(i, j, k, l + 1);
+ this.c(i, j, k, l + 1);
} else if (l < k) {
- this.d(i, j, l, k + 1);
+ this.c(i, j, l, k + 1);
}
}
- private void d(int i, int j, int k, int l) {
+ private void c(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.c(EnumSkyBlock.SKY, i, i1, j);
}
- this.l = true;
+ this.n = true;
}
}
@@ -251,10 +286,10 @@ public class Chunk {
}
if (i1 != l) {
- this.world.e(i + this.x * 16, k + this.z * 16, i1, l);
+ this.world.b(i + this.locX * 16, k + this.locZ * 16, i1, l);
this.heightMap[k << 4 | i] = i1;
- int j1 = this.x * 16 + i;
- int k1 = this.z * 16 + k;
+ int j1 = this.locX * 16 + i;
+ int k1 = this.locZ * 16 + k;
int l1;
int i2;
@@ -266,7 +301,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.setSkyLight(i, l1 & 15, k, 15);
- this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.m((this.locX << 4) + i, l1, (this.locZ << 4) + k);
}
}
} else {
@@ -274,7 +309,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.setSkyLight(i, l1 & 15, k, 0);
- this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.m((this.locX << 4) + i, l1, (this.locZ << 4) + k);
}
}
}
@@ -310,34 +345,46 @@ public class Chunk {
j2 = l;
}
- if (l1 < this.p) {
- this.p = l1;
+ if (l1 < this.r) {
+ this.r = l1;
}
if (!this.world.worldProvider.g) {
- this.d(j1 - 1, k1, i2, j2);
- this.d(j1 + 1, k1, i2, j2);
- this.d(j1, k1 - 1, i2, j2);
- this.d(j1, k1 + 1, i2, j2);
- this.d(j1, k1, i2, j2);
+ this.c(j1 - 1, k1, i2, j2);
+ this.c(j1 + 1, k1, i2, j2);
+ this.c(j1, k1 - 1, i2, j2);
+ this.c(j1, k1 + 1, i2, j2);
+ this.c(j1, k1, i2, j2);
}
- this.l = true;
+ this.n = true;
}
}
public int b(int i, int j, int k) {
- return Block.lightBlock[this.getTypeId(i, j, k)];
+ return this.getType(i, j, k).k();
}
- public int getTypeId(int i, int j, int k) {
- if (j >> 4 >= this.sections.length) {
- return 0;
- } else {
+ public Block getType(int i, int j, int k) {
+ Block block = Blocks.AIR;
+
+ if (j >> 4 < this.sections.length) {
ChunkSection chunksection = this.sections[j >> 4];
- return chunksection != null ? chunksection.getTypeId(i, j & 15, k) : 0;
+ if (chunksection != null) {
+ try {
+ block = chunksection.getTypeId(i, j & 15, k);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Getting block");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being got");
+
+ crashreportsystemdetails.a("Location", (Callable) (new CrashReportLocation(this, i, j, k)));
+ throw new ReportedException(crashreport);
+ }
+ }
}
+
+ return block;
}
public int getData(int i, int j, int k) {
@@ -350,105 +397,108 @@ public class Chunk {
}
}
- public boolean a(int i, int j, int k, int l, int i1) {
- int j1 = k << 4 | i;
+ public boolean a(int i, int j, int k, Block block, int l) {
+ int i1 = k << 4 | i;
- if (j >= this.b[j1] - 1) {
- this.b[j1] = -999;
+ if (j >= this.b[i1] - 1) {
+ this.b[i1] = -999;
}
- int k1 = this.heightMap[j1];
- int l1 = this.getTypeId(i, j, k);
- int i2 = this.getData(i, j, k);
+ int j1 = this.heightMap[i1];
+ Block block1 = this.getType(i, j, k);
+ int k1 = this.getData(i, j, k);
- if (l1 == l && i2 == i1) {
+ if (block1 == block && k1 == l) {
return false;
} else {
ChunkSection chunksection = this.sections[j >> 4];
boolean flag = false;
if (chunksection == null) {
- if (l == 0) {
+ if (block == Blocks.AIR) {
return false;
}
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.g);
- flag = j >= k1;
+ flag = j >= j1;
}
- int j2 = this.x * 16 + i;
- int k2 = this.z * 16 + k;
+ int l1 = this.locX * 16 + i;
+ int i2 = this.locZ * 16 + k;
- if (l1 != 0 && !this.world.isStatic) {
- Block.byId[l1].l(this.world, j2, j, k2, i2);
+ if (!this.world.isStatic) {
+ block1.f(this.world, l1, j, i2, k1);
}
- chunksection.setTypeId(i, j & 15, k, l);
- if (l1 != 0) {
- if (!this.world.isStatic) {
- Block.byId[l1].remove(this.world, j2, j, k2, l1, i2);
- } else if (Block.byId[l1] instanceof IContainer && l1 != l) {
- this.world.s(j2, j, k2);
- }
+ chunksection.setTypeId(i, j & 15, k, block);
+ if (!this.world.isStatic) {
+ block1.remove(this.world, l1, j, i2, block1, k1);
+ } else if (block1 instanceof IContainer && block1 != block) {
+ this.world.p(l1, j, i2);
}
- if (chunksection.getTypeId(i, j & 15, k) != l) {
+ if (chunksection.getTypeId(i, j & 15, k) != block) {
return false;
} else {
- chunksection.setData(i, j & 15, k, i1);
+ chunksection.setData(i, j & 15, k, l);
if (flag) {
this.initLighting();
} else {
- if (Block.lightBlock[l & 4095] > 0) {
- if (j >= k1) {
+ int j2 = block.k();
+ int k2 = block1.k();
+
+ if (j2 > 0) {
+ if (j >= j1) {
this.h(i, j + 1, k);
}
- } else if (j == k1 - 1) {
+ } else if (j == j1 - 1) {
this.h(i, j, k);
}
- this.e(i, k);
+ if (j2 != k2 && (j2 < k2 || this.getBrightness(EnumSkyBlock.SKY, i, j, k) > 0 || this.getBrightness(EnumSkyBlock.BLOCK, i, j, k) > 0)) {
+ this.e(i, k);
+ }
}
TileEntity tileentity;
- if (l != 0) {
- // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer
- if (!this.world.isStatic && (!this.world.callingPlaceEvent || (Block.byId[l] instanceof BlockContainer))) {
- Block.byId[l].onPlace(this.world, j2, j, k2);
- }
-
- if (Block.byId[l] instanceof IContainer) {
- // CraftBukkit start - Don't create tile entity if placement failed
- if (this.getTypeId(i, j, k) != l) {
- return false;
- }
- // CraftBukkit end
-
- tileentity = this.e(i, j, k);
- if (tileentity == null) {
- tileentity = ((IContainer) Block.byId[l]).b(this.world);
- this.world.setTileEntity(j2, j, k2, tileentity);
- }
-
- if (tileentity != null) {
- tileentity.i();
- }
- }
- } else if (l1 > 0 && Block.byId[l1] instanceof IContainer) {
+ if (block1 instanceof IContainer) {
tileentity = this.e(i, j, k);
if (tileentity != null) {
- tileentity.i();
+ tileentity.u();
}
}
- this.l = true;
+ // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer
+ if (!this.world.isStatic && (!this.world.callingPlaceEvent || (block instanceof BlockContainer))) {
+ block.onPlace(this.world, l1, j, i2);
+ }
+
+ if (block instanceof IContainer) {
+ // CraftBukkit start - Don't create tile entity if placement failed
+ if (this.getType(i, j, k) != block) {
+ return false;
+ }
+ // CraftBukkit end
+
+ tileentity = this.e(i, j, k);
+ if (tileentity == null) {
+ tileentity = ((IContainer) block).a(this.world, l);
+ this.world.setTileEntity(l1, j, i2, tileentity);
+ }
+
+ if (tileentity != null) {
+ tileentity.u();
+ }
+ }
+
+ this.n = true;
return true;
}
}
}
- public boolean b(int i, int j, int k, int l) {
+ public boolean a(int i, int j, int k, int l) {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
@@ -459,16 +509,14 @@ public class Chunk {
if (i1 == l) {
return false;
} else {
- this.l = true;
+ this.n = true;
chunksection.setData(i, j & 15, k, l);
- int j1 = chunksection.getTypeId(i, j & 15, k);
-
- if (j1 > 0 && Block.byId[j1] instanceof IContainer) {
+ if (chunksection.getTypeId(i, j & 15, k) instanceof IContainer) {
TileEntity tileentity = this.e(i, j, k);
if (tileentity != null) {
- tileentity.i();
- tileentity.p = l;
+ tileentity.u();
+ tileentity.g = l;
}
}
@@ -491,7 +539,7 @@ public class Chunk {
this.initLighting();
}
- this.l = true;
+ this.n = true;
if (enumskyblock == EnumSkyBlock.SKY) {
if (!this.world.worldProvider.g) {
chunksection.setSkyLight(i, j & 15, k, l);
@@ -501,7 +549,7 @@ public class Chunk {
}
}
- public int c(int i, int j, int k, int l) {
+ public int b(int i, int j, int k, int l) {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
@@ -525,15 +573,16 @@ public class Chunk {
}
public void a(Entity entity) {
- this.m = true;
+ this.o = true;
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
- if (i != this.x || j != this.z) {
+ if (i != this.locX || j != this.locZ) {
// CraftBukkit start
Bukkit.getLogger().warning("Wrong location for " + entity + " in world '" + world.getWorld().getName() + "'!");
+ // t.error("Wrong location! " + entity);
// Thread.dumpStack();
- Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.x + "," + this.z);
+ Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.locX + "," + this.locZ);
// CraftBukkit end
}
@@ -547,15 +596,15 @@ public class Chunk {
k = this.entitySlices.length - 1;
}
- entity.ai = true;
- entity.aj = this.x;
- entity.ak = k;
- entity.al = this.z;
+ entity.ah = true;
+ entity.ai = this.locX;
+ entity.aj = k;
+ entity.ak = this.locZ;
this.entitySlices[k].add(entity);
}
public void b(Entity entity) {
- this.a(entity, entity.ak);
+ this.a(entity, entity.aj);
}
public void a(Entity entity, int i) {
@@ -579,18 +628,14 @@ public class Chunk {
TileEntity tileentity = (TileEntity) this.tileEntities.get(chunkposition);
if (tileentity == null) {
- int l = this.getTypeId(i, j, k);
+ Block block = this.getType(i, j, k);
- if (l <= 0 || !Block.byId[l].t()) {
+ if (!block.isTileEntity()) {
return null;
}
- if (tileentity == null) {
- tileentity = ((IContainer) Block.byId[l]).b(this.world);
- this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity);
- }
-
- tileentity = (TileEntity) this.tileEntities.get(chunkposition);
+ tileentity = ((IContainer) block).a(this.world, this.getData(i, j, k));
+ this.world.setTileEntity(this.locX * 16 + i, j, this.locZ * 16 + k, tileentity);
}
if (tileentity != null && tileentity.r()) {
@@ -602,9 +647,9 @@ public class Chunk {
}
public void a(TileEntity tileentity) {
- int i = tileentity.x - this.x * 16;
+ int i = tileentity.x - this.locX * 16;
int j = tileentity.y;
- int k = tileentity.z - this.z * 16;
+ int k = tileentity.z - this.locZ * 16;
this.a(i, j, k, tileentity);
if (this.d) {
@@ -615,22 +660,22 @@ public class Chunk {
public void a(int i, int j, int k, TileEntity tileentity) {
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
- tileentity.b(this.world);
- tileentity.x = this.x * 16 + i;
+ tileentity.a(this.world);
+ tileentity.x = this.locX * 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 IContainer) {
+ tileentity.z = this.locZ * 16 + k;
+ if (this.getType(i, j, k) instanceof IContainer) {
if (this.tileEntities.containsKey(chunkposition)) {
- ((TileEntity) this.tileEntities.get(chunkposition)).w_();
+ ((TileEntity) this.tileEntities.get(chunkposition)).s();
}
- tileentity.s();
+ tileentity.t();
this.tileEntities.put(chunkposition, tileentity);
// CraftBukkit start
} else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z
- + " (" + org.bukkit.Material.getMaterial(getTypeId(i, j, k)) + ") where there was no entity tile!");
- System.out.println("Chunk coordinates: " + (this.x * 16) + "," + (this.z * 16));
+ + " (" + org.bukkit.Material.getMaterial(Block.b(getType(i, j, k))) + ") where there was no entity tile!");
+ System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
new Exception().printStackTrace();
// CraftBukkit end
}
@@ -643,7 +688,7 @@ public class Chunk {
TileEntity tileentity = (TileEntity) this.tileEntities.remove(chunkposition);
if (tileentity != null) {
- tileentity.w_();
+ tileentity.s();
}
}
}
@@ -658,7 +703,7 @@ public class Chunk {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- entity.R();
+ entity.X();
}
this.world.a(this.entitySlices[i]);
@@ -694,22 +739,15 @@ public class Chunk {
}
public void e() {
- this.l = true;
+ this.n = true;
}
public void a(Entity entity, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) {
int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
- if (i < 0) {
- i = 0;
- j = Math.max(i, j);
- }
-
- if (j >= this.entitySlices.length) {
- j = this.entitySlices.length - 1;
- i = Math.min(i, j);
- }
+ i = MathHelper.a(i, 0, this.entitySlices.length - 1);
+ j = MathHelper.a(j, 0, this.entitySlices.length - 1);
for (int k = i; k <= j; ++k) {
List list1 = this.entitySlices[k];
@@ -719,7 +757,7 @@ public class Chunk {
if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
- Entity[] aentity = entity1.ao();
+ Entity[] aentity = entity1.at();
if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) {
@@ -738,17 +776,8 @@ public class Chunk {
int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
- if (i < 0) {
- i = 0;
- } else if (i >= this.entitySlices.length) {
- i = this.entitySlices.length - 1;
- }
-
- if (j >= this.entitySlices.length) {
- j = this.entitySlices.length - 1;
- } else if (j < 0) {
- j = 0;
- }
+ i = MathHelper.a(i, 0, this.entitySlices.length - 1);
+ j = MathHelper.a(j, 0, this.entitySlices.length - 1);
for (int k = i; k <= j; ++k) {
List list1 = this.entitySlices[k];
@@ -765,18 +794,18 @@ public class Chunk {
public boolean a(boolean flag) {
if (flag) {
- if (this.m && this.world.getTime() != this.n || this.l) {
+ if (this.o && this.world.getTime() != this.p || this.n) {
return true;
}
- } else if (this.m && this.world.getTime() >= this.n + 600L) {
+ } else if (this.o && this.world.getTime() >= this.p + 600L) {
return true;
}
- return this.l;
+ return this.n;
}
public Random a(long i) {
- return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i);
+ return new Random(this.world.getSeed() + (long) (this.locX * this.locX * 4987142) + (long) (this.locX * 5947611) + (long) (this.locZ * this.locZ) * 4392871L + (long) (this.locZ * 389711) ^ i);
}
public boolean isEmpty() {
@@ -811,8 +840,8 @@ public class Chunk {
l = -1;
while (i1 > 0 && l == -1) {
- int j1 = this.getTypeId(i, i1, j);
- Material material = j1 == 0 ? Material.AIR : Block.byId[j1].material;
+ Block block = this.getType(i, i1, j);
+ Material material = block.getMaterial();
if (!material.isSolid() && !material.isLiquid()) {
--i1;
@@ -827,14 +856,23 @@ public class Chunk {
return l;
}
- public void k() {
- if (this.t && !this.world.worldProvider.g) {
- this.q();
+ public void b(boolean flag) {
+ if (this.w && !this.world.worldProvider.g && !flag) {
+ this.c(this.world.isStatic);
+ }
+
+ this.m = true;
+ if (!this.lit && this.done) {
+ this.p();
}
}
+ public boolean k() {
+ return this.m && this.done && this.lit;
+ }
+
public ChunkCoordIntPair l() {
- return new ChunkCoordIntPair(this.x, this.z);
+ return new ChunkCoordIntPair(this.locX, this.locZ);
}
public boolean c(int i, int j) {
@@ -862,75 +900,160 @@ public class Chunk {
}
public BiomeBase a(int i, int j, WorldChunkManager worldchunkmanager) {
- int k = this.s[j << 4 | i] & 255;
+ int k = this.v[j << 4 | i] & 255;
if (k == 255) {
- BiomeBase biomebase = worldchunkmanager.getBiome((this.x << 4) + i, (this.z << 4) + j);
+ BiomeBase biomebase = worldchunkmanager.getBiome((this.locX << 4) + i, (this.locZ << 4) + j);
k = biomebase.id;
- this.s[j << 4 | i] = (byte) (k & 255);
+ this.v[j << 4 | i] = (byte) (k & 255);
}
- return BiomeBase.biomes[k] == null ? BiomeBase.PLAINS : BiomeBase.biomes[k];
+ return BiomeBase.getBiome(k) == null ? BiomeBase.PLAINS : BiomeBase.getBiome(k);
}
public byte[] m() {
- return this.s;
+ return this.v;
}
public void a(byte[] abyte) {
- this.s = abyte;
+ this.v = abyte;
}
public void n() {
- this.u = 0;
+ this.x = 0;
}
public void o() {
for (int i = 0; i < 8; ++i) {
- if (this.u >= 4096) {
+ if (this.x >= 4096) {
return;
}
- int j = this.u % 16;
- int k = this.u / 16 % 16;
- int l = this.u / 256;
+ int j = this.x % 16;
+ int k = this.x / 16 % 16;
+ int l = this.x / 256;
- ++this.u;
- int i1 = (this.x << 4) + k;
- int j1 = (this.z << 4) + l;
+ ++this.x;
+ int i1 = (this.locX << 4) + k;
+ int j1 = (this.locZ << 4) + l;
for (int k1 = 0; k1 < 16; ++k1) {
int l1 = (j << 4) + k1;
- if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l) == 0) {
- if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) {
- this.world.A(i1, l1 - 1, j1);
+ if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l).getMaterial() == Material.AIR) {
+ if (this.world.getType(i1, l1 - 1, j1).m() > 0) {
+ this.world.t(i1, l1 - 1, j1);
}
- if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) {
- this.world.A(i1, l1 + 1, j1);
+ if (this.world.getType(i1, l1 + 1, j1).m() > 0) {
+ this.world.t(i1, l1 + 1, j1);
}
- if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) {
- this.world.A(i1 - 1, l1, j1);
+ if (this.world.getType(i1 - 1, l1, j1).m() > 0) {
+ this.world.t(i1 - 1, l1, j1);
}
- if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) {
- this.world.A(i1 + 1, l1, j1);
+ if (this.world.getType(i1 + 1, l1, j1).m() > 0) {
+ this.world.t(i1 + 1, l1, j1);
}
- if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) {
- this.world.A(i1, l1, j1 - 1);
+ if (this.world.getType(i1, l1, j1 - 1).m() > 0) {
+ this.world.t(i1, l1, j1 - 1);
}
- if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) {
- this.world.A(i1, l1, j1 + 1);
+ if (this.world.getType(i1, l1, j1 + 1).m() > 0) {
+ this.world.t(i1, l1, j1 + 1);
}
- this.world.A(i1, l1, j1);
+ this.world.t(i1, l1, j1);
}
}
}
}
+
+ public void p() {
+ this.done = true;
+ this.lit = true;
+ if (!this.world.worldProvider.g) {
+ if (this.world.b(this.locX * 16 - 1, 0, this.locZ * 16 - 1, this.locX * 16 + 1, 63, this.locZ * 16 + 1)) {
+ for (int i = 0; i < 16; ++i) {
+ for (int j = 0; j < 16; ++j) {
+ if (!this.f(i, j)) {
+ this.lit = false;
+ break;
+ }
+ }
+ }
+
+ if (this.lit) {
+ Chunk chunk = this.world.getChunkAtWorldCoords(this.locX * 16 - 1, this.locZ * 16);
+
+ chunk.a(3);
+ chunk = this.world.getChunkAtWorldCoords(this.locX * 16 + 16, this.locZ * 16);
+ chunk.a(1);
+ chunk = this.world.getChunkAtWorldCoords(this.locX * 16, this.locZ * 16 - 1);
+ chunk.a(0);
+ chunk = this.world.getChunkAtWorldCoords(this.locX * 16, this.locZ * 16 + 16);
+ chunk.a(2);
+ }
+ } else {
+ this.lit = false;
+ }
+ }
+ }
+
+ private void a(int i) {
+ if (this.done) {
+ int j;
+
+ if (i == 3) {
+ for (j = 0; j < 16; ++j) {
+ this.f(15, j);
+ }
+ } else if (i == 1) {
+ for (j = 0; j < 16; ++j) {
+ this.f(0, j);
+ }
+ } else if (i == 0) {
+ for (j = 0; j < 16; ++j) {
+ this.f(j, 15);
+ }
+ } else if (i == 2) {
+ for (j = 0; j < 16; ++j) {
+ this.f(j, 0);
+ }
+ }
+ }
+ }
+
+ private boolean f(int i, int j) {
+ int k = this.h();
+ boolean flag = false;
+ boolean flag1 = false;
+
+ int l;
+
+ for (l = k + 16 - 1; l > 63 || l > 0 && !flag1; --l) {
+ int i1 = this.b(i, l, j);
+
+ if (i1 == 255 && l < 63) {
+ flag1 = true;
+ }
+
+ if (!flag && i1 > 0) {
+ flag = true;
+ } else if (flag && i1 == 0 && !this.world.t(this.locX * 16 + i, l, this.locZ * 16 + j)) {
+ return false;
+ }
+ }
+
+ for (; l > 0; --l) {
+ if (this.getType(i, l, j).m() > 0) {
+ this.world.t(this.locX * 16 + i, l, this.locZ * 16 + j);
+ }
+ }
+
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index b73f69ca16..a702fe82ce 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -7,6 +7,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import java.util.Random;
@@ -19,20 +22,22 @@ import org.bukkit.event.world.ChunkUnloadEvent;
public class ChunkProviderServer implements IChunkProvider {
- // CraftBukkit start
- public LongHashSet unloadQueue = new LongHashSet();
+ private static final Logger b = LogManager.getLogger();
+ // CraftBukkit start - private -> public
+ public LongHashSet unloadQueue = new LongHashSet(); // LongHashSet
public Chunk emptyChunk;
- public IChunkProvider chunkProvider; // CraftBukkit
- private IChunkLoader e;
+ public IChunkProvider chunkProvider;
+ private IChunkLoader f;
public boolean forceChunkLoad = false; // true -> false
public LongObjectHashMap chunks = new LongObjectHashMap();
+ private List chunkList = new ArrayList();
public WorldServer world;
// CraftBukkit end
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
this.emptyChunk = new EmptyChunk(worldserver, 0, 0);
this.world = worldserver;
- this.e = ichunkloader;
+ this.f = ichunkloader;
this.chunkProvider = ichunkprovider;
}
@@ -75,7 +80,7 @@ public class ChunkProviderServer implements IChunkProvider {
while (iterator.hasNext()) {
Chunk chunk = (Chunk) iterator.next();
- this.queueUnload(chunk.x, chunk.z);
+ this.queueUnload(chunk.locX, chunk.locZ);
}
}
@@ -90,8 +95,8 @@ public class ChunkProviderServer implements IChunkProvider {
boolean newChunk = false;
ChunkRegionLoader loader = null;
- if (this.e instanceof ChunkRegionLoader) {
- loader = (ChunkRegionLoader) this.e;
+ if (this.f instanceof ChunkRegionLoader) {
+ loader = (ChunkRegionLoader) this.f;
}
// If the chunk exists but isn't loaded do it async
@@ -123,9 +128,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit
- if (chunk != null) {
- chunk.addEntities();
- }
+ this.chunkList.add(chunk);
+ chunk.addEntities();
// CraftBukkit start
Server server = this.world.getServer();
@@ -138,7 +142,6 @@ public class ChunkProviderServer implements IChunkProvider {
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk));
}
// CraftBukkit end
-
chunk.a(this, this, i, j);
}
@@ -157,9 +160,9 @@ public class ChunkProviderServer implements IChunkProvider {
chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
if (chunk == this.emptyChunk) return chunk;
- if (i != chunk.x || j != chunk.z) {
- this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
- this.world.getLogger().severe(chunk.getClass().getName());
+ if (i != chunk.locX || j != chunk.locZ) {
+ b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
+ b.error(chunk.getClass().getName());
Throwable ex = new Throwable();
ex.fillInStackTrace();
ex.printStackTrace();
@@ -169,14 +172,14 @@ public class ChunkProviderServer implements IChunkProvider {
}
public Chunk loadChunk(int i, int j) { // CraftBukkit - private -> public
- if (this.e == null) {
+ if (this.f == null) {
return null;
} else {
try {
- Chunk chunk = this.e.a(this.world, i, j);
+ Chunk chunk = this.f.a(this.world, i, j);
if (chunk != null) {
- chunk.n = this.world.getTime();
+ chunk.p = this.world.getTime();
if (this.chunkProvider != null) {
this.chunkProvider.recreateStructures(i, j);
}
@@ -184,35 +187,35 @@ public class ChunkProviderServer implements IChunkProvider {
return chunk;
} catch (Exception exception) {
- exception.printStackTrace();
+ b.error("Couldn\'t load chunk", exception);
return null;
}
}
}
public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private -> public
- if (this.e != null) {
+ if (this.f != null) {
try {
- this.e.b(this.world, chunk);
+ this.f.b(this.world, chunk);
} catch (Exception exception) {
- exception.printStackTrace();
+ b.error("Couldn\'t save entities", exception);
}
}
}
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
- if (this.e != null) {
+ if (this.f != null) {
try {
- chunk.n = this.world.getTime();
- this.e.a(this.world, chunk);
- } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
- ioexception.printStackTrace();
- // CraftBukkit start - Remove extra exception
+ chunk.p = this.world.getTime();
+ this.f.a(this.world, chunk);
+ // CraftBukkit start - IOException to Exception
+ } catch (Exception ioexception) {
+ b.error("Couldn\'t save chunk", ioexception);
+ /* Remove extra exception
+ } catch (ExceptionWorldConflict exceptionworldconflict) {
+ b.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
+ // CraftBukkit end */
}
- // } catch (ExceptionWorldConflict exceptionworldconflict) {
- // exceptionworldconflict.printStackTrace();
- // }
- // CraftBukkit end
}
}
@@ -220,7 +223,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = this.getOrCreateChunk(i, j);
if (!chunk.done) {
- chunk.done = true;
+ chunk.p();
if (this.chunkProvider != null) {
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
@@ -262,7 +265,7 @@ public class ChunkProviderServer implements IChunkProvider {
if (chunk.a(flag)) {
this.saveChunk(chunk);
- chunk.l = false;
+ chunk.n = false;
++i;
if (i == 24 && !flag) {
return false;
@@ -274,8 +277,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
public void b() {
- if (this.e != null) {
- this.e.b();
+ if (this.f != null) {
+ this.f.b();
}
}
@@ -294,14 +297,16 @@ public class ChunkProviderServer implements IChunkProvider {
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
- // this.unloadQueue.remove(integer);
+ // this.unloadQueue.remove(olong);
+ // this.chunks.remove(olong.longValue());
this.chunks.remove(chunkcoordinates); // CraftBukkit
+ this.chunkList.remove(chunk);
}
}
// CraftBukkit end
- if (this.e != null) {
- this.e.a();
+ if (this.f != null) {
+ this.f.a();
}
}
@@ -313,7 +318,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
public String getName() {
- return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit
+ // CraftBukkit - this.chunks.count() -> .values().size()
+ return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size();
}
public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) {
@@ -325,7 +331,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
public int getLoadedChunks() {
- return this.chunks.values().size(); // CraftBukkit
+ // CraftBukkit - this.chunks.count() -> .values().size()
+ return this.chunks.values().size();
}
public void recreateStructures(int i, int j) {}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 8a21f359f5..d5cf88d9c4 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -11,32 +11,36 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
-public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
- private List a = new ArrayList();
- private Set b = new HashSet();
- private Object c = new Object();
- private final File d;
+public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
+
+ private static final Logger a = LogManager.getLogger();
+ private List b = new ArrayList();
+ private Set c = new HashSet();
+ private Object d = new Object();
+ private final File e;
public ChunkRegionLoader(File file1) {
- this.d = file1;
+ this.e = file1;
}
// CraftBukkit start
public boolean chunkExists(World world, int i, int j) {
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
- 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)) {
+ synchronized (this.d) {
+ if (this.c.contains(chunkcoordintpair)) {
+ for (int k = 0; k < this.b.size(); ++k) {
+ if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
return true;
}
}
}
}
- return RegionFileCache.a(this.d, i, j).chunkExists(i & 31, j & 31);
+ return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31);
}
// CraftBukkit end
@@ -57,13 +61,13 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
// CraftBukkit end
NBTTagCompound nbttagcompound = null;
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
- Object object = this.c;
+ Object object = this.d;
- 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;
+ synchronized (this.d) {
+ if (this.c.contains(chunkcoordintpair)) {
+ for (int k = 0; k < this.b.size(); ++k) {
+ if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
+ nbttagcompound = ((PendingChunkToSave) this.b.get(k)).b;
break;
}
}
@@ -71,7 +75,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
if (nbttagcompound == null) {
- DataInputStream datainputstream = RegionFileCache.c(this.d, i, j);
+ DataInputStream datainputstream = RegionFileCache.c(this.e, i, j);
if (datainputstream == null) {
return null;
@@ -84,33 +88,32 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[]
- if (!nbttagcompound.hasKey("Level")) {
- world.getLogger().severe("Chunk file at " + i + "," + j + " is missing level data, skipping");
+ if (!nbttagcompound.hasKeyOfType("Level", 10)) {
+ a.error("Chunk file at " + i + "," + j + " is missing level data, skipping");
return null;
- } else if (!nbttagcompound.getCompound("Level").hasKey("Sections")) {
- world.getLogger().severe("Chunk file at " + i + "," + j + " is missing block data, skipping");
+ } else if (!nbttagcompound.getCompound("Level").hasKeyOfType("Sections", 9)) {
+ a.error("Chunk file at " + i + "," + j + " is missing block data, skipping");
return null;
} else {
Chunk chunk = this.a(world, nbttagcompound.getCompound("Level"));
if (!chunk.a(i, j)) {
- world.getLogger().severe("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
+ a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")");
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
// CraftBukkit start - Have to move tile entities since we don't load them at this stage
- NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities");
+ NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10);
if (tileEntities != null) {
for (int te = 0; te < tileEntities.size(); te++) {
NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te);
- int x = tileEntity.getInt("x") - chunk.x * 16;
- int z = tileEntity.getInt("z") - chunk.z * 16;
+ int x = tileEntity.getInt("x") - chunk.locX * 16;
+ int z = tileEntity.getInt("z") - chunk.locZ * 16;
tileEntity.setInt("x", i * 16 + x);
tileEntity.setInt("z", j * 16 + z);
}
}
// CraftBukkit end
-
chunk = this.a(world, nbttagcompound.getCompound("Level"));
}
@@ -126,7 +129,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void a(World world, Chunk chunk) {
// CraftBukkit start - "handle" exception
try {
- world.G();
+ world.F();
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
}
@@ -145,35 +148,35 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
protected void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) {
- Object object = this.c;
+ Object object = this.d;
- synchronized (this.c) {
- if (this.b.contains(chunkcoordintpair)) {
- for (int i = 0; i < this.a.size(); ++i) {
- if (((PendingChunkToSave) this.a.get(i)).a.equals(chunkcoordintpair)) {
- this.a.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
+ synchronized (this.d) {
+ if (this.c.contains(chunkcoordintpair)) {
+ for (int i = 0; i < this.b.size(); ++i) {
+ if (((PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) {
+ this.b.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
return;
}
}
}
- this.a.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
- this.b.add(chunkcoordintpair);
+ this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
+ this.c.add(chunkcoordintpair);
FileIOThread.a.a(this);
}
}
public boolean c() {
PendingChunkToSave pendingchunktosave = null;
- Object object = this.c;
+ Object object = this.d;
- synchronized (this.c) {
- if (this.a.isEmpty()) {
+ synchronized (this.d) {
+ if (this.b.isEmpty()) {
return false;
}
- pendingchunktosave = (PendingChunkToSave) this.a.remove(0);
- this.b.remove(pendingchunktosave.a);
+ pendingchunktosave = (PendingChunkToSave) this.b.remove(0);
+ this.c.remove(pendingchunktosave.a);
}
if (pendingchunktosave != null) {
@@ -188,7 +191,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
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);
+ DataOutputStream dataoutputstream = RegionFileCache.d(this.e, pendingchunktosave.a.x, pendingchunktosave.a.z);
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);
dataoutputstream.close();
@@ -205,14 +208,16 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
private void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) {
- nbttagcompound.setInt("xPos", chunk.x);
- nbttagcompound.setInt("zPos", chunk.z);
+ nbttagcompound.setByte("V", (byte) 1);
+ nbttagcompound.setInt("xPos", chunk.locX);
+ nbttagcompound.setInt("zPos", chunk.locZ);
nbttagcompound.setLong("LastUpdate", world.getTime());
nbttagcompound.setIntArray("HeightMap", chunk.heightMap);
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
- nbttagcompound.setLong("InhabitedTime", chunk.q);
+ nbttagcompound.setBoolean("LightPopulated", chunk.lit);
+ nbttagcompound.setLong("InhabitedTime", chunk.s);
ChunkSection[] achunksection = chunk.i();
- NBTTagList nbttaglist = new NBTTagList("Sections");
+ NBTTagList nbttaglist = new NBTTagList();
boolean flag = !world.worldProvider.g;
ChunkSection[] achunksection1 = achunksection;
int i = achunksection.length;
@@ -244,7 +249,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound.set("Sections", nbttaglist);
nbttagcompound.setByteArray("Biomes", chunk.m());
- chunk.m = false;
+ chunk.o = false;
NBTTagList nbttaglist1 = new NBTTagList();
Iterator iterator;
@@ -257,7 +262,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound1 = new NBTTagCompound();
if (entity.d(nbttagcompound1)) {
- chunk.m = true;
+ chunk.o = true;
nbttaglist1.add(nbttagcompound1);
}
}
@@ -288,12 +293,12 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
NextTickListEntry nextticklistentry = (NextTickListEntry) iterator1.next();
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
- nbttagcompound2.setInt("i", nextticklistentry.d);
+ nbttagcompound2.setInt("i", Block.b(nextticklistentry.a()));
nbttagcompound2.setInt("x", nextticklistentry.a);
nbttagcompound2.setInt("y", nextticklistentry.b);
nbttagcompound2.setInt("z", nextticklistentry.c);
- nbttagcompound2.setInt("t", (int) (nextticklistentry.e - k));
- nbttagcompound2.setInt("p", nextticklistentry.f);
+ nbttagcompound2.setInt("t", (int) (nextticklistentry.d - k));
+ nbttagcompound2.setInt("p", nextticklistentry.e);
nbttaglist3.add(nbttagcompound2);
}
@@ -308,19 +313,20 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
chunk.heightMap = nbttagcompound.getIntArray("HeightMap");
chunk.done = nbttagcompound.getBoolean("TerrainPopulated");
- chunk.q = nbttagcompound.getLong("InhabitedTime");
- NBTTagList nbttaglist = nbttagcompound.getList("Sections");
+ chunk.lit = nbttagcompound.getBoolean("LightPopulated");
+ chunk.s = nbttagcompound.getLong("InhabitedTime");
+ NBTTagList nbttaglist = nbttagcompound.getList("Sections", 10);
byte b0 = 16;
ChunkSection[] achunksection = new ChunkSection[b0];
boolean flag = !world.worldProvider.g;
for (int k = 0; k < nbttaglist.size(); ++k) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(k);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(k);
byte b1 = nbttagcompound1.getByte("Y");
ChunkSection chunksection = new ChunkSection(b1 << 4, flag);
chunksection.setIdArray(nbttagcompound1.getByteArray("Blocks"));
- if (nbttagcompound1.hasKey("Add")) {
+ if (nbttagcompound1.hasKeyOfType("Add", 7)) {
chunksection.setExtendedIdArray(new NibbleArray(nbttagcompound1.getByteArray("Add"), 4));
}
@@ -335,7 +341,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
chunk.a(achunksection);
- if (nbttagcompound.hasKey("Biomes")) {
+ if (nbttagcompound.hasKeyOfType("Biomes", 7)) {
chunk.a(nbttagcompound.getByteArray("Biomes"));
}
@@ -345,20 +351,19 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) {
// CraftBukkit end
-
- NBTTagList nbttaglist1 = nbttagcompound.getList("Entities");
+ NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
if (nbttaglist1 != null) {
for (int l = 0; l < nbttaglist1.size(); ++l) {
- NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.get(l);
+ NBTTagCompound nbttagcompound2 = nbttaglist1.get(l);
Entity entity = EntityTypes.a(nbttagcompound2, world);
- chunk.m = true;
+ chunk.o = true;
if (entity != null) {
chunk.a(entity);
Entity entity1 = entity;
- for (NBTTagCompound nbttagcompound3 = nbttagcompound2; nbttagcompound3.hasKey("Riding"); nbttagcompound3 = nbttagcompound3.getCompound("Riding")) {
+ for (NBTTagCompound nbttagcompound3 = nbttagcompound2; nbttagcompound3.hasKeyOfType("Riding", 10); nbttagcompound3 = nbttagcompound3.getCompound("Riding")) {
Entity entity2 = EntityTypes.a(nbttagcompound3.getCompound("Riding"), world);
if (entity2 != null) {
@@ -372,11 +377,11 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
}
- NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities");
+ NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities", 10);
if (nbttaglist2 != null) {
for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) {
- NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist2.get(i1);
+ NBTTagCompound nbttagcompound4 = nbttaglist2.get(i1);
TileEntity tileentity = TileEntity.c(nbttagcompound4);
if (tileentity != null) {
@@ -385,14 +390,14 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
}
- if (nbttagcompound.hasKey("TileTicks")) {
- NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks");
+ if (nbttagcompound.hasKeyOfType("TileTicks", 9)) {
+ NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks", 10);
if (nbttaglist3 != null) {
for (int j1 = 0; j1 < nbttaglist3.size(); ++j1) {
- NBTTagCompound nbttagcompound5 = (NBTTagCompound) nbttaglist3.get(j1);
+ NBTTagCompound nbttagcompound5 = nbttaglist3.get(j1);
- world.b(nbttagcompound5.getInt("x"), nbttagcompound5.getInt("y"), nbttagcompound5.getInt("z"), nbttagcompound5.getInt("i"), nbttagcompound5.getInt("t"), nbttagcompound5.getInt("p"));
+ world.b(nbttagcompound5.getInt("x"), nbttagcompound5.getInt("y"), nbttagcompound5.getInt("z"), Block.e(nbttagcompound5.getInt("i")), nbttagcompound5.getInt("t"), nbttagcompound5.getInt("p"));
}
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 3f67a19a18..a05efa0166 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -37,42 +37,48 @@ public class ChunkSection {
}
// CraftBukkit end
- public int getTypeId(int i, int j, int k) {
+ public Block getTypeId(int i, int j, int k) {
int l = this.blockIds[j << 8 | k << 4 | i] & 255;
- return this.extBlockIds != null ? this.extBlockIds.a(i, j, k) << 8 | l : l;
+ if (this.extBlockIds != null) {
+ l |= this.extBlockIds.a(i, j, k) << 8;
+ }
+
+ return Block.e(l);
}
- public void setTypeId(int i, int j, int k, int l) {
- int i1 = this.blockIds[j << 8 | k << 4 | i] & 255;
+ public void setTypeId(int i, int j, int k, Block block) {
+ int l = this.blockIds[j << 8 | k << 4 | i] & 255;
if (this.extBlockIds != null) {
- i1 |= this.extBlockIds.a(i, j, k) << 8;
+ l |= this.extBlockIds.a(i, j, k) << 8;
}
- if (i1 == 0 && l != 0) {
- ++this.nonEmptyBlockCount;
- if (Block.byId[l] != null && Block.byId[l].isTicking()) {
- ++this.tickingBlockCount;
- }
- } else if (i1 != 0 && l == 0) {
+ Block block1 = Block.e(l);
+
+ if (block1 != Blocks.AIR) {
--this.nonEmptyBlockCount;
- if (Block.byId[i1] != null && Block.byId[i1].isTicking()) {
+ if (block1.isTicking()) {
--this.tickingBlockCount;
}
- } else if (Block.byId[i1] != null && Block.byId[i1].isTicking() && (Block.byId[l] == null || !Block.byId[l].isTicking())) {
- --this.tickingBlockCount;
- } else if ((Block.byId[i1] == null || !Block.byId[i1].isTicking()) && Block.byId[l] != null && Block.byId[l].isTicking()) {
- ++this.tickingBlockCount;
}
- this.blockIds[j << 8 | k << 4 | i] = (byte) (l & 255);
- if (l > 255) {
+ if (block != Blocks.AIR) {
+ ++this.nonEmptyBlockCount;
+ if (block.isTicking()) {
+ ++this.tickingBlockCount;
+ }
+ }
+
+ int i1 = Block.b(block);
+
+ this.blockIds[j << 8 | k << 4 | i] = (byte) (i1 & 255);
+ if (i1 > 255) {
if (this.extBlockIds == null) {
this.extBlockIds = new NibbleArray(this.blockIds.length, 4);
}
- this.extBlockIds.a(i, j, k, (l & 3840) >> 8);
+ this.extBlockIds.a(i, j, k, (i1 & 3840) >> 8);
} else if (this.extBlockIds != null) {
this.extBlockIds.a(i, j, k, 0);
}
@@ -123,11 +129,11 @@ public class ChunkSection {
for (int off = 0; off < blkIds.length; off++) {
int l = blkIds[off] & 0xFF;
if (l > 0) {
- if (Block.byId[l] == null) {
+ if (Block.e(l) == null) {
blkIds[off] = 0;
} else {
++cntNonEmpty;
- if (Block.byId[l].isTicking()) {
+ if (Block.e(l).isTicking()) {
++cntTicking;
}
}
@@ -139,12 +145,12 @@ public class ChunkSection {
byte extid = ext[off2];
int l = (blkIds[off] & 0xFF) | ((extid & 0xF) << 8); // Even data
if (l > 0) {
- if (Block.byId[l] == null) {
+ if (Block.e(l) == null) {
blkIds[off] = 0;
ext[off2] &= 0xF0;
} else {
++cntNonEmpty;
- if (Block.byId[l].isTicking()) {
+ if (Block.e(l).isTicking()) {
++cntTicking;
}
}
@@ -152,12 +158,12 @@ public class ChunkSection {
off++;
l = (blkIds[off] & 0xFF) | ((extid & 0xF0) << 4); // Odd data
if (l > 0) {
- if (Block.byId[l] == null) {
+ if (Block.e(l) == null) {
blkIds[off] = 0;
ext[off2] &= 0x0F;
} else {
++cntNonEmpty;
- if (Block.byId[l].isTicking()) {
+ if (Block.e(l).isTicking()) {
++cntTicking;
}
}
@@ -178,19 +184,12 @@ public class ChunkSection {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
for (int k = 0; k < 16; ++k) {
- int l = this.getTypeId(i, j, k);
+ Block block = this.getTypeId(i, j, k);
- if (l > 0) {
- if (Block.byId[l] == null) {
- this.blockIds[j << 8 | k << 4 | i] = 0;
- if (this.extBlockIds != null) {
- this.extBlockIds.a(i, j, k, 0);
- }
- } else {
- ++this.nonEmptyBlockCount;
- if (Block.byId[l].isTicking()) {
- ++this.tickingBlockCount;
- }
+ if (block != Blocks.AIR) {
+ ++this.nonEmptyBlockCount;
+ if (block.isTicking()) {
+ ++this.tickingBlockCount;
}
}
}
diff --git a/src/main/java/net/minecraft/server/ClientCommandOrdinalWrapper.java b/src/main/java/net/minecraft/server/ClientCommandOrdinalWrapper.java
new file mode 100644
index 0000000000..04eacb8ed8
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ClientCommandOrdinalWrapper.java
@@ -0,0 +1,27 @@
+package net.minecraft.server;
+
+// CraftBukkit - import package private class
+class ClientCommandOrdinalWrapper {
+
+ static final int[] a = new int[EnumClientCommand.values().length];
+
+ static {
+ try {
+ a[EnumClientCommand.PERFORM_RESPAWN.ordinal()] = 1;
+ } catch (NoSuchFieldError nosuchfielderror) {
+ ;
+ }
+
+ try {
+ a[EnumClientCommand.REQUEST_STATS.ordinal()] = 2;
+ } catch (NoSuchFieldError nosuchfielderror1) {
+ ;
+ }
+
+ try {
+ a[EnumClientCommand.OPEN_INVENTORY_ACHIEVEMENT.ordinal()] = 3;
+ } catch (NoSuchFieldError nosuchfielderror2) {
+ ;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java
new file mode 100644
index 0000000000..527127289b
--- /dev/null
+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java
@@ -0,0 +1,220 @@
+package net.minecraft.server;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+// CraftBukkit start
+import java.util.ArrayList;
+import org.apache.logging.log4j.Level;
+import com.google.common.base.Joiner;
+// CraftBukkit end
+
+public abstract class CommandBlockListenerAbstract implements ICommandListener {
+
+ private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss");
+ private int b;
+ private boolean c = true;
+ private IChatBaseComponent d = null;
+ public String e = ""; // CraftBukkit - private -> public
+ private String f = "@";
+ protected org.bukkit.command.CommandSender sender; // CraftBukkit - add sender;
+
+ public CommandBlockListenerAbstract() {}
+
+ public int g() {
+ return this.b;
+ }
+
+ public IChatBaseComponent h() {
+ return this.d;
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ nbttagcompound.setString("Command", this.e);
+ nbttagcompound.setInt("SuccessCount", this.b);
+ nbttagcompound.setString("CustomName", this.f);
+ if (this.d != null) {
+ nbttagcompound.setString("LastOutput", ChatSerializer.a(this.d));
+ }
+
+ nbttagcompound.setBoolean("TrackOutput", this.c);
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ this.e = nbttagcompound.getString("Command");
+ this.b = nbttagcompound.getInt("SuccessCount");
+ if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
+ this.f = nbttagcompound.getString("CustomName");
+ }
+
+ if (nbttagcompound.hasKeyOfType("LastOutput", 8)) {
+ this.d = ChatSerializer.a(nbttagcompound.getString("LastOutput"));
+ }
+
+ if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) {
+ this.c = nbttagcompound.getBoolean("TrackOutput");
+ }
+ }
+
+ public boolean a(int i, String s) {
+ return i <= 2;
+ }
+
+ public void a(String s) {
+ this.e = s;
+ }
+
+ public String i() {
+ return this.e;
+ }
+
+ public void a(World world) {
+ if (world.isStatic) {
+ this.b = 0;
+ }
+
+ MinecraftServer minecraftserver = MinecraftServer.getServer();
+
+ if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) {
+ // CraftBukkit start - Handle command block commands using Bukkit dispatcher
+ org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
+ Joiner joiner = Joiner.on(" ");
+ String command = this.e;
+ if (this.e.startsWith("/")) {
+ command = this.e.substring(1);
+ }
+ String[] args = command.split(" ");
+ ArrayList commands = new ArrayList();
+
+ // Block disallowed commands
+ if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") ||
+ args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") ||
+ args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) {
+ this.b = 0;
+ return;
+ }
+
+ // Make sure this is a valid command
+ if (commandMap.getCommand(args[0]) == null) {
+ this.b = 0;
+ return;
+ }
+
+ // If the world has no players don't run
+ if (this.getWorld().players.isEmpty()) {
+ this.b = 0;
+ return;
+ }
+
+ // testfor command requires special handling
+ if (args[0].equalsIgnoreCase("testfor")) {
+ if (args.length < 2) {
+ this.b = 0;
+ return;
+ }
+
+ EntityPlayer[] players = PlayerSelector.getPlayers(this, args[1]);
+
+ if (players != null && players.length > 0) {
+ this.b = players.length;
+ return;
+ } else {
+ EntityPlayer player = MinecraftServer.getServer().getPlayerList().getPlayer(args[1]);
+ if (player == null) {
+ this.b = 0;
+ return;
+ } else {
+ this.b = 1;
+ return;
+ }
+ }
+ }
+
+ commands.add(args);
+
+ // Find positions of command block syntax, if any
+ ArrayList newCommands = new ArrayList();
+ for (int i = 0; i < args.length; i++) {
+ if (PlayerSelector.isPattern(args[i])) {
+ for (int j = 0; j < commands.size(); j++) {
+ newCommands.addAll(this.buildCommands(commands.get(j), i));
+ }
+ ArrayList temp = commands;
+ commands = newCommands;
+ newCommands = temp;
+ newCommands.clear();
+ }
+ }
+
+ int completed = 0;
+
+ // Now dispatch all of the commands we ended up with
+ for (int i = 0; i < commands.size(); i++) {
+ try {
+ if (commandMap.dispatch(sender, joiner.join(java.util.Arrays.asList(commands.get(i))))) {
+ completed++;
+ }
+ } catch (Throwable exception) {
+ if(this instanceof TileEntityCommandListener) {
+ TileEntityCommandListener listener = (TileEntityCommandListener) this;
+ MinecraftServer.av().log(Level.WARN, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().x, listener.getChunkCoordinates().y, listener.getChunkCoordinates().z), exception);
+ } else if (this instanceof EntityMinecartCommandBlockListener) {
+ EntityMinecartCommandBlockListener listener = (EntityMinecartCommandBlockListener) this;
+ MinecraftServer.av().log(Level.WARN, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().x, listener.getChunkCoordinates().y, listener.getChunkCoordinates().z), exception);
+ } else {
+ MinecraftServer.av().log(Level.WARN, String.format("Unknown CommandBlock failed to handle command"), exception);
+ }
+ }
+ }
+
+ this.b = completed;
+ // CraftBukkit end
+ } else {
+ this.b = 0;
+ }
+ }
+
+ // CraftBukkit start
+ private ArrayList buildCommands(String[] args, int pos) {
+ ArrayList commands = new ArrayList();
+ EntityPlayer[] players = PlayerSelector.getPlayers(this, args[pos]);
+ if (players != null) {
+ for (EntityPlayer player : players) {
+ if (player.world != this.getWorld()) {
+ continue;
+ }
+ String[] command = args.clone();
+ command[pos] = player.getName();
+ commands.add(command);
+ }
+ }
+
+ return commands;
+ }
+ // CraftBukkit end
+
+ public String getName() {
+ return this.f;
+ }
+
+ public IChatBaseComponent getScoreboardDisplayName() {
+ return new ChatComponentText(this.getName());
+ }
+
+ public void b(String s) {
+ this.f = s;
+ }
+
+ public void sendMessage(IChatBaseComponent ichatbasecomponent) {
+ if (this.c && this.getWorld() != null && !this.getWorld().isStatic) {
+ this.d = (new ChatComponentText("[" + a.format(new Date()) + "] ")).a(ichatbasecomponent);
+ this.e();
+ }
+ }
+
+ public abstract void e();
+
+ public void b(IChatBaseComponent ichatbasecomponent) {
+ this.d = ichatbasecomponent;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
deleted file mode 100644
index 533842c624..0000000000
--- a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package net.minecraft.server;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.SimpleDateFormat;
-import java.util.logging.Formatter;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import java.util.regex.Pattern; // CraftBukkit
-
-class ConsoleLogFormatter extends Formatter {
-
- private SimpleDateFormat b;
-
- final ConsoleLogManager a;
- // CraftBukkit start - Add color stripping
- private Pattern pattern = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]");
- private boolean strip = false;
- // CraftBukkit end
-
- private ConsoleLogFormatter(ConsoleLogManager consolelogmanager) {
- this.a = consolelogmanager;
- this.b = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- this.strip = MinecraftServer.getServer().options.has("log-strip-color"); // CraftBukkit
- }
-
- public String format(LogRecord logrecord) {
- StringBuilder stringbuilder = new StringBuilder();
-
- stringbuilder.append(this.b.format(Long.valueOf(logrecord.getMillis())));
- if (ConsoleLogManager.a(this.a) != null) {
- stringbuilder.append(ConsoleLogManager.a(this.a));
- }
-
- stringbuilder.append(" [").append(logrecord.getLevel().getName()).append("] ");
- stringbuilder.append(this.formatMessage(logrecord));
- stringbuilder.append('\n');
- Throwable throwable = logrecord.getThrown();
-
- if (throwable != null) {
- StringWriter stringwriter = new StringWriter();
-
- throwable.printStackTrace(new PrintWriter(stringwriter));
- stringbuilder.append(stringwriter.toString());
- }
-
- // CraftBukkit start - handle stripping color
- if (this.strip) {
- return this.pattern.matcher(stringbuilder.toString()).replaceAll("");
- } else {
- return stringbuilder.toString();
- }
- // CraftBukkit end
- }
-
- ConsoleLogFormatter(ConsoleLogManager consolelogmanager, EmptyClass3 emptyclass3) {
- this(consolelogmanager);
- }
-}
diff --git a/src/main/java/net/minecraft/server/ConsoleLogManager.java b/src/main/java/net/minecraft/server/ConsoleLogManager.java
deleted file mode 100644
index 98f9a8b102..0000000000
--- a/src/main/java/net/minecraft/server/ConsoleLogManager.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package net.minecraft.server;
-
-import java.util.logging.ConsoleHandler;
-import java.util.logging.FileHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import java.io.File; // CraftBukkit
-
-public class ConsoleLogManager implements IConsoleLogManager {
-
- private final Logger a;
- private final String b;
- private final String c;
- private final String d;
- public static Logger global = Logger.getLogger(""); // CraftBukkit
-
- public ConsoleLogManager(String s, String s1, String s2) {
- this.a = Logger.getLogger(s);
- this.c = s;
- this.d = s1;
- this.b = s2;
- this.b();
- }
-
- private void b() {
- this.a.setUseParentHandlers(false);
- Handler[] ahandler = this.a.getHandlers();
- int i = ahandler.length;
-
- for (int j = 0; j < i; ++j) {
- Handler handler = ahandler[j];
-
- this.a.removeHandler(handler);
- }
-
- ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(this, (EmptyClass3) null);
-
- // CraftBukkit start
- MinecraftServer server = MinecraftServer.getServer();
- ConsoleHandler consolehandler = new org.bukkit.craftbukkit.util.TerminalConsoleHandler(server.reader);
- // CraftBukkit end
-
- consolehandler.setFormatter(consolelogformatter);
- this.a.addHandler(consolehandler);
-
- // CraftBukkit start
- for (java.util.logging.Handler handler : global.getHandlers()) {
- global.removeHandler(handler);
- }
-
- consolehandler.setFormatter(new org.bukkit.craftbukkit.util.ShortConsoleLogFormatter(server));
- global.addHandler(consolehandler);
- // CraftBukkit end
-
- try {
- // CraftBukkit start
- String pattern = (String) server.options.valueOf("log-pattern");
-
- // We have to parse the pattern ourself so we can create directories as needed (java #6244047)
- String tmpDir = System.getProperty("java.io.tmpdir");
- String homeDir = System.getProperty("user.home");
- if (tmpDir == null) {
- tmpDir = homeDir;
- }
-
- // We only care about parsing for directories, FileHandler can do file names by itself
- File parent = new File(pattern).getParentFile();
- StringBuilder fixedPattern = new StringBuilder();
- String parentPath = "";
- if (parent != null) {
- parentPath = parent.getPath();
- }
-
- int j = 0;
- while (j < parentPath.length()) {
- char ch = parentPath.charAt(j);
- char ch2 = 0;
- if (j + 1 < parentPath.length()) {
- ch2 = Character.toLowerCase(pattern.charAt(j + 1));
- }
-
- if (ch == '%') {
- if (ch2 == 'h') {
- j += 2;
- fixedPattern.append(homeDir);
- continue;
- } else if (ch2 == 't') {
- j += 2;
- fixedPattern.append(tmpDir);
- continue;
- } else if (ch2 == '%') {
- // Even though we don't care about this we have to skip it to avoid matching %%t
- j += 2;
- fixedPattern.append("%%");
- continue;
- } else if (ch2 != 0) {
- throw new java.io.IOException("log-pattern can only use %t and %h for directories, got %" + ch2);
- }
- }
-
- fixedPattern.append(ch);
- j++;
- }
-
- // Try to create needed parent directories
- parent = new File(fixedPattern.toString());
- if (parent != null) {
- parent.mkdirs();
- }
-
- int limit = (Integer) server.options.valueOf("log-limit");
- int count = (Integer) server.options.valueOf("log-count");
- boolean append = (Boolean) server.options.valueOf("log-append");
- FileHandler filehandler = new FileHandler(pattern, limit, count, append);
- // CraftBukkit end
-
- filehandler.setFormatter(consolelogformatter);
- this.a.addHandler(filehandler);
- global.addHandler(filehandler); // CraftBukkit
- } catch (Exception exception) {
- this.a.log(Level.WARNING, "Failed to log " + this.c + " to " + this.b, exception);
- }
- }
-
- public Logger getLogger() {
- return this.a;
- }
-
- public void info(String s) {
- this.a.log(Level.INFO, s);
- }
-
- public void warning(String s) {
- this.a.log(Level.WARNING, s);
- }
-
- public void warning(String s, Object... aobject) {
- this.a.log(Level.WARNING, s, aobject);
- }
-
- public void warning(String s, Throwable throwable) {
- this.a.log(Level.WARNING, s, throwable);
- }
-
- public void severe(String s) {
- this.a.log(Level.SEVERE, s);
- }
-
- public void severe(String s, Throwable throwable) {
- this.a.log(Level.SEVERE, s, throwable);
- }
-
- static String a(ConsoleLogManager consolelogmanager) {
- return consolelogmanager.d;
- }
-}
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
index 8092047f71..1995968572 100644
--- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java
@@ -42,7 +42,7 @@ public abstract class Container {
public Container() {}
protected Slot a(Slot slot) {
- slot.g = this.c.size();
+ slot.rawSlotIndex = this.c.size();
this.c.add(slot);
this.b.add(null);
return slot;
@@ -162,7 +162,7 @@ public abstract class Container {
}
l -= itemstack2.count - j1;
- draggedSlots.put(slot1.g, itemstack2); // CraftBukkit - Put in map instead of setting, Should be Slot.rawSlotIndex
+ draggedSlots.put(slot1.rawSlotIndex, itemstack2); // CraftBukkit - Put in map instead of setting
}
}
@@ -221,7 +221,7 @@ public abstract class Container {
if (i == -999) {
if (playerinventory.getCarried() != null && i == -999) {
if (j == 0) {
- entityhuman.drop(playerinventory.getCarried());
+ entityhuman.drop(playerinventory.getCarried(), true);
playerinventory.setCarried((ItemStack) null);
}
@@ -229,7 +229,7 @@ public abstract class Container {
// CraftBukkit start - Store a reference
ItemStack itemstack4 = playerinventory.getCarried();
if (itemstack4.count > 0) {
- entityhuman.drop(itemstack4.a(1));
+ entityhuman.drop(itemstack4.a(1), true);
}
if (itemstack4.count == 0) {
@@ -247,9 +247,10 @@ public abstract class Container {
if (slot2 != null && slot2.a(entityhuman)) {
itemstack1 = this.b(entityhuman, i);
if (itemstack1 != null) {
- l = itemstack1.id;
+ Item item = itemstack1.getItem();
+
itemstack = itemstack1.cloneItemStack();
- if (slot2 != null && slot2.getItem() != null && slot2.getItem().id == l) {
+ if (slot2.getItem() != null && slot2.getItem().getItem() == item) {
this.a(i, j, true, entityhuman);
}
}
@@ -294,7 +295,7 @@ public abstract class Container {
slot2.a(entityhuman, playerinventory.getCarried());
} else if (slot2.isAllowed(itemstack4)) {
- if (itemstack1.id == itemstack4.id && itemstack1.getData() == itemstack4.getData() && ItemStack.equals(itemstack1, itemstack4)) {
+ if (itemstack1.getItem() == itemstack4.getItem() && itemstack1.getData() == itemstack4.getData() && ItemStack.equals(itemstack1, itemstack4)) {
k1 = j == 0 ? itemstack4.count : 1;
if (k1 > slot2.a() - itemstack1.count) {
k1 = slot2.a() - itemstack1.count;
@@ -314,7 +315,7 @@ public abstract class Container {
slot2.set(itemstack4);
playerinventory.setCarried(itemstack1);
}
- } else if (itemstack1.id == itemstack4.id && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) {
+ } else if (itemstack1.getItem() == itemstack4.getItem() && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) {
k1 = itemstack1.count;
if (k1 > 0 && k1 + itemstack4.count <= itemstack4.getMaxStackSize()) {
itemstack4.count += k1;
@@ -375,7 +376,7 @@ public abstract class Container {
if (slot2 != null && slot2.e() && slot2.a(entityhuman)) {
itemstack1 = slot2.a(j == 0 ? 1 : slot2.getItem().count);
slot2.a(entityhuman, itemstack1);
- entityhuman.drop(itemstack1);
+ entityhuman.drop(itemstack1, true);
}
} else if (k == 6 && i >= 0) {
slot2 = (Slot) this.c.get(i);
@@ -422,7 +423,7 @@ public abstract class Container {
PlayerInventory playerinventory = entityhuman.inventory;
if (playerinventory.getCarried() != null) {
- entityhuman.drop(playerinventory.getCarried());
+ entityhuman.drop(playerinventory.getCarried(), false);
playerinventory.setCarried((ItemStack) null);
}
}
@@ -464,7 +465,7 @@ public abstract class Container {
while (itemstack.count > 0 && (!flag && k < j || flag && k >= i)) {
slot = (Slot) this.c.get(k);
itemstack1 = slot.getItem();
- if (itemstack1 != null && itemstack1.id == itemstack.id && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
+ if (itemstack1 != null && itemstack1.getItem() == itemstack.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
int l = itemstack1.count + itemstack.count;
if (l <= itemstack.getMaxStackSize()) {
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index 9b73555c5e..24b2d7e257 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -3,22 +3,25 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
+import net.minecraft.util.org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
public class ContainerAnvil extends Container {
- private IInventory f = new InventoryCraftResult();
- private IInventory g = new ContainerAnvilInventory(this, "Repair", true, 2);
- private World h;
- private int i;
+ private static final Logger f = LogManager.getLogger();
+ private IInventory g = new InventoryCraftResult();
+ private IInventory h = new ContainerAnvilInventory(this, "Repair", true, 2);
+ private World i;
private int j;
private int k;
- public int a;
private int l;
- private String m;
- private final EntityHuman n;
+ public int a;
+ private int m;
+ private String n;
+ private final EntityHuman o;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -26,14 +29,14 @@ public class ContainerAnvil extends Container {
public ContainerAnvil(PlayerInventory playerinventory, World world, int i, int j, int k, EntityHuman entityhuman) {
this.player = playerinventory; // CraftBukkit
- this.h = world;
- this.i = i;
- this.j = j;
- this.k = k;
- this.n = entityhuman;
- this.a(new Slot(this.g, 0, 27, 47));
- this.a(new Slot(this.g, 1, 76, 47));
- this.a((Slot) (new SlotAnvilResult(this, this.f, 2, 134, 47, world, i, j, k)));
+ this.i = world;
+ this.j = i;
+ this.k = j;
+ this.l = k;
+ this.o = entityhuman;
+ this.a(new Slot(this.h, 0, 27, 47));
+ this.a(new Slot(this.h, 1, 76, 47));
+ this.a((Slot) (new SlotAnvilResult(this, this.g, 2, 134, 47, world, i, j, k)));
int l;
@@ -50,13 +53,13 @@ public class ContainerAnvil extends Container {
public void a(IInventory iinventory) {
super.a(iinventory);
- if (iinventory == this.g) {
+ if (iinventory == this.h) {
this.e();
}
}
public void e() {
- ItemStack itemstack = this.g.getItem(0);
+ ItemStack itemstack = this.h.getItem(0);
this.a = 0;
int i = 0;
@@ -64,16 +67,16 @@ public class ContainerAnvil extends Container {
int j = 0;
if (itemstack == null) {
- this.f.setItem(0, (ItemStack) null);
+ this.g.setItem(0, (ItemStack) null);
this.a = 0;
} else {
ItemStack itemstack1 = itemstack.cloneItemStack();
- ItemStack itemstack2 = this.g.getItem(1);
+ ItemStack itemstack2 = this.h.getItem(1);
Map map = EnchantmentManager.a(itemstack1);
boolean flag = false;
int k = b0 + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost());
- this.l = 0;
+ this.m = 0;
int l;
int i1;
int j1;
@@ -83,11 +86,11 @@ public class ContainerAnvil extends Container {
Enchantment enchantment;
if (itemstack2 != null) {
- flag = itemstack2.id == Item.ENCHANTED_BOOK.id && Item.ENCHANTED_BOOK.g(itemstack2).size() > 0;
- if (itemstack1.g() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
+ flag = itemstack2.getItem() == Items.ENCHANTED_BOOK && Items.ENCHANTED_BOOK.g(itemstack2).size() > 0;
+ if (itemstack1.g() && itemstack1.getItem().a(itemstack, itemstack2)) {
l = Math.min(itemstack1.j(), itemstack1.l() / 4);
if (l <= 0) {
- this.f.setItem(0, (ItemStack) null);
+ this.g.setItem(0, (ItemStack) null);
this.a = 0;
return;
}
@@ -99,10 +102,10 @@ public class ContainerAnvil extends Container {
l = Math.min(itemstack1.j(), itemstack1.l() / 4);
}
- this.l = i1;
+ this.m = i1;
} else {
- if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.g())) {
- this.f.setItem(0, (ItemStack) null);
+ if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.g())) {
+ this.g.setItem(0, (ItemStack) null);
this.a = 0;
return;
}
@@ -146,7 +149,7 @@ public class ContainerAnvil extends Container {
int k2 = l1 - k1;
boolean flag1 = enchantment.canEnchant(itemstack);
- if (this.n.abilities.canInstantlyBuild || itemstack.id == ItemEnchantedBook.ENCHANTED_BOOK.id) {
+ if (this.o.abilities.canInstantlyBuild || itemstack.getItem() == Items.ENCHANTED_BOOK) {
flag1 = true;
}
@@ -204,20 +207,20 @@ public class ContainerAnvil extends Container {
}
}
- if (StringUtils.isBlank(this.m)) {
+ if (StringUtils.isBlank(this.n)) {
if (itemstack.hasName()) {
j = itemstack.g() ? 7 : itemstack.count * 5;
i += j;
itemstack1.t();
}
- } else if (!this.m.equals(itemstack.getName())) {
+ } else if (!this.n.equals(itemstack.getName())) {
j = itemstack.g() ? 7 : itemstack.count * 5;
i += j;
if (itemstack.hasName()) {
k += j / 2;
}
- itemstack1.c(this.m);
+ itemstack1.c(this.n);
}
l = 0;
@@ -271,7 +274,7 @@ public class ContainerAnvil extends Container {
this.a = 39;
}
- if (this.a >= 40 && !this.n.abilities.canInstantlyBuild) {
+ if (this.a >= 40 && !this.o.abilities.canInstantlyBuild) {
itemstack1 = null;
}
@@ -294,7 +297,7 @@ public class ContainerAnvil extends Container {
EnchantmentManager.a(map, itemstack1);
}
- this.f.setItem(0, itemstack1);
+ this.g.setItem(0, itemstack1);
this.b();
}
}
@@ -306,12 +309,12 @@ public class ContainerAnvil extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
- if (!this.h.isStatic) {
- for (int i = 0; i < this.g.getSize(); ++i) {
- ItemStack itemstack = this.g.splitWithoutUpdate(i);
+ if (!this.i.isStatic) {
+ for (int i = 0; i < this.h.getSize(); ++i) {
+ ItemStack itemstack = this.h.splitWithoutUpdate(i);
if (itemstack != null) {
- entityhuman.drop(itemstack);
+ entityhuman.drop(itemstack, false);
}
}
}
@@ -319,7 +322,7 @@ public class ContainerAnvil extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.h.getTypeId(this.i, this.j, this.k) != Block.ANVIL.id ? false : entityhuman.e((double) this.i + 0.5D, (double) this.j + 0.5D, (double) this.k + 0.5D) <= 64.0D;
+ return this.i.getType(this.j, this.k, this.l) != Blocks.ANVIL ? false : entityhuman.e((double) this.j + 0.5D, (double) this.k + 0.5D, (double) this.l + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
@@ -361,14 +364,14 @@ public class ContainerAnvil extends Container {
}
public void a(String s) {
- this.m = s;
+ this.n = s;
if (this.getSlot(2).e()) {
ItemStack itemstack = this.getSlot(2).getItem();
if (StringUtils.isBlank(s)) {
itemstack.t();
} else {
- itemstack.c(this.m);
+ itemstack.c(this.n);
}
}
@@ -376,11 +379,11 @@ public class ContainerAnvil extends Container {
}
static IInventory a(ContainerAnvil containeranvil) {
- return containeranvil.g;
+ return containeranvil.h;
}
static int b(ContainerAnvil containeranvil) {
- return containeranvil.l;
+ return containeranvil.m;
}
// CraftBukkit start
@@ -389,7 +392,7 @@ public class ContainerAnvil extends Container {
return bukkitEntity;
}
- org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.g, this.f);
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.h, this.g);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
diff --git a/src/main/java/net/minecraft/server/ContainerAnvilInventory.java b/src/main/java/net/minecraft/server/ContainerAnvilInventory.java
index 465d6c8c5b..20d7c69cff 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvilInventory.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvilInventory.java
@@ -50,8 +50,4 @@ public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBuk
super.update();
this.a.a((IInventory) this);
}
-
- public boolean b(int i, ItemStack itemstack) {
- return true;
- }
}
diff --git a/src/main/java/net/minecraft/server/ContainerBrewingStand.java b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
index e4c2dce722..b3b68d0d24 100644
--- a/src/main/java/net/minecraft/server/ContainerBrewingStand.java
+++ b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
@@ -38,7 +38,7 @@ public class ContainerBrewingStand extends Container {
public void addSlotListener(ICrafting icrafting) {
super.addSlotListener(icrafting);
- icrafting.setContainerData(this, 0, this.brewingStand.x_());
+ icrafting.setContainerData(this, 0, this.brewingStand.i());
}
public void b() {
@@ -47,12 +47,12 @@ public class ContainerBrewingStand extends Container {
for (int i = 0; i < this.listeners.size(); ++i) {
ICrafting icrafting = (ICrafting) this.listeners.get(i);
- if (this.g != this.brewingStand.x_()) {
- icrafting.setContainerData(this, 0, this.brewingStand.x_());
+ if (this.g != this.brewingStand.i()) {
+ icrafting.setContainerData(this, 0, this.brewingStand.i());
}
}
- this.g = this.brewingStand.x_();
+ this.g = this.brewingStand.i();
}
public boolean a(EntityHuman entityhuman) {
diff --git a/src/main/java/net/minecraft/server/ContainerChest.java b/src/main/java/net/minecraft/server/ContainerChest.java
index 273e9e844d..889e5d5ddc 100644
--- a/src/main/java/net/minecraft/server/ContainerChest.java
+++ b/src/main/java/net/minecraft/server/ContainerChest.java
@@ -39,7 +39,7 @@ public class ContainerChest extends Container {
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;
+ this.player = (PlayerInventory) iinventory;
// CraftBukkit end
int j;
@@ -95,7 +95,7 @@ public class ContainerChest extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
- this.container.g();
+ this.container.l_();
}
public IInventory e() {
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
index e231b3c6bd..97a06f70d9 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
@@ -89,28 +89,28 @@ public class ContainerEnchantTable extends Container {
for (j = -1; j <= 1; ++j) {
for (int k = -1; k <= 1; ++k) {
if ((j != 0 || k != 0) && this.world.isEmpty(this.x + k, this.y, this.z + j) && this.world.isEmpty(this.x + k, this.y + 1, this.z + j)) {
- if (this.world.getTypeId(this.x + k * 2, this.y, this.z + j * 2) == Block.BOOKSHELF.id) {
+ if (this.world.getType(this.x + k * 2, this.y, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
- if (this.world.getTypeId(this.x + k * 2, this.y + 1, this.z + j * 2) == Block.BOOKSHELF.id) {
+ if (this.world.getType(this.x + k * 2, this.y + 1, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
if (k != 0 && j != 0) {
- if (this.world.getTypeId(this.x + k * 2, this.y, this.z + j) == Block.BOOKSHELF.id) {
+ if (this.world.getType(this.x + k * 2, this.y, this.z + j) == Blocks.BOOKSHELF) {
++i;
}
- if (this.world.getTypeId(this.x + k * 2, this.y + 1, this.z + j) == Block.BOOKSHELF.id) {
+ if (this.world.getType(this.x + k * 2, this.y + 1, this.z + j) == Blocks.BOOKSHELF) {
++i;
}
- if (this.world.getTypeId(this.x + k, this.y, this.z + j * 2) == Block.BOOKSHELF.id) {
+ if (this.world.getType(this.x + k, this.y, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
- if (this.world.getTypeId(this.x + k, this.y + 1, this.z + j * 2) == Block.BOOKSHELF.id) {
+ if (this.world.getType(this.x + k, this.y + 1, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
}
@@ -152,7 +152,7 @@ public class ContainerEnchantTable extends Container {
if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) {
if (!this.world.isStatic) {
List list = EnchantmentManager.b(this.l, itemstack, this.costs[i]);
- boolean flag = itemstack.id == Item.BOOK.id;
+ boolean flag = itemstack.getItem() == Items.BOOK;
if (list != null) {
// CraftBukkit start
@@ -181,9 +181,9 @@ public class ContainerEnchantTable extends Container {
}
EnchantmentInstance enchantment = new EnchantmentInstance(enchantId, entry.getValue());
- Item.ENCHANTED_BOOK.a(itemstack, enchantment);
+ Items.ENCHANTED_BOOK.a(itemstack, enchantment);
applied = true;
- itemstack.id = Item.ENCHANTED_BOOK.id;
+ itemstack.setItem((Item) Items.ENCHANTED_BOOK);
break;
} else {
item.addEnchantment(entry.getKey(), entry.getValue());
@@ -215,14 +215,14 @@ public class ContainerEnchantTable extends Container {
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(0);
if (itemstack != null) {
- entityhuman.drop(itemstack);
+ entityhuman.drop(itemstack, false);
}
}
}
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.world.getTypeId(this.x, this.y, this.z) != Block.ENCHANTMENT_TABLE.id ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
+ return this.world.getType(this.x, this.y, this.z) != Blocks.ENCHANTMENT_TABLE ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
@@ -246,7 +246,7 @@ public class ContainerEnchantTable extends Container {
((Slot) this.c.get(0)).set(itemstack1.cloneItemStack());
itemstack1.count = 0;
} else if (itemstack1.count >= 1) {
- ((Slot) this.c.get(0)).set(new ItemStack(itemstack1.id, 1, itemstack1.getData()));
+ ((Slot) this.c.get(0)).set(new ItemStack(itemstack1.getItem(), 1, itemstack1.getData()));
--itemstack1.count;
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java b/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
index c279eb3f09..b9dbf60a86 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
@@ -8,7 +8,7 @@ import org.bukkit.entity.HumanEntity;
public class ContainerEnchantTableInventory extends InventorySubcontainer { // CraftBukkit -> public
- private final ContainerEnchantTable enchantTable;
+ final ContainerEnchantTable enchantTable;
// CraftBukkit start
public List transaction = new java.util.ArrayList();
@@ -54,8 +54,4 @@ public class ContainerEnchantTableInventory extends InventorySubcontainer { // C
super.update();
this.enchantTable.a((IInventory) this);
}
-
- public boolean b(int i, ItemStack itemstack) {
- return true;
- }
}
diff --git a/src/main/java/net/minecraft/server/ContainerFurnace.java b/src/main/java/net/minecraft/server/ContainerFurnace.java
index d9764da25f..49757ae46b 100644
--- a/src/main/java/net/minecraft/server/ContainerFurnace.java
+++ b/src/main/java/net/minecraft/server/ContainerFurnace.java
@@ -98,7 +98,7 @@ public class ContainerFurnace extends Container {
slot.a(itemstack1, itemstack);
} else if (i != 1 && i != 0) {
- if (RecipesFurnace.getInstance().getResult(itemstack1.getItem().id) != null) {
+ if (RecipesFurnace.getInstance().getResult(itemstack1) != null) {
if (!this.a(itemstack1, 0, 1, false)) {
return null;
}
diff --git a/src/main/java/net/minecraft/server/ContainerHopper.java b/src/main/java/net/minecraft/server/ContainerHopper.java
index a46a3d3dd6..5c7450ba7d 100644
--- a/src/main/java/net/minecraft/server/ContainerHopper.java
+++ b/src/main/java/net/minecraft/server/ContainerHopper.java
@@ -80,6 +80,6 @@ public class ContainerHopper extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
- this.hopper.g();
+ this.hopper.l_();
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerHorse.java b/src/main/java/net/minecraft/server/ContainerHorse.java
index 43fb0cdd01..0fc3b73ae0 100644
--- a/src/main/java/net/minecraft/server/ContainerHorse.java
+++ b/src/main/java/net/minecraft/server/ContainerHorse.java
@@ -99,6 +99,6 @@ public class ContainerHorse extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
- this.a.g();
+ this.a.l_();
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerMerchant.java b/src/main/java/net/minecraft/server/ContainerMerchant.java
index 7424452d06..444ec54703 100644
--- a/src/main/java/net/minecraft/server/ContainerMerchant.java
+++ b/src/main/java/net/minecraft/server/ContainerMerchant.java
@@ -21,6 +21,7 @@ public class ContainerMerchant extends Container {
}
// CraftBukkit end
+
public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
this.merchant = imerchant;
this.g = world;
@@ -65,7 +66,7 @@ public class ContainerMerchant extends Container {
}
public boolean a(EntityHuman entityhuman) {
- return this.merchant.m_() == entityhuman;
+ return this.merchant.b() == entityhuman;
}
public ItemStack b(EntityHuman entityhuman, int i) {
@@ -118,12 +119,12 @@ public class ContainerMerchant extends Container {
ItemStack itemstack = this.f.splitWithoutUpdate(0);
if (itemstack != null) {
- entityhuman.drop(itemstack);
+ entityhuman.drop(itemstack, false);
}
itemstack = this.f.splitWithoutUpdate(1);
if (itemstack != null) {
- entityhuman.drop(itemstack);
+ entityhuman.drop(itemstack, false);
}
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerPlayer.java b/src/main/java/net/minecraft/server/ContainerPlayer.java
index 48b6d90aa6..08fb2be0ec 100644
--- a/src/main/java/net/minecraft/server/ContainerPlayer.java
+++ b/src/main/java/net/minecraft/server/ContainerPlayer.java
@@ -61,7 +61,7 @@ public class ContainerPlayer extends Container {
}
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
- player.playerConnection.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
+ player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
// CraftBukkit end
}
@@ -72,7 +72,7 @@ public class ContainerPlayer extends Container {
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
if (itemstack != null) {
- entityhuman.drop(itemstack);
+ entityhuman.drop(itemstack, false);
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerWorkbench.java b/src/main/java/net/minecraft/server/ContainerWorkbench.java
index 025cc62598..86997a7ffb 100644
--- a/src/main/java/net/minecraft/server/ContainerWorkbench.java
+++ b/src/main/java/net/minecraft/server/ContainerWorkbench.java
@@ -63,7 +63,7 @@ public class ContainerWorkbench extends Container {
}
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
- player.playerConnection.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
+ player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
// CraftBukkit end
}
@@ -74,7 +74,7 @@ public class ContainerWorkbench extends Container {
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
if (itemstack != null) {
- entityhuman.drop(itemstack);
+ entityhuman.drop(itemstack, false);
}
}
}
@@ -82,7 +82,7 @@ public class ContainerWorkbench extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.g.getTypeId(this.h, this.i, this.j) != Block.WORKBENCH.id ? false : entityhuman.e((double) this.h + 0.5D, (double) this.i + 0.5D, (double) this.j + 0.5D) <= 64.0D;
+ return this.g.getType(this.h, this.i, this.j) != Blocks.WORKBENCH ? false : entityhuman.e((double) this.h + 0.5D, (double) this.i + 0.5D, (double) this.j + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index 46985b5d28..9675edb2db 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -30,117 +30,124 @@ public class CraftingManager {
(new RecipesArmor()).a(this);
(new RecipesDyes()).a(this);
this.recipes.add(new RecipeArmorDye());
+ this.recipes.add(new RecipeBookClone());
this.recipes.add(new RecipeMapClone());
this.recipes.add(new RecipeMapExtend());
this.recipes.add(new RecipeFireworks());
- this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
- 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.COBBLE_WALL, 6, 0), new Object[] { "###", "###", Character.valueOf('#'), Block.COBBLESTONE});
- this.registerShapedRecipe(new ItemStack(Block.COBBLE_WALL, 6, 1), new Object[] { "###", "###", Character.valueOf('#'), Block.MOSSY_COBBLESTONE});
- 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});
- this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
- this.registerShapedRecipe(new ItemStack(Item.LEASH, 2), new Object[] { "~~ ", "~O ", " ~", Character.valueOf('~'), Item.STRING, Character.valueOf('O'), Item.SLIME_BALL});
- this.registerShapedRecipe(new ItemStack(Block.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE});
- this.registerShapedRecipe(new ItemStack(Block.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.BOOK});
- this.registerShapedRecipe(new ItemStack(Block.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.SNOW_BALL});
- this.registerShapedRecipe(new ItemStack(Block.SNOW, 6), new Object[] { "###", Character.valueOf('#'), Block.SNOW_BLOCK});
- this.registerShapedRecipe(new ItemStack(Block.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BALL});
- this.registerShapedRecipe(new ItemStack(Block.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BRICK});
- this.registerShapedRecipe(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.GLOWSTONE_DUST});
- this.registerShapedRecipe(new ItemStack(Block.QUARTZ_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.QUARTZ});
- this.registerShapedRecipe(new ItemStack(Block.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.STRING});
- this.registerShapedRecipe(new ItemStack(Block.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Item.SULPHUR, Character.valueOf('#'), Block.SAND});
- 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, 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.STEP, 6, 6), new Object[] { "###", Character.valueOf('#'), Block.NETHER_BRICK});
- this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 7), new Object[] { "###", Character.valueOf('#'), Block.QUARTZ_BLOCK});
- 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, 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)});
- this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 1), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 1)});
- this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 2), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 2)});
- this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 3), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 3)});
- this.registerShapedRecipe(new ItemStack(Item.STICK, 4), new Object[] { "#", "#", Character.valueOf('#'), Block.WOOD});
- this.registerShapedRecipe(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), Item.COAL, Character.valueOf('#'), Item.STICK});
- this.registerShapedRecipe(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), new ItemStack(Item.COAL, 1, 1), Character.valueOf('#'), Item.STICK});
- this.registerShapedRecipe(new ItemStack(Item.BOWL, 4), new Object[] { "# #", " # ", Character.valueOf('#'), Block.WOOD});
- this.registerShapedRecipe(new ItemStack(Item.GLASS_BOTTLE, 3), new Object[] { "# #", " # ", Character.valueOf('#'), Block.GLASS});
- this.registerShapedRecipe(new ItemStack(Block.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Item.STICK});
- this.registerShapedRecipe(new ItemStack(Block.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.GOLD_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Item.STICK});
- this.registerShapedRecipe(new ItemStack(Block.ACTIVATOR_RAIL, 6), new Object[] { "XSX", "X#X", "XSX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('S'), Item.STICK});
- this.registerShapedRecipe(new ItemStack(Block.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Block.STONE_PLATE});
- this.registerShapedRecipe(new ItemStack(Item.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
- this.registerShapedRecipe(new ItemStack(Item.CAULDRON, 1), new Object[] { "# #", "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
- this.registerShapedRecipe(new ItemStack(Item.BREWING_STAND, 1), new Object[] { " B ", "###", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('B'), Item.BLAZE_ROD});
- this.registerShapedRecipe(new ItemStack(Block.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.PUMPKIN, Character.valueOf('B'), Block.TORCH});
- this.registerShapedRecipe(new ItemStack(Item.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.CHEST, Character.valueOf('B'), Item.MINECART});
- this.registerShapedRecipe(new ItemStack(Item.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
- this.registerShapedRecipe(new ItemStack(Item.MINECART_TNT, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.TNT, Character.valueOf('B'), Item.MINECART});
- this.registerShapedRecipe(new ItemStack(Item.MINECART_HOPPER, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.HOPPER, Character.valueOf('B'), Item.MINECART});
- this.registerShapedRecipe(new ItemStack(Item.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Block.WOOD});
- this.registerShapedRecipe(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
- this.registerShapedRecipe(new ItemStack(Item.FLOWER_POT, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.CLAY_BRICK});
- 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('#'), 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(Item.CARROT_STICK, 1), new Object[] { "# ", " X", Character.valueOf('#'), Item.FISHING_ROD, Character.valueOf('X'), Item.CARROT}).c();
- 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(Block.QUARTZ_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.QUARTZ_BLOCK});
- this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
- this.registerShapedRecipe(new ItemStack(Item.ITEM_FRAME, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.LEATHER});
- this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_INGOT, 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(Item.CARROT_GOLDEN, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.CARROT});
- this.registerShapedRecipe(new ItemStack(Item.SPECKLED_MELON, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.MELON});
- 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.REDSTONE_COMPARATOR, 1), new Object[] { " # ", "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.QUARTZ, 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});
- this.registerShapedRecipe(new ItemStack(Item.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.IRON_INGOT, Character.valueOf('X'), Item.REDSTONE});
- this.registerShapedRecipe(new ItemStack(Item.MAP_EMPTY, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.PAPER, Character.valueOf('X'), Item.COMPASS});
- this.registerShapedRecipe(new ItemStack(Block.STONE_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Block.STONE});
- this.registerShapedRecipe(new ItemStack(Block.WOOD_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Block.WOOD});
- this.registerShapedRecipe(new ItemStack(Block.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.STONE});
- this.registerShapedRecipe(new ItemStack(Block.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.WOOD});
- this.registerShapedRecipe(new ItemStack(Block.IRON_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Item.IRON_INGOT});
- this.registerShapedRecipe(new ItemStack(Block.GOLD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Item.GOLD_INGOT});
- this.registerShapedRecipe(new ItemStack(Block.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.BOW, Character.valueOf('R'), Item.REDSTONE});
- this.registerShapedRecipe(new ItemStack(Block.DROPPER, 1), new Object[] { "###", "# #", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('R'), Item.REDSTONE});
- this.registerShapedRecipe(new ItemStack(Block.PISTON, 1), new Object[] { "TTT", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('T'), Block.WOOD});
- this.registerShapedRecipe(new ItemStack(Block.PISTON_STICKY, 1), new Object[] { "S", "P", Character.valueOf('S'), Item.SLIME_BALL, Character.valueOf('P'), Block.PISTON});
- this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
- this.registerShapedRecipe(new ItemStack(Block.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Block.OBSIDIAN, Character.valueOf('B'), Item.BOOK, Character.valueOf('D'), Item.DIAMOND});
- this.registerShapedRecipe(new ItemStack(Block.ANVIL, 1), new Object[] { "III", " i ", "iii", Character.valueOf('I'), Block.IRON_BLOCK, Character.valueOf('i'), Item.IRON_INGOT});
- this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
- this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, Item.COAL});
- this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, new ItemStack(Item.COAL, 1, 1)});
- this.registerShapedRecipe(new ItemStack(Block.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Block.GLASS, Character.valueOf('Q'), Item.QUARTZ, Character.valueOf('W'), Block.WOOD_STEP});
- this.registerShapedRecipe(new ItemStack(Block.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Item.IRON_INGOT, Character.valueOf('C'), Block.CHEST});
+ this.registerShapedRecipe(new ItemStack(Items.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Items.SUGAR_CANE});
+ this.registerShapelessRecipe(new ItemStack(Items.BOOK, 1), new Object[] { Items.PAPER, Items.PAPER, Items.PAPER, Items.LEATHER});
+ this.registerShapelessRecipe(new ItemStack(Items.BOOK_AND_QUILL, 1), new Object[] { Items.BOOK, new ItemStack(Items.INK_SACK, 1, 0), Items.FEATHER});
+ this.registerShapedRecipe(new ItemStack(Blocks.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.COBBLE_WALL, 6, 0), new Object[] { "###", "###", Character.valueOf('#'), Blocks.COBBLESTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.COBBLE_WALL, 6, 1), new Object[] { "###", "###", Character.valueOf('#'), Blocks.MOSSY_COBBLESTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Blocks.NETHER_BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Items.STICK, Character.valueOf('W'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Blocks.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.DIAMOND});
+ this.registerShapedRecipe(new ItemStack(Items.LEASH, 2), new Object[] { "~~ ", "~O ", " ~", Character.valueOf('~'), Items.STRING, Character.valueOf('O'), Items.SLIME_BALL});
+ this.registerShapedRecipe(new ItemStack(Blocks.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.REDSTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.BOOK});
+ this.registerShapedRecipe(new ItemStack(Blocks.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.SNOW_BALL});
+ this.registerShapedRecipe(new ItemStack(Blocks.SNOW, 6), new Object[] { "###", Character.valueOf('#'), Blocks.SNOW_BLOCK});
+ this.registerShapedRecipe(new ItemStack(Blocks.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.CLAY_BALL});
+ this.registerShapedRecipe(new ItemStack(Blocks.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.CLAY_BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.GLOWSTONE_DUST});
+ this.registerShapedRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.QUARTZ});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.STRING});
+ this.registerShapedRecipe(new ItemStack(Blocks.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Items.SULPHUR, Character.valueOf('#'), Blocks.SAND});
+ this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), Blocks.COBBLESTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), Blocks.STONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), Blocks.SANDSTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Blocks.BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Blocks.SMOOTH_BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 6), new Object[] { "###", Character.valueOf('#'), Blocks.NETHER_BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 7), new Object[] { "###", Character.valueOf('#'), Blocks.QUARTZ_BLOCK});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 0)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 2)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 3)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 4)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 5)});
+ this.registerShapedRecipe(new ItemStack(Blocks.LADDER, 3), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Items.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Blocks.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Items.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Items.IRON_INGOT});
+ this.registerShapedRecipe(new ItemStack(Items.SIGN, 3), new Object[] { "###", "###", " X ", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Items.CAKE, 1), new Object[] { "AAA", "BEB", "CCC", Character.valueOf('A'), Items.MILK_BUCKET, Character.valueOf('B'), Items.SUGAR, Character.valueOf('C'), Items.WHEAT, Character.valueOf('E'), Items.EGG});
+ this.registerShapedRecipe(new ItemStack(Items.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Items.SUGAR_CANE});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 0), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 0)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 1), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 2), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 2)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 3), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 3)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 4), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG2, 1, 0)});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 5), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG2, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Items.STICK, 4), new Object[] { "#", "#", Character.valueOf('#'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Blocks.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), Items.COAL, Character.valueOf('#'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), new ItemStack(Items.COAL, 1, 1), Character.valueOf('#'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Items.BOWL, 4), new Object[] { "# #", " # ", Character.valueOf('#'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Items.GLASS_BOTTLE, 3), new Object[] { "# #", " # ", Character.valueOf('#'), Blocks.GLASS});
+ this.registerShapedRecipe(new ItemStack(Blocks.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('#'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Items.GOLD_INGOT, Character.valueOf('R'), Items.REDSTONE, Character.valueOf('#'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.ACTIVATOR_RAIL, 6), new Object[] { "XSX", "X#X", "XSX", Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('#'), Blocks.REDSTONE_TORCH_ON, Character.valueOf('S'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('R'), Items.REDSTONE, Character.valueOf('#'), Blocks.STONE_PLATE});
+ this.registerShapedRecipe(new ItemStack(Items.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Items.IRON_INGOT});
+ this.registerShapedRecipe(new ItemStack(Items.CAULDRON, 1), new Object[] { "# #", "# #", "###", Character.valueOf('#'), Items.IRON_INGOT});
+ this.registerShapedRecipe(new ItemStack(Items.BREWING_STAND, 1), new Object[] { " B ", "###", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('B'), Items.BLAZE_ROD});
+ this.registerShapedRecipe(new ItemStack(Blocks.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.PUMPKIN, Character.valueOf('B'), Blocks.TORCH});
+ this.registerShapedRecipe(new ItemStack(Items.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.CHEST, Character.valueOf('B'), Items.MINECART});
+ this.registerShapedRecipe(new ItemStack(Items.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.FURNACE, Character.valueOf('B'), Items.MINECART});
+ this.registerShapedRecipe(new ItemStack(Items.MINECART_TNT, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.TNT, Character.valueOf('B'), Items.MINECART});
+ this.registerShapedRecipe(new ItemStack(Items.MINECART_HOPPER, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.HOPPER, Character.valueOf('B'), Items.MINECART});
+ this.registerShapedRecipe(new ItemStack(Items.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Items.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Items.IRON_INGOT});
+ this.registerShapedRecipe(new ItemStack(Items.FLOWER_POT, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Items.CLAY_BRICK});
+ this.registerShapelessRecipe(new ItemStack(Items.FLINT_AND_STEEL, 1), new Object[] { new ItemStack(Items.IRON_INGOT, 1), new ItemStack(Items.FLINT, 1)});
+ this.registerShapedRecipe(new ItemStack(Items.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Items.WHEAT});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 0)});
+ this.registerShapedRecipe(new ItemStack(Blocks.BIRCH_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 2)});
+ this.registerShapedRecipe(new ItemStack(Blocks.SPRUCE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Blocks.JUNGLE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 3)});
+ this.registerShapedRecipe(new ItemStack(Blocks.ACACIA_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 4)});
+ this.registerShapedRecipe(new ItemStack(Blocks.DARK_OAK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 5)});
+ this.registerShapedRecipe(new ItemStack(Items.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Items.STRING});
+ this.registerShapedRecipe(new ItemStack(Items.CARROT_STICK, 1), new Object[] { "# ", " X", Character.valueOf('#'), Items.FISHING_ROD, Character.valueOf('X'), Items.CARROT}).c();
+ this.registerShapedRecipe(new ItemStack(Blocks.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.COBBLESTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.SMOOTH_BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.NETHER_BRICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.SANDSTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.SANDSTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.QUARTZ_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.QUARTZ_BLOCK});
+ this.registerShapedRecipe(new ItemStack(Items.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Blocks.WOOL});
+ this.registerShapedRecipe(new ItemStack(Items.ITEM_FRAME, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Items.LEATHER});
+ this.registerShapedRecipe(new ItemStack(Items.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.GOLD_INGOT, Character.valueOf('X'), Items.APPLE});
+ this.registerShapedRecipe(new ItemStack(Items.GOLDEN_APPLE, 1, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Blocks.GOLD_BLOCK, Character.valueOf('X'), Items.APPLE});
+ this.registerShapedRecipe(new ItemStack(Items.CARROT_GOLDEN, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.GOLD_NUGGET, Character.valueOf('X'), Items.CARROT});
+ this.registerShapedRecipe(new ItemStack(Items.SPECKLED_MELON, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.GOLD_NUGGET, Character.valueOf('X'), Items.MELON});
+ this.registerShapedRecipe(new ItemStack(Blocks.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('X'), Items.STICK});
+ this.registerShapedRecipe(new ItemStack(Blocks.TRIPWIRE_SOURCE, 2), new Object[] { "I", "S", "#", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('S'), Items.STICK, Character.valueOf('I'), Items.IRON_INGOT});
+ this.registerShapedRecipe(new ItemStack(Blocks.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Items.REDSTONE});
+ this.registerShapedRecipe(new ItemStack(Items.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Blocks.REDSTONE_TORCH_ON, Character.valueOf('X'), Items.REDSTONE, Character.valueOf('I'), Blocks.STONE});
+ this.registerShapedRecipe(new ItemStack(Items.REDSTONE_COMPARATOR, 1), new Object[] { " # ", "#X#", "III", Character.valueOf('#'), Blocks.REDSTONE_TORCH_ON, Character.valueOf('X'), Items.QUARTZ, Character.valueOf('I'), Blocks.STONE});
+ this.registerShapedRecipe(new ItemStack(Items.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Items.GOLD_INGOT, Character.valueOf('X'), Items.REDSTONE});
+ this.registerShapedRecipe(new ItemStack(Items.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Items.IRON_INGOT, Character.valueOf('X'), Items.REDSTONE});
+ this.registerShapedRecipe(new ItemStack(Items.MAP_EMPTY, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.PAPER, Character.valueOf('X'), Items.COMPASS});
+ this.registerShapedRecipe(new ItemStack(Blocks.STONE_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Blocks.STONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Blocks.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Blocks.STONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Blocks.IRON_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Items.IRON_INGOT});
+ this.registerShapedRecipe(new ItemStack(Blocks.GOLD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Items.GOLD_INGOT});
+ this.registerShapedRecipe(new ItemStack(Blocks.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('X'), Items.BOW, Character.valueOf('R'), Items.REDSTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.DROPPER, 1), new Object[] { "###", "# #", "#R#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('R'), Items.REDSTONE});
+ this.registerShapedRecipe(new ItemStack(Blocks.PISTON, 1), new Object[] { "TTT", "#X#", "#R#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('R'), Items.REDSTONE, Character.valueOf('T'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Blocks.PISTON_STICKY, 1), new Object[] { "S", "P", Character.valueOf('S'), Items.SLIME_BALL, Character.valueOf('P'), Blocks.PISTON});
+ this.registerShapedRecipe(new ItemStack(Items.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Blocks.WOOL, Character.valueOf('X'), Blocks.WOOD});
+ this.registerShapedRecipe(new ItemStack(Blocks.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Blocks.OBSIDIAN, Character.valueOf('B'), Items.BOOK, Character.valueOf('D'), Items.DIAMOND});
+ this.registerShapedRecipe(new ItemStack(Blocks.ANVIL, 1), new Object[] { "III", " i ", "iii", Character.valueOf('I'), Blocks.IRON_BLOCK, Character.valueOf('i'), Items.IRON_INGOT});
+ this.registerShapelessRecipe(new ItemStack(Items.EYE_OF_ENDER, 1), new Object[] { Items.ENDER_PEARL, Items.BLAZE_POWDER});
+ this.registerShapelessRecipe(new ItemStack(Items.FIREBALL, 3), new Object[] { Items.SULPHUR, Items.BLAZE_POWDER, Items.COAL});
+ this.registerShapelessRecipe(new ItemStack(Items.FIREBALL, 3), new Object[] { Items.SULPHUR, Items.BLAZE_POWDER, new ItemStack(Items.COAL, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOOD_STEP});
+ this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST});
// Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
this.sort(); // CraftBukkit - call new sort method
}
@@ -261,8 +268,8 @@ public class CraftingManager {
}
}
- if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].usesDurability()) {
- Item item = Item.byId[itemstack.id];
+ if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.count == 1 && itemstack1.count == 1 && itemstack.getItem().usesDurability()) {
+ Item item = itemstack.getItem();
int k = item.getMaxDurability() - itemstack.j();
int l = item.getMaxDurability() - itemstack1.j();
int i1 = k + l + item.getMaxDurability() * 5 / 100;
@@ -273,7 +280,7 @@ public class CraftingManager {
}
// CraftBukkit start - Construct a dummy repair recipe
- ItemStack result = new ItemStack(itemstack.id, 1, j1);
+ ItemStack result = new ItemStack(itemstack.getItem(), 1, j1);
List ingredients = new ArrayList();
ingredients.add(itemstack.cloneItemStack());
ingredients.add(itemstack1.cloneItemStack());
diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java
index 9f96e461f6..aa9e9f71b2 100644
--- a/src/main/java/net/minecraft/server/CrashReport.java
+++ b/src/main/java/net/minecraft/server/CrashReport.java
@@ -2,7 +2,6 @@ package net.minecraft.server;
import java.io.File;
import java.io.FileWriter;
-import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
@@ -12,48 +11,57 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
+import net.minecraft.util.org.apache.commons.io.IOUtils;
+import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
public class CrashReport {
- private final String a;
- private final Throwable b;
- private final CrashReportSystemDetails c = new CrashReportSystemDetails(this, "System Details");
- private final List d = new ArrayList();
- private File e;
- private boolean f = true;
- private StackTraceElement[] g = new StackTraceElement[0];
+ private static final Logger a = LogManager.getLogger();
+ private final String b;
+ private final Throwable c;
+ private final CrashReportSystemDetails d = new CrashReportSystemDetails(this, "System Details");
+ private final List e = new ArrayList();
+ private File f;
+ private boolean g = true;
+ private StackTraceElement[] h = new StackTraceElement[0];
public CrashReport(String s, Throwable throwable) {
- this.a = s;
- this.b = throwable;
+ this.b = s;
+ this.c = throwable;
this.h();
}
private void h() {
- this.c.a("Minecraft Version", (Callable) (new CrashReportVersion(this)));
- this.c.a("Operating System", (Callable) (new CrashReportOperatingSystem(this)));
- this.c.a("Java Version", (Callable) (new CrashReportJavaVersion(this)));
- this.c.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
- this.c.a("Memory", (Callable) (new CrashReportMemory(this)));
- this.c.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
- this.c.a("AABB Pool Size", (Callable) (new CrashReportAABBPoolSize(this)));
- this.c.a("Suspicious classes", (Callable) (new CrashReportSuspiciousClasses(this)));
- this.c.a("IntCache", (Callable) (new CrashReportIntCacheSize(this)));
- this.c.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
+ this.d.a("Minecraft Version", (Callable) (new CrashReportVersion(this)));
+ this.d.a("Operating System", (Callable) (new CrashReportOperatingSystem(this)));
+ this.d.a("Java Version", (Callable) (new CrashReportJavaVersion(this)));
+ this.d.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
+ this.d.a("Memory", (Callable) (new CrashReportMemory(this)));
+ this.d.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
+ this.d.a("AABB Pool Size", (Callable) (new CrashReportAABBPoolSize(this)));
+ this.d.a("IntCache", (Callable) (new CrashReportIntCacheSize(this)));
+ this.d.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
}
public String a() {
- return this.a;
- }
-
- public Throwable b() {
return this.b;
}
+ public Throwable b() {
+ return this.c;
+ }
+
public void a(StringBuilder stringbuilder) {
- if (this.g != null && this.g.length > 0) {
+ if ((this.h == null || this.h.length <= 0) && this.e.size() > 0) {
+ this.h = (StackTraceElement[]) ArrayUtils.subarray(((CrashReportSystemDetails) this.e.get(0)).a(), 0, 1);
+ }
+
+ if (this.h != null && this.h.length > 0) {
stringbuilder.append("-- Head --\n");
stringbuilder.append("Stacktrace:\n");
- StackTraceElement[] astacktraceelement = this.g;
+ StackTraceElement[] astacktraceelement = this.h;
int i = astacktraceelement.length;
for (int j = 0; j < i; ++j) {
@@ -66,7 +74,7 @@ public class CrashReport {
stringbuilder.append("\n");
}
- Iterator iterator = this.d.iterator();
+ Iterator iterator = this.e.iterator();
while (iterator.hasNext()) {
CrashReportSystemDetails crashreportsystemdetails = (CrashReportSystemDetails) iterator.next();
@@ -75,31 +83,36 @@ public class CrashReport {
stringbuilder.append("\n\n");
}
- this.c.a(stringbuilder);
+ this.d.a(stringbuilder);
}
public String d() {
StringWriter stringwriter = null;
PrintWriter printwriter = null;
- String s = this.b.toString();
+ Object object = this.c;
+
+ if (((Throwable) object).getMessage() == null) {
+ if (object instanceof NullPointerException) {
+ object = new NullPointerException(this.b);
+ } else if (object instanceof StackOverflowError) {
+ object = new StackOverflowError(this.b);
+ } else if (object instanceof OutOfMemoryError) {
+ object = new OutOfMemoryError(this.b);
+ }
+
+ ((Throwable) object).setStackTrace(this.c.getStackTrace());
+ }
+
+ String s = ((Throwable) object).toString();
try {
stringwriter = new StringWriter();
printwriter = new PrintWriter(stringwriter);
- this.b.printStackTrace(printwriter);
+ ((Throwable) object).printStackTrace(printwriter);
s = stringwriter.toString();
} finally {
- try {
- if (stringwriter != null) {
- stringwriter.close();
- }
-
- if (printwriter != null) {
- printwriter.close();
- }
- } catch (IOException ioexception) {
- ;
- }
+ IOUtils.closeQuietly(stringwriter);
+ IOUtils.closeQuietly(printwriter);
}
return s;
@@ -116,7 +129,7 @@ public class CrashReport {
stringbuilder.append((new SimpleDateFormat()).format(new Date()));
stringbuilder.append("\n");
stringbuilder.append("Description: ");
- stringbuilder.append(this.a);
+ stringbuilder.append(this.b);
stringbuilder.append("\n\n");
stringbuilder.append(this.d());
stringbuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
@@ -130,8 +143,8 @@ public class CrashReport {
return stringbuilder.toString();
}
- public boolean a(File file1, IConsoleLogManager iconsolelogmanager) {
- if (this.e != null) {
+ public boolean a(File file1) {
+ if (this.f != null) {
return false;
} else {
if (file1.getParentFile() != null) {
@@ -143,17 +156,17 @@ public class CrashReport {
filewriter.write(this.e());
filewriter.close();
- this.e = file1;
+ this.f = file1;
return true;
} catch (Throwable throwable) {
- iconsolelogmanager.severe("Could not save crash report to " + file1, throwable);
+ a.error("Could not save crash report to " + file1, throwable);
return false;
}
}
}
public CrashReportSystemDetails g() {
- return this.c;
+ return this.d;
}
public CrashReportSystemDetails a(String s) {
@@ -163,9 +176,9 @@ public class CrashReport {
public CrashReportSystemDetails a(String s, int i) {
CrashReportSystemDetails crashreportsystemdetails = new CrashReportSystemDetails(this, s);
- if (this.f) {
+ if (this.g) {
int j = crashreportsystemdetails.a(i);
- StackTraceElement[] astacktraceelement = this.b.getStackTrace();
+ StackTraceElement[] astacktraceelement = this.c.getStackTrace();
StackTraceElement stacktraceelement = null;
StackTraceElement stacktraceelement1 = null;
@@ -176,20 +189,20 @@ public class CrashReport {
}
}
- this.f = crashreportsystemdetails.a(stacktraceelement, stacktraceelement1);
- if (j > 0 && !this.d.isEmpty()) {
- CrashReportSystemDetails crashreportsystemdetails1 = (CrashReportSystemDetails) this.d.get(this.d.size() - 1);
+ this.g = crashreportsystemdetails.a(stacktraceelement, stacktraceelement1);
+ if (j > 0 && !this.e.isEmpty()) {
+ CrashReportSystemDetails crashreportsystemdetails1 = (CrashReportSystemDetails) this.e.get(this.e.size() - 1);
crashreportsystemdetails1.b(j);
} else if (astacktraceelement != null && astacktraceelement.length >= j) {
- this.g = new StackTraceElement[astacktraceelement.length - j];
- System.arraycopy(astacktraceelement, 0, this.g, 0, this.g.length);
+ this.h = new StackTraceElement[astacktraceelement.length - j];
+ System.arraycopy(astacktraceelement, 0, this.h, 0, this.h.length);
} else {
- this.f = false;
+ this.g = false;
}
}
- this.d.add(crashreportsystemdetails);
+ this.e.add(crashreportsystemdetails);
return crashreportsystemdetails;
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index f871b739ba..03585b7ac5 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -3,15 +3,19 @@ package net.minecraft.server;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
+import java.net.Proxy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import java.io.PrintStream;
-import java.util.logging.Level;
+import org.apache.logging.log4j.Level;
import org.bukkit.craftbukkit.LoggerOutputStream;
import org.bukkit.event.server.ServerCommandEvent;
@@ -19,43 +23,51 @@ import org.bukkit.event.server.ServerCommandEvent;
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
- private final List l = Collections.synchronizedList(new ArrayList());
- private final IConsoleLogManager m;
- private RemoteStatusListener n;
- private RemoteControlListener o;
+ private static final Logger h = LogManager.getLogger();
+ private final List i = Collections.synchronizedList(new ArrayList());
+ private RemoteStatusListener j;
+ private RemoteControlListener k;
public PropertyManager propertyManager; // CraftBukkit - private -> public
private boolean generateStructures;
- private EnumGamemode r;
- private ServerConnection s;
- private boolean t;
+ private EnumGamemode n;
+ private boolean o;
// CraftBukkit start - Signature changed
public DedicatedServer(joptsimple.OptionSet options) {
- super(options);
+ super(options, Proxy.NO_PROXY);
+ // super(file1, Proxy.NO_PROXY);
// CraftBukkit end
- this.m = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument
- new ThreadSleepForever(this);
+ new ThreadSleepForever(this, "Server Infinisleeper");
}
protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException
- ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
+ ThreadCommandReader threadcommandreader = new ThreadCommandReader(this, "Server console handler");
threadcommandreader.setDaemon(true);
threadcommandreader.start();
- // CraftBukkit start
- System.setOut(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.INFO), true));
- System.setErr(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.SEVERE), true));
- // CraftBukkit end
-
- this.getLogger().info("Starting minecraft server version 1.6.4");
- if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
- this.getLogger().warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
+ // CraftBukkit start - TODO: See if this needs fixing
+ final org.apache.logging.log4j.core.Logger realLogger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger());
+ for (org.apache.logging.log4j.core.Appender appender : realLogger.getAppenders().values()) {
+ if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) {
+ realLogger.removeAppender(appender);
+ }
}
- this.getLogger().info("Loading properties");
- this.propertyManager = new PropertyManager(this.options, this.getLogger()); // CraftBukkit - CLI argument support
- if (this.K()) {
+ new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start();
+
+ System.setOut(new PrintStream(new LoggerOutputStream(realLogger, Level.INFO), true));
+ System.setErr(new PrintStream(new LoggerOutputStream(realLogger, Level.WARN), true));
+ // CraftBukkit end
+
+ h.info("Starting minecraft server version 1.7.2");
+ if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
+ h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
+ }
+
+ h.info("Loading properties");
+ this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
+ if (this.L()) {
this.c("127.0.0.1");
} else {
this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
@@ -66,10 +78,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
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.setTexturePack(this.propertyManager.getString("resource-pack", ""));
this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
this.setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false));
- this.e(this.propertyManager.getInt("player-idle-timeout", 0));
+ this.d(this.propertyManager.getInt("player-idle-timeout", 0));
if (this.propertyManager.getInt("difficulty", 1) < 0) {
this.propertyManager.a("difficulty", Integer.valueOf(0));
} else if (this.propertyManager.getInt("difficulty", 1) > 3) {
@@ -79,45 +91,45 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
- this.r = WorldSettings.a(i);
- this.getLogger().info("Default game type: " + this.r);
+ this.n = WorldSettings.a(i);
+ h.info("Default game type: " + this.n);
InetAddress inetaddress = null;
if (this.getServerIp().length() > 0) {
inetaddress = InetAddress.getByName(this.getServerIp());
}
- if (this.I() < 0) {
+ if (this.J() < 0) {
this.setPort(this.propertyManager.getInt("server-port", 25565));
}
- this.getLogger().info("Generating keypair");
+ h.info("Generating keypair");
this.a(MinecraftEncryption.b());
- this.getLogger().info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.I());
+ h.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.J());
try {
- this.s = new DedicatedServerConnection(this, inetaddress, this.I());
+ this.ag().a(inetaddress, this.J());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
- this.getLogger().warning("**** FAILED TO BIND TO PORT!");
- this.getLogger().warning("The exception was: {0}", new Object[] { ioexception.toString()});
- this.getLogger().warning("Perhaps a server is already running on that port?");
+ h.warn("**** FAILED TO BIND TO PORT!");
+ h.warn("The exception was: {}", new Object[] { ioexception.toString()});
+ h.warn("Perhaps a server is already running on that port?");
return false;
}
this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
if (!this.getOnlineMode()) {
- this.getLogger().warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
- this.getLogger().warning("The server will make no attempt to authenticate usernames. Beware.");
- this.getLogger().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.");
- this.getLogger().warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
+ h.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
+ h.warn("The server will make no attempt to authenticate usernames. Beware.");
+ h.warn("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.");
+ h.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
long j = System.nanoTime();
- if (this.L() == null) {
+ if (this.M() == null) {
this.k(this.propertyManager.getString("level-name", "world"));
}
@@ -144,32 +156,36 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
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.ar();
+ this.getEnableCommandBlock();
+ this.l();
+ this.getSnooperEnabled();
+ this.c(this.propertyManager.getInt("max-build-height", 256));
+ this.c((this.getMaxBuildHeight() + 8) / 16 * 16);
+ this.c(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
- this.getLogger().info("Preparing level \"" + this.L() + "\"");
- this.a(this.L(), this.L(), k, worldtype, s2);
+ h.info("Preparing level \"" + this.M() + "\"");
+ this.a(this.M(), this.M(), k, worldtype, s2);
long i1 = System.nanoTime() - j;
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
- this.getLogger().info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
+ h.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
if (this.propertyManager.getBoolean("enable-query", false)) {
- this.getLogger().info("Starting GS4 status listener");
- this.n = new RemoteStatusListener(this);
- this.n.a();
+ h.info("Starting GS4 status listener");
+ this.j = new RemoteStatusListener(this);
+ this.j.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false)) {
- this.getLogger().info("Starting remote control listener");
- this.o = new RemoteControlListener(this);
- this.o.a();
+ h.info("Starting remote control listener");
+ this.k = new RemoteControlListener(this);
+ this.k.a();
this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
}
// CraftBukkit start
if (this.server.getBukkitSpawnRadius() > -1) {
- this.getLogger().info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
+ h.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
this.propertyManager.properties.remove("spawn-protection");
this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
this.server.removeBukkitSpawnRadius();
@@ -189,11 +205,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public EnumGamemode getGamemode() {
- return this.r;
+ return this.n;
}
- public int getDifficulty() {
- return Math.max(0, Math.min(3, this.propertyManager.getInt("difficulty", 1))); // CraftBukkit - clamp values
+ public EnumDifficulty getDifficulty() {
+ return EnumDifficulty.a(this.propertyManager.getInt("difficulty", 1));
}
public boolean isHardcore() {
@@ -202,12 +218,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
protected void a(CrashReport crashreport) {
while (this.isRunning()) {
- this.as();
+ this.aw();
try {
Thread.sleep(10L);
} catch (InterruptedException interruptedexception) {
- interruptedexception.printStackTrace();
+ ;
}
}
}
@@ -219,13 +235,13 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return crashreport;
}
- protected void r() {
+ protected void s() {
System.exit(0);
}
- public void t() { // CraftBukkit - protected -> public
- super.t();
- this.as();
+ public void u() { // CraftBukkit - protected -> public
+ super.u();
+ this.aw();
}
public boolean getAllowNether() {
@@ -237,8 +253,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
- mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.at().getHasWhitelist()));
- mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.at().getWhitelisted().size()));
+ mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.ax().getHasWhitelist()));
+ mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.ax().getWhitelisted().size()));
super.a(mojangstatisticsgenerator);
}
@@ -247,12 +263,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void issueCommand(String s, ICommandListener icommandlistener) {
- this.l.add(new ServerCommand(s, icommandlistener));
+ this.i.add(new ServerCommand(s, icommandlistener));
}
- public void as() {
- while (!this.l.isEmpty()) {
- ServerCommand servercommand = (ServerCommand) this.l.remove(0);
+ public void aw() {
+ while (!this.i.isEmpty()) {
+ ServerCommand servercommand = (ServerCommand) this.i.remove(0);
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
@@ -269,14 +285,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return true;
}
- public DedicatedPlayerList at() {
+ public DedicatedPlayerList ax() {
return (DedicatedPlayerList) super.getPlayerList();
}
- public ServerConnection ag() {
- return this.s;
- }
-
public int a(String s, int i) {
return this.propertyManager.getInt(s, i);
}
@@ -297,19 +309,19 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.propertyManager.savePropertiesFile();
}
- public String b_() {
+ public String b() {
File file1 = this.propertyManager.c();
return file1 != null ? file1.getAbsolutePath() : "No settings file";
}
- public void au() {
+ public void ay() {
ServerGUI.a(this);
- this.t = true;
+ this.o = true;
}
public boolean ai() {
- return this.t;
+ return this.o;
}
public String a(EnumGamemode enumgamemode, boolean flag) {
@@ -327,9 +339,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.worldProvider.dimension != 0) {
return false;
- } else if (this.at().getOPs().isEmpty()) {
+ } else if (this.ax().getOPs().isEmpty()) {
return false;
- } else if (this.at().isOp(entityhuman.getName())) {
+ } else if (this.ax().isOp(entityhuman.getName())) {
return false;
} else if (this.getSpawnProtection() <= 0) {
return false;
@@ -343,21 +355,25 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
}
- public IConsoleLogManager getLogger() {
- return this.m;
- }
-
- public int k() {
+ public int l() {
return this.propertyManager.getInt("op-permission-level", 4);
}
- public void e(int i) {
- super.e(i);
+ public void d(int i) {
+ super.d(i);
this.propertyManager.a("player-idle-timeout", Integer.valueOf(i));
this.a();
}
+ public boolean ar() {
+ return this.propertyManager.getBoolean("announce-player-achievements", true);
+ }
+
public PlayerList getPlayerList() {
- return this.at();
+ return this.ax();
+ }
+
+ static Logger az() {
+ return h;
}
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
deleted file mode 100644
index e62f738842..0000000000
--- a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package net.minecraft.server;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
-public class DedicatedServerConnectionThread extends Thread {
-
- private final List a = Collections.synchronizedList(new ArrayList());
- private final HashMap b = new HashMap();
- private int c;
- private final ServerSocket d;
- private ServerConnection e;
- private final InetAddress f;
- private final int g;
-
- long connectionThrottle; // CraftBukkit
-
- public DedicatedServerConnectionThread(ServerConnection serverconnection, InetAddress inetaddress, int i) throws IOException { // CraftBukkit - added throws
- super("Listen thread");
- this.e = serverconnection;
- this.g = i;
- this.d = new ServerSocket(i, 0, inetaddress);
- this.f = inetaddress == null ? this.d.getInetAddress() : inetaddress;
- this.d.setPerformancePreferences(0, 2, 1);
- }
-
- public void a() {
- List list = this.a;
-
- synchronized (this.a) {
- for (int i = 0; i < this.a.size(); ++i) {
- PendingConnection pendingconnection = (PendingConnection) this.a.get(i);
-
- try {
- pendingconnection.d();
- } catch (Exception exception) {
- pendingconnection.disconnect("Internal server error");
- this.e.d().getLogger().warning("Failed to handle packet for " + pendingconnection.getName() + ": " + exception, (Throwable) exception);
- }
-
- if (pendingconnection.b) {
- this.a.remove(i--);
- }
-
- pendingconnection.networkManager.a();
- }
- }
- }
-
- public void run() {
- while (this.e.a) {
- try {
- Socket socket = this.d.accept();
-
- // CraftBukkit start - Connection throttle
- InetAddress address = socket.getInetAddress();
- long currentTime = System.currentTimeMillis();
-
- if (((MinecraftServer) this.e.d()).server == null) {
- socket.close();
- continue;
- }
-
- connectionThrottle = ((MinecraftServer) this.e.d()).server.getConnectionThrottle();
-
- synchronized (this.b) {
- if (this.b.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ((Long) this.b.get(address)).longValue() < connectionThrottle) {
- this.b.put(address, Long.valueOf(currentTime));
- socket.close();
- continue;
- }
-
- this.b.put(address, Long.valueOf(currentTime));
- }
- // CraftBukkit end
-
- PendingConnection pendingconnection = new PendingConnection(this.e.d(), socket, "Connection #" + this.c++);
-
- this.a(pendingconnection);
- } catch (IOException ioexception) {
- this.e.d().getLogger().warning("DSCT: " + ioexception.getMessage()); // CraftBukkit
- }
- }
-
- this.e.d().getLogger().info("Closing listening thread");
- }
-
- private void a(PendingConnection pendingconnection) {
- if (pendingconnection == null) {
- throw new IllegalArgumentException("Got null pendingconnection!");
- } else {
- List list = this.a;
-
- synchronized (this.a) {
- this.a.add(pendingconnection);
- }
- }
- }
-
- public void a(InetAddress inetaddress) {
- if (inetaddress != null) {
- HashMap hashmap = this.b;
-
- synchronized (this.b) {
- this.b.remove(inetaddress);
- }
- }
- }
-
- public void b() {
- try {
- this.d.close();
- } catch (Throwable throwable) {
- ;
- }
- }
-}
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java b/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
index f324d4d996..45efc9cd99 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorArmor extends DispenseBehaviorItem {
DispenseBehaviorArmor() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java b/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
index 708cf60d8b..cc0b34b5c8 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorBoat extends DispenseBehaviorItem {
DispenseBehaviorBoat() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
@@ -20,13 +20,13 @@ final class DispenseBehaviorBoat extends DispenseBehaviorItem {
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
- Material material = world.getMaterial(i, j, k);
+ Material material = world.getType(i, j, k).getMaterial();
double d3;
if (Material.WATER.equals(material)) {
d3 = 1.0D;
} else {
- if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getMaterial(i, j - 1, k))) {
+ if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getType(i, j - 1, k).getMaterial())) {
return this.b.a(isourceblock, itemstack);
}
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
index 1a58814dbb..713bbe80a4 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
@@ -13,7 +13,7 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
if (itemstack.getData() == 15) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java b/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
index 1e6d8529ec..04693a5515 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
@@ -12,23 +12,23 @@ final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
DispenseBehaviorEmptyBucket() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
- Material material = world.getMaterial(i, j, k);
+ Material material = world.getType(i, j, k).getMaterial();
int l = world.getData(i, j, k);
Item item;
if (Material.WATER.equals(material) && l == 0) {
- item = Item.WATER_BUCKET;
+ item = Items.WATER_BUCKET;
} else {
if (!Material.LAVA.equals(material) || l != 0) {
return super.b(isourceblock, itemstack);
}
- item = Item.LAVA_BUCKET;
+ item = Items.LAVA_BUCKET;
}
// CraftBukkit start
@@ -57,7 +57,7 @@ final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
world.setAir(i, j, k);
if (--itemstack.count == 0) {
- itemstack.id = item.id;
+ itemstack.setItem(item);
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
this.b.a(isourceblock, new ItemStack(item));
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
index b8a2a78f1b..a1a714de29 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
@@ -16,14 +16,14 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
int i = isourceblock.getBlockX();
int j = isourceblock.getBlockY();
int k = isourceblock.getBlockZ();
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
// CraftBukkit start
World world = isourceblock.k();
int x = i + enumfacing.c();
int y = j + enumfacing.d();
int z = k + enumfacing.e();
- if (world.isEmpty(x, y, z) || !world.getMaterial(x, y, z).isBuildable()) {
+ if (world.isEmpty(x, y, z) || !world.getType(x, y, z).getMaterial().isBuildable()) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
@@ -52,9 +52,9 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
if (itembucket.a(isourceblock.k(), i + enumfacing.c(), j + enumfacing.d(), k + enumfacing.e())) {
// CraftBukkit start - Handle stacked buckets
- Item item = Item.BUCKET;
+ Item item = Items.BUCKET;
if (--itemstack.count == 0) {
- itemstack.id = item.id;
+ itemstack.setItem(Items.BUCKET);
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
this.b.a(isourceblock, new ItemStack(item));
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
index 6d428c8f68..56ff612256 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorFireball extends DispenseBehaviorItem {
DispenseBehaviorFireball() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
double d0 = iposition.getX() + (double) ((float) enumfacing.c() * 0.3F);
double d1 = iposition.getY() + (double) ((float) enumfacing.c() * 0.3F);
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
index 6abc928aae..bb66cb02e1 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
@@ -10,7 +10,7 @@ final class DispenseBehaviorFireworks extends DispenseBehaviorItem {
DispenseBehaviorFireworks() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java b/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java
index d7f44fe12d..28f53bfe1a 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
DispenseBehaviorFlintAndSteel() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
@@ -45,14 +45,14 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
if (world.isEmpty(i, j, k)) {
// CraftBukkit start - Ignition by dispensing flint and steel
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()).isCancelled()) {
- world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ world.setTypeUpdate(i, j, k, Blocks.FIRE);
if (itemstack.isDamaged(1, world.random)) {
itemstack.count = 0;
}
}
// CraftBukkit end
- } else if (world.getTypeId(i, j, k) == Block.TNT.id) {
- Block.TNT.postBreak(world, i, j, k, 1);
+ } else if (world.getType(i, j, k) == Blocks.TNT) {
+ Blocks.TNT.postBreak(world, i, j, k, 1);
world.setAir(i, j, k);
} else {
this.b = false;
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
index 290b58378d..14ca919270 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
@@ -13,12 +13,12 @@ public class DispenseBehaviorItem implements IDispenseBehavior {
ItemStack itemstack1 = this.b(isourceblock, itemstack);
this.a(isourceblock);
- this.a(isourceblock, BlockDispenser.l_(isourceblock.h()));
+ this.a(isourceblock, BlockDispenser.b(isourceblock.h()));
return itemstack1;
}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
ItemStack itemstack1 = itemstack.a(1);
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java b/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
index 0682194b52..0358550a12 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
DispenseBehaviorMinecart() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
@@ -20,13 +20,13 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
- int l = world.getTypeId(i, j, k);
+ Block block = world.getType(i, j, k);
double d3;
- if (BlockMinecartTrackAbstract.e_(l)) {
+ if (BlockMinecartTrackAbstract.a(block)) {
d3 = 0.0D;
} else {
- if (l != 0 || !BlockMinecartTrackAbstract.e_(world.getTypeId(i, j - 1, k))) {
+ if (block.getMaterial() != Material.AIR || !BlockMinecartTrackAbstract.a(world.getType(i, j - 1, k))) {
return this.b.a(isourceblock, itemstack);
}
@@ -35,10 +35,10 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
// CraftBukkit start
ItemStack itemstack1 = itemstack.a(1);
- org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
+ org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
- BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
+ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
if (!BlockDispenser.eventFired) {
world.getServer().getPluginManager().callEvent(event);
}
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java b/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
index b3d01287c1..a854f7ae63 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
@@ -10,7 +10,7 @@ final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
DispenseBehaviorMonsterEgg() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java b/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
index 219480812c..0a51bafdbf 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
@@ -12,7 +12,7 @@ public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.k();
IPosition iposition = BlockDispenser.a(isourceblock);
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
IProjectile iprojectile = this.a(world, iposition);
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java b/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
index affe3ec73a..0d7f828b67 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
@@ -10,7 +10,7 @@ final class DispenseBehaviorTNT extends DispenseBehaviorItem {
DispenseBehaviorTNT() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
diff --git a/src/main/java/net/minecraft/server/Enchantment.java b/src/main/java/net/minecraft/server/Enchantment.java
index 54071dba65..3dffd20814 100644
--- a/src/main/java/net/minecraft/server/Enchantment.java
+++ b/src/main/java/net/minecraft/server/Enchantment.java
@@ -29,6 +29,8 @@ public abstract class Enchantment {
public static final Enchantment ARROW_KNOCKBACK = new EnchantmentArrowKnockback(49, 2);
public static final Enchantment ARROW_FIRE = new EnchantmentFlameArrows(50, 2);
public static final Enchantment ARROW_INFINITE = new EnchantmentInfiniteArrows(51, 1);
+ public static final Enchantment LUCK = new EnchantmentLootBonus(61, 2, EnchantmentSlotType.FISHING_ROD);
+ public static final Enchantment LURE = new EnchantmentLure(62, 2, EnchantmentSlotType.FISHING_ROD);
public final int id;
private final int weight;
public EnchantmentSlotType slot;
@@ -98,6 +100,10 @@ public abstract class Enchantment {
return this.slot.canEnchant(itemstack.getItem());
}
+ public void a(EntityLiving entityliving, Entity entity, int i) {}
+
+ public void b(EntityLiving entityliving, Entity entity, int i) {}
+
static {
ArrayList arraylist = new ArrayList();
Enchantment[] aenchantment = byId;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2158088850..fec07f8637 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -39,12 +39,12 @@ public abstract class Entity {
// CraftBukkit end
private static int entityCount;
- public int id;
- public double l;
- public boolean m;
+ private int id;
+ public double k;
+ public boolean l;
public Entity passenger;
public Entity vehicle;
- public boolean p;
+ public boolean o;
public World world;
public double lastX;
public double lastY;
@@ -62,27 +62,27 @@ public abstract class Entity {
public final AxisAlignedBB boundingBox;
public boolean onGround;
public boolean positionChanged;
+ public boolean G;
public boolean H;
- public boolean I;
public boolean velocityChanged;
- protected boolean K;
- public boolean L;
+ protected boolean J;
+ public boolean K;
public boolean dead;
public float height;
public float width;
public float length;
+ public float P;
public float Q;
public float R;
- public float S;
public float fallDistance;
- private int c;
+ private int d;
+ public double T;
public double U;
public double V;
- public double W;
+ public float W;
public float X;
- public float Y;
- public boolean Z;
- public float aa;
+ public boolean Y;
+ public float Z;
protected Random random;
public int ticksLived;
public int maxFireTicks;
@@ -92,36 +92,43 @@ public abstract class Entity {
private boolean justCreated;
protected boolean fireProof;
protected DataWatcher datawatcher;
- private double f;
private double g;
- public boolean ai;
+ private double h;
+ public boolean ah;
+ public int ai;
public int aj;
public int ak;
- public int al;
+ public boolean al;
public boolean am;
- public boolean an;
public int portalCooldown;
- protected boolean ap;
- protected int aq;
+ protected boolean ao;
+ protected int ap;
public int dimension;
- protected int as;
+ protected int ar;
private boolean invulnerable;
- public UUID uniqueID; // CraftBukkit - private -> public
+ public UUID uniqueID; // CraftBukkit - protected -> public
public EnumEntitySize at;
public boolean valid; // CraftBukkit
+ public int getId() {
+ return this.id;
+ }
+
+ public void d(int i) {
+ this.id = i;
+ }
+
public Entity(World world) {
this.id = entityCount++;
- this.l = 1.0D;
+ this.k = 1.0D;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
- this.L = true;
+ this.K = true;
this.width = 0.6F;
this.length = 1.8F;
- this.c = 1;
+ this.d = 1;
this.random = new Random();
this.maxFireTicks = 1;
this.justCreated = true;
- this.datawatcher = new DataWatcher();
this.uniqueID = UUID.randomUUID();
this.at = EnumEntitySize.SIZE_2;
this.world = world;
@@ -130,12 +137,13 @@ public abstract class Entity {
this.dimension = world.worldProvider.dimension;
}
+ this.datawatcher = new DataWatcher(this);
this.datawatcher.a(0, Byte.valueOf((byte) 0));
this.datawatcher.a(1, Short.valueOf((short) 300));
- this.a();
+ this.c();
}
- protected abstract void a();
+ protected abstract void c();
public DataWatcher getDataWatcher() {
return this.datawatcher;
@@ -223,20 +231,20 @@ public abstract class Entity {
float f = this.width / 2.0F;
float f1 = this.length;
- this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.X, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.X + (double) f1, d2 + (double) f);
+ this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.W, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.W + (double) f1, d2 + (double) f);
}
- public void l_() {
- this.y();
+ public void h() {
+ this.C();
}
- public void y() {
+ public void C() {
this.world.methodProfiler.a("entityBaseTick");
if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null;
}
- this.Q = this.R;
+ this.P = this.Q;
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -248,12 +256,12 @@ public abstract class Entity {
this.world.methodProfiler.a("portal");
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
- i = this.z();
- if (this.ap) {
+ i = this.D();
+ if (this.ao) {
if (true || minecraftserver.getAllowNether()) { // CraftBukkit
- if (this.vehicle == null && this.aq++ >= i) {
- this.aq = i;
- this.portalCooldown = this.ac();
+ if (this.vehicle == null && this.ap++ >= i) {
+ this.ap = i;
+ this.portalCooldown = this.ai();
byte b0;
if (this.world.worldProvider.dimension == -1) {
@@ -265,15 +273,15 @@ public abstract class Entity {
this.b(b0);
}
- this.ap = false;
+ this.ao = false;
}
} else {
- if (this.aq > 0) {
- this.aq -= 4;
+ if (this.ap > 0) {
+ this.ap -= 4;
}
- if (this.aq < 0) {
- this.aq = 0;
+ if (this.ap < 0) {
+ this.ap = 0;
}
}
@@ -284,19 +292,19 @@ public abstract class Entity {
this.world.methodProfiler.b();
}
- if (this.isSprinting() && !this.H()) {
+ if (this.isSprinting() && !this.M()) {
int j = MathHelper.floor(this.locX);
i = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
int k = MathHelper.floor(this.locZ);
- int l = this.world.getTypeId(j, i, k);
+ Block block = this.world.getType(j, i, k);
- if (l > 0) {
- this.world.addParticle("tilecrack_" + l + "_" + this.world.getData(j, i, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
+ if (block.getMaterial() != Material.AIR) {
+ this.world.addParticle("blockcrack_" + Block.b(block) + "_" + this.world.getData(j, i, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
}
}
- this.I();
+ this.N();
if (this.world.isStatic) {
this.fireTicks = 0;
} else if (this.fireTicks > 0) {
@@ -314,13 +322,13 @@ public abstract class Entity {
}
}
- if (this.J()) {
- this.A();
+ if (this.P()) {
+ this.E();
this.fallDistance *= 0.5F;
}
if (this.locY < -64.0D) {
- this.C();
+ this.G();
}
if (!this.world.isStatic) {
@@ -331,11 +339,11 @@ public abstract class Entity {
this.world.methodProfiler.b();
}
- public int z() {
+ public int D() {
return 0;
}
- protected void A() {
+ protected void E() {
if (!this.fireProof) {
// CraftBukkit start - Fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) {
@@ -387,7 +395,7 @@ public abstract class Entity {
this.fireTicks = 0;
}
- protected void C() {
+ protected void G() {
this.die();
}
@@ -400,25 +408,35 @@ public abstract class Entity {
public void move(double d0, double d1, double d2) {
// CraftBukkit start - Don't do anything if we aren't moving
+ // We need to do this regardless of whether or not we are moving thanks to portals
+ try {
+ this.I();
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision");
+
+ this.a(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
+ }
+ // Check if we're moving
if (d0 == 0 && d1 == 0 && d2 == 0 && this.vehicle == null && this.passenger == null) {
return;
}
// CraftBukkit end
-
- if (this.Z) {
+ if (this.Y) {
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.X;
+ this.locY = this.boundingBox.b + (double) this.height - (double) this.W;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else {
this.world.methodProfiler.a("move");
- this.X *= 0.4F;
+ this.W *= 0.4F;
double d3 = this.locX;
double d4 = this.locY;
double d5 = this.locZ;
- if (this.K) {
- this.K = false;
+ if (this.J) {
+ this.J = false;
d0 *= 0.25D;
d1 *= 0.05000000074505806D;
d2 *= 0.25D;
@@ -485,7 +503,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
- if (!this.L && d7 != d1) {
+ if (!this.K && d7 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -500,7 +518,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
- if (!this.L && d6 != d0) {
+ if (!this.K && d6 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -511,7 +529,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
- if (!this.L && d8 != d2) {
+ if (!this.K && d8 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -522,12 +540,12 @@ public abstract class Entity {
double d12;
int k;
- if (this.Y > 0.0F && flag1 && (flag || this.X < 0.05F) && (d6 != d0 || d8 != d2)) {
+ if (this.X > 0.0F && flag1 && (flag || this.W < 0.05F) && (d6 != d0 || d8 != d2)) {
d10 = d0;
d11 = d1;
d12 = d2;
d0 = d6;
- d1 = (double) this.Y;
+ d1 = (double) this.X;
d2 = d8;
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
@@ -539,7 +557,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
- if (!this.L && d7 != d1) {
+ if (!this.K && d7 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -550,7 +568,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
- if (!this.L && d6 != d0) {
+ if (!this.K && d6 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -561,18 +579,18 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
- if (!this.L && d8 != d2) {
+ if (!this.K && d8 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
- if (!this.L && d7 != d1) {
+ if (!this.K && d7 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
} else {
- d1 = (double) (-this.Y);
+ d1 = (double) (-this.X);
for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@@ -592,12 +610,12 @@ public abstract class Entity {
this.world.methodProfiler.b();
this.world.methodProfiler.a("rest");
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
- this.locY = this.boundingBox.b + (double) this.height - (double) this.X;
+ this.locY = this.boundingBox.b + (double) this.height - (double) this.W;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.positionChanged = d6 != d0 || d8 != d2;
- this.H = d7 != d1;
+ this.G = d7 != d1;
this.onGround = d7 != d1 && d7 < 0.0D;
- this.I = this.positionChanged || this.H;
+ this.H = this.positionChanged || this.G;
this.a(d1, this.onGround);
if (d6 != d0) {
this.motX = 0.0D;
@@ -635,55 +653,55 @@ public abstract class Entity {
}
// CraftBukkit end
- if (this.e_() && !flag && this.vehicle == null) {
+ if (this.g_() && !flag && this.vehicle == null) {
int l = MathHelper.floor(this.locX);
k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
int i1 = MathHelper.floor(this.locZ);
- int j1 = this.world.getTypeId(l, k, i1);
+ Block block = this.world.getType(l, k, i1);
+ int j1 = this.world.getType(l, k - 1, i1).b();
- if (j1 == 0) {
- int k1 = this.world.e(l, k - 1, i1);
-
- if (k1 == 11 || k1 == 32 || k1 == 21) {
- j1 = this.world.getTypeId(l, k - 1, i1);
- }
+ if (j1 == 11 || j1 == 32 || j1 == 21) {
+ block = this.world.getType(l, k - 1, i1);
}
- if (j1 != Block.LADDER.id) {
+ if (block != Blocks.LADDER) {
d11 = 0.0D;
}
- this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D);
- this.S = (float) ((double) this.S + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D);
- if (this.S > (float) this.c && j1 > 0) {
- this.c = (int) this.S + 1;
- if (this.H()) {
+ this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D);
+ this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D);
+ if (this.R > (float) this.d && block.getMaterial() != Material.AIR) {
+ this.d = (int) this.R + 1;
+ if (this.M()) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.35F;
if (f > 1.0F) {
f = 1.0F;
}
- this.makeSound("liquid.swim", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ this.makeSound(this.H(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
}
- this.a(l, k, i1, j1);
- Block.byId[j1].b(this.world, l, k, i1, this);
+ this.a(l, k, i1, block);
+ block.b(this.world, l, k, i1, this);
}
}
+ // CraftBukkit start - Move to the top of the method
+ /*
try {
- this.D();
+ this.I();
} catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Checking entity tile collision");
+ CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision");
this.a(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
-
- boolean flag2 = this.G();
+ */
+ // CraftBukkit end
+ boolean flag2 = this.L();
if (this.world.e(this.boundingBox.shrink(0.001D, 0.001D, 0.001D))) {
this.burn(1);
@@ -715,7 +733,11 @@ public abstract class Entity {
}
}
- protected void D() {
+ protected String H() {
+ return "game.neutral.swim";
+ }
+
+ protected void I() {
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);
@@ -723,22 +745,20 @@ public abstract class Entity {
int i1 = MathHelper.floor(this.boundingBox.e - 0.001D);
int j1 = MathHelper.floor(this.boundingBox.f - 0.001D);
- if (this.world.e(i, j, k, l, i1, j1)) {
+ if (this.world.b(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);
+ Block block = this.world.getType(k1, l1, i2);
- if (j2 > 0) {
- try {
- Block.byId[j2].a(this.world, k1, l1, i2, this);
- } catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Colliding entity with tile");
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Tile being collided with");
+ try {
+ block.a(this.world, k1, l1, i2, this);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Colliding entity with block");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being collided with");
- CrashReportSystemDetails.a(crashreportsystemdetails, k1, l1, i2, j2, this.world.getData(k1, l1, i2));
- throw new ReportedException(crashreport);
- }
+ CrashReportSystemDetails.a(crashreportsystemdetails, k1, l1, i2, block, this.world.getData(k1, l1, i2));
+ throw new ReportedException(crashreport);
}
}
}
@@ -746,13 +766,13 @@ public abstract class Entity {
}
}
- protected void a(int i, int j, int k, int l) {
- StepSound stepsound = Block.byId[l].stepSound;
+ protected void a(int i, int j, int k, Block block) {
+ StepSound stepsound = block.stepSound;
- if (this.world.getTypeId(i, j + 1, k) == Block.SNOW.id) {
- stepsound = Block.SNOW.stepSound;
+ if (this.world.getType(i, j + 1, k) == Blocks.SNOW) {
+ stepsound = Blocks.SNOW.stepSound;
this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
- } else if (!Block.byId[l].material.isLiquid()) {
+ } else if (!block.getMaterial().isLiquid()) {
this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
}
}
@@ -761,7 +781,7 @@ public abstract class Entity {
this.world.makeSound(this, s, f, f1);
}
- protected boolean e_() {
+ protected boolean g_() {
return true;
}
@@ -776,7 +796,7 @@ public abstract class Entity {
}
}
- public AxisAlignedBB E() {
+ public AxisAlignedBB J() {
return null;
}
@@ -796,15 +816,15 @@ public abstract class Entity {
}
}
- public boolean G() {
+ public boolean L() {
return this.inWater || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY + (double) this.length), MathHelper.floor(this.locZ));
}
- public boolean H() {
+ public boolean M() {
return this.inWater;
}
- public boolean I() {
+ public boolean N() {
if (this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D, 0.001D, 0.001D), Material.WATER, this)) {
if (!this.inWater && !this.justCreated) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
@@ -813,7 +833,7 @@ public abstract class Entity {
f = 1.0F;
}
- this.makeSound("liquid.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ this.makeSound(this.O(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
float f1 = (float) MathHelper.floor(this.boundingBox.b);
int i;
@@ -843,15 +863,19 @@ public abstract class Entity {
return this.inWater;
}
+ protected String O() {
+ return "game.neutral.swim.splash";
+ }
+
public boolean a(Material material) {
double d0 = this.locY + (double) this.getHeadHeight();
int i = MathHelper.floor(this.locX);
int j = MathHelper.d((float) MathHelper.floor(d0));
int k = MathHelper.floor(this.locZ);
- int l = this.world.getTypeId(i, j, k);
+ Block block = this.world.getType(i, j, k);
- if (l != 0 && Block.byId[l].material == material) {
- float f = BlockFluids.d(this.world.getData(i, j, k)) - 0.11111111F;
+ if (block.getMaterial() == material) {
+ float f = BlockFluids.b(this.world.getData(i, j, k)) - 0.11111111F;
float f1 = (float) (j + 1) - f;
return d0 < (double) f1;
@@ -864,7 +888,7 @@ public abstract class Entity {
return 0.0F;
}
- public boolean J() {
+ public boolean P() {
return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
}
@@ -896,7 +920,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.q(i, k, j);
+ return this.world.n(i, k, j);
} else {
return 0.0F;
}
@@ -920,7 +944,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1;
- this.X = 0.0F;
+ this.W = 0.0F;
double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) {
@@ -936,9 +960,9 @@ public abstract class Entity {
}
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
- this.U = this.lastX = this.locX = d0;
- this.V = this.lastY = this.locY = d1 + (double) this.height;
- this.W = this.lastZ = this.locZ = d2;
+ this.T = this.lastX = this.locX = d0;
+ this.U = this.lastY = this.locY = d1 + (double) this.height;
+ this.V = this.lastZ = this.locZ = d2;
this.yaw = f;
this.pitch = f1;
this.setPosition(this.locX, this.locY, this.locZ);
@@ -998,8 +1022,8 @@ public abstract class Entity {
d1 *= d3;
d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D;
- d0 *= (double) (1.0F - this.aa);
- d1 *= (double) (1.0F - this.aa);
+ d0 *= (double) (1.0F - this.Z);
+ d1 *= (double) (1.0F - this.Z);
this.g(-d0, 0.0D, -d1);
entity.g(d0, 0.0D, d1);
}
@@ -1010,10 +1034,10 @@ public abstract class Entity {
this.motX += d0;
this.motY += d1;
this.motZ += d2;
- this.an = true;
+ this.am = true;
}
- protected void K() {
+ protected void Q() {
this.velocityChanged = true;
}
@@ -1021,23 +1045,23 @@ public abstract class Entity {
if (this.isInvulnerable()) {
return false;
} else {
- this.K();
+ this.Q();
return false;
}
}
- public boolean L() {
+ public boolean R() {
return false;
}
- public boolean M() {
+ public boolean S() {
return false;
}
public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) {
- String s = this.Q();
+ String s = this.W();
if (!this.dead && s != null) {
nbttagcompound.setString("id", s);
@@ -1049,7 +1073,7 @@ public abstract class Entity {
}
public boolean d(NBTTagCompound nbttagcompound) {
- String s = this.Q();
+ String s = this.W();
if (!this.dead && s != null && this.passenger == null) {
nbttagcompound.setString("id", s);
@@ -1062,7 +1086,7 @@ public abstract class Entity {
public void e(NBTTagCompound nbttagcompound) {
try {
- nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.X, this.locZ}));
+ nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.W, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero
@@ -1084,8 +1108,8 @@ public abstract class Entity {
nbttagcompound.setInt("Dimension", this.dimension);
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
- nbttagcompound.setLong("UUIDMost", this.uniqueID.getMostSignificantBits());
- nbttagcompound.setLong("UUIDLeast", this.uniqueID.getLeastSignificantBits());
+ nbttagcompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
+ nbttagcompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
// CraftBukkit start
nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
@@ -1093,7 +1117,7 @@ public abstract class Entity {
// CraftBukkit end
this.b(nbttagcompound);
if (this.vehicle != null) {
- NBTTagCompound nbttagcompound1 = new NBTTagCompound("Riding");
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
if (this.vehicle.c(nbttagcompound1)) {
nbttagcompound.set("Riding", nbttagcompound1);
@@ -1110,13 +1134,13 @@ public abstract class Entity {
public void f(NBTTagCompound nbttagcompound) {
try {
- NBTTagList nbttaglist = nbttagcompound.getList("Pos");
- NBTTagList nbttaglist1 = nbttagcompound.getList("Motion");
- NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation");
+ NBTTagList nbttaglist = nbttagcompound.getList("Pos", 6);
+ NBTTagList nbttaglist1 = nbttagcompound.getList("Motion", 6);
+ NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation", 5);
- this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data;
- this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data;
- this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
+ this.motX = nbttaglist1.d(0);
+ this.motY = nbttaglist1.d(1);
+ this.motZ = nbttaglist1.d(2);
/* CraftBukkit start - Moved section down
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
@@ -1131,11 +1155,11 @@ public abstract class Entity {
}
// CraftBukkit end */
- this.lastX = this.U = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
- this.lastY = this.V = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
- this.lastZ = this.W = 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.lastX = this.T = this.locX = nbttaglist.d(0);
+ this.lastY = this.U = this.locY = nbttaglist.d(1);
+ this.lastZ = this.V = this.locZ = nbttaglist.d(2);
+ this.lastYaw = this.yaw = nbttaglist2.e(0);
+ this.lastPitch = this.pitch = nbttaglist2.e(1);
this.fallDistance = nbttagcompound.getFloat("FallDistance");
this.fireTicks = nbttagcompound.getShort("Fire");
this.setAirTicks(nbttagcompound.getShort("Air"));
@@ -1143,14 +1167,14 @@ public abstract class Entity {
this.dimension = nbttagcompound.getInt("Dimension");
this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
this.portalCooldown = nbttagcompound.getInt("PortalCooldown");
- if (nbttagcompound.hasKey("UUIDMost") && nbttagcompound.hasKey("UUIDLeast")) {
+ if (nbttagcompound.hasKeyOfType("UUIDMost", 4) && nbttagcompound.hasKeyOfType("UUIDLeast", 4)) {
this.uniqueID = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast"));
}
this.setPosition(this.locX, this.locY, this.locZ);
this.b(this.yaw, this.pitch);
this.a(nbttagcompound);
- if (this.P()) {
+ if (this.V()) {
this.setPosition(this.locX, this.locY, this.locZ);
}
@@ -1214,11 +1238,11 @@ public abstract class Entity {
}
}
- protected boolean P() {
+ protected boolean V() {
return true;
}
- protected final String Q() {
+ protected final String W() {
return EntityTypes.b(this);
}
@@ -1226,7 +1250,7 @@ public abstract class Entity {
protected abstract void b(NBTTagCompound nbttagcompound);
- public void R() {}
+ public void X() {}
protected NBTTagList a(double... adouble) {
NBTTagList nbttaglist = new NBTTagList();
@@ -1236,7 +1260,7 @@ public abstract class Entity {
for (int j = 0; j < i; ++j) {
double d0 = adouble1[j];
- nbttaglist.add(new NBTTagDouble((String) null, d0));
+ nbttaglist.add(new NBTTagDouble(d0));
}
return nbttaglist;
@@ -1250,29 +1274,29 @@ public abstract class Entity {
for (int j = 0; j < i; ++j) {
float f = afloat1[j];
- nbttaglist.add(new NBTTagFloat((String) null, f));
+ nbttaglist.add(new NBTTagFloat(f));
}
return nbttaglist;
}
- public EntityItem b(int i, int j) {
- return this.a(i, j, 0.0F);
+ public EntityItem a(Item item, int i) {
+ return this.a(item, i, 0.0F);
}
- public EntityItem a(int i, int j, float f) {
- return this.a(new ItemStack(i, j, 0), f);
+ public EntityItem a(Item item, int i, float f) {
+ return this.a(new ItemStack(item, i, 0), f);
}
public EntityItem a(ItemStack itemstack, float f) {
- if (itemstack.count == 0) {
- return null;
- } else {
+ if (itemstack.count != 0 && itemstack.getItem() != null) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
entityitem.pickupDelay = 10;
this.world.addEntity(entityitem);
return entityitem;
+ } else {
+ return null;
}
}
@@ -1289,7 +1313,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.u(j, k, l)) {
+ if (this.world.getType(j, k, l).r()) {
return true;
}
}
@@ -1305,36 +1329,36 @@ public abstract class Entity {
return null;
}
- public void V() {
+ public void ab() {
if (this.vehicle.dead) {
this.vehicle = null;
} else {
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
- this.l_();
+ this.h();
if (this.vehicle != null) {
- this.vehicle.W();
- this.g += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
+ this.vehicle.ac();
+ this.h += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
- for (this.f += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.g >= 180.0D; this.g -= 360.0D) {
+ for (this.g += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.h >= 180.0D; this.h -= 360.0D) {
;
}
+ while (this.h < -180.0D) {
+ this.h += 360.0D;
+ }
+
+ while (this.g >= 180.0D) {
+ this.g -= 360.0D;
+ }
+
while (this.g < -180.0D) {
this.g += 360.0D;
}
- while (this.f >= 180.0D) {
- this.f -= 360.0D;
- }
-
- while (this.f < -180.0D) {
- this.f += 360.0D;
- }
-
- double d0 = this.g * 0.5D;
- double d1 = this.f * 0.5D;
+ double d0 = this.h * 0.5D;
+ double d1 = this.g * 0.5D;
float f = 10.0F;
if (d0 > (double) f) {
@@ -1353,23 +1377,23 @@ public abstract class Entity {
d1 = (double) (-f);
}
- this.g -= d0;
- this.f -= d1;
+ this.h -= d0;
+ this.g -= d1;
}
}
}
- public void W() {
+ public void ac() {
if (this.passenger != null) {
- this.passenger.setPosition(this.locX, this.locY + this.Y() + this.passenger.X(), this.locZ);
+ this.passenger.setPosition(this.locX, this.locY + this.ae() + this.passenger.ad(), this.locZ);
}
}
- public double X() {
+ public double ad() {
return (double) this.height;
}
- public double Y() {
+ public double ae() {
return (double) this.length * 0.75D;
}
@@ -1396,8 +1420,8 @@ public abstract class Entity {
PluginManager pluginManager = Bukkit.getPluginManager();
this.getBukkitEntity(); // make sure bukkitEntity is initialised
// CraftBukkit end
- this.f = 0.0D;
this.g = 0.0D;
+ this.h = 0.0D;
if (entity == null) {
if (this.vehicle != null) {
// CraftBukkit start
@@ -1455,31 +1479,31 @@ public abstract class Entity {
}
}
- public float Z() {
+ public float af() {
return 0.1F;
}
- public Vec3D aa() {
+ public Vec3D ag() {
return null;
}
- public void ab() {
+ public void ah() {
if (this.portalCooldown > 0) {
- this.portalCooldown = this.ac();
+ this.portalCooldown = this.ai();
} else {
double d0 = this.lastX - this.locX;
double d1 = this.lastZ - this.locZ;
- if (!this.world.isStatic && !this.ap) {
- this.as = Direction.a(d0, d1);
+ if (!this.world.isStatic && !this.ao) {
+ this.ar = Direction.a(d0, d1);
}
- this.ap = true;
+ this.ao = true;
}
}
- public int ac() {
- return 900;
+ public int ai() {
+ return 300;
}
public ItemStack[] getEquipment() {
@@ -1489,15 +1513,17 @@ public abstract class Entity {
public void setEquipment(int i, ItemStack itemstack) {}
public boolean isBurning() {
- return !this.fireProof && (this.fireTicks > 0 || this.f(0));
+ boolean flag = this.world != null && this.world.isStatic;
+
+ return !this.fireProof && (this.fireTicks > 0 || flag && this.g(0));
}
- public boolean ag() {
+ public boolean am() {
return this.vehicle != null;
}
public boolean isSneaking() {
- return this.f(1);
+ return this.g(1);
}
public void setSneaking(boolean flag) {
@@ -1505,7 +1531,7 @@ public abstract class Entity {
}
public boolean isSprinting() {
- return this.f(3);
+ return this.g(3);
}
public void setSprinting(boolean flag) {
@@ -1513,7 +1539,7 @@ public abstract class Entity {
}
public boolean isInvisible() {
- return this.f(5);
+ return this.g(5);
}
public void setInvisible(boolean flag) {
@@ -1524,7 +1550,7 @@ public abstract class Entity {
this.a(4, flag);
}
- protected boolean f(int i) {
+ protected boolean g(int i) {
return (this.datawatcher.getByte(0) & 1 << i) != 0;
}
@@ -1583,7 +1609,7 @@ public abstract class Entity {
public void a(EntityLiving entityliving) {}
- protected boolean i(double d0, double d1, double d2) {
+ protected boolean j(double d0, double d1, double d2) {
int i = MathHelper.floor(d0);
int j = MathHelper.floor(d1);
int k = MathHelper.floor(d2);
@@ -1592,15 +1618,15 @@ public abstract class Entity {
double d5 = d2 - (double) k;
List list = this.world.a(this.boundingBox);
- if (list.isEmpty() && !this.world.v(i, j, k)) {
+ if (list.isEmpty() && !this.world.q(i, j, k)) {
return false;
} else {
- boolean flag = !this.world.v(i - 1, j, k);
- boolean flag1 = !this.world.v(i + 1, j, k);
- boolean flag2 = !this.world.v(i, j - 1, k);
- boolean flag3 = !this.world.v(i, j + 1, k);
- boolean flag4 = !this.world.v(i, j, k - 1);
- boolean flag5 = !this.world.v(i, j, k + 1);
+ boolean flag = !this.world.q(i - 1, j, k);
+ boolean flag1 = !this.world.q(i + 1, j, k);
+ boolean flag2 = !this.world.q(i, j - 1, k);
+ boolean flag3 = !this.world.q(i, j + 1, k);
+ boolean flag4 = !this.world.q(i, j, k - 1);
+ boolean flag5 = !this.world.q(i, j, k + 1);
byte b0 = 3;
double d6 = 9999.0D;
@@ -1659,12 +1685,12 @@ public abstract class Entity {
}
}
- public void am() {
- this.K = true;
+ public void as() {
+ this.J = true;
this.fallDistance = 0.0F;
}
- public String getLocalizedName() {
+ public String getName() {
String s = EntityTypes.b(this);
if (s == null) {
@@ -1674,7 +1700,7 @@ public abstract class Entity {
return LocaleI18n.get("entity." + s + ".name");
}
- public Entity[] ao() {
+ public Entity[] at() {
return null;
}
@@ -1686,7 +1712,7 @@ public abstract class Entity {
return 0.0F;
}
- public boolean aq() {
+ public boolean av() {
return true;
}
@@ -1695,7 +1721,7 @@ public abstract class Entity {
}
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)});
+ return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] { this.getClass().getSimpleName(), this.getName(), Integer.valueOf(this.id), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)});
}
public boolean isInvulnerable() {
@@ -1712,7 +1738,7 @@ public abstract class Entity {
entity.e(nbttagcompound);
this.f(nbttagcompound);
this.portalCooldown = entity.portalCooldown;
- this.as = entity.as;
+ this.ar = entity.ar;
}
public void b(int i) {
@@ -1804,19 +1830,19 @@ public abstract class Entity {
return block.a(this);
}
- public boolean a(Explosion explosion, World world, int i, int j, int k, int l, float f) {
+ public boolean a(Explosion explosion, World world, int i, int j, int k, Block block, float f) {
return true;
}
- public int as() {
+ public int ax() {
return 3;
}
- public int at() {
- return this.as;
+ public int ay() {
+ return this.ar;
}
- public boolean au() {
+ public boolean az() {
return false;
}
@@ -1833,11 +1859,13 @@ public abstract class Entity {
return this.uniqueID;
}
- public boolean ax() {
+ public boolean aC() {
return true;
}
- public String getScoreboardDisplayName() {
- return this.getLocalizedName();
+ public IChatBaseComponent getScoreboardDisplayName() {
+ return new ChatComponentText(this.getName());
}
+
+ public void i(int i) {}
}
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index 5ba19f3ceb..36ed831685 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -15,7 +15,7 @@ public abstract class EntityAgeable extends EntityCreature {
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id) {
+ if (itemstack != null && itemstack.getItem() == Items.MONSTER_EGG) {
if (!this.world.isStatic) {
Class oclass = EntityTypes.a(itemstack.getData());
@@ -46,8 +46,8 @@ public abstract class EntityAgeable extends EntityCreature {
}
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(12, new Integer(0));
}
@@ -83,8 +83,8 @@ public abstract class EntityAgeable extends EntityCreature {
this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
}
- public void c() {
- super.c();
+ public void e() {
+ super.e();
if (this.world.isStatic || this.ageLocked) { // CraftBukkit
this.a(this.isBaby());
} else {
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index c9ec78a194..4b3e5dd5c0 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -12,7 +12,7 @@ public class EntityArrow extends Entity implements IProjectile {
private int d = -1;
private int e = -1;
private int f = -1;
- private int g;
+ private Block g;
private int h;
private boolean inGround;
public int fromPlayer;
@@ -25,13 +25,13 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world) {
super(world);
- this.l = 10.0D;
+ this.k = 10.0D;
this.a(0.5F, 0.5F);
}
public EntityArrow(World world, double d0, double d1, double d2) {
super(world);
- this.l = 10.0D;
+ this.k = 10.0D;
this.a(0.5F, 0.5F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
@@ -39,7 +39,7 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world, EntityLiving entityliving, EntityLiving entityliving1, float f, float f1) {
super(world);
- this.l = 10.0D;
+ this.k = 10.0D;
this.shooter = entityliving;
if (entityliving instanceof EntityHuman) {
this.fromPlayer = 1;
@@ -67,7 +67,7 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world, EntityLiving entityliving, float f) {
super(world);
- this.l = 10.0D;
+ this.k = 10.0D;
this.shooter = entityliving;
if (entityliving instanceof EntityHuman) {
this.fromPlayer = 1;
@@ -86,7 +86,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.shoot(this.motX, this.motY, this.motZ, f * 1.5F, 1.0F);
}
- protected void a() {
+ protected void c() {
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
@@ -112,8 +112,8 @@ public class EntityArrow extends Entity implements IProjectile {
this.j = 0;
}
- public void l_() {
- super.l_();
+ 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);
@@ -121,11 +121,11 @@ public class EntityArrow extends Entity implements IProjectile {
this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
}
- int i = this.world.getTypeId(this.d, this.e, this.f);
+ Block block = this.world.getType(this.d, this.e, this.f);
- if (i > 0) {
- Block.byId[i].updateShape(this.world, this.d, this.e, this.f);
- AxisAlignedBB axisalignedbb = Block.byId[i].b(this.world, this.d, this.e, this.f);
+ if (block.getMaterial() != Material.AIR) {
+ block.updateShape(this.world, this.d, this.e, this.f);
+ AxisAlignedBB axisalignedbb = block.a(this.world, this.d, this.e, this.f);
if (axisalignedbb != null && axisalignedbb.a(this.world.getVec3DPool().create(this.locX, this.locY, this.locZ))) {
this.inGround = true;
@@ -137,10 +137,9 @@ public class EntityArrow extends Entity implements IProjectile {
}
if (this.inGround) {
- int j = this.world.getTypeId(this.d, this.e, this.f);
- int k = this.world.getData(this.d, this.e, this.f);
+ int i = this.world.getData(this.d, this.e, this.f);
- if (j == this.g && k == this.h) {
+ if (block == this.g && i == this.h) {
++this.j;
if (this.j == 1200) {
this.die();
@@ -157,7 +156,7 @@ public class EntityArrow extends Entity implements IProjectile {
++this.au;
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
- MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
+ MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true, false);
vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
@@ -169,13 +168,13 @@ public class EntityArrow extends Entity implements IProjectile {
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;
- int l;
+ int j;
float f1;
- for (l = 0; l < list.size(); ++l) {
- Entity entity1 = (Entity) list.get(l);
+ for (j = 0; j < list.size(); ++j) {
+ Entity entity1 = (Entity) list.get(j);
- if (entity1.L() && (entity1 != this.shooter || this.au >= 5)) {
+ if (entity1.R() && (entity1 != this.shooter || this.au >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
@@ -211,10 +210,10 @@ public class EntityArrow extends Entity implements IProjectile {
if (movingobjectposition.entity != null) {
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
- int i1 = MathHelper.f((double) f2 * this.damage);
+ int k = MathHelper.f((double) f2 * this.damage);
- if (this.d()) {
- i1 += this.random.nextInt(i1 / 2 + 2);
+ if (this.f()) {
+ k += this.random.nextInt(k / 2 + 2);
}
DamageSource damagesource = null;
@@ -226,7 +225,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
// CraftBukkit start - Moved damage call
- if (movingobjectposition.entity.damageEntity(damagesource, i1)) {
+ if (movingobjectposition.entity.damageEntity(damagesource, k)) {
if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
@@ -237,12 +236,12 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit end
}
- // if (movingobjectposition.entity.damageEntity(damagesource, (float) i1)) { // CraftBukkit - moved up
+ // if (movingobjectposition.entity.damageEntity(damagesource, (float) k)) { // CraftBukkit - moved up
if (movingobjectposition.entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
if (!this.world.isStatic) {
- entityliving.m(entityliving.aU() + 1);
+ entityliving.p(entityliving.aZ() + 1);
}
if (this.aw > 0) {
@@ -252,12 +251,13 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
- if (this.shooter != null) {
- EnchantmentThorns.a(this.shooter, entityliving, this.random);
+ if (this.shooter != null && this.shooter instanceof EntityLiving) {
+ EnchantmentManager.a(entityliving, this.shooter);
+ EnchantmentManager.b((EntityLiving) this.shooter, entityliving);
}
if (this.shooter != null && movingobjectposition.entity != this.shooter && movingobjectposition.entity instanceof EntityHuman && this.shooter instanceof EntityPlayer) {
- ((EntityPlayer) this.shooter).playerConnection.sendPacket(new Packet70Bed(6, 0));
+ ((EntityPlayer) this.shooter).playerConnection.sendPacket(new PacketPlayOutGameStateChange(6, 0.0F));
}
}
@@ -277,7 +277,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.d = movingobjectposition.b;
this.e = movingobjectposition.c;
this.f = movingobjectposition.d;
- this.g = this.world.getTypeId(this.d, this.e, this.f);
+ this.g = block;
this.h = this.world.getData(this.d, this.e, this.f);
this.motX = (double) ((float) (movingobjectposition.pos.c - this.locX));
this.motY = (double) ((float) (movingobjectposition.pos.d - this.locY));
@@ -290,15 +290,15 @@ public class EntityArrow extends Entity implements IProjectile {
this.inGround = true;
this.shake = 7;
this.a(false);
- if (this.g != 0) {
- Block.byId[this.g].a(this.world, this.d, this.e, this.f, (Entity) this);
+ if (this.g.getMaterial() != Material.AIR) {
+ this.g.a(this.world, this.d, this.e, this.f, (Entity) this);
}
}
}
- if (this.d()) {
- for (l = 0; l < 4; ++l) {
- this.world.addParticle("crit", this.locX + this.motX * (double) l / 4.0D, this.locY + this.motY * (double) l / 4.0D, this.locZ + this.motZ * (double) l / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
+ if (this.f()) {
+ for (j = 0; j < 4; ++j) {
+ this.world.addParticle("crit", this.locX + this.motX * (double) j / 4.0D, this.locY + this.motY * (double) j / 4.0D, this.locZ + this.motZ * (double) j / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
}
}
@@ -329,8 +329,8 @@ public class EntityArrow extends Entity implements IProjectile {
float f4 = 0.99F;
f1 = 0.05F;
- if (this.H()) {
- for (int j1 = 0; j1 < 4; ++j1) {
+ if (this.M()) {
+ for (int l = 0; l < 4; ++l) {
f3 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
}
@@ -338,12 +338,16 @@ public class EntityArrow extends Entity implements IProjectile {
f4 = 0.8F;
}
+ if (this.L()) {
+ this.extinguish();
+ }
+
this.motX *= (double) f4;
this.motY *= (double) f4;
this.motZ *= (double) f4;
this.motY -= (double) f1;
this.setPosition(this.locX, this.locY, this.locZ);
- this.D();
+ this.I();
}
}
@@ -351,7 +355,8 @@ public class EntityArrow extends Entity implements IProjectile {
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.setShort("life", (short) this.j);
+ nbttagcompound.setByte("inTile", (byte) Block.b(this.g));
nbttagcompound.setByte("inData", (byte) this.h);
nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
@@ -363,17 +368,18 @@ public class EntityArrow extends Entity implements IProjectile {
this.d = nbttagcompound.getShort("xTile");
this.e = nbttagcompound.getShort("yTile");
this.f = nbttagcompound.getShort("zTile");
- this.g = nbttagcompound.getByte("inTile") & 255;
+ this.j = nbttagcompound.getShort("life");
+ this.g = Block.e(nbttagcompound.getByte("inTile") & 255);
this.h = nbttagcompound.getByte("inData") & 255;
this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.getByte("inGround") == 1;
- if (nbttagcompound.hasKey("damage")) {
+ if (nbttagcompound.hasKeyOfType("damage", 99)) {
this.damage = nbttagcompound.getDouble("damage");
}
- if (nbttagcompound.hasKey("pickup")) {
+ if (nbttagcompound.hasKeyOfType("pickup", 99)) {
this.fromPlayer = nbttagcompound.getByte("pickup");
- } else if (nbttagcompound.hasKey("player")) {
+ } else if (nbttagcompound.hasKeyOfType("player", 99)) {
this.fromPlayer = nbttagcompound.getBoolean("player") ? 1 : 0;
}
}
@@ -381,7 +387,7 @@ public class EntityArrow extends Entity implements IProjectile {
public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic && this.inGround && this.shake <= 0) {
// CraftBukkit start
- ItemStack itemstack = new ItemStack(Item.ARROW);
+ ItemStack itemstack = new ItemStack(Items.ARROW);
if (this.fromPlayer == 1 && entityhuman.inventory.canHold(itemstack) > 0) {
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
@@ -397,7 +403,7 @@ public class EntityArrow extends Entity implements IProjectile {
boolean flag = this.fromPlayer == 1 || this.fromPlayer == 2 && entityhuman.abilities.canInstantlyBuild;
- if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
+ if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Items.ARROW, 1))) {
flag = false;
}
@@ -409,7 +415,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
@@ -417,7 +423,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.damage = d0;
}
- public double c() {
+ public double e() {
return this.damage;
}
@@ -425,7 +431,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.aw = i;
}
- public boolean aq() {
+ public boolean av() {
return false;
}
@@ -439,7 +445,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
- public boolean d() {
+ public boolean f() {
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 8c1c7e6623..ea428c335f 100644
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -12,25 +12,25 @@ public class EntityBlaze extends EntityMonster {
this.b = 10;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.e).setValue(6.0D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, new Byte((byte) 0));
}
- protected String r() {
+ protected String t() {
return "mob.blaze.breathe";
}
- protected String aO() {
+ protected String aT() {
return "mob.blaze.hit";
}
- protected String aP() {
+ protected String aU() {
return "mob.blaze.death";
}
@@ -38,9 +38,9 @@ public class EntityBlaze extends EntityMonster {
return 1.0F;
}
- public void c() {
+ public void e() {
if (!this.world.isStatic) {
- if (this.G()) {
+ if (this.L()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
@@ -50,7 +50,7 @@ public class EntityBlaze extends EntityMonster {
this.bp = 0.5F + (float) this.random.nextGaussian() * 3.0F;
}
- if (this.bN() != null && this.bN().locY + (double) this.bN().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) {
+ if (this.bR() != null && this.bR().locY + (double) this.bR().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
}
}
@@ -67,7 +67,7 @@ public class EntityBlaze extends EntityMonster {
this.world.addParticle("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.c();
+ super.e();
}
protected void a(Entity entity, float f) {
@@ -113,12 +113,12 @@ public class EntityBlaze extends EntityMonster {
protected void b(float f) {}
- protected int getLootId() {
- return Item.BLAZE_ROD.id;
+ protected Item getLoot() {
+ return Items.BLAZE_ROD;
}
public boolean isBurning() {
- return this.bT();
+ return this.bX();
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -128,7 +128,7 @@ public class EntityBlaze extends EntityMonster {
int j = this.random.nextInt(2 + i);
if (j > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.BLAZE_ROD.id, j));
+ loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(Items.BLAZE_ROD), j));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
@@ -136,7 +136,7 @@ public class EntityBlaze extends EntityMonster {
}
}
- public boolean bT() {
+ public boolean bX() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@@ -152,7 +152,7 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
- protected boolean i_() {
+ protected boolean j_() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index 0a0df02b52..cc64d606b0 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -48,16 +48,16 @@ public class EntityBoat extends Entity {
super(world);
this.a = true;
this.b = 0.07D;
- this.m = true;
+ this.l = true;
this.a(1.5F, 0.6F);
this.height = this.length / 2.0F;
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
- protected void a() {
+ protected void c() {
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(1));
this.datawatcher.a(19, new Float(0.0F));
@@ -67,11 +67,11 @@ public class EntityBoat extends Entity {
return entity.boundingBox;
}
- public AxisAlignedBB E() {
+ public AxisAlignedBB J() {
return this.boundingBox;
}
- public boolean M() {
+ public boolean S() {
return true;
}
@@ -88,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 Y() {
+ public double ae() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@@ -106,13 +106,13 @@ public class EntityBoat extends Entity {
if (event.isCancelled()) {
return true;
}
- // i = event.getDamage(); // TODO Why don't we do this?
+ // f = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
- this.c(-this.h());
+ this.c(-this.i());
this.a(10);
this.setDamage(this.getDamage() + f * 10.0F);
- this.K();
+ this.Q();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40.0F) {
@@ -131,7 +131,7 @@ public class EntityBoat extends Entity {
}
if (!flag) {
- this.a(Item.BOAT.id, 1, 0.0F);
+ this.a(Items.BOAT, 1, 0.0F);
}
this.die();
@@ -143,11 +143,11 @@ public class EntityBoat extends Entity {
}
}
- public boolean L() {
+ public boolean R() {
return !this.dead;
}
- public void l_() {
+ public void h() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@@ -156,9 +156,9 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
- super.l_();
- if (this.e() > 0) {
- this.a(this.e() - 1);
+ super.h();
+ if (this.f() > 0) {
+ this.a(this.f() - 1);
}
if (this.getDamage() > 0.0F) {
@@ -184,12 +184,13 @@ public class EntityBoat extends Entity {
double d3 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
double d4;
double d5;
+ int j;
if (d3 > 0.26249999999999996D) {
d4 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D);
d5 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D);
- for (int j = 0; (double) j < 1.0D + d3 * 60.0D; ++j) {
+ for (j = 0; (double) j < 1.0D + d3 * 60.0D; ++j) {
double d6 = (double) (this.random.nextFloat() * 2.0F - 1.0F);
double d7 = (double) (this.random.nextInt(2) * 2 - 1) * 0.7D;
double d8;
@@ -249,13 +250,11 @@ public class EntityBoat extends Entity {
}
if (this.passenger != null && this.passenger instanceof EntityLiving) {
- d4 = (double) ((EntityLiving) this.passenger).bf;
- if (d4 > 0.0D) {
- d5 = -Math.sin((double) (this.passenger.yaw * 3.1415927F / 180.0F));
- d10 = Math.cos((double) (this.passenger.yaw * 3.1415927F / 180.0F));
- this.motX += d5 * this.b * 0.05000000074505806D;
- this.motZ += d10 * this.b * 0.05000000074505806D;
- }
+ EntityLiving entityliving = (EntityLiving) this.passenger;
+ float f = this.passenger.yaw + -entityliving.be * 90.0F;
+
+ this.motX += -Math.sin((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.bf * 0.05000000074505806D;
+ this.motZ += Math.cos((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.bf * 0.05000000074505806D;
}
// CraftBukkit start - Support unoccupied deceleration
else if (unoccupiedDeceleration >= 0) {
@@ -291,6 +290,37 @@ public class EntityBoat extends Entity {
}
}
+ int k;
+
+ for (k = 0; k < 4; ++k) {
+ int l = MathHelper.floor(this.locX + ((double) (k % 2) - 0.5D) * 0.8D);
+
+ j = MathHelper.floor(this.locZ + ((double) (k / 2) - 0.5D) * 0.8D);
+
+ for (int i1 = 0; i1 < 2; ++i1) {
+ int j1 = MathHelper.floor(this.locY) + i1;
+ Block block = this.world.getType(l, j1, j);
+
+ if (block == Blocks.SNOW) {
+ // CraftBukkit start
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, l, j1, j, Blocks.AIR, 0).isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
+ this.world.setAir(l, j1, j);
+ this.positionChanged = false;
+ } else if (block == Blocks.WATER_LILY) {
+ // CraftBukkit start
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, l, j1, j, Blocks.AIR, 0).isCancelled()) {
+ continue;
+ }
+ // CraftBukkit end
+ this.world.setAir(l, j1, j, true);
+ this.positionChanged = false;
+ }
+ }
+ }
+
if (this.onGround && !this.landBoats) { // CraftBukkit
this.motX *= 0.5D;
this.motY *= 0.5D;
@@ -307,14 +337,12 @@ public class EntityBoat extends Entity {
if (!destroyEvent.isCancelled()) {
this.die();
- int k;
-
for (k = 0; k < 3; ++k) {
- this.a(Block.WOOD.id, 1, 0.0F);
+ this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
}
for (k = 0; k < 2; ++k) {
- this.a(Item.STICK.id, 1, 0.0F);
+ this.a(Items.STICK, 1, 0.0F);
}
}
// CraftBukkit end
@@ -364,46 +392,17 @@ public class EntityBoat extends Entity {
if (!this.world.isStatic) {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
- int l;
if (list != null && !list.isEmpty()) {
- for (l = 0; l < list.size(); ++l) {
- Entity entity = (Entity) list.get(l);
+ for (int k1 = 0; k1 < list.size(); ++k1) {
+ Entity entity = (Entity) list.get(k1);
- if (entity != this.passenger && entity.M() && entity instanceof EntityBoat) {
+ if (entity != this.passenger && entity.S() && 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.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);
-
- if (i2 == Block.SNOW.id) {
- // CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(this, i1, l1, j1, 0, 0).isCancelled()) {
- continue;
- }
- // CraftBukkit end
-
- this.world.setAir(i1, l1, j1);
- } else if (i2 == Block.WATER_LILY.id) {
- // CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(this, i1, l1, j1, 0, 0).isCancelled()) {
- continue;
- }
- // CraftBukkit end
-
- this.world.setAir(i1, l1, j1, true);
- }
- }
- }
-
if (this.passenger != null && this.passenger.dead) {
this.passenger.vehicle = null; // CraftBukkit
this.passenger = null;
@@ -412,12 +411,12 @@ public class EntityBoat extends Entity {
}
}
- public void W() {
+ public void ac() {
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.Y() + this.passenger.X(), this.locZ + d1);
+ this.passenger.setPosition(this.locX + d0, this.locY + this.ae() + this.passenger.ad(), this.locZ + d1);
}
}
@@ -437,6 +436,35 @@ public class EntityBoat extends Entity {
}
}
+ protected void a(double d0, boolean flag) {
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.locY);
+ int k = MathHelper.floor(this.locZ);
+
+ if (flag) {
+ if (this.fallDistance > 3.0F) {
+ this.b(this.fallDistance);
+ if (!this.world.isStatic && !this.dead) {
+ this.die();
+
+ int l;
+
+ for (l = 0; l < 3; ++l) {
+ this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
+ }
+
+ for (l = 0; l < 2; ++l) {
+ this.a(Items.STICK, 1, 0.0F);
+ }
+ }
+
+ this.fallDistance = 0.0F;
+ }
+ } else if (this.world.getType(i, j - 1, k).getMaterial() != Material.WATER && d0 < 0.0D) {
+ this.fallDistance = (float) ((double) this.fallDistance - d0);
+ }
+ }
+
public void setDamage(float f) {
this.datawatcher.watch(19, Float.valueOf(f));
}
@@ -449,7 +477,7 @@ public class EntityBoat extends Entity {
this.datawatcher.watch(17, Integer.valueOf(i));
}
- public int e() {
+ public int f() {
return this.datawatcher.getInt(17);
}
@@ -457,7 +485,7 @@ public class EntityBoat extends Entity {
this.datawatcher.watch(18, Integer.valueOf(i));
}
- public int h() {
+ 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 fc75f2b360..b5135b026d 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers; // CraftBukkit
+
public class EntityChicken extends EntityAnimal {
public float bp;
@@ -16,25 +18,25 @@ public class EntityChicken extends EntityAnimal {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
- this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, Item.SEEDS.id, false));
+ this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, Items.SEEDS, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.1D));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(4.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
- public void c() {
- super.c();
+ public void e() {
+ super.e();
this.bs = this.bp;
this.br = this.bq;
this.bq = (float) ((double) this.bq + (double) (this.onGround ? -1 : 4) * 0.3D);
@@ -58,31 +60,31 @@ public class EntityChicken extends EntityAnimal {
this.bp += this.bt * 2.0F;
if (!this.isBaby() && !this.world.isStatic && --this.bu <= 0) {
this.makeSound("mob.chicken.plop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
- this.b(Item.EGG.id, 1);
+ this.a(Items.EGG, 1);
this.bu = this.random.nextInt(6000) + 6000;
}
}
protected void b(float f) {}
- protected String r() {
+ protected String t() {
return "mob.chicken.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.chicken.hurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.chicken.hurt";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.chicken.step", 0.15F, 1.0F);
}
- protected int getLootId() {
- return Item.FEATHER.id;
+ protected Item getLoot() {
+ return Items.FEATHER;
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -91,13 +93,13 @@ public class EntityChicken extends EntityAnimal {
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
if (j > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, j));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.FEATHER), j));
}
if (this.isBurning()) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.COOKED_CHICKEN.id, 1));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.COOKED_CHICKEN), 1));
} else {
- loot.add(new org.bukkit.inventory.ItemStack(Item.RAW_CHICKEN.id, 1));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.RAW_CHICKEN), 1));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 501e71c823..fb993a60b0 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -3,6 +3,7 @@ package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
// CraftBukkit end
public class EntityCow extends EntityAnimal {
@@ -14,45 +15,45 @@ public class EntityCow extends EntityAnimal {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 2.0D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
- this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.25D, Item.WHEAT.id, false));
+ this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.25D, Items.WHEAT, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.20000000298023224D);
}
- protected String r() {
+ protected String t() {
return "mob.cow.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.cow.hurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.cow.hurt";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.cow.step", 0.15F, 1.0F);
}
- protected float ba() {
+ protected float bf() {
return 0.4F;
}
- protected int getLootId() {
- return Item.LEATHER.id;
+ protected Item getLoot() {
+ return Items.LEATHER;
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -63,13 +64,13 @@ public class EntityCow extends EntityAnimal {
int k;
if (j > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, j));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.LEATHER), j));
}
j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(this.isBurning() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
+ loot.add(new org.bukkit.inventory.ItemStack(this.isBurning() ? CraftMagicNumbers.getMaterial(Items.COOKED_BEEF) : CraftMagicNumbers.getMaterial(Items.RAW_BEEF), j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
@@ -79,10 +80,10 @@ public class EntityCow extends EntityAnimal {
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (itemstack != null && itemstack.id == Item.BUCKET.id && !entityhuman.abilities.canInstantlyBuild) {
+ if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild) {
// CraftBukkit start - Got milk?
org.bukkit.Location loc = this.getBukkitEntity().getLocation();
- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Items.MILK_BUCKET);
if (event.isCancelled()) {
return false;
@@ -90,8 +91,8 @@ public class EntityCow extends EntityAnimal {
if (--itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, CraftItemStack.asNMSCopy(event.getItemStack()));
- } else if (!entityhuman.inventory.pickup(new ItemStack(Item.MILK_BUCKET))) {
- entityhuman.drop(CraftItemStack.asNMSCopy(event.getItemStack()));
+ } else if (!entityhuman.inventory.pickup(new ItemStack(Items.MILK_BUCKET))) {
+ entityhuman.drop(CraftItemStack.asNMSCopy(event.getItemStack()), false);
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index a2ad05d996..81502c1ad8 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -25,11 +25,11 @@ public abstract class EntityCreature extends EntityInsentient {
super(world);
}
- protected boolean bJ() {
+ protected boolean bN() {
return false;
}
- protected void bl() {
+ protected void bq() {
this.world.methodProfiler.a("ai");
if (this.bo > 0 && --this.bo == 0) {
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);
@@ -37,7 +37,7 @@ public abstract class EntityCreature extends EntityInsentient {
attributeinstance.b(i);
}
- this.bn = this.bJ();
+ this.bn = this.bN();
float f11 = 16.0F;
if (this.target == null) {
@@ -81,16 +81,20 @@ public abstract class EntityCreature extends EntityInsentient {
// CraftBukkit end
}
+ if (this.target instanceof EntityPlayer && ((EntityPlayer) this.target).playerInteractManager.isCreative()) {
+ this.target = null;
+ }
+
this.world.methodProfiler.b();
if (!this.bn && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true);
} else if (!this.bn && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.bo > 0) && this.aV < 100) {
- this.bK();
+ this.bO();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
- boolean flag = this.H();
- boolean flag1 = this.J();
+ boolean flag = this.M();
+ boolean flag1 = this.P();
this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
@@ -147,7 +151,7 @@ public abstract class EntityCreature extends EntityInsentient {
this.a(this.target, 30.0F, 30.0F);
}
- if (this.positionChanged && !this.bM()) {
+ if (this.positionChanged && !this.bQ()) {
this.bd = true;
}
@@ -157,12 +161,12 @@ public abstract class EntityCreature extends EntityInsentient {
this.world.methodProfiler.b();
} else {
- super.bl();
+ super.bq();
this.pathEntity = null;
}
}
- protected void bK() {
+ protected void bO() {
this.world.methodProfiler.a("stroll");
boolean flag = false;
int i = -1;
@@ -210,7 +214,7 @@ public abstract class EntityCreature extends EntityInsentient {
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
}
- public boolean bM() {
+ public boolean bQ() {
return this.pathEntity != null;
}
@@ -218,7 +222,7 @@ public abstract class EntityCreature extends EntityInsentient {
this.pathEntity = pathentity;
}
- public Entity bN() {
+ public Entity bR() {
return this.target;
}
@@ -226,7 +230,7 @@ public abstract class EntityCreature extends EntityInsentient {
this.target = entity;
}
- public boolean bO() {
+ public boolean bS() {
return this.b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
@@ -234,33 +238,33 @@ public abstract class EntityCreature extends EntityInsentient {
return this.br == -1.0F ? true : this.bq.e(i, j, k) < this.br * this.br;
}
- public void b(int i, int j, int k, int l) {
+ public void a(int i, int j, int k, int l) {
this.bq.b(i, j, k);
this.br = (float) l;
}
- public ChunkCoordinates bP() {
+ public ChunkCoordinates bT() {
return this.bq;
}
- public float bQ() {
+ public float bU() {
return this.br;
}
- public void bR() {
+ public void bV() {
this.br = -1.0F;
}
- public boolean bS() {
+ public boolean bW() {
return this.br != -1.0F;
}
- protected void bF() {
- super.bF();
- if (this.bH() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
+ protected void bJ() {
+ super.bJ();
+ if (this.bL() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
- this.b((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
+ this.a((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
float f = this.d(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
@@ -297,11 +301,11 @@ public abstract class EntityCreature extends EntityInsentient {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
- } else if (!this.bH() && this.bt) {
+ } else if (!this.bL() && this.bt) {
this.bt = false;
this.goalSelector.a(this.bs);
this.getNavigation().a(true);
- this.bR();
+ this.bV();
}
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 5424003dab..3c51de56c6 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -26,16 +26,16 @@ public class EntityCreeper extends EntityMonster {
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- public int as() {
+ public int ax() {
return this.getGoalTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
}
@@ -47,10 +47,11 @@ public class EntityCreeper extends EntityMonster {
}
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, Byte.valueOf((byte) -1));
this.datawatcher.a(17, Byte.valueOf((byte) 0));
+ this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
public void b(NBTTagCompound nbttagcompound) {
@@ -61,27 +62,36 @@ public class EntityCreeper extends EntityMonster {
nbttagcompound.setShort("Fuse", (short) this.maxFuseTicks);
nbttagcompound.setByte("ExplosionRadius", (byte) this.explosionRadius);
+ nbttagcompound.setBoolean("ignited", this.ca());
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0)));
- if (nbttagcompound.hasKey("Fuse")) {
+ if (nbttagcompound.hasKeyOfType("Fuse", 99)) {
this.maxFuseTicks = nbttagcompound.getShort("Fuse");
}
- if (nbttagcompound.hasKey("ExplosionRadius")) {
+ if (nbttagcompound.hasKeyOfType("ExplosionRadius", 99)) {
this.explosionRadius = nbttagcompound.getByte("ExplosionRadius");
}
+
+ if (nbttagcompound.getBoolean("ignited")) {
+ this.cb();
+ }
}
- public void l_() {
+ public void h() {
if (this.isAlive()) {
this.bp = this.fuseTicks;
- int i = this.bV();
+ if (this.ca()) {
+ this.a(1);
+ }
+
+ int i = this.bZ();
if (i > 0 && this.fuseTicks == 0) {
- this.makeSound("random.fuse", 1.0F, 0.5F);
+ this.makeSound("creeper.primed", 1.0F, 0.5F);
}
this.fuseTicks += i;
@@ -91,42 +101,30 @@ public class EntityCreeper extends EntityMonster {
if (this.fuseTicks >= this.maxFuseTicks) {
this.fuseTicks = this.maxFuseTicks;
- if (!this.world.isStatic) {
- boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
- // 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(), flag);
- this.die();
- } else {
- this.fuseTicks = 0;
- }
- // CraftBukkit end
- }
+ this.cc();
}
}
- super.l_();
+ super.h();
}
- protected String aO() {
+ protected String aT() {
return "mob.creeper.say";
}
- protected String aP() {
+ protected String aU() {
return "mob.creeper.death";
}
public void die(DamageSource damagesource) {
// CraftBukkit start - Rearranged the method (super call to end, drop to dropDeathLoot)
if (damagesource.getEntity() instanceof EntitySkeleton) {
- int i = Item.RECORD_1.id + this.random.nextInt(Item.RECORD_12.id - Item.RECORD_1.id + 1);
+ int i = Item.b(Items.RECORD_1);
+ int j = Item.b(Items.RECORD_12);
+ int k = i + this.random.nextInt(j - i + 1);
- // this.b(i, 1); // CraftBukkit
- this.record = i;
+ // this.a(Item.d(k), 1); // CraftBukkit
+ this.record = k;
}
super.die(damagesource);
@@ -135,11 +133,11 @@ public class EntityCreeper extends EntityMonster {
// CraftBukkit start - Whole method
protected void dropDeathLoot(boolean flag, int i) {
- int j = this.getLootId();
+ Item j = this.getLoot();
java.util.List loot = new java.util.ArrayList();
- if (j > 0) {
+ if (j != null) {
int k = this.random.nextInt(3);
if (i > 0) {
@@ -147,13 +145,13 @@ public class EntityCreeper extends EntityMonster {
}
if (k > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(j, k));
+ loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(j), k));
}
}
// Drop a music disc?
if (this.record != -1) {
- loot.add(new org.bukkit.inventory.ItemStack(this.record, 1));
+ loot.add(new org.bukkit.inventory.ItemStack(this.record, 1)); // TODO: Material
this.record = -1;
}
@@ -169,11 +167,11 @@ public class EntityCreeper extends EntityMonster {
return this.datawatcher.getByte(17) == 1;
}
- protected int getLootId() {
- return Item.SULPHUR.id;
+ protected Item getLoot() {
+ return Items.SULPHUR;
}
- public int bV() {
+ public int bZ() {
return this.datawatcher.getByte(16);
}
@@ -199,4 +197,47 @@ public class EntityCreeper extends EntityMonster {
}
// CraftBukkit end
}
+
+ protected boolean a(EntityHuman entityhuman) {
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
+
+ if (itemstack != null && itemstack.getItem() == Items.FLINT_AND_STEEL) {
+ this.world.makeSound(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.ignite", 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
+ entityhuman.ba();
+ if (!this.world.isStatic) {
+ this.cb();
+ itemstack.damage(1, entityhuman);
+ return true;
+ }
+ }
+
+ return super.a(entityhuman);
+ }
+
+ private void cc() {
+ if (!this.world.isStatic) {
+ boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
+
+ // 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(), flag);
+ this.die();
+ } else {
+ this.fuseTicks = 0;
+ }
+ // CraftBukkit end
+ }
+ }
+
+ public boolean ca() {
+ return this.datawatcher.getByte(18) != 0;
+ }
+
+ public void cb() {
+ this.datawatcher.watch(18, Byte.valueOf((byte) 1));
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
index 1cb9622951..8c4670bab5 100644
--- a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
+++ b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
@@ -9,7 +9,7 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
this.owner = entity1;
}
- public Entity h() {
+ public Entity i() {
return this.p;
}
@@ -17,13 +17,13 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
return this.owner;
}
- public ChatMessage getLocalizedDeathMessage(EntityLiving entityliving) {
- String s = this.owner == null ? this.p.getScoreboardDisplayName() : this.owner.getScoreboardDisplayName();
- ItemStack itemstack = this.owner instanceof EntityLiving ? ((EntityLiving) this.owner).aZ() : null;
- String s1 = "death.attack." + this.translationIndex;
- String s2 = s1 + ".item";
+ public IChatBaseComponent getLocalizedDeathMessage(EntityLiving entityliving) {
+ IChatBaseComponent ichatbasecomponent = this.owner == null ? this.p.getScoreboardDisplayName() : this.owner.getScoreboardDisplayName();
+ ItemStack itemstack = this.owner instanceof EntityLiving ? ((EntityLiving) this.owner).be() : null;
+ String s = "death.attack." + this.translationIndex;
+ String s1 = s + ".item";
- return itemstack != null && itemstack.hasName() && LocaleI18n.b(s2) ? ChatMessage.b(s2, new Object[] { entityliving.getScoreboardDisplayName(), s, itemstack.getName()}) : ChatMessage.b(s1, new Object[] { entityliving.getScoreboardDisplayName(), s});
+ return itemstack != null && itemstack.hasName() && LocaleI18n.c(s1) ? new ChatMessage(s1, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.E()}) : new ChatMessage(s, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent});
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
index 3d6e2343fe..51cecfea48 100644
--- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java
+++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
@@ -9,22 +9,22 @@ public class EntityEnderCrystal extends Entity {
public EntityEnderCrystal(World world) {
super(world);
- this.m = true;
+ this.l = true;
this.a(2.0F, 2.0F);
this.height = this.length / 2.0F;
this.b = 5;
this.a = this.random.nextInt(100000);
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
- protected void a() {
+ protected void c() {
this.datawatcher.a(8, Integer.valueOf(this.b));
}
- public void l_() {
+ public void h() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -34,10 +34,10 @@ public class EntityEnderCrystal extends Entity {
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- if (this.world.getTypeId(i, j, k) != Block.FIRE.id) {
+ if (this.world.worldProvider instanceof WorldProviderTheEnd && this.world.getType(i, j, k) != Blocks.FIRE) {
// CraftBukkit start
if (!CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
- this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ this.world.setTypeUpdate(i, j, k, Blocks.FIRE);
}
// CraftBukkit end
}
@@ -47,7 +47,7 @@ public class EntityEnderCrystal extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
- public boolean L() {
+ public boolean R() {
return true;
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index e1eded3a5f..7067a64a8a 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -41,19 +41,19 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.children = new EntityComplexPart[] { this.bq = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.br = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bs = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bt = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bu = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bv = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bw = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
this.setHealth(this.getMaxHealth());
this.a(16.0F, 8.0F);
- this.Z = true;
+ this.Y = true;
this.fireProof = true;
this.i = 100.0D;
- this.am = true;
+ this.al = true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(200.0D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
}
public double[] b(int i, float f) {
@@ -76,7 +76,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
return adouble;
}
- public void c() {
+ public void e() {
float f;
float f1;
@@ -97,7 +97,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
this.world.addParticle("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
} else {
- this.bJ();
+ this.bN();
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.bA) {
@@ -161,8 +161,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.j += this.random.nextGaussian() * 2.0D;
}
- if (this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.H) {
- this.bK();
+ if (this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
+ this.bO();
}
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
@@ -243,11 +243,11 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
float f11 = MathHelper.sin(f10);
float f12 = MathHelper.cos(f10);
- this.br.l_();
+ this.br.h();
this.br.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
- this.bv.l_();
+ this.bv.h();
this.bv.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
- this.bw.l_();
+ this.bw.h();
this.bw.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.bv.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
@@ -261,7 +261,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bg * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bg * 0.01F);
- this.bq.l_();
+ this.bq.h();
this.bq.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F);
for (int j = 0; j < 3; ++j) {
@@ -286,7 +286,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
float f17 = 1.5F;
float f18 = (float) (j + 1) * 2.0F;
- entitycomplexpart.l_();
+ entitycomplexpart.h();
entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f2), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f2), 0.0F, 0.0F);
}
@@ -296,7 +296,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
}
}
- private void bJ() {
+ private void bN() {
if (this.bC != null) {
if (this.bC.dead) {
if (!this.world.isStatic) {
@@ -304,7 +304,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
}
this.bC = null;
- } else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) { // CraftBukkit - this.getMaxHealth() -> this.maxHealth
+ } else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
// CraftBukkit start
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0D, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
this.world.getServer().getPluginManager().callEvent(event);
@@ -365,7 +365,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
}
}
- private void bK() {
+ private void bO() {
this.bz = false;
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
this.bD = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
@@ -411,10 +411,10 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
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);
+ Block block = this.world.getType(k1, l1, i2);
- if (j2 != 0) {
- if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id && this.world.getGameRules().getBoolean("mobGriefing")) {
+ if (block.getMaterial() != Material.AIR) {
+ if (block != Blocks.OBSIDIAN && block != Blocks.WHITESTONE && block != Blocks.BEDROCK && this.world.getGameRules().getBoolean("mobGriefing")) {
// CraftBukkit start - Add blocks to list rather than destroying them
// flag1 = this.world.setAir(k1, l1, i2) || flag1;
flag1 = true;
@@ -444,9 +444,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
}
} else {
for (org.bukkit.block.Block block : event.blockList()) {
- int blockId = block.getTypeId();
-
- if (blockId == 0) {
+ org.bukkit.Material blockId = block.getType();
+ if (blockId == org.bukkit.Material.AIR) {
continue;
}
@@ -454,10 +453,11 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
int blockY = block.getY();
int blockZ = block.getZ();
- if (Block.byId[blockId].a(explosionSource)) {
- Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), event.getYield(), 0);
+ Block nmsBlock = org.bukkit.craftbukkit.util.CraftMagicNumbers.getBlock(blockId);
+ if (nmsBlock.a(explosionSource)) {
+ nmsBlock.dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), event.getYield(), 0);
}
- Block.byId[blockId].wasExploded(world, blockX, blockY, blockZ, explosionSource);
+ nmsBlock.wasExploded(world, blockX, blockY, blockZ, explosionSource);
this.world.setAir(blockX, blockY, blockZ);
}
@@ -502,7 +502,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
return super.damageEntity(damagesource, f);
}
- protected void aB() {
+ protected void aF() {
+ if (this.dead) return; // CraftBukkit - can't kill what's already dead
++this.bB;
if (this.bB >= 180 && this.bB <= 200) {
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
@@ -517,7 +518,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
if (!this.world.isStatic) {
if (this.bB > 150 && this.bB % 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()
+ i = this.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);
@@ -527,14 +528,14 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
}
if (this.bB == 1) {
- this.world.d(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ this.world.b(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
}
this.move(0.0D, 0.10000000149011612D, 0.0D);
this.aN = this.yaw += 20.0F;
if (this.bB == 200 && !this.world.isStatic) {
- i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
+ i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience
while (i > 0) {
j = EntityExperienceOrb.getOrbValue(i);
@@ -542,12 +543,12 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
}
- this.c(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
+ this.b(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
this.die();
}
}
- private void c(int i, int j) {
+ private void b(int i, int j) {
byte b0 = 64;
BlockEnderPortal.a = true;
@@ -566,29 +567,29 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
if (d2 <= ((double) b1 - 0.5D) * ((double) b1 - 0.5D)) {
if (k < b0) {
if (d2 <= ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
- world.setTypeId(l, k, i1, Block.BEDROCK.id);
+ world.setTypeUpdate(l, k, i1, Blocks.BEDROCK);
}
} else if (k > b0) {
- world.setTypeId(l, k, i1, 0);
+ world.setTypeUpdate(l, k, i1, Blocks.AIR);
} else if (d2 > ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
- world.setTypeId(l, k, i1, Block.BEDROCK.id);
+ world.setTypeUpdate(l, k, i1, Blocks.BEDROCK);
} else {
- world.setTypeId(l, k, i1, Block.ENDER_PORTAL.id);
+ world.setTypeUpdate(l, k, i1, Blocks.ENDER_PORTAL);
}
}
}
}
}
- world.setTypeId(i, b0 + 0, j, Block.BEDROCK.id);
- world.setTypeId(i, b0 + 1, j, Block.BEDROCK.id);
- world.setTypeId(i, b0 + 2, j, Block.BEDROCK.id);
- world.setTypeId(i - 1, b0 + 2, j, Block.TORCH.id);
- world.setTypeId(i + 1, b0 + 2, j, Block.TORCH.id);
- world.setTypeId(i, b0 + 2, j - 1, Block.TORCH.id);
- world.setTypeId(i, b0 + 2, j + 1, Block.TORCH.id);
- world.setTypeId(i, b0 + 3, j, Block.BEDROCK.id);
- world.setTypeId(i, b0 + 4, j, Block.DRAGON_EGG.id);
+ world.setType(i, b0 + 0, j, Blocks.BEDROCK);
+ world.setType(i, b0 + 1, j, Blocks.BEDROCK);
+ world.setType(i, b0 + 2, j, Blocks.BEDROCK);
+ world.setType(i - 1, b0 + 2, j, Blocks.TORCH);
+ world.setType(i + 1, b0 + 2, j, Blocks.TORCH);
+ world.setType(i, b0 + 2, j - 1, Blocks.TORCH);
+ world.setType(i, b0 + 2, j + 1, Blocks.TORCH);
+ world.setType(i, b0 + 3, j, Blocks.BEDROCK);
+ world.setType(i, b0 + 4, j, Blocks.DRAGON_EGG);
EntityCreatePortalEvent event = new EntityCreatePortalEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), java.util.Collections.unmodifiableList(world.getList()), org.bukkit.PortalType.ENDER);
this.world.getServer().getPluginManager().callEvent(event);
@@ -599,7 +600,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
}
} else {
for (BlockState state : event.getBlocks()) {
- Packet53BlockChange packet = new Packet53BlockChange(state.getX(), state.getY(), state.getZ(), this.world);
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(state.getX(), state.getY(), state.getZ(), this.world);
for (Iterator it = this.world.players.iterator(); it.hasNext();) {
EntityHuman entity = (EntityHuman) it.next();
if (entity instanceof EntityPlayer) {
@@ -613,29 +614,29 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
BlockEnderPortal.a = false;
}
- protected void u() {}
+ protected void w() {}
- public Entity[] ao() {
+ public Entity[] at() {
return this.children;
}
- public boolean L() {
+ public boolean R() {
return false;
}
- public World b() {
+ public World a() {
return this.world;
}
- protected String r() {
+ protected String t() {
return "mob.enderdragon.growl";
}
- protected String aO() {
+ protected String aT() {
return "mob.enderdragon.hit";
}
- protected float ba() {
+ protected float bf() {
return 5.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index 585154e459..3a602af079 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -18,7 +18,7 @@ public class EntityEnderPearl extends EntityProjectile {
protected void a(MovingObjectPosition movingobjectposition) {
if (movingobjectposition.entity != null) {
- movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0);
+ movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0.0F);
}
for (int i = 0; i < 32; ++i) {
@@ -29,7 +29,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (this.getShooter() != null && this.getShooter() instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) this.getShooter();
- if (!entityplayer.playerConnection.disconnected && entityplayer.world == this.world) {
+ if (entityplayer.playerConnection.b().d() && entityplayer.world == this.world) {
// CraftBukkit start
org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
org.bukkit.Location location = getBukkitEntity().getLocation();
@@ -39,14 +39,14 @@ public class EntityEnderPearl extends EntityProjectile {
PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
Bukkit.getPluginManager().callEvent(teleEvent);
- if (!teleEvent.isCancelled() && !entityplayer.playerConnection.disconnected) {
+ if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
entityplayer.playerConnection.teleport(teleEvent.getTo());
this.getShooter().fallDistance = 0.0F;
EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), player, EntityDamageByEntityEvent.DamageCause.FALL, 5.0D);
Bukkit.getPluginManager().callEvent(damageEvent);
- if (!damageEvent.isCancelled() && !entityplayer.playerConnection.disconnected) {
+ if (!damageEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
entityplayer.invulnerableTicks = -1; // Remove spawning invulnerability
player.setLastDamageCause(damageEvent);
entityplayer.damageEntity(DamageSource.FALL, (float) damageEvent.getDamage());
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index bd19ff3eb3..c73bdf7836 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -21,18 +21,18 @@ public class EntityEnderman extends EntityMonster {
public EntityEnderman(World world) {
super(world);
this.a(0.6F, 2.9F);
- this.Y = 1.0F;
+ this.X = 1.0F;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(40.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.30000001192092896D);
this.getAttributeInstance(GenericAttributes.e).setValue(7.0D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, new Byte((byte) 0));
this.datawatcher.a(17, new Byte((byte) 0));
this.datawatcher.a(18, new Byte((byte) 0));
@@ -40,13 +40,13 @@ public class EntityEnderman extends EntityMonster {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setShort("carried", (short) this.getCarriedId());
+ nbttagcompound.setShort("carried", (short) Block.b(this.getCarried()));
nbttagcompound.setShort("carriedData", (short) this.getCarriedData());
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.setCarriedId(nbttagcompound.getShort("carried"));
+ this.setCarried(Block.e(nbttagcompound.getShort("carried")));
this.setCarriedData(nbttagcompound.getShort("carriedData"));
}
@@ -57,7 +57,7 @@ public class EntityEnderman extends EntityMonster {
if (this.f(entityhuman)) {
this.bv = true;
if (this.bt == 0) {
- this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F);
+ this.world.makeSound(entityhuman.locX, entityhuman.locY, entityhuman.locZ, "mob.endermen.stare", 1.0F, 1.0F);
}
if (this.bt++ == 5) {
@@ -76,7 +76,7 @@ public class EntityEnderman extends EntityMonster {
private boolean f(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.armor[3];
- if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
+ if (itemstack != null && itemstack.getItem() == Item.getItemOf(Blocks.PUMPKIN)) {
return false;
} else {
Vec3D vec3d = entityhuman.j(1.0F).a();
@@ -90,8 +90,8 @@ public class EntityEnderman extends EntityMonster {
}
}
- public void c() {
- if (this.G()) {
+ public void e() {
+ if (this.L()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
@@ -110,20 +110,20 @@ public class EntityEnderman extends EntityMonster {
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
int j;
int k;
- int l;
+ Block block;
- if (this.getCarriedId() == 0) {
+ if (this.getCarried().getMaterial() == Material.AIR) {
if (this.random.nextInt(20) == 0) {
i = MathHelper.floor(this.locX - 2.0D + this.random.nextDouble() * 4.0D);
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 (br[l]) {
+ block = this.world.getType(i, j, k);
+ if (br[Block.b(block)]) {
// 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));
+ this.setCarried(block);
this.setCarriedData(this.world.getData(i, j, k));
- this.world.setTypeIdUpdate(i, j, k, 0);
+ this.world.setTypeUpdate(i, j, k, Blocks.AIR);
}
// CraftBukkit end
}
@@ -132,14 +132,14 @@ public class EntityEnderman extends EntityMonster {
i = MathHelper.floor(this.locX - 1.0D + this.random.nextDouble() * 2.0D);
j = MathHelper.floor(this.locY + this.random.nextDouble() * 2.0D);
k = MathHelper.floor(this.locZ - 1.0D + this.random.nextDouble() * 2.0D);
- l = this.world.getTypeId(i, j, k);
- int i1 = this.world.getTypeId(i, j - 1, k);
+ block = this.world.getType(i, j, k);
+ Block block1 = this.world.getType(i, j - 1, k);
- if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
+ if (block.getMaterial() == Material.AIR && block1.getMaterial() != Material.AIR && block1.d()) {
// CraftBukkit start - Place event
- if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarriedId(), this.getCarriedData()).isCancelled()) {
- this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3);
- this.setCarriedId(0);
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarried(), this.getCarriedData()).isCancelled()) {
+ this.world.setTypeAndData(i, j, k, this.getCarried(), this.getCarriedData(), 3);
+ this.setCarried(Blocks.AIR);
}
// CraftBukkit end
}
@@ -153,22 +153,22 @@ public class EntityEnderman extends EntityMonster {
if (this.world.v() && !this.world.isStatic) {
float f = this.d(1.0F);
- if (f > 0.5F && this.world.l(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.i(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.a(false);
this.bv = false;
- this.bT();
+ this.bX();
}
}
- if (this.G() || this.isBurning()) {
+ if (this.L() || this.isBurning()) {
this.target = null;
this.a(false);
this.bv = false;
- this.bT();
+ this.bX();
}
- if (this.bX() && !this.bv && this.random.nextInt(100) == 0) {
+ if (this.cb() && !this.bv && this.random.nextInt(100) == 0) {
this.a(false);
}
@@ -181,7 +181,7 @@ public class EntityEnderman extends EntityMonster {
if (this.target != null) {
if (this.target instanceof EntityHuman && this.f((EntityHuman) this.target)) {
if (this.target.e((Entity) this) < 16.0D) {
- this.bT();
+ this.bX();
}
this.bs = 0;
@@ -194,15 +194,15 @@ public class EntityEnderman extends EntityMonster {
}
}
- super.c();
+ super.e();
}
- protected boolean bT() {
+ protected boolean bX() {
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.j(d0, d1, d2);
+ return this.k(d0, d1, d2);
}
protected boolean c(Entity entity) {
@@ -214,10 +214,10 @@ public class EntityEnderman extends EntityMonster {
double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.d * d0;
double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.e * d0;
- return this.j(d1, d2, d3);
+ return this.k(d1, d2, d3);
}
- protected boolean j(double d0, double d1, double d2) {
+ protected boolean k(double d0, double d1, double d2) {
double d3 = this.locX;
double d4 = this.locY;
double d5 = this.locZ;
@@ -229,14 +229,14 @@ public class EntityEnderman extends EntityMonster {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- int l;
if (this.world.isLoaded(i, j, k)) {
boolean flag1 = false;
while (!flag1 && j > 0) {
- l = this.world.getTypeId(i, j - 1, k);
- if (l != 0 && Block.byId[l].material.isSolid()) {
+ Block block = this.world.getType(i, j - 1, k);
+
+ if (block.getMaterial().isSolid()) {
flag1 = true;
} else {
--this.locY;
@@ -268,7 +268,7 @@ public class EntityEnderman extends EntityMonster {
} else {
short short1 = 128;
- for (l = 0; l < short1; ++l) {
+ for (int l = 0; l < short1; ++l) {
double d6 = (double) l / ((double) short1 - 1.0D);
float f = (this.random.nextFloat() - 0.5F) * 0.2F;
float f1 = (this.random.nextFloat() - 0.5F) * 0.2F;
@@ -286,32 +286,32 @@ public class EntityEnderman extends EntityMonster {
}
}
- protected String r() {
- return this.bX() ? "mob.endermen.scream" : "mob.endermen.idle";
+ protected String t() {
+ return this.cb() ? "mob.endermen.scream" : "mob.endermen.idle";
}
- protected String aO() {
+ protected String aT() {
return "mob.endermen.hit";
}
- protected String aP() {
+ protected String aU() {
return "mob.endermen.death";
}
- protected int getLootId() {
- return Item.ENDER_PEARL.id;
+ protected Item getLoot() {
+ return Items.ENDER_PEARL;
}
protected void dropDeathLoot(boolean flag, int i) {
- int j = this.getLootId();
+ Item item = this.getLoot();
- if (j > 0) {
+ if (item != null) {
// CraftBukkit start - Whole method
java.util.List loot = new java.util.ArrayList();
int count = this.random.nextInt(2 + i);
- if ((j > 0) && (count > 0)) {
- loot.add(new org.bukkit.inventory.ItemStack(j, count));
+ if (count > 0) {
+ loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), count));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
@@ -319,12 +319,12 @@ public class EntityEnderman extends EntityMonster {
}
}
- public void setCarriedId(int i) {
- this.datawatcher.watch(16, Byte.valueOf((byte) (i & 255)));
+ public void setCarried(Block block) {
+ this.datawatcher.watch(16, Byte.valueOf((byte) (Block.b(block) & 255)));
}
- public int getCarriedId() {
- return this.datawatcher.getByte(16);
+ public Block getCarried() {
+ return Block.e(this.datawatcher.getByte(16));
}
public void setCarriedData(int i) {
@@ -348,7 +348,7 @@ public class EntityEnderman extends EntityMonster {
this.bv = false;
for (int i = 0; i < 64; ++i) {
- if (this.bT()) {
+ if (this.bX()) {
return true;
}
}
@@ -360,7 +360,7 @@ public class EntityEnderman extends EntityMonster {
}
}
- public boolean bX() {
+ public boolean cb() {
return this.datawatcher.getByte(18) > 0;
}
@@ -369,19 +369,19 @@ public class EntityEnderman extends EntityMonster {
}
static {
- br[Block.GRASS.id] = true;
- br[Block.DIRT.id] = true;
- br[Block.SAND.id] = true;
- br[Block.GRAVEL.id] = true;
- br[Block.YELLOW_FLOWER.id] = true;
- br[Block.RED_ROSE.id] = true;
- br[Block.BROWN_MUSHROOM.id] = true;
- br[Block.RED_MUSHROOM.id] = true;
- br[Block.TNT.id] = true;
- br[Block.CACTUS.id] = true;
- br[Block.CLAY.id] = true;
- br[Block.PUMPKIN.id] = true;
- br[Block.MELON.id] = true;
- br[Block.MYCEL.id] = true;
+ br[Block.b((Block) Blocks.GRASS)] = true;
+ br[Block.b(Blocks.DIRT)] = true;
+ br[Block.b(Blocks.SAND)] = true;
+ br[Block.b(Blocks.GRAVEL)] = true;
+ br[Block.b((Block) Blocks.YELLOW_FLOWER)] = true;
+ br[Block.b((Block) Blocks.RED_ROSE)] = true;
+ br[Block.b((Block) Blocks.BROWN_MUSHROOM)] = true;
+ br[Block.b((Block) Blocks.RED_MUSHROOM)] = true;
+ br[Block.b(Blocks.TNT)] = true;
+ br[Block.b(Blocks.CACTUS)] = true;
+ br[Block.b(Blocks.CLAY)] = true;
+ br[Block.b(Blocks.PUMPKIN)] = true;
+ br[Block.b(Blocks.MELON)] = true;
+ br[Block.b((Block) Blocks.MYCEL)] = true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index fab2b64714..d79f69339f 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -27,7 +27,7 @@ public class EntityExperienceOrb extends Entity {
this.value = i;
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
@@ -37,10 +37,10 @@ public class EntityExperienceOrb extends Entity {
this.height = this.length / 2.0F;
}
- protected void a() {}
+ protected void c() {}
- public void l_() {
- super.l_();
+ public void h() {
+ super.h();
if (this.c > 0) {
--this.c;
}
@@ -49,17 +49,17 @@ public class EntityExperienceOrb extends Entity {
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.029999999329447746D;
- if (this.world.getMaterial(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) == Material.LAVA) {
+ if (this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)).getMaterial() == 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.makeSound("random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
}
- this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
+ this.j(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
double d0 = 8.0D;
- if (this.targetTime < this.a - 20 + this.id % 100) {
+ if (this.targetTime < this.a - 20 + this.getId() % 100) {
if (this.targetPlayer == null || this.targetPlayer.e(this) > d0 * d0) {
this.targetPlayer = this.world.findNearbyPlayer(this, d0);
}
@@ -92,12 +92,7 @@ public class EntityExperienceOrb extends Entity {
float f = 0.98F;
if (this.onGround) {
- f = 0.58800006F;
- int i = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
-
- if (i > 0) {
- f = Block.byId[i].frictionFactor * 0.98F;
- }
+ f = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)).frictionFactor * 0.98F;
}
this.motX *= (double) f;
@@ -114,7 +109,7 @@ public class EntityExperienceOrb extends Entity {
}
}
- public boolean I() {
+ public boolean N() {
return this.world.a(this.boundingBox, Material.WATER, (Entity) this);
}
@@ -126,7 +121,7 @@ public class EntityExperienceOrb extends Entity {
if (this.isInvulnerable()) {
return false;
} else {
- this.K();
+ this.Q();
this.d = (int) ((float) this.d - f);
if (this.d <= 0) {
this.die();
@@ -150,9 +145,9 @@ public class EntityExperienceOrb extends Entity {
public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
- if (this.c == 0 && entityhuman.bv == 0) {
- entityhuman.bv = 2;
- this.makeSound("random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
+ if (this.c == 0 && entityhuman.bu == 0) {
+ entityhuman.bu = 2;
+ this.world.makeSound(entityhuman, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
entityhuman.receive(this, 1);
entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value to event.getAmount()
this.die();
@@ -160,7 +155,7 @@ public class EntityExperienceOrb extends Entity {
}
}
- public int c() {
+ public int e() {
return this.value;
}
@@ -187,7 +182,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 aq() {
+ public boolean av() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index b552421b8f..991a765871 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -10,9 +10,9 @@ import org.bukkit.event.entity.EntityDamageEvent;
public class EntityFallingBlock extends Entity {
- public int id;
+ public Block id; // CraftBukkit - private -> public
public int data;
- public int c;
+ public int b;
public boolean dropItem;
private boolean f;
private boolean hurtEntities;
@@ -27,18 +27,18 @@ public class EntityFallingBlock extends Entity {
this.fallHurtAmount = 2.0F;
}
- public EntityFallingBlock(World world, double d0, double d1, double d2, int i) {
- this(world, d0, d1, d2, i, 0);
+ public EntityFallingBlock(World world, double d0, double d1, double d2, Block block) {
+ this(world, d0, d1, d2, block, 0);
}
- public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int j) {
+ public EntityFallingBlock(World world, double d0, double d1, double d2, Block block, int i) {
super(world);
this.dropItem = true;
this.fallHurtMax = 40;
this.fallHurtAmount = 2.0F;
- this.id = i;
- this.data = j;
- this.m = true;
+ this.id = block;
+ this.data = i;
+ this.l = true;
this.a(0.98F, 0.98F);
this.height = this.length / 2.0F;
this.setPosition(d0, d1, d2);
@@ -50,24 +50,24 @@ public class EntityFallingBlock extends Entity {
this.lastZ = d2;
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
- protected void a() {}
+ protected void c() {}
- public boolean L() {
+ public boolean R() {
return !this.dead;
}
- public void l_() {
- if (this.id == 0) {
+ public void h() {
+ if (this.id.getMaterial() == Material.AIR) {
this.die();
} else {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
- ++this.c;
+ ++this.b;
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.9800000190734863D;
@@ -78,9 +78,9 @@ public class EntityFallingBlock extends Entity {
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- if (this.c == 1) {
+ if (this.b == 1) {
// CraftBukkit - compare data and call event
- if (this.c != 1 || this.world.getTypeId(i, j, k) != this.id || this.world.getData(i, j, k) != this.data || CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, 0, 0).isCancelled()) {
+ if (this.b != 1 || this.world.getType(i, j, k) != this.id || this.world.getData(i, j, k) != this.data || CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, Blocks.AIR, 0).isCancelled()) {
this.die();
return;
}
@@ -92,21 +92,21 @@ public class EntityFallingBlock extends Entity {
this.motX *= 0.699999988079071D;
this.motZ *= 0.699999988079071D;
this.motY *= -0.5D;
- if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
+ if (this.world.getType(i, j, k) != Blocks.PISTON_MOVING) {
this.die();
// CraftBukkit start
- if (!this.f && this.world.mayPlace(this.id, i, j, k, true, 1, (Entity) null, (ItemStack) null) && !BlockSand.canFall(this.world, i, j - 1, k) /* mimic the false conditions of setTypeIdAndData */ && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j > 0 && j < 256 && !(this.world.getTypeId(i, j, k) == this.id && this.world.getData(i, j, k) == this.data)) {
+ if (!this.f && this.world.mayPlace(this.id, i, j, k, true, 1, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, i, j - 1, k) /* mimic the false conditions of setTypeIdAndData */ && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j > 0 && j < 256 && !(this.world.getType(i, j, k) == this.id && this.world.getData(i, j, k) == this.data)) {
if (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.id, this.data).isCancelled()) {
return;
}
- this.world.setTypeIdAndData(i, j, k, this.id, this.data, 3);
+ this.world.setTypeAndData(i, j, k, this.id, this.data, 3);
// CraftBukkit end
- if (Block.byId[this.id] instanceof BlockSand) {
- ((BlockSand) Block.byId[this.id]).a_(this.world, i, j, k, this.data);
+ if (this.id instanceof BlockFalling) {
+ ((BlockFalling) this.id).a(this.world, i, j, k, this.data);
}
- if (this.tileEntityData != null && Block.byId[this.id] instanceof IContainer) {
+ if (this.tileEntityData != null && this.id instanceof IContainer) {
TileEntity tileentity = this.world.getTileEntity(i, j, k);
if (tileentity != null) {
@@ -116,10 +116,11 @@ public class EntityFallingBlock extends Entity {
Iterator iterator = this.tileEntityData.c().iterator();
while (iterator.hasNext()) {
- NBTBase nbtbase = (NBTBase) iterator.next();
+ String s = (String) iterator.next();
+ NBTBase nbtbase = this.tileEntityData.get(s);
- if (!nbtbase.getName().equals("x") && !nbtbase.getName().equals("y") && !nbtbase.getName().equals("z")) {
- nbttagcompound.set(nbtbase.getName(), nbtbase.clone());
+ if (!s.equals("x") && !s.equals("y") && !s.equals("z")) {
+ nbttagcompound.set(s, nbtbase.clone());
}
}
@@ -128,12 +129,12 @@ public class EntityFallingBlock extends Entity {
}
}
} else if (this.dropItem && !this.f) {
- this.a(new ItemStack(this.id, 1, Block.byId[this.id].getDropData(this.data)), 0.0F);
+ this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
}
}
- } else if (this.c > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.c > 600) {
+ } else if (this.b > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.b > 600) {
if (this.dropItem) {
- this.a(new ItemStack(this.id, 1, Block.byId[this.id].getDropData(this.data)), 0.0F);
+ this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
}
this.die();
@@ -148,7 +149,8 @@ public class EntityFallingBlock extends Entity {
if (i > 0) {
ArrayList arraylist = new ArrayList(this.world.getEntities(this, this.boundingBox));
- DamageSource damagesource = this.id == Block.ANVIL.id ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK;
+ boolean flag = this.id == Blocks.ANVIL;
+ DamageSource damagesource = flag ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK;
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
@@ -166,7 +168,7 @@ public class EntityFallingBlock extends Entity {
// CraftBukkit end
}
- if (this.id == Block.ANVIL.id && (double) this.random.nextFloat() < 0.05000000074505806D + (double) i * 0.05D) {
+ if (flag && (double) this.random.nextFloat() < 0.05000000074505806D + (double) i * 0.05D) {
int j = this.data >> 2;
int k = this.data & 3;
@@ -182,52 +184,46 @@ public class EntityFallingBlock extends Entity {
}
protected void b(NBTTagCompound nbttagcompound) {
- nbttagcompound.setByte("Tile", (byte) this.id);
- nbttagcompound.setInt("TileID", this.id);
+ nbttagcompound.setByte("Tile", (byte) Block.b(this.id));
+ nbttagcompound.setInt("TileID", Block.b(this.id));
nbttagcompound.setByte("Data", (byte) this.data);
- nbttagcompound.setByte("Time", (byte) this.c);
+ nbttagcompound.setByte("Time", (byte) this.b);
nbttagcompound.setBoolean("DropItem", this.dropItem);
nbttagcompound.setBoolean("HurtEntities", this.hurtEntities);
nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount);
nbttagcompound.setInt("FallHurtMax", this.fallHurtMax);
if (this.tileEntityData != null) {
- nbttagcompound.setCompound("TileEntityData", this.tileEntityData);
+ nbttagcompound.set("TileEntityData", this.tileEntityData);
}
}
protected void a(NBTTagCompound nbttagcompound) {
- if (nbttagcompound.hasKey("TileID")) {
- this.id = nbttagcompound.getInt("TileID");
+ if (nbttagcompound.hasKeyOfType("TileID", 99)) {
+ this.id = Block.e(nbttagcompound.getInt("TileID"));
} else {
- this.id = nbttagcompound.getByte("Tile") & 255;
+ this.id = Block.e(nbttagcompound.getByte("Tile") & 255);
}
this.data = nbttagcompound.getByte("Data") & 255;
- this.c = nbttagcompound.getByte("Time") & 255;
- if (nbttagcompound.hasKey("HurtEntities")) {
+ this.b = nbttagcompound.getByte("Time") & 255;
+ if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) {
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");
this.fallHurtAmount = nbttagcompound.getFloat("FallHurtAmount");
this.fallHurtMax = nbttagcompound.getInt("FallHurtMax");
- } else if (this.id == Block.ANVIL.id) {
+ } else if (this.id == Blocks.ANVIL) {
this.hurtEntities = true;
}
- if (nbttagcompound.hasKey("DropItem")) {
+ if (nbttagcompound.hasKeyOfType("DropItem", 99)) {
this.dropItem = nbttagcompound.getBoolean("DropItem");
}
- if (nbttagcompound.hasKey("TileEntityData")) {
+ if (nbttagcompound.hasKeyOfType("TileEntityData", 10)) {
this.tileEntityData = nbttagcompound.getCompound("TileEntityData");
}
- // CraftBukkit start - Backward compatibility, remove in 1.6
- if (nbttagcompound.hasKey("Bukkit.tileData")) {
- this.tileEntityData = (NBTTagCompound) nbttagcompound.getCompound("Bukkit.tileData").clone();
- }
- // CraftBukkit end
-
- if (this.id == 0) {
- this.id = Block.SAND.id;
+ if (this.id.getMaterial() == Material.AIR) {
+ this.id = Blocks.SAND;
}
}
@@ -237,7 +233,11 @@ public class EntityFallingBlock extends Entity {
public void a(CrashReportSystemDetails crashreportsystemdetails) {
super.a(crashreportsystemdetails);
- crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(this.id));
+ crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(Block.b(this.id)));
crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data));
}
+
+ public Block f() {
+ return this.id;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index 23510bff38..6915c37499 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -7,7 +7,7 @@ public abstract class EntityFireball extends Entity {
private int e = -1;
private int f = -1;
private int g = -1;
- private int h;
+ private Block h;
private boolean i;
public EntityLiving shooter;
private int j;
@@ -23,7 +23,7 @@ public abstract class EntityFireball extends Entity {
this.a(1.0F, 1.0F);
}
- protected void a() {}
+ protected void c() {}
public EntityFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
super(world);
@@ -61,16 +61,14 @@ public abstract class EntityFireball extends Entity {
this.dirZ = d2 / d3 * 0.1D;
}
- public void l_() {
+ 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.l_();
+ super.h();
this.setOnFire(1);
if (this.i) {
- int i = this.world.getTypeId(this.e, this.f, this.g);
-
- if (i == this.h) {
+ if (this.world.getType(this.e, this.f, this.g) == this.h) {
++this.j;
if (this.j == 600) {
this.die();
@@ -103,10 +101,10 @@ public abstract class EntityFireball extends Entity {
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;
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity1 = (Entity) list.get(i);
- if (entity1.L() && (!entity1.h(this.shooter) || this.au >= 25)) {
+ if (entity1.R() && (!entity1.h(this.shooter) || this.au >= 25)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -161,10 +159,10 @@ public abstract class EntityFireball extends Entity {
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
- float f2 = this.c();
+ float f2 = this.e();
- if (this.H()) {
- for (int k = 0; k < 4; ++k) {
+ if (this.M()) {
+ for (int j = 0; j < 4; ++j) {
float f3 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
@@ -184,7 +182,7 @@ public abstract class EntityFireball extends Entity {
}
}
- protected float c() {
+ protected float e() {
return 0.95F;
}
@@ -194,7 +192,7 @@ public abstract class EntityFireball extends Entity {
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("inTile", (byte) Block.b(this.h));
nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
// CraftBukkit - Fix direction being mismapped to invalid variables
nbttagcompound.set("power", this.a(new double[] { this.dirX, this.dirY, this.dirZ}));
@@ -204,26 +202,26 @@ public abstract class EntityFireball extends Entity {
this.e = nbttagcompound.getShort("xTile");
this.f = nbttagcompound.getShort("yTile");
this.g = nbttagcompound.getShort("zTile");
- this.h = nbttagcompound.getByte("inTile") & 255;
+ this.h = Block.e(nbttagcompound.getByte("inTile") & 255);
this.i = nbttagcompound.getByte("inGround") == 1;
// CraftBukkit start - direction -> power
- if (nbttagcompound.hasKey("power")) {
- NBTTagList nbttaglist = nbttagcompound.getList("power");
+ if (nbttagcompound.hasKeyOfType("power", 9)) {
+ NBTTagList nbttaglist = nbttagcompound.getList("power", 6);
- this.dirX = ((NBTTagDouble) nbttaglist.get(0)).data;
- this.dirY = ((NBTTagDouble) nbttaglist.get(1)).data;
- this.dirZ = ((NBTTagDouble) nbttaglist.get(2)).data;
+ this.dirX = nbttaglist.d(0);
+ this.dirY = nbttaglist.d(1);
+ this.dirZ = nbttaglist.d(2);
// CraftBukkit end
} else {
this.die();
}
}
- public boolean L() {
+ public boolean R() {
return true;
}
- public float Z() {
+ public float af() {
return 1.0F;
}
@@ -231,9 +229,9 @@ public abstract class EntityFireball extends Entity {
if (this.isInvulnerable()) {
return false;
} else {
- this.K();
+ this.Q();
if (damagesource.getEntity() != null) {
- Vec3D vec3d = damagesource.getEntity().aa();
+ Vec3D vec3d = damagesource.getEntity().ag();
if (vec3d != null) {
this.motX = vec3d.c;
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index dc35ae5ce0..261262ede2 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -10,7 +10,7 @@ public class EntityFireworks extends Entity {
this.a(0.25F, 0.25F);
}
- protected void a() {
+ protected void c() {
this.datawatcher.a(8, 5);
}
@@ -38,11 +38,11 @@ public class EntityFireworks extends Entity {
this.expectedLifespan = 10 * i + this.random.nextInt(6) + this.random.nextInt(7);
}
- public void l_() {
- this.U = this.locX;
- this.V = this.locY;
- this.W = this.locZ;
- super.l_();
+ public void h() {
+ this.T = this.locX;
+ this.U = this.locY;
+ this.V = this.locZ;
+ super.h();
this.motX *= 1.15D;
this.motZ *= 1.15D;
this.motY += 0.04D;
@@ -93,7 +93,7 @@ public class EntityFireworks extends Entity {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
itemstack.save(nbttagcompound1);
- nbttagcompound.setCompound("FireworksItem", nbttagcompound1);
+ nbttagcompound.set("FireworksItem", nbttagcompound1);
}
}
@@ -115,7 +115,7 @@ public class EntityFireworks extends Entity {
return super.d(f);
}
- public boolean aq() {
+ public boolean av() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index ee8fb09a60..d5d28da82c 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
// CraftBukkit start
@@ -10,33 +12,39 @@ import org.bukkit.event.player.PlayerFishEvent;
public class EntityFishingHook extends Entity {
- private int d = -1;
- private int e = -1;
- private int f = -1;
- private int g;
- private boolean h;
+ private static final List d = Arrays.asList(new PossibleFishingResult[] { (new PossibleFishingResult(new ItemStack(Items.LEATHER_BOOTS), 10)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.LEATHER), 10), new PossibleFishingResult(new ItemStack(Items.BONE), 10), new PossibleFishingResult(new ItemStack(Items.POTION), 10), new PossibleFishingResult(new ItemStack(Items.STRING), 5), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 2)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.BOWL), 10), new PossibleFishingResult(new ItemStack(Items.STICK), 5), new PossibleFishingResult(new ItemStack(Items.INK_SACK, 10, 0), 1), new PossibleFishingResult(new ItemStack(Blocks.TRIPWIRE_SOURCE), 10), new PossibleFishingResult(new ItemStack(Items.ROTTEN_FLESH), 10)});
+ private static final List e = Arrays.asList(new PossibleFishingResult[] { new PossibleFishingResult(new ItemStack(Blocks.WATER_LILY), 1), new PossibleFishingResult(new ItemStack(Items.NAME_TAG), 1), new PossibleFishingResult(new ItemStack(Items.SADDLE), 1), (new PossibleFishingResult(new ItemStack(Items.BOW), 1)).a(0.25F).a(), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 1)).a(0.25F).a(), (new PossibleFishingResult(new ItemStack(Items.BOOK), 1)).a()});
+ private static final List f = Arrays.asList(new PossibleFishingResult[] { new PossibleFishingResult(new ItemStack(Items.RAW_FISH, 1, EnumFish.COD.a()), 60), new PossibleFishingResult(new ItemStack(Items.RAW_FISH, 1, EnumFish.SALMON.a()), 25), new PossibleFishingResult(new ItemStack(Items.RAW_FISH, 1, EnumFish.CLOWNFISH.a()), 2), new PossibleFishingResult(new ItemStack(Items.RAW_FISH, 1, EnumFish.PUFFERFISH.a()), 13)});
+ private int g = -1;
+ private int h = -1;
+ private int i = -1;
+ private Block j;
+ private boolean au;
public int a;
public EntityHuman owner;
- private int i;
- private int j;
- private int au;
- public Entity hooked;
private int av;
- private double aw;
- private double ax;
- private double ay;
- private double az;
- private double aA;
+ private int aw;
+ private int ax;
+ private int ay;
+ private int az;
+ private float aA;
+ public Entity hooked;
+ private int aB;
+ private double aC;
+ private double aD;
+ private double aE;
+ private double aF;
+ private double aG;
public EntityFishingHook(World world) {
super(world);
this.a(0.25F, 0.25F);
- this.am = true;
+ this.al = true;
}
public EntityFishingHook(World world, EntityHuman entityhuman) {
super(world);
- this.am = true;
+ this.al = true;
this.owner = entityhuman;
this.owner.hookedFish = this;
this.a(0.25F, 0.25F);
@@ -54,7 +62,7 @@ public class EntityFishingHook extends Entity {
this.c(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
}
- protected void a() {}
+ protected void c() {}
public void c(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
@@ -75,27 +83,27 @@ public class EntityFishingHook 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.i = 0;
+ this.av = 0;
}
- public void l_() {
- super.l_();
- if (this.av > 0) {
- double d0 = this.locX + (this.aw - this.locX) / (double) this.av;
- double d1 = this.locY + (this.ax - this.locY) / (double) this.av;
- double d2 = this.locZ + (this.ay - this.locZ) / (double) this.av;
- double d3 = MathHelper.g(this.az - (double) this.yaw);
+ public void h() {
+ super.h();
+ if (this.aB > 0) {
+ double d0 = this.locX + (this.aC - this.locX) / (double) this.aB;
+ double d1 = this.locY + (this.aD - this.locY) / (double) this.aB;
+ double d2 = this.locZ + (this.aE - this.locZ) / (double) this.aB;
+ double d3 = MathHelper.g(this.aF - (double) this.yaw);
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.av);
- this.pitch = (float) ((double) this.pitch + (this.aA - (double) this.pitch) / (double) this.av);
- --this.av;
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.aB);
+ this.pitch = (float) ((double) this.pitch + (this.aG - (double) this.pitch) / (double) this.aB);
+ --this.aB;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
- ItemStack itemstack = this.owner.by();
+ ItemStack itemstack = this.owner.bD();
- if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
+ if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Items.FISHING_ROD || this.e(this.owner) > 1024.0D) {
this.die();
this.owner.hookedFish = null;
return;
@@ -117,26 +125,24 @@ public class EntityFishingHook extends Entity {
--this.a;
}
- if (this.h) {
- int i = this.world.getTypeId(this.d, this.e, this.f);
-
- if (i == this.g) {
- ++this.i;
- if (this.i == 1200) {
+ if (this.au) {
+ if (this.world.getType(this.g, this.h, this.i) == this.j) {
+ ++this.av;
+ if (this.av == 1200) {
this.die();
}
return;
}
- this.h = false;
+ this.au = false;
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.i = 0;
- this.j = 0;
+ this.av = 0;
+ this.aw = 0;
} else {
- ++this.j;
+ ++this.aw;
}
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
@@ -155,10 +161,10 @@ public class EntityFishingHook extends Entity {
double d5;
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity1 = (Entity) list.get(i);
- if (entity1.L() && (entity1 != this.owner || this.j >= 5)) {
+ if (entity1.R() && (entity1 != this.owner || this.aw >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -184,11 +190,11 @@ public class EntityFishingHook extends Entity {
this.hooked = movingobjectposition.entity;
}
} else {
- this.h = true;
+ this.au = true;
}
}
- if (!this.h) {
+ if (!this.au) {
this.move(this.motX, this.motY, this.motZ);
float f1 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -221,9 +227,9 @@ 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;
+ 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)) {
@@ -231,37 +237,92 @@ public class EntityFishingHook extends Entity {
}
}
- if (d6 > 0.0D) {
- if (this.au > 0) {
- --this.au;
+ if (!this.world.isStatic && d6 > 0.0D) {
+ WorldServer worldserver = (WorldServer) this.world;
+ int k = 1;
+
+ if (this.random.nextFloat() < 0.25F && this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
+ k = 2;
+ }
+
+ if (this.random.nextFloat() < 0.5F && !this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
+ --k;
+ }
+
+ if (this.ax > 0) {
+ --this.ax;
+ if (this.ax <= 0) {
+ this.ay = 0;
+ this.az = 0;
+ }
} else {
- if (random.nextDouble() < ((org.bukkit.entity.Fish) this.getBukkitEntity()).getBiteChance()) { // CraftBukkit - moved logic to CraftFish
- this.au = this.random.nextInt(30) + 10;
- this.motY -= 0.20000000298023224D;
- this.makeSound("random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
- float f3 = (float) MathHelper.floor(this.boundingBox.b);
+ float f3;
+ double d9;
+ float f4;
+ float f5;
+ double d10;
+ double d11;
- float f4;
- int l;
- float f5;
+ if (this.az > 0) {
+ this.az -= k;
+ if (this.az <= 0) {
+ this.motY -= 0.20000000298023224D;
+ this.makeSound("random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
+ f4 = (float) MathHelper.floor(this.boundingBox.b);
+ worldserver.a("bubble", this.locX, (double) (f4 + 1.0F), this.locZ, (int) (1.0F + this.width * 20.0F), (double) this.width, 0.0D, (double) this.width, 0.20000000298023224D);
+ worldserver.a("wake", this.locX, (double) (f4 + 1.0F), this.locZ, (int) (1.0F + this.width * 20.0F), (double) this.width, 0.0D, (double) this.width, 0.20000000298023224D);
+ this.ax = MathHelper.nextInt(this.random, 10, 30);
+ } else {
+ this.aA = (float) ((double) this.aA + this.random.nextGaussian() * 4.0D);
+ f4 = this.aA * 0.017453292F;
+ f5 = MathHelper.sin(f4);
+ f3 = MathHelper.cos(f4);
+ d9 = this.locX + (double) (f5 * (float) this.az * 0.1F);
+ d11 = (double) ((float) MathHelper.floor(this.boundingBox.b) + 1.0F);
+ d10 = this.locZ + (double) (f3 * (float) this.az * 0.1F);
+ if (this.random.nextFloat() < 0.15F) {
+ worldserver.a("bubble", d9, d11 - 0.10000000149011612D, d10, 1, (double) f5, 0.1D, (double) f3, 0.0D);
+ }
- for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
- f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- this.world.addParticle("bubble", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
+ float f6 = f5 * 0.04F;
+ float f7 = f3 * 0.04F;
+
+ worldserver.a("wake", d9, d11, d10, 0, (double) f7, 0.01D, (double) (-f6), 1.0D);
+ worldserver.a("wake", d9, d11, d10, 0, (double) (-f7), 0.01D, (double) f6, 1.0D);
+ }
+ } else if (this.ay > 0) {
+ this.ay -= k;
+ f4 = 0.15F;
+ if (this.ay < 20) {
+ f4 = (float) ((double) f4 + (double) (20 - this.ay) * 0.05D);
+ } else if (this.ay < 40) {
+ f4 = (float) ((double) f4 + (double) (40 - this.ay) * 0.02D);
+ } else if (this.ay < 60) {
+ f4 = (float) ((double) f4 + (double) (60 - this.ay) * 0.01D);
}
- for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
- f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
- this.world.addParticle("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ);
+ if (this.random.nextFloat() < f4) {
+ f5 = MathHelper.a(this.random, 0.0F, 360.0F) * 0.017453292F;
+ f3 = MathHelper.a(this.random, 25.0F, 60.0F);
+ d9 = this.locX + (double) (MathHelper.sin(f5) * f3 * 0.1F);
+ d11 = (double) ((float) MathHelper.floor(this.boundingBox.b) + 1.0F);
+ d10 = this.locZ + (double) (MathHelper.cos(f5) * f3 * 0.1F);
+ worldserver.a("splash", d9, d11, d10, 2 + this.random.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D);
}
+
+ if (this.ay <= 0) {
+ this.aA = MathHelper.a(this.random, 0.0F, 360.0F);
+ this.az = MathHelper.nextInt(this.random, 20, 80);
+ }
+ } else {
+ this.ay = MathHelper.nextInt(this.random, 100, 900);
+ this.ay -= EnchantmentManager.getLureEnchantmentLevel(this.owner) * 20 * 5;
}
}
- }
- if (this.au > 0) {
- this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
+ if (this.ax > 0) {
+ this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
+ }
}
d5 = d6 * 2.0D - 1.0D;
@@ -280,24 +341,24 @@ public class EntityFishingHook extends Entity {
}
public void b(NBTTagCompound nbttagcompound) {
- 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.setShort("xTile", (short) this.g);
+ nbttagcompound.setShort("yTile", (short) this.h);
+ nbttagcompound.setShort("zTile", (short) this.i);
+ nbttagcompound.setByte("inTile", (byte) Block.b(this.j));
nbttagcompound.setByte("shake", (byte) this.a);
- nbttagcompound.setByte("inGround", (byte) (this.h ? 1 : 0));
+ nbttagcompound.setByte("inGround", (byte) (this.au ? 1 : 0));
}
public void a(NBTTagCompound nbttagcompound) {
- this.d = nbttagcompound.getShort("xTile");
- this.e = nbttagcompound.getShort("yTile");
- this.f = nbttagcompound.getShort("zTile");
- this.g = nbttagcompound.getByte("inTile") & 255;
+ this.g = nbttagcompound.getShort("xTile");
+ this.h = nbttagcompound.getShort("yTile");
+ this.i = nbttagcompound.getShort("zTile");
+ this.j = Block.e(nbttagcompound.getByte("inTile") & 255);
this.a = nbttagcompound.getByte("shake") & 255;
- this.h = nbttagcompound.getByte("inGround") == 1;
+ this.au = nbttagcompound.getByte("inGround") == 1;
}
- public int c() {
+ public int e() {
if (this.world.isStatic) {
return 0;
} else {
@@ -325,8 +386,8 @@ public class EntityFishingHook extends Entity {
this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
this.hooked.motZ += d2 * d4;
b0 = 3;
- } else if (this.au > 0) {
- EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
+ } else if (this.ax > 0) {
+ EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, this.f());
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
@@ -349,13 +410,12 @@ public class EntityFishingHook extends Entity {
entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
entityitem.motZ = d7 * d9;
this.world.addEntity(entityitem);
- this.owner.a(StatisticList.B, 1);
// CraftBukkit - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
- this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop()));
+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(6) + 1));
b0 = 1;
}
- if (this.h) {
+ if (this.au) {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND);
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
@@ -383,6 +443,32 @@ public class EntityFishingHook extends Entity {
}
}
+ private ItemStack f() {
+ float f = this.world.random.nextFloat();
+ int i = EnchantmentManager.getLuckEnchantmentLevel(this.owner);
+ int j = EnchantmentManager.getLureEnchantmentLevel(this.owner);
+ float f1 = 0.1F - (float) i * 0.025F - (float) j * 0.01F;
+ float f2 = 0.05F + (float) i * 0.01F - (float) j * 0.01F;
+
+ f1 = MathHelper.a(f1, 0.0F, 1.0F);
+ f2 = MathHelper.a(f2, 0.0F, 1.0F);
+ if (f < f1) {
+ this.owner.a(StatisticList.A, 1);
+ return ((PossibleFishingResult) WeightedRandom.a(this.random, (Collection) d)).a(this.random);
+ } else {
+ f -= f1;
+ if (f < f2) {
+ this.owner.a(StatisticList.B, 1);
+ return ((PossibleFishingResult) WeightedRandom.a(this.random, (Collection) e)).a(this.random);
+ } else {
+ float f3 = f - f2;
+
+ this.owner.a(StatisticList.z, 1);
+ return ((PossibleFishingResult) WeightedRandom.a(this.random, (Collection) EntityFishingHook.f)).a(this.random); // CraftBukkit - fix static reference to fish list
+ }
+ }
+ }
+
public void die() {
super.die();
if (this.owner != null) {
diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java
index a2c215e1d9..982e434974 100644
--- a/src/main/java/net/minecraft/server/EntityGhast.java
+++ b/src/main/java/net/minecraft/server/EntityGhast.java
@@ -28,31 +28,31 @@ public class EntityGhast extends EntityFlying implements IMonster {
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
- } else if ("fireball".equals(damagesource.n()) && damagesource.getEntity() instanceof EntityHuman) {
+ } else if ("fireball".equals(damagesource.p()) && damagesource.getEntity() instanceof EntityHuman) {
super.damageEntity(damagesource, 1000.0F);
- ((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.y);
+ ((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.z);
return true;
} else {
return super.damageEntity(damagesource, f);
}
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
}
- protected void bl() {
- if (!this.world.isStatic && this.world.difficulty == 0) {
+ protected void bq() {
+ if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL) {
this.die();
}
- this.u();
+ this.w();
this.bo = this.bp;
double d0 = this.i - this.locX;
double d1 = this.j - this.locY;
@@ -181,20 +181,20 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true;
}
- protected String r() {
+ protected String t() {
return "mob.ghast.moan";
}
- protected String aO() {
+ protected String aT() {
return "mob.ghast.scream";
}
- protected String aP() {
+ protected String aU() {
return "mob.ghast.death";
}
- protected int getLootId() {
- return Item.SULPHUR.id;
+ protected Item getLoot() {
+ return Items.SULPHUR;
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -205,28 +205,28 @@ public class EntityGhast extends EntityFlying implements IMonster {
int k;
if (j > 0) {
- loot.add(CraftItemStack.asNewCraftStack(Item.GHAST_TEAR, j));
+ loot.add(CraftItemStack.asNewCraftStack(Items.GHAST_TEAR, j));
}
j = this.random.nextInt(3) + this.random.nextInt(1 + i);
if (j > 0) {
- loot.add(CraftItemStack.asNewCraftStack(Item.SULPHUR, j));
+ loot.add(CraftItemStack.asNewCraftStack(Items.SULPHUR, j));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
- protected float ba() {
+ protected float bf() {
return 10.0F;
}
public boolean canSpawn() {
- return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
+ return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty != EnumDifficulty.PEACEFUL;
}
- public int bv() {
+ public int bz() {
return 1;
}
@@ -237,7 +237,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- if (nbttagcompound.hasKey("ExplosionPower")) {
+ if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) {
this.explosionPower = nbttagcompound.getInt("ExplosionPower");
}
}
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java
index 86c5302ff1..4de0b17b36 100644
--- a/src/main/java/net/minecraft/server/EntityHanging.java
+++ b/src/main/java/net/minecraft/server/EntityHanging.java
@@ -31,14 +31,14 @@ public abstract class EntityHanging extends Entity {
this.z = k;
}
- protected void a() {}
+ protected void c() {}
public void setDirection(int i) {
this.direction = i;
this.lastYaw = this.yaw = (float) (i * 90);
- float f = (float) this.d();
- float f1 = (float) this.e();
- float f2 = (float) this.d();
+ float f = (float) this.f();
+ float f1 = (float) this.i();
+ float f2 = (float) this.f();
if (i != 2 && i != 0) {
f = 0.5F;
@@ -72,22 +72,22 @@ public abstract class EntityHanging extends Entity {
}
if (i == 2) {
- f3 -= this.c(this.d());
+ f3 -= this.c(this.f());
}
if (i == 1) {
- f5 += this.c(this.d());
+ f5 += this.c(this.f());
}
if (i == 0) {
- f3 += this.c(this.d());
+ f3 += this.c(this.f());
}
if (i == 3) {
- f5 -= this.c(this.d());
+ f5 -= this.c(this.f());
}
- f4 += this.c(this.e());
+ f4 += this.c(this.i());
this.setPosition((double) f3, (double) f4, (double) f5);
float f7 = -0.03125F;
@@ -98,7 +98,7 @@ public abstract class EntityHanging extends Entity {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
}
- public void l_() {
+ public void h() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -106,7 +106,7 @@ public abstract class EntityHanging extends Entity {
this.e = 0;
if (!this.dead && !this.survives()) {
// CraftBukkit start
- Material material = this.world.getMaterial((int) this.locX, (int) this.locY, (int) this.locZ);
+ Material material = this.world.getType((int) this.locX, (int) this.locY, (int) this.locZ).getMaterial();
HangingBreakEvent.RemoveCause cause;
if (!material.equals(Material.AIR)) {
@@ -142,38 +142,38 @@ public abstract class EntityHanging extends Entity {
if (!this.world.getCubes(this, this.boundingBox).isEmpty()) {
return false;
} else {
- int i = Math.max(1, this.d() / 16);
- int j = Math.max(1, this.e() / 16);
+ int i = Math.max(1, this.f() / 16);
+ int j = Math.max(1, this.i() / 16);
int k = this.x;
int l = this.y;
int i1 = this.z;
if (this.direction == 2) {
- k = MathHelper.floor(this.locX - (double) ((float) this.d() / 32.0F));
+ k = MathHelper.floor(this.locX - (double) ((float) this.f() / 32.0F));
}
if (this.direction == 1) {
- i1 = MathHelper.floor(this.locZ - (double) ((float) this.d() / 32.0F));
+ i1 = MathHelper.floor(this.locZ - (double) ((float) this.f() / 32.0F));
}
if (this.direction == 0) {
- k = MathHelper.floor(this.locX - (double) ((float) this.d() / 32.0F));
+ k = MathHelper.floor(this.locX - (double) ((float) this.f() / 32.0F));
}
if (this.direction == 3) {
- i1 = MathHelper.floor(this.locZ - (double) ((float) this.d() / 32.0F));
+ i1 = MathHelper.floor(this.locZ - (double) ((float) this.f() / 32.0F));
}
- l = MathHelper.floor(this.locY - (double) ((float) this.e() / 32.0F));
+ l = MathHelper.floor(this.locY - (double) ((float) this.i() / 32.0F));
for (int j1 = 0; j1 < i; ++j1) {
for (int k1 = 0; k1 < j; ++k1) {
Material material;
if (this.direction != 2 && this.direction != 0) {
- material = this.world.getMaterial(this.x, l + k1, i1 + j1);
+ material = this.world.getType(this.x, l + k1, i1 + j1).getMaterial();
} else {
- material = this.world.getMaterial(k + j1, l + k1, this.z);
+ material = this.world.getType(k + j1, l + k1, this.z).getMaterial();
}
if (!material.isBuildable()) {
@@ -199,7 +199,7 @@ public abstract class EntityHanging extends Entity {
}
}
- public boolean L() {
+ public boolean R() {
return true;
}
@@ -207,6 +207,10 @@ public abstract class EntityHanging extends Entity {
return entity instanceof EntityHuman ? this.damageEntity(DamageSource.playerAttack((EntityHuman) entity), 0.0F) : false;
}
+ public void i(int i) {
+ this.world.X();
+ }
+
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
@@ -239,7 +243,7 @@ public abstract class EntityHanging extends Entity {
// CraftBukkit end
this.die();
- this.K();
+ this.Q();
this.b(damagesource.getEntity());
}
@@ -287,7 +291,7 @@ public abstract class EntityHanging extends Entity {
}
public void a(NBTTagCompound nbttagcompound) {
- if (nbttagcompound.hasKey("Direction")) {
+ if (nbttagcompound.hasKeyOfType("Direction", 99)) {
this.direction = nbttagcompound.getByte("Direction");
} else {
switch (nbttagcompound.getByte("Dir")) {
@@ -314,13 +318,13 @@ public abstract class EntityHanging extends Entity {
this.setDirection(this.direction);
}
- public abstract int d();
+ public abstract int f();
- public abstract int e();
-
- protected boolean P() {
- return false;
- }
+ public abstract int i();
public abstract void b(Entity entity);
+
+ protected boolean V() {
+ return false;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
index 3195aaf251..2477237502 100644
--- a/src/main/java/net/minecraft/server/EntityHorse.java
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
@@ -58,8 +58,8 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.loadChest();
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, Integer.valueOf(0));
this.datawatcher.a(19, Byte.valueOf((byte) 0));
this.datawatcher.a(20, Integer.valueOf(0));
@@ -69,7 +69,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public void setType(int i) {
this.datawatcher.watch(19, Byte.valueOf((byte) i));
- this.cJ();
+ this.cN();
}
public int getType() {
@@ -78,14 +78,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public void setVariant(int i) {
this.datawatcher.watch(20, Integer.valueOf(i));
- this.cJ();
+ this.cN();
}
public int getVariant() {
return this.datawatcher.getInt(20);
}
- public String getLocalizedName() {
+ public String getName() {
if (this.hasCustomName()) {
return this.getCustomName();
} else {
@@ -111,7 +111,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- private boolean w(int i) {
+ private boolean x(int i) {
return (this.datawatcher.getInt(16) & i) != 0;
}
@@ -125,16 +125,16 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- public boolean bV() {
+ public boolean bZ() {
return !this.isBaby();
}
public boolean isTame() {
- return this.w(2);
+ return this.x(2);
}
- public boolean ca() {
- return this.bV();
+ public boolean ce() {
+ return this.bZ();
}
public String getOwnerName() {
@@ -145,7 +145,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.datawatcher.watch(21, s);
}
- public float cc() {
+ public float cg() {
int i = this.getAge();
return i >= 0 ? 1.0F : 0.5F + (float) (-24000 - i) / -24000.0F * 0.5F;
@@ -153,13 +153,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public void a(boolean flag) {
if (flag) {
- this.a(this.cc());
+ this.a(this.cg());
} else {
this.a(1.0F);
}
}
- public boolean cd() {
+ public boolean ch() {
return this.br;
}
@@ -171,47 +171,53 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.br = flag;
}
- public boolean bG() {
- return !this.cy() && super.bG();
+ public boolean bK() {
+ return !this.cC() && super.bK();
}
protected void o(float f) {
- if (f > 6.0F && this.cg()) {
+ if (f > 6.0F && this.ck()) {
this.o(false);
}
}
public boolean hasChest() {
- return this.w(8);
+ return this.x(8);
}
- public int cf() {
+ public int cj() {
return this.datawatcher.getInt(22);
}
- public int d(ItemStack itemstack) {
- return itemstack == null ? 0 : (itemstack.id == Item.HORSE_ARMOR_IRON.id ? 1 : (itemstack.id == Item.HORSE_ARMOR_GOLD.id ? 2 : (itemstack.id == Item.HORSE_ARMOR_DIAMOND.id ? 3 : 0)));
+ private int e(ItemStack itemstack) {
+ if (itemstack == null) {
+ return 0;
+ } else {
+ Item item = itemstack.getItem();
+
+ return item == Items.HORSE_ARMOR_IRON ? 1 : (item == Items.HORSE_ARMOR_GOLD ? 2 : (item == Items.HORSE_ARMOR_DIAMOND ? 3 : 0));
+ }
}
- public boolean cg() {
- return this.w(32);
+ public boolean ck() {
+ return this.x(32);
}
- public boolean ch() {
- return this.w(64);
+ public boolean cl() {
+ return this.x(64);
}
- public boolean ci() {
- return this.w(16);
+ public boolean cm() {
+ return this.x(16);
}
- public boolean cj() {
+ public boolean cn() {
return this.bH;
}
- public void r(int i) {
- this.datawatcher.watch(22, Integer.valueOf(i));
- this.cJ();
+ public void d(ItemStack itemstack) {
+ this.datawatcher.watch(22, Integer.valueOf(this.e(itemstack)));
+ this.cN();
}
public void k(boolean flag) {
@@ -238,7 +244,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.bs = i;
}
- public int t(int i) {
+ public int v(int i) {
int j = MathHelper.a(this.getTemper() + i, 0, this.getMaxDomestication());
this.setTemper(j);
@@ -251,15 +257,15 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return this.passenger != null && this.passenger.equals(entity) ? false : super.damageEntity(damagesource, f);
}
- public int aQ() {
- return by[this.cf()];
+ public int aV() {
+ return by[this.cj()];
}
- public boolean M() {
+ public boolean S() {
return this.passenger == null;
}
- public boolean cl() {
+ public boolean cp() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
@@ -267,15 +273,15 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return true;
}
- public void cm() {
+ public void cq() {
if (!this.world.isStatic && this.hasChest()) {
- this.b(Block.CHEST.id, 1);
+ this.a(Item.getItemOf(Blocks.CHEST), 1);
this.setHasChest(false);
}
}
- private void cF() {
- this.cM();
+ private void cJ() {
+ this.cQ();
this.world.makeSound(this, "eating", 1.0F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
}
@@ -309,17 +315,17 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
// CraftBukkit end
}
- int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw), MathHelper.floor(this.locZ));
+ Block block = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw), MathHelper.floor(this.locZ));
- if (j > 0) {
- StepSound stepsound = Block.byId[j].stepSound;
+ if (block.getMaterial() != Material.AIR) {
+ StepSound stepsound = block.stepSound;
this.world.makeSound(this, stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F);
}
}
}
- private int cG() {
+ private int cK() {
int i = this.getType();
return this.hasChest() /* && (i == 1 || i == 2) */ ? 17 : 2; // CraftBukkit - Remove type check
@@ -328,8 +334,8 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public void loadChest() { // CraftBukkit - private -> public
InventoryHorseChest inventoryhorsechest = this.inventoryChest;
- this.inventoryChest = new InventoryHorseChest("HorseChest", this.cG(), this); // CraftBukkit - add this horse
- this.inventoryChest.a(this.getLocalizedName());
+ this.inventoryChest = new InventoryHorseChest("HorseChest", this.cK(), this); // CraftBukkit - add this horse
+ this.inventoryChest.a(this.getName());
if (inventoryhorsechest != null) {
inventoryhorsechest.b(this);
int i = Math.min(inventoryhorsechest.getSize(), this.inventoryChest.getSize());
@@ -346,36 +352,38 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
this.inventoryChest.a(this);
- this.cI();
+ this.cM();
}
- private void cI() {
+ private void cM() {
if (!this.world.isStatic) {
this.n(this.inventoryChest.getItem(0) != null);
- if (this.cv()) {
- this.r(this.d(this.inventoryChest.getItem(1)));
+ if (this.cz()) {
+ this.d(this.inventoryChest.getItem(1));
}
}
}
public void a(InventorySubcontainer inventorysubcontainer) {
- int i = this.cf();
- boolean flag = this.co();
+ int i = this.cj();
+ boolean flag = this.cs();
- this.cI();
+ this.cM();
if (this.ticksLived > 20) {
- if (i == 0 && i != this.cf()) {
+ if (i == 0 && i != this.cj()) {
+ this.makeSound("mob.horse.armor", 0.5F, 1.0F);
+ } else if (i != this.cj()) {
this.makeSound("mob.horse.armor", 0.5F, 1.0F);
}
- if (!flag && this.co()) {
+ if (!flag && this.cs()) {
this.makeSound("mob.horse.leather", 0.5F, 1.0F);
}
}
}
public boolean canSpawn() {
- this.cl();
+ this.cp();
return super.canSpawn();
}
@@ -402,24 +410,24 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return this.getAttributeInstance(attributeJumpStrength).getValue();
}
- protected String aP() {
- this.cM();
+ protected String aU() {
+ this.cQ();
int i = this.getType();
return i == 3 ? "mob.horse.zombie.death" : (i == 4 ? "mob.horse.skeleton.death" : (i != 1 && i != 2 ? "mob.horse.death" : "mob.horse.donkey.death"));
}
- protected int getLootId() {
+ protected Item getLoot() {
boolean flag = this.random.nextInt(4) == 0;
int i = this.getType();
- return i == 4 ? Item.BONE.id : (i == 3 ? (flag ? 0 : Item.ROTTEN_FLESH.id) : Item.LEATHER.id);
+ return i == 4 ? Items.BONE : (i == 3 ? (flag ? Item.d(0) : Items.ROTTEN_FLESH) : Items.LEATHER);
}
- protected String aO() {
- this.cM();
+ protected String aT() {
+ this.cQ();
if (this.random.nextInt(3) == 0) {
- this.cO();
+ this.cS();
}
int i = this.getType();
@@ -427,14 +435,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return i == 3 ? "mob.horse.zombie.hit" : (i == 4 ? "mob.horse.skeleton.hit" : (i != 1 && i != 2 ? "mob.horse.hit" : "mob.horse.donkey.hit"));
}
- public boolean co() {
- return this.w(4);
+ public boolean cs() {
+ return this.x(4);
}
- protected String r() {
- this.cM();
- if (this.random.nextInt(10) == 0 && !this.bc()) {
- this.cO();
+ protected String t() {
+ this.cQ();
+ if (this.random.nextInt(10) == 0 && !this.bh()) {
+ this.cS();
}
int i = this.getType();
@@ -442,50 +450,50 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return i == 3 ? "mob.horse.zombie.idle" : (i == 4 ? "mob.horse.skeleton.idle" : (i != 1 && i != 2 ? "mob.horse.idle" : "mob.horse.donkey.idle"));
}
- protected String cp() {
- this.cM();
- this.cO();
+ protected String ct() {
+ this.cQ();
+ this.cS();
int i = this.getType();
return i != 3 && i != 4 ? (i != 1 && i != 2 ? "mob.horse.angry" : "mob.horse.donkey.angry") : null;
}
- protected void a(int i, int j, int k, int l) {
- StepSound stepsound = Block.byId[l].stepSound;
+ protected void a(int i, int j, int k, Block block) {
+ StepSound stepsound = block.stepSound;
- if (this.world.getTypeId(i, j + 1, k) == Block.SNOW.id) {
- stepsound = Block.SNOW.stepSound;
+ if (this.world.getType(i, j + 1, k) == Blocks.SNOW) {
+ stepsound = Blocks.SNOW.stepSound;
}
- if (!Block.byId[l].material.isLiquid()) {
- int i1 = this.getType();
+ if (!block.getMaterial().isLiquid()) {
+ int l = this.getType();
- if (this.passenger != null && i1 != 1 && i1 != 2) {
+ if (this.passenger != null && l != 1 && l != 2) {
++this.bP;
if (this.bP > 5 && this.bP % 3 == 0) {
this.makeSound("mob.horse.gallop", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
- if (i1 == 0 && this.random.nextInt(10) == 0) {
+ if (l == 0 && this.random.nextInt(10) == 0) {
this.makeSound("mob.horse.breathe", stepsound.getVolume1() * 0.6F, stepsound.getVolume2());
}
} else if (this.bP <= 5) {
this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
}
- } else if (stepsound == Block.h) {
- this.makeSound("mob.horse.soft", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
- } else {
+ } else if (stepsound == Block.f) {
this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
+ } else {
+ this.makeSound("mob.horse.soft", stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
}
}
}
- protected void az() {
- super.az();
- this.aX().b(attributeJumpStrength);
+ protected void aD() {
+ super.aD();
+ this.bc().b(attributeJumpStrength);
this.getAttributeInstance(GenericAttributes.a).setValue(53.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.22499999403953552D);
}
- public int bv() {
+ public int bz() {
return 6;
}
@@ -493,21 +501,21 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100
}
- protected float ba() {
+ protected float bf() {
return 0.8F;
}
- public int o() {
+ public int q() {
return 400;
}
- private void cJ() {
+ private void cN() {
this.bQ = null;
}
- public void f(EntityHuman entityhuman) {
+ public void g(EntityHuman entityhuman) {
if (!this.world.isStatic && (this.passenger == null || this.passenger == entityhuman) && this.isTame()) {
- this.inventoryChest.a(this.getLocalizedName());
+ this.inventoryChest.a(this.getName());
entityhuman.openHorseInventory(this, this.inventoryChest);
}
}
@@ -515,80 +523,80 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id) {
+ if (itemstack != null && itemstack.getItem() == Items.MONSTER_EGG) {
return super.a(entityhuman);
- } else if (!this.isTame() && this.cy()) {
+ } else if (!this.isTame() && this.cC()) {
return false;
- } else if (this.isTame() && this.bV() && entityhuman.isSneaking()) {
- this.f(entityhuman);
+ } else if (this.isTame() && this.bZ() && entityhuman.isSneaking()) {
+ this.g(entityhuman);
return true;
- } else if (this.ca() && this.passenger != null) {
+ } else if (this.ce() && this.passenger != null) {
return super.a(entityhuman);
} else {
if (itemstack != null) {
boolean flag = false;
- if (this.cv()) {
+ if (this.cz()) {
byte b0 = -1;
- if (itemstack.id == Item.HORSE_ARMOR_IRON.id) {
+ if (itemstack.getItem() == Items.HORSE_ARMOR_IRON) {
b0 = 1;
- } else if (itemstack.id == Item.HORSE_ARMOR_GOLD.id) {
+ } else if (itemstack.getItem() == Items.HORSE_ARMOR_GOLD) {
b0 = 2;
- } else if (itemstack.id == Item.HORSE_ARMOR_DIAMOND.id) {
+ } else if (itemstack.getItem() == Items.HORSE_ARMOR_DIAMOND) {
b0 = 3;
}
if (b0 >= 0) {
if (!this.isTame()) {
- this.cD();
+ this.cH();
return true;
}
- this.f(entityhuman);
+ this.g(entityhuman);
return true;
}
}
- if (!flag && !this.cy()) {
+ if (!flag && !this.cC()) {
float f = 0.0F;
short short1 = 0;
byte b1 = 0;
- if (itemstack.id == Item.WHEAT.id) {
+ if (itemstack.getItem() == Items.WHEAT) {
f = 2.0F;
short1 = 60;
b1 = 3;
- } else if (itemstack.id == Item.SUGAR.id) {
+ } else if (itemstack.getItem() == Items.SUGAR) {
f = 1.0F;
short1 = 30;
b1 = 3;
- } else if (itemstack.id == Item.BREAD.id) {
+ } else if (itemstack.getItem() == Items.BREAD) {
f = 7.0F;
short1 = 180;
b1 = 3;
- } else if (itemstack.id == Block.HAY_BLOCK.id) {
+ } else if (Block.a(itemstack.getItem()) == Blocks.HAY_BLOCK) {
f = 20.0F;
short1 = 180;
- } else if (itemstack.id == Item.APPLE.id) {
+ } else if (itemstack.getItem() == Items.APPLE) {
f = 3.0F;
short1 = 60;
b1 = 3;
- } else if (itemstack.id == Item.CARROT_GOLDEN.id) {
+ } else if (itemstack.getItem() == Items.CARROT_GOLDEN) {
f = 4.0F;
short1 = 60;
b1 = 5;
if (this.isTame() && this.getAge() == 0) {
flag = true;
- this.bX();
+ this.f(entityhuman);
}
- } else if (itemstack.id == Item.GOLDEN_APPLE.id) {
+ } else if (itemstack.getItem() == Items.GOLDEN_APPLE) {
f = 10.0F;
short1 = 240;
b1 = 10;
if (this.isTame() && this.getAge() == 0) {
flag = true;
- this.bX();
+ this.f(entityhuman);
}
}
@@ -597,18 +605,18 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
flag = true;
}
- if (!this.bV() && short1 > 0) {
+ if (!this.bZ() && short1 > 0) {
this.a(short1);
flag = true;
}
if (b1 > 0 && (flag || !this.isTame()) && b1 < this.getMaxDomestication()) {
flag = true;
- this.t(b1);
+ this.v(b1);
}
if (flag) {
- this.cF();
+ this.cJ();
}
}
@@ -617,19 +625,19 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return true;
}
- this.cD();
+ this.cH();
return true;
}
- if (!flag && this.cw() && !this.hasChest() && itemstack.id == Block.CHEST.id) {
+ if (!flag && this.cA() && !this.hasChest() && itemstack.getItem() == Item.getItemOf(Blocks.CHEST)) {
this.setHasChest(true);
this.makeSound("mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
flag = true;
this.loadChest();
}
- if (!flag && this.ca() && !this.co() && itemstack.id == Item.SADDLE.id) {
- this.f(entityhuman);
+ if (!flag && this.ce() && !this.cs() && itemstack.getItem() == Items.SADDLE) {
+ this.g(entityhuman);
return true;
}
@@ -642,11 +650,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- if (this.ca() && this.passenger == null) {
+ if (this.ce() && this.passenger == null) {
if (itemstack != null && itemstack.a(entityhuman, (EntityLiving) this)) {
return true;
} else {
- this.h(entityhuman);
+ this.i(entityhuman);
return true;
}
} else {
@@ -655,7 +663,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- private void h(EntityHuman entityhuman) {
+ private void i(EntityHuman entityhuman) {
entityhuman.yaw = this.yaw;
entityhuman.pitch = this.pitch;
this.o(false);
@@ -665,66 +673,66 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- public boolean cv() {
+ public boolean cz() {
return this.getType() == 0;
}
- public boolean cw() {
+ public boolean cA() {
int i = this.getType();
return i == 2 || i == 1;
}
- protected boolean bc() {
- return this.passenger != null && this.co() ? true : this.cg() || this.ch();
+ protected boolean bh() {
+ return this.passenger != null && this.cs() ? true : this.ck() || this.cl();
}
- public boolean cy() {
+ public boolean cC() {
int i = this.getType();
return i == 3 || i == 4;
}
- public boolean cz() {
- return this.cy() || this.getType() == 2;
+ public boolean cD() {
+ return this.cC() || this.getType() == 2;
}
public boolean c(ItemStack itemstack) {
return false;
}
- private void cL() {
+ private void cP() {
this.bp = 1;
}
public void die(DamageSource damagesource) {
super.die(damagesource);
if (!this.world.isStatic) {
- this.cE();
+ this.cI();
}
}
- public void c() {
+ public void e() {
if (this.random.nextInt(200) == 0) {
- this.cL();
+ this.cP();
}
- super.c();
+ super.e();
if (!this.world.isStatic) {
if (this.random.nextInt(900) == 0 && this.deathTicks == 0) {
this.heal(1.0F);
}
- if (!this.cg() && this.passenger == null && this.random.nextInt(300) == 0 && this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ)) == Block.GRASS.id) {
+ if (!this.ck() && this.passenger == null && this.random.nextInt(300) == 0 && this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ)) == Blocks.GRASS) {
this.o(true);
}
- if (this.cg() && ++this.bD > 50) {
+ if (this.ck() && ++this.bD > 50) {
this.bD = 0;
this.o(false);
}
- if (this.ci() && !this.bV() && !this.cg()) {
+ if (this.cm() && !this.bZ() && !this.ck()) {
EntityHorse entityhorse = this.a(this, 16.0D);
if (entityhorse != null && this.e(entityhorse) > 4.0D) {
@@ -736,11 +744,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- public void l_() {
- super.l_();
+ public void h() {
+ super.h();
if (this.world.isStatic && this.datawatcher.a()) {
this.datawatcher.e();
- this.cJ();
+ this.cN();
}
if (this.bE > 0 && ++this.bE > 30) {
@@ -765,7 +773,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
this.bK = this.bJ;
- if (this.cg()) {
+ if (this.ck()) {
this.bJ += (1.0F - this.bJ) * 0.4F + 0.05F;
if (this.bJ > 1.0F) {
this.bJ = 1.0F;
@@ -778,7 +786,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
this.bM = this.bL;
- if (this.ch()) {
+ if (this.cl()) {
this.bK = this.bJ = 0.0F;
this.bL += (1.0F - this.bL) * 0.4F + 0.05F;
if (this.bL > 1.0F) {
@@ -793,7 +801,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
this.bO = this.bN;
- if (this.w(128)) {
+ if (this.x(128)) {
this.bN += (1.0F - this.bN) * 0.7F + 0.05F;
if (this.bN > 1.0F) {
this.bN = 1.0F;
@@ -806,15 +814,15 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- private void cM() {
+ private void cQ() {
if (!this.world.isStatic) {
this.bE = 1;
this.b(128, true);
}
}
- private boolean cN() {
- return this.passenger == null && this.vehicle == null && this.isTame() && this.bV() && !this.cz() && this.getHealth() >= this.getMaxHealth();
+ private boolean cR() {
+ return this.passenger == null && this.vehicle == null && this.isTame() && this.bZ() && !this.cD() && this.getHealth() >= this.getMaxHealth();
}
public void e(boolean flag) {
@@ -833,25 +841,25 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.b(64, flag);
}
- private void cO() {
+ private void cS() {
if (!this.world.isStatic) {
this.bF = 1;
this.p(true);
}
}
- public void cD() {
- this.cO();
- String s = this.cp();
+ public void cH() {
+ this.cS();
+ String s = this.ct();
if (s != null) {
- this.makeSound(s, this.ba(), this.bb());
+ this.makeSound(s, this.bf(), this.bg());
}
}
- public void cE() {
+ public void cI() {
this.a(this, this.inventoryChest);
- this.cm();
+ this.cq();
}
private void a(Entity entity, InventoryHorseChest inventoryhorsechest) {
@@ -866,14 +874,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
}
- public boolean g(EntityHuman entityhuman) {
+ public boolean h(EntityHuman entityhuman) {
this.setOwnerName(entityhuman.getName());
this.setTame(true);
return true;
}
public void e(float f, float f1) {
- if (this.passenger != null && this.co()) {
+ if (this.passenger != null && this.cs()) {
this.lastYaw = this.yaw = this.passenger.yaw;
this.pitch = this.passenger.pitch * 0.5F;
this.b(this.yaw, this.pitch);
@@ -885,19 +893,19 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.bP = 0;
}
- if (this.onGround && this.bt == 0.0F && this.ch() && !this.bI) {
+ if (this.onGround && this.bt == 0.0F && this.cl() && !this.bI) {
f = 0.0F;
f1 = 0.0F;
}
- if (this.bt > 0.0F && !this.cd() && this.onGround) {
+ if (this.bt > 0.0F && !this.ch() && this.onGround) {
this.motY = this.getJumpStrength() * (double) this.bt;
if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
}
this.j(true);
- this.an = true;
+ this.am = true;
if (f1 > 0.0F) {
float f2 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F);
float f3 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F);
@@ -910,8 +918,8 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.bt = 0.0F;
}
- this.Y = 1.0F;
- this.aR = this.bg() * 0.1F;
+ this.X = 1.0F;
+ this.aR = this.bl() * 0.1F;
if (!this.world.isStatic) {
this.i((float) this.getAttributeInstance(GenericAttributes.d).getValue());
super.e(f, f1);
@@ -934,7 +942,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.aG += (f4 - this.aG) * 0.4F;
this.aH += this.aG;
} else {
- this.Y = 0.5F;
+ this.X = 0.5F;
this.aR = 0.02F;
super.e(f, f1);
}
@@ -942,10 +950,10 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setBoolean("EatingHaystack", this.cg());
+ nbttagcompound.setBoolean("EatingHaystack", this.ck());
nbttagcompound.setBoolean("ChestedHorse", this.hasChest());
- nbttagcompound.setBoolean("HasReproduced", this.cj());
- nbttagcompound.setBoolean("Bred", this.ci());
+ nbttagcompound.setBoolean("HasReproduced", this.cn());
+ nbttagcompound.setBoolean("Bred", this.cm());
nbttagcompound.setInt("Type", this.getType());
nbttagcompound.setInt("Variant", this.getVariant());
nbttagcompound.setInt("Temper", this.getTemper());
@@ -971,11 +979,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
if (this.inventoryChest.getItem(1) != null) {
- nbttagcompound.set("ArmorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound("ArmorItem")));
+ nbttagcompound.set("ArmorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound()));
}
if (this.inventoryChest.getItem(0) != null) {
- nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound("SaddleItem")));
+ nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound()));
}
}
@@ -989,7 +997,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.setVariant(nbttagcompound.getInt("Variant"));
this.setTemper(nbttagcompound.getInt("Temper"));
this.setTame(nbttagcompound.getBoolean("Tame"));
- if (nbttagcompound.hasKey("OwnerName")) {
+ if (nbttagcompound.hasKeyOfType("OwnerName", 8)) {
this.setOwnerName(nbttagcompound.getString("OwnerName"));
}
// CraftBukkit start
@@ -997,19 +1005,19 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication");
}
// CraftBukkit end
- AttributeInstance attributeinstance = this.aX().a("Speed");
+ AttributeInstance attributeinstance = this.bc().a("Speed");
if (attributeinstance != null) {
this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D);
}
if (this.hasChest()) {
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
+ NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
this.loadChest();
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 2 && j < this.inventoryChest.getSize()) {
@@ -1020,23 +1028,23 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
ItemStack itemstack;
- if (nbttagcompound.hasKey("ArmorItem")) {
+ if (nbttagcompound.hasKeyOfType("ArmorItem", 10)) {
itemstack = ItemStack.createStack(nbttagcompound.getCompound("ArmorItem"));
- if (itemstack != null && v(itemstack.id)) {
+ if (itemstack != null && a(itemstack.getItem())) {
this.inventoryChest.setItem(1, itemstack);
}
}
- if (nbttagcompound.hasKey("SaddleItem")) {
+ if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) {
itemstack = ItemStack.createStack(nbttagcompound.getCompound("SaddleItem"));
- if (itemstack != null && itemstack.id == Item.SADDLE.id) {
+ if (itemstack != null && itemstack.getItem() == Items.SADDLE) {
this.inventoryChest.setItem(0, itemstack);
}
} else if (nbttagcompound.getBoolean("Saddle")) {
- this.inventoryChest.setItem(0, new ItemStack(Item.SADDLE));
+ this.inventoryChest.setItem(0, new ItemStack(Items.SADDLE));
}
- this.cI();
+ this.cM();
}
public boolean mate(EntityAnimal entityanimal) {
@@ -1047,7 +1055,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
} else {
EntityHorse entityhorse = (EntityHorse) entityanimal;
- if (this.cN() && entityhorse.cN()) {
+ if (this.cR() && entityhorse.cR()) {
int i = this.getType();
int j = entityhorse.getType();
@@ -1085,9 +1093,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
int j1 = this.random.nextInt(5);
- if (j1 < 4) {
+ if (j1 < 2) {
i1 |= this.getVariant() & '\uff00';
- } else if (j1 < 8) {
+ } else if (j1 < 4) {
i1 |= entityhorse.getVariant() & '\uff00';
} else {
i1 |= this.random.nextInt(5) << 8 & '\uff00';
@@ -1097,13 +1105,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
entityhorse1.setType(k);
- double d0 = this.getAttributeInstance(GenericAttributes.a).b() + entityageable.getAttributeInstance(GenericAttributes.a).b() + (double) this.cP();
+ double d0 = this.getAttributeInstance(GenericAttributes.a).b() + entityageable.getAttributeInstance(GenericAttributes.a).b() + (double) this.cT();
entityhorse1.getAttributeInstance(GenericAttributes.a).setValue(d0 / 3.0D);
- double d1 = this.getAttributeInstance(attributeJumpStrength).b() + entityageable.getAttributeInstance(attributeJumpStrength).b() + this.cQ();
+ double d1 = this.getAttributeInstance(attributeJumpStrength).b() + entityageable.getAttributeInstance(attributeJumpStrength).b() + this.cU();
entityhorse1.getAttributeInstance(attributeJumpStrength).setValue(d1 / 3.0D);
- double d2 = this.getAttributeInstance(GenericAttributes.d).b() + entityageable.getAttributeInstance(GenericAttributes.d).b() + this.cR();
+ double d2 = this.getAttributeInstance(GenericAttributes.d).b() + entityageable.getAttributeInstance(GenericAttributes.d).b() + this.cV();
entityhorse1.getAttributeInstance(GenericAttributes.d).setValue(d2 / 3.0D);
return entityhorse1;
@@ -1139,9 +1147,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
if (j != 4 && j != 3) {
- this.getAttributeInstance(GenericAttributes.a).setValue((double) this.cP());
+ this.getAttributeInstance(GenericAttributes.a).setValue((double) this.cT());
if (j == 0) {
- this.getAttributeInstance(GenericAttributes.d).setValue(this.cR());
+ this.getAttributeInstance(GenericAttributes.d).setValue(this.cV());
} else {
this.getAttributeInstance(GenericAttributes.d).setValue(0.17499999701976776D);
}
@@ -1151,7 +1159,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
}
if (j != 2 && j != 1) {
- this.getAttributeInstance(attributeJumpStrength).setValue(this.cQ());
+ this.getAttributeInstance(attributeJumpStrength).setValue(this.cU());
} else {
this.getAttributeInstance(attributeJumpStrength).setValue(0.5D);
}
@@ -1160,12 +1168,12 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return (GroupDataEntity) object;
}
- protected boolean bf() {
+ protected boolean bk() {
return true;
}
- public void u(int i) {
- if (this.co()) {
+ public void w(int i) {
+ if (this.cs()) {
// CraftBukkit start - fire HorseJumpEvent, use event power
if (i < 0) {
i = 0;
@@ -1181,45 +1189,45 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callHorseJumpEvent(this, power);
if (!event.isCancelled()) {
this.bI = true;
- this.cO();
+ this.cS();
this.bt = event.getPower();
}
// CraftBukkit end
}
}
- public void W() {
- super.W();
+ public void ac() {
+ super.ac();
if (this.bM > 0.0F) {
float f = MathHelper.sin(this.aN * 3.1415927F / 180.0F);
float f1 = MathHelper.cos(this.aN * 3.1415927F / 180.0F);
float f2 = 0.7F * this.bM;
float f3 = 0.15F * this.bM;
- this.passenger.setPosition(this.locX + (double) (f2 * f), this.locY + this.Y() + this.passenger.X() + (double) f3, this.locZ - (double) (f2 * f1));
+ this.passenger.setPosition(this.locX + (double) (f2 * f), this.locY + this.ae() + this.passenger.ad() + (double) f3, this.locZ - (double) (f2 * f1));
if (this.passenger instanceof EntityLiving) {
((EntityLiving) this.passenger).aN = this.aN;
}
}
}
- private float cP() {
+ private float cT() {
return 15.0F + (float) this.random.nextInt(8) + (float) this.random.nextInt(9);
}
- private double cQ() {
+ private double cU() {
return 0.4000000059604645D + this.random.nextDouble() * 0.2D + this.random.nextDouble() * 0.2D + this.random.nextDouble() * 0.2D;
}
- private double cR() {
+ private double cV() {
return (0.44999998807907104D + this.random.nextDouble() * 0.3D + this.random.nextDouble() * 0.3D + this.random.nextDouble() * 0.3D) * 0.25D;
}
- public static boolean v(int i) {
- return i == Item.HORSE_ARMOR_IRON.id || i == Item.HORSE_ARMOR_GOLD.id || i == Item.HORSE_ARMOR_DIAMOND.id;
+ public static boolean a(Item item) {
+ return item == Items.HORSE_ARMOR_IRON || item == Items.HORSE_ARMOR_GOLD || item == Items.HORSE_ARMOR_DIAMOND;
}
- public boolean e() {
+ public boolean h_() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index e4fe7703fd..c12a08ffd9 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -3,6 +3,10 @@ package net.minecraft.server;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
+
+import net.minecraft.util.com.google.common.base.Charsets;
+import net.minecraft.util.com.mojang.authlib.GameProfile;
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -22,18 +26,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
private InventoryEnderChest enderChest = new InventoryEnderChest();
public Container defaultContainer;
public Container activeContainer;
- protected FoodMetaData foodData = new FoodMetaData();
+ protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor
protected int br;
public float bs;
public float bt;
- protected final String name;
- public int bv;
+ public int bu;
+ public double bv;
public double bw;
public double bx;
public double by;
public double bz;
public double bA;
- public double bB;
// CraftBukkit start
public boolean sleeping; // protected -> public
public boolean fauxSleeping;
@@ -45,10 +48,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
- public ChunkCoordinates bD;
+ public ChunkCoordinates bC;
public int sleepTicks; // CraftBukkit - private -> public
+ public float bD;
public float bE;
- public float bF;
private ChunkCoordinates c;
private boolean d;
private ChunkCoordinates e;
@@ -59,14 +62,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public float exp;
private ItemStack f;
private int g;
- protected float bK = 0.1F;
- protected float bL = 0.02F;
+ protected float bJ = 0.1F;
+ protected float bK = 0.02F;
private int h;
+ private final GameProfile i;
public EntityFishingHook hookedFish;
- public EntityHuman(World world, String s) {
+ public EntityHuman(World world, GameProfile gameprofile) {
super(world);
- this.name = s;
+ this.uniqueID = a(gameprofile);
+ this.i = gameprofile;
this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic, this);
this.activeContainer = this.defaultContainer;
this.height = 1.62F;
@@ -77,31 +82,31 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.maxFireTicks = 20;
}
- protected void az() {
- super.az();
- this.aX().b(GenericAttributes.e).setValue(1.0D);
+ protected void aD() {
+ super.aD();
+ this.bc().b(GenericAttributes.e).setValue(1.0D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
this.datawatcher.a(17, Float.valueOf(0.0F));
this.datawatcher.a(18, Integer.valueOf(0));
}
- public boolean br() {
+ public boolean bw() {
return this.f != null;
}
- public void bt() {
+ public void by() {
if (this.f != null) {
this.f.b(this.world, this, this.g);
}
- this.bu();
+ this.bz();
}
- public void bu() {
+ public void bz() {
this.f = null;
this.g = 0;
if (!this.world.isStatic) {
@@ -110,10 +115,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public boolean isBlocking() {
- return this.br() && Item.byId[this.f.id].c_(this.f) == EnumAnimation.BLOCK;
+ return this.bw() && this.f.getItem().d(this.f) == EnumAnimation.BLOCK;
}
- public void l_() {
+ public void h() {
if (this.f != null) {
ItemStack itemstack = this.inventory.getItemInHand();
@@ -123,15 +128,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (--this.g == 0 && !this.world.isStatic) {
- this.n();
+ this.p();
}
} else {
- this.bu();
+ this.bz();
}
}
- if (this.bv > 0) {
- --this.bv;
+ if (this.bu > 0) {
+ --this.bu;
}
if (this.isSleeping()) {
@@ -141,7 +146,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (!this.world.isStatic) {
- if (!this.h()) {
+ if (!this.j()) {
this.a(true, true, false);
} else if (this.world.v()) {
this.a(false, true, true);
@@ -154,7 +159,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- super.l_();
+ super.h();
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.a(this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
@@ -164,56 +169,64 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.extinguish();
}
+ this.bv = this.by;
this.bw = this.bz;
this.bx = this.bA;
- this.by = this.bB;
- double d0 = this.locX - this.bz;
- double d1 = this.locY - this.bA;
- double d2 = this.locZ - this.bB;
+ double d0 = this.locX - this.by;
+ double d1 = this.locY - this.bz;
+ double d2 = this.locZ - this.bA;
double d3 = 10.0D;
if (d0 > d3) {
- this.bw = this.bz = this.locX;
+ this.bv = this.by = this.locX;
}
if (d2 > d3) {
- this.by = this.bB = this.locZ;
+ this.bx = this.bA = this.locZ;
}
if (d1 > d3) {
- this.bx = this.bA = this.locY;
+ this.bw = this.bz = this.locY;
}
if (d0 < -d3) {
- this.bw = this.bz = this.locX;
+ this.bv = this.by = this.locX;
}
if (d2 < -d3) {
- this.by = this.bB = this.locZ;
+ this.bx = this.bA = this.locZ;
}
if (d1 < -d3) {
- this.bx = this.bA = this.locY;
+ this.bw = this.bz = this.locY;
}
- this.bz += d0 * 0.25D;
- this.bB += d2 * 0.25D;
- this.bA += d1 * 0.25D;
- this.a(StatisticList.k, 1);
+ this.by += d0 * 0.25D;
+ this.bA += d2 * 0.25D;
+ this.bz += d1 * 0.25D;
if (this.vehicle == null) {
this.e = null;
}
if (!this.world.isStatic) {
this.foodData.a(this);
+ this.a(StatisticList.g, 1);
}
}
- public int z() {
+ public int D() {
return this.abilities.isInvulnerable ? 0 : 80;
}
- public int ac() {
+ protected String H() {
+ return "game.player.swim";
+ }
+
+ protected String O() {
+ return "game.player.swim.splash";
+ }
+
+ public int ai() {
return 10;
}
@@ -237,14 +250,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
- this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
+ String s = "iconcrack_" + Item.b(itemstack.getItem());
+
+ if (itemstack.usesData()) {
+ s = s + "_" + itemstack.getData();
+ }
+
+ this.world.addParticle(s, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
}
this.makeSound("random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
- protected void n() {
+ protected void p() {
if (this.f != null) {
this.c(this.f, 16);
int i = this.f.count;
@@ -257,7 +276,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (event.isCancelled()) {
// Update client
if (this instanceof EntityPlayer) {
- ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
+ ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
}
return;
}
@@ -268,7 +287,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
// Update client
if (this instanceof EntityPlayer) {
- ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
+ ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
}
return;
}
@@ -283,11 +302,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- this.bu();
+ this.bz();
}
}
- protected boolean bc() {
+ protected boolean bh() {
return this.getHealth() <= 0.0F || this.isSleeping();
}
@@ -328,7 +347,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public void V() {
+ public void ab() {
if (!this.world.isStatic && this.isSneaking()) {
this.mount((Entity) null);
this.setSneaking(false);
@@ -339,10 +358,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
float f = this.yaw;
float f1 = this.pitch;
- super.V();
+ super.ab();
this.bs = this.bt;
this.bt = 0.0F;
- this.k(this.locX - d0, this.locY - d1, this.locZ - d2);
+ this.l(this.locX - d0, this.locY - d1, this.locZ - d2);
if (this.vehicle instanceof EntityPig) {
this.pitch = f1;
this.yaw = f;
@@ -351,33 +370,33 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- protected void bl() {
- super.bl();
- this.aW();
+ protected void bq() {
+ super.bq();
+ this.bb();
}
- public void c() {
+ public void e() {
if (this.br > 0) {
--this.br;
}
- if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) {
+ if (this.world.difficulty == EnumDifficulty.PEACEFUL && this.getHealth() < this.getMaxHealth() && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) {
// CraftBukkit - added regain reason of "REGEN" for filtering purposes.
this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
}
this.inventory.k();
this.bs = this.bt;
- super.c();
+ super.e();
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);
if (!this.world.isStatic) {
attributeinstance.setValue((double) this.abilities.b());
}
- this.aR = this.bL;
+ this.aR = this.bK;
if (this.isSprinting()) {
- this.aR = (float) ((double) this.aR + (double) this.bL * 0.3D);
+ this.aR = (float) ((double) this.aR + (double) this.bK * 0.3D);
}
this.i((float) attributeinstance.getValue());
@@ -445,8 +464,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
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);
+ if (this.getName().equals("Notch")) {
+ this.a(new ItemStack(Items.APPLE, 1), true, false);
}
if (!this.world.getGameRules().getBoolean("keepInventory")) {
@@ -461,20 +480,28 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
this.height = 0.1F;
- this.a(StatisticList.y, 1);
+ this.a(StatisticList.v, 1);
+ }
+
+ protected String aT() {
+ return "game.player.hurt";
+ }
+
+ protected String aU() {
+ return "game.player.die";
}
public void b(Entity entity, int i) {
this.addScore(i);
// CraftBukkit - Get our scores instead
- Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getLocalizedName(), new java.util.ArrayList());
+ Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getName(), new java.util.ArrayList());
if (entity instanceof EntityHuman) {
- this.a(StatisticList.A, 1);
+ this.a(StatisticList.y, 1);
// CraftBukkit - Get our scores instead
- this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getLocalizedName(), collection);
+ this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), collection);
} else {
- this.a(StatisticList.z, 1);
+ this.a(StatisticList.w, 1);
}
Iterator iterator = collection.iterator();
@@ -487,14 +514,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public EntityItem a(boolean flag) {
- return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false);
+ return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true);
}
- public EntityItem drop(ItemStack itemstack) {
- return this.a(itemstack, false);
+ public EntityItem drop(ItemStack itemstack, boolean flag) {
+ return this.a(itemstack, false, false);
}
- public EntityItem a(ItemStack itemstack, boolean flag) {
+ public EntityItem a(ItemStack itemstack, boolean flag, boolean flag1) {
if (itemstack == null) {
return null;
} else if (itemstack.count == 0) {
@@ -503,6 +530,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.getHeadHeight(), this.locZ, itemstack);
entityitem.pickupDelay = 40;
+ if (flag1) {
+ entityitem.b(this.getName());
+ }
+
float f = 0.1F;
float f1;
@@ -540,7 +571,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
// CraftBukkit end
this.a(entityitem);
- this.a(StatisticList.v, 1);
+ this.a(StatisticList.s, 1);
return entityitem;
}
}
@@ -592,7 +623,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Inventory");
+ this.uniqueID = a(this.i);
+ NBTTagList nbttaglist = nbttagcompound.getList("Inventory", 10);
this.inventory.b(nbttaglist);
this.inventory.itemInHandIndex = nbttagcompound.getInt("SelectedItemSlot");
@@ -603,7 +635,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = nbttagcompound.getInt("XpTotal");
this.setScore(nbttagcompound.getInt("Score"));
if (this.sleeping) {
- this.bD = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ this.bC = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
@@ -614,15 +646,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
- if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
+ if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.c = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.d = nbttagcompound.getBoolean("SpawnForced");
}
this.foodData.a(nbttagcompound);
this.abilities.b(nbttagcompound);
- if (nbttagcompound.hasKey("EnderItems")) {
- NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems");
+ if (nbttagcompound.hasKeyOfType("EnderItems", 9)) {
+ NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems", 10);
this.enderChest.a(nbttaglist1);
}
@@ -669,7 +701,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return 0.12F;
}
- protected void d_() {
+ protected void e_() {
this.height = 1.62F;
}
@@ -687,16 +719,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(true, true, false);
}
- if (damagesource.p()) {
- if (this.world.difficulty == 0) {
- return false; // CraftBukkit - f = 0 -> return false
+ if (damagesource.r()) {
+ if (this.world.difficulty == EnumDifficulty.PEACEFUL) {
+ return false; // CraftBukkit - f = 0.0f -> return false
}
- if (this.world.difficulty == 1) {
+ if (this.world.difficulty == EnumDifficulty.EASY) {
f = f / 2.0F + 1.0F;
}
- if (this.world.difficulty == 3) {
+ if (this.world.difficulty == EnumDifficulty.HARD) {
f = f * 3.0F / 2.0F;
}
}
@@ -710,7 +742,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
entity = ((EntityArrow) entity).shooter;
}
- this.a(StatisticList.x, Math.round(f * 10.0F));
+ this.a(StatisticList.u, Math.round(f * 10.0F));
return super.damageEntity(damagesource, f);
}
}
@@ -729,7 +761,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
} else {
// This should never be called, but is implemented anyway
- org.bukkit.OfflinePlayer thisPlayer = entityhuman.world.getServer().getOfflinePlayer(entityhuman.name);
+ org.bukkit.OfflinePlayer thisPlayer = entityhuman.world.getServer().getOfflinePlayer(entityhuman.getName());
team = entityhuman.world.getServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer);
if (team == null || team.allowFriendlyFire()) {
return true;
@@ -739,7 +771,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this instanceof EntityPlayer) {
return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity());
}
- return !team.hasPlayer(this.world.getServer().getOfflinePlayer(this.name));
+ return !team.hasPlayer(this.world.getServer().getOfflinePlayer(this.getName()));
// CraftBukkit end
}
@@ -747,11 +779,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.inventory.a(f);
}
- public int aQ() {
+ public int aV() {
return this.inventory.l();
}
- public float bx() {
+ public float bC() {
int i = 0;
ItemStack[] aitemstack = this.inventory.armor;
int j = aitemstack.length;
@@ -777,14 +809,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f = this.c(damagesource, f);
float f1 = f;
- f = Math.max(f - this.bn(), 0.0F);
- this.m(this.bn() - (f1 - f));
+ f = Math.max(f - this.bs(), 0.0F);
+ this.m(this.bs() - (f1 - f));
if (f != 0.0F) {
this.a(damagesource.f());
float f2 = this.getHealth();
this.setHealth(this.getHealth() - f);
- this.aR().a(damagesource, f2, f);
+ this.aW().a(damagesource, f2, f);
}
}
}
@@ -795,16 +827,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(TileEntity tileentity) {}
+ public void a(CommandBlockListenerAbstract commandblocklistenerabstract) {}
+
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {}
public void openBeacon(TileEntityBeacon tileentitybeacon) {}
public void openTrade(IMerchant imerchant, String s) {}
- public void c(ItemStack itemstack) {}
+ public void b(ItemStack itemstack) {}
public boolean p(Entity entity) {
- ItemStack itemstack = this.by();
+ ItemStack itemstack = this.bD();
ItemStack itemstack1 = itemstack != null ? itemstack.cloneItemStack() : null;
if (!entity.c(this)) {
@@ -816,7 +850,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (itemstack.a(this, (EntityLiving) entity)) {
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
- this.bz();
+ this.bE();
}
return true;
@@ -825,9 +859,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return false;
} else {
- if (itemstack != null && itemstack == this.by()) {
+ if (itemstack != null && itemstack == this.bD()) {
if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) {
- this.bz();
+ this.bE();
} else if (itemstack.count < itemstack1.count && this.abilities.canInstantlyBuild) {
itemstack.count = itemstack1.count;
}
@@ -837,20 +871,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public ItemStack by() {
+ public ItemStack bD() {
return this.inventory.getItemInHand();
}
- public void bz() {
+ public void bE() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
- public double X() {
+ public double ad() {
return (double) (this.height - 0.5F);
}
public void attack(Entity entity) {
- if (entity.aq()) {
+ if (entity.av()) {
if (!entity.i(this)) {
float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue();
int i = 0;
@@ -866,7 +900,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (f > 0.0F || f1 > 0.0F) {
- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.e() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
+ boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.h_() && !this.M() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag && f > 0.0F) {
f *= 1.5F;
@@ -883,15 +917,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), f);
- // CraftBukkit start - Return when the damage fails so that the item will not lose durability
- if (!flag2) {
- if (flag1) {
- entity.extinguish();
- }
- return;
- }
- // CraftBukkit end
-
if (flag2) {
if (i > 0) {
entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
@@ -909,51 +934,52 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (f >= 18.0F) {
- this.a((Statistic) AchievementList.E);
+ this.a((Statistic) AchievementList.F);
}
this.k(entity);
if (entity instanceof EntityLiving) {
- EnchantmentThorns.a(this, (EntityLiving) entity, this.random);
+ EnchantmentManager.a((EntityLiving) entity, (Entity) this);
}
- }
- ItemStack itemstack = this.by();
- Object object = entity;
+ EnchantmentManager.b(this, entity);
+ ItemStack itemstack = this.bD();
+ Object object = entity;
- if (entity instanceof EntityComplexPart) {
- IComplex icomplex = ((EntityComplexPart) entity).owner;
+ if (entity instanceof EntityComplexPart) {
+ IComplex icomplex = ((EntityComplexPart) entity).owner;
- if (icomplex != null && icomplex instanceof EntityLiving) {
- object = (EntityLiving) icomplex;
- }
- }
-
- if (itemstack != null && object instanceof EntityLiving) {
- itemstack.a((EntityLiving) object, this);
- // CraftBukkit - bypass infinite items; <= 0 -> == 0
- if (itemstack.count == 0) {
- this.bz();
- }
- }
-
- if (entity instanceof EntityLiving) {
- this.a(StatisticList.w, Math.round(f * 10.0F));
- if (j > 0 && flag2) {
- // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
- EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
- org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
-
- if (!combustEvent.isCancelled()) {
- entity.setOnFire(combustEvent.getDuration());
+ if (icomplex != null && icomplex instanceof EntityLiving) {
+ object = (EntityLiving) icomplex;
}
- // CraftBukkit end
- } else if (flag1) {
- entity.extinguish();
}
- }
- this.a(0.3F);
+ if (itemstack != null && object instanceof EntityLiving) {
+ itemstack.a((EntityLiving) object, this);
+ // CraftBukkit - bypass infinite items; <= 0 -> == 0
+ if (itemstack.count == 0) {
+ this.bE();
+ }
+ }
+
+ if (entity instanceof EntityLiving) {
+ this.a(StatisticList.t, Math.round(f * 10.0F));
+ if (j > 0) {
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ entity.setOnFire(combustEvent.getDuration());
+ }
+ // CraftBukkit end
+ }
+ }
+
+ this.a(0.3F);
+ } else if (flag1) {
+ entity.extinguish();
+ }
}
}
}
@@ -975,6 +1001,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return !this.sleeping && super.inBlock();
}
+ public GameProfile getProfile() {
+ return this.i;
+ }
+
public EnumBedResult a(int i, int j, int k) {
if (!this.world.isStatic) {
if (this.isSleeping() || !this.isAlive()) {
@@ -1002,7 +1032,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- if (this.ag()) {
+ if (this.am()) {
this.mount((Entity) null);
}
@@ -1024,7 +1054,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.height = 0.2F;
if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
- int i1 = BlockBed.j(l);
+ int i1 = BlockBed.l(l);
float f = 0.5F;
float f1 = 0.5F;
@@ -1045,7 +1075,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f = 0.9F;
}
- this.t(i1);
+ this.w(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));
@@ -1053,7 +1083,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.sleeping = true;
this.sleepTicks = 0;
- this.bD = new ChunkCoordinates(i, j, k);
+ this.bC = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
@@ -1062,36 +1092,36 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return EnumBedResult.OK;
}
- private void t(int i) {
+ private void w(int i) {
+ this.bD = 0.0F;
this.bE = 0.0F;
- this.bF = 0.0F;
switch (i) {
case 0:
- this.bF = -1.8F;
+ this.bE = -1.8F;
break;
case 1:
- this.bE = 1.8F;
+ this.bD = 1.8F;
break;
case 2:
- this.bF = 1.8F;
+ this.bE = 1.8F;
break;
case 3:
- this.bE = -1.8F;
+ this.bD = -1.8F;
}
}
public void a(boolean flag, boolean flag1, boolean flag2) {
this.a(0.6F, 1.8F);
- this.d_();
- ChunkCoordinates chunkcoordinates = this.bD;
- ChunkCoordinates chunkcoordinates1 = this.bD;
+ this.e_();
+ ChunkCoordinates chunkcoordinates = this.bC;
+ ChunkCoordinates chunkcoordinates1 = this.bC;
- if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
+ if (chunkcoordinates != null && this.world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Blocks.BED) {
BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false);
- chunkcoordinates1 = BlockBed.b(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
+ chunkcoordinates1 = BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
if (chunkcoordinates1 == null) {
chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z);
}
@@ -1127,28 +1157,28 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (flag2) {
- this.setRespawnPosition(this.bD, false);
+ this.setRespawnPosition(this.bC, false);
}
}
- private boolean h() {
- return this.world.getTypeId(this.bD.x, this.bD.y, this.bD.z) == Block.BED.id;
+ private boolean j() {
+ return this.world.getType(this.bC.x, this.bC.y, this.bC.z) == Blocks.BED;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) {
- IChunkProvider ichunkprovider = world.L();
+ IChunkProvider ichunkprovider = world.K();
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z + 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z + 3 >> 4);
- if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
- ChunkCoordinates chunkcoordinates1 = BlockBed.b(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
+ if (world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Blocks.BED) {
+ ChunkCoordinates chunkcoordinates1 = BlockBed.a(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);
return chunkcoordinates1;
} else {
- Material material = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
- Material material1 = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z);
+ Material material = world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z).getMaterial();
+ Material material1 = world.getType(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z).getMaterial();
boolean flag1 = !material.isBuildable() && !material.isLiquid();
boolean flag2 = !material1.isBuildable() && !material1.isLiquid();
@@ -1174,7 +1204,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public void a(String s) {}
+ public void b(IChatBaseComponent ichatbasecomponent) {}
public ChunkCoordinates getBed() {
return this.c;
@@ -1202,9 +1232,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(Statistic statistic, int i) {}
- protected void be() {
- super.be();
- this.a(StatisticList.u, 1);
+ public void bj() {
+ super.bj();
+ this.a(StatisticList.r, 1);
if (this.isSprinting()) {
this.a(0.8F);
} else {
@@ -1232,7 +1262,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2);
}
- public float bg() {
+ public float bl() {
return (float) this.getAttributeInstance(GenericAttributes.d).getValue();
}
@@ -1242,24 +1272,24 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this.a(Material.WATER)) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
- if (i > 0) {
- this.a(StatisticList.q, i);
- this.a(0.015F * (float) i * 0.01F);
- }
- } else if (this.H()) {
- i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
this.a(0.015F * (float) i * 0.01F);
}
- } else if (this.e()) {
+ } else if (this.M()) {
+ i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
+ if (i > 0) {
+ this.a(StatisticList.i, i);
+ this.a(0.015F * (float) i * 0.01F);
+ }
+ } else if (this.h_()) {
if (d1 > 0.0D) {
- this.a(StatisticList.o, (int) Math.round(d1 * 100.0D));
+ this.a(StatisticList.k, (int) Math.round(d1 * 100.0D));
}
} else if (this.onGround) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
- this.a(StatisticList.l, i);
+ this.a(StatisticList.h, i);
if (this.isSprinting()) {
this.a(0.099999994F * (float) i * 0.01F);
} else {
@@ -1269,28 +1299,30 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} else {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 25) {
- this.a(StatisticList.p, i);
+ this.a(StatisticList.l, i);
}
}
}
}
- private void k(double d0, double d1, double d2) {
+ private void l(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 EntityMinecartAbstract) {
- this.a(StatisticList.r, i);
+ this.a(StatisticList.n, i);
if (this.e == null) {
this.e = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
} else if ((double) this.e.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) {
- this.a(StatisticList.s, i);
+ this.a(StatisticList.o, i);
} else if (this.vehicle instanceof EntityPig) {
- this.a(StatisticList.t, i);
+ this.a(StatisticList.p, i);
+ } else if (this.vehicle instanceof EntityHorse) {
+ this.a(StatisticList.q, i);
}
}
}
@@ -1299,27 +1331,38 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
protected void b(float f) {
if (!this.abilities.canFly) {
if (f >= 2.0F) {
- this.a(StatisticList.n, (int) Math.round((double) f * 100.0D));
+ this.a(StatisticList.j, (int) Math.round((double) f * 100.0D));
}
super.b(f);
}
}
+ protected String o(int i) {
+ return i > 4 ? "game.player.hurt.fall.big" : "game.player.hurt.fall.small";
+ }
+
public void a(EntityLiving entityliving) {
if (entityliving instanceof IMonster) {
this.a((Statistic) AchievementList.s);
}
- }
- public void am() {
- if (!this.abilities.isFlying) {
- super.am();
+ int i = EntityTypes.a(entityliving);
+ MonsterEggInfo monsteregginfo = (MonsterEggInfo) EntityTypes.a.get(Integer.valueOf(i));
+
+ if (monsteregginfo != null) {
+ this.a(monsteregginfo.d, 1);
}
}
- public ItemStack o(int i) {
- return this.inventory.f(i);
+ public void as() {
+ if (!this.abilities.isFlying) {
+ super.as();
+ }
+ }
+
+ public ItemStack r(int i) {
+ return this.inventory.d(i);
}
public void giveExp(int i) {
@@ -1374,7 +1417,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
}
- public boolean bJ() {
+ public boolean bP() {
return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth();
}
@@ -1392,17 +1435,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this.abilities.mayBuild) {
return true;
} else {
- int l = this.world.getTypeId(i, j, k);
+ Block block = this.world.getType(i, j, k);
- if (l > 0) {
- Block block = Block.byId[l];
-
- if (block.material.q()) {
+ if (block.getMaterial() != Material.AIR) {
+ if (block.getMaterial().q()) {
return true;
}
- if (this.by() != null) {
- ItemStack itemstack = this.by();
+ if (this.bD() != null) {
+ ItemStack itemstack = this.bD();
if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
return true;
@@ -1432,10 +1473,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return true;
}
- public String getLocalizedName() {
- return this.name;
- }
-
public void copyTo(EntityHuman entityhuman, boolean flag) {
if (flag) {
this.inventory.b(entityhuman.inventory);
@@ -1445,7 +1482,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = entityhuman.expTotal;
this.exp = entityhuman.exp;
this.setScore(entityhuman.getScore());
- this.as = entityhuman.as;
+ this.ar = entityhuman.ar;
} else if (this.world.getGameRules().getBoolean("keepInventory")) {
this.inventory.b(entityhuman.inventory);
this.expLevel = entityhuman.expLevel;
@@ -1457,7 +1494,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.enderChest = entityhuman.enderChest;
}
- protected boolean e_() {
+ protected boolean g_() {
return !this.abilities.isFlying;
}
@@ -1466,10 +1503,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(EnumGamemode enumgamemode) {}
public String getName() {
- return this.name;
+ return this.i.getName();
}
- public World f_() {
+ public World getWorld() {
return this.world;
}
@@ -1481,7 +1518,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
}
- public ItemStack aZ() {
+ public ItemStack be() {
return this.inventory.getItemInHand();
}
@@ -1493,7 +1530,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.inventory.armor;
}
- public boolean ax() {
+ public boolean aC() {
return !this.abilities.isFlying;
}
@@ -1502,12 +1539,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public ScoreboardTeamBase getScoreboardTeam() {
- return this.getScoreboard().getPlayerTeam(this.name);
+ return this.getScoreboard().getPlayerTeam(this.getName());
}
- public String getScoreboardDisplayName() {
+ public IChatBaseComponent getScoreboardDisplayName() {
// CraftBukkit todo: fun
- return ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.name);
+ ChatComponentText chatcomponenttext = new ChatComponentText(ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.getName()));
+
+ chatcomponenttext.b().a(new ChatClickable(EnumClickAction.SUGGEST_COMMAND, "/msg " + this.getName() + " "));
+ return chatcomponenttext;
}
public void m(float f) {
@@ -1518,7 +1558,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.getDataWatcher().watch(17, Float.valueOf(f));
}
- public float bn() {
+ public float bs() {
return this.getDataWatcher().getFloat(17);
}
+
+ public static UUID a(GameProfile gameprofile) {
+ UUID uuid = UtilUUID.b(gameprofile.getId());
+
+ if (uuid == null) {
+ uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + gameprofile.getName()).getBytes(Charsets.UTF_8));
+ }
+
+ return uuid;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 90d46f7425..885a0efc1b 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -50,9 +50,9 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- protected void az() {
- super.az();
- this.aX().b(GenericAttributes.b).setValue(16.0D);
+ protected void aD() {
+ super.aD();
+ this.bc().b(GenericAttributes.b).setValue(16.0D);
}
public ControllerLook getControllerLook() {
@@ -87,32 +87,32 @@ public abstract class EntityInsentient extends EntityLiving {
return EntityCreeper.class != oclass && EntityGhast.class != oclass;
}
- public void n() {}
+ public void p() {}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(11, Byte.valueOf((byte) 0));
this.datawatcher.a(10, "");
}
- public int o() {
+ public int q() {
return 80;
}
- public void p() {
- String s = this.r();
+ public void r() {
+ String s = this.t();
if (s != null) {
- this.makeSound(s, this.ba(), this.bb());
+ this.makeSound(s, this.bf(), this.bg());
}
}
- public void y() {
- super.y();
+ public void C() {
+ super.C();
this.world.methodProfiler.a("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.a_++) {
- this.a_ = -this.o();
- this.p();
+ this.a_ = -this.q();
+ this.r();
}
this.world.methodProfiler.b();
@@ -135,7 +135,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- public void q() {
+ public void s() {
for (int i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
@@ -146,15 +146,15 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- public void l_() {
- super.l_();
+ public void h() {
+ super.h();
if (!this.world.isStatic) {
- this.bF();
+ this.bJ();
}
}
protected float f(float f, float f1) {
- if (this.bf()) {
+ if (this.bk()) {
this.bn.a();
return f1;
} else {
@@ -162,28 +162,28 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- protected String r() {
+ protected String t() {
return null;
}
- protected int getLootId() {
- return 0;
+ protected Item getLoot() {
+ return Item.d(0);
}
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - Whole method
List loot = new java.util.ArrayList();
- int j = this.getLootId();
+ Item item = this.getLoot();
- if (j > 0) {
- int k = this.random.nextInt(3);
+ if (item != null) {
+ int j = this.random.nextInt(3);
if (i > 0) {
- k += this.random.nextInt(i + 1);
+ j += this.random.nextInt(i + 1);
}
- if (k > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(j, k));
+ if (j > 0) {
+ loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), j));
}
}
@@ -192,7 +192,7 @@ public abstract class EntityInsentient extends EntityLiving {
int k = this.random.nextInt(200) - i;
if (k < 5) {
- ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
+ ItemStack itemstack = this.getRareDrop(k <= 0 ? 1 : 0);
if (itemstack != null) {
loot.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
}
@@ -205,7 +205,7 @@ public abstract class EntityInsentient extends EntityLiving {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setBoolean("CanPickUpLoot", this.bD());
+ nbttagcompound.setBoolean("CanPickUpLoot", this.bH());
nbttagcompound.setBoolean("PersistenceRequired", this.persistent);
NBTTagList nbttaglist = new NBTTagList();
@@ -224,7 +224,7 @@ public abstract class EntityInsentient extends EntityLiving {
NBTTagList nbttaglist1 = new NBTTagList();
for (int j = 0; j < this.dropChances.length; ++j) {
- nbttaglist1.add(new NBTTagFloat(j + "", this.dropChances[j]));
+ nbttaglist1.add(new NBTTagFloat(this.dropChances[j]));
}
nbttagcompound.set("DropChances", nbttaglist1);
@@ -232,7 +232,7 @@ public abstract class EntityInsentient extends EntityLiving {
nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
nbttagcompound.setBoolean("Leashed", this.bv);
if (this.bw != null) {
- nbttagcompound1 = new NBTTagCompound("Leash");
+ nbttagcompound1 = new NBTTagCompound();
if (this.bw instanceof EntityLiving) {
nbttagcompound1.setLong("UUIDMost", this.bw.getUniqueID().getMostSignificantBits());
nbttagcompound1.setLong("UUIDLeast", this.bw.getUniqueID().getLeastSignificantBits());
@@ -263,7 +263,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
// CraftBukkit end
- if (nbttagcompound.hasKey("CustomName") && nbttagcompound.getString("CustomName").length() > 0) {
+ if (nbttagcompound.hasKeyOfType("CustomName", 8) && nbttagcompound.getString("CustomName").length() > 0) {
this.setCustomName(nbttagcompound.getString("CustomName"));
}
@@ -271,24 +271,24 @@ public abstract class EntityInsentient extends EntityLiving {
NBTTagList nbttaglist;
int i;
- if (nbttagcompound.hasKey("Equipment")) {
- nbttaglist = nbttagcompound.getList("Equipment");
+ if (nbttagcompound.hasKeyOfType("Equipment", 9)) {
+ nbttaglist = nbttagcompound.getList("Equipment", 10);
for (i = 0; i < this.equipment.length; ++i) {
- this.equipment[i] = ItemStack.createStack((NBTTagCompound) nbttaglist.get(i));
+ this.equipment[i] = ItemStack.createStack(nbttaglist.get(i));
}
}
- if (nbttagcompound.hasKey("DropChances")) {
- nbttaglist = nbttagcompound.getList("DropChances");
+ if (nbttagcompound.hasKeyOfType("DropChances", 9)) {
+ nbttaglist = nbttagcompound.getList("DropChances", 5);
for (i = 0; i < nbttaglist.size(); ++i) {
- this.dropChances[i] = ((NBTTagFloat) nbttaglist.get(i)).data;
+ this.dropChances[i] = nbttaglist.e(i);
}
}
this.bv = nbttagcompound.getBoolean("Leashed");
- if (this.bv && nbttagcompound.hasKey("Leash")) {
+ if (this.bv && nbttagcompound.hasKeyOfType("Leash", 10)) {
this.bx = nbttagcompound.getCompound("Leash");
}
}
@@ -302,10 +302,10 @@ public abstract class EntityInsentient extends EntityLiving {
this.n(f);
}
- public void c() {
- super.c();
+ public void e() {
+ super.e();
this.world.methodProfiler.a("looting");
- if (!this.world.isStatic && this.bD() && !this.aU && this.world.getGameRules().getBoolean("mobGriefing")) {
+ if (!this.world.isStatic && this.bH() && !this.aU && this.world.getGameRules().getBoolean("mobGriefing")) {
List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
Iterator iterator = list.iterator();
@@ -328,10 +328,10 @@ public abstract class EntityInsentient extends EntityLiving {
ItemSword itemsword = (ItemSword) itemstack.getItem();
ItemSword itemsword1 = (ItemSword) itemstack1.getItem();
- if (itemsword.g() == itemsword1.g()) {
+ if (itemsword.i() == itemsword1.i()) {
flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
} else {
- flag = itemsword.g() > itemsword1.g();
+ flag = itemsword.i() > itemsword1.i();
}
} else {
flag = false;
@@ -357,6 +357,14 @@ public abstract class EntityInsentient extends EntityLiving {
this.a(itemstack1, 0.0F);
}
+ if (itemstack.getItem() == Items.DIAMOND && entityitem.j() != null) {
+ EntityHuman entityhuman = this.world.a(entityitem.j());
+
+ if (entityhuman != null) {
+ entityhuman.a((Statistic) AchievementList.x);
+ }
+ }
+
this.setEquipment(i, itemstack);
this.dropChances[i] = 2.0F;
this.persistent = true;
@@ -371,7 +379,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.methodProfiler.b();
}
- protected boolean bf() {
+ protected boolean bk() {
return false;
}
@@ -379,7 +387,7 @@ public abstract class EntityInsentient extends EntityLiving {
return true;
}
- protected void u() {
+ protected void w() {
if (this.persistent) {
this.aV = 0;
} else {
@@ -404,10 +412,10 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- protected void bi() {
+ protected void bn() {
++this.aV;
this.world.methodProfiler.a("checkDespawn");
- this.u();
+ this.w();
this.world.methodProfiler.b();
this.world.methodProfiler.a("sensing");
this.bq.a();
@@ -422,7 +430,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.navigation.f();
this.world.methodProfiler.b();
this.world.methodProfiler.a("mob tick");
- this.bk();
+ this.bp();
this.world.methodProfiler.b();
this.world.methodProfiler.a("controls");
this.world.methodProfiler.a("move");
@@ -435,11 +443,11 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.methodProfiler.b();
}
- protected void bl() {
- super.bl();
+ protected void bq() {
+ super.bq();
this.be = 0.0F;
this.bf = 0.0F;
- this.u();
+ this.w();
float f = 8.0F;
if (this.random.nextFloat() < 0.02F) {
@@ -454,7 +462,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
if (this.bu != null) {
- this.a(this.bu, 10.0F, (float) this.bp());
+ this.a(this.bu, 10.0F, (float) this.x());
if (this.g-- <= 0 || this.bu.dead || this.bu.e((Entity) this) > (double) (f * f)) {
this.bu = null;
}
@@ -467,15 +475,15 @@ public abstract class EntityInsentient extends EntityLiving {
this.pitch = this.f;
}
- boolean flag = this.H();
- boolean flag1 = this.J();
+ boolean flag = this.M();
+ boolean flag1 = this.P();
if (flag || flag1) {
this.bd = this.random.nextFloat() < 0.8F;
}
}
- public int bp() {
+ public int x() {
return 40;
}
@@ -518,17 +526,17 @@ public abstract class EntityInsentient extends EntityLiving {
return this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- public int bv() {
+ public int bz() {
return 4;
}
- public int as() {
+ public int ax() {
if (this.getGoalTarget() == null) {
return 3;
} else {
int i = (int) (this.getHealth() - this.getMaxHealth() * 0.33F);
- i -= (3 - this.world.difficulty) * 4;
+ i -= (3 - this.world.difficulty.a()) * 4;
if (i < 0) {
i = 0;
}
@@ -537,7 +545,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- public ItemStack aZ() {
+ public ItemStack be() {
return this.equipment[0];
}
@@ -545,7 +553,7 @@ public abstract class EntityInsentient extends EntityLiving {
return this.equipment[i];
}
- public ItemStack o(int i) {
+ public ItemStack r(int i) {
return this.equipment[i + 1];
}
@@ -583,10 +591,10 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- protected void bw() {
+ protected void bA() {
if (this.random.nextFloat() < 0.15F * this.world.b(this.locX, this.locY, this.locZ)) {
int i = this.random.nextInt(2);
- float f = this.world.difficulty == 3 ? 0.1F : 0.25F;
+ float f = this.world.difficulty == EnumDifficulty.HARD ? 0.1F : 0.25F;
if (this.random.nextFloat() < 0.095F) {
++i;
@@ -601,7 +609,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
for (int j = 3; j >= 0; --j) {
- ItemStack itemstack = this.o(j);
+ ItemStack itemstack = this.r(j);
if (j < 3 && this.random.nextFloat() < f) {
break;
@@ -619,7 +627,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
public static int b(ItemStack itemstack) {
- if (itemstack.id != Block.PUMPKIN.id && itemstack.id != Item.SKULL.id) {
+ if (itemstack.getItem() != Item.getItemOf(Blocks.PUMPKIN) && itemstack.getItem() != Items.SKULL) {
if (itemstack.getItem() instanceof ItemArmor) {
switch (((ItemArmor) itemstack.getItem()).b) {
case 0:
@@ -646,54 +654,54 @@ public abstract class EntityInsentient extends EntityLiving {
switch (i) {
case 4:
if (j == 0) {
- return Item.LEATHER_HELMET;
+ return Items.LEATHER_HELMET;
} else if (j == 1) {
- return Item.GOLD_HELMET;
+ return Items.GOLD_HELMET;
} else if (j == 2) {
- return Item.CHAINMAIL_HELMET;
+ return Items.CHAINMAIL_HELMET;
} else if (j == 3) {
- return Item.IRON_HELMET;
+ return Items.IRON_HELMET;
} else if (j == 4) {
- return Item.DIAMOND_HELMET;
+ return Items.DIAMOND_HELMET;
}
case 3:
if (j == 0) {
- return Item.LEATHER_CHESTPLATE;
+ return Items.LEATHER_CHESTPLATE;
} else if (j == 1) {
- return Item.GOLD_CHESTPLATE;
+ return Items.GOLD_CHESTPLATE;
} else if (j == 2) {
- return Item.CHAINMAIL_CHESTPLATE;
+ return Items.CHAINMAIL_CHESTPLATE;
} else if (j == 3) {
- return Item.IRON_CHESTPLATE;
+ return Items.IRON_CHESTPLATE;
} else if (j == 4) {
- return Item.DIAMOND_CHESTPLATE;
+ return Items.DIAMOND_CHESTPLATE;
}
case 2:
if (j == 0) {
- return Item.LEATHER_LEGGINGS;
+ return Items.LEATHER_LEGGINGS;
} else if (j == 1) {
- return Item.GOLD_LEGGINGS;
+ return Items.GOLD_LEGGINGS;
} else if (j == 2) {
- return Item.CHAINMAIL_LEGGINGS;
+ return Items.CHAINMAIL_LEGGINGS;
} else if (j == 3) {
- return Item.IRON_LEGGINGS;
+ return Items.IRON_LEGGINGS;
} else if (j == 4) {
- return Item.DIAMOND_LEGGINGS;
+ return Items.DIAMOND_LEGGINGS;
}
case 1:
if (j == 0) {
- return Item.LEATHER_BOOTS;
+ return Items.LEATHER_BOOTS;
} else if (j == 1) {
- return Item.GOLD_BOOTS;
+ return Items.GOLD_BOOTS;
} else if (j == 2) {
- return Item.CHAINMAIL_BOOTS;
+ return Items.CHAINMAIL_BOOTS;
} else if (j == 3) {
- return Item.IRON_BOOTS;
+ return Items.IRON_BOOTS;
} else if (j == 4) {
- return Item.DIAMOND_BOOTS;
+ return Items.DIAMOND_BOOTS;
}
default:
@@ -701,15 +709,15 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
- protected void bx() {
+ protected void bB() {
float f = this.world.b(this.locX, this.locY, this.locZ);
- if (this.aZ() != null && this.random.nextFloat() < 0.25F * f) {
- EnchantmentManager.a(this.random, this.aZ(), (int) (5.0F + f * (float) this.random.nextInt(18)));
+ if (this.be() != null && this.random.nextFloat() < 0.25F * f) {
+ EnchantmentManager.a(this.random, this.be(), (int) (5.0F + f * (float) this.random.nextInt(18)));
}
for (int i = 0; i < 4; ++i) {
- ItemStack itemstack = this.o(i);
+ ItemStack itemstack = this.r(i);
if (itemstack != null && this.random.nextFloat() < 0.5F * f) {
EnchantmentManager.a(this.random, itemstack, (int) (5.0F + f * (float) this.random.nextInt(18)));
@@ -722,15 +730,15 @@ public abstract class EntityInsentient extends EntityLiving {
return groupdataentity;
}
- public boolean by() {
+ public boolean bC() {
return false;
}
- public String getLocalizedName() {
- return this.hasCustomName() ? this.getCustomName() : super.getLocalizedName();
+ public String getName() {
+ return this.hasCustomName() ? this.getCustomName() : super.getName();
}
- public void bz() {
+ public void bD() {
this.persistent = true;
}
@@ -758,7 +766,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.dropChances[i] = f;
}
- public boolean bD() {
+ public boolean bH() {
return this.canPickUpLoot;
}
@@ -771,10 +779,10 @@ public abstract class EntityInsentient extends EntityLiving {
}
public final boolean c(EntityHuman entityhuman) {
- if (this.bH() && this.getLeashHolder() == entityhuman) {
+ if (this.bL() && this.getLeashHolder() == entityhuman) {
// CraftBukkit start
if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet39AttachEntity(1, this, this.getLeashHolder()));
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
return false;
}
// CraftBukkit end
@@ -783,11 +791,11 @@ public abstract class EntityInsentient extends EntityLiving {
} else {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (itemstack != null && itemstack.id == Item.LEASH.id && this.bG()) {
+ if (itemstack != null && itemstack.getItem() == Items.LEASH && this.bK()) {
if (!(this instanceof EntityTameableAnimal) || !((EntityTameableAnimal) this).isTamed()) {
// CraftBukkit start
if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet39AttachEntity(1, this, this.getLeashHolder()));
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
return false;
}
// CraftBukkit end
@@ -799,7 +807,7 @@ public abstract class EntityInsentient extends EntityLiving {
if (entityhuman.getName().equalsIgnoreCase(((EntityTameableAnimal) this).getOwnerName())) {
// CraftBukkit start
if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet39AttachEntity(1, this, this.getLeashHolder()));
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
return false;
}
// CraftBukkit end
@@ -817,9 +825,9 @@ public abstract class EntityInsentient extends EntityLiving {
return false;
}
- protected void bF() {
+ protected void bJ() {
if (this.bx != null) {
- this.bJ();
+ this.bN();
}
if (this.bv) {
@@ -835,20 +843,20 @@ public abstract class EntityInsentient extends EntityLiving {
this.bv = false;
this.bw = null;
if (!this.world.isStatic && flag1) {
- this.b(Item.LEASH.id, 1);
+ this.a(Items.LEASH, 1);
}
if (!this.world.isStatic && flag && this.world instanceof WorldServer) {
- ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet39AttachEntity(1, this, (Entity) null)));
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAttachEntity(1, this, (Entity) null)));
}
}
}
- public boolean bG() {
- return !this.bH() && !(this instanceof IMonster);
+ public boolean bK() {
+ return !this.bL() && !(this instanceof IMonster);
}
- public boolean bH() {
+ public boolean bL() {
return this.bv;
}
@@ -860,13 +868,13 @@ public abstract class EntityInsentient extends EntityLiving {
this.bv = true;
this.bw = entity;
if (!this.world.isStatic && flag && this.world instanceof WorldServer) {
- ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet39AttachEntity(1, this, this.bw)));
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAttachEntity(1, this, this.bw)));
}
}
- private void bJ() {
+ private void bN() {
if (this.bv && this.bx != null) {
- if (this.bx.hasKey("UUIDMost") && this.bx.hasKey("UUIDLeast")) {
+ if (this.bx.hasKeyOfType("UUIDMost", 4) && this.bx.hasKeyOfType("UUIDLeast", 4)) {
UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast"));
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D));
Iterator iterator = list.iterator();
@@ -879,7 +887,7 @@ public abstract class EntityInsentient extends EntityLiving {
break;
}
}
- } else if (this.bx.hasKey("X") && this.bx.hasKey("Y") && this.bx.hasKey("Z")) {
+ } else if (this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) {
int i = this.bx.getInt("X");
int j = this.bx.getInt("Y");
int k = this.bx.getInt("Z");
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
index 9247f1bbc7..80060e9b1c 100644
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
@@ -26,51 +26,51 @@ public class EntityIronGolem extends EntityGolem {
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 0, false, true, IMonster.a));
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- protected void bk() {
+ protected void bp() {
if (--this.bq <= 0) {
this.bq = 70 + this.random.nextInt(50);
this.bp = this.world.villages.getClosestVillage(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32);
if (this.bp == null) {
- this.bR();
+ this.bV();
} else {
ChunkCoordinates chunkcoordinates = this.bp.getCenter();
- this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, (int) ((float) this.bp.getSize() * 0.6F));
+ this.a(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, (int) ((float) this.bp.getSize() * 0.6F));
}
}
- super.bk();
+ super.bp();
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(100.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
- protected int h(int i) {
+ protected int j(int i) {
return i;
}
protected void n(Entity entity) {
- if (entity instanceof IMonster && this.aD().nextInt(20) == 0) {
+ if (entity instanceof IMonster && this.aI().nextInt(20) == 0) {
this.setGoalTarget((EntityLiving) entity);
}
super.n(entity);
}
- public void c() {
- super.c();
+ public void e() {
+ super.e();
if (this.br > 0) {
--this.br;
}
@@ -83,10 +83,10 @@ public class EntityIronGolem extends EntityGolem {
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);
+ Block block = this.world.getType(i, j, k);
- if (l > 0) {
- this.world.addParticle("tilecrack_" + l + "_" + this.world.getData(i, j, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D);
+ if (block.getMaterial() != Material.AIR) {
+ this.world.addParticle("blockcrack_" + Block.b(block) + "_" + this.world.getData(i, j, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D);
}
}
}
@@ -118,7 +118,7 @@ public class EntityIronGolem extends EntityGolem {
return flag;
}
- public Village bT() {
+ public Village bX() {
return this.bp;
}
@@ -127,19 +127,15 @@ public class EntityIronGolem extends EntityGolem {
this.world.broadcastEntityEffect(this, (byte) 11);
}
- protected String r() {
- return "none";
- }
-
- protected String aO() {
+ protected String aT() {
return "mob.irongolem.hit";
}
- protected String aP() {
+ protected String aU() {
return "mob.irongolem.death";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.irongolem.walk", 1.0F, 1.0F);
}
@@ -151,20 +147,20 @@ public class EntityIronGolem extends EntityGolem {
int k;
if (j > 0) {
- loot.add(CraftItemStack.asNewCraftStack(Item.byId[Block.RED_ROSE.id], j));
+ loot.add(CraftItemStack.asNewCraftStack(Item.getItemOf(Blocks.RED_ROSE), j));
}
k = 3 + this.random.nextInt(3);
if (k > 0) {
- loot.add(CraftItemStack.asNewCraftStack(Item.IRON_INGOT, k));
+ loot.add(CraftItemStack.asNewCraftStack(Items.IRON_INGOT, k));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
- public int bV() {
+ public int bZ() {
return this.bs;
}
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 584102ed7e..bbcf6746cd 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -2,19 +2,25 @@ package net.minecraft.server;
import java.util.Iterator;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
public class EntityItem extends Entity {
+ private static final Logger d = LogManager.getLogger();
public int age;
public int pickupDelay;
- private int d;
+ private int e;
+ private String f;
+ private String g;
public float c;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit
public EntityItem(World world, double d0, double d1, double d2) {
super(world);
- this.d = 5;
+ this.e = 5;
this.c = (float) (Math.random() * 3.141592653589793D * 2.0D);
this.a(0.25F, 0.25F);
this.height = this.length / 2.0F;
@@ -35,83 +41,82 @@ public class EntityItem extends Entity {
this.setItemStack(itemstack);
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
public EntityItem(World world) {
super(world);
- this.d = 5;
+ this.e = 5;
this.c = (float) (Math.random() * 3.141592653589793D * 2.0D);
this.a(0.25F, 0.25F);
this.height = this.length / 2.0F;
}
- protected void a() {
+ protected void c() {
this.getDataWatcher().a(10, 5);
}
- public void l_() {
- super.l_();
- // CraftBukkit start - Use wall time for pickup and despawn timers
- int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
- this.pickupDelay -= elapsedTicks;
- this.age += elapsedTicks;
- this.lastTick = MinecraftServer.currentTick;
- // CraftBukkit end
-
- this.lastX = this.locX;
- this.lastY = this.locY;
- this.lastZ = this.locZ;
- this.motY -= 0.03999999910593033D;
- this.Z = 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 || this.ticksLived % 25 == 0) {
- 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.makeSound("random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
- }
-
- if (!this.world.isStatic) {
- this.e();
- }
- }
-
- float f = 0.98F;
-
- if (this.onGround) {
- f = 0.58800006F;
- int i = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
-
- if (i > 0) {
- f = Block.byId[i].frictionFactor * 0.98F;
- }
- }
-
- this.motX *= (double) f;
- this.motY *= 0.9800000190734863D;
- this.motZ *= (double) f;
- if (this.onGround) {
- this.motY *= -0.5D;
- }
-
- // ++this.age; // CraftBukkit - Moved up
- if (!this.world.isStatic && this.age >= 6000) {
- // CraftBukkit start
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
- this.age = 0;
- return;
- }
- // CraftBukkit end
+ public void h() {
+ if (this.getItemStack() == null) {
this.die();
+ } else {
+ super.h();
+ // CraftBukkit start - Use wall time for pickup and despawn timers
+ int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
+ this.pickupDelay -= elapsedTicks;
+ this.age += elapsedTicks;
+ this.lastTick = MinecraftServer.currentTick;
+ // CraftBukkit end
+
+ this.lastX = this.locX;
+ this.lastY = this.locY;
+ this.lastZ = this.locZ;
+ this.motY -= 0.03999999910593033D;
+ this.Y = this.j(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 || this.ticksLived % 25 == 0) {
+ if (this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)).getMaterial() == 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.makeSound("random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
+ }
+
+ if (!this.world.isStatic) {
+ this.k();
+ }
+ }
+
+ float f = 0.98F;
+
+ if (this.onGround) {
+ f = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)).frictionFactor * 0.98F;
+ }
+
+ this.motX *= (double) f;
+ this.motY *= 0.9800000190734863D;
+ this.motZ *= (double) f;
+ if (this.onGround) {
+ this.motY *= -0.5D;
+ }
+
+ // ++this.age; // CraftBukkit - Moved up
+ if (!this.world.isStatic && this.age >= 6000) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
+ this.age = 0;
+ return;
+ }
+ // CraftBukkit end
+ this.die();
+ }
}
}
- private void e() {
+ private void k() {
Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
while (iterator.hasNext()) {
@@ -134,6 +139,8 @@ public class EntityItem extends Entity {
return false;
} else if (itemstack1.hasTag() && !itemstack1.getTag().equals(itemstack.getTag())) {
return false;
+ } else if (itemstack1.getItem() == null) {
+ return false;
} else if (itemstack1.getItem().n() && itemstack1.getData() != itemstack.getData()) {
return false;
} else if (itemstack1.count < itemstack.count) {
@@ -153,11 +160,11 @@ public class EntityItem extends Entity {
}
}
- public void c() {
+ public void e() {
this.age = 4800;
}
- public boolean I() {
+ public boolean N() {
return this.world.a(this.boundingBox, Material.WATER, (Entity) this);
}
@@ -168,12 +175,12 @@ public class EntityItem extends Entity {
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
- } else if (this.getItemStack() != null && this.getItemStack().id == Item.NETHER_STAR.id && damagesource.c()) {
+ } else if (this.getItemStack() != null && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.c()) {
return false;
} else {
- this.K();
- this.d = (int) ((float) this.d - f);
- if (this.d <= 0) {
+ this.Q();
+ this.e = (int) ((float) this.e - f);
+ if (this.e <= 0) {
this.die();
}
@@ -182,16 +189,32 @@ public class EntityItem extends Entity {
}
public void b(NBTTagCompound nbttagcompound) {
- nbttagcompound.setShort("Health", (short) ((byte) this.d));
+ nbttagcompound.setShort("Health", (short) ((byte) this.e));
nbttagcompound.setShort("Age", (short) this.age);
+ if (this.j() != null) {
+ nbttagcompound.setString("Thrower", this.f);
+ }
+
+ if (this.i() != null) {
+ nbttagcompound.setString("Owner", this.g);
+ }
+
if (this.getItemStack() != null) {
- nbttagcompound.setCompound("Item", this.getItemStack().save(new NBTTagCompound()));
+ nbttagcompound.set("Item", this.getItemStack().save(new NBTTagCompound()));
}
}
public void a(NBTTagCompound nbttagcompound) {
- this.d = nbttagcompound.getShort("Health") & 255;
+ this.e = nbttagcompound.getShort("Health") & 255;
this.age = nbttagcompound.getShort("Age");
+ if (nbttagcompound.hasKey("Owner")) {
+ this.g = nbttagcompound.getString("Owner");
+ }
+
+ if (nbttagcompound.hasKey("Thrower")) {
+ this.f = nbttagcompound.getString("Thrower");
+ }
+
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
// CraftBukkit start
@@ -236,24 +259,36 @@ public class EntityItem extends Entity {
}
// CraftBukkit end
- if (this.pickupDelay == 0 && entityhuman.inventory.pickup(itemstack)) {
- if (itemstack.id == Block.LOG.id) {
+ if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) {
+ if (itemstack.getItem() == Item.getItemOf(Blocks.LOG)) {
entityhuman.a((Statistic) AchievementList.g);
}
- if (itemstack.id == Item.LEATHER.id) {
+ if (itemstack.getItem() == Item.getItemOf(Blocks.LOG2)) {
+ entityhuman.a((Statistic) AchievementList.g);
+ }
+
+ if (itemstack.getItem() == Items.LEATHER) {
entityhuman.a((Statistic) AchievementList.t);
}
- if (itemstack.id == Item.DIAMOND.id) {
+ if (itemstack.getItem() == Items.DIAMOND) {
entityhuman.a((Statistic) AchievementList.w);
}
- if (itemstack.id == Item.BLAZE_ROD.id) {
- entityhuman.a((Statistic) AchievementList.z);
+ if (itemstack.getItem() == Items.BLAZE_ROD) {
+ entityhuman.a((Statistic) AchievementList.A);
}
- this.makeSound("random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ if (itemstack.getItem() == Items.DIAMOND && this.j() != null) {
+ EntityHuman entityhuman1 = this.world.a(this.j());
+
+ if (entityhuman1 != null && entityhuman1 != entityhuman) {
+ entityhuman1.a((Statistic) AchievementList.x);
+ }
+ }
+
+ this.world.makeSound(entityhuman, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, i);
if (itemstack.count <= 0) {
this.die();
@@ -262,18 +297,18 @@ public class EntityItem extends Entity {
}
}
- public String getLocalizedName() {
+ public String getName() {
return LocaleI18n.get("item." + this.getItemStack().a());
}
- public boolean aq() {
+ public boolean av() {
return false;
}
public void b(int i) {
super.b(i);
if (!this.world.isStatic) {
- this.e();
+ this.k();
}
}
@@ -282,10 +317,10 @@ public class EntityItem extends Entity {
if (itemstack == null) {
if (this.world != null) {
- this.world.getLogger().severe("Item entity " + this.id + " has no item?!");
+ d.error("Item entity " + this.getId() + " has no item?!");
}
- return new ItemStack(Block.STONE);
+ return new ItemStack(Blocks.STONE);
} else {
return itemstack;
}
@@ -295,4 +330,20 @@ public class EntityItem extends Entity {
this.getDataWatcher().watch(10, itemstack);
this.getDataWatcher().h(10);
}
+
+ public String i() {
+ return this.g;
+ }
+
+ public void a(String s) {
+ this.g = s;
+ }
+
+ public String j() {
+ return this.f;
+ }
+
+ public void b(String s) {
+ this.f = s;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityLargeFireball.java b/src/main/java/net/minecraft/server/EntityLargeFireball.java
index df86311f34..d136d2da35 100644
--- a/src/main/java/net/minecraft/server/EntityLargeFireball.java
+++ b/src/main/java/net/minecraft/server/EntityLargeFireball.java
@@ -41,7 +41,7 @@ public class EntityLargeFireball extends EntityFireball {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- if (nbttagcompound.hasKey("ExplosionPower")) {
+ if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) {
// CraftBukkit - set bukkitYield when setting explosionpower
this.bukkitYield = this.yield = nbttagcompound.getInt("ExplosionPower");
}
diff --git a/src/main/java/net/minecraft/server/EntityLeash.java b/src/main/java/net/minecraft/server/EntityLeash.java
index a2687c2d16..420879946e 100644
--- a/src/main/java/net/minecraft/server/EntityLeash.java
+++ b/src/main/java/net/minecraft/server/EntityLeash.java
@@ -16,17 +16,17 @@ public class EntityLeash extends EntityHanging {
this.setPosition((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
}
public void setDirection(int i) {}
- public int d() {
+ public int f() {
return 9;
}
- public int e() {
+ public int i() {
return 9;
}
@@ -41,14 +41,14 @@ public class EntityLeash extends EntityHanging {
public void a(NBTTagCompound nbttagcompound) {}
public boolean c(EntityHuman entityhuman) {
- ItemStack itemstack = entityhuman.aZ();
+ ItemStack itemstack = entityhuman.be();
boolean flag = false;
double d0;
List list;
Iterator iterator;
EntityInsentient entityinsentient;
- if (itemstack != null && itemstack.id == Item.LEASH.id && !this.world.isStatic) {
+ if (itemstack != null && itemstack.getItem() == Items.LEASH && !this.world.isStatic) {
d0 = 7.0D;
list = this.world.a(EntityInsentient.class, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + d0, this.locZ + d0));
if (list != null) {
@@ -56,10 +56,10 @@ public class EntityLeash extends EntityHanging {
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
- if (entityinsentient.bH() && entityinsentient.getLeashHolder() == entityhuman) {
+ if (entityinsentient.bL() && entityinsentient.getLeashHolder() == entityhuman) {
// CraftBukkit start
if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman).isCancelled()) {
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet39AttachEntity(1, entityinsentient, entityinsentient.getLeashHolder()));
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, entityinsentient, entityinsentient.getLeashHolder()));
continue;
}
// CraftBukkit end
@@ -83,7 +83,7 @@ public class EntityLeash extends EntityHanging {
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
- if (entityinsentient.bH() && entityinsentient.getLeashHolder() == this) {
+ if (entityinsentient.bL() && entityinsentient.getLeashHolder() == this) {
// CraftBukkit start
if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman).isCancelled()) {
die = false;
@@ -106,22 +106,19 @@ public class EntityLeash extends EntityHanging {
}
public boolean survives() {
- int i = this.world.getTypeId(this.x, this.y, this.z);
-
- return Block.byId[i] != null && Block.byId[i].d() == 11;
+ return this.world.getType(this.x, this.y, this.z).b() == 11;
}
public static EntityLeash a(World world, int i, int j, int k) {
EntityLeash entityleash = new EntityLeash(world, i, j, k);
- entityleash.p = true;
+ entityleash.o = true;
world.addEntity(entityleash);
return entityleash;
}
public static EntityLeash b(World world, int i, int j, int k) {
List list = world.a(EntityLeash.class, AxisAlignedBB.a().a((double) i - 1.0D, (double) j - 1.0D, (double) k - 1.0D, (double) i + 1.0D, (double) j + 1.0D, (double) k + 1.0D));
- Object object = null;
if (list != null) {
Iterator iterator = list.iterator();
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
index 6f0dab6171..36923bb6dd 100644
--- a/src/main/java/net/minecraft/server/EntityLightning.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -32,15 +32,15 @@ public class EntityLightning extends EntityWeather {
this.c = this.random.nextInt(3) + 1;
// CraftBukkit
- if (!isEffect && !world.isStatic && world.getGameRules().getBoolean("doFireTick") && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
+ if (!isEffect && !world.isStatic && world.getGameRules().getBoolean("doFireTick") && (world.difficulty == EnumDifficulty.NORMAL || world.difficulty == EnumDifficulty.HARD) && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
int i = MathHelper.floor(d0);
int j = MathHelper.floor(d1);
int k = MathHelper.floor(d2);
- if (world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(world, i, j, k)) {
+ if (world.getType(i, j, k).getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, i, j, k)) {
// CraftBukkit start
if (!CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
- world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ world.setTypeUpdate(i, j, k, Blocks.FIRE);
}
// CraftBukkit end
}
@@ -50,10 +50,10 @@ public class EntityLightning extends EntityWeather {
k = MathHelper.floor(d1) + this.random.nextInt(3) - 1;
int l = MathHelper.floor(d2) + this.random.nextInt(3) - 1;
- if (world.getTypeId(j, k, l) == 0 && Block.FIRE.canPlace(world, j, k, l)) {
+ if (world.getType(j, k, l).getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, j, k, l)) {
// CraftBukkit start
if (!CraftEventFactory.callBlockIgniteEvent(world, j, k, l, this).isCancelled()) {
- world.setTypeIdUpdate(j, k, l, Block.FIRE.id);
+ world.setTypeUpdate(j, k, l, Blocks.FIRE);
}
// CraftBukkit end
}
@@ -61,8 +61,8 @@ public class EntityLightning extends EntityWeather {
}
}
- public void l_() {
- super.l_();
+ 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);
@@ -82,10 +82,10 @@ public class EntityLightning extends EntityWeather {
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- if (this.world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(this.world, i, j, k)) {
+ if (this.world.getType(i, j, k).getMaterial() == Material.AIR && Blocks.FIRE.canPlace(this.world, i, j, k)) {
// CraftBukkit start
if (!CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
- world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ this.world.setTypeUpdate(i, j, k, Blocks.FIRE);
}
// CraftBukkit end
}
@@ -109,7 +109,7 @@ public class EntityLightning extends EntityWeather {
}
}
- protected void a() {}
+ protected void c() {}
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 16a16cf3ac..75b1ec1084 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -81,68 +81,68 @@ public abstract class EntityLiving extends Entity {
public EntityLiving(World world) {
super(world);
- this.az();
+ this.aD();
// CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
this.datawatcher.watch(6, (float) this.getAttributeInstance(GenericAttributes.a).getValue());
- this.m = true;
+ this.l = true;
this.aM = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
this.aL = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
this.aP = this.yaw;
- this.Y = 0.5F;
+ this.X = 0.5F;
}
- protected void a() {
+ protected void c() {
this.datawatcher.a(7, Integer.valueOf(0));
this.datawatcher.a(8, Byte.valueOf((byte) 0));
this.datawatcher.a(9, Byte.valueOf((byte) 0));
this.datawatcher.a(6, Float.valueOf(1.0F));
}
- protected void az() {
- this.aX().b(GenericAttributes.a);
- this.aX().b(GenericAttributes.c);
- this.aX().b(GenericAttributes.d);
- if (!this.bf()) {
+ protected void aD() {
+ this.bc().b(GenericAttributes.a);
+ this.bc().b(GenericAttributes.c);
+ this.bc().b(GenericAttributes.d);
+ if (!this.bk()) {
this.getAttributeInstance(GenericAttributes.d).setValue(0.10000000149011612D);
}
}
protected void a(double d0, boolean flag) {
- if (!this.H()) {
- this.I();
+ if (!this.M()) {
+ this.N();
}
if (flag && this.fallDistance > 0.0F) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
int k = MathHelper.floor(this.locZ);
- int l = this.world.getTypeId(i, j, k);
+ Block block = this.world.getType(i, j, k);
- if (l == 0) {
- int i1 = this.world.e(i, j - 1, k);
+ if (block.getMaterial() == Material.AIR) {
+ int l = this.world.getType(i, j - 1, k).b();
- if (i1 == 11 || i1 == 32 || i1 == 21) {
- l = this.world.getTypeId(i, j - 1, k);
+ if (l == 11 || l == 32 || l == 21) {
+ block = this.world.getType(i, j - 1, k);
}
+ } else if (!this.world.isStatic && this.fallDistance > 3.0F) {
+ this.world.triggerEffect(2006, i, j, k, MathHelper.f(this.fallDistance - 3.0F));
}
- if (l > 0) {
- Block.byId[l].a(this.world, i, j, k, this, this.fallDistance);
- }
+ block.a(this.world, i, j, k, this, this.fallDistance);
}
super.a(d0, flag);
}
- public boolean aA() {
+ public boolean aE() {
return false;
}
- public void y() {
+ public void C() {
this.aD = this.aE;
- super.y();
+ super.C();
this.world.methodProfiler.a("livingEntityBaseTick");
if (this.isAlive() && this.inBlock()) {
this.damageEntity(DamageSource.STUCK, 1.0F);
@@ -155,8 +155,8 @@ public abstract class EntityLiving extends Entity {
boolean flag = this instanceof EntityHuman && ((EntityHuman) this).abilities.isInvulnerable;
if (this.isAlive() && this.a(Material.WATER)) {
- if (!this.aA() && !this.hasEffect(MobEffectList.WATER_BREATHING.id) && !flag) {
- this.setAirTicks(this.h(this.getAirTicks()));
+ if (!this.aE() && !this.hasEffect(MobEffectList.WATER_BREATHING.id) && !flag) {
+ this.setAirTicks(this.j(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
@@ -172,8 +172,7 @@ public abstract class EntityLiving extends Entity {
}
}
- this.extinguish();
- if (!this.world.isStatic && this.ag() && this.vehicle instanceof EntityLiving) {
+ if (!this.world.isStatic && this.am() && this.vehicle instanceof EntityLiving) {
this.mount((Entity) null);
}
} else {
@@ -184,6 +183,10 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
+ if (this.isAlive() && this.L()) {
+ this.extinguish();
+ }
+
this.aJ = this.aK;
if (this.attackTicks > 0) {
--this.attackTicks;
@@ -193,13 +196,12 @@ public abstract class EntityLiving extends Entity {
--this.hurtTicks;
}
- // CraftBukkit
if (this.noDamageTicks > 0 && !(this instanceof EntityPlayer)) {
--this.noDamageTicks;
}
if (this.getHealth() <= 0.0F) {
- this.aB();
+ this.aF();
}
if (this.lastDamageByPlayerTime > 0) {
@@ -212,11 +214,15 @@ public abstract class EntityLiving extends Entity {
this.bn = null;
}
- if (this.lastDamager != null && !this.lastDamager.isAlive()) {
- this.b((EntityLiving) null);
+ if (this.lastDamager != null) {
+ if (!this.lastDamager.isAlive()) {
+ this.b((EntityLiving) null);
+ } else if (this.ticksLived - this.j > 100) {
+ this.b((EntityLiving) null);
+ }
}
- this.aJ();
+ this.removeAllEffects();
this.aZ = this.aY;
this.aO = this.aN;
this.aQ = this.aP;
@@ -229,7 +235,7 @@ public abstract class EntityLiving extends Entity {
public int getExpReward() {
int exp = this.getExpValue(this.killer);
- if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) {
+ if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.aG()) {
return exp;
} else {
return 0;
@@ -241,7 +247,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
- protected void aB() {
+ protected void aF() {
++this.deathTicks;
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
int i;
@@ -269,7 +275,11 @@ public abstract class EntityLiving extends Entity {
}
}
- protected int h(int i) {
+ protected boolean aG() {
+ return !this.isBaby();
+ }
+
+ protected int j(int i) {
int j = EnchantmentManager.getOxygenEnchantmentLevel(this);
return j > 0 && this.random.nextInt(j + 1) > 0 ? i : i - 1;
@@ -283,7 +293,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
- public Random aD() {
+ public Random aI() {
return this.random;
}
@@ -291,7 +301,7 @@ public abstract class EntityLiving extends Entity {
return this.lastDamager;
}
- public int aF() {
+ public int aK() {
return this.j;
}
@@ -300,11 +310,11 @@ public abstract class EntityLiving extends Entity {
this.j = this.ticksLived;
}
- public EntityLiving aG() {
+ public EntityLiving aL() {
return this.bn;
}
- public int aH() {
+ public int aM() {
return this.bo;
}
@@ -318,7 +328,7 @@ public abstract class EntityLiving extends Entity {
this.bo = this.ticksLived;
}
- public int aI() {
+ public int aN() {
return this.aV;
}
@@ -328,7 +338,7 @@ public abstract class EntityLiving extends Entity {
nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
nbttagcompound.setShort("DeathTime", (short) this.deathTicks);
nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
- nbttagcompound.setFloat("AbsorptionAmount", this.bn());
+ nbttagcompound.setFloat("AbsorptionAmount", this.bs());
ItemStack[] aitemstack = this.getEquipment();
int i = aitemstack.length;
@@ -342,7 +352,7 @@ public abstract class EntityLiving extends Entity {
}
}
- nbttagcompound.set("Attributes", GenericAttributes.a(this.aX()));
+ nbttagcompound.set("Attributes", GenericAttributes.a(this.bc()));
aitemstack = this.getEquipment();
i = aitemstack.length;
@@ -369,18 +379,20 @@ public abstract class EntityLiving extends Entity {
public void a(NBTTagCompound nbttagcompound) {
this.m(nbttagcompound.getFloat("AbsorptionAmount"));
- if (nbttagcompound.hasKey("Attributes") && this.world != null && !this.world.isStatic) {
- GenericAttributes.a(this.aX(), nbttagcompound.getList("Attributes"), this.world == null ? null : this.world.getLogger());
+ if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isStatic) {
+ GenericAttributes.a(this.bc(), nbttagcompound.getList("Attributes", 10));
}
- if (nbttagcompound.hasKey("ActiveEffects")) {
- NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects");
+ if (nbttagcompound.hasKeyOfType("ActiveEffects", 9)) {
+ NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects", 10);
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
MobEffect mobeffect = MobEffect.b(nbttagcompound1);
- this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
+ if (mobeffect != null) {
+ this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
+ }
}
}
@@ -388,14 +400,14 @@ public abstract class EntityLiving extends Entity {
if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth");
if (nbtbase.getTypeId() == 5) {
- this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagFloat) nbtbase).data);
+ this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagFloat) nbtbase).c());
} else if (nbtbase.getTypeId() == 3) {
- this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagInt) nbtbase).data);
+ this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagInt) nbtbase).d());
}
}
// CraftBukkit end
- if (nbttagcompound.hasKey("HealF")) {
+ if (nbttagcompound.hasKeyOfType("HealF", 99)) {
this.setHealth(nbttagcompound.getFloat("HealF"));
} else {
NBTBase nbtbase = nbttagcompound.get("Health");
@@ -403,9 +415,9 @@ public abstract class EntityLiving extends Entity {
if (nbtbase == null) {
this.setHealth(this.getMaxHealth());
} else if (nbtbase.getTypeId() == 5) {
- this.setHealth(((NBTTagFloat) nbtbase).data);
+ this.setHealth(((NBTTagFloat) nbtbase).h());
} else if (nbtbase.getTypeId() == 2) {
- this.setHealth((float) ((NBTTagShort) nbtbase).data);
+ this.setHealth((float) ((NBTTagShort) nbtbase).e());
}
}
@@ -414,7 +426,7 @@ public abstract class EntityLiving extends Entity {
this.attackTicks = nbttagcompound.getShort("AttackTime");
}
- protected void aJ() {
+ protected void removeAllEffects() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@@ -476,7 +488,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public void aK() {
+ public void aP() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@@ -532,11 +544,11 @@ public abstract class EntityLiving extends Entity {
return true;
}
- public boolean aM() {
+ public boolean aR() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
- public void k(int i) {
+ public void m(int i) {
MobEffect mobeffect = (MobEffect) this.effects.remove(Integer.valueOf(i));
if (mobeffect != null) {
@@ -547,22 +559,22 @@ public abstract class EntityLiving extends Entity {
protected void a(MobEffect mobeffect) {
this.updateEffects = true;
if (!this.world.isStatic) {
- MobEffectList.byId[mobeffect.getEffectId()].b(this, this.aX(), mobeffect.getAmplifier());
+ MobEffectList.byId[mobeffect.getEffectId()].b(this, this.bc(), mobeffect.getAmplifier());
}
}
protected void a(MobEffect mobeffect, boolean flag) {
this.updateEffects = true;
if (flag && !this.world.isStatic) {
- MobEffectList.byId[mobeffect.getEffectId()].a(this, this.aX(), mobeffect.getAmplifier());
- MobEffectList.byId[mobeffect.getEffectId()].b(this, this.aX(), mobeffect.getAmplifier());
+ MobEffectList.byId[mobeffect.getEffectId()].a(this, this.bc(), mobeffect.getAmplifier());
+ MobEffectList.byId[mobeffect.getEffectId()].b(this, this.bc(), mobeffect.getAmplifier());
}
}
protected void b(MobEffect mobeffect) {
this.updateEffects = true;
if (!this.world.isStatic) {
- MobEffectList.byId[mobeffect.getEffectId()].a(this, this.aX(), mobeffect.getAmplifier());
+ MobEffectList.byId[mobeffect.getEffectId()].a(this, this.bc(), mobeffect.getAmplifier());
}
}
@@ -622,7 +634,7 @@ public abstract class EntityLiving extends Entity {
this.aV = 0;
if (this.getHealth() <= 0.0F) {
return false;
- } else if (damagesource.m() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
+ } else if (damagesource.o() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
return false;
} else {
if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) {
@@ -683,7 +695,7 @@ public abstract class EntityLiving extends Entity {
if (flag) {
this.world.broadcastEntityEffect(this, (byte) 2);
if (damagesource != DamageSource.DROWN) {
- this.K();
+ this.Q();
}
if (entity != null) {
@@ -702,14 +714,20 @@ public abstract class EntityLiving extends Entity {
}
}
+ String s;
+
if (this.getHealth() <= 0.0F) {
- if (flag) {
- this.makeSound(this.aP(), this.ba(), this.bb());
+ s = this.aU();
+ if (flag && s != null) {
+ this.makeSound(s, this.bf(), this.bg());
}
this.die(damagesource);
- } else if (flag) {
- this.makeSound(this.aO(), this.ba(), this.bb());
+ } else {
+ s = this.aT();
+ if (flag && s != null) {
+ this.makeSound(s, this.bf(), this.bg());
+ }
}
return true;
@@ -730,13 +748,13 @@ public abstract class EntityLiving extends Entity {
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
- this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
+ this.world.addParticle("iconcrack_" + Item.b(itemstack.getItem()), vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
}
}
public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity();
- EntityLiving entityliving = this.aS();
+ EntityLiving entityliving = this.aX();
if (this.bb >= 0 && entityliving != null) {
entityliving.b(this, this.bb);
@@ -754,14 +772,14 @@ public abstract class EntityLiving extends Entity {
i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
}
- if (!this.isBaby() && this.world.getGameRules().getBoolean("doMobLoot")) {
+ if (this.aG() && this.world.getGameRules().getBoolean("doMobLoot")) {
this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
if (false && this.lastDamageByPlayerTime > 0) { // CraftBukkit - move rare item drop call to dropDeathLoot
int j = this.random.nextInt(200) - i;
if (j < 5) {
- this.l(j <= 0 ? 1 : 0);
+ this.getRareDrop(j <= 0 ? 1 : 0);
}
}
} else { // CraftBukkit
@@ -776,7 +794,7 @@ public abstract class EntityLiving extends Entity {
public void a(Entity entity, float f, double d0, double d1) {
if (this.random.nextDouble() >= this.getAttributeInstance(GenericAttributes.c).getValue()) {
- this.an = true;
+ this.am = true;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1);
float f2 = 0.4F;
@@ -792,29 +810,29 @@ public abstract class EntityLiving extends Entity {
}
}
- protected String aO() {
- return "damage.hit";
+ protected String aT() {
+ return "game.neutral.hurt";
}
- protected String aP() {
- return "damage.hit";
+ protected String aU() {
+ return "game.neutral.die";
}
// CraftBukkit start - Change return type to ItemStack
- protected ItemStack l(int i) {
+ protected ItemStack getRareDrop(int i) {
return null;
}
// CraftBukkit end
protected void dropDeathLoot(boolean flag, int i) {}
- public boolean e() {
+ public boolean h_() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
- int l = this.world.getTypeId(i, j, k);
+ Block block = this.world.getType(i, j, k);
- return l == Block.LADDER.id || l == Block.VINE.id;
+ return block == Blocks.LADDER || block == Blocks.VINE;
}
public boolean isAlive() {
@@ -842,24 +860,26 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
if (i > 0) {
- if (i > 4) {
- this.makeSound("damage.fallbig", 1.0F, 1.0F);
- } else {
- this.makeSound("damage.fallsmall", 1.0F, 1.0F);
- }
-
+ this.makeSound(this.o(org.bukkit.util.NumberConversions.ceil(i)), 1.0F, 1.0F); // CraftBukkit - ceil
this.damageEntity(DamageSource.FALL, (float) i);
- int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
+ int j = MathHelper.floor(this.locX);
+ int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
+ int l = MathHelper.floor(this.locZ);
+ Block block = this.world.getType(j, k, l);
- if (j > 0) {
- StepSound stepsound = Block.byId[j].stepSound;
+ if (block.getMaterial() != Material.AIR) {
+ StepSound stepsound = block.stepSound;
this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F);
}
}
}
- public int aQ() {
+ protected String o(int i) {
+ return i > 4 ? "game.neutral.hurt.fall.big" : "game.neutral.hurt.fall.small";
+ }
+
+ public int aV() {
int i = 0;
ItemStack[] aitemstack = this.getEquipment();
int j = aitemstack.length;
@@ -881,7 +901,7 @@ public abstract class EntityLiving extends Entity {
protected float b(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
- int i = 25 - this.aQ();
+ int i = 25 - this.aV();
float f1 = f * (float) i;
this.h(f);
@@ -892,36 +912,40 @@ public abstract class EntityLiving extends Entity {
}
protected float c(DamageSource damagesource, float f) {
- if (this instanceof EntityZombie) {
- f = f;
- }
-
- int i;
- int j;
- float f1;
-
- if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
- i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
- j = 25 - i;
- f1 = f * (float) j;
- f = f1 / 25.0F;
- }
-
- if (f <= 0.0F) {
- return 0.0F;
+ if (damagesource.h()) {
+ return f;
} else {
- i = EnchantmentManager.a(this.getEquipment(), damagesource);
- if (i > 20) {
- i = 20;
+ if (this instanceof EntityZombie) {
+ f = f;
}
- if (i > 0 && i <= 20) {
+ int i;
+ int j;
+ float f1;
+
+ if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
+ i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
j = 25 - i;
f1 = f * (float) j;
f = f1 / 25.0F;
}
- return f;
+ if (f <= 0.0F) {
+ return 0.0F;
+ } else {
+ i = EnchantmentManager.a(this.getEquipment(), damagesource);
+ if (i > 20) {
+ i = 20;
+ }
+
+ if (i > 0 && i <= 20) {
+ j = 25 - i;
+ f1 = f * (float) j;
+ f = f1 / 25.0F;
+ }
+
+ return f;
+ }
}
}
@@ -931,23 +955,23 @@ public abstract class EntityLiving extends Entity {
f = this.c(damagesource, f);
float f1 = f;
- f = Math.max(f - this.bn(), 0.0F);
- this.m(this.bn() - (f1 - f));
+ f = Math.max(f - this.bs(), 0.0F);
+ this.m(this.bs() - (f1 - f));
if (f != 0.0F) {
float f2 = this.getHealth();
this.setHealth(f2 - f);
- this.aR().a(damagesource, f2, f);
- this.m(this.bn() - f);
+ this.aW().a(damagesource, f2, f);
+ this.m(this.bs() - f);
}
}
}
- public CombatTracker aR() {
+ public CombatTracker aW() {
return this.combatTracker;
}
- public EntityLiving aS() {
+ public EntityLiving aX() {
return (EntityLiving) (this.combatTracker.c() != null ? this.combatTracker.c() : (this.killer != null ? this.killer : (this.lastDamager != null ? this.lastDamager : null)));
}
@@ -955,34 +979,34 @@ public abstract class EntityLiving extends Entity {
return (float) this.getAttributeInstance(GenericAttributes.a).getValue();
}
- public final int aU() {
+ public final int aZ() {
return this.datawatcher.getByte(9);
}
- public final void m(int i) {
+ public final void p(int i) {
this.datawatcher.watch(9, Byte.valueOf((byte) i));
}
- private int h() {
+ private int j() {
return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6);
}
- public void aV() {
- if (!this.au || this.av >= this.h() / 2 || this.av < 0) {
+ public void ba() {
+ if (!this.au || this.av >= this.j() / 2 || this.av < 0) {
this.av = -1;
this.au = true;
if (this.world instanceof WorldServer) {
- ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet18ArmAnimation(this, 1)));
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAnimation(this, 0)));
}
}
}
- protected void C() {
+ protected void G() {
this.damageEntity(DamageSource.OUT_OF_WORLD, 4.0F);
}
- protected void aW() {
- int i = this.h();
+ protected void bb() {
+ int i = this.j();
if (this.au) {
++this.av;
@@ -998,10 +1022,10 @@ public abstract class EntityLiving extends Entity {
}
public AttributeInstance getAttributeInstance(IAttribute iattribute) {
- return this.aX().a(iattribute);
+ return this.bc().a(iattribute);
}
- public AttributeMapBase aX() {
+ public AttributeMapBase bc() {
if (this.d == null) {
this.d = new AttributeMapServer();
}
@@ -1013,7 +1037,7 @@ public abstract class EntityLiving extends Entity {
return EnumMonsterType.UNDEFINED;
}
- public abstract ItemStack aZ();
+ public abstract ItemStack be();
public abstract ItemStack getEquipment(int i);
@@ -1034,15 +1058,15 @@ public abstract class EntityLiving extends Entity {
public abstract ItemStack[] getEquipment();
- protected float ba() {
+ protected float bf() {
return 1.0F;
}
- protected float bb() {
+ protected float bg() {
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
- protected boolean bc() {
+ protected boolean bh() {
return this.getHealth() <= 0.0F;
}
@@ -1054,24 +1078,25 @@ public abstract class EntityLiving extends Entity {
double d0 = entity.locX;
double d1 = entity.boundingBox.b + (double) entity.length;
double d2 = entity.locZ;
+ byte b0 = 3;
- 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);
+ for (int i = -b0; i <= b0; ++i) {
+ for (int j = -b0; j < b0; ++j) {
+ if (i != 0 || j != 0) {
+ int k = (int) (this.locX + (double) i);
+ int l = (int) (this.locZ + (double) j);
+ AxisAlignedBB axisalignedbb = this.boundingBox.c((double) i, 1.0D, (double) j);
if (this.world.a(axisalignedbb).isEmpty()) {
- if (this.world.w(i, (int) this.locY, j)) {
- this.enderTeleportTo(this.locX + d3, this.locY + 1.0D, this.locZ + d4);
+ if (World.a((IBlockAccess) this.world, k, (int) this.locY, l)) {
+ this.enderTeleportTo(this.locX + (double) i, this.locY + 1.0D, this.locZ + (double) j);
return;
}
- if (this.world.w(i, (int) this.locY - 1, j) || this.world.getMaterial(i, (int) this.locY - 1, j) == Material.WATER) {
- d0 = this.locX + d3;
+ if (World.a((IBlockAccess) this.world, k, (int) this.locY - 1, l) || this.world.getType(k, (int) this.locY - 1, l).getMaterial() == Material.WATER) {
+ d0 = this.locX + (double) i;
d1 = this.locY + 1.0D;
- d2 = this.locZ + d4;
+ d2 = this.locZ + (double) j;
}
}
}
@@ -1081,7 +1106,7 @@ public abstract class EntityLiving extends Entity {
this.enderTeleportTo(d0, d1, d2);
}
- protected void be() {
+ protected void bj() {
this.motY = 0.41999998688697815D;
if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
@@ -1094,15 +1119,15 @@ public abstract class EntityLiving extends Entity {
this.motZ += (double) (MathHelper.cos(f) * 0.2F);
}
- this.an = true;
+ this.am = true;
}
public void e(float f, float f1) {
double d0;
- if (this.H() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
+ if (this.M() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
- this.a(f, f1, this.bf() ? 0.04F : 0.02F);
+ this.a(f, f1, this.bk() ? 0.04F : 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
@@ -1111,7 +1136,7 @@ public abstract class EntityLiving extends Entity {
if (this.positionChanged && this.c(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
- } else if (this.J() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
+ } else if (this.P() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
this.a(f, f1, 0.02F);
this.move(this.motX, this.motY, this.motZ);
@@ -1126,19 +1151,14 @@ public abstract class EntityLiving extends Entity {
float f2 = 0.91F;
if (this.onGround) {
- f2 = 0.54600006F;
- int i = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
-
- if (i > 0) {
- f2 = Block.byId[i].frictionFactor * 0.91F;
- }
+ f2 = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)).frictionFactor * 0.91F;
}
float f3 = 0.16277136F / (f2 * f2 * f2);
float f4;
if (this.onGround) {
- f4 = this.bg() * f3;
+ f4 = this.bl() * f3;
} else {
f4 = this.aR;
}
@@ -1146,15 +1166,10 @@ public abstract class EntityLiving extends Entity {
this.a(f, f1, f4);
f2 = 0.91F;
if (this.onGround) {
- f2 = 0.54600006F;
- int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ));
-
- if (j > 0) {
- f2 = Block.byId[j].frictionFactor * 0.91F;
- }
+ f2 = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)).frictionFactor * 0.91F;
}
- if (this.e()) {
+ if (this.h_()) {
float f5 = 0.15F;
if (this.motX < (double) (-f5)) {
@@ -1186,7 +1201,7 @@ public abstract class EntityLiving extends Entity {
}
this.move(this.motX, this.motY, this.motZ);
- if (this.positionChanged && this.e()) {
+ if (this.positionChanged && this.h_()) {
this.motY = 0.2D;
}
@@ -1218,12 +1233,12 @@ public abstract class EntityLiving extends Entity {
this.aH += this.aG;
}
- protected boolean bf() {
+ protected boolean bk() {
return false;
}
- public float bg() {
- return this.bf() ? this.bp : 0.1F;
+ public float bl() {
+ return this.bk() ? this.bp : 0.1F;
}
public void i(float f) {
@@ -1239,10 +1254,10 @@ public abstract class EntityLiving extends Entity {
return false;
}
- public void l_() {
- super.l_();
+ public void h() {
+ super.h();
if (!this.world.isStatic) {
- int i = this.aU();
+ int i = this.aZ();
if (i > 0) {
if (this.aw <= 0) {
@@ -1251,7 +1266,7 @@ public abstract class EntityLiving extends Entity {
--this.aw;
if (this.aw <= 0) {
- this.m(i - 1);
+ this.p(i - 1);
}
}
@@ -1260,7 +1275,7 @@ public abstract class EntityLiving extends Entity {
ItemStack itemstack1 = this.getEquipment(j);
if (!ItemStack.matches(itemstack1, itemstack)) {
- ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, j, itemstack1)));
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutEntityEquipment(this.getId(), j, itemstack1)));
if (itemstack != null) {
this.d.a(itemstack.D());
}
@@ -1274,7 +1289,7 @@ public abstract class EntityLiving extends Entity {
}
}
- this.c();
+ this.e();
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1);
@@ -1368,7 +1383,7 @@ public abstract class EntityLiving extends Entity {
return f1;
}
- public void c() {
+ public void e() {
if (this.bq > 0) {
--this.bq;
}
@@ -1384,7 +1399,7 @@ public abstract class EntityLiving extends Entity {
--this.bh;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
- } else if (!this.bm()) {
+ } else if (!this.br()) {
this.motX *= 0.98D;
this.motY *= 0.98D;
this.motZ *= 0.98D;
@@ -1403,19 +1418,19 @@ public abstract class EntityLiving extends Entity {
}
this.world.methodProfiler.a("ai");
- if (this.bc()) {
+ if (this.bh()) {
this.bd = false;
this.be = 0.0F;
this.bf = 0.0F;
this.bg = 0.0F;
- } else if (this.bm()) {
- if (this.bf()) {
+ } else if (this.br()) {
+ if (this.bk()) {
this.world.methodProfiler.a("newAi");
- this.bi();
+ this.bn();
this.world.methodProfiler.b();
} else {
this.world.methodProfiler.a("oldAi");
- this.bl();
+ this.bq();
this.world.methodProfiler.b();
this.aP = this.yaw;
}
@@ -1424,9 +1439,9 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
if (this.bd) {
- if (!this.H() && !this.J()) {
+ if (!this.M() && !this.P()) {
if (this.onGround && this.bq == 0) {
- this.be();
+ this.bj();
this.bq = 10;
}
} else {
@@ -1445,15 +1460,15 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
if (!this.world.isStatic) {
- this.bj();
+ this.bo();
}
this.world.methodProfiler.b();
}
- protected void bi() {}
+ protected void bn() {}
- protected void bj() {
+ protected void bo() {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
if (list != null && !list.isEmpty()) {
@@ -1467,7 +1482,7 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
- if (entity.M()) {
+ if (entity.S()) {
this.n(entity);
}
}
@@ -1478,16 +1493,16 @@ public abstract class EntityLiving extends Entity {
entity.collide(this);
}
- public void V() {
- super.V();
+ public void ab() {
+ super.ab();
this.aW = this.aX;
this.aX = 0.0F;
this.fallDistance = 0.0F;
}
- protected void bk() {}
+ protected void bp() {}
- protected void bl() {
+ protected void bq() {
++this.aV;
}
@@ -1500,15 +1515,15 @@ public abstract class EntityLiving extends Entity {
EntityTracker entitytracker = ((WorldServer) this.world).getTracker();
if (entity instanceof EntityItem) {
- entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
+ entitytracker.a(entity, (Packet) (new PacketPlayOutCollect(entity.getId(), this.getId())));
}
if (entity instanceof EntityArrow) {
- entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
+ entitytracker.a(entity, (Packet) (new PacketPlayOutCollect(entity.getId(), this.getId())));
}
if (entity instanceof EntityExperienceOrb) {
- entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
+ entitytracker.a(entity, (Packet) (new PacketPlayOutCollect(entity.getId(), this.getId())));
}
}
}
@@ -1517,7 +1532,7 @@ public abstract class EntityLiving extends Entity {
return this.world.a(this.world.getVec3DPool().create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), this.world.getVec3DPool().create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
}
- public Vec3D aa() {
+ public Vec3D ag() {
return this.j(1.0F);
}
@@ -1545,15 +1560,15 @@ public abstract class EntityLiving extends Entity {
}
}
- public boolean bm() {
+ public boolean br() {
return !this.world.isStatic;
}
- public boolean L() {
+ public boolean R() {
return !this.dead;
}
- public boolean M() {
+ public boolean S() {
return !this.dead;
}
@@ -1561,7 +1576,7 @@ public abstract class EntityLiving extends Entity {
return this.length * 0.85F;
}
- protected void K() {
+ protected void Q() {
this.velocityChanged = this.random.nextDouble() >= this.getAttributeInstance(GenericAttributes.c).getValue();
}
@@ -1569,7 +1584,7 @@ public abstract class EntityLiving extends Entity {
return this.aP;
}
- public float bn() {
+ public float bs() {
return this.br;
}
diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java
index c2947b7ae1..1fe6b073d4 100644
--- a/src/main/java/net/minecraft/server/EntityMagmaCube.java
+++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java
@@ -7,16 +7,16 @@ public class EntityMagmaCube extends EntitySlime {
this.fireProof = true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.d).setValue(0.20000000298023224D);
}
public boolean canSpawn() {
- return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
+ return this.world.difficulty != EnumDifficulty.PEACEFUL && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- public int aQ() {
+ public int aV() {
return this.getSize() * 3;
}
@@ -24,32 +24,32 @@ public class EntityMagmaCube extends EntitySlime {
return 1.0F;
}
- protected String bJ() {
+ protected String bN() {
return "flame";
}
- protected EntitySlime bK() {
+ protected EntitySlime bO() {
return new EntityMagmaCube(this.world);
}
- protected int getLootId() {
- return Item.MAGMA_CREAM.id;
+ protected Item getLoot() {
+ return Items.MAGMA_CREAM;
}
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - Whole method
java.util.List loot = new java.util.ArrayList();
- int j = this.getLootId();
+ Item item = this.getLoot();
- if (j > 0 && this.getSize() > 1) {
- int k = this.random.nextInt(4) - 2;
+ if (item != null && this.getSize() > 1) {
+ int j = this.random.nextInt(4) - 2;
if (i > 0) {
- k += this.random.nextInt(i + 1);
+ j += this.random.nextInt(i + 1);
}
- if (k > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(j, k));
+ if (j > 0) {
+ loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), j));
}
}
@@ -61,46 +61,38 @@ public class EntityMagmaCube extends EntitySlime {
return false;
}
- protected int bL() {
- return super.bL() * 4;
+ protected int bP() {
+ return super.bP() * 4;
}
- protected void bM() {
+ protected void bQ() {
this.h *= 0.9F;
}
- protected void be() {
+ protected void bj() {
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
- this.an = true;
+ this.am = true;
}
protected void b(float f) {}
- protected boolean bN() {
+ protected boolean bR() {
return true;
}
- protected int bO() {
- return super.bO() + 2;
+ protected int bS() {
+ return super.bS() + 2;
}
- protected String aO() {
- return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
- }
-
- protected String aP() {
- return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
- }
-
- protected String bP() {
+ protected String bT() {
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
}
- public boolean J() {
+ public boolean P() {
return false;
}
- protected boolean bQ() {
+ protected boolean bU() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
index b8f1030884..b570b00e02 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -14,15 +14,14 @@ import org.bukkit.util.Vector;
public abstract class EntityMinecartAbstract extends Entity {
private boolean a;
- private final IUpdatePlayerListBox b;
- private String c;
+ private String b;
private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
- private int e;
+ private int d;
+ private double e;
private double f;
private double g;
private double h;
private double i;
- private double j;
// CraftBukkit start
public boolean slowWhenEmpty = true;
@@ -37,10 +36,9 @@ public abstract class EntityMinecartAbstract extends Entity {
public EntityMinecartAbstract(World world) {
super(world);
- this.m = true;
+ this.l = true;
this.a(0.98F, 0.7F);
this.height = this.length / 2.0F;
- this.b = world != null ? world.a(this) : null;
}
public static EntityMinecartAbstract a(World world, double d0, double d1, double d2, int i) {
@@ -60,16 +58,19 @@ public abstract class EntityMinecartAbstract extends Entity {
case 5:
return new EntityMinecartHopper(world, d0, d1, d2);
+ case 6:
+ return new EntityMinecartCommandBlock(world, d0, d1, d2);
+
default:
return new EntityMinecartRideable(world, d0, d1, d2);
}
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
- protected void a() {
+ protected void c() {
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(1));
this.datawatcher.a(19, new Float(0.0F));
@@ -79,14 +80,14 @@ public abstract class EntityMinecartAbstract extends Entity {
}
public AxisAlignedBB g(Entity entity) {
- return entity.M() ? entity.boundingBox : null;
+ return entity.S() ? entity.boundingBox : null;
}
- public AxisAlignedBB E() {
+ public AxisAlignedBB J() {
return null;
}
- public boolean M() {
+ public boolean S() {
return true;
}
@@ -103,7 +104,7 @@ public abstract class EntityMinecartAbstract extends Entity {
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
- public double Y() {
+ public double ae() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@@ -126,9 +127,9 @@ public abstract class EntityMinecartAbstract extends Entity {
f = (float) event.getDamage();
// CraftBukkit end
- this.h(-this.k());
+ this.j(-this.l());
this.c(10);
- this.K();
+ this.Q();
this.setDamage(this.getDamage() + f * 10.0F);
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
@@ -147,7 +148,7 @@ public abstract class EntityMinecartAbstract extends Entity {
}
// CraftBukkit end
- if (flag && !this.c()) {
+ if (flag && !this.k_()) {
this.die();
} else {
this.a(damagesource);
@@ -163,27 +164,24 @@ public abstract class EntityMinecartAbstract extends Entity {
public void a(DamageSource damagesource) {
this.die();
- ItemStack itemstack = new ItemStack(Item.MINECART, 1);
+ ItemStack itemstack = new ItemStack(Items.MINECART, 1);
- if (this.c != null) {
- itemstack.c(this.c);
+ if (this.b != null) {
+ itemstack.c(this.b);
}
this.a(itemstack, 0.0F);
}
- public boolean L() {
+ public boolean R() {
return !this.dead;
}
public void die() {
super.die();
- if (this.b != null) {
- this.b.a();
- }
}
- public void l_() {
+ public void h() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@@ -192,12 +190,8 @@ public abstract class EntityMinecartAbstract extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
- if (this.b != null) {
- this.b.a();
- }
-
- if (this.j() > 0) {
- this.c(this.j() - 1);
+ if (this.getType() > 0) {
+ this.c(this.getType() - 1);
}
if (this.getDamage() > 0.0F) {
@@ -205,7 +199,7 @@ public abstract class EntityMinecartAbstract extends Entity {
}
if (this.locY < -64.0D) {
- this.C();
+ this.G();
}
int i;
@@ -214,12 +208,12 @@ public abstract class EntityMinecartAbstract extends Entity {
this.world.methodProfiler.a("portal");
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
- i = this.z();
- if (this.ap) {
+ i = this.D();
+ if (this.ao) {
if (true || minecraftserver.getAllowNether()) { // CraftBukkit - multi-world should still allow teleport even if default vanilla nether disabled
- if (this.vehicle == null && this.aq++ >= i) {
- this.aq = i;
- this.portalCooldown = this.ac();
+ if (this.vehicle == null && this.ap++ >= i) {
+ this.ap = i;
+ this.portalCooldown = this.ai();
byte b0;
if (this.world.worldProvider.dimension == -1) {
@@ -231,15 +225,15 @@ public abstract class EntityMinecartAbstract extends Entity {
this.b(b0);
}
- this.ap = false;
+ this.ao = false;
}
} else {
- if (this.aq > 0) {
- this.aq -= 4;
+ if (this.ap > 0) {
+ this.ap -= 4;
}
- if (this.aq < 0) {
- this.aq = 0;
+ if (this.ap < 0) {
+ this.ap = 0;
}
}
@@ -251,15 +245,15 @@ public abstract class EntityMinecartAbstract extends Entity {
}
if (this.world.isStatic) {
- if (this.e > 0) {
- double d0 = this.locX + (this.f - this.locX) / (double) this.e;
- double d1 = this.locY + (this.g - this.locY) / (double) this.e;
- double d2 = this.locZ + (this.h - this.locZ) / (double) this.e;
- double d3 = MathHelper.g(this.i - (double) this.yaw);
+ if (this.d > 0) {
+ double d0 = this.locX + (this.e - this.locX) / (double) this.d;
+ double d1 = this.locY + (this.f - this.locY) / (double) this.d;
+ double d2 = this.locZ + (this.g - this.locZ) / (double) this.d;
+ double d3 = MathHelper.g(this.h - (double) this.yaw);
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.e);
- this.pitch = (float) ((double) this.pitch + (this.j - (double) this.pitch) / (double) this.e);
- --this.e;
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.d);
+ this.pitch = (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d);
+ --this.d;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
} else {
@@ -276,26 +270,26 @@ public abstract class EntityMinecartAbstract extends Entity {
i = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
- if (BlockMinecartTrackAbstract.d_(this.world, j, i - 1, k)) {
+ if (BlockMinecartTrackAbstract.b_(this.world, j, i - 1, k)) {
--i;
}
double d4 = this.maxSpeed; // CraftBukkit
double d5 = 0.0078125D;
- int l = this.world.getTypeId(j, i, k);
+ Block block = this.world.getType(j, i, k);
- if (BlockMinecartTrackAbstract.e_(l)) {
- int i1 = this.world.getData(j, i, k);
+ if (BlockMinecartTrackAbstract.a(block)) {
+ int l = this.world.getData(j, i, k);
- this.a(j, i, k, d4, d5, l, i1);
- if (l == Block.ACTIVATOR_RAIL.id) {
- this.a(j, i, k, (i1 & 8) != 0);
+ this.a(j, i, k, d4, d5, block, l);
+ if (block == Blocks.ACTIVATOR_RAIL) {
+ this.a(j, i, k, (l & 8) != 0);
}
} else {
this.b(d4);
}
- this.D();
+ this.I();
this.pitch = 0.0F;
double d6 = this.lastX - this.locX;
double d7 = this.lastZ - this.locZ;
@@ -332,10 +326,10 @@ public abstract class EntityMinecartAbstract extends Entity {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
if (list != null && !list.isEmpty()) {
- for (int j1 = 0; j1 < list.size(); ++j1) {
- Entity entity = (Entity) list.get(j1);
+ for (int i1 = 0; i1 < list.size(); ++i1) {
+ Entity entity = (Entity) list.get(i1);
- if (entity != this.passenger && entity.M() && entity instanceof EntityMinecartAbstract) {
+ if (entity != this.passenger && entity.S() && entity instanceof EntityMinecartAbstract) {
entity.collide(this);
}
}
@@ -388,7 +382,7 @@ public abstract class EntityMinecartAbstract extends Entity {
}
}
- protected void a(int i, int j, int k, double d0, double d1, int l, int i1) {
+ protected void a(int i, int j, int k, double d0, double d1, Block block, int l) {
this.fallDistance = 0.0F;
Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
@@ -396,36 +390,36 @@ public abstract class EntityMinecartAbstract extends Entity {
boolean flag = false;
boolean flag1 = false;
- if (l == Block.GOLDEN_RAIL.id) {
- flag = (i1 & 8) != 0;
+ if (block == Blocks.GOLDEN_RAIL) {
+ flag = (l & 8) != 0;
flag1 = !flag;
}
- if (((BlockMinecartTrackAbstract) Block.byId[l]).e()) {
- i1 &= 7;
+ if (((BlockMinecartTrackAbstract) block).e()) {
+ l &= 7;
}
- if (i1 >= 2 && i1 <= 5) {
+ if (l >= 2 && l <= 5) {
this.locY = (double) (j + 1);
}
- if (i1 == 2) {
+ if (l == 2) {
this.motX -= d1;
}
- if (i1 == 3) {
+ if (l == 3) {
this.motX += d1;
}
- if (i1 == 4) {
+ if (l == 4) {
this.motZ += d1;
}
- if (i1 == 5) {
+ if (l == 5) {
this.motZ -= d1;
}
- int[][] aint = matrix[i1];
+ int[][] aint = matrix[l];
double d2 = (double) (aint[1][0] - aint[0][0]);
double d3 = (double) (aint[1][2] - aint[0][2]);
double d4 = Math.sqrt(d2 * d2 + d3 * d3);
@@ -532,7 +526,7 @@ public abstract class EntityMinecartAbstract extends Entity {
this.setPosition(this.locX, this.locY + (double) aint[1][1], this.locZ);
}
- this.h();
+ this.i();
Vec3D vec3d1 = this.a(this.locX, this.locY, this.locZ);
if (vec3d1 != null && vec3d != null) {
@@ -547,13 +541,13 @@ public abstract class EntityMinecartAbstract extends Entity {
this.setPosition(this.locX, vec3d1.d, this.locZ);
}
- int j1 = MathHelper.floor(this.locX);
- int k1 = MathHelper.floor(this.locZ);
+ int i1 = MathHelper.floor(this.locX);
+ int j1 = MathHelper.floor(this.locZ);
- if (j1 != i || k1 != k) {
+ if (i1 != i || j1 != k) {
d6 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- this.motX = d6 * (double) (j1 - i);
- this.motZ = d6 * (double) (k1 - k);
+ this.motX = d6 * (double) (i1 - i);
+ this.motZ = d6 * (double) (j1 - k);
}
if (flag) {
@@ -564,23 +558,23 @@ public abstract class EntityMinecartAbstract extends Entity {
this.motX += this.motX / d15 * d16;
this.motZ += this.motZ / d15 * d16;
- } else if (i1 == 1) {
- if (this.world.u(i - 1, j, k)) {
+ } else if (l == 1) {
+ if (this.world.getType(i - 1, j, k).r()) {
this.motX = 0.02D;
- } else if (this.world.u(i + 1, j, k)) {
+ } else if (this.world.getType(i + 1, j, k).r()) {
this.motX = -0.02D;
}
- } else if (i1 == 0) {
- if (this.world.u(i, j, k - 1)) {
+ } else if (l == 0) {
+ if (this.world.getType(i, j, k - 1).r()) {
this.motZ = 0.02D;
- } else if (this.world.u(i, j, k + 1)) {
+ } else if (this.world.getType(i, j, k + 1).r()) {
this.motZ = -0.02D;
}
}
}
}
- protected void h() {
+ protected void i() {
if (this.passenger != null || !this.slowWhenEmpty) { // CraftBukkit
this.motX *= 0.996999979019165D;
this.motY *= 0.0D;
@@ -597,25 +591,25 @@ public abstract class EntityMinecartAbstract extends Entity {
int j = MathHelper.floor(d1);
int k = MathHelper.floor(d2);
- if (BlockMinecartTrackAbstract.d_(this.world, i, j - 1, k)) {
+ if (BlockMinecartTrackAbstract.b_(this.world, i, j - 1, k)) {
--j;
}
- int l = this.world.getTypeId(i, j, k);
+ Block block = this.world.getType(i, j, k);
- if (BlockMinecartTrackAbstract.e_(l)) {
- int i1 = this.world.getData(i, j, k);
+ if (BlockMinecartTrackAbstract.a(block)) {
+ int l = this.world.getData(i, j, k);
d1 = (double) j;
- if (((BlockMinecartTrackAbstract) Block.byId[l]).e()) {
- i1 &= 7;
+ if (((BlockMinecartTrackAbstract) block).e()) {
+ l &= 7;
}
- if (i1 >= 2 && i1 <= 5) {
+ if (l >= 2 && l <= 5) {
d1 = (double) (j + 1);
}
- int[][] aint = matrix[i1];
+ int[][] aint = matrix[l];
double d3 = 0.0D;
double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D;
@@ -659,26 +653,26 @@ public abstract class EntityMinecartAbstract extends Entity {
protected void a(NBTTagCompound nbttagcompound) {
if (nbttagcompound.getBoolean("CustomDisplayTile")) {
- this.i(nbttagcompound.getInt("DisplayTile"));
- this.j(nbttagcompound.getInt("DisplayData"));
- this.k(nbttagcompound.getInt("DisplayOffset"));
+ this.k(nbttagcompound.getInt("DisplayTile"));
+ this.l(nbttagcompound.getInt("DisplayData"));
+ this.m(nbttagcompound.getInt("DisplayOffset"));
}
- if (nbttagcompound.hasKey("CustomName") && nbttagcompound.getString("CustomName").length() > 0) {
- this.c = nbttagcompound.getString("CustomName");
+ if (nbttagcompound.hasKeyOfType("CustomName", 8) && nbttagcompound.getString("CustomName").length() > 0) {
+ this.b = nbttagcompound.getString("CustomName");
}
}
protected void b(NBTTagCompound nbttagcompound) {
- if (this.s()) {
+ if (this.t()) {
nbttagcompound.setBoolean("CustomDisplayTile", true);
- nbttagcompound.setInt("DisplayTile", this.m() == null ? 0 : this.m().id);
- nbttagcompound.setInt("DisplayData", this.o());
- nbttagcompound.setInt("DisplayOffset", this.q());
+ nbttagcompound.setInt("DisplayTile", this.n().getMaterial() == Material.AIR ? 0 : Block.b(this.n()));
+ nbttagcompound.setInt("DisplayData", this.p());
+ nbttagcompound.setInt("DisplayOffset", this.r());
}
- if (this.c != null && this.c.length() > 0) {
- nbttagcompound.setString("CustomName", this.c);
+ if (this.b != null && this.b.length() > 0) {
+ nbttagcompound.setString("CustomName", this.b);
}
}
@@ -697,7 +691,7 @@ public abstract class EntityMinecartAbstract extends Entity {
}
// CraftBukkit end
- if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && this.getType() == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
+ if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && this.m() == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
entity.mount(this);
}
@@ -720,8 +714,8 @@ public abstract class EntityMinecartAbstract extends Entity {
d1 *= d3;
d0 *= 0.10000000149011612D;
d1 *= 0.10000000149011612D;
- d0 *= (double) (1.0F - this.aa);
- d1 *= (double) (1.0F - this.aa);
+ d0 *= (double) (1.0F - this.Z);
+ d1 *= (double) (1.0F - this.Z);
d0 *= 0.5D;
d1 *= 0.5D;
if (entity instanceof EntityMinecartAbstract) {
@@ -738,13 +732,13 @@ public abstract class EntityMinecartAbstract extends Entity {
double d7 = entity.motX + this.motX;
double d8 = entity.motZ + this.motZ;
- if (((EntityMinecartAbstract) entity).getType() == 2 && this.getType() != 2) {
+ if (((EntityMinecartAbstract) entity).m() == 2 && this.m() != 2) {
this.motX *= 0.20000000298023224D;
this.motZ *= 0.20000000298023224D;
this.g(entity.motX - d0, 0.0D, entity.motZ - d1);
entity.motX *= 0.949999988079071D;
entity.motZ *= 0.949999988079071D;
- } else if (((EntityMinecartAbstract) entity).getType() != 2 && this.getType() == 2) {
+ } else if (((EntityMinecartAbstract) entity).m() != 2 && this.m() == 2) {
entity.motX *= 0.20000000298023224D;
entity.motZ *= 0.20000000298023224D;
entity.g(this.motX + d0, 0.0D, this.motZ + d1);
@@ -781,69 +775,66 @@ public abstract class EntityMinecartAbstract extends Entity {
this.datawatcher.watch(17, Integer.valueOf(i));
}
- public int j() {
+ public int getType() {
return this.datawatcher.getInt(17);
}
- public void h(int i) {
+ public void j(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
- public int k() {
+ public int l() {
return this.datawatcher.getInt(18);
}
- public abstract int getType();
+ public abstract int m();
- public Block m() {
- if (!this.s()) {
- return this.n();
+ public Block n() {
+ if (!this.t()) {
+ return this.o();
} else {
int i = this.getDataWatcher().getInt(20) & '\uffff';
- return i > 0 && i < Block.byId.length ? Block.byId[i] : null;
+ return Block.e(i);
}
}
- public Block n() {
- return null;
- }
-
- public int o() {
- return !this.s() ? this.p() : this.getDataWatcher().getInt(20) >> 16;
+ public Block o() {
+ return Blocks.AIR;
}
public int p() {
- return 0;
+ return !this.t() ? this.q() : this.getDataWatcher().getInt(20) >> 16;
}
public int q() {
- return !this.s() ? this.r() : this.getDataWatcher().getInt(21);
+ return 0;
}
public int r() {
+ return !this.t() ? this.s() : this.getDataWatcher().getInt(21);
+ }
+
+ public int s() {
return 6;
}
- public void i(int i) {
- this.getDataWatcher().watch(20, Integer.valueOf(i & '\uffff' | this.o() << 16));
- this.a(true);
- }
-
- public void j(int i) {
- Block block = this.m();
- int j = block == null ? 0 : block.id;
-
- this.getDataWatcher().watch(20, Integer.valueOf(j & '\uffff' | i << 16));
- this.a(true);
- }
-
public void k(int i) {
+ this.getDataWatcher().watch(20, Integer.valueOf(i & '\uffff' | this.p() << 16));
+ this.a(true);
+ }
+
+ public void l(int i) {
+ this.getDataWatcher().watch(20, Integer.valueOf(Block.b(this.n()) & '\uffff' | i << 16));
+ this.a(true);
+ }
+
+ public void m(int i) {
this.getDataWatcher().watch(21, Integer.valueOf(i));
this.a(true);
}
- public boolean s() {
+ public boolean t() {
return this.getDataWatcher().getByte(22) == 1;
}
@@ -852,19 +843,19 @@ public abstract class EntityMinecartAbstract extends Entity {
}
public void a(String s) {
- this.c = s;
+ this.b = s;
}
- public String getLocalizedName() {
- return this.c != null ? this.c : super.getLocalizedName();
+ public String getName() {
+ return this.b != null ? this.b : super.getName();
}
- public boolean c() {
- return this.c != null;
+ public boolean k_() {
+ return this.b != null;
}
- public String t() {
- return this.c;
+ public String u() {
+ return this.b;
}
// CraftBukkit start - Methods for getting and setting flying and derailed velocity modifiers
diff --git a/src/main/java/net/minecraft/server/EntityMinecartCommandBlockListener.java b/src/main/java/net/minecraft/server/EntityMinecartCommandBlockListener.java
new file mode 100644
index 0000000000..3139e57dab
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityMinecartCommandBlockListener.java
@@ -0,0 +1,25 @@
+package net.minecraft.server;
+
+// CraftBukkit - package-private -> public
+public class EntityMinecartCommandBlockListener extends CommandBlockListenerAbstract {
+
+ final EntityMinecartCommandBlock a;
+
+ EntityMinecartCommandBlockListener(EntityMinecartCommandBlock entityminecartcommandblock) {
+ this.a = entityminecartcommandblock;
+ this.sender = (org.bukkit.craftbukkit.entity.CraftMinecartCommand) entityminecartcommandblock.getBukkitEntity(); // CraftBukkit - Set the sender
+ }
+
+ public void e() {
+ this.a.getDataWatcher().watch(23, this.i());
+ this.a.getDataWatcher().watch(24, ChatSerializer.a(this.h()));
+ }
+
+ public ChunkCoordinates getChunkCoordinates() {
+ return new ChunkCoordinates(MathHelper.floor(this.a.locX), MathHelper.floor(this.a.locY + 0.5D), MathHelper.floor(this.a.locZ));
+ }
+
+ public World getWorld() {
+ return this.a.world;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index e89b106374..1d997e10f6 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -71,7 +71,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
}
itemstack.count -= j;
- EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
+ EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.getItem(), j, itemstack.getData()));
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
@@ -134,14 +134,14 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
}
- public String getName() {
- return this.c() ? this.t() : "container.minecart";
+ public String getInventoryName() {
+ return this.k_() ? this.u() : "container.minecart";
}
public int getMaxStackSize() {
@@ -171,7 +171,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
}
itemstack.count -= j;
- EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
+ EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.getItem(), j, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
@@ -210,12 +210,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
protected void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
+ NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) {
@@ -232,7 +232,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
return true;
}
- protected void h() {
+ protected void i() {
int i = 15 - Container.b((IInventory) this);
float f = 0.98F + (float) i * 0.001F;
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index ea7df6279a..88559240ed 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -9,24 +9,32 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
this.b = 5;
}
- public void c() {
- this.aW();
+ public void e() {
+ this.bb();
float f = this.d(1.0F);
if (f > 0.5F) {
this.aV += 2;
}
- super.c();
+ super.e();
}
- public void l_() {
- super.l_();
- if (!this.world.isStatic && this.world.difficulty == 0) {
+ public void h() {
+ super.h();
+ if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL) {
this.die();
}
}
+ protected String H() {
+ return "game.hostile.swim";
+ }
+
+ protected String O() {
+ return "game.hostile.swim.splash";
+ }
+
protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
@@ -67,6 +75,18 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
+ protected String aT() {
+ return "game.hostile.hurt";
+ }
+
+ protected String aU() {
+ return "game.hostile.die";
+ }
+
+ protected String o(int i) {
+ return i > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small";
+ }
+
public boolean m(Entity entity) {
float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue();
int i = 0;
@@ -92,8 +112,10 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
if (entity instanceof EntityLiving) {
- EnchantmentThorns.a(this, (EntityLiving) entity, this.random);
+ EnchantmentManager.a((EntityLiving) entity, (Entity) this);
}
+
+ EnchantmentManager.b(this, entity);
}
return flag;
@@ -107,10 +129,10 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public float a(int i, int j, int k) {
- return 0.5F - this.world.q(i, j, k);
+ return 0.5F - this.world.n(i, j, k);
}
- protected boolean i_() {
+ protected boolean j_() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
@@ -120,7 +142,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} else {
int l = this.world.getLightLevel(i, j, k);
- if (this.world.P()) {
+ if (this.world.O()) {
int i1 = this.world.j;
this.world.j = 10;
@@ -133,11 +155,15 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public boolean canSpawn() {
- return this.world.difficulty > 0 && this.i_() && super.canSpawn();
+ return this.world.difficulty != EnumDifficulty.PEACEFUL && this.j_() && super.canSpawn();
}
- protected void az() {
- super.az();
- this.aX().b(GenericAttributes.e);
+ protected void aD() {
+ super.aD();
+ this.bc().b(GenericAttributes.e);
+ }
+
+ protected boolean aG() {
+ return true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index abf7d270e8..a5f84c91c8 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -12,19 +12,19 @@ public class EntityMushroomCow extends EntityCow {
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
+ if (itemstack != null && itemstack.getItem() == Items.BOWL && this.getAge() >= 0) {
if (itemstack.count == 1) {
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Item.MUSHROOM_SOUP));
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Items.MUSHROOM_SOUP));
return true;
}
- if (entityhuman.inventory.pickup(new ItemStack(Item.MUSHROOM_SOUP)) && !entityhuman.abilities.canInstantlyBuild) {
+ if (entityhuman.inventory.pickup(new ItemStack(Items.MUSHROOM_SOUP)) && !entityhuman.abilities.canInstantlyBuild) {
entityhuman.inventory.splitStack(entityhuman.inventory.itemInHandIndex, 1);
return true;
}
}
- if (itemstack != null && itemstack.id == Item.SHEARS.id && this.getAge() >= 0) {
+ if (itemstack != null && itemstack.getItem() == Items.SHEARS && this.getAge() >= 0) {
// CraftBukkit start
PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
@@ -45,8 +45,11 @@ public class EntityMushroomCow extends EntityCow {
this.world.addEntity(entitycow);
for (int i = 0; i < 5; ++i) {
- this.world.addEntity(new EntityItem(this.world, this.locX, this.locY + (double) this.length, this.locZ, new ItemStack(Block.RED_MUSHROOM)));
+ this.world.addEntity(new EntityItem(this.world, this.locX, this.locY + (double) this.length, this.locZ, new ItemStack(Blocks.RED_MUSHROOM)));
}
+
+ itemstack.damage(1, entityhuman);
+ this.makeSound("mob.sheep.shear", 1.0F, 1.0F);
}
return true;
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 14bc0dd8b6..867abd75ee 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -10,7 +10,7 @@ public class EntityOcelot extends EntityTameableAnimal {
this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, this.bp);
- this.goalSelector.a(3, this.bq = new PathfinderGoalTempt(this, 0.6D, Item.RAW_FISH.id, true));
+ this.goalSelector.a(3, this.bq = new PathfinderGoalTempt(this, 0.6D, Items.RAW_FISH, true));
this.goalSelector.a(4, new PathfinderGoalAvoidPlayer(this, EntityHuman.class, 16.0F, 0.8D, 1.33D));
this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, 1.0D, 10.0F, 5.0F));
this.goalSelector.a(6, new PathfinderGoalJumpOnBlock(this, 1.33D));
@@ -22,12 +22,12 @@ public class EntityOcelot extends EntityTameableAnimal {
this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed(this, EntityChicken.class, 750, false));
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
- public void bk() {
+ public void bp() {
if (this.getControllerMove().a()) {
double d0 = this.getControllerMove().b();
@@ -51,12 +51,12 @@ public class EntityOcelot extends EntityTameableAnimal {
return !this.isTamed(); // CraftBukkit
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.30000001192092896D);
}
@@ -73,24 +73,24 @@ public class EntityOcelot extends EntityTameableAnimal {
this.setCatType(nbttagcompound.getInt("CatType"));
}
- protected String r() {
- return this.isTamed() ? (this.bY() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
+ protected String t() {
+ return this.isTamed() ? (this.cc() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
}
- protected String aO() {
+ protected String aT() {
return "mob.cat.hitt";
}
- protected String aP() {
+ protected String aU() {
return "mob.cat.hitt";
}
- protected float ba() {
+ protected float bf() {
return 0.4F;
}
- protected int getLootId() {
- return Item.LEATHER.id;
+ protected Item getLoot() {
+ return Items.LEATHER;
}
public boolean m(Entity entity) {
@@ -117,7 +117,7 @@ public class EntityOcelot extends EntityTameableAnimal {
if (entityhuman.getName().equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
this.bp.setSitting(!this.isSitting());
}
- } else if (this.bq.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.e(this) < 9.0D) {
+ } else if (this.bq.f() && itemstack != null && itemstack.getItem() == Items.RAW_FISH && entityhuman.e(this) < 9.0D) {
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -160,7 +160,7 @@ public class EntityOcelot extends EntityTameableAnimal {
}
public boolean c(ItemStack itemstack) {
- return itemstack != null && itemstack.id == Item.RAW_FISH.id;
+ return itemstack != null && itemstack.getItem() == Items.RAW_FISH;
}
public boolean mate(EntityAnimal entityanimal) {
@@ -173,7 +173,7 @@ public class EntityOcelot extends EntityTameableAnimal {
} else {
EntityOcelot entityocelot = (EntityOcelot) entityanimal;
- return !entityocelot.isTamed() ? false : this.bY() && entityocelot.bY();
+ return !entityocelot.isTamed() ? false : this.cc() && entityocelot.cc();
}
}
@@ -198,9 +198,9 @@ public class EntityOcelot extends EntityTameableAnimal {
return false;
}
- int l = this.world.getTypeId(i, j - 1, k);
+ Block block = this.world.getType(i, j - 1, k);
- if (l == Block.GRASS.id || l == Block.LEAVES.id) {
+ if (block == Blocks.GRASS || block.getMaterial() == Material.LEAVES) {
return true;
}
}
@@ -209,8 +209,8 @@ public class EntityOcelot extends EntityTameableAnimal {
}
}
- public String getLocalizedName() {
- return this.hasCustomName() ? this.getCustomName() : (this.isTamed() ? "entity.Cat.name" : super.getLocalizedName());
+ public String getName() {
+ return this.hasCustomName() ? this.getCustomName() : (this.isTamed() ? LocaleI18n.get("entity.Cat.name") : super.getName());
}
public GroupDataEntity a(GroupDataEntity groupdataentity) {
diff --git a/src/main/java/net/minecraft/server/EntityPainting.java b/src/main/java/net/minecraft/server/EntityPainting.java
index 1bd0cccf6a..2c3a233dbd 100644
--- a/src/main/java/net/minecraft/server/EntityPainting.java
+++ b/src/main/java/net/minecraft/server/EntityPainting.java
@@ -59,11 +59,11 @@ public class EntityPainting extends EntityHanging {
super.a(nbttagcompound);
}
- public int d() {
+ public int f() {
return this.art.C;
}
- public int e() {
+ public int i() {
return this.art.D;
}
@@ -76,6 +76,6 @@ public class EntityPainting extends EntityHanging {
}
}
- this.a(new ItemStack(Item.PAINTING), 0.0F);
+ this.a(new ItemStack(Items.PAINTING), 0.0F);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 1f0f4dd691..abb2a6f92d 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -1,6 +1,9 @@
package net.minecraft.server;
-import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+// CraftBukkit end
public class EntityPig extends EntityAnimal {
@@ -14,36 +17,36 @@ public class EntityPig extends EntityAnimal {
this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.25D));
this.goalSelector.a(2, this.bp = new PathfinderGoalPassengerCarrotStick(this, 0.3F));
this.goalSelector.a(3, new PathfinderGoalBreed(this, 1.0D));
- this.goalSelector.a(4, new PathfinderGoalTempt(this, 1.2D, Item.CARROT_STICK.id, false));
- this.goalSelector.a(4, new PathfinderGoalTempt(this, 1.2D, Item.CARROT.id, false));
+ this.goalSelector.a(4, new PathfinderGoalTempt(this, 1.2D, Items.CARROT_STICK, false));
+ this.goalSelector.a(4, new PathfinderGoalTempt(this, 1.2D, Items.CARROT, false));
this.goalSelector.a(5, new PathfinderGoalFollowParent(this, 1.1D));
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
- protected void bi() {
- super.bi();
+ protected void bn() {
+ super.bn();
}
- public boolean by() {
- ItemStack itemstack = ((EntityHuman) this.passenger).aZ();
+ public boolean bC() {
+ ItemStack itemstack = ((EntityHuman) this.passenger).be();
- return itemstack != null && itemstack.id == Item.CARROT_STICK.id;
+ return itemstack != null && itemstack.getItem() == Items.CARROT_STICK;
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
@@ -57,19 +60,19 @@ public class EntityPig extends EntityAnimal {
this.setSaddle(nbttagcompound.getBoolean("Saddle"));
}
- protected String r() {
+ protected String t() {
return "mob.pig.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.pig.say";
}
- protected String aP() {
+ protected String aU() {
return "mob.pig.death";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.pig.step", 0.15F, 1.0F);
}
@@ -84,8 +87,8 @@ public class EntityPig extends EntityAnimal {
}
}
- protected int getLootId() {
- return this.isBurning() ? Item.GRILLED_PORK.id : Item.PORK.id;
+ protected Item getLoot() {
+ return this.isBurning() ? Items.GRILLED_PORK : Items.PORK;
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -95,14 +98,14 @@ public class EntityPig extends EntityAnimal {
if (j > 0) {
if (this.isBurning()) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.GRILLED_PORK.id, j));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.GRILLED_PORK), j));
} else {
- loot.add(new org.bukkit.inventory.ItemStack(Item.PORK.id, j));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.PORK), j));
}
}
if (this.hasSaddle()) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.SADDLE.id, 1));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.SADDLE), 1));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
@@ -131,6 +134,7 @@ public class EntityPig extends EntityAnimal {
}
// CraftBukkit end
+ entitypigzombie.setEquipment(0, new ItemStack(Items.GOLD_SWORD));
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
// CraftBukkit - added a reason for spawning this creature
this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
@@ -150,10 +154,10 @@ public class EntityPig extends EntityAnimal {
}
public boolean c(ItemStack itemstack) {
- return itemstack != null && itemstack.id == Item.CARROT.id;
+ return itemstack != null && itemstack.getItem() == Items.CARROT;
}
- public PathfinderGoalPassengerCarrotStick bU() {
+ public PathfinderGoalPassengerCarrotStick bY() {
return this.bp;
}
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index df4c384006..533d460556 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -21,18 +21,18 @@ public class EntityPigZombie extends EntityZombie {
this.fireProof = true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(bp).setValue(0.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.5D);
this.getAttributeInstance(GenericAttributes.e).setValue(5.0D);
}
- protected boolean bf() {
+ protected boolean bk() {
return false;
}
- public void l_() {
+ public void h() {
if (this.bu != this.target && !this.world.isStatic) {
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);
@@ -44,14 +44,14 @@ public class EntityPigZombie extends EntityZombie {
this.bu = this.target;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
- this.makeSound("mob.zombiepig.zpigangry", this.ba() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
+ this.makeSound("mob.zombiepig.zpigangry", this.bf() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
- super.l_();
+ super.h();
}
public boolean canSpawn() {
- return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
+ return this.world.difficulty != EnumDifficulty.PEACEFUL && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
public void b(NBTTagCompound nbttagcompound) {
@@ -117,15 +117,15 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40);
}
- protected String r() {
+ protected String t() {
return "mob.zombiepig.zpig";
}
- protected String aO() {
+ protected String aT() {
return "mob.zombiepig.zpighurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.zombiepig.zpigdeath";
}
@@ -135,13 +135,13 @@ public class EntityPigZombie extends EntityZombie {
int j = this.random.nextInt(2 + i);
if (j > 0) {
- loot.add(CraftItemStack.asNewCraftStack(Item.ROTTEN_FLESH, j));
+ loot.add(CraftItemStack.asNewCraftStack(Items.ROTTEN_FLESH, j));
}
j = this.random.nextInt(2 + i);
if (j > 0) {
- loot.add(CraftItemStack.asNewCraftStack(Item.GOLD_NUGGET, j));
+ loot.add(CraftItemStack.asNewCraftStack(Items.GOLD_NUGGET, j));
}
// Determine rare item drops and add them to the loot
@@ -149,7 +149,7 @@ public class EntityPigZombie extends EntityZombie {
int k = this.random.nextInt(200) - i;
if (k < 5) {
- ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
+ ItemStack itemstack = this.getRareDrop(k <= 0 ? 1 : 0);
if (itemstack != null) {
loot.add(CraftItemStack.asCraftMirror(itemstack));
}
@@ -165,17 +165,13 @@ public class EntityPigZombie extends EntityZombie {
}
// CraftBukkit start - Return rare dropped item instead of dropping it
- protected ItemStack l(int i) {
- return new ItemStack(Item.GOLD_INGOT.id, 1, 0);
+ protected ItemStack getRareDrop(int i) {
+ return new ItemStack(Items.GOLD_INGOT, 1, 0);
}
// CraftBukkit end
- protected int getLootId() {
- return Item.ROTTEN_FLESH.id;
- }
-
- protected void bw() {
- this.setEquipment(0, new ItemStack(Item.GOLD_SWORD));
+ protected void bA() {
+ this.setEquipment(0, new ItemStack(Items.GOLD_SWORD));
}
public GroupDataEntity a(GroupDataEntity groupdataentity) {
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 2e234f11d6..42fa9e0a4a 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1,15 +1,21 @@
package net.minecraft.server;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import net.minecraft.util.com.google.common.collect.Sets;
+import net.minecraft.util.com.mojang.authlib.GameProfile;
+import net.minecraft.util.io.netty.buffer.Unpooled;
+import net.minecraft.util.org.apache.commons.io.Charsets;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import org.bukkit.Bukkit;
import org.bukkit.WeatherType;
@@ -23,24 +29,26 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class EntityPlayer extends EntityHuman implements ICrafting {
+ private static final Logger bM = LogManager.getLogger();
private String locale = "en_US";
public PlayerConnection playerConnection;
- public MinecraftServer server;
- public PlayerInteractManager playerInteractManager;
+ public final MinecraftServer server;
+ public final PlayerInteractManager playerInteractManager;
public double d;
public double e;
public final List chunkCoordIntPairQueue = new LinkedList();
public final List removeQueue = new LinkedList();
- private float bO = Float.MIN_VALUE;
- private float bP = -1.0E8F;
- private int bQ = -99999999;
- private boolean bR = true;
+ private final ServerStatisticManager bO;
+ private float bP = Float.MIN_VALUE;
+ private float bQ = -1.0E8F;
+ private int bR = -99999999;
+ private boolean bS = true;
public int lastSentExp = -99999999; // CraftBukkit - private -> public
public int invulnerableTicks = 60; // CraftBukkit - private -> public
- private int bU;
private int bV;
- private boolean bW = true;
- private long bX = 0L;
+ private EnumChatVisibility bW;
+ private boolean bX = true;
+ private long bY = 0L;
private int containerCounter;
public boolean h;
public int ping;
@@ -56,36 +64,37 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double maxHealthCache;
// CraftBukkit end
- public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) {
- super(world, s);
+ public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
+ super(worldserver, gameprofile);
playerinteractmanager.player = this;
this.playerInteractManager = playerinteractmanager;
- this.bU = minecraftserver.getPlayerList().o();
- ChunkCoordinates chunkcoordinates = world.getSpawn();
+ this.bV = minecraftserver.getPlayerList().o();
+ ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
int i = chunkcoordinates.x;
int j = chunkcoordinates.z;
int k = chunkcoordinates.y;
- if (!world.worldProvider.g && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
+ if (!worldserver.worldProvider.g && worldserver.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
int l = Math.max(5, minecraftserver.getSpawnProtection() - 6);
i += this.random.nextInt(l * 2) - l;
j += this.random.nextInt(l * 2) - l;
- k = world.i(i, j);
+ k = worldserver.i(i, j);
}
this.server = minecraftserver;
- this.Y = 0.0F;
+ this.bO = minecraftserver.getPlayerList().i(this.getName());
+ this.X = 0.0F;
this.height = 0.0F;
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
- while (!world.getCubes(this, this.boundingBox).isEmpty()) {
+ while (!worldserver.getCubes(this, this.boundingBox).isEmpty()) {
this.setPosition(this.locX, this.locY + 1.0D, this.locZ);
}
// CraftBukkit start
- this.displayName = this.name;
- this.listName = this.name;
+ this.displayName = this.getName();
+ this.listName = this.getName();
// this.canPickUpLoot = true; TODO
this.maxHealthCache = this.getMaxHealth();
// CraftBukkit end
@@ -93,7 +102,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- if (nbttagcompound.hasKey("playerGameType")) {
+ if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
if (MinecraftServer.getServer().getForceGamemode()) {
this.playerInteractManager.setGameMode(MinecraftServer.getServer().getGamemode());
} else {
@@ -143,7 +152,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.addSlotListener(this);
}
- protected void d_() {
+ protected void e_() {
this.height = 0.0F;
}
@@ -151,21 +160,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return 1.62F;
}
- public void l_() {
+ public void h() {
this.playerInteractManager.a();
--this.invulnerableTicks;
+ if (this.noDamageTicks > 0) {
+ --this.noDamageTicks;
+ }
+
this.activeContainer.b();
if (!this.world.isStatic && !this.activeContainer.a((EntityHuman) this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
}
- // CraftBukkit start
- if (this.noDamageTicks > 0) {
- --this.noDamageTicks;
- }
- // CraftBukkit end
-
while (!this.removeQueue.isEmpty()) {
int i = Math.min(this.removeQueue.size(), 127);
int[] aint = new int[i];
@@ -177,7 +184,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
iterator.remove();
}
- this.playerConnection.sendPacket(new Packet29DestroyEntity(aint));
+ this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint));
}
if (!this.chunkCoordIntPairQueue.isEmpty()) {
@@ -185,21 +192,27 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
Iterator iterator1 = this.chunkCoordIntPairQueue.iterator();
ArrayList arraylist1 = new ArrayList();
- while (iterator1.hasNext() && arraylist.size() < 5) {
+ Chunk chunk;
+
+ while (iterator1.hasNext() && arraylist.size() < PacketPlayOutMapChunkBulk.c()) {
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next();
- iterator1.remove();
- if (chunkcoordintpair != null && this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
- // CraftBukkit start - Get tile entities directly from the chunk instead of the world
- Chunk chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
- arraylist.add(chunk);
- arraylist1.addAll(chunk.tileEntities.values());
- // CraftBukkit end
+ if (chunkcoordintpair != null) {
+ if (this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
+ chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
+ if (chunk.k()) {
+ arraylist.add(chunk);
+ arraylist1.addAll(chunk.tileEntities.values()); // CraftBukkit - Get tile entities directly from the chunk instead of the world
+ iterator1.remove();
+ }
+ }
+ } else {
+ iterator1.remove();
}
}
if (!arraylist.isEmpty()) {
- this.playerConnection.sendPacket(new Packet56MapChunkBulk(arraylist));
+ this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist));
Iterator iterator2 = arraylist1.iterator();
while (iterator2.hasNext()) {
@@ -211,27 +224,26 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
iterator2 = arraylist.iterator();
while (iterator2.hasNext()) {
- Chunk chunk = (Chunk) iterator2.next();
-
- this.p().getTracker().a(this, chunk);
+ chunk = (Chunk) iterator2.next();
+ this.r().getTracker().a(this, chunk);
}
}
}
- if (this.bX > 0L && this.server.ar() > 0 && MinecraftServer.aq() - this.bX > (long) (this.server.ar() * 1000 * 60)) {
+ if (this.bY > 0L && this.server.aq() > 0 && MinecraftServer.ap() - this.bY > (long) (this.server.aq() * 1000 * 60)) {
this.playerConnection.disconnect("You have been idle for too long!");
}
}
- public void h() {
+ public void i() {
try {
- super.l_();
+ super.h();
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
- if (itemstack != null && Item.byId[itemstack.id].f() && this.playerConnection.lowPriorityCount() <= 5) {
- Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
+ if (itemstack != null && itemstack.getItem().h()) {
+ Packet packet = ((ItemWorldMapBase) itemstack.getItem()).c(itemstack, this.world, this);
if (packet != null) {
this.playerConnection.sendPacket(packet);
@@ -239,18 +251,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- if (this.getHealth() != this.bP || this.bQ != this.foodData.a() || this.foodData.e() == 0.0F != this.bR) {
- // CraftBukkit - Optionally scale health
- this.playerConnection.sendPacket(new Packet8UpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.a(), this.foodData.e()));
- this.bP = this.getHealth();
- this.bQ = this.foodData.a();
- this.bR = this.foodData.e() == 0.0F;
+ // CraftBukkit - Optionally scale health
+ if (this.getHealth() != this.bQ || this.bR != this.foodData.a() || this.foodData.e() == 0.0F != this.bS) {
+ this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.a(), this.foodData.e()));
+ this.bQ = this.getHealth();
+ this.bR = this.foodData.a();
+ this.bS = this.foodData.e() == 0.0F;
}
- if (this.getHealth() + this.bn() != this.bO) {
- this.bO = this.getHealth() + this.bn();
+ if (this.getHealth() + this.bs() != this.bP) {
+ this.bP = this.getHealth() + this.bs();
// CraftBukkit - Update ALL the scores!
- this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getLocalizedName(), com.google.common.collect.ImmutableList.of(this));
+ this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getName(), com.google.common.collect.ImmutableList.of(this));
}
// CraftBukkit start - Force max health updates
@@ -261,7 +273,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.expTotal != this.lastSentExp) {
this.lastSentExp = this.expTotal;
- this.playerConnection.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
+ this.playerConnection.sendPacket(new PacketPlayOutExperience(this.exp, this.expTotal, this.expLevel));
+ }
+
+ if (this.ticksLived % 20 * 5 == 0 && !this.x().a(AchievementList.L)) {
+ this.j();
}
// CraftBukkit start
@@ -283,6 +299,46 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
+ protected void j() {
+ BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
+
+ if (biomebase != null) {
+ String s = biomebase.af;
+ AchievementSet achievementset = (AchievementSet) this.x().b((Statistic) AchievementList.L); // CraftBukkit - fix decompile error
+
+ if (achievementset == null) {
+ achievementset = (AchievementSet) this.x().a(AchievementList.L, new AchievementSet());
+ }
+
+ achievementset.add(s);
+ if (this.x().b(AchievementList.L) && achievementset.size() == BiomeBase.n.size()) {
+ HashSet hashset = Sets.newHashSet(BiomeBase.n);
+ Iterator iterator = achievementset.iterator();
+
+ while (iterator.hasNext()) {
+ String s1 = (String) iterator.next();
+ Iterator iterator1 = hashset.iterator();
+
+ while (iterator1.hasNext()) {
+ BiomeBase biomebase1 = (BiomeBase) iterator1.next();
+
+ if (biomebase1.af.equals(s1)) {
+ iterator1.remove();
+ }
+ }
+
+ if (hashset.isEmpty()) {
+ break;
+ }
+ }
+
+ if (hashset.isEmpty()) {
+ this.a((Statistic) AchievementList.L);
+ }
+ }
+ }
+ }
+
public void die(DamageSource damagesource) {
// CraftBukkit start
if (this.dead) {
@@ -306,22 +362,22 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- ChatMessage chatmessage = this.aR().b();
+ IChatBaseComponent chatmessage = this.aW().b();
- String deathmessage = chatmessage.toString();
+ String deathmessage = chatmessage.c();
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage);
String deathMessage = event.getDeathMessage();
if (deathMessage != null && deathMessage.length() > 0) {
- if (deathMessage.equals(chatmessage.toString())) {
+ if (deathMessage.equals(deathmessage)) {
this.server.getPlayerList().sendMessage(chatmessage);
} else {
- this.server.getPlayerList().sendMessage(ChatMessage.d(event.getDeathMessage()));
+ this.server.getPlayerList().sendMessage(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(deathMessage));
}
}
- // CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
+ // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!keepInventory) {
for (int i = 0; i < this.inventory.items.length; ++i) {
this.inventory.items[i] = null;
@@ -336,7 +392,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
// CraftBukkit - Get our scores instead
- Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.c, this.getLocalizedName(), new java.util.ArrayList());
+ Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.c, this.getName(), new java.util.ArrayList());
Iterator iterator = collection.iterator();
while (iterator.hasNext()) {
@@ -345,13 +401,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
scoreboardscore.incrementScore();
}
- EntityLiving entityliving = this.aS();
+ EntityLiving entityliving = this.aX();
if (entityliving != null) {
+ int i = EntityTypes.a(entityliving);
+ MonsterEggInfo monsteregginfo = (MonsterEggInfo) EntityTypes.a.get(Integer.valueOf(i));
+
+ if (monsteregginfo != null) {
+ this.a(monsteregginfo.e, 1);
+ }
+
entityliving.b(this, this.bb);
}
- this.a(StatisticList.y, 1);
+ this.a(StatisticList.v, 1);
}
public boolean damageEntity(DamageSource damagesource, float f) {
@@ -392,13 +455,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void b(int i) {
if (this.dimension == 1 && i == 1) {
- this.a((Statistic) AchievementList.C);
+ this.a((Statistic) AchievementList.D);
this.world.kill(this);
this.viewingCredits = true;
- this.playerConnection.sendPacket(new Packet70Bed(4, 0));
+ this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
} else {
if (this.dimension == 0 && i == 1) {
- this.a((Statistic) AchievementList.B);
+ this.a((Statistic) AchievementList.C);
// CraftBukkit start - Rely on custom portal management
/*
ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();
@@ -411,7 +474,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
*/
// CraftBukkit end
} else {
- this.a((Statistic) AchievementList.x);
+ this.a((Statistic) AchievementList.y);
}
// CraftBukkit start
@@ -419,8 +482,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.server.getPlayerList().changeDimension(this, i, cause);
// CraftBukkit end
this.lastSentExp = -1;
- this.bP = -1.0F;
- this.bQ = -1;
+ this.bQ = -1.0F;
+ this.bR = -1;
}
}
@@ -443,11 +506,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
EnumBedResult enumbedresult = super.a(i, j, k);
if (enumbedresult == EnumBedResult.OK) {
- Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
+ PacketPlayOutBed packetplayoutbed = new PacketPlayOutBed(this, i, j, k);
- this.p().getTracker().a((Entity) this, (Packet) packet17entitylocationaction);
+ this.r().getTracker().a((Entity) this, (Packet) packetplayoutbed);
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
- this.playerConnection.sendPacket(packet17entitylocationaction);
+ this.playerConnection.sendPacket(packetplayoutbed);
}
return enumbedresult;
@@ -457,7 +520,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
if (this.isSleeping()) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
+ this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2));
}
super.a(flag, flag1, flag2);
@@ -480,7 +543,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// Check if the vehicle actually changed.
if (currentVehicle != this.vehicle) {
- this.playerConnection.sendPacket(new Packet39AttachEntity(0, this, this.vehicle));
+ this.playerConnection.sendPacket(new PacketPlayOutAttachEntity(0, this, this.vehicle));
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}
// CraftBukkit end
@@ -495,7 +558,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(TileEntity tileentity) {
if (tileentity instanceof TileEntitySign) {
((TileEntitySign) tileentity).a((EntityHuman) this);
- this.playerConnection.sendPacket(new Packet133OpenTileEntity(0, tileentity.x, tileentity.y, tileentity.z));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentity.x, tileentity.y, tileentity.z));
}
}
@@ -511,7 +574,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9, true));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 9, true));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -524,7 +587,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -537,7 +600,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 8, "Repairing", 9, true));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 9, true));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -554,7 +617,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize(), iinventory.c()));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 0, iinventory.getInventoryName(), iinventory.getSize(), iinventory.k_()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -567,7 +630,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, tileentityhopper.getName(), tileentityhopper.getSize(), tileentityhopper.c()));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 9, tileentityhopper.getInventoryName(), tileentityhopper.getSize(), tileentityhopper.k_()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -580,7 +643,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, entityminecarthopper.getName(), entityminecarthopper.getSize(), entityminecarthopper.c()));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 9, entityminecarthopper.getInventoryName(), entityminecarthopper.getSize(), entityminecarthopper.k_()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -593,7 +656,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize(), tileentityfurnace.c()));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 2, tileentityfurnace.getInventoryName(), tileentityfurnace.getSize(), tileentityfurnace.k_()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -606,7 +669,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, tileentitydispenser instanceof TileEntityDropper ? 10 : 3, tileentitydispenser.getName(), tileentitydispenser.getSize(), tileentitydispenser.c()));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, tileentitydispenser instanceof TileEntityDropper ? 10 : 3, tileentitydispenser.getInventoryName(), tileentitydispenser.getSize(), tileentitydispenser.k_()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -619,7 +682,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize(), tileentitybrewingstand.c()));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 5, tileentitybrewingstand.getInventoryName(), tileentitybrewingstand.getSize(), tileentitybrewingstand.k_()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -632,7 +695,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 7, tileentitybeacon.getName(), tileentitybeacon.getSize(), tileentitybeacon.c()));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 7, tileentitybeacon.getInventoryName(), tileentitybeacon.getSize(), tileentitybeacon.k_()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -650,19 +713,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, s == null ? "" : s, inventorymerchant.getSize(), s != null));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 6, s == null ? "" : s, inventorymerchant.getSize(), s != null));
MerchantRecipeList merchantrecipelist = imerchant.getOffers(this);
if (merchantrecipelist != null) {
try {
- ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
- DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer());
- dataoutputstream.writeInt(this.containerCounter);
- merchantrecipelist.a(dataoutputstream);
- this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray()));
- } catch (IOException ioexception) {
- ioexception.printStackTrace();
+ packetdataserializer.writeInt(this.containerCounter);
+ merchantrecipelist.a(packetdataserializer);
+ this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|TrList", packetdataserializer));
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
+ bM.error("Couldn\'t send trade list", ioexception);
}
}
}
@@ -678,7 +740,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 11, iinventory.getName(), iinventory.getSize(), iinventory.c(), entityhorse.id));
+ this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 11, iinventory.getInventoryName(), iinventory.getSize(), iinventory.k_(), entityhorse.getId()));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -687,7 +749,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Container container, int i, ItemStack itemstack) {
if (!(container.getSlot(i) instanceof SlotResult)) {
if (!this.h) {
- this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack));
+ this.playerConnection.sendPacket(new PacketPlayOutSetSlot(container.windowId, i, itemstack));
}
}
}
@@ -697,32 +759,32 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(Container container, List list) {
- this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list));
- this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
+ this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, list));
+ this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
// CraftBukkit start - Send a Set Slot to update the crafting result slot
if (java.util.EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) {
- this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem()));
+ this.playerConnection.sendPacket(new PacketPlayOutSetSlot(container.windowId, 0, container.getSlot(0).getItem()));
}
// CraftBukkit end
}
public void setContainerData(Container container, int i, int j) {
- this.playerConnection.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j));
+ this.playerConnection.sendPacket(new PacketPlayOutCraftProgressBar(container.windowId, i, j));
}
public void closeInventory() {
CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit
- this.playerConnection.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
- this.k();
+ this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
+ this.m();
}
public void broadcastCarriedItem() {
if (!this.h) {
- this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
+ this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
}
}
- public void k() {
+ public void m() {
this.activeContainer.b((EntityHuman) this);
this.activeContainer = this.defaultContainer;
}
@@ -744,13 +806,22 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Statistic statistic, int i) {
if (statistic != null) {
- if (!statistic.f) {
- this.playerConnection.sendPacket(new Packet200Statistic(statistic.e, i));
+ this.bO.b(this, statistic, i);
+ Iterator iterator = this.getScoreboard().getObjectivesForCriteria(statistic.k()).iterator();
+
+ while (iterator.hasNext()) {
+ ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
+
+ this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective).incrementScore();
+ }
+
+ if (this.bO.e()) {
+ this.bO.a(this);
}
}
}
- public void l() {
+ public void n() {
if (this.passenger != null) {
this.passenger.mount(this);
}
@@ -761,47 +832,47 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void triggerHealthUpdate() {
- this.bP = -1.0E8F;
+ this.bQ = -1.0E8F;
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
- public void a(String s) {
- this.playerConnection.sendPacket(new Packet3Chat(ChatMessage.e(s)));
+ public void b(IChatBaseComponent ichatbasecomponent) {
+ this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent));
}
- protected void n() {
- this.playerConnection.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
- super.n();
+ protected void p() {
+ this.playerConnection.sendPacket(new PacketPlayOutEntityStatus(this, (byte) 9));
+ super.p();
}
public void a(ItemStack itemstack, int i) {
super.a(itemstack, i);
- if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().c_(itemstack) == EnumAnimation.EAT) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
+ if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().d(itemstack) == EnumAnimation.EAT) {
+ this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 3));
}
}
public void copyTo(EntityHuman entityhuman, boolean flag) {
super.copyTo(entityhuman, flag);
this.lastSentExp = -1;
- this.bP = -1.0F;
- this.bQ = -1;
+ this.bQ = -1.0F;
+ this.bR = -1;
this.removeQueue.addAll(((EntityPlayer) entityhuman).removeQueue);
}
protected void a(MobEffect mobeffect) {
super.a(mobeffect);
- this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect));
+ this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
}
protected void a(MobEffect mobeffect, boolean flag) {
super.a(mobeffect, flag);
- this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect));
+ this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
}
protected void b(MobEffect mobeffect) {
super.b(mobeffect);
- this.playerConnection.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
+ this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect));
}
public void enderTeleportTo(double d0, double d1, double d2) {
@@ -809,37 +880,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void b(Entity entity) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
+ this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 4));
}
public void c(Entity entity) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
+ this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 5));
}
public void updateAbilities() {
if (this.playerConnection != null) {
- this.playerConnection.sendPacket(new Packet202Abilities(this.abilities));
+ this.playerConnection.sendPacket(new PacketPlayOutAbilities(this.abilities));
}
}
- public WorldServer p() {
+ public WorldServer r() {
return (WorldServer) this.world;
}
public void a(EnumGamemode enumgamemode) {
this.playerInteractManager.setGameMode(enumgamemode);
- this.playerConnection.sendPacket(new Packet70Bed(3, enumgamemode.a()));
+ this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.a()));
}
- public void sendMessage(ChatMessage chatmessage) {
- this.playerConnection.sendPacket(new Packet3Chat(chatmessage));
+ // CraftBukkit start - Support multi-line messages
+ public void sendMessage(IChatBaseComponent[] ichatbasecomponent) {
+ for (IChatBaseComponent component : ichatbasecomponent) {
+ this.sendMessage(component);
+ }
+ }
+ // CraftBukkit end
+
+ public void sendMessage(IChatBaseComponent ichatbasecomponent) {
+ this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent));
}
public boolean a(int i, String s) {
- return "seed".equals(s) && !this.server.V() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? (this.server.getPlayerList().isOp(this.name) ? this.server.k() >= i : false) : true);
+ return "seed".equals(s) && !this.server.V() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? (this.server.getPlayerList().isOp(this.getName()) ? this.server.l() >= i : false) : true);
}
- public String q() {
+ public String s() {
String s = this.playerConnection.networkManager.getSocketAddress().toString();
s = s.substring(s.indexOf("/") + 1);
@@ -847,39 +926,41 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return s;
}
- public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
- this.locale = packet204localeandviewdistance.d();
- int i = 256 >> packet204localeandviewdistance.f();
+ public void a(PacketPlayInSettings packetplayinsettings) {
+ this.locale = packetplayinsettings.c();
+ int i = 256 >> packetplayinsettings.d();
if (i > 3 && i < 15) {
- this.bU = i;
+ this.bV = i;
}
- this.bV = packet204localeandviewdistance.g();
- this.bW = packet204localeandviewdistance.h();
- if (this.server.K() && this.server.J().equals(this.name)) {
- this.server.c(packet204localeandviewdistance.i());
+ this.bW = packetplayinsettings.e();
+ this.bX = packetplayinsettings.f();
+ if (this.server.L() && this.server.K().equals(this.getName())) {
+ this.server.a(packetplayinsettings.g());
}
- this.b(1, !packet204localeandviewdistance.j());
+ this.b(1, !packetplayinsettings.h());
}
- public int getChatFlags() {
- return this.bV;
+ public EnumChatVisibility getChatFlags() {
+ return this.bW;
}
- public void a(String s, int i) {
- String s1 = s + "\0" + i; // CraftBukkit - fix decompile error
-
- this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", s1.getBytes()));
+ public void a(String s) {
+ this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|RPack", s.getBytes(Charsets.UTF_8)));
}
- public ChunkCoordinates b() {
+ public ChunkCoordinates getChunkCoordinates() {
return new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY + 0.5D), MathHelper.floor(this.locZ));
}
- public void u() {
- this.bX = MinecraftServer.aq();
+ public void w() {
+ this.bY = MinecraftServer.ap();
+ }
+
+ public ServerStatisticManager x() {
+ return this.bO;
}
// CraftBukkit start
@@ -911,7 +992,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.weather = type;
}
- this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0));
+ if (type == WeatherType.DOWNFALL) {
+ this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(2, 0));
+ // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, this.world.j(1.0F)));
+ // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, this.world.h(1.0F)));
+ } else {
+ this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0));
+ }
}
public void resetPlayerWeather() {
@@ -921,7 +1008,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
public String toString() {
- return super.toString() + "(" + this.name + " at " + this.locX + "," + this.locY + "," + this.locZ + ")";
+ return super.toString() + "(" + this.getName() + " at " + this.locX + "," + this.locY + "," + this.locZ + ")";
}
public void reset() {
@@ -937,12 +1024,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.setHealth(this.getMaxHealth());
this.fireTicks = 0;
this.fallDistance = 0;
- this.foodData = new FoodMetaData();
+ this.foodData = new FoodMetaData(this);
this.expLevel = this.newLevel;
this.expTotal = this.newTotalExp;
this.exp = 0;
this.deathTicks = 0;
- this.aJ(); // Should be removeAllEffects.
+ this.removeAllEffects();
this.updateEffects = true;
this.activeContainer = this.defaultContainer;
this.killer = null;
diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java
index cde3d7c3b3..72873357d3 100644
--- a/src/main/java/net/minecraft/server/EntityPotion.java
+++ b/src/main/java/net/minecraft/server/EntityPotion.java
@@ -19,7 +19,7 @@ public class EntityPotion extends EntityProjectile {
}
public EntityPotion(World world, EntityLiving entityliving, int i) {
- this(world, entityliving, new ItemStack(Item.POTION, 1, i));
+ this(world, entityliving, new ItemStack(Items.POTION, 1, i));
}
public EntityPotion(World world, EntityLiving entityliving, ItemStack itemstack) {
@@ -32,21 +32,21 @@ public class EntityPotion extends EntityProjectile {
this.item = itemstack;
}
- protected float e() {
+ protected float i() {
return 0.05F;
}
- protected float c() {
+ protected float e() {
return 0.5F;
}
- protected float d() {
+ protected float f() {
return -20.0F;
}
public void setPotionValue(int i) {
if (this.item == null) {
- this.item = new ItemStack(Item.POTION, 1, 0);
+ this.item = new ItemStack(Items.POTION, 1, 0);
}
this.item.setData(i);
@@ -54,7 +54,7 @@ public class EntityPotion extends EntityProjectile {
public int getPotionValue() {
if (this.item == null) {
- this.item = new ItemStack(Item.POTION, 1, 0);
+ this.item = new ItemStack(Items.POTION, 1, 0);
}
return this.item.getData();
@@ -62,7 +62,7 @@ public class EntityPotion extends EntityProjectile {
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
- List list = Item.POTION.g(this.item);
+ List list = Items.POTION.g(this.item);
if (true || list != null && !list.isEmpty()) { // CraftBukkit - Call event even if no effects to apply
AxisAlignedBB axisalignedbb = this.boundingBox.grow(4.0D, 2.0D, 4.0D);
@@ -137,7 +137,7 @@ public class EntityPotion extends EntityProjectile {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- if (nbttagcompound.hasKey("Potion")) {
+ if (nbttagcompound.hasKeyOfType("Potion", 10)) {
this.item = ItemStack.createStack(nbttagcompound.getCompound("Potion"));
} else {
this.setPotionValue(nbttagcompound.getInt("potionValue"));
@@ -151,7 +151,7 @@ public class EntityPotion extends EntityProjectile {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
if (this.item != null) {
- nbttagcompound.setCompound("Potion", this.item.save(new NBTTagCompound()));
+ nbttagcompound.set("Potion", this.item.save(new NBTTagCompound()));
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 0809b6f3c3..10c242c1b7 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -7,7 +7,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
private int blockX = -1;
private int blockY = -1;
private int blockZ = -1;
- private int inBlockId;
+ private Block inBlockId;
protected boolean inGround;
public int shake;
public EntityLiving shooter; // CraftBukkit - private -> public
@@ -20,7 +20,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.a(0.25F, 0.25F);
}
- protected void a() {}
+ protected void c() {}
public EntityProjectile(World world, EntityLiving entityliving) {
super(world);
@@ -36,8 +36,8 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
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.shoot(this.motX, this.motY, this.motZ, this.c(), 1.0F);
+ this.motY = (double) (-MathHelper.sin((this.pitch + this.f()) / 180.0F * 3.1415927F) * f);
+ this.shoot(this.motX, this.motY, this.motZ, this.e(), 1.0F);
}
public EntityProjectile(World world, double d0, double d1, double d2) {
@@ -48,11 +48,11 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.height = 0.0F;
}
- protected float c() {
+ protected float e() {
return 1.5F;
}
- protected float d() {
+ protected float f() {
return 0.0F;
}
@@ -78,19 +78,17 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.i = 0;
}
- public void l_() {
- this.U = this.locX;
- this.V = this.locY;
- this.W = this.locZ;
- super.l_();
+ public void h() {
+ this.T = this.locX;
+ this.U = this.locY;
+ this.V = this.locZ;
+ super.h();
if (this.shake > 0) {
--this.shake;
}
if (this.inGround) {
- int i = this.world.getTypeId(this.blockX, this.blockY, this.blockZ);
-
- if (i == this.inBlockId) {
+ if (this.world.getType(this.blockX, this.blockY, this.blockZ) == this.inBlockId) {
++this.i;
if (this.i == 1200) {
this.die();
@@ -125,10 +123,10 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
double d0 = 0.0D;
EntityLiving entityliving = this.getShooter();
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity1 = (Entity) list.get(i);
- if (entity1.L() && (entity1 != entityliving || this.j >= 5)) {
+ if (entity1.R() && (entity1 != entityliving || this.j >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -150,8 +148,8 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
}
if (movingobjectposition != null) {
- if (movingobjectposition.type == EnumMovingObjectType.TILE && this.world.getTypeId(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d) == Block.PORTAL.id) {
- this.ab();
+ if (movingobjectposition.type == EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d) == Blocks.PORTAL) {
+ this.ah();
} else {
this.a(movingobjectposition);
// CraftBukkit start
@@ -188,10 +186,10 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
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.i();
- if (this.H()) {
- for (int k = 0; k < 4; ++k) {
+ if (this.M()) {
+ for (int j = 0; j < 4; ++j) {
float f4 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
@@ -207,7 +205,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.setPosition(this.locX, this.locY, this.locZ);
}
- protected float e() {
+ protected float i() {
return 0.03F;
}
@@ -217,11 +215,11 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
nbttagcompound.setShort("xTile", (short) this.blockX);
nbttagcompound.setShort("yTile", (short) this.blockY);
nbttagcompound.setShort("zTile", (short) this.blockZ);
- nbttagcompound.setByte("inTile", (byte) this.inBlockId);
+ nbttagcompound.setByte("inTile", (byte) Block.b(this.inBlockId));
nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
if ((this.shooterName == null || this.shooterName.length() == 0) && this.shooter != null && this.shooter instanceof EntityHuman) {
- this.shooterName = this.shooter.getLocalizedName();
+ this.shooterName = this.shooter.getName();
}
nbttagcompound.setString("ownerName", this.shooterName == null ? "" : this.shooterName);
@@ -231,7 +229,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.blockX = nbttagcompound.getShort("xTile");
this.blockY = nbttagcompound.getShort("yTile");
this.blockZ = nbttagcompound.getShort("zTile");
- this.inBlockId = nbttagcompound.getByte("inTile") & 255;
+ this.inBlockId = Block.e(nbttagcompound.getByte("inTile") & 255);
this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.getByte("inGround") == 1;
this.shooterName = nbttagcompound.getString("ownerName");
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index 9df1c388dd..9a1a3025ab 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -21,42 +21,42 @@ public class EntitySheep extends EntityAnimal {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.25D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
- this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.1D, Item.WHEAT.id, false));
+ this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.1D, Items.WHEAT, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.1D));
this.goalSelector.a(5, this.bs);
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
- this.bq.setItem(0, new ItemStack(Item.INK_SACK, 1, 0));
- this.bq.setItem(1, new ItemStack(Item.INK_SACK, 1, 0));
+ this.bq.setItem(0, new ItemStack(Items.INK_SACK, 1, 0));
+ this.bq.setItem(1, new ItemStack(Items.INK_SACK, 1, 0));
this.bq.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
}
- protected boolean bf() {
+ protected boolean bk() {
return true;
}
- protected void bi() {
+ protected void bn() {
this.br = this.bs.f();
- super.bi();
+ super.bn();
}
- public void c() {
+ public void e() {
if (this.world.isStatic) {
this.br = Math.max(0, this.br - 1);
}
- super.c();
+ super.e();
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(8.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, new Byte((byte) 0));
}
@@ -72,14 +72,14 @@ public class EntitySheep extends EntityAnimal {
// CraftBukkit end
}
- protected int getLootId() {
- return Block.WOOL.id;
+ protected Item getLoot() {
+ return Item.getItemOf(Blocks.WOOL);
}
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
- if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.isBaby()) {
+ if (itemstack != null && itemstack.getItem() == Items.SHEARS && !this.isSheared() && !this.isBaby()) {
if (!this.world.isStatic) {
// CraftBukkit start
PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity());
@@ -94,7 +94,7 @@ public class EntitySheep extends EntityAnimal {
int i = 1 + this.random.nextInt(3);
for (int j = 0; j < i; ++j) {
- EntityItem entityitem = this.a(new ItemStack(Block.WOOL.id, 1, this.getColor()), 1.0F);
+ EntityItem entityitem = this.a(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, this.getColor()), 1.0F);
entityitem.motY += (double) (this.random.nextFloat() * 0.05F);
entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
@@ -121,19 +121,19 @@ public class EntitySheep extends EntityAnimal {
this.setColor(nbttagcompound.getByte("Color"));
}
- protected String r() {
+ protected String t() {
return "mob.sheep.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.sheep.say";
}
- protected String aP() {
+ protected String aU() {
return "mob.sheep.say";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.sheep.step", 0.15F, 1.0F);
}
@@ -176,7 +176,7 @@ public class EntitySheep extends EntityAnimal {
return entitysheep1;
}
- public void n() {
+ public void p() {
// CraftBukkit start
SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
@@ -206,7 +206,7 @@ public class EntitySheep extends EntityAnimal {
ItemStack itemstack = CraftingManager.getInstance().craft(this.bq, ((EntitySheep) entityanimal).world);
int k;
- if (itemstack != null && itemstack.getItem().id == Item.INK_SACK.id) {
+ if (itemstack != null && itemstack.getItem() == Items.INK_SACK) {
k = itemstack.getData();
} else {
k = this.world.random.nextBoolean() ? i : j;
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
index 0e9abd63ef..88a90661e0 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import net.minecraft.util.org.apache.commons.lang3.tuple.ImmutablePair;
+
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntitySilverfish extends EntityMonster {
@@ -11,14 +13,14 @@ public class EntitySilverfish extends EntityMonster {
this.a(0.3F, 0.7F);
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(8.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.6000000238418579D);
this.getAttributeInstance(GenericAttributes.e).setValue(1.0D);
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
@@ -28,15 +30,15 @@ public class EntitySilverfish extends EntityMonster {
return this.world.findNearbyVulnerablePlayer(this, d0);
}
- protected String r() {
+ protected String t() {
return "mob.silverfish.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.silverfish.hit";
}
- protected String aP() {
+ protected String aU() {
return "mob.silverfish.kill";
}
@@ -59,21 +61,21 @@ public class EntitySilverfish extends EntityMonster {
}
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.silverfish.step", 0.15F, 1.0F);
}
- protected int getLootId() {
- return 0;
+ protected Item getLoot() {
+ return Item.d(0);
}
- public void l_() {
+ public void h() {
this.aN = this.yaw;
- super.l_();
+ super.h();
}
- protected void bl() {
- super.bl();
+ protected void bq() {
+ super.bq();
if (!this.world.isStatic) {
int i;
int j;
@@ -88,36 +90,25 @@ public class EntitySilverfish extends EntityMonster {
k = MathHelper.floor(this.locZ);
boolean flag = false;
- for (l = 0; !flag && l <= 5 && l >= -5; l = l <= 0 ? 1 - l : 0 - l) {
- for (int i1 = 0; !flag && i1 <= 10 && i1 >= -10; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) {
+ for (int i1 = 0; !flag && i1 <= 5 && i1 >= -5; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) {
+ for (l = 0; !flag && l <= 10 && l >= -10; l = l <= 0 ? 1 - l : 0 - l) {
for (int j1 = 0; !flag && j1 <= 10 && j1 >= -10; j1 = j1 <= 0 ? 1 - j1 : 0 - j1) {
- int k1 = this.world.getTypeId(i + i1, j + l, k + j1);
-
- if (k1 == Block.MONSTER_EGGS.id) {
+ if (this.world.getType(i + l, j + i1, k + j1) == Blocks.MONSTER_EGGS) {
// CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(this, i + i1, j + l, k + j1, 0, 0).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, i + l, j + i1, k + j1, Blocks.AIR, 0).isCancelled()) {
continue;
}
// CraftBukkit end
-
if (!this.world.getGameRules().getBoolean("mobGriefing")) {
- int l1 = this.world.getData(i + i1, j + l, k + j1);
- Block block = Block.STONE;
+ int k1 = this.world.getData(i + l, j + i1, k + j1);
+ ImmutablePair immutablepair = BlockMonsterEggs.b(k1);
- if (l1 == 1) {
- block = Block.COBBLESTONE;
- }
-
- if (l1 == 2) {
- block = Block.SMOOTH_BRICK;
- }
-
- this.world.setTypeIdAndData(i + i1, j + l, k + j1, block.id, 0, 3);
+ this.world.setTypeAndData(i + l, j + i1, k + j1, (Block) immutablepair.getLeft(), ((Integer) immutablepair.getRight()).intValue(), 3);
} else {
- this.world.setAir(i + i1, j + l, k + j1, false);
+ this.world.setAir(i + l, j + i1, k + j1, false);
}
- Block.MONSTER_EGGS.postBreak(this.world, i + i1, j + l, k + j1, 0);
+ Blocks.MONSTER_EGGS.postBreak(this.world, i + l, j + i1, k + j1, 0);
if (this.random.nextBoolean()) {
flag = true;
break;
@@ -129,37 +120,38 @@ public class EntitySilverfish extends EntityMonster {
}
}
- if (this.target == null && !this.bM()) {
+ if (this.target == null && !this.bQ()) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY + 0.5D);
k = MathHelper.floor(this.locZ);
- int i2 = this.random.nextInt(6);
+ int l1 = this.random.nextInt(6);
+ Block block = this.world.getType(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
- l = this.world.getTypeId(i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2]);
- if (BlockMonsterEggs.d(l)) {
+ l = this.world.getData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
+ if (BlockMonsterEggs.a(block)) {
// CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l)).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, Block.b(BlockMonsterEggs.e(l))).isCancelled()) {
return;
}
// CraftBukkit end
- this.world.setTypeIdAndData(i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l), 3);
- this.q();
+ this.world.setTypeAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Blocks.MONSTER_EGGS, BlockMonsterEggs.a(block, l), 3);
+ this.s();
this.die();
} else {
- this.bK();
+ this.bO();
}
- } else if (this.target != null && !this.bM()) {
+ } else if (this.target != null && !this.bQ()) {
this.target = null;
}
}
}
public float a(int i, int j, int k) {
- return this.world.getTypeId(i, j - 1, k) == Block.STONE.id ? 10.0F : super.a(i, j, k);
+ return this.world.getType(i, j - 1, k) == Blocks.STONE ? 10.0F : super.a(i, j, k);
}
- protected boolean i_() {
+ protected boolean j_() {
return true;
}
diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java
index df60605340..11ba41a174 100644
--- a/src/main/java/net/minecraft/server/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/server/EntitySkeleton.java
@@ -20,37 +20,37 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
if (world != null && !world.isStatic) {
- this.bT();
+ this.bX();
}
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(13, new Byte((byte) 0));
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- protected String r() {
+ protected String t() {
return "mob.skeleton.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.skeleton.hurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.skeleton.death";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.skeleton.step", 0.15F, 1.0F);
}
@@ -70,11 +70,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
return EnumMonsterType.UNDEAD;
}
- public void c() {
+ public void e() {
if (this.world.v() && !this.world.isStatic) {
float f = this.d(1.0F);
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
+ if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
boolean flag = true;
ItemStack itemstack = this.getEquipment(4);
@@ -107,11 +107,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.a(0.72F, 2.34F);
}
- super.c();
+ super.e();
}
- public void V() {
- super.V();
+ public void ab() {
+ super.ab();
if (this.vehicle instanceof EntityCreature) {
EntityCreature entitycreature = (EntityCreature) this.vehicle;
@@ -121,7 +121,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public void die(DamageSource damagesource) {
super.die(damagesource);
- if (damagesource.h() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
+ if (damagesource.i() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX;
double d1 = entityhuman.locZ - this.locZ;
@@ -132,8 +132,8 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
}
- protected int getLootId() {
- return Item.ARROW.id;
+ protected Item getLoot() {
+ return Items.ARROW;
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -162,7 +162,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
int k = this.random.nextInt(200) - i;
if (k < 5) {
- ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
+ ItemStack itemstack = this.getRareDrop(k <= 0 ? 1 : 0);
if (itemstack != null) {
loot.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
}
@@ -174,38 +174,38 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
// CraftBukkit - return rare dropped item instead of dropping it
- protected ItemStack l(int i) {
+ protected ItemStack getRareDrop(int i) {
if (this.getSkeletonType() == 1) {
- return new ItemStack(Item.SKULL.id, 1, 1); // CraftBukkit
+ return new ItemStack(Items.SKULL, 1, 1); // CraftBukkit
}
return null; // CraftBukkit
}
- protected void bw() {
- super.bw();
- this.setEquipment(0, new ItemStack(Item.BOW));
+ protected void bA() {
+ super.bA();
+ this.setEquipment(0, new ItemStack(Items.BOW));
}
public GroupDataEntity a(GroupDataEntity groupdataentity) {
groupdataentity = super.a(groupdataentity);
- if (this.world.worldProvider instanceof WorldProviderHell && this.aD().nextInt(5) > 0) {
+ if (this.world.worldProvider instanceof WorldProviderHell && this.aI().nextInt(5) > 0) {
this.goalSelector.a(4, this.bq);
this.setSkeletonType(1);
- this.setEquipment(0, new ItemStack(Item.STONE_SWORD));
+ this.setEquipment(0, new ItemStack(Items.STONE_SWORD));
this.getAttributeInstance(GenericAttributes.e).setValue(4.0D);
} else {
this.goalSelector.a(4, this.bp);
- this.bw();
- this.bx();
+ this.bA();
+ this.bB();
}
this.h(this.random.nextFloat() < 0.55F * this.world.b(this.locX, this.locY, this.locZ));
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.W();
+ Calendar calendar = this.world.V();
if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) {
- this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN));
+ this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.PUMPKIN));
this.dropChances[4] = 0.0F;
}
}
@@ -213,12 +213,12 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
return groupdataentity;
}
- public void bT() {
+ public void bX() {
this.goalSelector.a((PathfinderGoal) this.bq);
this.goalSelector.a((PathfinderGoal) this.bp);
- ItemStack itemstack = this.aZ();
+ ItemStack itemstack = this.be();
- if (itemstack != null && itemstack.id == Item.BOW.id) {
+ if (itemstack != null && itemstack.getItem() == Items.BOW) {
this.goalSelector.a(4, this.bp);
} else {
this.goalSelector.a(4, this.bq);
@@ -226,24 +226,24 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
public void a(EntityLiving entityliving, float f) {
- EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float) (14 - this.world.difficulty * 4));
- int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.aZ());
- int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.aZ());
+ EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float) (14 - this.world.difficulty.a() * 4));
+ int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.be());
+ int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.be());
- entityarrow.b((double) (f * 2.0F) + this.random.nextGaussian() * 0.25D + (double) ((float) this.world.difficulty * 0.11F));
+ entityarrow.b((double) (f * 2.0F) + this.random.nextGaussian() * 0.25D + (double) ((float) this.world.difficulty.a() * 0.11F));
if (i > 0) {
- entityarrow.b(entityarrow.c() + (double) i * 0.5D + 0.5D);
+ entityarrow.b(entityarrow.e() + (double) i * 0.5D + 0.5D);
}
if (j > 0) {
entityarrow.a(j);
}
- if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.aZ()) > 0 || this.getSkeletonType() == 1) {
+ if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.be()) > 0 || this.getSkeletonType() == 1) {
entityarrow.setOnFire(100);
}
- this.makeSound("random.bow", 1.0F, 1.0F / (this.aD().nextFloat() * 0.4F + 0.8F));
+ this.makeSound("random.bow", 1.0F, 1.0F / (this.aI().nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entityarrow);
}
@@ -263,13 +263,13 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- if (nbttagcompound.hasKey("SkeletonType")) {
+ if (nbttagcompound.hasKeyOfType("SkeletonType", 99)) {
byte b0 = nbttagcompound.getByte("SkeletonType");
this.setSkeletonType(b0);
}
- this.bT();
+ this.bX();
}
public void b(NBTTagCompound nbttagcompound) {
@@ -280,11 +280,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public void setEquipment(int i, ItemStack itemstack) {
super.setEquipment(i, itemstack);
if (!this.world.isStatic && i == 0) {
- this.bT();
+ this.bX();
}
}
- public double X() {
- return super.X() - 0.5D;
+ public double ad() {
+ return super.ad() - 0.5D;
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index d888dc1c16..87dcb159ff 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -24,8 +24,8 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.setSize(i);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, new Byte((byte) 1));
}
@@ -53,16 +53,16 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.setSize(nbttagcompound.getInt("Size") + 1);
}
- protected String bJ() {
+ protected String bN() {
return "slime";
}
- protected String bP() {
+ protected String bT() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- public void l_() {
- if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
+ public void h() {
+ if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL && this.getSize() > 0) {
this.dead = true;
}
@@ -70,7 +70,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.j = this.i;
boolean flag = this.onGround;
- super.l_();
+ super.h();
int i;
if (this.onGround && !flag) {
@@ -82,11 +82,11 @@ public class EntitySlime extends EntityInsentient implements IMonster {
float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
- this.world.addParticle(this.bJ(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
+ this.world.addParticle(this.bN(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
}
- if (this.bQ()) {
- this.makeSound(this.bP(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
+ if (this.bU()) {
+ this.makeSound(this.bT(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.h = -0.5F;
@@ -94,15 +94,15 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.h = 1.0F;
}
- this.bM();
+ this.bQ();
if (this.world.isStatic) {
i = this.getSize();
this.a(0.6F * (float) i, 0.6F * (float) i);
}
}
- protected void bl() {
- this.u();
+ protected void bq() {
+ this.w();
// CraftBukkit start
Entity entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // EntityHuman -> Entity
EntityTargetEvent event = null;
@@ -125,14 +125,14 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
if (this.onGround && this.jumpDelay-- <= 0) {
- this.jumpDelay = this.bL();
+ this.jumpDelay = this.bP();
if (entityhuman != null) {
this.jumpDelay /= 3;
}
this.bd = true;
- if (this.bS()) {
- this.makeSound(this.bP(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
+ if (this.bW()) {
+ this.makeSound(this.bT(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.be = 1.0F - this.random.nextFloat() * 2.0F;
@@ -145,15 +145,15 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
}
- protected void bM() {
+ protected void bQ() {
this.h *= 0.6F;
}
- protected int bL() {
+ protected int bP() {
return this.random.nextInt(20) + 10;
}
- protected EntitySlime bK() {
+ protected EntitySlime bO() {
return new EntitySlime(this.world);
}
@@ -178,7 +178,7 @@ public class EntitySlime extends EntityInsentient 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.bK();
+ EntitySlime entityslime = this.bO();
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);
@@ -190,33 +190,33 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
public void b_(EntityHuman entityhuman) {
- if (this.bN()) {
+ if (this.bR()) {
int i = this.getSize();
- if (this.o(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bO())) {
+ if (this.o(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bS())) {
this.makeSound("mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
}
- protected boolean bN() {
+ protected boolean bR() {
return this.getSize() > 1;
}
- protected int bO() {
+ protected int bS() {
return this.getSize();
}
- protected String aO() {
+ protected String aT() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String aP() {
+ protected String aU() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected int getLootId() {
- return this.getSize() == 1 ? Item.SLIME_BALL.id : 0;
+ protected Item getLoot() {
+ return this.getSize() == 1 ? Items.SLIME_BALL : Item.d(0);
}
public boolean canSpawn() {
@@ -225,7 +225,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
if (this.world.getWorldData().getType() == WorldType.FLAT && this.random.nextInt(4) != 1) {
return false;
} else {
- if (this.getSize() == 1 || this.world.difficulty > 0) {
+ if (this.getSize() == 1 || this.world.difficulty != EnumDifficulty.PEACEFUL) {
BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < this.world.x() && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) {
@@ -241,19 +241,19 @@ public class EntitySlime extends EntityInsentient implements IMonster {
}
}
- protected float ba() {
+ protected float bf() {
return 0.4F * (float) this.getSize();
}
- public int bp() {
+ public int x() {
return 0;
}
- protected boolean bS() {
+ protected boolean bW() {
return this.getSize() > 0;
}
- protected boolean bQ() {
+ protected boolean bU() {
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 94eadc16f4..4d61eec2c1 100644
--- a/src/main/java/net/minecraft/server/EntitySmallFireball.java
+++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java
@@ -65,7 +65,7 @@ public class EntitySmallFireball extends EntityFireball {
if (this.world.isEmpty(i, j, k)) {
// CraftBukkit start
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
- this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ this.world.setTypeUpdate(i, j, k, Blocks.FIRE);
}
// CraftBukkit end
}
@@ -75,7 +75,7 @@ public class EntitySmallFireball extends EntityFireball {
}
}
- public boolean L() {
+ public boolean R() {
return false;
}
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index ec2319e312..d1b04a81d8 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.event.block.EntityBlockFormEvent;
// CraftBukkit end
@@ -18,38 +19,38 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 0, true, false, IMonster.a));
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(4.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.20000000298023224D);
}
- public void c() {
- super.c();
- if (this.G()) {
+ public void e() {
+ super.e();
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.locY);
+ int k = MathHelper.floor(this.locZ);
+
+ if (this.L()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
- int i = MathHelper.floor(this.locX);
- int j = MathHelper.floor(this.locZ);
-
- if (this.world.getBiome(i, j).j() > 1.0F) {
+ if (this.world.getBiome(i, k).a(i, j, k) > 1.0F) {
this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
- for (i = 0; i < 4; ++i) {
- j = MathHelper.floor(this.locX + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
- 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).j() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
+ for (int l = 0; l < 4; ++l) {
+ i = MathHelper.floor(this.locX + (double) ((float) (l % 2 * 2 - 1) * 0.25F));
+ j = MathHelper.floor(this.locY);
+ k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F));
+ if (this.world.getType(i, j, k).getMaterial() == Material.AIR && this.world.getBiome(i, k).a(i, j, k) < 0.8F && Blocks.SNOW.canPlace(this.world, i, j, k)) {
// CraftBukkit start
org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
- blockState.setTypeId(Block.SNOW.id);
+ blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW));
EntityBlockFormEvent event = new EntityBlockFormEvent(this.getBukkitEntity(), blockState.getBlock(), blockState);
this.world.getServer().getPluginManager().callEvent(event);
@@ -62,8 +63,8 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
}
}
- protected int getLootId() {
- return Item.SNOW_BALL.id;
+ protected Item getLoot() {
+ return Items.SNOW_BALL;
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -72,7 +73,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
int j = this.random.nextInt(16);
if (j > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.SNOW_BALL.id, j));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.SNOW_BALL), j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
@@ -87,7 +88,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
float f1 = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
entitysnowball.shoot(d0, d1 + (double) f1, d2, 1.6F, 12.0F);
- this.makeSound("random.bow", 1.0F, 1.0F / (this.aD().nextFloat() * 0.4F + 0.8F));
+ this.makeSound("random.bow", 1.0F, 1.0F / (this.aI().nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entitysnowball);
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index 3c5b32ed8e..e93d3f7071 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -1,6 +1,9 @@
package net.minecraft.server;
-import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
+import org.bukkit.event.entity.EntityTargetEvent;
+// CraftBukkti end
public class EntitySpider extends EntityMonster {
@@ -9,20 +12,20 @@ public class EntitySpider extends EntityMonster {
this.a(1.4F, 0.9F);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(16, new Byte((byte) 0));
}
- public void l_() {
- super.l_();
+ public void h() {
+ super.h();
if (!this.world.isStatic) {
this.a(this.positionChanged);
}
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(16.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.800000011920929D);
}
@@ -39,19 +42,19 @@ public class EntitySpider extends EntityMonster {
}
}
- protected String r() {
+ protected String t() {
return "mob.spider.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.spider.say";
}
- protected String aP() {
+ protected String aU() {
return "mob.spider.death";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.spider.step", 0.15F, 1.0F);
}
@@ -89,8 +92,8 @@ public class EntitySpider extends EntityMonster {
}
}
- protected int getLootId() {
- return Item.STRING.id;
+ protected Item getLoot() {
+ return Items.STRING;
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -104,22 +107,22 @@ public class EntitySpider extends EntityMonster {
}
if (k > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.STRING.id, k));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.STRING), k));
}
if (flag && (this.random.nextInt(3) == 0 || this.random.nextInt(1 + i) > 0)) {
- loot.add(new org.bukkit.inventory.ItemStack(Item.SPIDER_EYE.id, 1));
+ loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.SPIDER_EYE), 1));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot); // raise event even for those times when the entity does not drop loot
// CraftBukkit end
}
- public boolean e() {
- return this.bT();
+ public boolean h_() {
+ return this.bX();
}
- public void am() {}
+ public void as() {}
public EnumMonsterType getMonsterType() {
return EnumMonsterType.ARTHROPOD;
@@ -129,7 +132,7 @@ public class EntitySpider extends EntityMonster {
return mobeffect.getEffectId() == MobEffectList.POISON.id ? false : super.d(mobeffect);
}
- public boolean bT() {
+ public boolean bX() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@@ -159,7 +162,7 @@ public class EntitySpider extends EntityMonster {
if (object == null) {
object = new GroupDataSpider();
- if (this.world.difficulty > 2 && this.world.random.nextFloat() < 0.1F * this.world.b(this.locX, this.locY, this.locZ)) {
+ if (this.world.difficulty == EnumDifficulty.HARD && this.world.random.nextFloat() < 0.1F * this.world.b(this.locX, this.locY, this.locZ)) {
((GroupDataSpider) object).a(this.world.random);
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index e238e6581a..bc6e1f4abc 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -25,32 +25,32 @@ public class EntitySquid extends EntityWaterAnimal {
this.by = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
}
- protected String r() {
+ protected String t() {
return null;
}
- protected String aO() {
+ protected String aT() {
return null;
}
- protected String aP() {
+ protected String aU() {
return null;
}
- protected float ba() {
+ protected float bf() {
return 0.4F;
}
- protected int getLootId() {
- return 0;
+ protected Item getLoot() {
+ return Item.d(0);
}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
@@ -68,13 +68,13 @@ public class EntitySquid extends EntityWaterAnimal {
}
/* CraftBukkit start - Delegate to Entity to use existing inWater value
- public boolean H() {
+ public boolean M() {
return this.world.a(this.boundingBox.grow(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, (Entity) this);
}
// CraftBukkit end */
- public void c() {
- super.c();
+ public void e() {
+ super.e();
this.bq = this.bp;
this.bs = this.br;
this.bu = this.bt;
@@ -87,7 +87,7 @@ public class EntitySquid extends EntityWaterAnimal {
}
}
- if (this.H()) {
+ if (this.M()) {
float f;
if (this.bt < 3.1415927F) {
@@ -135,7 +135,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.move(this.motX, this.motY, this.motZ);
}
- protected void bl() {
+ protected void bq() {
++this.aV;
if (this.aV > 100) {
this.bA = this.bB = this.bC = 0.0F;
@@ -147,7 +147,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.bC = MathHelper.sin(f) * 0.2F;
}
- this.u();
+ this.w();
}
public boolean canSpawn() {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 858d11ec84..92f00427e3 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -11,7 +11,7 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world) {
super(world);
- this.m = true;
+ this.l = true;
this.a(0.98F, 0.98F);
this.height = this.length / 2.0F;
}
@@ -31,17 +31,17 @@ public class EntityTNTPrimed extends Entity {
this.source = entityliving;
}
- protected void a() {}
+ protected void c() {}
- protected boolean e_() {
+ protected boolean g_() {
return false;
}
- public boolean L() {
+ public boolean R() {
return !this.dead;
}
- public void l_() {
+ public void h() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
index 51695390d0..a21387df2f 100644
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
@@ -14,15 +14,15 @@ public class EntityThrownExpBottle extends EntityProjectile {
super(world, d0, d1, d2);
}
- protected float e() {
+ protected float i() {
return 0.07F;
}
- protected float c() {
+ protected float e() {
return 0.7F;
}
- protected float d() {
+ protected float f() {
return -20.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index 1d9203b19c..7447e42586 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -6,23 +6,27 @@ import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.Callable;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
public class EntityTracker {
+ private static final Logger a = LogManager.getLogger();
private final WorldServer world;
- private Set b = new HashSet();
+ private Set c = new HashSet();
public IntHashMap trackedEntities = new IntHashMap(); // CraftBukkit - private -> public
- private int d;
+ private int e;
public EntityTracker(WorldServer worldserver) {
this.world = worldserver;
- this.d = worldserver.getMinecraftServer().getPlayerList().a();
+ this.e = worldserver.getMinecraftServer().getPlayerList().a();
}
public void track(Entity entity) {
if (entity instanceof EntityPlayer) {
this.addEntity(entity, 512, 2);
EntityPlayer entityplayer = (EntityPlayer) entity;
- Iterator iterator = this.b.iterator();
+ Iterator iterator = this.c.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
@@ -87,19 +91,19 @@ public class EntityTracker {
}
public void addEntity(Entity entity, int i, int j, boolean flag) {
- if (i > this.d) {
- i = this.d;
+ if (i > this.e) {
+ i = this.e;
}
try {
- if (this.trackedEntities.b(entity.id)) {
+ if (this.trackedEntities.b(entity.getId())) {
throw new IllegalStateException("Entity is already tracked!");
}
EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag);
- this.b.add(entitytrackerentry);
- this.trackedEntities.a(entity.id, entitytrackerentry);
+ this.c.add(entitytrackerentry);
+ this.trackedEntities.a(entity.getId(), entitytrackerentry);
entitytrackerentry.scanPlayers(this.world.players);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Adding entity to track");
@@ -110,13 +114,12 @@ public class EntityTracker {
entity.a(crashreportsystemdetails);
CrashReportSystemDetails crashreportsystemdetails1 = crashreport.a("Entity That Is Already Tracked");
- ((EntityTrackerEntry) this.trackedEntities.get(entity.id)).tracker.a(crashreportsystemdetails1);
+ ((EntityTrackerEntry) this.trackedEntities.get(entity.getId())).tracker.a(crashreportsystemdetails1);
try {
throw new ReportedException(crashreport);
} catch (ReportedException reportedexception) {
- System.err.println("\"Silently\" catching entity tracking error.");
- reportedexception.printStackTrace();
+ a.error("\"Silently\" catching entity tracking error.", reportedexception);
}
}
}
@@ -124,7 +127,7 @@ public class EntityTracker {
public void untrackEntity(Entity entity) {
if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
- Iterator iterator = this.b.iterator();
+ Iterator iterator = this.c.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
@@ -133,17 +136,17 @@ public class EntityTracker {
}
}
- EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.trackedEntities.d(entity.id);
+ EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) this.trackedEntities.d(entity.getId());
if (entitytrackerentry1 != null) {
- this.b.remove(entitytrackerentry1);
+ this.c.remove(entitytrackerentry1);
entitytrackerentry1.a();
}
}
public void updatePlayers() {
ArrayList arraylist = new ArrayList();
- Iterator iterator = this.b.iterator();
+ Iterator iterator = this.c.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
@@ -156,7 +159,7 @@ public class EntityTracker {
for (int i = 0; i < arraylist.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) arraylist.get(i);
- Iterator iterator1 = this.b.iterator();
+ Iterator iterator1 = this.c.iterator();
while (iterator1.hasNext()) {
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
@@ -169,7 +172,7 @@ public class EntityTracker {
}
public void a(Entity entity, Packet packet) {
- EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.id);
+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId());
if (entitytrackerentry != null) {
entitytrackerentry.broadcast(packet);
@@ -177,7 +180,7 @@ public class EntityTracker {
}
public void sendPacketToEntity(Entity entity, Packet packet) {
- EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.id);
+ EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.getId());
if (entitytrackerentry != null) {
entitytrackerentry.broadcastIncludingSelf(packet);
@@ -185,7 +188,7 @@ public class EntityTracker {
}
public void untrackPlayer(EntityPlayer entityplayer) {
- Iterator iterator = this.b.iterator();
+ Iterator iterator = this.c.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
@@ -195,12 +198,12 @@ public class EntityTracker {
}
public void a(EntityPlayer entityplayer, Chunk chunk) {
- Iterator iterator = this.b.iterator();
+ Iterator iterator = this.c.iterator();
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
- if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.aj == chunk.x && entitytrackerentry.tracker.al == chunk.z) {
+ if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.ai == chunk.locX && entitytrackerentry.tracker.ak == chunk.locZ) {
entitytrackerentry.updatePlayer(entityplayer);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index baa5b557b6..9f818cf04f 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -6,6 +6,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerVelocityEvent;
@@ -13,6 +16,7 @@ import org.bukkit.event.player.PlayerVelocityEvent;
public class EntityTrackerEntry {
+ private static final Logger p = LogManager.getLogger();
public Entity tracker;
public int b;
public int c;
@@ -26,14 +30,14 @@ public class EntityTrackerEntry {
public double k;
public double l;
public int m;
- private double p;
private double q;
private double r;
- private boolean s;
+ private double s;
private boolean isMoving;
- private int u;
- private Entity v;
- private boolean w;
+ private boolean u;
+ private int v;
+ private Entity w;
+ private boolean x;
public boolean n;
public Set trackedPlayers = new HashSet();
@@ -41,7 +45,7 @@ public class EntityTrackerEntry {
this.tracker = entity;
this.b = i;
this.c = j;
- this.isMoving = flag;
+ this.u = flag;
this.xLoc = MathHelper.floor(entity.locX * 32.0D);
this.yLoc = MathHelper.floor(entity.locY * 32.0D);
this.zLoc = MathHelper.floor(entity.locZ * 32.0D);
@@ -51,27 +55,27 @@ public class EntityTrackerEntry {
}
public boolean equals(Object object) {
- return object instanceof EntityTrackerEntry ? ((EntityTrackerEntry) object).tracker.id == this.tracker.id : false;
+ return object instanceof EntityTrackerEntry ? ((EntityTrackerEntry) object).tracker.getId() == this.tracker.getId() : false;
}
public int hashCode() {
- return this.tracker.id;
+ return this.tracker.getId();
}
public void track(List list) {
this.n = false;
- if (!this.s || this.tracker.e(this.p, this.q, this.r) > 16.0D) {
- this.p = this.tracker.locX;
- this.q = this.tracker.locY;
- this.r = this.tracker.locZ;
- this.s = true;
+ if (!this.isMoving || this.tracker.e(this.q, this.r, this.s) > 16.0D) {
+ this.q = this.tracker.locX;
+ this.r = this.tracker.locY;
+ this.s = this.tracker.locZ;
+ this.isMoving = true;
this.n = true;
this.scanPlayers(list);
}
- if (this.v != this.tracker.vehicle || this.tracker.vehicle != null && this.m % 60 == 0) {
- this.v = this.tracker.vehicle;
- this.broadcast(new Packet39AttachEntity(0, this.tracker, this.tracker.vehicle));
+ if (this.w != this.tracker.vehicle || this.tracker.vehicle != null && this.m % 60 == 0) {
+ this.w = this.tracker.vehicle;
+ this.broadcast(new PacketPlayOutAttachEntity(0, this.tracker, this.tracker.vehicle));
}
if (this.tracker instanceof EntityItemFrame /*&& this.m % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block
@@ -79,7 +83,7 @@ public class EntityTrackerEntry {
ItemStack i4 = i3.getItem();
if (this.m % 10 == 0 && i4 != null && i4.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks
- WorldMap i6 = Item.MAP.getSavedMap(i4, this.tracker.world);
+ WorldMap i6 = Items.MAP.getSavedMap(i4, this.tracker.world);
Iterator i7 = this.trackedPlayers.iterator(); // CraftBukkit
while (i7.hasNext()) {
@@ -87,23 +91,21 @@ public class EntityTrackerEntry {
EntityPlayer i9 = (EntityPlayer) i8;
i6.a(i9, i4);
- if (i9.playerConnection.lowPriorityCount() <= 5) {
- Packet j0 = Item.MAP.c(i4, this.tracker.world, i9);
+ Packet j0 = Items.MAP.c(i4, this.tracker.world, i9);
- if (j0 != null) {
- i9.playerConnection.sendPacket(j0);
- }
+ if (j0 != null) {
+ i9.playerConnection.sendPacket(j0);
}
}
}
this.b();
- } else if (this.m % this.c == 0 || this.tracker.an || this.tracker.getDataWatcher().a()) {
+ } else if (this.m % this.c == 0 || this.tracker.am || this.tracker.getDataWatcher().a()) {
int i;
int j;
if (this.tracker.vehicle == null) {
- ++this.u;
+ ++this.v;
i = this.tracker.at.a(this.tracker.locX);
j = MathHelper.floor(this.tracker.locY * 32.0D);
int k = this.tracker.at.a(this.tracker.locZ);
@@ -130,26 +132,26 @@ public class EntityTrackerEntry {
// CraftBukkit end
if (this.m > 0 || this.tracker instanceof EntityArrow) {
- if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.u <= 400 && !this.w) {
+ if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x) {
if (flag && flag1) {
- object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
+ object = new PacketPlayOutRelEntityMoveLook(this.tracker.getId(), (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);
+ object = new PacketPlayOutRelEntityMove(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1);
} else if (flag1) {
- object = new Packet32EntityLook(this.tracker.id, (byte) l, (byte) i1);
+ object = new PacketPlayOutEntityLook(this.tracker.getId(), (byte) l, (byte) i1);
}
} else {
- this.u = 0;
+ this.v = 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);
+ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1);
}
}
- if (this.isMoving) {
+ if (this.u) {
double d0 = this.tracker.motX - this.j;
double d1 = this.tracker.motY - this.k;
double d2 = this.tracker.motZ - this.l;
@@ -160,7 +162,7 @@ public class EntityTrackerEntry {
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));
+ this.broadcast(new PacketPlayOutEntityVelocity(this.tracker.getId(), this.j, this.k, this.l));
}
}
@@ -182,14 +184,14 @@ public class EntityTrackerEntry {
}
// CraftBukkit end */
- this.w = false;
+ this.x = false;
} else {
i = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
j = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
boolean flag2 = Math.abs(i - this.yRot) >= 4 || Math.abs(j - this.xRot) >= 4;
if (flag2) {
- this.broadcast(new Packet32EntityLook(this.tracker.id, (byte) i, (byte) j));
+ this.broadcast(new PacketPlayOutEntityLook(this.tracker.getId(), (byte) i, (byte) j));
this.yRot = i;
this.xRot = j;
}
@@ -198,16 +200,16 @@ public class EntityTrackerEntry {
this.yLoc = MathHelper.floor(this.tracker.locY * 32.0D);
this.zLoc = this.tracker.at.a(this.tracker.locZ);
this.b();
- this.w = true;
+ this.x = true;
}
i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
if (Math.abs(i - this.i) >= 4) {
- this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i));
+ this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) i));
this.i = i;
}
- this.tracker.an = false;
+ this.tracker.am = false;
}
++this.m;
@@ -230,7 +232,7 @@ public class EntityTrackerEntry {
}
if (!cancelled) {
- this.broadcastIncludingSelf((Packet) (new Packet28EntityVelocity(this.tracker)));
+ this.broadcastIncludingSelf((Packet) (new PacketPlayOutEntityVelocity(this.tracker)));
}
// CraftBukkit end
@@ -242,11 +244,11 @@ public class EntityTrackerEntry {
DataWatcher datawatcher = this.tracker.getDataWatcher();
if (datawatcher.a()) {
- this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher, false));
+ this.broadcastIncludingSelf(new PacketPlayOutEntityMetadata(this.tracker.getId(), datawatcher, false));
}
if (this.tracker instanceof EntityLiving) {
- AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).aX();
+ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).bc();
Set set = attributemapserver.b();
if (!set.isEmpty()) {
@@ -255,7 +257,7 @@ public class EntityTrackerEntry {
((EntityPlayer) this.tracker).getBukkitEntity().injectScaledMaxHealth(set, false);
}
// CraftBukkit end
- this.broadcastIncludingSelf(new Packet44UpdateAttributes(this.tracker.id, set));
+ this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.tracker.getId(), set));
}
set.clear();
@@ -285,13 +287,13 @@ public class EntityTrackerEntry {
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id));
+ entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId()));
}
}
public void a(EntityPlayer entityplayer) {
if (this.trackedPlayers.contains(entityplayer)) {
- entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id));
+ entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId()));
this.trackedPlayers.remove(entityplayer);
}
}
@@ -302,7 +304,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) && (this.d(entityplayer) || this.tracker.p)) {
+ if (!this.trackedPlayers.contains(entityplayer) && (this.d(entityplayer) || this.tracker.o)) {
// CraftBukkit start
if (this.tracker instanceof EntityPlayer) {
Player player = ((EntityPlayer) this.tracker).getBukkitEntity();
@@ -311,7 +313,7 @@ public class EntityTrackerEntry {
}
}
- entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.id));
+ entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
// CraftBukkit end
this.trackedPlayers.add(entityplayer);
@@ -319,42 +321,42 @@ public class EntityTrackerEntry {
entityplayer.playerConnection.sendPacket(packet);
if (!this.tracker.getDataWatcher().d()) {
- entityplayer.playerConnection.sendPacket(new Packet40EntityMetadata(this.tracker.id, this.tracker.getDataWatcher(), true));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(this.tracker.getId(), this.tracker.getDataWatcher(), true));
}
if (this.tracker instanceof EntityLiving) {
- AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).aX();
+ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).bc();
Collection collection = attributemapserver.c();
// CraftBukkit start - If sending own attributes send scaled health instead of current maximum health
- if (this.tracker.id == entityplayer.id) {
+ if (this.tracker.getId() == entityplayer.getId()) {
((EntityPlayer) this.tracker).getBukkitEntity().injectScaledMaxHealth(collection, false);
}
// CraftBukkit end
if (!collection.isEmpty()) {
- entityplayer.playerConnection.sendPacket(new Packet44UpdateAttributes(this.tracker.id, collection));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection));
}
}
this.j = this.tracker.motX;
this.k = this.tracker.motY;
this.l = this.tracker.motZ;
- if (this.isMoving && !(packet instanceof Packet24MobSpawn)) {
- entityplayer.playerConnection.sendPacket(new Packet28EntityVelocity(this.tracker.id, this.tracker.motX, this.tracker.motY, this.tracker.motZ));
+ if (this.u && !(packet instanceof PacketPlayOutSpawnEntityLiving)) {
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityVelocity(this.tracker.getId(), this.tracker.motX, this.tracker.motY, this.tracker.motZ));
}
if (this.tracker.vehicle != null) {
- entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(0, this.tracker, this.tracker.vehicle));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutAttachEntity(0, this.tracker, this.tracker.vehicle));
}
// CraftBukkit start
if (this.tracker.passenger != null) {
- entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(0, this.tracker.passenger, this.tracker));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutAttachEntity(0, this.tracker.passenger, this.tracker));
}
// CraftBukkit end
if (this.tracker instanceof EntityInsentient && ((EntityInsentient) this.tracker).getLeashHolder() != null) {
- entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(1, this.tracker, ((EntityInsentient) this.tracker).getLeashHolder()));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this.tracker, ((EntityInsentient) this.tracker).getLeashHolder()));
}
if (this.tracker instanceof EntityLiving) {
@@ -362,7 +364,7 @@ public class EntityTrackerEntry {
ItemStack itemstack = ((EntityLiving) this.tracker).getEquipment(i);
if (itemstack != null) {
- entityplayer.playerConnection.sendPacket(new Packet5EntityEquipment(this.tracker.id, i, itemstack));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEquipment(this.tracker.getId(), i, itemstack));
}
}
}
@@ -371,13 +373,13 @@ public class EntityTrackerEntry {
EntityHuman entityhuman = (EntityHuman) this.tracker;
if (entityhuman.isSleeping()) {
- entityplayer.playerConnection.sendPacket(new Packet17EntityLocationAction(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBed(entityhuman, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
}
}
// CraftBukkit start - Fix for nonsensical head yaw
this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); // tracker.ao() should be getHeadRotation
- this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i));
+ this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) i));
// CraftBukkit end
if (this.tracker instanceof EntityLiving) {
@@ -387,19 +389,19 @@ public class EntityTrackerEntry {
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
- entityplayer.playerConnection.sendPacket(new Packet41MobEffect(this.tracker.id, mobeffect));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.tracker.getId(), mobeffect));
}
}
}
} else if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer);
- entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id));
+ entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId()));
}
}
}
private boolean d(EntityPlayer entityplayer) {
- return entityplayer.p().getPlayerChunkMap().a(entityplayer, this.tracker.aj, this.tracker.al);
+ return entityplayer.r().getPlayerChunkMap().a(entityplayer, this.tracker.ai, this.tracker.ak);
}
public void scanPlayers(List list) {
@@ -411,49 +413,49 @@ public class EntityTrackerEntry {
private Packet c() {
if (this.tracker.dead) {
// CraftBukkit start - Remove useless error spam, just return
- // this.tracker.world.getLogger().warning("Fetching addPacket for removed entity");
+ // p.warn("Fetching addPacket for removed entity");
return null;
// CraftBukkit end
}
if (this.tracker instanceof EntityItem) {
- return new Packet23VehicleSpawn(this.tracker, 2, 1);
+ return new PacketPlayOutSpawnEntity(this.tracker, 2, 1);
} else if (this.tracker instanceof EntityPlayer) {
- return new Packet20NamedEntitySpawn((EntityHuman) this.tracker);
+ return new PacketPlayOutNamedEntitySpawn((EntityHuman) this.tracker);
} else if (this.tracker instanceof EntityMinecartAbstract) {
EntityMinecartAbstract entityminecartabstract = (EntityMinecartAbstract) this.tracker;
- return new Packet23VehicleSpawn(this.tracker, 10, entityminecartabstract.getType());
+ return new PacketPlayOutSpawnEntity(this.tracker, 10, entityminecartabstract.m());
} else if (this.tracker instanceof EntityBoat) {
- return new Packet23VehicleSpawn(this.tracker, 1);
+ return new PacketPlayOutSpawnEntity(this.tracker, 1);
} 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);
+ return new PacketPlayOutSpawnEntity(this.tracker, 90, entityhuman != null ? entityhuman.getId() : this.tracker.getId());
} 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);
+ return new PacketPlayOutSpawnEntity(this.tracker, 60, entity != null ? entity.getId() : this.tracker.getId());
} else if (this.tracker instanceof EntitySnowball) {
- return new Packet23VehicleSpawn(this.tracker, 61);
+ return new PacketPlayOutSpawnEntity(this.tracker, 61);
} else if (this.tracker instanceof EntityPotion) {
- return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
+ return new PacketPlayOutSpawnEntity(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
} else if (this.tracker instanceof EntityThrownExpBottle) {
- return new Packet23VehicleSpawn(this.tracker, 75);
+ return new PacketPlayOutSpawnEntity(this.tracker, 75);
} else if (this.tracker instanceof EntityEnderPearl) {
- return new Packet23VehicleSpawn(this.tracker, 65);
+ return new PacketPlayOutSpawnEntity(this.tracker, 65);
} else if (this.tracker instanceof EntityEnderSignal) {
- return new Packet23VehicleSpawn(this.tracker, 72);
+ return new PacketPlayOutSpawnEntity(this.tracker, 72);
} else if (this.tracker instanceof EntityFireworks) {
- return new Packet23VehicleSpawn(this.tracker, 76);
+ return new PacketPlayOutSpawnEntity(this.tracker, 76);
} else {
- Packet23VehicleSpawn packet23vehiclespawn;
+ PacketPlayOutSpawnEntity packetplayoutspawnentity;
if (this.tracker instanceof EntityFireball) {
EntityFireball entityfireball = (EntityFireball) this.tracker;
- packet23vehiclespawn = null;
+ packetplayoutspawnentity = null;
byte b0 = 63;
if (this.tracker instanceof EntitySmallFireball) {
@@ -463,59 +465,59 @@ public class EntityTrackerEntry {
}
if (entityfireball.shooter != null) {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, b0, ((EntityFireball) this.tracker).shooter.id);
+ packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, b0, ((EntityFireball) this.tracker).shooter.getId());
} else {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, b0, 0);
+ packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, b0, 0);
}
- packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
- packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
- packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
- return packet23vehiclespawn;
+ packetplayoutspawnentity.d((int) (entityfireball.dirX * 8000.0D));
+ packetplayoutspawnentity.e((int) (entityfireball.dirY * 8000.0D));
+ packetplayoutspawnentity.f((int) (entityfireball.dirZ * 8000.0D));
+ return packetplayoutspawnentity;
} else if (this.tracker instanceof EntityEgg) {
- return new Packet23VehicleSpawn(this.tracker, 62);
+ return new PacketPlayOutSpawnEntity(this.tracker, 62);
} else if (this.tracker instanceof EntityTNTPrimed) {
- return new Packet23VehicleSpawn(this.tracker, 50);
+ return new PacketPlayOutSpawnEntity(this.tracker, 50);
} else if (this.tracker instanceof EntityEnderCrystal) {
- return new Packet23VehicleSpawn(this.tracker, 51);
+ return new PacketPlayOutSpawnEntity(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);
+ return new PacketPlayOutSpawnEntity(this.tracker, 70, Block.b(entityfallingblock.f()) | entityfallingblock.data << 16);
} else if (this.tracker instanceof EntityPainting) {
- return new Packet25EntityPainting((EntityPainting) this.tracker);
+ return new PacketPlayOutSpawnEntityPainting((EntityPainting) this.tracker);
} else if (this.tracker instanceof EntityItemFrame) {
EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 71, entityitemframe.direction);
- packet23vehiclespawn.b = MathHelper.d((float) (entityitemframe.x * 32));
- packet23vehiclespawn.c = MathHelper.d((float) (entityitemframe.y * 32));
- packet23vehiclespawn.d = MathHelper.d((float) (entityitemframe.z * 32));
- return packet23vehiclespawn;
+ packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, 71, entityitemframe.direction);
+ packetplayoutspawnentity.a(MathHelper.d((float) (entityitemframe.x * 32)));
+ packetplayoutspawnentity.b(MathHelper.d((float) (entityitemframe.y * 32)));
+ packetplayoutspawnentity.c(MathHelper.d((float) (entityitemframe.z * 32)));
+ return packetplayoutspawnentity;
} else if (this.tracker instanceof EntityLeash) {
EntityLeash entityleash = (EntityLeash) this.tracker;
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 77);
- packet23vehiclespawn.b = MathHelper.d((float) (entityleash.x * 32));
- packet23vehiclespawn.c = MathHelper.d((float) (entityleash.y * 32));
- packet23vehiclespawn.d = MathHelper.d((float) (entityleash.z * 32));
- return packet23vehiclespawn;
+ packetplayoutspawnentity = new PacketPlayOutSpawnEntity(this.tracker, 77);
+ packetplayoutspawnentity.a(MathHelper.d((float) (entityleash.x * 32)));
+ packetplayoutspawnentity.b(MathHelper.d((float) (entityleash.y * 32)));
+ packetplayoutspawnentity.c(MathHelper.d((float) (entityleash.z * 32)));
+ return packetplayoutspawnentity;
} else if (this.tracker instanceof EntityExperienceOrb) {
- return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
+ return new PacketPlayOutSpawnEntityExperienceOrb((EntityExperienceOrb) this.tracker);
} else {
throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
}
}
} else {
this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
- return new Packet24MobSpawn((EntityLiving) this.tracker);
+ return new PacketPlayOutSpawnEntityLiving((EntityLiving) this.tracker);
}
}
public void clear(EntityPlayer entityplayer) {
if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer);
- entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id));
+ entityplayer.removeQueue.add(Integer.valueOf(this.tracker.getId()));
}
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index d22fec15a8..d300ec0b4a 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -8,7 +8,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
private static final UUID bp = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
private static final AttributeModifier bq = (new AttributeModifier(bp, "Drinking speed penalty", -0.25D, 0)).a(false);
- private static final int[] br = new int[] { Item.GLOWSTONE_DUST.id, Item.SUGAR.id, Item.REDSTONE.id, Item.SPIDER_EYE.id, Item.GLASS_BOTTLE.id, Item.SULPHUR.id, Item.STICK.id, Item.STICK.id};
+ private static final Item[] br = new Item[] { Items.GLOWSTONE_DUST, Items.SUGAR, Items.REDSTONE, Items.SPIDER_EYE, Items.GLASS_BOTTLE, Items.SULPHUR, Items.STICK, Items.STICK};
private int bs;
public EntityWitch(World world) {
@@ -22,20 +22,20 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.getDataWatcher().a(21, Byte.valueOf((byte) 0));
}
- protected String r() {
+ protected String t() {
return "mob.witch.idle";
}
- protected String aO() {
+ protected String aT() {
return "mob.witch.hurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.witch.death";
}
@@ -43,30 +43,30 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.getDataWatcher().watch(21, Byte.valueOf((byte) (flag ? 1 : 0)));
}
- public boolean bT() {
+ public boolean bX() {
return this.getDataWatcher().getByte(21) == 1;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(26.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
- public void c() {
+ public void e() {
if (!this.world.isStatic) {
- if (this.bT()) {
+ if (this.bX()) {
if (this.bs-- <= 0) {
this.a(false);
- ItemStack itemstack = this.aZ();
+ ItemStack itemstack = this.be();
this.setEquipment(0, (ItemStack) null);
- if (itemstack != null && itemstack.id == Item.POTION.id) {
- List list = Item.POTION.g(itemstack);
+ if (itemstack != null && itemstack.getItem() == Items.POTION) {
+ List list = Items.POTION.g(itemstack);
if (list != null) {
Iterator iterator = list.iterator();
@@ -84,7 +84,9 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
} else {
short short1 = -1;
- if (this.random.nextFloat() < 0.15F && this.isBurning() && !this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
+ if (this.random.nextFloat() < 0.15F && this.a(Material.WATER) && !this.hasEffect(MobEffectList.WATER_BREATHING)) {
+ short1 = 8237;
+ } else if (this.random.nextFloat() < 0.15F && this.isBurning() && !this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
short1 = 16307;
} else if (this.random.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth()) {
short1 = 16341;
@@ -95,8 +97,8 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
}
if (short1 > -1) {
- this.setEquipment(0, new ItemStack(Item.POTION, 1, short1));
- this.bs = this.aZ().n();
+ this.setEquipment(0, new ItemStack(Items.POTION, 1, short1));
+ this.bs = this.be().n();
this.a(true);
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);
@@ -110,7 +112,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
}
}
- super.c();
+ super.e();
}
protected float c(DamageSource damagesource, float f) {
@@ -119,7 +121,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
f = 0.0F;
}
- if (damagesource.q()) {
+ if (damagesource.s()) {
f = (float) ((double) f * 0.15D);
}
@@ -134,13 +136,13 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
for (int k = 0; k < j; ++k) {
int l = this.random.nextInt(3);
- int i1 = br[this.random.nextInt(br.length)];
+ Item item = br[this.random.nextInt(br.length)];
if (i > 0) {
l += this.random.nextInt(i + 1);
}
- loot.add(new org.bukkit.inventory.ItemStack(i1, l));
+ loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), l));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
@@ -148,7 +150,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
}
public void a(EntityLiving entityliving, float f) {
- if (!this.bT()) {
+ if (!this.bX()) {
EntityPotion entitypotion = new EntityPotion(this.world, this, 32732);
entitypotion.pitch -= -20.0F;
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 057ce7edd6..04d624e9f2 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Iterator;
import java.util.List;
// CraftBukkit start
@@ -34,8 +35,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.b = 50;
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(0));
this.datawatcher.a(19, new Integer(0));
@@ -44,37 +45,37 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setInt("Invul", this.bU());
+ nbttagcompound.setInt("Invul", this.bY());
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.p(nbttagcompound.getInt("Invul"));
+ this.s(nbttagcompound.getInt("Invul"));
}
- protected String r() {
+ protected String t() {
return "mob.wither.idle";
}
- protected String aO() {
+ protected String aT() {
return "mob.wither.hurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.wither.death";
}
- public void c() {
+ public void e() {
this.motY *= 0.6000000238418579D;
double d0;
double d1;
double d2;
- if (!this.world.isStatic && this.q(0) > 0) {
- Entity entity = this.world.getEntity(this.q(0));
+ if (!this.world.isStatic && this.t(0) > 0) {
+ Entity entity = this.world.getEntity(this.t(0));
if (entity != null) {
- if (this.locY < entity.locY || !this.bV() && this.locY < entity.locY + 5.0D) {
+ if (this.locY < entity.locY || !this.bZ() && this.locY < entity.locY + 5.0D) {
if (this.motY < 0.0D) {
this.motY = 0.0D;
}
@@ -98,7 +99,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.yaw = (float) Math.atan2(this.motZ, this.motX) * 57.295776F - 90.0F;
}
- super.c();
+ super.e();
int i;
@@ -110,7 +111,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
int j;
for (i = 0; i < 2; ++i) {
- j = this.q(i + 1);
+ j = this.t(i + 1);
Entity entity1 = null;
if (j > 0) {
@@ -118,9 +119,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
if (entity1 != null) {
- d0 = this.r(i + 1);
- d1 = this.s(i + 1);
- d2 = this.t(i + 1);
+ d0 = this.u(i + 1);
+ d1 = this.v(i + 1);
+ d2 = this.w(i + 1);
double d4 = entity1.locX - d0;
double d5 = entity1.locY + (double) entity1.getHeadHeight() - d1;
double d6 = entity1.locZ - d2;
@@ -135,12 +136,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- boolean flag = this.bV();
+ boolean flag = this.bZ();
for (j = 0; j < 3; ++j) {
- double d8 = this.r(j);
- double d9 = this.s(j);
- double d10 = this.t(j);
+ double d8 = this.u(j);
+ double d9 = this.v(j);
+ double d10 = this.w(j);
this.world.addParticle("smoke", d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D);
if (flag && this.world.random.nextInt(4) == 0) {
@@ -148,18 +149,18 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- if (this.bU() > 0) {
+ if (this.bY() > 0) {
for (j = 0; j < 3; ++j) {
this.world.addParticle("mobSpell", this.locX + this.random.nextGaussian() * 1.0D, this.locY + (double) (this.random.nextFloat() * 3.3F), this.locZ + this.random.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D);
}
}
}
- protected void bi() {
+ protected void bn() {
int i;
- if (this.bU() > 0) {
- i = this.bU() - 1;
+ if (this.bY() > 0) {
+ i = this.bY() - 1;
if (i <= 0) {
// CraftBukkit start
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
@@ -171,22 +172,22 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit end
this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing"));
- this.world.d(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ this.world.b(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
- this.p(i);
+ this.s(i);
if (this.ticksLived % 10 == 0) {
this.heal(10.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
}
} else {
- super.bi();
+ super.bn();
int j;
for (i = 1; i < 3; ++i) {
if (this.ticksLived >= this.bt[i - 1]) {
this.bt[i - 1] = this.ticksLived + 10 + this.random.nextInt(10);
- if (this.world.difficulty >= 2) {
+ if (this.world.difficulty == EnumDifficulty.NORMAL || this.world.difficulty == EnumDifficulty.HARD) {
int i1001 = i - 1;
int i1003 = this.bu[i - 1];
@@ -203,7 +204,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- j = this.q(i);
+ j = this.t(i);
if (j > 0) {
Entity entity = this.world.getEntity(j);
@@ -212,7 +213,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.bt[i - 1] = this.ticksLived + 40 + this.random.nextInt(20);
this.bu[i - 1] = 0;
} else {
- this.c(i, 0);
+ this.b(i, 0);
}
} else {
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bw);
@@ -223,10 +224,10 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (entityliving != this && entityliving.isAlive() && this.o(entityliving)) {
if (entityliving instanceof EntityHuman) {
if (!((EntityHuman) entityliving).abilities.isInvulnerable) {
- this.c(i, entityliving.id);
+ this.b(i, entityliving.getId());
}
} else {
- this.c(i, entityliving.id);
+ this.b(i, entityliving.getId());
}
break;
}
@@ -238,9 +239,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
if (this.getGoalTarget() != null) {
- this.c(0, this.getGoalTarget().id);
+ this.b(0, this.getGoalTarget().getId());
} else {
- this.c(0, 0);
+ this.b(0, 0);
}
if (this.bv > 0) {
@@ -257,11 +258,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
int j2 = j + k1;
int k2 = i + i2;
int l2 = j1 + l1;
- int i3 = this.world.getTypeId(j2, k2, l2);
+ Block block = this.world.getType(j2, k2, l2);
- if (i3 > 0 && i3 != Block.BEDROCK.id && i3 != Block.ENDER_PORTAL.id && i3 != Block.ENDER_PORTAL_FRAME.id) {
+ if (block.getMaterial() != Material.AIR && block != Blocks.BEDROCK && block != Blocks.ENDER_PORTAL && block != Blocks.ENDER_PORTAL_FRAME && block != Blocks.COMMAND) {
// CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, 0, 0).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, Blocks.AIR, 0).isCancelled()) {
continue;
}
// CraftBukkit end
@@ -284,18 +285,18 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- public void bT() {
- this.p(220);
+ public void bX() {
+ this.s(220);
this.setHealth(this.getMaxHealth() / 3.0F);
}
- public void am() {}
+ public void as() {}
- public int aQ() {
+ public int aV() {
return 4;
}
- private double r(int i) {
+ private double u(int i) {
if (i <= 0) {
return this.locX;
} else {
@@ -306,11 +307,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- private double s(int i) {
+ private double v(int i) {
return i <= 0 ? this.locY + 3.0D : this.locY + 2.2D;
}
- private double t(int i) {
+ private double w(int i) {
if (i <= 0) {
return this.locZ;
} else {
@@ -341,9 +342,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
private void a(int i, double d0, double d1, double d2, boolean flag) {
this.world.a((EntityHuman) null, 1014, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
- double d3 = this.r(i);
- double d4 = this.s(i);
- double d5 = this.t(i);
+ double d3 = this.u(i);
+ double d4 = this.v(i);
+ double d5 = this.w(i);
double d6 = d0 - d3;
double d7 = d1 - d4;
double d8 = d2 - d5;
@@ -368,13 +369,13 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
return false;
} else if (damagesource == DamageSource.DROWN) {
return false;
- } else if (this.bU() > 0) {
+ } else if (this.bY() > 0) {
return false;
} else {
Entity entity;
- if (this.bV()) {
- entity = damagesource.h();
+ if (this.bZ()) {
+ entity = damagesource.i();
if (entity instanceof EntityArrow) {
return false;
}
@@ -400,51 +401,56 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start
java.util.List loot = new java.util.ArrayList();
- loot.add(new org.bukkit.inventory.ItemStack(Item.NETHER_STAR.id, 1));
+ loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(Items.NETHER_STAR), 1));
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
+ if (!this.world.isStatic) {
+ Iterator iterator = this.world.a(EntityHuman.class, this.boundingBox.grow(50.0D, 100.0D, 50.0D)).iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ entityhuman.a((Statistic) AchievementList.J);
+ }
+ }
}
- protected void u() {
+ protected void w() {
this.aV = 0;
}
- public boolean L() {
- return !this.dead;
- }
-
protected void b(float f) {}
public void addEffect(MobEffect mobeffect) {}
- protected boolean bf() {
+ protected boolean bk() {
return true;
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(300.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.6000000238418579D);
this.getAttributeInstance(GenericAttributes.b).setValue(40.0D);
}
- public int bU() {
+ public int bY() {
return this.datawatcher.getInt(20);
}
- public void p(int i) {
+ public void s(int i) {
this.datawatcher.watch(20, Integer.valueOf(i));
}
- public int q(int i) {
+ public int t(int i) {
return this.datawatcher.getInt(17 + i);
}
- public void c(int i, int j) {
+ public void b(int i, int j) {
this.datawatcher.watch(17 + i, Integer.valueOf(j));
}
- public boolean bV() {
+ public boolean bZ() {
return this.getHealth() <= this.getMaxHealth() / 2.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java
index 970c91a79d..2d428f9d39 100644
--- a/src/main/java/net/minecraft/server/EntityWitherSkull.java
+++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java
@@ -14,8 +14,8 @@ public class EntityWitherSkull extends EntityFireball {
this.a(0.3125F, 0.3125F);
}
- protected float c() {
- return this.d() ? 0.73F : super.c();
+ protected float e() {
+ return this.f() ? 0.73F : super.e();
}
public boolean isBurning() {
@@ -25,7 +25,7 @@ public class EntityWitherSkull extends EntityFireball {
public float a(Explosion explosion, World world, int i, int j, int k, Block block) {
float f = super.a(explosion, world, i, j, k, block);
- if (this.d() && block != Block.BEDROCK && block != Block.ENDER_PORTAL && block != Block.ENDER_PORTAL_FRAME) {
+ if (this.f() && block != Blocks.BEDROCK && block != Blocks.ENDER_PORTAL && block != Blocks.ENDER_PORTAL_FRAME && block != Blocks.COMMAND) {
f = Math.min(0.8F, f);
}
@@ -46,12 +46,10 @@ public class EntityWitherSkull extends EntityFireball {
if (movingobjectposition.entity instanceof EntityLiving) {
byte b0 = 0;
- if (this.world.difficulty > 1) {
- if (this.world.difficulty == 2) {
- b0 = 10;
- } else if (this.world.difficulty == 3) {
- b0 = 40;
- }
+ if (this.world.difficulty == EnumDifficulty.NORMAL) {
+ b0 = 10;
+ } else if (this.world.difficulty == EnumDifficulty.HARD) {
+ b0 = 40;
}
if (b0 > 0) {
@@ -73,7 +71,7 @@ public class EntityWitherSkull extends EntityFireball {
}
}
- public boolean L() {
+ public boolean R() {
return false;
}
@@ -81,11 +79,11 @@ public class EntityWitherSkull extends EntityFireball {
return false;
}
- protected void a() {
+ protected void c() {
this.datawatcher.a(10, Byte.valueOf((byte) 0));
}
- public boolean d() {
+ public boolean f() {
return this.datawatcher.getByte(10) == 1;
}
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 880a024881..7359a12bc1 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -30,8 +30,8 @@ public class EntityWolf extends EntityTameableAnimal {
this.setTamed(false);
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.d).setValue(0.30000001192092896D);
if (this.isTamed()) {
this.getAttributeInstance(GenericAttributes.a).setValue(20.0D);
@@ -40,7 +40,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- public boolean bf() {
+ public boolean bk() {
return true;
}
@@ -53,18 +53,18 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- protected void bk() {
+ protected void bp() {
this.datawatcher.watch(18, Float.valueOf(this.getHealth()));
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.datawatcher.a(18, new Float(this.getHealth()));
this.datawatcher.a(19, new Byte((byte) 0));
- this.datawatcher.a(20, new Byte((byte) BlockCloth.j_(1)));
+ this.datawatcher.a(20, new Byte((byte) BlockCloth.b(1)));
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.wolf.step", 0.15F, 1.0F);
}
@@ -77,35 +77,35 @@ public class EntityWolf extends EntityTameableAnimal {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.setAngry(nbttagcompound.getBoolean("Angry"));
- if (nbttagcompound.hasKey("CollarColor")) {
+ if (nbttagcompound.hasKeyOfType("CollarColor", 99)) {
this.setCollarColor(nbttagcompound.getByte("CollarColor"));
}
}
- protected String r() {
- // CraftBukkit - (getInt(18) < 10) -> (getInt(18) < this.getMaxHealth() / 2)
+ protected String t() {
+ // CraftBukkit - (getFloat(18) < 10) -> (getFloat(18) < this.getMaxHealth() / 2)
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getFloat(18) < (this.getMaxHealth() / 2) ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
}
- protected String aO() {
+ protected String aT() {
return "mob.wolf.hurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.wolf.death";
}
- protected float ba() {
+ protected float bf() {
return 0.4F;
}
- protected int getLootId() {
- return -1;
+ protected Item getLoot() {
+ return Item.d(-1);
}
- public void c() {
- super.c();
- if (!this.world.isStatic && this.bs && !this.bt && !this.bM() && this.onGround) {
+ public void e() {
+ super.e();
+ if (!this.world.isStatic && this.bs && !this.bt && !this.bQ() && this.onGround) {
this.bt = true;
this.bu = 0.0F;
this.bv = 0.0F;
@@ -113,27 +113,27 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- public void l_() {
- super.l_();
+ public void h() {
+ super.h();
this.br = this.bq;
- if (this.ce()) {
+ if (this.ci()) {
this.bq += (1.0F - this.bq) * 0.4F;
} else {
this.bq += (0.0F - this.bq) * 0.4F;
}
- if (this.ce()) {
+ if (this.ci()) {
this.g = 10;
}
- if (this.G()) {
+ if (this.L()) {
this.bs = true;
this.bt = false;
this.bu = 0.0F;
this.bv = 0.0F;
} else if ((this.bs || this.bt) && this.bt) {
if (this.bu == 0.0F) {
- this.makeSound("mob.wolf.shake", this.ba(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.makeSound("mob.wolf.shake", this.bf(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
this.bv = this.bu;
@@ -163,8 +163,8 @@ public class EntityWolf extends EntityTameableAnimal {
return this.length * 0.8F;
}
- public int bp() {
- return this.isSitting() ? 20 : super.bp();
+ public int x() {
+ return this.isSitting() ? 20 : super.x();
}
public boolean damageEntity(DamageSource damagesource, float f) {
@@ -202,23 +202,23 @@ public class EntityWolf extends EntityTameableAnimal {
if (this.isTamed()) {
if (itemstack != null) {
- if (Item.byId[itemstack.id] instanceof ItemFood) {
- ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
+ if (itemstack.getItem() instanceof ItemFood) {
+ ItemFood itemfood = (ItemFood) itemstack.getItem();
- if (itemfood.j() && this.datawatcher.getFloat(18) < 20.0F) {
+ if (itemfood.i() && this.datawatcher.getFloat(18) < 20.0F) {
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
- this.heal((float) itemfood.getNutrition());
+ this.heal((float) itemfood.getNutrition(itemstack));
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
return true;
}
- } else if (itemstack.id == Item.INK_SACK.id) {
- int i = BlockCloth.j_(itemstack.getData());
+ } else if (itemstack.getItem() == Items.INK_SACK) {
+ int i = BlockCloth.b(itemstack.getData());
if (i != this.getCollarColor()) {
this.setCollarColor(i);
@@ -238,7 +238,7 @@ public class EntityWolf extends EntityTameableAnimal {
this.setTarget((Entity) null);
this.setGoalTarget((EntityLiving) null);
}
- } else if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
+ } else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) {
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -271,10 +271,10 @@ public class EntityWolf extends EntityTameableAnimal {
}
public boolean c(ItemStack itemstack) {
- return itemstack == null ? false : (!(Item.byId[itemstack.id] instanceof ItemFood) ? false : ((ItemFood) Item.byId[itemstack.id]).j());
+ return itemstack == null ? false : (!(itemstack.getItem() instanceof ItemFood) ? false : ((ItemFood) itemstack.getItem()).i());
}
- public int bv() {
+ public int bz() {
return 8;
}
@@ -330,11 +330,11 @@ public class EntityWolf extends EntityTameableAnimal {
} else {
EntityWolf entitywolf = (EntityWolf) entityanimal;
- return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.bY() && entitywolf.bY());
+ return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.cc() && entitywolf.cc());
}
}
- public boolean ce() {
+ public boolean ci() {
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 1aa684f5cf..6c6e03edcd 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -14,43 +14,47 @@ public class EntityZombie extends EntityMonster {
protected static final IAttribute bp = (new AttributeRanged("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
private static final UUID bq = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", 0.5D, 1);
- private int bs;
+ private final PathfinderGoalBreakDoor bs = new PathfinderGoalBreakDoor(this);
+ private int bt;
+ private boolean bu = false;
+ private float bv = -1.0F;
+ private float bw;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit
public EntityZombie(World world) {
super(world);
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, 1.0D, false));
- this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
- this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
- this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 1.0D));
- this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
- this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(6, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false));
+ this.a(0.6F, 1.8F);
}
- protected void az() {
- super.az();
+ protected void aD() {
+ super.aD();
this.getAttributeInstance(GenericAttributes.b).setValue(40.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D);
this.getAttributeInstance(GenericAttributes.e).setValue(3.0D);
- this.aX().b(bp).setValue(this.random.nextDouble() * 0.10000000149011612D);
+ this.bc().b(bp).setValue(this.random.nextDouble() * 0.10000000149011612D);
}
- protected void a() {
- super.a();
+ protected void c() {
+ super.c();
this.getDataWatcher().a(12, Byte.valueOf((byte) 0));
this.getDataWatcher().a(13, Byte.valueOf((byte) 0));
this.getDataWatcher().a(14, Byte.valueOf((byte) 0));
}
- public int aQ() {
- int i = super.aQ() + 2;
+ public int aV() {
+ int i = super.aV() + 2;
if (i > 20) {
i = 20;
@@ -59,14 +63,37 @@ public class EntityZombie extends EntityMonster {
return i;
}
- protected boolean bf() {
+ protected boolean bk() {
return true;
}
+ public boolean bX() {
+ return this.bu;
+ }
+
+ public void a(boolean flag) {
+ if (this.bu != flag) {
+ this.bu = flag;
+ if (flag) {
+ this.goalSelector.a(1, this.bs);
+ } else {
+ this.goalSelector.a((PathfinderGoal) this.bs);
+ }
+ }
+ }
+
public boolean isBaby() {
return this.getDataWatcher().getByte(12) == 1;
}
+ protected int getExpValue(EntityHuman entityhuman) {
+ if (this.isBaby()) {
+ this.b = (int) ((float) this.b * 2.5F);
+ }
+
+ return super.getExpValue(entityhuman);
+ }
+
public void setBaby(boolean flag) {
this.getDataWatcher().watch(12, Byte.valueOf((byte) (flag ? 1 : 0)));
if (this.world != null && !this.world.isStatic) {
@@ -77,6 +104,8 @@ public class EntityZombie extends EntityMonster {
attributeinstance.a(br);
}
}
+
+ this.k(flag);
}
public boolean isVillager() {
@@ -87,11 +116,11 @@ public class EntityZombie extends EntityMonster {
this.getDataWatcher().watch(13, Byte.valueOf((byte) (flag ? 1 : 0)));
}
- public void c() {
+ public void e() {
if (this.world.v() && !this.world.isStatic && !this.isBaby()) {
float f = this.d(1.0F);
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
+ if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
boolean flag = true;
ItemStack itemstack = this.getEquipment(4);
@@ -120,7 +149,7 @@ public class EntityZombie extends EntityMonster {
}
}
- super.c();
+ super.e();
}
public boolean damageEntity(DamageSource damagesource, float f) {
@@ -129,15 +158,15 @@ public class EntityZombie extends EntityMonster {
} else {
EntityLiving entityliving = this.getGoalTarget();
- if (entityliving == null && this.bN() instanceof EntityLiving) {
- entityliving = (EntityLiving) this.bN();
+ if (entityliving == null && this.bR() instanceof EntityLiving) {
+ entityliving = (EntityLiving) this.bR();
}
if (entityliving == null && damagesource.getEntity() instanceof EntityLiving) {
entityliving = (EntityLiving) damagesource.getEntity();
}
- if (entityliving != null && this.world.difficulty >= 3 && (double) this.random.nextFloat() < this.getAttributeInstance(bp).getValue()) {
+ if (entityliving != null && this.world.difficulty == EnumDifficulty.HARD && (double) this.random.nextFloat() < this.getAttributeInstance(bp).getValue()) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
@@ -148,10 +177,10 @@ public class EntityZombie extends EntityMonster {
int j1 = j + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
int k1 = k + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
- if (this.world.w(i1, j1 - 1, k1) && this.world.getLightLevel(i1, j1, k1) < 10) {
+ if (World.a((IBlockAccess) this.world, i1, j1 - 1, k1) && this.world.getLightLevel(i1, j1, k1) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
if (this.world.b(entityzombie.boundingBox) && this.world.getCubes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.world.containsLiquid(entityzombie.boundingBox)) {
- this.world.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.REINFORCEMENTS);
+ this.world.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
entityzombie.setGoalTarget(entityliving);
entityzombie.a((GroupDataEntity) null);
this.getAttributeInstance(bp).a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
@@ -166,9 +195,9 @@ public class EntityZombie extends EntityMonster {
}
}
- public void l_() {
- if (!this.world.isStatic && this.bV()) {
- int i = this.bX();
+ public void h() {
+ if (!this.world.isStatic && this.ca()) {
+ int i = this.cc();
// CraftBukkit start - Use wall time instead of ticks for villager conversion
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
@@ -176,50 +205,54 @@ public class EntityZombie extends EntityMonster {
i *= elapsedTicks;
// CraftBukkit end
- this.bs -= i;
- if (this.bs <= 0) {
- this.bW();
+ this.bt -= i;
+ if (this.bt <= 0) {
+ this.cb();
}
}
- super.l_();
+ super.h();
}
public boolean m(Entity entity) {
boolean flag = super.m(entity);
- if (flag && this.aZ() == null && this.isBurning() && this.random.nextFloat() < (float) this.world.difficulty * 0.3F) {
- // CraftBukkit start
- EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * this.world.difficulty);
- this.world.getServer().getPluginManager().callEvent(event);
+ if (flag) {
+ int i = this.world.difficulty.a();
- if (!event.isCancelled()) {
- entity.setOnFire(event.getDuration());
+ if (this.be() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) {
+ // CraftBukkit start
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i);
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entity.setOnFire(event.getDuration());
+ }
+ // CraftBukkit end
}
- // CraftBukkit end
}
return flag;
}
- protected String r() {
+ protected String t() {
return "mob.zombie.say";
}
- protected String aO() {
+ protected String aT() {
return "mob.zombie.hurt";
}
- protected String aP() {
+ protected String aU() {
return "mob.zombie.death";
}
- protected void a(int i, int j, int k, int l) {
+ protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.zombie.step", 0.15F, 1.0F);
}
- protected int getLootId() {
- return Item.ROTTEN_FLESH.id;
+ protected Item getLoot() {
+ return Items.ROTTEN_FLESH;
}
public EnumMonsterType getMonsterType() {
@@ -227,29 +260,29 @@ public class EntityZombie extends EntityMonster {
}
// CraftBukkit start - Return rare dropped item instead of dropping it
- protected ItemStack l(int i) {
+ protected ItemStack getRareDrop(int i) {
switch (this.random.nextInt(3)) {
case 0:
- return new ItemStack(Item.IRON_INGOT.id, 1, 0);
+ return new ItemStack(Items.IRON_INGOT, 1, 0);
case 1:
- return new ItemStack(Item.CARROT.id, 1, 0);
+ return new ItemStack(Items.CARROT, 1, 0);
case 2:
- return new ItemStack(Item.POTATO.id, 1, 0);
+ return new ItemStack(Items.POTATO, 1, 0);
default:
return null;
}
}
// CraftBukkit end
- protected void bw() {
- super.bw();
- if (this.random.nextFloat() < (this.world.difficulty == 3 ? 0.05F : 0.01F)) {
+ protected void bA() {
+ super.bA();
+ if (this.random.nextFloat() < (this.world.difficulty == EnumDifficulty.HARD ? 0.05F : 0.01F)) {
int i = this.random.nextInt(3);
if (i == 0) {
- this.setEquipment(0, new ItemStack(Item.IRON_SWORD));
+ this.setEquipment(0, new ItemStack(Items.IRON_SWORD));
} else {
- this.setEquipment(0, new ItemStack(Item.IRON_SPADE));
+ this.setEquipment(0, new ItemStack(Items.IRON_SPADE));
}
}
}
@@ -264,7 +297,8 @@ public class EntityZombie extends EntityMonster {
nbttagcompound.setBoolean("IsVillager", true);
}
- nbttagcompound.setInt("ConversionTime", this.bV() ? this.bs : -1);
+ nbttagcompound.setInt("ConversionTime", this.ca() ? this.bt : -1);
+ nbttagcompound.setBoolean("CanBreakDoors", this.bX());
}
public void a(NBTTagCompound nbttagcompound) {
@@ -277,15 +311,17 @@ public class EntityZombie extends EntityMonster {
this.setVillager(true);
}
- if (nbttagcompound.hasKey("ConversionTime") && nbttagcompound.getInt("ConversionTime") > -1) {
+ if (nbttagcompound.hasKeyOfType("ConversionTime", 99) && nbttagcompound.getInt("ConversionTime") > -1) {
this.a(nbttagcompound.getInt("ConversionTime"));
}
+
+ this.a(nbttagcompound.getBoolean("CanBreakDoors"));
}
public void a(EntityLiving entityliving) {
super.a(entityliving);
- if (this.world.difficulty >= 2 && entityliving instanceof EntityVillager) {
- if (this.world.difficulty == 2 && this.random.nextBoolean()) {
+ if ((this.world.difficulty == EnumDifficulty.NORMAL || this.world.difficulty == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
+ if (this.random.nextBoolean()) {
return;
}
@@ -310,7 +346,7 @@ public class EntityZombie extends EntityMonster {
this.h(this.random.nextFloat() < 0.55F * f);
if (object == null) {
- object = new GroupDataZombie(this, this.world.random.nextFloat() < 0.05F, this.world.random.nextFloat() < 0.05F, (EmptyClass4) null);
+ object = new GroupDataZombie(this, this.world.random.nextFloat() < 0.05F, this.world.random.nextFloat() < 0.05F, (EmptyClassZombie) null);
}
if (object instanceof GroupDataZombie) {
@@ -325,31 +361,38 @@ public class EntityZombie extends EntityMonster {
}
}
- this.bw();
- this.bx();
+ this.a(this.random.nextFloat() < f * 0.1F);
+ this.bA();
+ this.bB();
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.W();
+ Calendar calendar = this.world.V();
if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) {
- this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN));
+ this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.PUMPKIN));
this.dropChances[4] = 0.0F;
}
}
this.getAttributeInstance(GenericAttributes.c).a(new AttributeModifier("Random spawn bonus", this.random.nextDouble() * 0.05000000074505806D, 0));
- this.getAttributeInstance(GenericAttributes.b).a(new AttributeModifier("Random zombie-spawn bonus", this.random.nextDouble() * 1.5D, 2));
+ double d0 = this.random.nextDouble() * 1.5D * (double) this.world.b(this.locX, this.locY, this.locZ);
+
+ if (d0 > 1.0D) {
+ this.getAttributeInstance(GenericAttributes.b).a(new AttributeModifier("Random zombie-spawn bonus", d0, 2));
+ }
+
if (this.random.nextFloat() < f * 0.05F) {
this.getAttributeInstance(bp).a(new AttributeModifier("Leader zombie bonus", this.random.nextDouble() * 0.25D + 0.5D, 0));
this.getAttributeInstance(GenericAttributes.a).a(new AttributeModifier("Leader zombie bonus", this.random.nextDouble() * 3.0D + 1.0D, 2));
+ this.a(true);
}
return (GroupDataEntity) object;
}
public boolean a(EntityHuman entityhuman) {
- ItemStack itemstack = entityhuman.by();
+ ItemStack itemstack = entityhuman.bD();
- if (itemstack != null && itemstack.getItem() == Item.GOLDEN_APPLE && itemstack.getData() == 0 && this.isVillager() && this.hasEffect(MobEffectList.WEAKNESS)) {
+ if (itemstack != null && itemstack.getItem() == Items.GOLDEN_APPLE && itemstack.getData() == 0 && this.isVillager() && this.hasEffect(MobEffectList.WEAKNESS)) {
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -369,27 +412,27 @@ public class EntityZombie extends EntityMonster {
}
protected void a(int i) {
- this.bs = i;
+ this.bt = i;
this.getDataWatcher().watch(14, Byte.valueOf((byte) 1));
- this.k(MobEffectList.WEAKNESS.id);
- this.addEffect(new MobEffect(MobEffectList.INCREASE_DAMAGE.id, i, Math.min(this.world.difficulty - 1, 0)));
+ this.m(MobEffectList.WEAKNESS.id);
+ this.addEffect(new MobEffect(MobEffectList.INCREASE_DAMAGE.id, i, Math.min(this.world.difficulty.a() - 1, 0)));
this.world.broadcastEntityEffect(this, (byte) 16);
}
protected boolean isTypeNotPersistent() {
- return !this.bV();
+ return !this.ca();
}
- public boolean bV() {
+ public boolean ca() {
return this.getDataWatcher().getByte(14) == 1;
}
- protected void bW() {
+ protected void cb() {
EntityVillager entityvillager = new EntityVillager(this.world);
entityvillager.j(this);
entityvillager.a((GroupDataEntity) null);
- entityvillager.bX();
+ entityvillager.cb();
if (this.isBaby()) {
entityvillager.setAge(-24000);
}
@@ -400,7 +443,7 @@ public class EntityZombie extends EntityMonster {
this.world.a((EntityHuman) null, 1017, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
- protected int bX() {
+ protected int cc() {
int i = 1;
if (this.random.nextFloat() < 0.01F) {
@@ -409,9 +452,9 @@ public class EntityZombie extends EntityMonster {
for (int k = (int) this.locX - 4; k < (int) this.locX + 4 && j < 14; ++k) {
for (int l = (int) this.locY - 4; l < (int) this.locY + 4 && j < 14; ++l) {
for (int i1 = (int) this.locZ - 4; i1 < (int) this.locZ + 4 && j < 14; ++i1) {
- int j1 = this.world.getTypeId(k, l, i1);
+ Block block = this.world.getType(k, l, i1);
- if (j1 == Block.IRON_FENCE.id || j1 == Block.BED.id) {
+ if (block == Blocks.IRON_FENCE || block == Blocks.BED) {
if (this.random.nextFloat() < 0.3F) {
++i;
}
@@ -425,4 +468,22 @@ public class EntityZombie extends EntityMonster {
return i;
}
+
+ public void k(boolean flag) {
+ this.a(flag ? 0.5F : 1.0F);
+ }
+
+ protected final void a(float f, float f1) {
+ boolean flag = this.bv > 0.0F && this.bw > 0.0F;
+
+ this.bv = f;
+ this.bw = f1;
+ if (!flag) {
+ this.a(1.0F);
+ }
+ }
+
+ protected final void a(float f) {
+ super.a(this.bv * f, this.bw * f);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index 758d447b4c..39e5b5bee7 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -81,16 +81,15 @@ public class Explosion {
int l = MathHelper.floor(d0);
int i1 = MathHelper.floor(d1);
int j1 = MathHelper.floor(d2);
- int k1 = this.world.getTypeId(l, i1, j1);
+ Block block = this.world.getType(l, i1, j1);
- if (k1 > 0) {
- Block block = Block.byId[k1];
+ if (block.getMaterial() != Material.AIR) {
float f3 = this.source != null ? this.source.a(this, this.world, l, i1, j1, block) : block.a(this.source);
f1 -= (f3 + 0.3F) * f2;
}
- if (f1 > 0.0F && (this.source == null || this.source.a(this, this.world, l, i1, j1, k1, f1)) && i1 < 256 && i1 >= 0) { // CraftBukkit - don't wrap explosions
+ if (f1 > 0.0F && (this.source == null || this.source.a(this, this.world, l, i1, j1, block, f1)) && i1 < 256 && i1 >= 0) { // CraftBukkit - don't wrap explosions
hashset.add(new ChunkPosition(l, i1, j1));
}
@@ -108,14 +107,14 @@ public class Explosion {
i = MathHelper.floor(this.posX - (double) this.size - 1.0D);
j = MathHelper.floor(this.posX + (double) this.size + 1.0D);
k = MathHelper.floor(this.posY - (double) this.size - 1.0D);
- 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.a().a((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2));
+ int k1 = MathHelper.floor(this.posY + (double) this.size + 1.0D);
+ int l1 = MathHelper.floor(this.posZ - (double) this.size - 1.0D);
+ int i2 = MathHelper.floor(this.posZ + (double) this.size + 1.0D);
+ List list = this.world.getEntities(this.source, AxisAlignedBB.a().a((double) i, (double) k, (double) l1, (double) j, (double) k1, (double) i2));
Vec3D vec3d = this.world.getVec3DPool().create(this.posX, this.posY, this.posZ);
- for (int k2 = 0; k2 < list.size(); ++k2) {
- Entity entity = (Entity) list.get(k2);
+ for (int j2 = 0; j2 < list.size(); ++j2) {
+ Entity entity = (Entity) list.get(j2);
double d7 = entity.f(this.posX, this.posY, this.posZ) / (double) this.size;
if (d7 <= 1.0D) {
@@ -199,7 +198,7 @@ public class Explosion {
int i;
int j;
int k;
- int l;
+ Block block;
if (this.b) {
// CraftBukkit start
@@ -210,9 +209,9 @@ public class Explosion {
List blockList = new ArrayList();
for (int i1 = this.blocks.size() - 1; i1 >= 0; i1--) {
ChunkPosition cpos = (ChunkPosition) this.blocks.get(i1);
- org.bukkit.block.Block block = bworld.getBlockAt(cpos.x, cpos.y, cpos.z);
- if (block.getType() != org.bukkit.Material.AIR) {
- blockList.add(block);
+ org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.x, cpos.y, cpos.z);
+ if (bblock.getType() != org.bukkit.Material.AIR) {
+ blockList.add(bblock);
}
}
@@ -221,8 +220,8 @@ public class Explosion {
this.blocks.clear();
- for (org.bukkit.block.Block block : event.blockList()) {
- ChunkPosition coords = new ChunkPosition(block.getX(), block.getY(), block.getZ());
+ for (org.bukkit.block.Block bblock : event.blockList()) {
+ ChunkPosition coords = new ChunkPosition(bblock.getX(), bblock.getY(), bblock.getZ());
blocks.add(coords);
}
@@ -239,7 +238,7 @@ public class Explosion {
i = chunkposition.x;
j = chunkposition.y;
k = chunkposition.z;
- l = this.world.getTypeId(i, j, k);
+ block = this.world.getType(i, j, k);
if (flag) {
double d0 = (double) ((float) i + this.world.random.nextFloat());
double d1 = (double) ((float) j + this.world.random.nextFloat());
@@ -262,15 +261,13 @@ public class Explosion {
this.world.addParticle("smoke", d0, d1, d2, d3, d4, d5);
}
- if (l > 0) {
- Block block = Block.byId[l];
-
+ if (block.getMaterial() != Material.AIR) {
if (block.a(this)) {
// CraftBukkit - add yield
block.dropNaturally(this.world, i, j, k, this.world.getData(i, j, k), event.getYield(), 0);
}
- this.world.setTypeIdAndData(i, j, k, 0, 0, 3);
+ this.world.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
block.wasExploded(this.world, i, j, k, this);
}
}
@@ -284,13 +281,13 @@ public class Explosion {
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);
+ block = this.world.getType(i, j, k);
+ Block block1 = this.world.getType(i, j - 1, k);
- if (l == 0 && Block.t[i1] && this.j.nextInt(3) == 0) {
+ if (block.getMaterial() == Material.AIR && block1.j() && this.j.nextInt(3) == 0) {
// CraftBukkit start - Ignition by explosion
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
- this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ this.world.setTypeUpdate(i, j, k, Blocks.FIRE);
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index bda2efb121..39c41b8789 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -1,7 +1,5 @@
package net.minecraft.server;
-import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit
-
public class FoodMetaData {
// CraftBukkit start - All made public
@@ -9,29 +7,47 @@ public class FoodMetaData {
public float saturationLevel = 5.0F;
public float exhaustionLevel;
public int foodTickTimer;
+ private EntityHuman entityhuman;
// CraftBukkit end
private int e = 20;
- public FoodMetaData() {}
+ public FoodMetaData() { throw new AssertionError("Whoopsie, we missed the bukkit."); } // CraftBukkit start - throw an error
+
+ // CraftBukkit start - added EntityHuman constructor
+ public FoodMetaData(EntityHuman entityhuman) {
+ org.apache.commons.lang.Validate.notNull(entityhuman);
+ this.entityhuman = entityhuman;
+ }
+ // CraftBukkit end
public void eat(int i, float f) {
this.foodLevel = Math.min(i + this.foodLevel, 20);
this.saturationLevel = Math.min(this.saturationLevel + (float) i * f * 2.0F, (float) this.foodLevel);
}
- public void a(ItemFood itemfood) {
- this.eat(itemfood.getNutrition(), itemfood.getSaturationModifier());
+ public void a(ItemFood itemfood, ItemStack itemstack) {
+ // CraftBukkit start
+ int oldFoodLevel = foodLevel;
+
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, itemfood.getNutrition(itemstack) + oldFoodLevel);
+
+ if (!event.isCancelled()) {
+ this.eat(event.getFoodLevel() - oldFoodLevel, itemfood.getSaturationModifier(itemstack));
+ }
+
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
+ // CraftBukkit end
}
public void a(EntityHuman entityhuman) {
- int i = entityhuman.world.difficulty;
+ EnumDifficulty enumdifficulty = entityhuman.world.difficulty;
this.e = this.foodLevel;
if (this.exhaustionLevel > 4.0F) {
this.exhaustionLevel -= 4.0F;
if (this.saturationLevel > 0.0F) {
this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F);
- } else if (i > 0) {
+ } else if (enumdifficulty != EnumDifficulty.PEACEFUL) {
// CraftBukkit start
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, Math.max(this.foodLevel - 1, 0));
@@ -39,22 +55,23 @@ public class FoodMetaData {
this.foodLevel = event.getFoodLevel();
}
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet8UpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), this.foodLevel, this.saturationLevel));
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), this.foodLevel, this.saturationLevel));
// CraftBukkit end
}
}
- if (entityhuman.world.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && entityhuman.bJ()) {
+ if (entityhuman.world.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && entityhuman.bP()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason
entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
+ this.a(3.0F);
this.foodTickTimer = 0;
}
} else if (this.foodLevel <= 0) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
- if (entityhuman.getHealth() > 10.0F || i >= 3 || entityhuman.getHealth() > 1.0F && i >= 2) {
+ if (entityhuman.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || entityhuman.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) {
entityhuman.damageEntity(DamageSource.STARVE, 1.0F);
}
@@ -66,7 +83,7 @@ public class FoodMetaData {
}
public void a(NBTTagCompound nbttagcompound) {
- if (nbttagcompound.hasKey("foodLevel")) {
+ if (nbttagcompound.hasKeyOfType("foodLevel", 99)) {
this.foodLevel = nbttagcompound.getInt("foodLevel");
this.foodTickTimer = nbttagcompound.getInt("foodTickTimer");
this.saturationLevel = nbttagcompound.getFloat("foodSaturationLevel");
diff --git a/src/main/java/net/minecraft/server/GroupDataZombie.java b/src/main/java/net/minecraft/server/GroupDataZombie.java
index 50f579f6ac..340af90fce 100644
--- a/src/main/java/net/minecraft/server/GroupDataZombie.java
+++ b/src/main/java/net/minecraft/server/GroupDataZombie.java
@@ -5,7 +5,6 @@ class GroupDataZombie implements GroupDataEntity {
public boolean a;
public boolean b;
-
final EntityZombie c;
private GroupDataZombie(EntityZombie entityzombie, boolean flag, boolean flag1) {
@@ -16,7 +15,7 @@ class GroupDataZombie implements GroupDataEntity {
this.b = flag1;
}
- GroupDataZombie(EntityZombie entityzombie, boolean flag, boolean flag1, EmptyClass4 emptyclass4) {
+ GroupDataZombie(EntityZombie entityzombie, boolean flag, boolean flag1, EmptyClassZombie emptyclasszombie) {
this(entityzombie, flag, flag1);
}
}
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
new file mode 100644
index 0000000000..b7f67758ff
--- /dev/null
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -0,0 +1,54 @@
+package net.minecraft.server;
+
+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
+
+public class HandshakeListener implements PacketHandshakingInListener {
+
+ private final MinecraftServer a;
+ private final NetworkManager b;
+
+ public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
+ this.a = minecraftserver;
+ this.b = networkmanager;
+ }
+
+ public void a(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) {
+ switch (ProtocolOrdinalWrapper.a[packethandshakinginsetprotocol.c().ordinal()]) {
+ case 1:
+ this.b.a(EnumProtocol.LOGIN);
+ ChatComponentText chatcomponenttext;
+
+ if (packethandshakinginsetprotocol.d() > 4) {
+ chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.7.2");
+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
+ this.b.a((IChatBaseComponent) chatcomponenttext);
+ } else if (packethandshakinginsetprotocol.d() < 4) {
+ chatcomponenttext = new ChatComponentText("Outdated client! Please use 1.7.2");
+ this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
+ this.b.a((IChatBaseComponent) chatcomponenttext);
+ } else {
+ this.b.a((PacketListener) (new LoginListener(this.a, this.b)));
+ ((LoginListener) this.b.getPacketListener()).hostname = packethandshakinginsetprotocol.b + ":" + packethandshakinginsetprotocol.c; // CraftBukkit - set hostname
+ }
+ break;
+
+ case 2:
+ this.b.a(EnumProtocol.STATUS);
+ this.b.a((PacketListener) (new PacketStatusListener(this.a, this.b)));
+ break;
+
+ default:
+ throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.c());
+ }
+ }
+
+ public void a(IChatBaseComponent ichatbasecomponent) {}
+
+ public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) {
+ if (enumprotocol1 != EnumProtocol.LOGIN && enumprotocol1 != EnumProtocol.STATUS) {
+ throw new UnsupportedOperationException("Invalid state " + enumprotocol1);
+ }
+ }
+
+ public void a() {}
+}
diff --git a/src/main/java/net/minecraft/server/IDataManager.java b/src/main/java/net/minecraft/server/IDataManager.java
index 5580893ceb..e5d578dfd6 100644
--- a/src/main/java/net/minecraft/server/IDataManager.java
+++ b/src/main/java/net/minecraft/server/IDataManager.java
@@ -18,6 +18,8 @@ public interface IDataManager {
void a();
+ File getDirectory();
+
File getDataFile(String s);
String g();
diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java
index c77ce9971b..56dc14b6f0 100644
--- a/src/main/java/net/minecraft/server/IInventory.java
+++ b/src/main/java/net/minecraft/server/IInventory.java
@@ -14,9 +14,9 @@ public interface IInventory {
void setItem(int i, ItemStack itemstack);
- String getName();
+ String getInventoryName();
- boolean c();
+ boolean k_();
int getMaxStackSize();
@@ -26,7 +26,7 @@ public interface IInventory {
void startOpen();
- void g();
+ void l_();
boolean b(int i, ItemStack itemstack);
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java
index 9e254d8dda..1c8f328ec3 100644
--- a/src/main/java/net/minecraft/server/InventoryCraftResult.java
+++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java
@@ -42,11 +42,11 @@ public class InventoryCraftResult implements IInventory {
return this.items[0];
}
- public String getName() {
+ public String getInventoryName() {
return "Result";
}
- public boolean c() {
+ public boolean k_() {
return false;
}
@@ -88,7 +88,7 @@ public class InventoryCraftResult implements IInventory {
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java
index 6e8ea2f8a8..30d22c61ef 100644
--- a/src/main/java/net/minecraft/server/InventoryCrafting.java
+++ b/src/main/java/net/minecraft/server/InventoryCrafting.java
@@ -82,11 +82,11 @@ public class InventoryCrafting implements IInventory {
}
}
- public String getName() {
+ public String getInventoryName() {
return "container.crafting";
}
- public boolean c() {
+ public boolean k_() {
return false;
}
@@ -141,7 +141,7 @@ public class InventoryCrafting implements IInventory {
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
index 221f97656f..ecaf354cfc 100644
--- a/src/main/java/net/minecraft/server/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -60,7 +60,7 @@ public class InventoryEnderChest extends InventorySubcontainer {
}
for (i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound = nbttaglist.get(i);
int j = nbttagcompound.getByte("Slot") & 255;
if (j >= 0 && j < this.getSize()) {
@@ -70,7 +70,7 @@ public class InventoryEnderChest extends InventorySubcontainer {
}
public NBTTagList h() {
- NBTTagList nbttaglist = new NBTTagList("EnderItems");
+ NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.getSize(); ++i) {
ItemStack itemstack = this.getItem(i);
@@ -99,16 +99,12 @@ public class InventoryEnderChest extends InventorySubcontainer {
super.startOpen();
}
- public void g() {
+ public void l_() {
if (this.a != null) {
this.a.b();
}
- super.g();
+ super.l_();
this.a = null;
}
-
- public boolean b(int i, ItemStack itemstack) {
- return true;
- }
}
diff --git a/src/main/java/net/minecraft/server/InventoryHorseChest.java b/src/main/java/net/minecraft/server/InventoryHorseChest.java
index d3a5ebe4e9..54a9a7d708 100644
--- a/src/main/java/net/minecraft/server/InventoryHorseChest.java
+++ b/src/main/java/net/minecraft/server/InventoryHorseChest.java
@@ -57,4 +57,4 @@ public class InventoryHorseChest extends InventorySubcontainer {
return maxStack;
}
// CraftBukkit end
-}
\ No newline at end of file
+}
diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java
index 3eee4b8f8d..575d59fbf0 100644
--- a/src/main/java/net/minecraft/server/InventoryLargeChest.java
+++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java
@@ -72,12 +72,12 @@ public class InventoryLargeChest implements IInventory {
return this.left == iinventory || this.right == iinventory;
}
- public String getName() {
- return this.left.c() ? this.left.getName() : (this.right.c() ? this.right.getName() : this.a);
+ public String getInventoryName() {
+ return this.left.k_() ? this.left.getInventoryName() : (this.right.k_() ? this.right.getInventoryName() : this.a);
}
- public boolean c() {
- return this.left.c() || this.right.c();
+ public boolean k_() {
+ return this.left.k_() || this.right.k_();
}
public ItemStack getItem(int i) {
@@ -118,9 +118,9 @@ public class InventoryLargeChest implements IInventory {
this.right.startOpen();
}
- public void g() {
- this.left.g();
- this.right.g();
+ public void l_() {
+ this.left.l_();
+ this.right.l_();
}
public boolean b(int i, ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/InventoryMerchant.java b/src/main/java/net/minecraft/server/InventoryMerchant.java
index 9ab8fdc52d..37eb8faedd 100644
--- a/src/main/java/net/minecraft/server/InventoryMerchant.java
+++ b/src/main/java/net/minecraft/server/InventoryMerchant.java
@@ -115,11 +115,11 @@ public class InventoryMerchant implements IInventory {
}
}
- public String getName() {
+ public String getInventoryName() {
return "mob.villager";
}
- public boolean c() {
+ public boolean k_() {
return false;
}
@@ -128,12 +128,12 @@ public class InventoryMerchant implements IInventory {
}
public boolean a(EntityHuman entityhuman) {
- return this.merchant.m_() == entityhuman;
+ return this.merchant.b() == entityhuman;
}
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
diff --git a/src/main/java/net/minecraft/server/InventorySubcontainer.java b/src/main/java/net/minecraft/server/InventorySubcontainer.java
index 825d5ac958..e2d16fca29 100644
--- a/src/main/java/net/minecraft/server/InventorySubcontainer.java
+++ b/src/main/java/net/minecraft/server/InventorySubcontainer.java
@@ -81,11 +81,11 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
return this.b;
}
- public String getName() {
+ public String getInventoryName() {
return this.a;
}
- public boolean c() {
+ public boolean k_() {
return this.e;
}
@@ -112,7 +112,7 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
diff --git a/src/main/java/net/minecraft/server/Item.java b/src/main/java/net/minecraft/server/Item.java
new file mode 100644
index 0000000000..351436c85f
--- /dev/null
+++ b/src/main/java/net/minecraft/server/Item.java
@@ -0,0 +1,503 @@
+package net.minecraft.server;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.UUID;
+
+import net.minecraft.util.com.google.common.collect.HashMultimap;
+import net.minecraft.util.com.google.common.collect.Multimap;
+import net.minecraft.util.com.google.common.collect.Sets;
+
+public class Item {
+
+ public static final RegistryMaterials REGISTRY = new RegistryMaterials();
+ protected static final UUID f = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
+ private CreativeModeTab a;
+ protected static Random g = new Random();
+ protected int maxStackSize = 64;
+ private int durability;
+ protected boolean i;
+ protected boolean j;
+ private Item craftingResult;
+ private String d;
+ private String name;
+ protected String l;
+
+ public Item() {}
+
+ public static int b(Item item) {
+ return item == null ? 0 : REGISTRY.b(item);
+ }
+
+ public static Item d(int i) {
+ return (Item) REGISTRY.a(i);
+ }
+
+ public static Item getItemOf(Block block) {
+ return d(Block.b(block));
+ }
+
+ public static void l() {
+ REGISTRY.a(256, "iron_shovel", (new ItemSpade(EnumToolMaterial.IRON)).c("shovelIron").f("iron_shovel"));
+ REGISTRY.a(257, "iron_pickaxe", (new ItemPickaxe(EnumToolMaterial.IRON)).c("pickaxeIron").f("iron_pickaxe"));
+ REGISTRY.a(258, "iron_axe", (new ItemAxe(EnumToolMaterial.IRON)).c("hatchetIron").f("iron_axe"));
+ REGISTRY.a(259, "flint_and_steel", (new ItemFlintAndSteel()).c("flintAndSteel").f("flint_and_steel"));
+ REGISTRY.a(260, "apple", (new ItemFood(4, 0.3F, false)).c("apple").f("apple"));
+ REGISTRY.a(261, "bow", (new ItemBow()).c("bow").f("bow"));
+ REGISTRY.a(262, "arrow", (new Item()).c("arrow").a(CreativeModeTab.j).f("arrow"));
+ REGISTRY.a(263, "coal", (new ItemCoal()).c("coal").f("coal"));
+ REGISTRY.a(264, "diamond", (new Item()).c("diamond").a(CreativeModeTab.l).f("diamond"));
+ REGISTRY.a(265, "iron_ingot", (new Item()).c("ingotIron").a(CreativeModeTab.l).f("iron_ingot"));
+ REGISTRY.a(266, "gold_ingot", (new Item()).c("ingotGold").a(CreativeModeTab.l).f("gold_ingot"));
+ REGISTRY.a(267, "iron_sword", (new ItemSword(EnumToolMaterial.IRON)).c("swordIron").f("iron_sword"));
+ REGISTRY.a(268, "wooden_sword", (new ItemSword(EnumToolMaterial.WOOD)).c("swordWood").f("wood_sword"));
+ REGISTRY.a(269, "wooden_shovel", (new ItemSpade(EnumToolMaterial.WOOD)).c("shovelWood").f("wood_shovel"));
+ REGISTRY.a(270, "wooden_pickaxe", (new ItemPickaxe(EnumToolMaterial.WOOD)).c("pickaxeWood").f("wood_pickaxe"));
+ REGISTRY.a(271, "wooden_axe", (new ItemAxe(EnumToolMaterial.WOOD)).c("hatchetWood").f("wood_axe"));
+ REGISTRY.a(272, "stone_sword", (new ItemSword(EnumToolMaterial.STONE)).c("swordStone").f("stone_sword"));
+ REGISTRY.a(273, "stone_shovel", (new ItemSpade(EnumToolMaterial.STONE)).c("shovelStone").f("stone_shovel"));
+ REGISTRY.a(274, "stone_pickaxe", (new ItemPickaxe(EnumToolMaterial.STONE)).c("pickaxeStone").f("stone_pickaxe"));
+ REGISTRY.a(275, "stone_axe", (new ItemAxe(EnumToolMaterial.STONE)).c("hatchetStone").f("stone_axe"));
+ REGISTRY.a(276, "diamond_sword", (new ItemSword(EnumToolMaterial.DIAMOND)).c("swordDiamond").f("diamond_sword"));
+ REGISTRY.a(277, "diamond_shovel", (new ItemSpade(EnumToolMaterial.DIAMOND)).c("shovelDiamond").f("diamond_shovel"));
+ REGISTRY.a(278, "diamond_pickaxe", (new ItemPickaxe(EnumToolMaterial.DIAMOND)).c("pickaxeDiamond").f("diamond_pickaxe"));
+ REGISTRY.a(279, "diamond_axe", (new ItemAxe(EnumToolMaterial.DIAMOND)).c("hatchetDiamond").f("diamond_axe"));
+ REGISTRY.a(280, "stick", (new Item()).q().c("stick").a(CreativeModeTab.l).f("stick"));
+ REGISTRY.a(281, "bowl", (new Item()).c("bowl").a(CreativeModeTab.l).f("bowl"));
+ REGISTRY.a(282, "mushroom_stew", (new ItemSoup(6)).c("mushroomStew").f("mushroom_stew"));
+ REGISTRY.a(283, "golden_sword", (new ItemSword(EnumToolMaterial.GOLD)).c("swordGold").f("gold_sword"));
+ REGISTRY.a(284, "golden_shovel", (new ItemSpade(EnumToolMaterial.GOLD)).c("shovelGold").f("gold_shovel"));
+ REGISTRY.a(285, "golden_pickaxe", (new ItemPickaxe(EnumToolMaterial.GOLD)).c("pickaxeGold").f("gold_pickaxe"));
+ REGISTRY.a(286, "golden_axe", (new ItemAxe(EnumToolMaterial.GOLD)).c("hatchetGold").f("gold_axe"));
+ REGISTRY.a(287, "string", (new ItemReed(Blocks.TRIPWIRE)).c("string").a(CreativeModeTab.l).f("string"));
+ REGISTRY.a(288, "feather", (new Item()).c("feather").a(CreativeModeTab.l).f("feather"));
+ REGISTRY.a(289, "gunpowder", (new Item()).c("sulphur").e(PotionBrewer.k).a(CreativeModeTab.l).f("gunpowder"));
+ REGISTRY.a(290, "wooden_hoe", (new ItemHoe(EnumToolMaterial.WOOD)).c("hoeWood").f("wood_hoe"));
+ REGISTRY.a(291, "stone_hoe", (new ItemHoe(EnumToolMaterial.STONE)).c("hoeStone").f("stone_hoe"));
+ REGISTRY.a(292, "iron_hoe", (new ItemHoe(EnumToolMaterial.IRON)).c("hoeIron").f("iron_hoe"));
+ REGISTRY.a(293, "diamond_hoe", (new ItemHoe(EnumToolMaterial.DIAMOND)).c("hoeDiamond").f("diamond_hoe"));
+ REGISTRY.a(294, "golden_hoe", (new ItemHoe(EnumToolMaterial.GOLD)).c("hoeGold").f("gold_hoe"));
+ REGISTRY.a(295, "wheat_seeds", (new ItemSeeds(Blocks.CROPS, Blocks.SOIL)).c("seeds").f("seeds_wheat"));
+ REGISTRY.a(296, "wheat", (new Item()).c("wheat").a(CreativeModeTab.l).f("wheat"));
+ REGISTRY.a(297, "bread", (new ItemFood(5, 0.6F, false)).c("bread").f("bread"));
+ REGISTRY.a(298, "leather_helmet", (new ItemArmor(EnumArmorMaterial.CLOTH, 0, 0)).c("helmetCloth").f("leather_helmet"));
+ REGISTRY.a(299, "leather_chestplate", (new ItemArmor(EnumArmorMaterial.CLOTH, 0, 1)).c("chestplateCloth").f("leather_chestplate"));
+ REGISTRY.a(300, "leather_leggings", (new ItemArmor(EnumArmorMaterial.CLOTH, 0, 2)).c("leggingsCloth").f("leather_leggings"));
+ REGISTRY.a(301, "leather_boots", (new ItemArmor(EnumArmorMaterial.CLOTH, 0, 3)).c("bootsCloth").f("leather_boots"));
+ REGISTRY.a(302, "chainmail_helmet", (new ItemArmor(EnumArmorMaterial.CHAIN, 1, 0)).c("helmetChain").f("chainmail_helmet"));
+ REGISTRY.a(303, "chainmail_chestplate", (new ItemArmor(EnumArmorMaterial.CHAIN, 1, 1)).c("chestplateChain").f("chainmail_chestplate"));
+ REGISTRY.a(304, "chainmail_leggings", (new ItemArmor(EnumArmorMaterial.CHAIN, 1, 2)).c("leggingsChain").f("chainmail_leggings"));
+ REGISTRY.a(305, "chainmail_boots", (new ItemArmor(EnumArmorMaterial.CHAIN, 1, 3)).c("bootsChain").f("chainmail_boots"));
+ REGISTRY.a(306, "iron_helmet", (new ItemArmor(EnumArmorMaterial.IRON, 2, 0)).c("helmetIron").f("iron_helmet"));
+ REGISTRY.a(307, "iron_chestplate", (new ItemArmor(EnumArmorMaterial.IRON, 2, 1)).c("chestplateIron").f("iron_chestplate"));
+ REGISTRY.a(308, "iron_leggings", (new ItemArmor(EnumArmorMaterial.IRON, 2, 2)).c("leggingsIron").f("iron_leggings"));
+ REGISTRY.a(309, "iron_boots", (new ItemArmor(EnumArmorMaterial.IRON, 2, 3)).c("bootsIron").f("iron_boots"));
+ REGISTRY.a(310, "diamond_helmet", (new ItemArmor(EnumArmorMaterial.DIAMOND, 3, 0)).c("helmetDiamond").f("diamond_helmet"));
+ REGISTRY.a(311, "diamond_chestplate", (new ItemArmor(EnumArmorMaterial.DIAMOND, 3, 1)).c("chestplateDiamond").f("diamond_chestplate"));
+ REGISTRY.a(312, "diamond_leggings", (new ItemArmor(EnumArmorMaterial.DIAMOND, 3, 2)).c("leggingsDiamond").f("diamond_leggings"));
+ REGISTRY.a(313, "diamond_boots", (new ItemArmor(EnumArmorMaterial.DIAMOND, 3, 3)).c("bootsDiamond").f("diamond_boots"));
+ REGISTRY.a(314, "golden_helmet", (new ItemArmor(EnumArmorMaterial.GOLD, 4, 0)).c("helmetGold").f("gold_helmet"));
+ REGISTRY.a(315, "golden_chestplate", (new ItemArmor(EnumArmorMaterial.GOLD, 4, 1)).c("chestplateGold").f("gold_chestplate"));
+ REGISTRY.a(316, "golden_leggings", (new ItemArmor(EnumArmorMaterial.GOLD, 4, 2)).c("leggingsGold").f("gold_leggings"));
+ REGISTRY.a(317, "golden_boots", (new ItemArmor(EnumArmorMaterial.GOLD, 4, 3)).c("bootsGold").f("gold_boots"));
+ REGISTRY.a(318, "flint", (new Item()).c("flint").a(CreativeModeTab.l).f("flint"));
+ REGISTRY.a(319, "porkchop", (new ItemFood(3, 0.3F, true)).c("porkchopRaw").f("porkchop_raw"));
+ REGISTRY.a(320, "cooked_porkchop", (new ItemFood(8, 0.8F, true)).c("porkchopCooked").f("porkchop_cooked"));
+ REGISTRY.a(321, "painting", (new ItemHanging(EntityPainting.class)).c("painting").f("painting"));
+ REGISTRY.a(322, "golden_apple", (new ItemGoldenApple(4, 1.2F, false)).j().a(MobEffectList.REGENERATION.id, 5, 1, 1.0F).c("appleGold").f("apple_golden"));
+ REGISTRY.a(323, "sign", (new ItemSign()).c("sign").f("sign"));
+ REGISTRY.a(324, "wooden_door", (new ItemDoor(Material.WOOD)).c("doorWood").f("door_wood"));
+ Item item = (new ItemBucket(Blocks.AIR)).c("bucket").e(16).f("bucket_empty");
+
+ REGISTRY.a(325, "bucket", item);
+ REGISTRY.a(326, "water_bucket", (new ItemBucket(Blocks.WATER)).c("bucketWater").c(item).f("bucket_water"));
+ REGISTRY.a(327, "lava_bucket", (new ItemBucket(Blocks.LAVA)).c("bucketLava").c(item).f("bucket_lava"));
+ REGISTRY.a(328, "minecart", (new ItemMinecart(0)).c("minecart").f("minecart_normal"));
+ REGISTRY.a(329, "saddle", (new ItemSaddle()).c("saddle").f("saddle"));
+ REGISTRY.a(330, "iron_door", (new ItemDoor(Material.ORE)).c("doorIron").f("door_iron"));
+ REGISTRY.a(331, "redstone", (new ItemRedstone()).c("redstone").e(PotionBrewer.i).f("redstone_dust"));
+ REGISTRY.a(332, "snowball", (new ItemSnowball()).c("snowball").f("snowball"));
+ REGISTRY.a(333, "boat", (new ItemBoat()).c("boat").f("boat"));
+ REGISTRY.a(334, "leather", (new Item()).c("leather").a(CreativeModeTab.l).f("leather"));
+ REGISTRY.a(335, "milk_bucket", (new ItemMilkBucket()).c("milk").c(item).f("bucket_milk"));
+ REGISTRY.a(336, "brick", (new Item()).c("brick").a(CreativeModeTab.l).f("brick"));
+ REGISTRY.a(337, "clay_ball", (new Item()).c("clay").a(CreativeModeTab.l).f("clay_ball"));
+ REGISTRY.a(338, "reeds", (new ItemReed(Blocks.SUGAR_CANE_BLOCK)).c("reeds").a(CreativeModeTab.l).f("reeds"));
+ REGISTRY.a(339, "paper", (new Item()).c("paper").a(CreativeModeTab.f).f("paper"));
+ REGISTRY.a(340, "book", (new ItemBook()).c("book").a(CreativeModeTab.f).f("book_normal"));
+ REGISTRY.a(341, "slime_ball", (new Item()).c("slimeball").a(CreativeModeTab.f).f("slimeball"));
+ REGISTRY.a(342, "chest_minecart", (new ItemMinecart(1)).c("minecartChest").f("minecart_chest"));
+ REGISTRY.a(343, "furnace_minecart", (new ItemMinecart(2)).c("minecartFurnace").f("minecart_furnace"));
+ REGISTRY.a(344, "egg", (new ItemEgg()).c("egg").f("egg"));
+ REGISTRY.a(345, "compass", (new Item()).c("compass").a(CreativeModeTab.i).f("compass"));
+ REGISTRY.a(346, "fishing_rod", (new ItemFishingRod()).c("fishingRod").f("fishing_rod"));
+ REGISTRY.a(347, "clock", (new Item()).c("clock").a(CreativeModeTab.i).f("clock"));
+ REGISTRY.a(348, "glowstone_dust", (new Item()).c("yellowDust").e(PotionBrewer.j).a(CreativeModeTab.l).f("glowstone_dust"));
+ REGISTRY.a(349, "fish", (new ItemFish(false)).c("fish").f("fish_raw").a(true));
+ REGISTRY.a(350, "cooked_fished", (new ItemFish(true)).c("fish").f("fish_cooked").a(true));
+ REGISTRY.a(351, "dye", (new ItemDye()).c("dyePowder").f("dye_powder"));
+ REGISTRY.a(352, "bone", (new Item()).c("bone").q().a(CreativeModeTab.f).f("bone"));
+ REGISTRY.a(353, "sugar", (new Item()).c("sugar").e(PotionBrewer.b).a(CreativeModeTab.l).f("sugar"));
+ REGISTRY.a(354, "cake", (new ItemReed(Blocks.CAKE_BLOCK)).e(1).c("cake").a(CreativeModeTab.h).f("cake"));
+ REGISTRY.a(355, "bed", (new ItemBed()).e(1).c("bed").f("bed"));
+ REGISTRY.a(356, "repeater", (new ItemReed(Blocks.DIODE_OFF)).c("diode").a(CreativeModeTab.d).f("repeater"));
+ REGISTRY.a(357, "cookie", (new ItemFood(2, 0.1F, false)).c("cookie").f("cookie"));
+ REGISTRY.a(358, "filled_map", (new ItemWorldMap()).c("map").f("map_filled"));
+ REGISTRY.a(359, "shears", (new ItemShears()).c("shears").f("shears"));
+ REGISTRY.a(360, "melon", (new ItemFood(2, 0.3F, false)).c("melon").f("melon"));
+ REGISTRY.a(361, "pumpkin_seeds", (new ItemSeeds(Blocks.PUMPKIN_STEM, Blocks.SOIL)).c("seeds_pumpkin").f("seeds_pumpkin"));
+ REGISTRY.a(362, "melon_seeds", (new ItemSeeds(Blocks.MELON_STEM, Blocks.SOIL)).c("seeds_melon").f("seeds_melon"));
+ REGISTRY.a(363, "beef", (new ItemFood(3, 0.3F, true)).c("beefRaw").f("beef_raw"));
+ REGISTRY.a(364, "cooked_beef", (new ItemFood(8, 0.8F, true)).c("beefCooked").f("beef_cooked"));
+ REGISTRY.a(365, "chicken", (new ItemFood(2, 0.3F, true)).a(MobEffectList.HUNGER.id, 30, 0, 0.3F).c("chickenRaw").f("chicken_raw"));
+ REGISTRY.a(366, "cooked_chicken", (new ItemFood(6, 0.6F, true)).c("chickenCooked").f("chicken_cooked"));
+ REGISTRY.a(367, "rotten_flesh", (new ItemFood(4, 0.1F, true)).a(MobEffectList.HUNGER.id, 30, 0, 0.8F).c("rottenFlesh").f("rotten_flesh"));
+ REGISTRY.a(368, "ender_pearl", (new ItemEnderPearl()).c("enderPearl").f("ender_pearl"));
+ REGISTRY.a(369, "blaze_rod", (new Item()).c("blazeRod").a(CreativeModeTab.l).f("blaze_rod"));
+ REGISTRY.a(370, "ghast_tear", (new Item()).c("ghastTear").e(PotionBrewer.c).a(CreativeModeTab.k).f("ghast_tear"));
+ REGISTRY.a(371, "gold_nugget", (new Item()).c("goldNugget").a(CreativeModeTab.l).f("gold_nugget"));
+ REGISTRY.a(372, "nether_wart", (new ItemSeeds(Blocks.NETHER_WART, Blocks.SOUL_SAND)).c("netherStalkSeeds").e("+4").f("nether_wart"));
+ REGISTRY.a(373, "potion", (new ItemPotion()).c("potion").f("potion"));
+ REGISTRY.a(374, "glass_bottle", (new ItemGlassBottle()).c("glassBottle").f("potion_bottle_empty"));
+ REGISTRY.a(375, "spider_eye", (new ItemFood(2, 0.8F, false)).a(MobEffectList.POISON.id, 5, 0, 1.0F).c("spiderEye").e(PotionBrewer.d).f("spider_eye"));
+ REGISTRY.a(376, "fermented_spider_eye", (new Item()).c("fermentedSpiderEye").e(PotionBrewer.e).a(CreativeModeTab.k).f("spider_eye_fermented"));
+ REGISTRY.a(377, "blaze_powder", (new Item()).c("blazePowder").e(PotionBrewer.g).a(CreativeModeTab.k).f("blaze_powder"));
+ REGISTRY.a(378, "magma_cream", (new Item()).c("magmaCream").e(PotionBrewer.h).a(CreativeModeTab.k).f("magma_cream"));
+ REGISTRY.a(379, "brewing_stand", (new ItemReed(Blocks.BREWING_STAND)).c("brewingStand").a(CreativeModeTab.k).f("brewing_stand"));
+ REGISTRY.a(380, "cauldron", (new ItemReed(Blocks.CAULDRON)).c("cauldron").a(CreativeModeTab.k).f("cauldron"));
+ REGISTRY.a(381, "ender_eye", (new ItemEnderEye()).c("eyeOfEnder").f("ender_eye"));
+ REGISTRY.a(382, "speckled_melon", (new Item()).c("speckledMelon").e(PotionBrewer.f).a(CreativeModeTab.k).f("melon_speckled"));
+ REGISTRY.a(383, "spawn_egg", (new ItemMonsterEgg()).c("monsterPlacer").f("spawn_egg"));
+ REGISTRY.a(384, "experience_bottle", (new ItemExpBottle()).c("expBottle").f("experience_bottle"));
+ REGISTRY.a(385, "fire_charge", (new ItemFireball()).c("fireball").f("fireball"));
+ REGISTRY.a(386, "writable_book", (new ItemBookAndQuill()).c("writingBook").a(CreativeModeTab.f).f("book_writable"));
+ REGISTRY.a(387, "written_book", (new ItemWrittenBook()).c("writtenBook").f("book_written").e(16));
+ REGISTRY.a(388, "emerald", (new Item()).c("emerald").a(CreativeModeTab.l).f("emerald"));
+ REGISTRY.a(389, "item_frame", (new ItemHanging(EntityItemFrame.class)).c("frame").f("item_frame"));
+ REGISTRY.a(390, "flower_pot", (new ItemReed(Blocks.FLOWER_POT)).c("flowerPot").a(CreativeModeTab.c).f("flower_pot"));
+ REGISTRY.a(391, "carrot", (new ItemSeedFood(4, 0.6F, Blocks.CARROTS, Blocks.SOIL)).c("carrots").f("carrot"));
+ REGISTRY.a(392, "potato", (new ItemSeedFood(1, 0.3F, Blocks.POTATOES, Blocks.SOIL)).c("potato").f("potato"));
+ REGISTRY.a(393, "baked_potato", (new ItemFood(6, 0.6F, false)).c("potatoBaked").f("potato_baked"));
+ REGISTRY.a(394, "poisonous_potato", (new ItemFood(2, 0.3F, false)).a(MobEffectList.POISON.id, 5, 0, 0.6F).c("potatoPoisonous").f("potato_poisonous"));
+ REGISTRY.a(395, "map", (new ItemMapEmpty()).c("emptyMap").f("map_empty"));
+ REGISTRY.a(396, "golden_carrot", (new ItemFood(6, 1.2F, false)).c("carrotGolden").e(PotionBrewer.l).f("carrot_golden"));
+ REGISTRY.a(397, "skull", (new ItemSkull()).c("skull").f("skull"));
+ REGISTRY.a(398, "carrot_on_a_stick", (new ItemCarrotStick()).c("carrotOnAStick").f("carrot_on_a_stick"));
+ REGISTRY.a(399, "nether_star", (new ItemNetherStar()).c("netherStar").a(CreativeModeTab.l).f("nether_star"));
+ REGISTRY.a(400, "pumpkin_pie", (new ItemFood(8, 0.3F, false)).c("pumpkinPie").a(CreativeModeTab.h).f("pumpkin_pie"));
+ REGISTRY.a(401, "fireworks", (new ItemFireworks()).c("fireworks").f("fireworks"));
+ REGISTRY.a(402, "firework_charge", (new ItemFireworksCharge()).c("fireworksCharge").a(CreativeModeTab.f).f("fireworks_charge"));
+ REGISTRY.a(403, "enchanted_book", (new ItemEnchantedBook()).e(1).c("enchantedBook").f("book_enchanted"));
+ REGISTRY.a(404, "comparator", (new ItemReed(Blocks.REDSTONE_COMPARATOR_OFF)).c("comparator").a(CreativeModeTab.d).f("comparator"));
+ REGISTRY.a(405, "netherbrick", (new Item()).c("netherbrick").a(CreativeModeTab.l).f("netherbrick"));
+ REGISTRY.a(406, "quartz", (new Item()).c("netherquartz").a(CreativeModeTab.l).f("quartz"));
+ REGISTRY.a(407, "tnt_minecart", (new ItemMinecart(3)).c("minecartTnt").f("minecart_tnt"));
+ REGISTRY.a(408, "hopper_minecart", (new ItemMinecart(5)).c("minecartHopper").f("minecart_hopper"));
+ REGISTRY.a(417, "iron_horse_armor", (new Item()).c("horsearmormetal").e(1).a(CreativeModeTab.f).f("iron_horse_armor"));
+ REGISTRY.a(418, "golden_horse_armor", (new Item()).c("horsearmorgold").e(1).a(CreativeModeTab.f).f("gold_horse_armor"));
+ REGISTRY.a(419, "diamond_horse_armor", (new Item()).c("horsearmordiamond").e(1).a(CreativeModeTab.f).f("diamond_horse_armor"));
+ REGISTRY.a(420, "lead", (new ItemLeash()).c("leash").f("lead"));
+ REGISTRY.a(421, "name_tag", (new ItemNameTag()).c("nameTag").f("name_tag"));
+ REGISTRY.a(422, "command_block_minecart", (new ItemMinecart(6)).c("minecartCommandBlock").f("minecart_command_block").a((CreativeModeTab) null));
+ REGISTRY.a(2256, "record_13", (new ItemRecord("13")).c("record").f("record_13"));
+ REGISTRY.a(2257, "record_cat", (new ItemRecord("cat")).c("record").f("record_cat"));
+ REGISTRY.a(2258, "record_blocks", (new ItemRecord("blocks")).c("record").f("record_blocks"));
+ REGISTRY.a(2259, "record_chirp", (new ItemRecord("chirp")).c("record").f("record_chirp"));
+ REGISTRY.a(2260, "record_far", (new ItemRecord("far")).c("record").f("record_far"));
+ REGISTRY.a(2261, "record_mall", (new ItemRecord("mall")).c("record").f("record_mall"));
+ REGISTRY.a(2262, "record_mellohi", (new ItemRecord("mellohi")).c("record").f("record_mellohi"));
+ REGISTRY.a(2263, "record_stal", (new ItemRecord("stal")).c("record").f("record_stal"));
+ REGISTRY.a(2264, "record_strad", (new ItemRecord("strad")).c("record").f("record_strad"));
+ REGISTRY.a(2265, "record_ward", (new ItemRecord("ward")).c("record").f("record_ward"));
+ REGISTRY.a(2266, "record_11", (new ItemRecord("11")).c("record").f("record_11"));
+ REGISTRY.a(2267, "record_wait", (new ItemRecord("wait")).c("record").f("record_wait"));
+ HashSet hashset = Sets.newHashSet(new Block[] { Blocks.AIR, Blocks.BREWING_STAND, Blocks.BED, Blocks.NETHER_WART, Blocks.CAULDRON, Blocks.FLOWER_POT, Blocks.CROPS, Blocks.SUGAR_CANE_BLOCK, Blocks.CAKE_BLOCK, Blocks.SKULL, Blocks.PISTON_EXTENSION, Blocks.PISTON_MOVING, Blocks.GLOWING_REDSTONE_ORE, Blocks.DIODE_ON, Blocks.PUMPKIN_STEM, Blocks.SIGN_POST, Blocks.REDSTONE_COMPARATOR_ON, Blocks.TRIPWIRE, Blocks.REDSTONE_LAMP_ON, Blocks.MELON_STEM, Blocks.REDSTONE_TORCH_OFF, Blocks.REDSTONE_COMPARATOR_OFF, Blocks.REDSTONE_WIRE, Blocks.WALL_SIGN, Blocks.DIODE_OFF, Blocks.IRON_DOOR_BLOCK, Blocks.WOODEN_DOOR});
+ Iterator iterator = Block.REGISTRY.b().iterator();
+
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
+ Block block = (Block) Block.REGISTRY.a(s);
+ Object object;
+
+ if (block == Blocks.WOOL) {
+ object = (new ItemCloth(Blocks.WOOL)).b("cloth");
+ } else if (block == Blocks.STAINED_HARDENED_CLAY) {
+ object = (new ItemCloth(Blocks.STAINED_HARDENED_CLAY)).b("clayHardenedStained");
+ } else if (block == Blocks.STAINED_GLASS) {
+ object = (new ItemCloth(Blocks.STAINED_GLASS)).b("stainedGlass");
+ } else if (block == Blocks.STAINED_GLASS_PANE) {
+ object = (new ItemCloth(Blocks.STAINED_GLASS_PANE)).b("stainedGlassPane");
+ } else if (block == Blocks.WOOL_CARPET) {
+ object = (new ItemCloth(Blocks.WOOL_CARPET)).b("woolCarpet");
+ } else if (block == Blocks.DIRT) {
+ object = (new ItemMultiTexture(Blocks.DIRT, Blocks.DIRT, BlockDirt.a)).b("dirt");
+ } else if (block == Blocks.SAND) {
+ object = (new ItemMultiTexture(Blocks.SAND, Blocks.SAND, BlockSand.a)).b("sand");
+ } else if (block == Blocks.LOG) {
+ object = (new ItemMultiTexture(Blocks.LOG, Blocks.LOG, BlockLog1.M)).b("log");
+ } else if (block == Blocks.LOG2) {
+ object = (new ItemMultiTexture(Blocks.LOG2, Blocks.LOG2, BlockLog2.M)).b("log");
+ } else if (block == Blocks.WOOD) {
+ object = (new ItemMultiTexture(Blocks.WOOD, Blocks.WOOD, BlockWood.a)).b("wood");
+ } else if (block == Blocks.MONSTER_EGGS) {
+ object = (new ItemMultiTexture(Blocks.MONSTER_EGGS, Blocks.MONSTER_EGGS, BlockMonsterEggs.a)).b("monsterStoneEgg");
+ } else if (block == Blocks.SMOOTH_BRICK) {
+ object = (new ItemMultiTexture(Blocks.SMOOTH_BRICK, Blocks.SMOOTH_BRICK, BlockSmoothBrick.a)).b("stonebricksmooth");
+ } else if (block == Blocks.SANDSTONE) {
+ object = (new ItemMultiTexture(Blocks.SANDSTONE, Blocks.SANDSTONE, BlockSandStone.a)).b("sandStone");
+ } else if (block == Blocks.QUARTZ_BLOCK) {
+ object = (new ItemMultiTexture(Blocks.QUARTZ_BLOCK, Blocks.QUARTZ_BLOCK, BlockQuartz.a)).b("quartzBlock");
+ } else if (block == Blocks.STEP) {
+ object = (new ItemStep(Blocks.STEP, Blocks.STEP, Blocks.DOUBLE_STEP, false)).b("stoneSlab");
+ } else if (block == Blocks.DOUBLE_STEP) {
+ object = (new ItemStep(Blocks.DOUBLE_STEP, Blocks.STEP, Blocks.DOUBLE_STEP, true)).b("stoneSlab");
+ } else if (block == Blocks.WOOD_STEP) {
+ object = (new ItemStep(Blocks.WOOD_STEP, Blocks.WOOD_STEP, Blocks.WOOD_DOUBLE_STEP, false)).b("woodSlab");
+ } else if (block == Blocks.WOOD_DOUBLE_STEP) {
+ object = (new ItemStep(Blocks.WOOD_DOUBLE_STEP, Blocks.WOOD_STEP, Blocks.WOOD_DOUBLE_STEP, true)).b("woodSlab");
+ } else if (block == Blocks.SAPLING) {
+ object = (new ItemMultiTexture(Blocks.SAPLING, Blocks.SAPLING, BlockSapling.a)).b("sapling");
+ } else if (block == Blocks.LEAVES) {
+ object = (new ItemLeaves(Blocks.LEAVES)).b("leaves");
+ } else if (block == Blocks.LEAVES2) {
+ object = (new ItemLeaves(Blocks.LEAVES2)).b("leaves");
+ } else if (block == Blocks.VINE) {
+ object = new ItemWithAuxData(Blocks.VINE, false);
+ } else if (block == Blocks.LONG_GRASS) {
+ object = (new ItemWithAuxData(Blocks.LONG_GRASS, true)).a(new String[] { "shrub", "grass", "fern"});
+ } else if (block == Blocks.YELLOW_FLOWER) {
+ object = (new ItemMultiTexture(Blocks.YELLOW_FLOWER, Blocks.YELLOW_FLOWER, BlockFlowers.b)).b("flower");
+ } else if (block == Blocks.RED_ROSE) {
+ object = (new ItemMultiTexture(Blocks.RED_ROSE, Blocks.RED_ROSE, BlockFlowers.a)).b("rose");
+ } else if (block == Blocks.SNOW) {
+ object = new ItemSnow(Blocks.SNOW, Blocks.SNOW);
+ } else if (block == Blocks.WATER_LILY) {
+ object = new ItemWaterLily(Blocks.WATER_LILY);
+ } else if (block == Blocks.PISTON) {
+ object = new ItemPiston(Blocks.PISTON);
+ } else if (block == Blocks.PISTON_STICKY) {
+ object = new ItemPiston(Blocks.PISTON_STICKY);
+ } else if (block == Blocks.COBBLE_WALL) {
+ object = (new ItemMultiTexture(Blocks.COBBLE_WALL, Blocks.COBBLE_WALL, BlockCobbleWall.a)).b("cobbleWall");
+ } else if (block == Blocks.ANVIL) {
+ object = (new ItemAnvil(Blocks.ANVIL)).b("anvil");
+ } else if (block == Blocks.DOUBLE_PLANT) {
+ object = (new ItemTallPlant(Blocks.DOUBLE_PLANT, Blocks.DOUBLE_PLANT, BlockTallPlant.a)).b("doublePlant");
+ // CraftBukkit start - allow certain blocks to retain data
+ } else if (block == Blocks.MOB_SPAWNER || block == Blocks.BIG_MUSHROOM_1 || block == Blocks.BIG_MUSHROOM_2) {
+ object = new ItemWithAuxData(block, true);
+ // CraftBukkit end
+ } else {
+ if (hashset.contains(block)) {
+ continue;
+ }
+
+ object = new ItemBlock(block);
+ }
+
+ REGISTRY.a(Block.b(block), s, object);
+ }
+ }
+
+ public Item e(int i) {
+ this.maxStackSize = i;
+ return this;
+ }
+
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ return false;
+ }
+
+ public float getDestroySpeed(ItemStack itemstack, Block block) {
+ return 1.0F;
+ }
+
+ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
+ return itemstack;
+ }
+
+ public ItemStack b(ItemStack itemstack, World world, EntityHuman entityhuman) {
+ return itemstack;
+ }
+
+ public int getMaxStackSize() {
+ return this.maxStackSize;
+ }
+
+ public int filterData(int i) {
+ return 0;
+ }
+
+ public boolean n() {
+ return this.j;
+ }
+
+ protected Item a(boolean flag) {
+ this.j = flag;
+ return this;
+ }
+
+ public int getMaxDurability() {
+ return this.durability;
+ }
+
+ protected Item setMaxDurability(int i) {
+ this.durability = i;
+ return this;
+ }
+
+ public boolean usesDurability() {
+ return this.durability > 0 && !this.j;
+ }
+
+ public boolean a(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1) {
+ return false;
+ }
+
+ public boolean a(ItemStack itemstack, World world, Block block, int i, int j, int k, EntityLiving entityliving) {
+ return false;
+ }
+
+ public boolean canDestroySpecialBlock(Block block) {
+ return false;
+ }
+
+ public boolean a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving) {
+ return false;
+ }
+
+ public Item q() {
+ this.i = true;
+ return this;
+ }
+
+ public Item c(String s) {
+ this.name = s;
+ return this;
+ }
+
+ public String k(ItemStack itemstack) {
+ String s = this.a(itemstack);
+
+ return s == null ? "" : LocaleI18n.get(s);
+ }
+
+ public String getName() {
+ return "item." + this.name;
+ }
+
+ public String a(ItemStack itemstack) {
+ return "item." + this.name;
+ }
+
+ public Item c(Item item) {
+ this.craftingResult = item;
+ return this;
+ }
+
+ public boolean l(ItemStack itemstack) {
+ return true;
+ }
+
+ public boolean s() {
+ return true;
+ }
+
+ public Item t() {
+ return this.craftingResult;
+ }
+
+ public boolean u() {
+ return this.craftingResult != null;
+ }
+
+ public void a(ItemStack itemstack, World world, Entity entity, int i, boolean flag) {}
+
+ public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {}
+
+ public boolean h() {
+ return false;
+ }
+
+ public EnumAnimation d(ItemStack itemstack) {
+ return EnumAnimation.NONE;
+ }
+
+ public int d_(ItemStack itemstack) {
+ return 0;
+ }
+
+ public void a(ItemStack itemstack, World world, EntityHuman entityhuman, int i) {}
+
+ protected Item e(String s) {
+ this.d = s;
+ return this;
+ }
+
+ public String i(ItemStack itemstack) {
+ return this.d;
+ }
+
+ public boolean m(ItemStack itemstack) {
+ return this.i(itemstack) != null;
+ }
+
+ public String n(ItemStack itemstack) {
+ return ("" + LocaleI18n.get(this.k(itemstack) + ".name")).trim();
+ }
+
+ public EnumItemRarity f(ItemStack itemstack) {
+ return itemstack.hasEnchantments() ? EnumItemRarity.RARE : EnumItemRarity.COMMON;
+ }
+
+ public boolean e_(ItemStack itemstack) {
+ return this.getMaxStackSize() == 1 && this.usesDurability();
+ }
+
+ protected MovingObjectPosition a(World world, EntityHuman entityhuman, boolean flag) {
+ float f = 1.0F;
+ float f1 = entityhuman.lastPitch + (entityhuman.pitch - entityhuman.lastPitch) * f;
+ float f2 = entityhuman.lastYaw + (entityhuman.yaw - entityhuman.lastYaw) * f;
+ 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 = world.getVec3DPool().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);
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
+ float f7 = f4 * f5;
+ float f8 = f3 * f5;
+ double d3 = 5.0D;
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
+
+ return world.rayTrace(vec3d, vec3d1, flag, !flag, false);
+ }
+
+ public int c() {
+ return 0;
+ }
+
+ public Item a(CreativeModeTab creativemodetab) {
+ this.a = creativemodetab;
+ return this;
+ }
+
+ public boolean v() {
+ return true;
+ }
+
+ public boolean a(ItemStack itemstack, ItemStack itemstack1) {
+ return false;
+ }
+
+ public Multimap k() {
+ return HashMultimap.create();
+ }
+
+ protected Item f(String s) {
+ this.l = s;
+ return this;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ItemBed.java b/src/main/java/net/minecraft/server/ItemBed.java
index f72133d6e0..7e63b182c4 100644
--- a/src/main/java/net/minecraft/server/ItemBed.java
+++ b/src/main/java/net/minecraft/server/ItemBed.java
@@ -2,8 +2,7 @@ package net.minecraft.server;
public class ItemBed extends Item {
- public ItemBed(int i) {
- super(i);
+ public ItemBed() {
this.a(CreativeModeTab.c);
}
@@ -15,7 +14,7 @@ public class ItemBed extends Item {
return false;
} else {
++j;
- BlockBed blockbed = (BlockBed) Block.BED;
+ BlockBed blockbed = (BlockBed) Blocks.BED;
int i1 = MathHelper.floor((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3;
byte b0 = 0;
byte b1 = 0;
@@ -37,16 +36,16 @@ public class ItemBed extends Item {
}
if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i + b0, j, k + b1, l, itemstack)) {
- if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.w(i, j - 1, k) && world.w(i + b0, j - 1, k + b1)) {
+ if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && World.a((IBlockAccess) world, i, j - 1, k) && World.a((IBlockAccess) world, i + b0, j - 1, k + b1)) {
// CraftBukkit start
- // world.setTypeIdAndData(i, j, k, blockbed.id, i1, 3);
- if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, blockbed.id, i1, clickedX, clickedY, clickedZ)) {
+ // world.setTypeAndData(i, j, k, blockbed, i1, 3);
+ if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, blockbed, i1, clickedX, clickedY, clickedZ)) {
return false;
}
// CraftBukkit end
- if (world.getTypeId(i, j, k) == blockbed.id) {
- world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8, 3);
+ if (world.getType(i, j, k) == blockbed) {
+ world.setTypeAndData(i + b0, j, k + b1, blockbed, i1 + 8, 3);
}
--itemstack.count;
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index adfa43df56..0449461d59 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -2,24 +2,24 @@ package net.minecraft.server;
public class ItemBlock extends Item {
- private int id;
+ protected final Block block;
- public ItemBlock(int i) {
- super(i);
- this.id = i + 256;
+ public ItemBlock(Block block) {
+ this.block = block;
}
- public int g() {
- return this.id;
+ public ItemBlock b(String s) {
+ super.c(s);
+ return this;
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
- int i1 = world.getTypeId(i, j, k);
+ Block block = world.getType(i, j, k);
- if (i1 == Block.SNOW.id && (world.getData(i, j, k) & 7) < 1) {
+ if (block == Blocks.SNOW && (world.getData(i, j, k) & 7) < 1) {
l = 1;
- } else if (i1 != Block.VINE.id && i1 != Block.LONG_GRASS.id && i1 != Block.DEAD_BUSH.id) {
+ } else if (block != Blocks.VINE && block != Blocks.LONG_GRASS && block != Blocks.DEAD_BUSH) {
if (l == 0) {
--j;
}
@@ -49,28 +49,27 @@ public class ItemBlock extends Item {
return false;
} else if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
- } else if (j == 255 && Block.byId[this.id].material.isBuildable()) {
+ } else if (j == 255 && this.block.getMaterial().isBuildable()) {
return false;
- } else if (world.mayPlace(this.id, i, j, k, false, l, entityhuman, itemstack)) {
- Block block = Block.byId[this.id];
- int j1 = this.filterData(itemstack.getData());
- int k1 = Block.byId[this.id].getPlacedData(world, i, j, k, l, f, f1, f2, j1);
+ } else if (world.mayPlace(this.block, i, j, k, false, l, entityhuman, itemstack)) {
+ int i1 = this.filterData(itemstack.getData());
+ int j1 = this.block.getPlacedData(world, i, j, k, l, f, f1, f2, i1);
// CraftBukkit start - Redirect to common function handler
/*
- if (world.setTypeIdAndData(i, j, k, this.id, k1, 3)) {
- if (world.getTypeId(i, j, k) == this.id) {
- Block.byId[this.id].postPlace(world, i, j, k, entityhuman, itemstack);
- Block.byId[this.id].postPlace(world, i, j, k, k1);
+ if (world.setTypeAndData(i, j, k, this.block, j1, 3)) {
+ if (world.getType(i, j, k) == this.block) {
+ this.block.postPlace(world, i, j, k, entityhuman, itemstack);
+ this.block.postPlace(world, i, j, k, j1);
}
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume1() + 1.0F) / 2.0F, this.block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
return true;
*/
- return processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, k1, clickedX, clickedY, clickedZ);
+ return processBlockPlace(world, entityhuman, itemstack, i, j, k, this.block, j1, clickedX, clickedY, clickedZ);
// CraftBukkit end
} else {
return false;
@@ -78,13 +77,13 @@ public class ItemBlock extends Item {
}
// CraftBukkit start - Add method to process block placement
- static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data, final int clickedX, final int clickedY, final int clickedZ) {
+ static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final Block id, final int data, final int clickedX, final int clickedY, final int clickedZ) {
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);
world.callingPlaceEvent = true;
// Sign is now 3 not 2.
- int flag = (id == Block.SIGN_POST.id || id == Block.WALL_SIGN.id) ? 3 : 2;
- world.setTypeIdAndData(x, y, z, id, data, flag);
+ int flag = (id == Blocks.SIGN_POST || id == Blocks.WALL_SIGN) ? 3 : 2;
+ world.setTypeAndData(x, y, z, id, data, flag);
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, clickedX, clickedY, clickedZ);
if (event.isCancelled() || !event.canBuild()) {
@@ -95,18 +94,17 @@ public class ItemBlock extends Item {
world.callingPlaceEvent = false;
- int newId = world.getTypeId(x, y, z);
+ Block block = world.getType(x, y, z);
int newData = world.getData(x, y, z);
- Block block = Block.byId[newId];
if (block != null && !(block instanceof BlockContainer)) { // Containers get placed automatically
block.onPlace(world, x, y, z);
}
- world.update(x, y, z, newId);
+ world.update(x, y, z, block);
// Skulls don't get block data applied to them
- if (block != null && block != Block.SKULL) {
+ if (block != null && block != Blocks.SKULL) {
block.postPlace(world, x, y, z, entityhuman, itemstack);
block.postPlace(world, x, y, z, newData);
@@ -121,11 +119,15 @@ public class ItemBlock extends Item {
}
// CraftBukkit end
- public String d(ItemStack itemstack) {
- return Block.byId[this.id].a();
+ public String a(ItemStack itemstack) {
+ return this.block.a();
}
public String getName() {
- return Block.byId[this.id].a();
+ return this.block.a();
+ }
+
+ public Item c(String s) {
+ return this.b(s);
}
}
diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java
index fbb7ba1fad..30310e2c9e 100644
--- a/src/main/java/net/minecraft/server/ItemBoat.java
+++ b/src/main/java/net/minecraft/server/ItemBoat.java
@@ -4,8 +4,7 @@ import java.util.List;
public class ItemBoat extends Item {
- public ItemBoat(int i) {
- super(i);
+ public ItemBoat() {
this.maxStackSize = 1;
this.a(CreativeModeTab.e);
}
@@ -41,8 +40,8 @@ public class ItemBoat extends Item {
for (i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
- if (entity.L()) {
- float f10 = entity.Z();
+ if (entity.R()) {
+ float f10 = entity.af();
AxisAlignedBB axisalignedbb = entity.boundingBox.grow((double) f10, (double) f10, (double) f10);
if (axisalignedbb.a(vec3d)) {
@@ -54,7 +53,7 @@ public class ItemBoat extends Item {
if (flag) {
return itemstack;
} else {
- if (movingobjectposition.type == EnumMovingObjectType.TILE) {
+ if (movingobjectposition.type == EnumMovingObjectType.BLOCK) {
i = movingobjectposition.b;
int j = movingobjectposition.c;
int k = movingobjectposition.d;
@@ -67,7 +66,7 @@ public class ItemBoat extends Item {
}
// CraftBukkit end
- if (world.getTypeId(i, j, k) == Block.SNOW.id) {
+ if (world.getType(i, j, k) == Blocks.SNOW) {
--j;
}
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
index 7b0bb5100b..59d543ca20 100644
--- a/src/main/java/net/minecraft/server/ItemBow.java
+++ b/src/main/java/net/minecraft/server/ItemBow.java
@@ -4,8 +4,7 @@ public class ItemBow extends Item {
public static final String[] a = new String[] { "pulling_0", "pulling_1", "pulling_2"};
- public ItemBow(int i) {
- super(i);
+ public ItemBow() {
this.maxStackSize = 1;
this.setMaxDurability(384);
this.a(CreativeModeTab.j);
@@ -14,7 +13,7 @@ public class ItemBow extends Item {
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.e(Item.ARROW.id)) {
+ if (flag || entityhuman.inventory.b(Items.ARROW)) {
int j = this.d_(itemstack) - i;
float f = (float) j / 20.0F;
@@ -36,7 +35,7 @@ public class ItemBow extends Item {
int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack);
if (k > 0) {
- entityarrow.b(entityarrow.c() + (double) k * 0.5D + 0.5D);
+ entityarrow.b(entityarrow.e() + (double) k * 0.5D + 0.5D);
}
int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack);
@@ -62,13 +61,16 @@ public class ItemBow extends Item {
// CraftBukkit end
itemstack.damage(1, entityhuman);
- world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (Item.f.nextFloat() * 0.4F + 1.2F) + f * 0.5F); // CraftBukkit - Fix compilation
+ world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (g.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (flag) {
entityarrow.fromPlayer = 2;
} else {
- entityhuman.inventory.d(Item.ARROW.id);
+ entityhuman.inventory.a(Items.ARROW);
+ }
+
+ if (!world.isStatic) {
+ // world.addEntity(entityarrow); // CraftBukkit - moved up
}
- // CraftBukkit - moved addEntity up
}
}
@@ -80,12 +82,12 @@ public class ItemBow extends Item {
return 72000;
}
- public EnumAnimation c_(ItemStack itemstack) {
+ public EnumAnimation d(ItemStack itemstack) {
return EnumAnimation.BOW;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.e(Item.ARROW.id)) {
+ if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.b(Items.ARROW)) {
entityhuman.a(itemstack, this.d_(itemstack));
}
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index b0440dd895..a58d4e73c1 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java
+++ b/src/main/java/net/minecraft/server/ItemBucket.java
@@ -9,23 +9,22 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
public class ItemBucket extends Item {
- private int a;
+ private Block a;
- public ItemBucket(int i, int j) {
- super(i);
+ public ItemBucket(Block block) {
this.maxStackSize = 1;
- this.a = j;
+ this.a = block;
this.a(CreativeModeTab.f);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- boolean flag = this.a == 0;
+ boolean flag = this.a == Blocks.AIR;
MovingObjectPosition movingobjectposition = this.a(world, entityhuman, flag);
if (movingobjectposition == null) {
return itemstack;
} else {
- if (movingobjectposition.type == EnumMovingObjectType.TILE) {
+ if (movingobjectposition.type == EnumMovingObjectType.BLOCK) {
int i = movingobjectposition.b;
int j = movingobjectposition.c;
int k = movingobjectposition.d;
@@ -34,62 +33,39 @@ public class ItemBucket extends Item {
return itemstack;
}
- if (this.a == 0) {
+ if (flag) {
if (!entityhuman.a(i, j, k, movingobjectposition.face, itemstack)) {
return itemstack;
}
- if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0) {
+ Material material = world.getType(i, j, k).getMaterial();
+ int l = world.getData(i, j, k);
+
+ if (material == Material.WATER && l == 0) {
// CraftBukkit start
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, i, j, k, -1, itemstack, Item.WATER_BUCKET);
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, i, j, k, -1, itemstack, Items.WATER_BUCKET);
if (event.isCancelled()) {
return itemstack;
}
// CraftBukkit end
world.setAir(i, j, k);
- if (entityhuman.abilities.canInstantlyBuild) {
- return itemstack;
- }
-
- ItemStack result = CraftItemStack.asNMSCopy(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.asNMSCopy(event.getItemStack())); // CraftBukkit
- }
-
- return itemstack;
+ return this.a(itemstack, entityhuman, Items.WATER_BUCKET, event.getItemStack()); // CraftBukkit - added Event stack
}
- if (world.getMaterial(i, j, k) == Material.LAVA && world.getData(i, j, k) == 0) {
+ if (material == Material.LAVA && l == 0) {
// CraftBukkit start
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, i, j, k, -1, itemstack, Item.LAVA_BUCKET);
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, i, j, k, -1, itemstack, Items.LAVA_BUCKET);
if (event.isCancelled()) {
return itemstack;
}
// CraftBukkit end
world.setAir(i, j, k);
- if (entityhuman.abilities.canInstantlyBuild) {
- return itemstack;
- }
-
- ItemStack result = CraftItemStack.asNMSCopy(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.asNMSCopy(event.getItemStack())); // CraftBukkit
- }
-
- return itemstack;
+ return this.a(itemstack, entityhuman, Items.LAVA_BUCKET, event.getItemStack()); // CraftBukkit - added Event stack
}
} else {
- if (this.a < 0) {
+ if (this.a == Blocks.AIR) {
// CraftBukkit start
PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, i, j, k, movingobjectposition.face, itemstack);
@@ -149,17 +125,32 @@ public class ItemBucket extends Item {
}
}
+ // CraftBukkit - added ob.ItemStack result - TODO: Is this... the right way to handle this?
+ private ItemStack a(ItemStack itemstack, EntityHuman entityhuman, Item item, org.bukkit.inventory.ItemStack result) {
+ if (entityhuman.abilities.canInstantlyBuild) {
+ return itemstack;
+ } else if (--itemstack.count <= 0) {
+ return CraftItemStack.asNMSCopy(result); // CraftBukkit
+ } else {
+ if (!entityhuman.inventory.pickup(CraftItemStack.asNMSCopy(result))) { // CraftBukkit
+ entityhuman.drop(CraftItemStack.asNMSCopy(result), false); // CraftBukkit
+ }
+
+ return itemstack;
+ }
+ }
+
public boolean a(World world, int i, int j, int k) {
- if (this.a <= 0) {
+ if (this.a == Blocks.AIR) {
return false;
} else {
- Material material = world.getMaterial(i, j, k);
+ Material material = world.getType(i, j, k).getMaterial();
boolean flag = !material.isBuildable();
if (!world.isEmpty(i, j, k) && !flag) {
return false;
} else {
- if (world.worldProvider.f && this.a == Block.WATER.id) {
+ if (world.worldProvider.f && this.a == Blocks.WATER) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {
@@ -170,7 +161,7 @@ public class ItemBucket extends Item {
world.setAir(i, j, k, true);
}
- world.setTypeIdAndData(i, j, k, this.a, 0, 3);
+ world.setTypeAndData(i, j, k, this.a, 0, 3);
}
return true;
diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java
index 708fcf8ef6..29dc1330b0 100644
--- a/src/main/java/net/minecraft/server/ItemDoor.java
+++ b/src/main/java/net/minecraft/server/ItemDoor.java
@@ -4,8 +4,7 @@ public class ItemDoor extends Item {
private Material a;
- public ItemDoor(int i, Material material) {
- super(i);
+ public ItemDoor(Material material) {
this.a = material;
this.maxStackSize = 1;
this.a(CreativeModeTab.d);
@@ -20,9 +19,9 @@ public class ItemDoor extends Item {
Block block;
if (this.a == Material.WOOD) {
- block = Block.WOODEN_DOOR;
+ block = Blocks.WOODEN_DOOR;
} else {
- block = Block.IRON_DOOR_BLOCK;
+ block = Blocks.IRON_DOOR_BLOCK;
}
if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i, j + 1, k, l, itemstack)) {
@@ -72,10 +71,10 @@ public class ItemDoor extends Item {
b0 = 1;
}
- int i1 = (world.u(i - b0, j, k - b1) ? 1 : 0) + (world.u(i - b0, j + 1, k - b1) ? 1 : 0);
- int j1 = (world.u(i + b0, j, k + b1) ? 1 : 0) + (world.u(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;
+ int i1 = (world.getType(i - b0, j, k - b1).r() ? 1 : 0) + (world.getType(i - b0, j + 1, k - b1).r() ? 1 : 0);
+ int j1 = (world.getType(i + b0, j, k + b1).r() ? 1 : 0) + (world.getType(i + b0, j + 1, k + b1).r() ? 1 : 0);
+ boolean flag = world.getType(i - b0, j, k - b1) == block || world.getType(i - b0, j + 1, k - b1) == block;
+ boolean flag1 = world.getType(i + b0, j, k + b1) == block || world.getType(i + b0, j + 1, k + b1) == block;
boolean flag2 = false;
if (flag && !flag1) {
@@ -86,22 +85,22 @@ public class ItemDoor extends Item {
// CraftBukkit start
if (entityhuman != null) {
- if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, l, clickedX, clickedY, clickedZ)) {
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet53BlockChange(i, j + 1, k, world));
+ if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block, l, clickedX, clickedY, clickedZ)) {
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j + 1, k, world));
return false;
}
- if (world.getTypeId(i, j, k) != block.id) {
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet53BlockChange(i, j + 1, k, world));
+ if (world.getType(i, j, k) != block) {
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j + 1, k, world));
return true;
}
} else {
- world.setTypeIdAndData(i, j, k, block.id, l, 2);
+ world.setTypeAndData(i, j, k, block, l, 2);
}
// CraftBukkit end
- world.setTypeIdAndData(i, j + 1, k, block.id, 8 | (flag2 ? 1 : 0), 2);
- world.applyPhysics(i, j, k, block.id);
- world.applyPhysics(i, j + 1, k, block.id);
+ world.setTypeAndData(i, j + 1, k, block, 8 | (flag2 ? 1 : 0), 2);
+ world.applyPhysics(i, j, k, block);
+ world.applyPhysics(i, j + 1, k, block);
return true; // CraftBukkit
}
}
diff --git a/src/main/java/net/minecraft/server/ItemDye.java b/src/main/java/net/minecraft/server/ItemDye.java
index 95b681da95..9dde66f76b 100644
--- a/src/main/java/net/minecraft/server/ItemDye.java
+++ b/src/main/java/net/minecraft/server/ItemDye.java
@@ -11,14 +11,13 @@ public class ItemDye extends Item {
public static final String[] b = new String[] { "black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "light_blue", "magenta", "orange", "white"};
public static final int[] c = new int[] { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
- public ItemDye(int i) {
- super(i);
+ public ItemDye() {
this.a(true);
this.setMaxDurability(0);
this.a(CreativeModeTab.l);
}
- public String d(ItemStack itemstack) {
+ public String a(ItemStack itemstack) {
int i = MathHelper.a(itemstack.getData(), 0, 15);
return super.getName() + "." + a[i];
@@ -37,10 +36,10 @@ public class ItemDye extends Item {
return true;
}
} else if (itemstack.getData() == 3) {
- int i1 = world.getTypeId(i, j, k);
- int j1 = world.getData(i, j, k);
+ Block block = world.getType(i, j, k);
+ int i1 = world.getData(i, j, k);
- if (i1 == Block.LOG.id && BlockLog.f(j1) == 3) {
+ if (block == Blocks.LOG && BlockLogAbstract.c(i1) == 3) {
if (l == 0) {
return false;
}
@@ -66,9 +65,9 @@ public class ItemDye extends Item {
}
if (world.isEmpty(i, j, k)) {
- int k1 = Block.byId[Block.COCOA.id].getPlacedData(world, i, j, k, l, f, f1, f2, 0);
+ int j1 = Blocks.COCOA.getPlacedData(world, i, j, k, l, f, f1, f2, 0);
- world.setTypeIdAndData(i, j, k, Block.COCOA.id, k1, 2);
+ world.setTypeAndData(i, j, k, Blocks.COCOA, j1, 2);
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -82,131 +81,49 @@ public class ItemDye extends Item {
}
}
- // CraftBukkit start
public static boolean a(ItemStack itemstack, World world, int i, int j, int k) {
+ // CraftBukkit start
return a(itemstack, world, i, j, k, null);
}
public static boolean a(ItemStack itemstack, World world, int i, int j, int k, EntityHuman entityhuman) {
// CraftBukkit end
- int l = world.getTypeId(i, j, k);
+ Block block = world.getType(i, j, k);
- if (l == Block.SAPLING.id) {
- if (!world.isStatic) {
- if ((double) world.random.nextFloat() < 0.45D) {
- // CraftBukkit start
- Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
- ((BlockSapling) Block.SAPLING).grow(world, i, j, k, world.random, true, player, null);
- // CraftBukkit end
- }
+ if (block instanceof IBlockFragilePlantElement) {
+ IBlockFragilePlantElement iblockfragileplantelement = (IBlockFragilePlantElement) block;
- --itemstack.count;
- }
-
- return true;
- } else if (l != Block.BROWN_MUSHROOM.id && l != Block.RED_MUSHROOM.id) {
- if (l != Block.MELON_STEM.id && l != Block.PUMPKIN_STEM.id) {
- if (l > 0 && Block.byId[l] instanceof BlockCrops) {
- if (world.getData(i, j, k) == 7) {
- return false;
- } else {
- if (!world.isStatic) {
- ((BlockCrops) Block.byId[l]).e_(world, i, j, k);
- --itemstack.count;
- }
-
- return true;
- }
- } else {
- int i1;
- int j1;
- int k1;
-
- if (l == Block.COCOA.id) {
- i1 = world.getData(i, j, k);
- j1 = BlockDirectional.j(i1);
- k1 = BlockCocoa.c(i1);
- if (k1 >= 2) {
- return false;
- } else {
- if (!world.isStatic) {
- ++k1;
- world.setData(i, j, k, k1 << 2 | j1, 2);
- --itemstack.count;
- }
-
- return true;
- }
- } else if (l != Block.GRASS.id) {
- return false;
- } else {
- if (!world.isStatic) {
- --itemstack.count;
-
- label102:
- for (i1 = 0; i1 < 128; ++i1) {
- j1 = i;
- k1 = j + 1;
- int l1 = k;
-
- for (int i2 = 0; i2 < i1 / 16; ++i2) {
- j1 += f.nextInt(3) - 1;
- k1 += (f.nextInt(3) - 1) * f.nextInt(3) / 2;
- l1 += f.nextInt(3) - 1;
- if (world.getTypeId(j1, k1 - 1, l1) != Block.GRASS.id || world.u(j1, k1, l1)) {
- continue label102;
- }
- }
-
- if (world.getTypeId(j1, k1, l1) == 0) {
- if (f.nextInt(10) != 0) {
- if (Block.LONG_GRASS.f(world, j1, k1, l1)) {
- world.setTypeIdAndData(j1, k1, l1, Block.LONG_GRASS.id, 1, 3);
- }
- } else if (f.nextInt(3) != 0) {
- if (Block.YELLOW_FLOWER.f(world, j1, k1, l1)) {
- world.setTypeIdUpdate(j1, k1, l1, Block.YELLOW_FLOWER.id);
- }
- } else if (Block.RED_ROSE.f(world, j1, k1, l1)) {
- world.setTypeIdUpdate(j1, k1, l1, Block.RED_ROSE.id);
- }
- }
- }
- }
-
- return true;
- }
- }
- } else if (world.getData(i, j, k) == 7) {
- return false;
- } else {
+ if (iblockfragileplantelement.a(world, i, j, k, world.isStatic)) {
if (!world.isStatic) {
- ((BlockStem) Block.byId[l]).k(world, i, j, k);
+ if (iblockfragileplantelement.a(world, world.random, i, j, k)) {
+ // CraftBukkit start - Special case BlockSapling and BlockMushroom to use our methods
+ if (block instanceof BlockSapling) {
+ Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
+ ((BlockSapling) block).grow(world, i, j, k, world.random, true, player, null);
+ } else if (block instanceof BlockMushroom) {
+ Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
+ ((BlockMushroom) block).grow(world, i, j, k, world.random, true, player, null);
+ } else {
+ iblockfragileplantelement.b(world, world.random, i, j, k);
+ }
+ // CraftBukkit end
+
+ }
+
--itemstack.count;
}
return true;
}
- } else {
- if (!world.isStatic) {
- if ((double) world.random.nextFloat() < 0.4D) {
- // CraftBukkit start - Validate
- Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
- ((BlockMushroom) Block.byId[l]).grow(world, i, j, k, world.random, true, player, itemstack);
- }
-
- //--itemstack.count; - called later if the bonemeal attempt was not cancelled by a plugin
- // CraftBukkit end
- }
-
- return true;
}
+
+ return false;
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving) {
if (entityliving instanceof EntitySheep) {
EntitySheep entitysheep = (EntitySheep) entityliving;
- int i = BlockCloth.j_(itemstack.getData());
+ int i = BlockCloth.b(itemstack.getData());
if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
// CraftBukkit start
@@ -220,7 +137,6 @@ public class ItemDye extends Item {
i = (byte) event.getColor().getWoolData();
// CraftBukkit end
-
entitysheep.setColor(i);
--itemstack.count;
}
diff --git a/src/main/java/net/minecraft/server/ItemFireball.java b/src/main/java/net/minecraft/server/ItemFireball.java
index 3145c94338..d7c795e415 100644
--- a/src/main/java/net/minecraft/server/ItemFireball.java
+++ b/src/main/java/net/minecraft/server/ItemFireball.java
@@ -2,8 +2,7 @@ package net.minecraft.server;
public class ItemFireball extends Item {
- public ItemFireball(int i) {
- super(i);
+ public ItemFireball() {
this.a(CreativeModeTab.f);
}
@@ -38,9 +37,7 @@ public class ItemFireball extends Item {
if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
} else {
- int i1 = world.getTypeId(i, j, k);
-
- if (i1 == 0) {
+ if (world.getType(i, j, k).getMaterial() == Material.AIR) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, entityhuman).isCancelled()) {
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -50,8 +47,8 @@ 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, Item.f.nextFloat() * 0.4F + 0.8F); // CraftBukkit - Fix compilation
- world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, g.nextFloat() * 0.4F + 0.8F);
+ world.setTypeUpdate(i, j, k, Blocks.FIRE);
}
if (!entityhuman.abilities.canInstantlyBuild) {
diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java
index 2ac49979b9..2f34151b2b 100644
--- a/src/main/java/net/minecraft/server/ItemFishingRod.java
+++ b/src/main/java/net/minecraft/server/ItemFishingRod.java
@@ -4,19 +4,18 @@ import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
public class ItemFishingRod extends Item {
- public ItemFishingRod(int i) {
- super(i);
+ public ItemFishingRod() {
this.setMaxDurability(64);
- this.d(1);
+ this.e(1);
this.a(CreativeModeTab.i);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.hookedFish != null) {
- int i = entityhuman.hookedFish.c();
+ int i = entityhuman.hookedFish.e();
itemstack.damage(i, entityhuman);
- entityhuman.aV();
+ entityhuman.ba();
} else {
// CraftBukkit start
EntityFishingHook hook = new EntityFishingHook(world, entityhuman);
@@ -27,14 +26,22 @@ public class ItemFishingRod extends Item {
return itemstack;
}
// CraftBukkit end
- world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (f.nextFloat() * 0.4F + 0.8F));
+ world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (g.nextFloat() * 0.4F + 0.8F));
if (!world.isStatic) {
world.addEntity(hook); // CraftBukkit - moved creation up
}
- entityhuman.aV();
+ entityhuman.ba();
}
return itemstack;
}
+
+ public boolean e_(ItemStack itemstack) {
+ return super.e_(itemstack);
+ }
+
+ public int c() {
+ return 1;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
index e2d0a141a8..ec2edea587 100644
--- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
@@ -7,8 +7,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
public class ItemFlintAndSteel extends Item {
- public ItemFlintAndSteel(int i) {
- super(i);
+ public ItemFlintAndSteel() {
this.maxStackSize = 1;
this.setMaxDurability(64);
this.a(CreativeModeTab.i);
@@ -16,7 +15,6 @@ public class ItemFlintAndSteel extends Item {
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
-
if (l == 0) {
--j;
}
@@ -44,9 +42,7 @@ public class ItemFlintAndSteel extends Item {
if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
} else {
- int i1 = world.getTypeId(i, j, k);
-
- if (i1 == 0) {
+ if (world.getType(i, j, k).getMaterial() == Material.AIR) {
// CraftBukkit start - Store the clicked block
if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
itemstack.damage(1, entityhuman);
@@ -56,8 +52,8 @@ 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, Item.f.nextFloat() * 0.4F + 0.8F); // CraftBukkit - fix compilation
- world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, g.nextFloat() * 0.4F + 0.8F);
+ world.setTypeUpdate(i, j, k, Blocks.FIRE);
// CraftBukkit start
org.bukkit.event.block.BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ);
diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java
deleted file mode 100644
index 78bbb59b58..0000000000
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package net.minecraft.server;
-
-public class ItemFood extends Item {
-
- public final int a;
- private final int b;
- private final float c;
- private final boolean d;
- private boolean cB;
- private int cC;
- private int cD;
- private int cE;
- private float cF;
-
- public ItemFood(int i, int j, float f, boolean flag) {
- super(i);
- this.a = 32;
- this.b = j;
- this.d = flag;
- this.c = f;
- this.a(CreativeModeTab.h);
- }
-
- public ItemFood(int i, int j, boolean flag) {
- this(i, j, 0.6F, flag);
- }
-
- public ItemStack b(ItemStack itemstack, World world, EntityHuman entityhuman) {
- --itemstack.count;
- // CraftBukkit start
- int oldFoodLevel = entityhuman.getFoodData().foodLevel;
-
- org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, this.getNutrition() + oldFoodLevel);
-
- if (!event.isCancelled()) {
- entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, this.getSaturationModifier());
- }
-
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet8UpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
- // CraftBukkit end
-
- world.makeSound(entityhuman, "random.burp", 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
- this.c(itemstack, world, entityhuman);
- return itemstack;
- }
-
- protected void c(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (!world.isStatic && this.cC > 0 && world.random.nextFloat() < this.cF) {
- entityhuman.addEffect(new MobEffect(this.cC, this.cD * 20, this.cE));
- }
- }
-
- public int d_(ItemStack itemstack) {
- return 32;
- }
-
- public EnumAnimation c_(ItemStack itemstack) {
- return EnumAnimation.EAT;
- }
-
- public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (entityhuman.g(this.cB)) {
- entityhuman.a(itemstack, this.d_(itemstack));
- }
-
- return itemstack;
- }
-
- public int getNutrition() {
- return this.b;
- }
-
- public float getSaturationModifier() {
- return this.c;
- }
-
- public boolean j() {
- return this.d;
- }
-
- public ItemFood a(int i, int j, int k, float f) {
- this.cC = i;
- this.cD = j;
- this.cE = k;
- this.cF = f;
- return this;
- }
-
- public ItemFood k() {
- this.cB = true;
- return this;
- }
-}
diff --git a/src/main/java/net/minecraft/server/ItemHanging.java b/src/main/java/net/minecraft/server/ItemHanging.java
index bfcd283dbf..6708453986 100644
--- a/src/main/java/net/minecraft/server/ItemHanging.java
+++ b/src/main/java/net/minecraft/server/ItemHanging.java
@@ -10,8 +10,7 @@ public class ItemHanging extends Item {
private final Class a;
- public ItemHanging(int i, Class oclass) {
- super(i);
+ public ItemHanging(Class oclass) {
this.a = oclass;
this.a(CreativeModeTab.c);
}
diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java
index 4d216e833f..67c63d5555 100644
--- a/src/main/java/net/minecraft/server/ItemHoe.java
+++ b/src/main/java/net/minecraft/server/ItemHoe.java
@@ -4,8 +4,7 @@ public class ItemHoe extends Item {
protected EnumToolMaterial a;
- public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
- super(i);
+ public ItemHoe(EnumToolMaterial enumtoolmaterial) {
this.a = enumtoolmaterial;
this.maxStackSize = 1;
this.setMaxDurability(enumtoolmaterial.a());
@@ -17,23 +16,21 @@ public class ItemHoe extends Item {
if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
} else {
- int i1 = world.getTypeId(i, j, k);
- int j1 = world.getTypeId(i, j + 1, k);
+ Block block = world.getType(i, j, k);
- if (l != 0 && j1 == 0 && (i1 == Block.GRASS.id || i1 == Block.DIRT.id)) {
- Block block = Block.SOIL;
+ if (l != 0 && world.getType(i, j + 1, k).getMaterial() == Material.AIR && (block == Blocks.GRASS || block == Blocks.DIRT)) {
+ Block block1 = Blocks.SOIL;
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block1.stepSound.getStepSound(), (block1.stepSound.getVolume1() + 1.0F) / 2.0F, block1.stepSound.getVolume2() * 0.8F);
if (world.isStatic) {
return true;
} else {
// CraftBukkit start - Hoes - blockface -1 for 'SELF'
- // world.setTypeIdUpdate(i, j, k, block.id);
- if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, 0, clickedX, clickedY, clickedZ)) {
+ // world.setTypeUpdate(i, j, k, block1);
+ if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block1, 0, clickedX, clickedY, clickedZ)) {
return false;
}
// CraftBukkit end
-
itemstack.damage(1, entityhuman);
return true;
}
@@ -43,7 +40,7 @@ public class ItemHoe extends Item {
}
}
- public String g() {
+ public String i() {
return this.a.toString();
}
}
diff --git a/src/main/java/net/minecraft/server/ItemLeash.java b/src/main/java/net/minecraft/server/ItemLeash.java
index e63ae3e6e6..e24b2a8d0f 100644
--- a/src/main/java/net/minecraft/server/ItemLeash.java
+++ b/src/main/java/net/minecraft/server/ItemLeash.java
@@ -7,15 +7,14 @@ import org.bukkit.event.hanging.HangingPlaceEvent; // CraftBukkit
public class ItemLeash extends Item {
- public ItemLeash(int i) {
- super(i);
+ public ItemLeash() {
this.a(CreativeModeTab.i);
}
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);
+ Block block = world.getType(i, j, k);
- if (Block.byId[i1] != null && Block.byId[i1].d() == 11) {
+ if (block.b() == 11) {
if (world.isStatic) {
return true;
} else {
@@ -39,7 +38,7 @@ public class ItemLeash extends Item {
while (iterator.hasNext()) {
EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
- if (entityinsentient.bH() && entityinsentient.getLeashHolder() == entityhuman) {
+ if (entityinsentient.bL() && entityinsentient.getLeashHolder() == entityhuman) {
if (entityleash == null) {
entityleash = EntityLeash.a(world, i, j, k);
@@ -59,6 +58,7 @@ public class ItemLeash extends Item {
continue;
}
// CraftBukkit end
+
entityinsentient.setLeashHolder(entityleash, true);
flag = true;
}
diff --git a/src/main/java/net/minecraft/server/ItemMapEmpty.java b/src/main/java/net/minecraft/server/ItemMapEmpty.java
index f774592498..8998a3fe72 100644
--- a/src/main/java/net/minecraft/server/ItemMapEmpty.java
+++ b/src/main/java/net/minecraft/server/ItemMapEmpty.java
@@ -2,18 +2,17 @@ package net.minecraft.server;
public class ItemMapEmpty extends ItemWorldMapBase {
- protected ItemMapEmpty(int i) {
- super(i);
+ protected ItemMapEmpty() {
this.a(CreativeModeTab.f);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
- ItemStack itemstack1 = new ItemStack(Item.MAP, 1, worldMain.b("map")); // CraftBukkit - use primary world for maps
+ ItemStack itemstack1 = new ItemStack(Items.MAP, 1, worldMain.b("map")); // CraftBukkit - use primary world for maps
String s = "map_" + itemstack1.getData();
WorldMap worldmap = new WorldMap(s);
- worldMain.a(s, (WorldMapBase) worldmap); // CraftBukkit - use primary world for maps
+ worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit - use primary world for maps
worldmap.scale = 0;
int i = 128 * (1 << worldmap.scale);
@@ -29,7 +28,7 @@ public class ItemMapEmpty extends ItemWorldMapBase {
return itemstack1;
} else {
if (!entityhuman.inventory.pickup(itemstack1.cloneItemStack())) {
- entityhuman.drop(itemstack1);
+ entityhuman.drop(itemstack1, false);
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java
index 5df0c3205c..02a1fd8e2b 100644
--- a/src/main/java/net/minecraft/server/ItemMinecart.java
+++ b/src/main/java/net/minecraft/server/ItemMinecart.java
@@ -5,18 +5,15 @@ public class ItemMinecart extends Item {
private static final IDispenseBehavior b = new DispenseBehaviorMinecart();
public int a;
- public ItemMinecart(int i, int j) {
- super(i);
+ public ItemMinecart(int i) {
this.maxStackSize = 1;
- this.a = j;
+ this.a = i;
this.a(CreativeModeTab.e);
BlockDispenser.a.a(this, b);
}
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 (BlockMinecartTrackAbstract.e_(i1)) {
+ if (BlockMinecartTrackAbstract.a(world.getType(i, j, k))) {
if (!world.isStatic) {
// CraftBukkit start - Minecarts
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);
@@ -25,7 +22,6 @@ public class ItemMinecart extends Item {
return false;
}
// CraftBukkit end
-
EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.a);
if (itemstack.hasName()) {
diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index 06967d8aaf..34c21efc5e 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -2,13 +2,12 @@ package net.minecraft.server;
public class ItemMonsterEgg extends Item {
- public ItemMonsterEgg(int i) {
- super(i);
+ public ItemMonsterEgg() {
this.a(true);
this.a(CreativeModeTab.f);
}
- public String l(ItemStack itemstack) {
+ public String n(ItemStack itemstack) {
String s = ("" + LocaleI18n.get(this.getName() + ".name")).trim();
String s1 = EntityTypes.b(itemstack.getData());
@@ -23,14 +22,14 @@ public class ItemMonsterEgg extends Item {
if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63 || itemstack.getData() == 64) { // CraftBukkit
return true;
} else {
- int i1 = world.getTypeId(i, j, k);
+ Block block = world.getType(i, j, k);
i += Facing.b[l];
j += Facing.c[l];
k += Facing.d[l];
double d0 = 0.0D;
- if (l == 1 && Block.byId[i1] != null && Block.byId[i1].d() == 11) {
+ if (l == 1 && block.b() == 11) {
d0 = 0.5D;
}
@@ -59,7 +58,7 @@ public class ItemMonsterEgg extends Item {
if (movingobjectposition == null) {
return itemstack;
} else {
- if (movingobjectposition.type == EnumMovingObjectType.TILE) {
+ if (movingobjectposition.type == EnumMovingObjectType.BLOCK) {
int i = movingobjectposition.b;
int j = movingobjectposition.c;
int k = movingobjectposition.d;
@@ -72,7 +71,7 @@ public class ItemMonsterEgg extends Item {
return itemstack;
}
- if (world.getMaterial(i, j, k) == Material.WATER) {
+ if (world.getType(i, j, k) instanceof BlockFluids) {
Entity entity = a(world, itemstack.getData(), (double) i, (double) j, (double) k);
if (entity != null) {
@@ -108,7 +107,7 @@ public class ItemMonsterEgg extends Item {
entityinsentient.aN = entityinsentient.yaw;
entityinsentient.a((GroupDataEntity) null);
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
- entityinsentient.p();
+ entityinsentient.r();
}
}
diff --git a/src/main/java/net/minecraft/server/ItemRedstone.java b/src/main/java/net/minecraft/server/ItemRedstone.java
index ad43b412c6..78e66fb910 100644
--- a/src/main/java/net/minecraft/server/ItemRedstone.java
+++ b/src/main/java/net/minecraft/server/ItemRedstone.java
@@ -2,14 +2,13 @@ package net.minecraft.server;
public class ItemRedstone extends Item {
- public ItemRedstone(int i) {
- super(i);
+ public ItemRedstone() {
this.a(CreativeModeTab.d);
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
- if (world.getTypeId(i, j, k) != Block.SNOW.id) {
+ if (world.getType(i, j, k) != Blocks.SNOW) {
if (l == 0) {
--j;
}
@@ -42,11 +41,11 @@ public class ItemRedstone extends Item {
if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
} else {
- if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
+ if (Blocks.REDSTONE_WIRE.canPlace(world, i, j, k)) {
// CraftBukkit start
// --itemstack.count;
- // world.setTypeIdUpdate(i, j, k, Block.REDSTONE_WIRE.id);
- if (!ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, Block.REDSTONE_WIRE.id, 0, clickedX, clickedY, clickedZ)) {
+ // world.setTypeUpdate(i, j, k, Blocks.REDSTONE_WIRE);
+ if (!ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, Blocks.REDSTONE_WIRE, 0, clickedX, clickedY, clickedZ)) {
return false;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ItemReed.java b/src/main/java/net/minecraft/server/ItemReed.java
index f3a3c0e058..bdcc92b628 100644
--- a/src/main/java/net/minecraft/server/ItemReed.java
+++ b/src/main/java/net/minecraft/server/ItemReed.java
@@ -2,20 +2,19 @@ package net.minecraft.server;
public class ItemReed extends Item {
- private int id;
+ private Block block;
- public ItemReed(int i, Block block) {
- super(i);
- this.id = block.id;
+ public ItemReed(Block block) {
+ this.block = block;
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
- int i1 = world.getTypeId(i, j, k);
+ Block block = world.getType(i, j, k);
- if (i1 == Block.SNOW.id && (world.getData(i, j, k) & 7) < 1) {
+ if (block == Blocks.SNOW && (world.getData(i, j, k) & 7) < 1) {
l = 1;
- } else if (i1 != Block.VINE.id && i1 != Block.LONG_GRASS.id && i1 != Block.DEAD_BUSH.id) {
+ } else if (block != Blocks.VINE && block != Blocks.LONG_GRASS && block != Blocks.DEAD_BUSH) {
if (l == 0) {
--j;
}
@@ -46,24 +45,21 @@ public class ItemReed extends Item {
} else if (itemstack.count == 0) {
return false;
} else {
- if (world.mayPlace(this.id, i, j, k, false, l, (Entity) null, itemstack)) {
- Block block = Block.byId[this.id];
- int j1 = block.getPlacedData(world, i, j, k, l, f, f1, f2, 0);
-
+ if (world.mayPlace(this.block, i, j, k, false, l, (Entity) null, itemstack)) {
+ int i1 = this.block.getPlacedData(world, i, j, k, l, f, f1, f2, 0);
// CraftBukkit start - Redirect to common handler
- ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, j1, clickedX, clickedY, clickedZ);
+ ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, this.block, i1, clickedX, clickedY, clickedZ);
/*
- if (world.setTypeIdAndData(i, j, k, this.id, j1, 3)) {
- if (world.getTypeId(i, j, k) == this.id) {
- Block.byId[this.id].postPlace(world, i, j, k, entityhuman, itemstack);
- Block.byId[this.id].postPlace(world, i, j, k, j1);
+ if (world.setTypeAndData(i, j, k, this.block, i1, 3)) {
+ if (world.getType(i, j, k) == this.block) {
+ this.block.postPlace(world, i, j, k, entityhuman, itemstack);
+ this.block.postPlace(world, i, j, k, i1);
}
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume1() + 1.0F) / 2.0F, this.block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
- */
- // CraftBukkit end
+ // CraftBukkit end */
}
return true;
diff --git a/src/main/java/net/minecraft/server/ItemSeedFood.java b/src/main/java/net/minecraft/server/ItemSeedFood.java
index 7fc09d8680..eec8b5f8aa 100644
--- a/src/main/java/net/minecraft/server/ItemSeedFood.java
+++ b/src/main/java/net/minecraft/server/ItemSeedFood.java
@@ -2,13 +2,13 @@ package net.minecraft.server;
public class ItemSeedFood extends ItemFood {
- private int b;
- private int c;
+ private Block b;
+ private Block c;
- public ItemSeedFood(int i, int j, float f, int k, int l) {
- super(i, j, f, false);
- this.b = k;
- this.c = l;
+ public ItemSeedFood(int i, float f, Block block, Block block1) {
+ super(i, f, false);
+ this.b = block;
+ this.c = block1;
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
@@ -16,16 +16,13 @@ public class ItemSeedFood extends ItemFood {
if (l != 1) {
return false;
} else if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i, j + 1, k, l, itemstack)) {
- int i1 = world.getTypeId(i, j, k);
-
- if (i1 == this.c && world.isEmpty(i, j + 1, k)) {
+ if (world.getType(i, j, k) == this.c && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start
- // world.setTypeIdUpdate(i, j + 1, k, this.b);
+ // world.setTypeUpdate(i, j + 1, k, this.b);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.b, 0, clickedX, clickedY, clickedZ)) {
return false;
}
// CraftBukkit end
-
--itemstack.count;
return true;
} else {
diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java
index 381d028e2b..d74cb30f47 100644
--- a/src/main/java/net/minecraft/server/ItemSeeds.java
+++ b/src/main/java/net/minecraft/server/ItemSeeds.java
@@ -2,13 +2,12 @@ package net.minecraft.server;
public class ItemSeeds extends Item {
- private int id;
- private int b;
+ private Block block;
+ private Block b;
- public ItemSeeds(int i, int j, int k) {
- super(i);
- this.id = j;
- this.b = k;
+ public ItemSeeds(Block block, Block block1) {
+ this.block = block;
+ this.b = block1;
this.a(CreativeModeTab.l);
}
@@ -17,16 +16,13 @@ public class ItemSeeds extends Item {
if (l != 1) {
return false;
} else if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i, j + 1, k, l, itemstack)) {
- int i1 = world.getTypeId(i, j, k);
-
- if (i1 == this.b && world.isEmpty(i, j + 1, k)) {
+ if (world.getType(i, j, k) == this.b && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start - Seeds
- // world.setTypeIdUpdate(i, j + 1, k, this.id);
- if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.id, 0, clickedX, clickedY, clickedZ)) {
+ // world.setTypeUpdate(i, j + 1, k, this.block);
+ if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.block, 0, clickedX, clickedY, clickedZ)) {
return false;
}
// CraftBukkit end
-
--itemstack.count;
return true;
} else {
diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java
index f7d3607b03..8362602ca4 100644
--- a/src/main/java/net/minecraft/server/ItemSign.java
+++ b/src/main/java/net/minecraft/server/ItemSign.java
@@ -2,8 +2,7 @@ package net.minecraft.server;
public class ItemSign extends Item {
- public ItemSign(int i) {
- super(i);
+ public ItemSign() {
this.maxStackSize = 16;
this.a(CreativeModeTab.c);
}
@@ -12,7 +11,7 @@ public class ItemSign extends Item {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (l == 0) {
return false;
- } else if (!world.getMaterial(i, j, k).isBuildable()) {
+ } else if (!world.getType(i, j, k).getMaterial().isBuildable()) {
return false;
} else {
if (l == 1) {
@@ -37,7 +36,7 @@ public class ItemSign extends Item {
if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
- } else if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
+ } else if (!Blocks.SIGN_POST.canPlace(world, i, j, k)) {
return false;
} else if (world.isStatic) {
return true;
@@ -47,14 +46,14 @@ public class ItemSign extends Item {
if (l == 1) {
int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
- // world.setTypeIdAndData(i, j, k, Block.SIGN_POST.id, i1, 3);
- block = Block.SIGN_POST;
+ // world.setTypeAndData(i, j, k, Blocks.SIGN_POST, i1, 3);
+ block = Blocks.SIGN_POST;
l = i1;
} else {
- // world.setTypeIdAndData(i, j, k, Block.WALL_SIGN.id, l, 3);
- block = Block.WALL_SIGN;
+ // world.setTypeAndData(i, j, k, Blocks.WALL_SIGN, l, 3);
+ block = Blocks.WALL_SIGN;
}
- if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, l, clickedX, clickedY, clickedZ)) {
+ if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block, l, clickedX, clickedY, clickedZ)) {
return false;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java
index 063f50b685..6b2bf9bb09 100644
--- a/src/main/java/net/minecraft/server/ItemSkull.java
+++ b/src/main/java/net/minecraft/server/ItemSkull.java
@@ -5,8 +5,7 @@ public class ItemSkull extends Item {
private static final String[] b = new String[] { "skeleton", "wither", "zombie", "char", "creeper"};
public static final String[] a = new String[] { "skeleton", "wither", "zombie", "steve", "creeper"};
- public ItemSkull(int i) {
- super(i);
+ public ItemSkull() {
this.a(CreativeModeTab.c);
this.setMaxDurability(0);
this.a(true);
@@ -16,7 +15,7 @@ public class ItemSkull extends Item {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (l == 0) {
return false;
- } else if (!world.getMaterial(i, j, k).isBuildable()) {
+ } else if (!world.getType(i, j, k).getMaterial().isBuildable()) {
return false;
} else {
if (l == 1) {
@@ -41,12 +40,12 @@ public class ItemSkull extends Item {
if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
- } else if (!Block.SKULL.canPlace(world, i, j, k)) {
+ } else if (!Blocks.SKULL.canPlace(world, i, j, k)) {
return false;
} else {
// CraftBukkit start - Handle in ItemBlock
- // world.setTypeIdAndData(i, j, k, Block.SKULL.id, l, 2);
- if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Block.SKULL.id, l, clickedX, clickedY, clickedZ)) {
+ // world.setTypeAndData(i, j, k, Blocks.SKULL, l, 2);
+ if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Blocks.SKULL, l, clickedX, clickedY, clickedZ)) {
return false;
}
l = world.getData(i, j, k);
@@ -62,13 +61,13 @@ public class ItemSkull extends Item {
if (tileentity != null && tileentity instanceof TileEntitySkull) {
String s = "";
- if (itemstack.hasTag() && itemstack.getTag().hasKey("SkullOwner")) {
+ if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("SkullOwner", 8)) {
s = itemstack.getTag().getString("SkullOwner");
}
((TileEntitySkull) tileentity).setSkullType(itemstack.getData(), s);
((TileEntitySkull) tileentity).setRotation(i1);
- ((BlockSkull) Block.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity);
+ ((BlockSkull) Blocks.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity);
}
--itemstack.count;
@@ -81,7 +80,7 @@ public class ItemSkull extends Item {
return i;
}
- public String d(ItemStack itemstack) {
+ public String a(ItemStack itemstack) {
int i = itemstack.getData();
if (i < 0 || i >= b.length) {
@@ -91,7 +90,7 @@ public class ItemSkull extends Item {
return super.getName() + "." + b[i];
}
- public String l(ItemStack itemstack) {
- return itemstack.getData() == 3 && itemstack.hasTag() && itemstack.getTag().hasKey("SkullOwner") ? LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}) : super.l(itemstack);
+ public String n(ItemStack itemstack) {
+ return itemstack.getData() == 3 && itemstack.hasTag() && itemstack.getTag().hasKeyOfType("SkullOwner", 8) ? LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}) : super.n(itemstack);
}
}
diff --git a/src/main/java/net/minecraft/server/ItemSnow.java b/src/main/java/net/minecraft/server/ItemSnow.java
index 1cee156eee..19e2b38c4d 100644
--- a/src/main/java/net/minecraft/server/ItemSnow.java
+++ b/src/main/java/net/minecraft/server/ItemSnow.java
@@ -2,8 +2,8 @@ package net.minecraft.server;
public class ItemSnow extends ItemBlockWithAuxData {
- public ItemSnow(int i, Block block) {
- super(i, block);
+ public ItemSnow(Block block, Block block1) {
+ super(block, block1);
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
@@ -13,25 +13,23 @@ public class ItemSnow extends ItemBlockWithAuxData {
} else if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
} else {
- int i1 = world.getTypeId(i, j, k);
+ Block block = world.getType(i, j, k);
- if (i1 == Block.SNOW.id) {
- Block block = Block.byId[this.g()];
- int j1 = world.getData(i, j, k);
- int k1 = j1 & 7;
+ if (block == Blocks.SNOW) {
+ int i1 = world.getData(i, j, k);
+ int j1 = i1 & 7;
// CraftBukkit start - Redirect to common handler
- if (k1 <= 6 && world.b(block.b(world, i, j, k)) && ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, Block.SNOW.id, k1 + 1 | j1 & -8, clickedX, clickedY, clickedZ)) {
+ if (j1 <= 6 && world.b(this.block.a(world, i, j, k)) && ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, block, j1 + 1 | i1 & -8, clickedX, clickedY, clickedZ)) {
return true;
}
/*
- if (k1 <= 6 && world.b(block.b(world, i, j, k)) && world.setData(i, j, k, k1 + 1 | j1 & -8, 2)) {
- world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ if (j1 <= 6 && world.b(this.block.a(world, i, j, k)) && world.setData(i, j, k, j1 + 1 | i1 & -8, 2)) {
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume1() + 1.0F) / 2.0F, this.block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
return true;
}
- */
- // CraftBukkit end
+ // CraftBukkit end */
}
return super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2);
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 808860edd9..53c665b88a 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -1,16 +1,17 @@
package net.minecraft.server;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimap;
import java.text.DecimalFormat;
import java.util.Random;
+import net.minecraft.util.com.google.common.collect.HashMultimap;
+import net.minecraft.util.com.google.common.collect.Multimap;
+
public final class ItemStack {
public static final DecimalFormat a = new DecimalFormat("#.###");
public int count;
public int c;
- public int id;
+ private Item item;
public NBTTagCompound tag;
private int damage;
private EntityItemFrame g;
@@ -20,31 +21,27 @@ public final class ItemStack {
}
public ItemStack(Block block, int i) {
- this(block.id, i, 0);
+ this(block, i, 0);
}
public ItemStack(Block block, int i, int j) {
- this(block.id, i, j);
+ this(Item.getItemOf(block), i, j);
}
public ItemStack(Item item) {
- this(item.id, 1, 0);
+ this(item, 1);
}
public ItemStack(Item item, int i) {
- this(item.id, i, 0);
+ this(item, i, 0);
}
public ItemStack(Item item, int i, int j) {
- this(item.id, i, j);
- }
-
- public ItemStack(int i, int j, int k) {
- this.id = i;
- this.count = j;
+ this.item = item;
+ this.count = i;
// CraftBukkit start - Pass to setData to do filtering
- this.setData(k);
- //this.damage = k;
+ this.setData(j);
+ //this.damage = j;
//if (this.damage < 0) {
// this.damage = 0;
//}
@@ -61,7 +58,7 @@ public final class ItemStack {
private ItemStack() {}
public ItemStack a(int i) {
- ItemStack itemstack = new ItemStack(this.id, i, this.damage);
+ ItemStack itemstack = new ItemStack(this.item, i, this.damage);
if (this.tag != null) {
itemstack.tag = (NBTTagCompound) this.tag.clone();
@@ -72,14 +69,14 @@ public final class ItemStack {
}
public Item getItem() {
- return Item.byId[this.id];
+ return this.item;
}
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);
+ entityhuman.a(StatisticList.E[Item.b(this.item)], 1);
}
return flag;
@@ -98,7 +95,7 @@ public final class ItemStack {
}
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
- nbttagcompound.setShort("id", (short) this.id);
+ nbttagcompound.setShort("id", (short) Item.b(this.item));
nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.setShort("Damage", (short) this.damage);
if (this.tag != null) {
@@ -109,14 +106,14 @@ public final class ItemStack {
}
public void c(NBTTagCompound nbttagcompound) {
- this.id = nbttagcompound.getShort("id");
+ this.item = Item.d(nbttagcompound.getShort("id"));
this.count = nbttagcompound.getByte("Count");
this.damage = nbttagcompound.getShort("Damage");
if (this.damage < 0) {
this.damage = 0;
}
- if (nbttagcompound.hasKey("tag")) {
+ if (nbttagcompound.hasKeyOfType("tag", 10)) {
// CraftBukkit - make defensive copy as this data may be coming from the save thread
this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
}
@@ -131,11 +128,11 @@ public final class ItemStack {
}
public boolean g() {
- return Item.byId[this.id].getMaxDurability() > 0;
+ return this.item.getMaxDurability() <= 0 ? false : !this.hasTag() || !this.getTag().getBoolean("Unbreakable");
}
public boolean usesData() {
- return Item.byId[this.id].n();
+ return this.item.n();
}
public boolean i() {
@@ -158,12 +155,12 @@ public final class ItemStack {
return;
}
- if (!(this.usesData() || Item.byId[this.id].usesDurability() || this.id > 255)) {
+ if (!(this.usesData() || this.getItem().usesDurability())) { // || this.id > 255)) {
i = 0;
}
// Filter wool to avoid confusing the client
- if (this.id == Block.WOOL.id) {
+ if (this.getItem() == Item.getItemOf(Blocks.WOOL)) {
i = Math.min(15, i);
}
// CraftBukkit end
@@ -175,7 +172,7 @@ public final class ItemStack {
}
public int l() {
- return Item.byId[this.id].getMaxDurability();
+ return this.item.getMaxDurability();
}
public boolean isDamaged(int i, Random random) {
@@ -206,15 +203,15 @@ public final class ItemStack {
public void damage(int i, EntityLiving entityliving) {
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
if (this.g()) {
- if (this.isDamaged(i, entityliving.aD())) {
+ if (this.isDamaged(i, entityliving.aI())) {
entityliving.a(this);
--this.count;
if (entityliving instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entityliving;
- entityhuman.a(StatisticList.F[this.id], 1);
+ entityhuman.a(StatisticList.F[Item.b(this.item)], 1);
if (this.count == 0 && this.getItem() instanceof ItemBow) {
- entityhuman.bz();
+ entityhuman.bE();
}
}
@@ -235,31 +232,31 @@ public final class ItemStack {
}
public void a(EntityLiving entityliving, EntityHuman entityhuman) {
- boolean flag = Item.byId[this.id].a(this, entityliving, (EntityLiving) entityhuman);
+ boolean flag = this.item.a(this, entityliving, (EntityLiving) entityhuman);
if (flag) {
- entityhuman.a(StatisticList.E[this.id], 1);
+ entityhuman.a(StatisticList.E[Item.b(this.item)], 1);
}
}
- 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);
+ public void a(World world, Block block, int i, int j, int k, EntityHuman entityhuman) {
+ boolean flag = this.item.a(this, world, block, i, j, k, entityhuman);
if (flag) {
- entityhuman.a(StatisticList.E[this.id], 1);
+ entityhuman.a(StatisticList.E[Item.b(this.item)], 1);
}
}
public boolean b(Block block) {
- return Item.byId[this.id].canDestroySpecialBlock(block);
+ return this.item.canDestroySpecialBlock(block);
}
public boolean a(EntityHuman entityhuman, EntityLiving entityliving) {
- return Item.byId[this.id].a(this, entityhuman, entityliving);
+ return this.item.a(this, entityhuman, entityliving);
}
public ItemStack cloneItemStack() {
- ItemStack itemstack = new ItemStack(this.id, this.count, this.damage);
+ ItemStack itemstack = new ItemStack(this.item, this.count, this.damage);
if (this.tag != null) {
itemstack.tag = (NBTTagCompound) this.tag.clone();
@@ -277,15 +274,15 @@ public final class ItemStack {
}
private boolean d(ItemStack itemstack) {
- return this.count != itemstack.count ? false : (this.id != itemstack.id ? false : (this.damage != itemstack.damage ? false : (this.tag == null && itemstack.tag != null ? false : this.tag == null || this.tag.equals(itemstack.tag))));
+ return this.count != itemstack.count ? false : (this.item != itemstack.item ? false : (this.damage != itemstack.damage ? false : (this.tag == null && itemstack.tag != null ? false : this.tag == null || this.tag.equals(itemstack.tag))));
}
public boolean doMaterialsMatch(ItemStack itemstack) {
- return this.id == itemstack.id && this.damage == itemstack.damage;
+ return this.item == itemstack.item && this.damage == itemstack.damage;
}
public String a() {
- return Item.byId[this.id].d(this);
+ return this.item.a(this);
}
public static ItemStack b(ItemStack itemstack) {
@@ -293,7 +290,7 @@ public final class ItemStack {
}
public String toString() {
- return this.count + "x" + Item.byId[this.id].getName() + "@" + this.damage;
+ return this.count + "x" + this.item.getName() + "@" + this.damage;
}
public void a(World world, Entity entity, int i, boolean flag) {
@@ -301,12 +298,12 @@ public final class ItemStack {
--this.c;
}
- Item.byId[this.id].a(this, world, entity, i, flag);
+ this.item.a(this, world, entity, i, flag);
}
public void a(World world, EntityHuman entityhuman, int i) {
- entityhuman.a(StatisticList.D[this.id], i);
- Item.byId[this.id].d(this, world, entityhuman);
+ entityhuman.a(StatisticList.D[Item.b(this.item)], i);
+ this.item.d(this, world, entityhuman);
}
public int n() {
@@ -314,7 +311,7 @@ public final class ItemStack {
}
public EnumAnimation o() {
- return this.getItem().c_(this);
+ return this.getItem().d(this);
}
public void b(World world, EntityHuman entityhuman, int i) {
@@ -330,25 +327,20 @@ public final class ItemStack {
}
public NBTTagList getEnchantments() {
- return this.tag == null ? null : (NBTTagList) this.tag.get("ench");
+ return this.tag == null ? null : this.tag.getList("ench", 10);
}
public void setTag(NBTTagCompound nbttagcompound) {
- // CraftBukkit start - Set compound name to "tag," remove discrepancy
- if (nbttagcompound != null) {
- nbttagcompound.setName("tag");
- }
- // CraftBukkit end
this.tag = nbttagcompound;
}
public String getName() {
- String s = this.getItem().l(this);
+ String s = this.getItem().n(this);
- if (this.tag != null && this.tag.hasKey("display")) {
+ if (this.tag != null && this.tag.hasKeyOfType("display", 10)) {
NBTTagCompound nbttagcompound = this.tag.getCompound("display");
- if (nbttagcompound.hasKey("Name")) {
+ if (nbttagcompound.hasKeyOfType("Name", 8)) {
s = nbttagcompound.getString("Name");
}
}
@@ -356,21 +348,22 @@ public final class ItemStack {
return s;
}
- public void c(String s) {
+ public ItemStack c(String s) {
if (this.tag == null) {
- this.tag = new NBTTagCompound("tag");
+ this.tag = new NBTTagCompound();
}
- if (!this.tag.hasKey("display")) {
- this.tag.setCompound("display", new NBTTagCompound());
+ if (!this.tag.hasKeyOfType("display", 10)) {
+ this.tag.set("display", new NBTTagCompound());
}
this.tag.getCompound("display").setString("Name", s);
+ return this;
}
public void t() {
if (this.tag != null) {
- if (this.tag.hasKey("display")) {
+ if (this.tag.hasKeyOfType("display", 10)) {
NBTTagCompound nbttagcompound = this.tag.getCompound("display");
nbttagcompound.remove("Name");
@@ -385,7 +378,11 @@ public final class ItemStack {
}
public boolean hasName() {
- return this.tag == null ? false : (!this.tag.hasKey("display") ? false : this.tag.getCompound("display").hasKey("Name"));
+ return this.tag == null ? false : (!this.tag.hasKeyOfType("display", 10) ? false : this.tag.getCompound("display").hasKeyOfType("Name", 8));
+ }
+
+ public EnumItemRarity w() {
+ return this.getItem().f(this);
}
public boolean x() {
@@ -397,11 +394,11 @@ public final class ItemStack {
this.setTag(new NBTTagCompound());
}
- if (!this.tag.hasKey("ench")) {
- this.tag.set("ench", new NBTTagList("ench"));
+ if (!this.tag.hasKeyOfType("ench", 9)) {
+ this.tag.set("ench", new NBTTagList());
}
- NBTTagList nbttaglist = (NBTTagList) this.tag.get("ench");
+ NBTTagList nbttaglist = this.tag.getList("ench", 10);
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setShort("id", (short) enchantment.id);
@@ -410,7 +407,7 @@ public final class ItemStack {
}
public boolean hasEnchantments() {
- return this.tag != null && this.tag.hasKey("ench");
+ return this.tag != null && this.tag.hasKeyOfType("ench", 9);
}
public void a(String s, NBTBase nbtbase) {
@@ -422,7 +419,7 @@ public final class ItemStack {
}
public boolean z() {
- return this.getItem().z();
+ return this.getItem().v();
}
public boolean A() {
@@ -438,12 +435,12 @@ public final class ItemStack {
}
public int getRepairCost() {
- return this.hasTag() && this.tag.hasKey("RepairCost") ? this.tag.getInt("RepairCost") : 0;
+ return this.hasTag() && this.tag.hasKeyOfType("RepairCost", 3) ? this.tag.getInt("RepairCost") : 0;
}
public void setRepairCost(int i) {
if (!this.hasTag()) {
- this.tag = new NBTTagCompound("tag");
+ this.tag = new NBTTagCompound();
}
this.tag.setInt("RepairCost", i);
@@ -452,12 +449,12 @@ public final class ItemStack {
public Multimap D() {
Object object;
- if (this.hasTag() && this.tag.hasKey("AttributeModifiers")) {
+ if (this.hasTag() && this.tag.hasKeyOfType("AttributeModifiers", 9)) {
object = HashMultimap.create();
- NBTTagList nbttaglist = this.tag.getList("AttributeModifiers");
+ NBTTagList nbttaglist = this.tag.getList("AttributeModifiers", 10);
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound = nbttaglist.get(i);
AttributeModifier attributemodifier = GenericAttributes.a(nbttagcompound);
if (attributemodifier.a().getLeastSignificantBits() != 0L && attributemodifier.a().getMostSignificantBits() != 0L) {
@@ -465,9 +462,27 @@ public final class ItemStack {
}
}
} else {
- object = this.getItem().h();
+ object = this.getItem().k();
}
return (Multimap) object;
}
+
+ public void setItem(Item item) {
+ this.item = item;
+ }
+
+ public IChatBaseComponent E() {
+ IChatBaseComponent ichatbasecomponent = (new ChatComponentText("[")).a(this.getName()).a("]");
+
+ if (this.item != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ this.save(nbttagcompound);
+ ichatbasecomponent.b().a(new ChatHoverable(EnumHoverAction.SHOW_ITEM, new ChatComponentText(nbttagcompound.toString())));
+ ichatbasecomponent.b().setColor(this.w().e);
+ }
+
+ return ichatbasecomponent;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ItemStep.java b/src/main/java/net/minecraft/server/ItemStep.java
index 4f5a8846f8..6448f3529d 100644
--- a/src/main/java/net/minecraft/server/ItemStep.java
+++ b/src/main/java/net/minecraft/server/ItemStep.java
@@ -2,15 +2,15 @@ package net.minecraft.server;
public class ItemStep extends ItemBlock {
- private final boolean a;
- private final BlockStepAbstract b;
+ private final boolean b;
private final BlockStepAbstract c;
+ private final BlockStepAbstract d;
- public ItemStep(int i, BlockStepAbstract blockstepabstract, BlockStepAbstract blockstepabstract1, boolean flag) {
- super(i);
- this.b = blockstepabstract;
- this.c = blockstepabstract1;
- this.a = flag;
+ public ItemStep(Block block, BlockStepAbstract blockstepabstract, BlockStepAbstract blockstepabstract1, boolean flag) {
+ super(block);
+ this.c = blockstepabstract;
+ this.d = blockstepabstract1;
+ this.b = flag;
this.setMaxDurability(0);
this.a(true);
}
@@ -19,32 +19,33 @@ public class ItemStep extends ItemBlock {
return i;
}
- public String d(ItemStack itemstack) {
- return this.b.c(itemstack.getData());
+ public String a(ItemStack itemstack) {
+ return this.c.b(itemstack.getData());
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
- if (this.a) {
+ if (this.b) {
return super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2);
} else if (itemstack.count == 0) {
return false;
} else if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
} else {
- int i1 = world.getTypeId(i, j, k);
- int j1 = world.getData(i, j, k);
- int k1 = j1 & 7;
- boolean flag = (j1 & 8) != 0;
+ Block block = world.getType(i, j, k);
+ int i1 = world.getData(i, j, k);
+ int j1 = i1 & 7;
+ boolean flag = (i1 & 8) != 0;
- if ((l == 1 && !flag || l == 0 && flag) && i1 == this.b.id && k1 == itemstack.getData()) {
+ if ((l == 1 && !flag || l == 0 && flag) && block == this.c && j1 == itemstack.getData()) {
// CraftBukkit start - world.setTypeIdAndData -> processBlockPlace()
- // if (world.b(this.c.b(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1, 3)) {
- if (world.b(this.c.b(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) {
- // world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
+ // if (world.b(this.d.a(world, i, j, k)) && world.setTypeAndData(i, j, k, this.d, j1, 3)) {
+ if (world.b(this.d.a(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.d, j1, clickedX, clickedY, clickedZ)) {
+ // world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.d.stepSound.getPlaceSound(), (this.d.stepSound.getVolume1() + 1.0F) / 2.0F, this.d.stepSound.getVolume2() * 0.8F);
// CraftBukkit end
--itemstack.count;
}
+
return true;
} else {
return this.a(itemstack, entityhuman, world, i, j, k, l) ? true : super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2);
@@ -53,7 +54,6 @@ public class ItemStep extends ItemBlock {
}
private boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
- final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (l == 0) {
--j;
}
@@ -78,16 +78,13 @@ public class ItemStep extends ItemBlock {
++i;
}
- int i1 = world.getTypeId(i, j, k);
- int j1 = world.getData(i, j, k);
- int k1 = j1 & 7;
+ Block block = world.getType(i, j, k);
+ int i1 = world.getData(i, j, k);
+ int j1 = i1 & 7;
- if (i1 == this.b.id && k1 == itemstack.getData()) {
- // CraftBukkit start - world.setTypeIdAndData -> processBlockPlace()
- // if (world.b(this.c.b(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1, 3)) {
- if (world.b(this.c.b(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) {
- // world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F, this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
- // CraftBukkit end
+ if (block == this.c && j1 == itemstack.getData()) {
+ if (world.b(this.d.a(world, i, j, k)) && world.setTypeAndData(i, j, k, this.d, j1, 3)) {
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.d.stepSound.getPlaceSound(), (this.d.stepSound.getVolume1() + 1.0F) / 2.0F, this.d.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 691ad467b3..2d55d5299a 100644
--- a/src/main/java/net/minecraft/server/ItemWaterLily.java
+++ b/src/main/java/net/minecraft/server/ItemWaterLily.java
@@ -2,8 +2,8 @@ package net.minecraft.server;
public class ItemWaterLily extends ItemWithAuxData {
- public ItemWaterLily(int i) {
- super(i, false);
+ public ItemWaterLily(Block block) {
+ super(block, false);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
@@ -12,7 +12,7 @@ public class ItemWaterLily extends ItemWithAuxData {
if (movingobjectposition == null) {
return itemstack;
} else {
- if (movingobjectposition.type == EnumMovingObjectType.TILE) {
+ if (movingobjectposition.type == EnumMovingObjectType.BLOCK) {
int i = movingobjectposition.b;
int j = movingobjectposition.c;
int k = movingobjectposition.d;
@@ -26,10 +26,10 @@ public class ItemWaterLily extends ItemWithAuxData {
return itemstack;
}
- if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) {
+ if (world.getType(i, j, k).getMaterial() == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start
- // world.setTypeIdUpdate(i, j + 1, k, Block.WATER_LILY.id);
- if (!processBlockPlace(world, entityhuman, null, i, j + 1, k, Block.WATER_LILY.id, 0, clickedX, clickedY, clickedZ)) {
+ // world.setTypeUpdate(i, j + 1, k, Blocks.WATER_LILY);
+ if (!processBlockPlace(world, entityhuman, null, i, j + 1, k, Blocks.WATER_LILY, 0, clickedX, clickedY, clickedZ)) {
return itemstack;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java
index 3866c1bb06..39d7632c83 100644
--- a/src/main/java/net/minecraft/server/ItemWorldMap.java
+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java
@@ -1,5 +1,9 @@
package net.minecraft.server;
+import net.minecraft.util.com.google.common.collect.HashMultiset;
+import net.minecraft.util.com.google.common.collect.Iterables;
+import net.minecraft.util.com.google.common.collect.Multisets;
+
// CraftBukkit start
import org.bukkit.Bukkit;
import org.bukkit.event.server.MapInitializeEvent;
@@ -7,8 +11,7 @@ import org.bukkit.event.server.MapInitializeEvent;
public class ItemWorldMap extends ItemWorldMapBase {
- protected ItemWorldMap(int i) {
- super(i);
+ protected ItemWorldMap() {
this.a(true);
}
@@ -28,7 +31,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
worldmap.centerZ = Math.round((float) (world.getWorldData().e() / i)) * i;
worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps
worldmap.c();
- worldMain.a(s, (WorldMapBase) worldmap); // CraftBukkit - use primary world for maps
+ worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit - use primary world for maps
// CraftBukkit start
MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
@@ -42,13 +45,11 @@ public class ItemWorldMap extends ItemWorldMapBase {
public void a(World world, Entity entity, WorldMap worldmap) {
// CraftBukkit
if (((WorldServer) world).dimension == worldmap.map && entity instanceof EntityHuman) {
- short short1 = 128;
- short short2 = 128;
int i = 1 << worldmap.scale;
int j = worldmap.centerX;
int k = worldmap.centerZ;
- int l = MathHelper.floor(entity.locX - (double) j) / i + short1 / 2;
- int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2;
+ int l = MathHelper.floor(entity.locX - (double) j) / i + 64;
+ int i1 = MathHelper.floor(entity.locZ - (double) k) / i + 64;
int j1 = 128 / i;
if (world.worldProvider.g) {
@@ -66,13 +67,13 @@ public class ItemWorldMap extends ItemWorldMapBase {
double d0 = 0.0D;
for (int j2 = i1 - j1 - 1; j2 < i1 + j1; ++j2) {
- if (k1 >= 0 && j2 >= -1 && k1 < short1 && j2 < short2) {
+ if (k1 >= 0 && j2 >= -1 && k1 < 128 && j2 < 128) {
int k2 = k1 - l;
int l2 = j2 - i1;
boolean flag = k2 * k2 + l2 * l2 > (j1 - 2) * (j1 - 2);
- int i3 = (j / i + k1 - short1 / 2) * i;
- int j3 = (k / i + j2 - short2 / 2) * i;
- int[] aint = new int[256];
+ int i3 = (j / i + k1 - 64) * i;
+ int j3 = (k / i + j2 - 64) * i;
+ HashMultiset hashmultiset = HashMultiset.create();
Chunk chunk = world.getChunkAtWorldCoords(i3, j3);
if (!chunk.isEmpty()) {
@@ -81,78 +82,50 @@ public class ItemWorldMap extends ItemWorldMapBase {
int i4 = 0;
double d1 = 0.0D;
int j4;
- int k4;
- int l4;
- int i5;
if (world.worldProvider.g) {
j4 = i3 + j3 * 231871;
j4 = j4 * j4 * 31287121 + j4 * 11;
if ((j4 >> 20 & 1) == 0) {
- aint[Block.DIRT.id] += 10;
+ hashmultiset.add(Blocks.DIRT.f(0), 10);
} else {
- aint[Block.STONE.id] += 10;
+ hashmultiset.add(Blocks.STONE.f(0), 100);
}
d1 = 100.0D;
} else {
for (j4 = 0; j4 < i; ++j4) {
- for (k4 = 0; k4 < i; ++k4) {
- l4 = chunk.b(j4 + k3, k4 + l3) + 1;
- int j5 = 0;
+ for (int k4 = 0; k4 < i; ++k4) {
+ int l4 = chunk.b(j4 + k3, k4 + l3) + 1;
+ Block block = Blocks.AIR;
+ int i5 = 0;
if (l4 > 1) {
- boolean flag1;
-
do {
- flag1 = true;
- j5 = chunk.getTypeId(j4 + k3, l4 - 1, k4 + l3);
- if (j5 == 0) {
- flag1 = false;
- } else if (l4 > 0 && j5 > 0 && Block.byId[j5].material.H == MaterialMapColor.b) {
- flag1 = false;
- }
+ --l4;
+ block = chunk.getType(j4 + k3, l4, k4 + l3);
+ i5 = chunk.getData(j4 + k3, l4, k4 + l3);
+ } while (block.f(i5) == MaterialMapColor.b && l4 > 0);
- if (!flag1) {
- --l4;
- if (l4 <= 0) {
- break;
- }
+ if (l4 > 0 && block.getMaterial().isLiquid()) {
+ int j5 = l4 - 1;
- j5 = chunk.getTypeId(j4 + k3, l4 - 1, k4 + l3);
- }
- } while (l4 > 0 && !flag1);
-
- if (l4 > 0 && j5 != 0 && Block.byId[j5].material.isLiquid()) {
- i5 = l4 - 1;
- boolean flag2 = false;
-
- int k5;
+ Block block1;
do {
- k5 = chunk.getTypeId(j4 + k3, i5--, k4 + l3);
+ block1 = chunk.getType(j4 + k3, j5--, k4 + l3);
++i4;
- } while (i5 > 0 && k5 != 0 && Block.byId[k5].material.isLiquid());
+ } while (j5 > 0 && block1.getMaterial().isLiquid());
}
}
d1 += (double) l4 / (double) (i * i);
- ++aint[j5];
+ hashmultiset.add(block.f(i5));
}
}
}
i4 /= i * i;
- j4 = 0;
- k4 = 0;
-
- for (l4 = 0; l4 < 256; ++l4) {
- if (aint[l4] > j4) {
- k4 = l4;
- j4 = aint[l4];
- }
- }
-
double d2 = (d1 - d0) * 4.0D / (double) (i + 4) + ((double) (k1 + j2 & 1) - 0.5D) * 0.4D;
byte b0 = 1;
@@ -164,29 +137,24 @@ public class ItemWorldMap extends ItemWorldMapBase {
b0 = 0;
}
- i5 = 0;
- if (k4 > 0) {
- MaterialMapColor materialmapcolor = Block.byId[k4].material.H;
+ MaterialMapColor materialmapcolor = (MaterialMapColor) Iterables.getFirst(Multisets.copyHighestCountFirst(hashmultiset), MaterialMapColor.b);
- if (materialmapcolor == MaterialMapColor.n) {
- d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
- b0 = 1;
- if (d2 < 0.5D) {
- b0 = 2;
- }
-
- if (d2 > 0.9D) {
- b0 = 0;
- }
+ if (materialmapcolor == MaterialMapColor.n) {
+ d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
+ b0 = 1;
+ if (d2 < 0.5D) {
+ b0 = 2;
}
- i5 = materialmapcolor.q;
+ if (d2 > 0.9D) {
+ b0 = 0;
+ }
}
d0 = d1;
if (j2 >= 0 && k2 * k2 + l2 * l2 < j1 * j1 && (!flag || (k1 + j2 & 1) != 0)) {
- byte b1 = worldmap.colors[k1 + j2 * short1];
- byte b2 = (byte) (i5 * 4 + b0);
+ byte b1 = worldmap.colors[k1 + j2 * 128];
+ byte b2 = (byte) (materialmapcolor.M * 4 + b0);
if (b1 != b2) {
if (l1 > j2) {
@@ -197,7 +165,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
i2 = j2;
}
- worldmap.colors[k1 + j2 * short1] = b2;
+ worldmap.colors[k1 + j2 * 128] = b2;
}
}
}
@@ -231,12 +199,12 @@ public class ItemWorldMap extends ItemWorldMapBase {
public Packet c(ItemStack itemstack, World world, EntityHuman entityhuman) {
byte[] abyte = this.getSavedMap(itemstack, world).getUpdatePacket(itemstack, world, entityhuman);
- return abyte == null ? null : new Packet131ItemData((short) Item.MAP.id, (short) itemstack.getData(), abyte);
+ return abyte == null ? null : new PacketPlayOutMap(itemstack.getData(), abyte);
}
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) {
- WorldMap worldmap = Item.MAP.getSavedMap(itemstack, world);
+ WorldMap worldmap = Items.MAP.getSavedMap(itemstack, world);
world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps
@@ -252,7 +220,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
worldmap1.centerZ = worldmap.centerZ;
worldmap1.map = worldmap.map;
worldmap1.c();
- world.a("map_" + itemstack.getData(), (WorldMapBase) worldmap1);
+ world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1);
// CraftBukkit start
MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
new file mode 100644
index 0000000000..6beac826c1
--- /dev/null
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +1,147 @@
+package net.minecraft.server;
+
+import java.security.PrivateKey;
+import java.util.Arrays;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.crypto.SecretKey;
+
+import net.minecraft.util.com.google.common.base.Charsets;
+import net.minecraft.util.com.mojang.authlib.GameProfile;
+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
+import net.minecraft.util.org.apache.commons.lang3.Validate;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class LoginListener implements PacketLoginInListener {
+
+ private static final AtomicInteger b = new AtomicInteger(0);
+ private static final Logger c = LogManager.getLogger();
+ private static final Random random = new Random();
+ private final byte[] e = new byte[4];
+ private final MinecraftServer server;
+ public final NetworkManager networkManager;
+ private EnumProtocolState g;
+ private int h;
+ private GameProfile i;
+ private String j;
+ private SecretKey loginKey;
+ public String hostname = ""; // CraftBukkit - add field
+
+ public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
+ this.g = EnumProtocolState.HELLO;
+ this.j = "";
+ this.server = minecraftserver;
+ this.networkManager = networkmanager;
+ random.nextBytes(this.e);
+ }
+
+ public void a() {
+ if (this.g == EnumProtocolState.READY_TO_ACCEPT) {
+ this.c();
+ }
+
+ if (this.h++ == 600) {
+ this.disconnect("Took too long to log in");
+ }
+ }
+
+ public void disconnect(String s) {
+ try {
+ c.info("Disconnecting " + this.getName() + ": " + s);
+ ChatComponentText chatcomponenttext = new ChatComponentText(s);
+
+ this.networkManager.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
+ this.networkManager.a((IChatBaseComponent) chatcomponenttext);
+ } catch (Exception exception) {
+ c.error("Error whilst disconnecting player", exception);
+ }
+ }
+
+ public void c() {
+ if (!this.i.isComplete()) {
+ UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + this.i.getName()).getBytes(Charsets.UTF_8));
+
+ this.i = new GameProfile(uuid.toString().replaceAll("-", ""), this.i.getName());
+ }
+
+ // CraftBukkit start
+ EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, this.hostname);
+
+ if (s == null) {
+ // this.disconnect(s);
+ // CraftBukkit end
+ } else {
+ this.g = EnumProtocolState.e;
+ this.networkManager.handle(new PacketLoginOutSuccess(this.i), new GenericFutureListener[0]);
+ this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference
+ }
+ }
+
+ public void a(IChatBaseComponent ichatbasecomponent) {
+ c.info(this.getName() + " lost connection: " + ichatbasecomponent.c());
+ }
+
+ public String getName() {
+ return this.i != null ? this.i.toString() + " (" + this.networkManager.getSocketAddress().toString() + ")" : String.valueOf(this.networkManager.getSocketAddress());
+ }
+
+ public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) {
+ Validate.validState(this.g == EnumProtocolState.e || this.g == EnumProtocolState.HELLO, "Unexpected change in protocol", new Object[0]);
+ Validate.validState(enumprotocol1 == EnumProtocol.PLAY || enumprotocol1 == EnumProtocol.LOGIN, "Unexpected protocol " + enumprotocol1, new Object[0]);
+ }
+
+ public void a(PacketLoginInStart packetlogininstart) {
+ Validate.validState(this.g == EnumProtocolState.HELLO, "Unexpected hello packet", new Object[0]);
+ this.i = packetlogininstart.c();
+ if (this.server.getOnlineMode() && !this.networkManager.c()) {
+ this.g = EnumProtocolState.KEY;
+ this.networkManager.handle(new PacketLoginOutEncryptionBegin(this.j, this.server.I().getPublic(), this.e), new GenericFutureListener[0]);
+ } else {
+ this.g = EnumProtocolState.READY_TO_ACCEPT;
+ }
+ }
+
+ public void a(PacketLoginInEncryptionBegin packetlogininencryptionbegin) {
+ Validate.validState(this.g == EnumProtocolState.KEY, "Unexpected key packet", new Object[0]);
+ PrivateKey privatekey = this.server.I().getPrivate();
+
+ if (!Arrays.equals(this.e, packetlogininencryptionbegin.b(privatekey))) {
+ throw new IllegalStateException("Invalid nonce!");
+ } else {
+ this.loginKey = packetlogininencryptionbegin.a(privatekey);
+ this.g = EnumProtocolState.AUTHENTICATING;
+ this.networkManager.a(this.loginKey);
+ (new ThreadPlayerLookupUUID(this, "User Authenticator #" + b.incrementAndGet())).start();
+ }
+ }
+
+ static String a(LoginListener loginlistener) {
+ return loginlistener.j;
+ }
+
+ static MinecraftServer b(LoginListener loginlistener) {
+ return loginlistener.server;
+ }
+
+ static SecretKey c(LoginListener loginlistener) {
+ return loginlistener.loginKey;
+ }
+
+ static GameProfile a(LoginListener loginlistener, GameProfile gameprofile) {
+ return loginlistener.i = gameprofile;
+ }
+
+ static GameProfile d(LoginListener loginlistener) {
+ return loginlistener.i;
+ }
+
+ static Logger e() {
+ return c;
+ }
+
+ static EnumProtocolState a(LoginListener loginlistener, EnumProtocolState enumprotocolstate) {
+ return loginlistener.g = enumprotocolstate;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MethodProfiler.java b/src/main/java/net/minecraft/server/MethodProfiler.java
index e56157cbdc..7285e09e16 100644
--- a/src/main/java/net/minecraft/server/MethodProfiler.java
+++ b/src/main/java/net/minecraft/server/MethodProfiler.java
@@ -7,6 +7,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start - Strip down to empty methods, performance cost
public class MethodProfiler {
public boolean a = false;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 029131d2f5..cdc41b41a5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,17 +1,33 @@
package net.minecraft.server;
import java.awt.GraphicsEnvironment;
+import java.awt.image.BufferedImage;
import java.io.File;
import java.net.Proxy;
import java.security.KeyPair;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
+import java.util.Random;
+import java.util.UUID;
import java.util.concurrent.Callable;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import javax.imageio.ImageIO;
+
+import net.minecraft.util.com.google.common.base.Charsets;
+import net.minecraft.util.com.mojang.authlib.GameProfile;
+import net.minecraft.util.com.mojang.authlib.minecraft.MinecraftSessionService;
+import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import net.minecraft.util.io.netty.buffer.ByteBuf;
+import net.minecraft.util.io.netty.buffer.ByteBufOutputStream;
+import net.minecraft.util.io.netty.buffer.Unpooled;
+import net.minecraft.util.io.netty.handler.codec.base64.Base64;
+import net.minecraft.util.org.apache.commons.lang3.Validate;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
// CraftBukkit start
import java.io.IOException;
@@ -27,13 +43,17 @@ import org.bukkit.event.world.WorldSaveEvent;
public abstract class MinecraftServer implements ICommandListener, Runnable, IMojangStatistics {
- private static MinecraftServer l;
+ private static final Logger h = LogManager.getLogger();
+ private static MinecraftServer i;
public Convertable convertable; // CraftBukkit - private final -> public
- private final MojangStatisticsGenerator n = new MojangStatisticsGenerator("server", this, aq());
+ private final MojangStatisticsGenerator k = new MojangStatisticsGenerator("server", this, ap());
public File universe; // CraftBukkit - private final -> public
- private final List p = new ArrayList();
- private final ICommandHandler q;
+ private final List m = new ArrayList();
+ private final ICommandHandler n;
public final MethodProfiler methodProfiler = new MethodProfiler();
+ private final ServerConnection o;
+ private final ServerPing p = new ServerPing();
+ private final Random q = new Random();
private String serverIp;
private int s = -1;
public WorldServer[] worldServer;
@@ -41,7 +61,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
private boolean isRunning = true;
private boolean isStopped;
private int ticks;
- protected Proxy c;
+ protected final Proxy c;
public String d;
public int e;
private boolean onlineMode;
@@ -51,29 +71,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
private boolean allowFlight;
private String motd;
private int D;
- private int E;
- private long F;
- private long G;
- private long H;
- private long I;
- public final long[] f;
- public final long[] g;
- public final long[] h;
- public final long[] i;
- public final long[] j;
- public long[][] k;
- private KeyPair J;
- private String K;
- private String L;
+ private int E = 0;
+ public final long[] f = new long[100];
+ public long[][] g;
+ private KeyPair F;
+ private String G;
+ private String H;
private boolean demoMode;
- private boolean O;
- private boolean P;
- private String Q;
+ private boolean K;
+ private boolean L;
+ private String M = "";
+ private boolean N;
+ private long O;
+ private String P;
+ private boolean Q;
private boolean R;
- private long S;
- private String T;
- private boolean U;
- private boolean V;
+ private final MinecraftSessionService S;
+ private long T = 0L;
// CraftBukkit start
public List worlds = new ArrayList();
@@ -88,20 +102,14 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public int autosavePeriod;
// CraftBukkit end
- public MinecraftServer(OptionSet options) { // CraftBukkit - signature file -> OptionSet
- this.c = Proxy.NO_PROXY;
- this.E = 0;
- this.f = new long[100];
- this.g = new long[100];
- this.h = new long[100];
- this.i = new long[100];
- this.j = new long[100];
- this.Q = "";
- l = this;
+ public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet
+ i = this;
+ this.c = proxy;
// this.universe = file1; // CraftBukkit
- this.q = new CommandDispatcher();
- // this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved to DedicatedServer.init
- this.as();
+ this.o = new ServerConnection(this);
+ this.n = new CommandDispatcher();
+ // this.convertable = new WorldLoaderServer(file1); // CraftBukkit - moved to DedicatedServer.init
+ this.S = (new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
// CraftBukkit start
this.options = options;
@@ -117,7 +125,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.reader = new ConsoleReader(System.in, System.out);
this.reader.setExpandEvents(false);
} catch (IOException ex) {
- Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex);
+ h.warn((String) null, ex);
}
}
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
@@ -128,32 +136,41 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public abstract PropertyManager getPropertyManager();
// CraftBukkit end
- private void as() {
- DispenserRegistry.a();
- }
-
protected abstract boolean init() throws java.net.UnknownHostException; // CraftBukkit - throws UnknownHostException
protected void a(String s) {
if (this.getConvertable().isConvertable(s)) {
- this.getLogger().info("Converting map!");
+ h.info("Converting map!");
this.b("menu.convertingLevel");
this.getConvertable().convert(s, new ConvertProgressUpdater(this));
}
}
protected synchronized void b(String s) {
- this.T = s;
+ this.P = s;
}
protected void a(String s, String s1, long i, WorldType worldtype, String s2) {
this.a(s);
this.b("menu.loadingLevel");
this.worldServer = new WorldServer[3];
- // CraftBukkit - Removed ticktime arrays
- IDataManager idatamanager = this.convertable.a(s, true);
- WorldData worlddata = idatamanager.getWorldData();
- // CraftBukkit start - Removed worldsettings
+ // this.g = new long[this.worldServer.length][100]; // CraftBukkit - Removed ticktime arrays
+ // IDataManager idatamanager = this.convertable.a(s, true);
+ // WorldData worlddata = idatamanager.getWorldData();
+ /* CraftBukkit start - Removed worldsettings
+ WorldSettings worldsettings;
+
+ if (worlddata == null) {
+ worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype);
+ worldsettings.a(s2);
+ } else {
+ worldsettings = new WorldSettings(worlddata);
+ }
+
+ if (this.K) {
+ worldsettings.a();
+ }
+ // */
int worldCount = 3;
for (int j = 0; j < worldCount; ++j) {
@@ -184,13 +201,14 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
worldsettings.a(s2);
if (j == 0) {
- if (this.O()) { // Strip out DEMO?
- // CraftBukkit
- world = new DemoWorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, this.methodProfiler, this.getLogger());
+ IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), s1, true);
+ if (this.P()) {
+ world = new DemoWorldServer(this, idatamanager, s1, dimension, this.methodProfiler);
} else {
- // CraftBukkit
- world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, worldsettings, this.methodProfiler, this.getLogger(), Environment.getEnvironment(dimension), gen);
+ // world =, b0 to dimension, added Environment and gen
+ world = new WorldServer(this, idatamanager, s1, dimension, worldsettings, this.methodProfiler, Environment.getEnvironment(dimension), gen);
}
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
} else {
String dim = "DIM" + dimension;
@@ -198,61 +216,60 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
File oldWorld = new File(new File(s), dim);
if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) {
- final IConsoleLogManager log = this.getLogger();
- log.info("---- Migration of old " + worldType + " folder required ----");
- log.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly.");
- log.info("We will move this folder for you, but it will mean that you need to move it back should you wish to stop using Bukkit in the future.");
- log.info("Attempting to move " + oldWorld + " to " + newWorld + "...");
+ h.info("---- Migration of old " + worldType + " folder required ----");
+ h.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly.");
+ h.info("We will move this folder for you, but it will mean that you need to move it back should you wish to stop using Bukkit in the future.");
+ h.info("Attempting to move " + oldWorld + " to " + newWorld + "...");
if (newWorld.exists()) {
- log.severe("A file or folder already exists at " + newWorld + "!");
- log.info("---- Migration of old " + worldType + " folder failed ----");
+ h.warn("A file or folder already exists at " + newWorld + "!");
+ h.info("---- Migration of old " + worldType + " folder failed ----");
} else if (newWorld.getParentFile().mkdirs()) {
if (oldWorld.renameTo(newWorld)) {
- log.info("Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld);
+ h.info("Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld);
// Migrate world data too.
try {
com.google.common.io.Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat"));
} catch (IOException exception) {
- log.severe("Unable to migrate world data.");
+ h.warn("Unable to migrate world data.");
}
- log.info("---- Migration of old " + worldType + " folder complete ----");
+ h.info("---- Migration of old " + worldType + " folder complete ----");
} else {
- log.severe("Could not move folder " + oldWorld + " to " + newWorld + "!");
- log.info("---- Migration of old " + worldType + " folder failed ----");
+ h.warn("Could not move folder " + oldWorld + " to " + newWorld + "!");
+ h.info("---- Migration of old " + worldType + " folder failed ----");
}
} else {
- log.severe("Could not create path for " + newWorld + "!");
- log.info("---- Migration of old " + worldType + " folder failed ----");
+ h.warn("Could not create path for " + newWorld + "!");
+ h.info("---- Migration of old " + worldType + " folder failed ----");
}
}
- // CraftBukkit
- world = new SecondaryWorldServer(this, new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, worldsettings, this.worlds.get(0), this.methodProfiler, this.getLogger(), Environment.getEnvironment(dimension), gen);
+ IDataManager idatamanager = new ServerNBTManager(server.getWorldContainer(), name, true);
+ // world =, b0 to dimension, s1 to name, added Environment and gen
+ world = new SecondaryWorldServer(this, idatamanager, name, dimension, worldsettings, this.worlds.get(0), this.methodProfiler, Environment.getEnvironment(dimension), gen);
}
if (gen != null) {
world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld()));
}
- this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
-
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
world.addIWorldAccess(new WorldManager(this, world));
- if (!this.K()) {
+ if (!this.L()) {
world.getWorldData().setGameType(this.getGamemode());
}
+
this.worlds.add(world);
this.t.setPlayerFileData(this.worlds.toArray(new WorldServer[this.worlds.size()]));
// CraftBukkit end
}
- this.c(this.getDifficulty());
- this.f();
+ this.a(this.getDifficulty());
+ this.g();
}
- protected void f() {
+ protected void g() {
boolean flag = true;
boolean flag1 = true;
boolean flag2 = true;
@@ -265,18 +282,18 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// CraftBukkit start
for (int m = 0; m < this.worlds.size(); ++m) {
WorldServer worldserver = this.worlds.get(m);
- this.getLogger().info("Preparing start region for level " + m + " (Seed: " + worldserver.getSeed() + ")");
+ h.info("Preparing start region for level " + m + " (Seed: " + worldserver.getSeed() + ")");
if (!worldserver.getWorld().getKeepSpawnInMemory()) {
continue;
}
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
- long j = aq();
+ long j = ap();
i = 0;
for (int k = -192; k <= 192 && this.isRunning(); k += 16) {
for (int l = -192; l <= 192 && this.isRunning(); l += 16) {
- long i1 = aq();
+ long i1 = ap();
if (i1 - j > 1000L) {
this.a_("Preparing spawn area", i * 100 / 625);
@@ -289,26 +306,26 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
}
// CraftBukkit end
- this.l();
+ this.m();
}
public abstract boolean getGenerateStructures();
public abstract EnumGamemode getGamemode();
- public abstract int getDifficulty();
+ public abstract EnumDifficulty getDifficulty();
public abstract boolean isHardcore();
- public abstract int k();
+ public abstract int l();
protected void a_(String s, int i) {
this.d = s;
this.e = i;
- this.getLogger().info(s + ": " + i + "%");
+ h.info(s + ": " + i + "%");
}
- protected void l() {
+ protected void m() {
this.d = null;
this.e = 0;
@@ -316,14 +333,17 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws
- if (!this.P) {
+ if (!this.L) {
// CraftBukkit start
- for (int j = 0; j < this.worlds.size(); ++j) {
+ // WorldServer[] aworldserver = this.worldServer;
+ int i = this.worlds.size();
+
+ for (int j = 0; j < i; ++j) {
WorldServer worldserver = this.worlds.get(j);
if (worldserver != null) {
if (!flag) {
- this.getLogger().info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName());
+ h.info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName());
}
worldserver.save(true, (IProgressUpdate) null);
@@ -331,15 +351,15 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld());
this.server.getPluginManager().callEvent(event);
+ // CraftBukkit end
}
}
- // CraftBukkit end
}
}
public void stop() throws ExceptionWorldConflict { // CraftBukkit - added throws
- if (!this.P) {
- this.getLogger().info("Stopping server");
+ if (!this.L) {
+ h.info("Stopping server");
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -347,16 +367,16 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// CraftBukkit end
if (this.ag() != null) {
- this.ag().a();
+ this.ag().b();
}
if (this.t != null) {
- this.getLogger().info("Saving players");
+ h.info("Saving players");
this.t.savePlayers();
this.t.r();
}
- this.getLogger().info("Saving worlds");
+ h.info("Saving worlds");
this.saveChunks(false);
/* CraftBukkit start - Handled in saveChunks
@@ -366,8 +386,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
worldserver.saveLevel();
}
// CraftBukkit end */
- if (this.n != null && this.n.d()) {
- this.n.e();
+
+ if (this.k.d()) {
+ this.k.e();
}
}
}
@@ -391,45 +412,50 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public void run() {
try {
if (this.init()) {
- long i = aq();
+ long i = ap();
+ long j = 0L;
- for (long j = 0L; this.isRunning; this.R = true) {
- long k = aq();
+ this.p.setMOTD(new ChatComponentText(this.motd));
+ this.p.setServerInfo(new ServerPingServerData("1.7.2", 4));
+ this.a(this.p);
+
+ while (this.isRunning) {
+ long k = ap();
long l = k - i;
- if (l > 2000L && i - this.S >= 15000L) {
+ if (l > 2000L && i - this.O >= 15000L) {
if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages
- this.getLogger().warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
+ h.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(l), Long.valueOf(l / 50L)});
l = 2000L;
- this.S = i;
+ this.O = i;
}
if (l < 0L) {
- this.getLogger().warning("Time ran backwards! Did the system time change?");
+ h.warn("Time ran backwards! Did the system time change?");
l = 0L;
}
j += l;
i = k;
if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
- this.s();
+ this.t();
j = 0L;
} else {
while (j > 50L) {
MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
j -= 50L;
- this.s();
+ this.t();
}
}
Thread.sleep(1L);
+ this.N = true;
}
} else {
this.a((CrashReport) null);
}
} catch (Throwable throwable) {
- throwable.printStackTrace();
- this.getLogger().severe("Encountered an unexpected exception " + throwable.getClass().getSimpleName(), throwable);
+ h.error("Encountered an unexpected exception", throwable);
CrashReport crashreport = null;
if (throwable instanceof ReportedException) {
@@ -438,12 +464,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
crashreport = this.b(new CrashReport("Exception in server tick loop", throwable));
}
- File file1 = new File(new File(this.q(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
+ File file1 = new File(new File(this.r(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
- if (crashreport.a(file1, this.getLogger())) {
- this.getLogger().severe("This crash report has been saved to: " + file1.getAbsolutePath());
+ if (crashreport.a(file1)) {
+ h.error("This crash report has been saved to: " + file1.getAbsolutePath());
} else {
- this.getLogger().severe("We were unable to save this crash report to disk.");
+ h.error("We were unable to save this crash report to disk.");
}
this.a(crashreport);
@@ -452,7 +478,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.stop();
this.isStopped = true;
} catch (Throwable throwable1) {
- throwable1.printStackTrace();
+ h.error("Exception stopping the server", throwable1);
} finally {
// CraftBukkit start - Restore terminal to original settings
try {
@@ -460,32 +486,67 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
} catch (Exception e) {
}
// CraftBukkit end
- this.r();
+ this.s();
}
}
}
- protected File q() {
+ private void a(ServerPing serverping) {
+ File file1 = this.d("server-icon.png");
+
+ if (file1.isFile()) {
+ ByteBuf bytebuf = Unpooled.buffer();
+
+ try {
+ BufferedImage bufferedimage = ImageIO.read(file1);
+
+ Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
+ Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
+ ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
+ ByteBuf bytebuf1 = Base64.encode(bytebuf);
+
+ serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
+ } catch (Exception exception) {
+ h.error("Couldn\'t load server icon", exception);
+ }
+ }
+ }
+
+ protected File r() {
return new File(".");
}
protected void a(CrashReport crashreport) {}
- protected void r() {}
+ protected void s() {}
- protected void s() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ protected void t() throws ExceptionWorldConflict { // CraftBukkit - added throws
long i = System.nanoTime();
AxisAlignedBB.a().a();
++this.ticks;
- if (this.U) {
- this.U = false;
+ if (this.Q) {
+ this.Q = false;
this.methodProfiler.a = true;
this.methodProfiler.a();
}
this.methodProfiler.a("root");
- this.t();
+ this.u();
+ if (i - this.T >= 5000000000L) {
+ this.T = i;
+ this.p.setPlayerSample(new ServerPingPlayerSample(this.C(), this.B()));
+ GameProfile[] agameprofile = new GameProfile[Math.min(this.B(), 12)];
+ int j = MathHelper.nextInt(this.q, 0, this.B() - agameprofile.length);
+
+ for (int k = 0; k < agameprofile.length; ++k) {
+ agameprofile[k] = ((EntityPlayer) this.t.players.get(j + k)).getProfile();
+ }
+
+ Collections.shuffle(Arrays.asList(agameprofile));
+ this.p.b().a(agameprofile);
+ }
+
if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit
this.methodProfiler.a("save");
this.t.savePlayers();
@@ -494,30 +555,22 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
this.methodProfiler.a("tallying");
- this.j[this.ticks % 100] = System.nanoTime() - i;
- this.f[this.ticks % 100] = Packet.q - this.F;
- this.F = Packet.q;
- this.g[this.ticks % 100] = Packet.r - this.G;
- this.G = Packet.r;
- this.h[this.ticks % 100] = Packet.o - this.H;
- this.H = Packet.o;
- this.i[this.ticks % 100] = Packet.p - this.I;
- this.I = Packet.p;
+ this.f[this.ticks % 100] = System.nanoTime() - i;
this.methodProfiler.b();
this.methodProfiler.a("snooper");
- if (!this.n.d() && this.ticks > 100) {
- this.n.a();
+ if (!this.k.d() && this.ticks > 100) {
+ this.k.a();
}
if (this.ticks % 6000 == 0) {
- this.n.b();
+ this.k.b();
}
this.methodProfiler.b();
this.methodProfiler.b();
}
- public void t() {
+ public void u() {
this.methodProfiler.a("levels");
// CraftBukkit start
@@ -534,7 +587,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
- entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time
}
}
@@ -553,7 +606,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
/* Drop global time updates
if (this.ticks % 20 == 0) {
this.methodProfiler.a("timeSync");
- this.t.a(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.worldProvider.dimension);
+ this.t.a(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.worldProvider.dimension);
this.methodProfiler.b();
}
// CraftBukkit end */
@@ -585,17 +638,17 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.methodProfiler.b();
// } // CraftBukkit
- // this.k[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
+ // this.g[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
}
this.methodProfiler.c("connection");
- this.ag().b();
+ this.ag().c();
this.methodProfiler.c("players");
this.t.tick();
this.methodProfiler.c("tickables");
- for (i = 0; i < this.p.size(); ++i) {
- ((IUpdatePlayerListBox) this.p.get(i)).a();
+ for (i = 0; i < this.m.size(); ++i) {
+ ((IUpdatePlayerListBox) this.m.get(i)).a();
}
this.methodProfiler.b();
@@ -606,12 +659,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
- this.p.add(iupdateplayerlistbox);
+ this.m.add(iupdateplayerlistbox);
}
public static void main(final OptionSet options) { // CraftBukkit - replaces main(String[] astring)
- StatisticList.a();
- IConsoleLogManager iconsolelogmanager = null;
+ DispenserRegistry.b();
try {
/* CraftBukkit start - Replace everything
@@ -659,26 +711,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
++j;
}
}
- // */
- DedicatedServer dedicatedserver = new DedicatedServer(options);
+ DedicatedServer dedicatedserver = new DedicatedServer(new File(s1));
- iconsolelogmanager = dedicatedserver.getLogger();
- 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.k((String) options.valueOf("world"));
- }
- /*
if (s != null) {
dedicatedserver.j(s);
}
@@ -700,36 +735,49 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
if (flag) {
- dedicatedserver.au();
+ dedicatedserver.ay();
+ }
+ // */
+
+ 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.k((String) options.valueOf("world"));
}
- */
dedicatedserver.primaryThread.start();
- // Runtime.getRuntime().addShutdownHook(new ThreadShutdown(dedicatedserver));
+ // Runtime.getRuntime().addShutdownHook(new ThreadShutdown("Server Shutdown Thread", dedicatedserver));
// CraftBukkit end
} catch (Exception exception) {
- if (iconsolelogmanager != null) {
- iconsolelogmanager.severe("Failed to start the minecraft server", exception);
- } else {
- Logger.getAnonymousLogger().log(Level.SEVERE, "Failed to start the minecraft server", exception);
- }
+ h.fatal("Failed to start the minecraft server", exception);
}
}
- public void v() {
+ public void w() {
// (new ThreadServerApplication(this, "Server thread")).start(); // CraftBukkit - prevent abuse
}
public File d(String s) {
- return new File(this.q(), s);
+ return new File(this.r(), s);
}
public void info(String s) {
- this.getLogger().info(s);
+ h.info(s);
}
public void warning(String s) {
- this.getLogger().warning(s);
+ h.warn(s);
}
public WorldServer getWorldServer(int i) {
@@ -744,27 +792,27 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// CraftBukkit end
}
- public String w() {
+ public String x() {
return this.serverIp;
}
- public int x() {
+ public int y() {
return this.s;
}
- public String y() {
+ public String z() {
return this.motd;
}
public String getVersion() {
- return "1.6.4";
- }
-
- public int A() {
- return this.t.getPlayerCount();
+ return "1.7.2";
}
public int B() {
+ return this.t.getPlayerCount();
+ }
+
+ public int C() {
return this.t.getMaxPlayers();
}
@@ -800,19 +848,19 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
// CraftBukkit start
- public String g(final String s) { // CraftBukkit - final parameter
+ public String g(final String s) { // final parameter
Waitable waitable = new Waitable() {
@Override
protected String evaluate() {
- RemoteControlCommandListener.instance.d();
+ RemoteControlCommandListener.instance.e();
// Event changes start
RemoteServerCommandEvent event = new RemoteServerCommandEvent(MinecraftServer.this.remoteConsole, s);
MinecraftServer.this.server.getPluginManager().callEvent(event);
// Event changes end
ServerCommand servercommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.instance);
- // this.p.a(RemoteControlCommandListener.instance, s);
MinecraftServer.this.server.dispatchServerCommand(MinecraftServer.this.remoteConsole, servercommand); // CraftBukkit
- return RemoteControlCommandListener.instance.e();
+ // this.n.a(RemoteControlCommandListener.instance, s);
+ return RemoteControlCommandListener.instance.f();
}};
processQueue.add(waitable);
try {
@@ -831,12 +879,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void h(String s) {
- this.getLogger().severe(s);
+ h.error(s);
}
public void i(String s) {
if (this.isDebugging()) {
- this.getLogger().info(s);
+ h.info(s);
}
}
@@ -865,7 +913,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (s.startsWith("/")) {
s = s.substring(1);
boolean flag = !s.contains(" ");
- List list = this.p.b(icommandlistener, s);
+ List list = this.n.b(icommandlistener, s);
if (list != null) {
Iterator iterator = list.iterator();
@@ -885,7 +933,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
} else {
String[] astring = s.split(" ", -1);
String s2 = astring[astring.length - 1];
- String[] astring1 = this.s.d();
+ String[] astring1 = this.t.d();
int i = astring1.length;
for (int j = 0; j < i; ++j) {
@@ -904,15 +952,15 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public static MinecraftServer getServer() {
- return l;
+ return i;
}
public String getName() {
return "Server";
}
- public void sendMessage(ChatMessage chatmessage) {
- this.getLogger().info(chatmessage.toString());
+ public void sendMessage(IChatBaseComponent ichatbasecomponent) {
+ h.info(ichatbasecomponent.c());
}
public boolean a(int i, String s) {
@@ -920,14 +968,14 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public ICommandHandler getCommandHandler() {
- return this.q;
+ return this.n;
}
- public KeyPair H() {
- return this.J;
+ public KeyPair I() {
+ return this.F;
}
- public int I() {
+ public int J() {
return this.s;
}
@@ -935,31 +983,31 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.s = i;
}
- public String J() {
- return this.K;
+ public String K() {
+ return this.G;
}
public void j(String s) {
- this.K = s;
+ this.G = s;
}
- public boolean K() {
- return this.K != null;
+ public boolean L() {
+ return this.G != null;
}
- public String L() {
- return this.L;
+ public String M() {
+ return this.H;
}
public void k(String s) {
- this.L = s;
+ this.H = s;
}
public void a(KeyPair keypair) {
- this.J = keypair;
+ this.F = keypair;
}
- public void c(int i) {
+ public void a(EnumDifficulty enumdifficulty) {
// CraftBukkit start
for (int j = 0; j < this.worlds.size(); ++j) {
WorldServer worldserver = this.worlds.get(j);
@@ -967,13 +1015,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (worldserver != null) {
if (worldserver.getWorldData().isHardcore()) {
- worldserver.difficulty = 3;
+ worldserver.difficulty = EnumDifficulty.HARD;
worldserver.setSpawnFlags(true, true);
- } else if (this.K()) {
- worldserver.difficulty = i;
- worldserver.setSpawnFlags(worldserver.difficulty > 0, true);
+ } else if (this.L()) {
+ worldserver.difficulty = enumdifficulty;
+ worldserver.setSpawnFlags(worldserver.difficulty != EnumDifficulty.PEACEFUL, true);
} else {
- worldserver.difficulty = i;
+ worldserver.difficulty = enumdifficulty;
worldserver.setSpawnFlags(this.getSpawnMonsters(), this.spawnAnimals);
}
}
@@ -984,7 +1032,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return true;
}
- public boolean O() {
+ public boolean P() {
return this.demoMode;
}
@@ -993,18 +1041,18 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void c(boolean flag) {
- this.O = flag;
+ this.K = flag;
}
public Convertable getConvertable() {
return this.convertable;
}
- public void R() {
- this.P = true;
+ public void S() {
+ this.L = true;
this.getConvertable().d();
- // CraftBukkit start - This needs review, what does it do? (it's new)
+ // CraftBukkit start
for (int i = 0; i < this.worlds.size(); ++i) {
WorldServer worldserver = this.worlds.get(i);
// CraftBukkit end
@@ -1018,54 +1066,50 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.safeShutdown();
}
- public String getTexturePack() {
- return this.Q;
+ public String getResourcePack() {
+ return this.M;
}
public void setTexturePack(String s) {
- this.Q = s;
+ this.M = 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.A()));
- mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.B()));
+ mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.B()));
+ mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.C()));
mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.t.getSeenPlayers().length));
mojangstatisticsgenerator.a("uses_auth", Boolean.valueOf(this.onlineMode));
mojangstatisticsgenerator.a("gui_state", this.ai() ? "enabled" : "disabled");
- mojangstatisticsgenerator.a("run_time", Long.valueOf((aq() - mojangstatisticsgenerator.g()) / 60L * 1000L));
- 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)));
+ mojangstatisticsgenerator.a("run_time", Long.valueOf((ap() - mojangstatisticsgenerator.g()) / 60L * 1000L));
+ mojangstatisticsgenerator.a("avg_tick_ms", Integer.valueOf((int) (MathHelper.a(this.f) * 1.0E-6D)));
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);
+ WorldServer worldserver = this.worlds.get(j);
+ if (worldServer != null) {
// 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 + "][difficulty]", 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.L().getLoadedChunks()));
+ mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.K().getLoadedChunks()));
++i;
- // } // CraftBukkit
+ }
}
mojangstatisticsgenerator.a("worlds", Integer.valueOf(i));
}
public void b(MojangStatisticsGenerator mojangstatisticsgenerator) {
- mojangstatisticsgenerator.a("singleplayer", Boolean.valueOf(this.K()));
+ mojangstatisticsgenerator.a("singleplayer", Boolean.valueOf(this.L()));
mojangstatisticsgenerator.a("server_brand", this.getServerModName());
mojangstatisticsgenerator.a("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
mojangstatisticsgenerator.a("dedicated", Boolean.valueOf(this.V()));
@@ -1075,10 +1119,6 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return true;
}
- public int U() {
- return 16;
- }
-
public abstract boolean V();
public boolean getOnlineMode() {
@@ -1135,7 +1175,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return this.D;
}
- public void d(int i) {
+ public void c(int i) {
this.D = i;
}
@@ -1159,7 +1199,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
}
- public abstract ServerConnection ag();
+ public ServerConnection ag() {
+ return this.o;
+ }
public boolean ai() {
return false;
@@ -1172,14 +1214,14 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void ak() {
- this.U = true;
+ this.Q = true;
}
- public ChunkCoordinates b() {
+ public ChunkCoordinates getChunkCoordinates() {
return new ChunkCoordinates(0, 0, 0);
}
- public World f_() {
+ public World getWorld() {
return this.worlds.get(0); // CraftBukkit
}
@@ -1191,32 +1233,54 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return false;
}
- public abstract IConsoleLogManager getLogger();
-
public void setForceGamemode(boolean flag) {
- this.V = flag;
+ this.R = flag;
}
public boolean getForceGamemode() {
- return this.V;
+ return this.R;
}
- public Proxy ap() {
+ public Proxy ao() {
return this.c;
}
- public static long aq() {
+ public static long ap() {
return System.currentTimeMillis();
}
- public int ar() {
+ public int aq() {
return this.E;
}
- public void e(int i) {
+ public void d(int i) {
this.E = i;
}
+ public IChatBaseComponent getScoreboardDisplayName() {
+ return new ChatComponentText(this.getName());
+ }
+
+ public boolean ar() {
+ return true;
+ }
+
+ public MinecraftSessionService as() {
+ return this.S;
+ }
+
+ public ServerPing at() {
+ return this.p;
+ }
+
+ public void au() {
+ this.T = 0L;
+ }
+
+ public static Logger av() {
+ return h;
+ }
+
public static PlayerList 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 8e494f75e1..c6effa9f2f 100644
--- a/src/main/java/net/minecraft/server/MobEffectList.java
+++ b/src/main/java/net/minecraft/server/MobEffectList.java
@@ -1,11 +1,12 @@
package net.minecraft.server;
-import com.google.common.collect.Maps;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import java.util.Map.Entry;
+import net.minecraft.util.com.google.common.collect.Maps;
+
// CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
@@ -96,8 +97,8 @@ public class MobEffectList {
if (!entityliving.world.isStatic) {
((EntityHuman) entityliving).getFoodData().eat(i + 1, 1.0F);
}
- } else if ((this.id != HEAL.id || entityliving.aM()) && (this.id != HARM.id || !entityliving.aM())) {
- if (this.id == HARM.id && !entityliving.aM() || this.id == HEAL.id && entityliving.aM()) {
+ } else if ((this.id != HEAL.id || entityliving.aR()) && (this.id != HARM.id || !entityliving.aR())) {
+ if (this.id == HARM.id && !entityliving.aR() || this.id == HEAL.id && entityliving.aR()) {
entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
}
} else {
@@ -114,8 +115,8 @@ public class MobEffectList {
// CraftBukkit end
int j;
- if ((this.id != HEAL.id || entityliving1.aM()) && (this.id != HARM.id || !entityliving1.aM())) {
- if (this.id == HARM.id && !entityliving1.aM() || this.id == HEAL.id && entityliving1.aM()) {
+ if ((this.id != HEAL.id || entityliving1.aR()) && (this.id != HARM.id || !entityliving1.aR())) {
+ if (this.id == HARM.id && !entityliving1.aR() || this.id == HEAL.id && entityliving1.aR()) {
j = (int) (d0 * (double) (6 << i) + 0.5D);
if (entityliving == null) {
entityliving1.damageEntity(DamageSource.MAGIC, (float) j);
@@ -126,7 +127,7 @@ public class MobEffectList {
}
} else {
j = (int) (d0 * (double) (4 << i) + 0.5D);
- entityliving1.heal((float) j, RegainReason.MAGIC);
+ entityliving1.heal((float) j, RegainReason.MAGIC); // CraftBukkit
}
}
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 108b375b74..67c3397dd3 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -98,7 +98,7 @@ public abstract class MobSpawnerAbstract {
this.a(entity);
this.a().triggerEffect(2004, this.b(), this.c(), this.d(), 0);
if (entityinsentient != null) {
- entityinsentient.q();
+ entityinsentient.s();
}
flag = true;
@@ -120,9 +120,10 @@ public abstract class MobSpawnerAbstract {
Iterator iterator = this.i().b.c().iterator();
while (iterator.hasNext()) {
- NBTBase nbtbase = (NBTBase) iterator.next();
+ String s = (String) iterator.next();
+ NBTBase nbtbase = this.i().b.get(s);
- nbttagcompound.set(nbtbase.getName(), nbtbase.clone());
+ nbttagcompound.set(s, nbtbase.clone());
}
entity.f(nbttagcompound);
@@ -132,7 +133,7 @@ public abstract class MobSpawnerAbstract {
NBTTagCompound nbttagcompound1;
- for (Entity entity1 = entity; nbttagcompound.hasKey("Riding"); nbttagcompound = nbttagcompound1) {
+ for (Entity entity1 = entity; nbttagcompound.hasKeyOfType("Riding", 10); nbttagcompound = nbttagcompound1) {
nbttagcompound1 = nbttagcompound.getCompound("Riding");
Entity entity2 = EntityTypes.createEntityByName(nbttagcompound1.getString("id"), entity.world);
@@ -143,9 +144,10 @@ public abstract class MobSpawnerAbstract {
Iterator iterator1 = nbttagcompound1.c().iterator();
while (iterator1.hasNext()) {
- NBTBase nbtbase1 = (NBTBase) iterator1.next();
+ String s1 = (String) iterator1.next();
+ NBTBase nbtbase1 = nbttagcompound1.get(s1);
- nbttagcompound2.set(nbtbase1.getName(), nbtbase1.clone());
+ nbttagcompound2.set(s1, nbtbase1.clone());
}
entity2.f(nbttagcompound2);
@@ -186,35 +188,35 @@ public abstract class MobSpawnerAbstract {
public void a(NBTTagCompound nbttagcompound) {
this.mobName = nbttagcompound.getString("EntityId");
this.spawnDelay = nbttagcompound.getShort("Delay");
- if (nbttagcompound.hasKey("SpawnPotentials")) {
+ if (nbttagcompound.hasKeyOfType("SpawnPotentials", 9)) {
this.mobs = new ArrayList();
- NBTTagList nbttaglist = nbttagcompound.getList("SpawnPotentials");
+ NBTTagList nbttaglist = nbttagcompound.getList("SpawnPotentials", 10);
for (int i = 0; i < nbttaglist.size(); ++i) {
- this.mobs.add(new TileEntityMobSpawnerData(this, (NBTTagCompound) nbttaglist.get(i)));
+ this.mobs.add(new TileEntityMobSpawnerData(this, nbttaglist.get(i)));
}
} else {
this.mobs = null;
}
- if (nbttagcompound.hasKey("SpawnData")) {
+ if (nbttagcompound.hasKeyOfType("SpawnData", 10)) {
this.a(new TileEntityMobSpawnerData(this, nbttagcompound.getCompound("SpawnData"), this.mobName));
} else {
this.a((TileEntityMobSpawnerData) null);
}
- if (nbttagcompound.hasKey("MinSpawnDelay")) {
+ if (nbttagcompound.hasKeyOfType("MinSpawnDelay", 99)) {
this.minSpawnDelay = nbttagcompound.getShort("MinSpawnDelay");
this.maxSpawnDelay = nbttagcompound.getShort("MaxSpawnDelay");
this.spawnCount = nbttagcompound.getShort("SpawnCount");
}
- if (nbttagcompound.hasKey("MaxNearbyEntities")) {
+ if (nbttagcompound.hasKeyOfType("MaxNearbyEntities", 99)) {
this.maxNearbyEntities = nbttagcompound.getShort("MaxNearbyEntities");
this.requiredPlayerRange = nbttagcompound.getShort("RequiredPlayerRange");
}
- if (nbttagcompound.hasKey("SpawnRange")) {
+ if (nbttagcompound.hasKeyOfType("SpawnRange", 99)) {
this.spawnRange = nbttagcompound.getShort("SpawnRange");
}
@@ -233,7 +235,7 @@ public abstract class MobSpawnerAbstract {
nbttagcompound.setShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
nbttagcompound.setShort("SpawnRange", (short) this.spawnRange);
if (this.i() != null) {
- nbttagcompound.setCompound("SpawnData", (NBTTagCompound) this.i().b.clone());
+ nbttagcompound.set("SpawnData", this.i().b.clone());
}
if (this.i() != null || this.mobs != null && this.mobs.size() > 0) {
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index a2bdfa3256..8f829bb969 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -1,377 +1,198 @@
package net.minecraft.server;
-import java.io.BufferedOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.InputStream;
-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.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicInteger;
import javax.crypto.SecretKey;
-import java.io.IOException; // CraftBukkit
+import net.minecraft.util.com.google.common.collect.Queues;
+import net.minecraft.util.com.google.common.util.concurrent.ThreadFactoryBuilder;
+import net.minecraft.util.io.netty.channel.Channel;
+import net.minecraft.util.io.netty.channel.ChannelFutureListener;
+import net.minecraft.util.io.netty.channel.ChannelHandlerContext;
+import net.minecraft.util.io.netty.channel.SimpleChannelInboundHandler;
+import net.minecraft.util.io.netty.channel.local.LocalChannel;
+import net.minecraft.util.io.netty.channel.local.LocalServerChannel;
+import net.minecraft.util.io.netty.channel.nio.NioEventLoopGroup;
+import net.minecraft.util.io.netty.util.AttributeKey;
+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
+import net.minecraft.util.org.apache.commons.lang3.Validate;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.Marker;
+import org.apache.logging.log4j.MarkerManager;
-public class NetworkManager implements INetworkManager {
+public class NetworkManager extends SimpleChannelInboundHandler {
- public static AtomicInteger a = new AtomicInteger();
- public static AtomicInteger b = new AtomicInteger();
- private final Object h = new Object();
- private final IConsoleLogManager i;
- public Socket socket; // CraftBukkit - private -> public
- private final SocketAddress k;
- private volatile DataInputStream input;
- private volatile DataOutputStream output;
- private volatile boolean n = true;
- private volatile boolean o;
- private Queue inboundQueue = new ConcurrentLinkedQueue();
- private List highPriorityQueue = Collections.synchronizedList(new ArrayList());
- private List lowPriorityQueue = Collections.synchronizedList(new ArrayList());
- private Connection connection;
- private boolean t;
- private Thread u;
- private Thread v;
- private String w = "";
- private Object[] x;
- private int y;
- private int z;
- public static int[] c = new int[256];
- public static int[] d = new int[256];
- public int e;
- boolean f;
- boolean g;
- private SecretKey A;
- private PrivateKey B;
- private int lowPriorityQueueDelay = 50;
+ private static final Logger g = LogManager.getLogger();
+ public static final Marker a = MarkerManager.getMarker("NETWORK");
+ public static final Marker b = MarkerManager.getMarker("NETWORK_PACKETS", a);
+ public static final AttributeKey c = new AttributeKey("protocol");
+ public static final AttributeKey d = new AttributeKey("receivable_packets");
+ public static final AttributeKey e = new AttributeKey("sendable_packets");
+ public static final NioEventLoopGroup f = new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build());
+ private final boolean h;
+ private final Queue i = Queues.newConcurrentLinkedQueue();
+ private final Queue j = Queues.newConcurrentLinkedQueue();
+ private Channel k;
+ private SocketAddress l;
+ private PacketListener m;
+ private EnumProtocol n;
+ private IChatBaseComponent o;
- public NetworkManager(IConsoleLogManager iconsolelogmanager, Socket socket, String s, Connection connection, PrivateKey privatekey) throws IOException { // CraftBukkit - throws IOException
- this.B = privatekey;
- this.socket = socket;
- this.i = iconsolelogmanager;
- this.k = socket.getRemoteSocketAddress();
- this.connection = connection;
-
- try {
- socket.setSoTimeout(30000);
- socket.setTrafficClass(24);
- } catch (SocketException socketexception) {
- System.err.println(socketexception.getMessage());
- }
-
- this.input = new DataInputStream(socket.getInputStream());
- this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
- this.v = new NetworkReaderThread(this, s + " read thread");
- this.u = new NetworkWriterThread(this, s + " write thread");
- this.v.start();
- this.u.start();
+ public NetworkManager(boolean flag) {
+ this.h = flag;
}
- public void a(Connection connection) {
- this.connection = connection;
+ public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception { // CraftBukkit - throws Exception
+ super.channelActive(channelhandlercontext);
+ this.k = channelhandlercontext.channel();
+ this.l = this.k.remoteAddress();
+ this.a(EnumProtocol.HANDSHAKING);
}
- public void queue(Packet packet) {
- if (!this.t) {
- Object object = this.h;
+ public void a(EnumProtocol enumprotocol) {
+ this.n = (EnumProtocol) this.k.attr(c).getAndSet(enumprotocol);
+ this.k.attr(d).set(enumprotocol.a(this.h));
+ this.k.attr(e).set(enumprotocol.b(this.h));
+ this.k.config().setAutoRead(true);
+ g.debug("Enabled auto read");
+ }
- synchronized (this.h) {
- this.z += packet.a() + 1;
- this.highPriorityQueue.add(packet);
+ public void channelInactive(ChannelHandlerContext channelhandlercontext) {
+ this.a((IChatBaseComponent) (new ChatMessage("disconnect.endOfStream", new Object[0])));
+ }
+
+ public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) {
+ this.a((IChatBaseComponent) (new ChatMessage("disconnect.genericReason", new Object[] { "Internal Exception: " + throwable})));
+ }
+
+ protected void a(ChannelHandlerContext channelhandlercontext, Packet packet) {
+ if (this.k.isOpen()) {
+ if (packet.a()) {
+ packet.handle(this.m);
+ } else {
+ this.i.add(packet);
}
}
}
- private boolean h() {
- boolean flag = false;
-
- try {
- Packet packet;
- int i;
- int[] aint;
-
- if (this.e == 0 || !this.highPriorityQueue.isEmpty() && MinecraftServer.aq() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.e) {
- packet = this.a(false);
- if (packet != null) {
- Packet.a(packet, (DataOutput) this.output);
- if (packet instanceof Packet252KeyResponse && !this.g) {
- if (!this.connection.a()) {
- this.A = ((Packet252KeyResponse) packet).d();
- }
-
- this.k();
- }
-
- aint = d;
- i = packet.n();
- 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 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)) {
- packet = this.a(true);
- if (packet != null) {
- Packet.a(packet, (DataOutput) this.output);
- aint = d;
- i = packet.n();
- aint[i] += packet.a() + 1;
- this.lowPriorityQueueDelay = 0;
- flag = true;
- }
- }
-
- return flag;
- } catch (Exception exception) {
- if (!this.o) {
- this.a(exception);
- }
-
- return false;
- }
+ public void a(PacketListener packetlistener) {
+ Validate.notNull(packetlistener, "packetListener", new Object[0]);
+ g.debug("Set listener of {} to {}", new Object[] { this, packetlistener});
+ this.m = packetlistener;
}
- 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.z -= packet.a() + 1;
- if (this.a(packet, flag)) {
- packet = null;
- }
- }
-
- return packet;
- }
- }
-
- private boolean a(Packet packet, boolean flag) {
- if (!packet.e()) {
- return false;
+ public void handle(Packet packet, GenericFutureListener... agenericfuturelistener) {
+ if (this.k != null && this.k.isOpen()) {
+ this.h();
+ this.b(packet, agenericfuturelistener);
} else {
- List list = flag ? this.lowPriorityQueue : this.highPriorityQueue;
- Iterator iterator = list.iterator();
+ this.j.add(new QueuedPacket(packet, agenericfuturelistener));
+ }
+ }
- Packet packet1;
+ private void b(Packet packet, GenericFutureListener[] agenericfuturelistener) {
+ EnumProtocol enumprotocol = EnumProtocol.a(packet);
+ EnumProtocol enumprotocol1 = (EnumProtocol) this.k.attr(c).get();
- do {
- if (!iterator.hasNext()) {
- return false;
- }
+ if (enumprotocol1 != enumprotocol) {
+ g.debug("Disabled auto read");
+ this.k.config().setAutoRead(false);
+ }
- packet1 = (Packet) iterator.next();
- } while (packet1.n() != packet.n());
+ if (this.k.eventLoop().inEventLoop()) {
+ if (enumprotocol != enumprotocol1) {
+ this.a(enumprotocol);
+ }
- return packet.a(packet1);
+ this.k.writeAndFlush(packet).addListeners(agenericfuturelistener).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
+ } else {
+ this.k.eventLoop().execute(new QueuedProtocolSwitch(this, enumprotocol, enumprotocol1, packet, agenericfuturelistener));
+ }
+ }
+
+ private void h() {
+ if (this.k != null && this.k.isOpen()) {
+ while (!this.j.isEmpty()) {
+ QueuedPacket queuedpacket = (QueuedPacket) this.j.poll();
+
+ this.b(QueuedPacket.a(queuedpacket), QueuedPacket.b(queuedpacket));
+ }
}
}
public void a() {
- if (this.v != null) {
- this.v.interrupt();
+ this.h();
+ EnumProtocol enumprotocol = (EnumProtocol) this.k.attr(c).get();
+
+ if (this.n != enumprotocol) {
+ if (this.n != null) {
+ this.m.a(this.n, enumprotocol);
+ }
+
+ this.n = enumprotocol;
}
- if (this.u != null) {
- this.u.interrupt();
- }
- }
+ if (this.m != null) {
+ for (int i = 1000; !this.i.isEmpty() && i >= 0; --i) {
+ Packet packet = (Packet) this.i.poll();
- private boolean i() {
- boolean flag = false;
-
- try {
- Packet packet = Packet.a(this.i, this.input, this.connection.a(), this.socket);
-
- if (packet != null) {
- if (packet instanceof Packet252KeyResponse && !this.f) {
- if (this.connection.a()) {
- this.A = ((Packet252KeyResponse) packet).a(this.B);
- }
-
- this.j();
+ // CraftBukkit start
+ if (!this.d() || !this.k.config().isAutoRead()) { // Should be isConnected
+ continue;
}
+ // CraftBukkit end
- int[] aint = c;
- int i = packet.n();
-
- aint[i] += packet.a() + 1;
- if (!this.t) {
- if (packet.a_() && this.connection.b()) {
- this.y = 0;
- packet.handle(this.connection);
- } else {
- this.inboundQueue.add(packet);
- }
- }
-
- flag = true;
- } else {
- this.a("disconnect.endOfStream", new Object[0]);
+ packet.handle(this.m);
}
- return flag;
- } catch (Exception exception) {
- if (!this.o) {
- this.a(exception);
- }
-
- return false;
- }
- }
-
- private void a(Exception exception) {
- // exception.printStackTrace(); // CraftBukkit - Remove console spam
- this.a("disconnect.genericReason", new Object[] { "Internal exception: " + exception.toString()});
- }
-
- public void a(String s, Object... aobject) {
- if (this.n) {
- this.o = true;
- this.w = s;
- this.x = aobject;
- this.n = false;
- (new NetworkMasterThread(this)).start();
-
- try {
- this.input.close();
- } catch (Throwable throwable) {
- ;
- }
-
- try {
- this.output.close();
- } catch (Throwable throwable1) {
- ;
- }
-
- try {
- this.socket.close();
- } catch (Throwable throwable2) {
- ;
- }
-
- this.input = null;
- this.output = null;
- this.socket = null;
- }
- }
-
- public void b() {
- if (this.z > 2097152) {
- this.a("disconnect.overflow", new Object[0]);
+ this.m.a();
}
- if (this.inboundQueue.isEmpty()) {
- if (this.y++ == 1200) {
- this.a("disconnect.timeout", new Object[0]);
- }
- } else {
- this.y = 0;
- }
-
- int i = 1000;
-
- while (!this.inboundQueue.isEmpty() && i-- >= 0) {
- Packet packet = (Packet) this.inboundQueue.poll();
-
- // CraftBukkit start
- if (this.connection instanceof PendingConnection ? ((PendingConnection) this.connection).b : ((PlayerConnection) this.connection).disconnected) {
- continue;
- }
- // CraftBukkit end
-
- if (packet != null && !this.connection.c()) {
- packet.handle(this.connection);
- }
- }
-
- this.a();
- if (this.o && this.inboundQueue.isEmpty()) {
- this.connection.a(this.w, this.x);
- }
+ this.k.flush();
}
public SocketAddress getSocketAddress() {
- return this.k;
+ return this.l;
}
- public void d() {
- if (!this.t) {
- this.a();
- this.t = true;
- this.v.interrupt();
- (new NetworkMonitorThread(this)).start();
+ public void a(IChatBaseComponent ichatbasecomponent) {
+ if (this.k.isOpen()) {
+ this.k.close();
+ this.o = ichatbasecomponent;
}
}
- private void j() throws IOException { // CraftBukkit - throws IOException
- this.f = true;
- InputStream inputstream = this.socket.getInputStream();
-
- this.input = new DataInputStream(MinecraftEncryption.a(this.A, inputstream));
+ public boolean c() {
+ return this.k instanceof LocalChannel || this.k instanceof LocalServerChannel;
}
- private void k() throws IOException { // CraftBukkit - throws IOException
- this.output.flush();
- this.g = true;
- BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(MinecraftEncryption.a(this.A, this.socket.getOutputStream()), 5120);
-
- this.output = new DataOutputStream(bufferedoutputstream);
+ public void a(SecretKey secretkey) {
+ this.k.pipeline().addBefore("splitter", "decrypt", new PacketDecrypter(MinecraftEncryption.a(2, secretkey)));
+ this.k.pipeline().addBefore("prepender", "encrypt", new PacketEncrypter(MinecraftEncryption.a(1, secretkey)));
}
- public int e() {
- return this.lowPriorityQueue.size();
+ public boolean d() {
+ return this.k != null && this.k.isOpen();
}
- public Socket getSocket() {
- return this.socket;
+ public PacketListener getPacketListener() {
+ return this.m;
}
- static boolean a(NetworkManager networkmanager) {
- return networkmanager.n;
+ public IChatBaseComponent f() {
+ return this.o;
}
- static boolean b(NetworkManager networkmanager) {
- return networkmanager.t;
+ public void g() {
+ this.k.config().setAutoRead(false);
}
- static boolean c(NetworkManager networkmanager) {
- return networkmanager.i();
+ protected void channelRead0(ChannelHandlerContext channelhandlercontext, Object object) {
+ this.a(channelhandlercontext, (Packet) object);
}
- static boolean d(NetworkManager networkmanager) {
- return networkmanager.h();
- }
-
- static DataOutputStream e(NetworkManager networkmanager) {
- return networkmanager.output;
- }
-
- static boolean f(NetworkManager networkmanager) {
- return networkmanager.o;
- }
-
- static void a(NetworkManager networkmanager, Exception exception) {
- networkmanager.a(exception);
- }
-
- static Thread g(NetworkManager networkmanager) {
- return networkmanager.v;
- }
-
- static Thread h(NetworkManager networkmanager) {
- return networkmanager.u;
+ static Channel a(NetworkManager networkmanager) {
+ return networkmanager.k;
}
}
diff --git a/src/main/java/net/minecraft/server/NetworkWriterThread.java b/src/main/java/net/minecraft/server/NetworkWriterThread.java
deleted file mode 100644
index 68d84deb8a..0000000000
--- a/src/main/java/net/minecraft/server/NetworkWriterThread.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package net.minecraft.server;
-
-import java.io.IOException;
-
-class NetworkWriterThread extends Thread {
-
- final NetworkManager a;
-
- NetworkWriterThread(NetworkManager networkmanager, String s) {
- super(s);
- this.a = networkmanager;
- }
-
- public void run() {
- NetworkManager.b.getAndIncrement();
-
- try {
- while (NetworkManager.a(this.a)) {
- boolean flag;
-
- for (flag = false; NetworkManager.d(this.a); flag = true) {
- ;
- }
-
- try {
- if (flag && NetworkManager.e(this.a) != null) {
- NetworkManager.e(this.a).flush();
- }
- } catch (IOException ioexception) {
- if (!NetworkManager.f(this.a)) {
- NetworkManager.a(this.a, (Exception) ioexception);
- }
-
- // ioexception.printStackTrace(); // CraftBukkit - Don't spam console on unexpected disconnect
- }
-
- try {
- sleep(2L);
- } catch (InterruptedException interruptedexception) {
- ;
- }
- }
- } finally {
- NetworkManager.b.getAndDecrement();
- }
- }
-}
diff --git a/src/main/java/net/minecraft/server/NoteDataList.java b/src/main/java/net/minecraft/server/NoteDataList.java
index 79d09b487f..75e26bf4a1 100644
--- a/src/main/java/net/minecraft/server/NoteDataList.java
+++ b/src/main/java/net/minecraft/server/NoteDataList.java
@@ -3,7 +3,6 @@ package net.minecraft.server;
import java.util.ArrayList;
// CraftBukkit - imported class because the constructor is package private
-
class NoteDataList extends ArrayList {
private NoteDataList() {}
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index e7e1d73d11..592ffc585c 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -1,341 +1,63 @@
package net.minecraft.server;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.EOFException;
import java.io.IOException;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
+import net.minecraft.util.com.google.common.collect.BiMap;
+import net.minecraft.util.io.netty.buffer.ByteBuf;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public abstract class Packet {
- public static IntHashMap l = new IntHashMap();
- private static Map a = new HashMap();
- private static Set b = new HashSet();
- private static Set c = new HashSet();
- protected IConsoleLogManager m;
- public final long timestamp = MinecraftServer.aq();
- public static long o;
- public static long p;
- public static long q;
- public static long r;
- public boolean lowPriority;
- // CraftBukkit start - Calculate packet ID once - used a bunch of times
- private int packetID;
+ private static final Logger a = LogManager.getLogger();
+ public final long timestamp = System.currentTimeMillis(); // CraftBukkit
- public Packet() {
- packetID = ((Integer) a.get(this.getClass())).intValue();
- }
- // CraftBukkit end
+ public Packet() {}
- static void a(int i, boolean flag, boolean flag1, Class oclass) {
- if (l.b(i)) {
- throw new IllegalArgumentException("Duplicate packet id:" + i);
- } else if (a.containsKey(oclass)) {
- throw new IllegalArgumentException("Duplicate packet class:" + oclass);
- } else {
- l.a(i, oclass);
- a.put(oclass, Integer.valueOf(i));
- if (flag) {
- b.add(Integer.valueOf(i));
- }
-
- if (flag1) {
- c.add(Integer.valueOf(i));
- }
- }
- }
-
- public static Packet a(IConsoleLogManager iconsolelogmanager, int i) {
+ public static Packet a(BiMap bimap, int i) {
try {
- Class oclass = (Class) l.get(i);
+ Class oclass = (Class) bimap.get(Integer.valueOf(i));
return oclass == null ? null : (Packet) oclass.newInstance();
} catch (Exception exception) {
- exception.printStackTrace();
- iconsolelogmanager.severe("Skipping packet with id " + i);
+ a.error("Couldn\'t create packet " + i, exception);
return null;
}
}
- public static void a(DataOutput dataoutput, byte[] abyte) throws IOException { // CraftBukkit - throws IOException
- dataoutput.writeShort(abyte.length);
- dataoutput.write(abyte);
+ public static void a(ByteBuf bytebuf, byte[] abyte) {
+ bytebuf.writeShort(abyte.length);
+ bytebuf.writeBytes(abyte);
}
- public static byte[] b(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainput.readShort();
+ public static byte[] a(ByteBuf bytebuf) throws IOException { // CraftBukkit - added throws
+ short short1 = bytebuf.readShort();
if (short1 < 0) {
throw new IOException("Key was smaller than nothing! Weird key!");
} else {
byte[] abyte = new byte[short1];
- datainput.readFully(abyte);
+ bytebuf.readBytes(abyte);
return abyte;
}
}
- public final int n() {
- return packetID; // ((Integer) a.get(this.getClass())).intValue(); // CraftBukkit
- }
+ public abstract void a(PacketDataSerializer packetdataserializer) throws IOException; // CraftBukkit - added throws
- public static Packet a(IConsoleLogManager iconsolelogmanager, DataInput datainput, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException
- boolean flag1 = false;
- Packet packet = null;
- int i = socket.getSoTimeout();
+ public abstract void b(PacketDataSerializer packetdataserializer) throws IOException; // CraftBukkit - added throws
- int j;
+ public abstract void handle(PacketListener packetlistener);
- try {
- j = datainput.readUnsignedByte();
- if (flag && !c.contains(Integer.valueOf(j)) || !flag && !b.contains(Integer.valueOf(j))) {
- throw new IOException("Bad packet id " + j);
- }
-
- packet = a(iconsolelogmanager, j);
- if (packet == null) {
- throw new IOException("Bad packet id " + j);
- }
-
- packet.m = iconsolelogmanager;
- if (packet instanceof Packet254GetInfo) {
- socket.setSoTimeout(1500);
- }
-
- packet.a(datainput);
- ++o;
- p += (long) packet.a();
- } catch (EOFException eofexception) {
- //iconsolelogmanager.severe("Reached end of stream for " + socket.getInetAddress()); // CraftBukkit - remove unnecessary logging
- return null;
- }
-
- // CraftBukkit start
- catch (java.net.SocketTimeoutException exception) {
- iconsolelogmanager.info("Read timed out");
- return null;
- } catch (java.net.SocketException exception) {
- iconsolelogmanager.info("Connection reset");
- return null;
- }
- // CraftBukkit end
-
- PacketCounter.a(j, (long) packet.a());
- ++o;
- p += (long) packet.a();
- socket.setSoTimeout(i);
- return packet;
- }
-
- public static void a(Packet packet, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
- dataoutput.write(packet.n());
- packet.a(dataoutput);
- ++q;
- r += (long) packet.a();
- }
-
- public static void a(String s, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
- if (s.length() > 32767) {
- throw new IOException("String too big");
- } else {
- dataoutput.writeShort(s.length());
- dataoutput.writeChars(s);
- }
- }
-
- public static String a(DataInput datainput, int i) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainput.readShort();
-
- if (short1 > i) {
- throw new IOException("Received string length longer than maximum allowed (" + short1 + " > " + i + ")");
- } else if (short1 < 0) {
- throw new IOException("Received string length is less than zero! Weird string!");
- } else {
- StringBuilder stringbuilder = new StringBuilder();
-
- for (int j = 0; j < short1; ++j) {
- stringbuilder.append(datainput.readChar());
- }
-
- return stringbuilder.toString();
- }
- }
-
- public abstract void a(DataInput datainput) throws IOException; // CraftBukkit - throws IOException
-
- public abstract void a(DataOutput dataoutput) throws IOException; // CraftBukkit - throws IOException
-
- public abstract void handle(Connection connection);
-
- public abstract int a();
-
- public boolean e() {
+ public boolean a() {
return false;
}
- public boolean a(Packet packet) {
- return false;
- }
-
- public boolean a_() {
- return this instanceof Packet3Chat && !((Packet3Chat) this).message.startsWith("/"); // CraftBukkit - async chat
- }
-
public String toString() {
- String s = this.getClass().getSimpleName();
-
- return s;
+ return this.getClass().getSimpleName();
}
- public static ItemStack c(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
- ItemStack itemstack = null;
- short short1 = datainput.readShort();
-
- if (short1 >= 0) {
- byte b0 = datainput.readByte();
- short short2 = datainput.readShort();
-
- itemstack = new ItemStack(short1, b0, short2);
- itemstack.tag = d(datainput);
- // CraftBukkit start
- if (itemstack.tag != null) {
- CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
- }
- // CraftBukkit end
- }
-
- return itemstack;
- }
-
- public static void a(ItemStack itemstack, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
- if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
- dataoutput.writeShort(-1);
- } else {
- dataoutput.writeShort(itemstack.id);
- dataoutput.writeByte(itemstack.count);
- dataoutput.writeShort(itemstack.getData());
- NBTTagCompound nbttagcompound = null;
-
- if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) {
- nbttagcompound = itemstack.tag;
- }
-
- a(nbttagcompound, dataoutput);
- }
- }
-
- public static NBTTagCompound d(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainput.readShort();
-
- if (short1 < 0) {
- return null;
- } else {
- byte[] abyte = new byte[short1];
-
- datainput.readFully(abyte);
- return NBTCompressedStreamTools.a(abyte);
- }
- }
-
- protected static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
- if (nbttagcompound == null) {
- dataoutput.writeShort(-1);
- } else {
- byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
-
- dataoutput.writeShort((short) abyte.length);
- dataoutput.write(abyte);
- }
- }
-
- static {
- a(0, true, true, Packet0KeepAlive.class);
- a(1, true, true, Packet1Login.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);
- a(6, true, false, Packet6SpawnPosition.class);
- a(7, false, true, Packet7UseEntity.class);
- a(8, true, false, Packet8UpdateHealth.class);
- a(9, true, true, Packet9Respawn.class);
- a(10, true, true, Packet10Flying.class);
- a(11, true, true, Packet11PlayerPosition.class);
- a(12, true, true, Packet12PlayerLook.class);
- a(13, true, true, Packet13PlayerLookMove.class);
- a(14, false, true, Packet14BlockDig.class);
- a(15, false, true, Packet15Place.class);
- a(16, true, true, Packet16BlockItemSwitch.class);
- a(17, true, false, Packet17EntityLocationAction.class);
- a(18, true, true, Packet18ArmAnimation.class);
- a(19, false, true, Packet19EntityAction.class);
- a(20, true, false, Packet20NamedEntitySpawn.class);
- a(22, true, false, Packet22Collect.class);
- a(23, true, false, Packet23VehicleSpawn.class);
- a(24, true, false, Packet24MobSpawn.class);
- a(25, true, false, Packet25EntityPainting.class);
- a(26, true, false, Packet26AddExpOrb.class);
- a(27, false, true, Packet27PlayerInput.class);
- a(28, true, false, Packet28EntityVelocity.class);
- a(29, true, false, Packet29DestroyEntity.class);
- a(30, true, false, Packet30Entity.class);
- a(31, true, false, Packet31RelEntityMove.class);
- a(32, true, false, Packet32EntityLook.class);
- a(33, true, false, Packet33RelEntityMoveLook.class);
- a(34, true, false, Packet34EntityTeleport.class);
- a(35, true, false, Packet35EntityHeadRotation.class);
- a(38, true, false, Packet38EntityStatus.class);
- a(39, true, false, Packet39AttachEntity.class);
- a(40, true, false, Packet40EntityMetadata.class);
- a(41, true, false, Packet41MobEffect.class);
- a(42, true, false, Packet42RemoveMobEffect.class);
- a(43, true, false, Packet43SetExperience.class);
- a(44, true, false, Packet44UpdateAttributes.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(63, true, false, Packet63WorldParticles.class);
- a(70, true, false, Packet70Bed.class);
- a(71, true, false, Packet71Weather.class);
- a(100, true, false, Packet100OpenWindow.class);
- a(101, true, true, Packet101CloseWindow.class);
- a(102, false, true, Packet102WindowClick.class);
- a(103, true, false, Packet103SetSlot.class);
- a(104, true, false, Packet104WindowItems.class);
- a(105, true, false, Packet105CraftProgressBar.class);
- a(106, true, true, Packet106Transaction.class);
- a(107, true, true, Packet107SetCreativeSlot.class);
- a(108, false, true, Packet108ButtonClick.class);
- a(130, true, true, Packet130UpdateSign.class);
- a(131, true, false, Packet131ItemData.class);
- a(132, true, false, Packet132TileEntityData.class);
- a(133, true, false, Packet133OpenTileEntity.class);
- 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(206, true, false, Packet206SetScoreboardObjective.class);
- a(207, true, false, Packet207SetScoreboardScore.class);
- a(208, true, false, Packet208SetScoreboardDisplayObjective.class);
- a(209, true, false, Packet209SetScoreboardTeam.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);
+ public String b() {
+ return "";
}
}
diff --git a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java b/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
deleted file mode 100644
index 1843d9ceb4..0000000000
--- a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package net.minecraft.server;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.util.List;
-
-import java.io.IOException; // CraftBukkit
-
-public class Packet20NamedEntitySpawn extends Packet {
-
- public int a;
- public String b;
- public int c;
- public int d;
- public int e;
- public byte f;
- public byte g;
- public int h;
- private DataWatcher i;
- private List j;
-
- public Packet20NamedEntitySpawn() {}
-
- public Packet20NamedEntitySpawn(EntityHuman entityhuman) {
- this.a = entityhuman.id;
-
- // CraftBukkit start - Limit name length to 16 characters
- if (entityhuman.name.length() > 16) {
- this.b = entityhuman.name.substring(0, 16);
- } else {
- this.b = entityhuman.name;
- }
- // CraftBukkit end
-
- this.b = entityhuman.getName();
- this.c = MathHelper.floor(entityhuman.locX * 32.0D);
- this.d = MathHelper.floor(entityhuman.locY * 32.0D);
- this.e = MathHelper.floor(entityhuman.locZ * 32.0D);
- this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F));
- this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F));
- ItemStack itemstack = entityhuman.inventory.getItemInHand();
-
- this.h = itemstack == null ? 0 : itemstack.id;
- this.i = entityhuman.getDataWatcher();
- }
-
- public void a(DataInput datainput) throws IOException { // CraftBukkit
- this.a = datainput.readInt();
- this.b = a(datainput, 16);
- this.c = datainput.readInt();
- this.d = datainput.readInt();
- this.e = datainput.readInt();
- this.f = datainput.readByte();
- this.g = datainput.readByte();
- this.h = datainput.readShort();
- this.j = DataWatcher.a(datainput);
- }
-
- public void a(DataOutput dataoutput) throws IOException { // CraftBukkit
- dataoutput.writeInt(this.a);
- a(this.b, dataoutput);
- dataoutput.writeInt(this.c);
- dataoutput.writeInt(this.d);
- dataoutput.writeInt(this.e);
- dataoutput.writeByte(this.f);
- dataoutput.writeByte(this.g);
- dataoutput.writeShort(this.h);
- this.i.a(dataoutput);
- }
-
- public void handle(Connection connection) {
- connection.a(this);
- }
-
- public int a() {
- return 28;
- }
-}
diff --git a/src/main/java/net/minecraft/server/Packet2Handshake.java b/src/main/java/net/minecraft/server/Packet2Handshake.java
deleted file mode 100644
index 1e7bad0829..0000000000
--- a/src/main/java/net/minecraft/server/Packet2Handshake.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package net.minecraft.server;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-
-import java.io.IOException; // CraftBukkit
-
-public class Packet2Handshake extends Packet {
-
- private int a;
- private String b;
- public String c; // CraftBukkit private -> public
- public int d; // CraftBukkit private -> public
-
- public Packet2Handshake() {}
-
- public void a(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
- this.a = datainput.readByte();
- this.b = a(datainput, 16);
- this.c = a(datainput, 255);
- this.d = datainput.readInt();
- }
-
- public void a(DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
- dataoutput.writeByte(this.a);
- a(this.b, dataoutput);
- a(this.c, dataoutput);
- dataoutput.writeInt(this.d);
- }
-
- public void handle(Connection connection) {
- connection.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/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
new file mode 100644
index 0000000000..fe2b24d31e
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -0,0 +1,726 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+import java.nio.charset.Charset;
+
+import net.minecraft.util.com.google.common.base.Charsets;
+import net.minecraft.util.io.netty.buffer.ByteBuf;
+import net.minecraft.util.io.netty.buffer.ByteBufAllocator;
+import net.minecraft.util.io.netty.buffer.ByteBufProcessor;
+
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
+
+public class PacketDataSerializer extends ByteBuf {
+
+ private final ByteBuf a;
+
+ public PacketDataSerializer(ByteBuf bytebuf) {
+ this.a = bytebuf;
+ }
+
+ public static int a(int i) {
+ return (i & -128) == 0 ? 1 : ((i & -16384) == 0 ? 2 : ((i & -2097152) == 0 ? 3 : ((i & -268435456) == 0 ? 4 : 5)));
+ }
+
+ public int a() {
+ int i = 0;
+ int j = 0;
+
+ byte b0;
+
+ do {
+ b0 = this.readByte();
+ i |= (b0 & 127) << j++ * 7;
+ if (j > 5) {
+ throw new RuntimeException("VarInt too big");
+ }
+ } while ((b0 & 128) == 128);
+
+ return i;
+ }
+
+ public void b(int i) {
+ while ((i & -128) != 0) {
+ this.writeByte(i & 127 | 128);
+ i >>>= 7;
+ }
+
+ this.writeByte(i);
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ if (nbttagcompound == null) {
+ this.writeShort(-1);
+ } else {
+ byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
+
+ this.writeShort((short) abyte.length);
+ this.writeBytes(abyte);
+ }
+ }
+
+ public NBTTagCompound b() {
+ short short1 = this.readShort();
+
+ if (short1 < 0) {
+ return null;
+ } else {
+ byte[] abyte = new byte[short1];
+
+ this.readBytes(abyte);
+ return NBTCompressedStreamTools.a(abyte);
+ }
+ }
+
+ public void a(ItemStack itemstack) {
+ if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
+ this.writeShort(-1);
+ } else {
+ this.writeShort(Item.b(itemstack.getItem()));
+ this.writeByte(itemstack.count);
+ this.writeShort(itemstack.getData());
+ NBTTagCompound nbttagcompound = null;
+
+ if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) {
+ nbttagcompound = itemstack.tag;
+ }
+
+ this.a(nbttagcompound);
+ }
+ }
+
+ public ItemStack c() {
+ ItemStack itemstack = null;
+ short short1 = this.readShort();
+
+ if (short1 >= 0) {
+ byte b0 = this.readByte();
+ short short2 = this.readShort();
+
+ itemstack = new ItemStack(Item.d(short1), b0, short2);
+ itemstack.tag = this.b();
+ // CraftBukkit start
+ if (itemstack.tag != null) {
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
+ }
+ // CraftBukkit end
+ }
+
+ return itemstack;
+ }
+
+ public String c(int i) throws IOException { // CraftBukkit - throws IOException
+ int j = this.a();
+
+ if (j > i * 4) {
+ throw new IOException("The received encoded string buffer length is longer than maximum allowed (" + j + " > " + i * 4 + ")");
+ } else if (j < 0) {
+ throw new IOException("The received encoded string buffer length is less than zero! Weird string!");
+ } else {
+ String s = new String(this.readBytes(j).array(), Charsets.UTF_8);
+
+ if (s.length() > i) {
+ throw new IOException("The received string length is longer than maximum allowed (" + j + " > " + i + ")");
+ } else {
+ return s;
+ }
+ }
+ }
+
+ public void a(String s) throws IOException { // CraftBukkit - throws IOException
+ byte[] abyte = s.getBytes(Charsets.UTF_8);
+
+ if (abyte.length > 32767) {
+ throw new IOException("String too big (was " + s.length() + " bytes encoded, max " + 32767 + ")");
+ } else {
+ this.b(abyte.length);
+ this.writeBytes(abyte);
+ }
+ }
+
+ public int capacity() {
+ return this.a.capacity();
+ }
+
+ public ByteBuf capacity(int i) {
+ return this.a.capacity(i);
+ }
+
+ public int maxCapacity() {
+ return this.a.maxCapacity();
+ }
+
+ public ByteBufAllocator alloc() {
+ return this.a.alloc();
+ }
+
+ public ByteOrder order() {
+ return this.a.order();
+ }
+
+ public ByteBuf order(ByteOrder byteorder) {
+ return this.a.order(byteorder);
+ }
+
+ public ByteBuf unwrap() {
+ return this.a.unwrap();
+ }
+
+ public boolean isDirect() {
+ return this.a.isDirect();
+ }
+
+ public int readerIndex() {
+ return this.a.readerIndex();
+ }
+
+ public ByteBuf readerIndex(int i) {
+ return this.a.readerIndex(i);
+ }
+
+ public int writerIndex() {
+ return this.a.writerIndex();
+ }
+
+ public ByteBuf writerIndex(int i) {
+ return this.a.writerIndex(i);
+ }
+
+ public ByteBuf setIndex(int i, int j) {
+ return this.a.setIndex(i, j);
+ }
+
+ public int readableBytes() {
+ return this.a.readableBytes();
+ }
+
+ public int writableBytes() {
+ return this.a.writableBytes();
+ }
+
+ public int maxWritableBytes() {
+ return this.a.maxWritableBytes();
+ }
+
+ public boolean isReadable() {
+ return this.a.isReadable();
+ }
+
+ public boolean isReadable(int i) {
+ return this.a.isReadable(i);
+ }
+
+ public boolean isWritable() {
+ return this.a.isWritable();
+ }
+
+ public boolean isWritable(int i) {
+ return this.a.isWritable(i);
+ }
+
+ public ByteBuf clear() {
+ return this.a.clear();
+ }
+
+ public ByteBuf markReaderIndex() {
+ return this.a.markReaderIndex();
+ }
+
+ public ByteBuf resetReaderIndex() {
+ return this.a.resetReaderIndex();
+ }
+
+ public ByteBuf markWriterIndex() {
+ return this.a.markWriterIndex();
+ }
+
+ public ByteBuf resetWriterIndex() {
+ return this.a.resetWriterIndex();
+ }
+
+ public ByteBuf discardReadBytes() {
+ return this.a.discardReadBytes();
+ }
+
+ public ByteBuf discardSomeReadBytes() {
+ return this.a.discardSomeReadBytes();
+ }
+
+ public ByteBuf ensureWritable(int i) {
+ return this.a.ensureWritable(i);
+ }
+
+ public int ensureWritable(int i, boolean flag) {
+ return this.a.ensureWritable(i, flag);
+ }
+
+ public boolean getBoolean(int i) {
+ return this.a.getBoolean(i);
+ }
+
+ public byte getByte(int i) {
+ return this.a.getByte(i);
+ }
+
+ public short getUnsignedByte(int i) {
+ return this.a.getUnsignedByte(i);
+ }
+
+ public short getShort(int i) {
+ return this.a.getShort(i);
+ }
+
+ public int getUnsignedShort(int i) {
+ return this.a.getUnsignedShort(i);
+ }
+
+ public int getMedium(int i) {
+ return this.a.getMedium(i);
+ }
+
+ public int getUnsignedMedium(int i) {
+ return this.a.getUnsignedMedium(i);
+ }
+
+ public int getInt(int i) {
+ return this.a.getInt(i);
+ }
+
+ public long getUnsignedInt(int i) {
+ return this.a.getUnsignedInt(i);
+ }
+
+ public long getLong(int i) {
+ return this.a.getLong(i);
+ }
+
+ public char getChar(int i) {
+ return this.a.getChar(i);
+ }
+
+ public float getFloat(int i) {
+ return this.a.getFloat(i);
+ }
+
+ public double getDouble(int i) {
+ return this.a.getDouble(i);
+ }
+
+ public ByteBuf getBytes(int i, ByteBuf bytebuf) {
+ return this.a.getBytes(i, bytebuf);
+ }
+
+ public ByteBuf getBytes(int i, ByteBuf bytebuf, int j) {
+ return this.a.getBytes(i, bytebuf, j);
+ }
+
+ public ByteBuf getBytes(int i, ByteBuf bytebuf, int j, int k) {
+ return this.a.getBytes(i, bytebuf, j, k);
+ }
+
+ public ByteBuf getBytes(int i, byte[] abyte) {
+ return this.a.getBytes(i, abyte);
+ }
+
+ public ByteBuf getBytes(int i, byte[] abyte, int j, int k) {
+ return this.a.getBytes(i, abyte, j, k);
+ }
+
+ public ByteBuf getBytes(int i, ByteBuffer bytebuffer) {
+ return this.a.getBytes(i, bytebuffer);
+ }
+
+ public ByteBuf getBytes(int i, OutputStream outputstream, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.getBytes(i, outputstream, j);
+ }
+
+ public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.getBytes(i, gatheringbytechannel, j);
+ }
+
+ public ByteBuf setBoolean(int i, boolean flag) {
+ return this.a.setBoolean(i, flag);
+ }
+
+ public ByteBuf setByte(int i, int j) {
+ return this.a.setByte(i, j);
+ }
+
+ public ByteBuf setShort(int i, int j) {
+ return this.a.setShort(i, j);
+ }
+
+ public ByteBuf setMedium(int i, int j) {
+ return this.a.setMedium(i, j);
+ }
+
+ public ByteBuf setInt(int i, int j) {
+ return this.a.setInt(i, j);
+ }
+
+ public ByteBuf setLong(int i, long j) {
+ return this.a.setLong(i, j);
+ }
+
+ public ByteBuf setChar(int i, int j) {
+ return this.a.setChar(i, j);
+ }
+
+ public ByteBuf setFloat(int i, float f) {
+ return this.a.setFloat(i, f);
+ }
+
+ public ByteBuf setDouble(int i, double d0) {
+ return this.a.setDouble(i, d0);
+ }
+
+ public ByteBuf setBytes(int i, ByteBuf bytebuf) {
+ return this.a.setBytes(i, bytebuf);
+ }
+
+ public ByteBuf setBytes(int i, ByteBuf bytebuf, int j) {
+ return this.a.setBytes(i, bytebuf, j);
+ }
+
+ public ByteBuf setBytes(int i, ByteBuf bytebuf, int j, int k) {
+ return this.a.setBytes(i, bytebuf, j, k);
+ }
+
+ public ByteBuf setBytes(int i, byte[] abyte) {
+ return this.a.setBytes(i, abyte);
+ }
+
+ public ByteBuf setBytes(int i, byte[] abyte, int j, int k) {
+ return this.a.setBytes(i, abyte, j, k);
+ }
+
+ public ByteBuf setBytes(int i, ByteBuffer bytebuffer) {
+ return this.a.setBytes(i, bytebuffer);
+ }
+
+ public int setBytes(int i, InputStream inputstream, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.setBytes(i, inputstream, j);
+ }
+
+ public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) throws IOException { // CraftBukkit - throws IOException
+ return this.a.setBytes(i, scatteringbytechannel, j);
+ }
+
+ public ByteBuf setZero(int i, int j) {
+ return this.a.setZero(i, j);
+ }
+
+ public boolean readBoolean() {
+ return this.a.readBoolean();
+ }
+
+ public byte readByte() {
+ return this.a.readByte();
+ }
+
+ public short readUnsignedByte() {
+ return this.a.readUnsignedByte();
+ }
+
+ public short readShort() {
+ return this.a.readShort();
+ }
+
+ public int readUnsignedShort() {
+ return this.a.readUnsignedShort();
+ }
+
+ public int readMedium() {
+ return this.a.readMedium();
+ }
+
+ public int readUnsignedMedium() {
+ return this.a.readUnsignedMedium();
+ }
+
+ public int readInt() {
+ return this.a.readInt();
+ }
+
+ public long readUnsignedInt() {
+ return this.a.readUnsignedInt();
+ }
+
+ public long readLong() {
+ return this.a.readLong();
+ }
+
+ public char readChar() {
+ return this.a.readChar();
+ }
+
+ public float readFloat() {
+ return this.a.readFloat();
+ }
+
+ public double readDouble() {
+ return this.a.readDouble();
+ }
+
+ public ByteBuf readBytes(int i) {
+ return this.a.readBytes(i);
+ }
+
+ public ByteBuf readSlice(int i) {
+ return this.a.readSlice(i);
+ }
+
+ public ByteBuf readBytes(ByteBuf bytebuf) {
+ return this.a.readBytes(bytebuf);
+ }
+
+ public ByteBuf readBytes(ByteBuf bytebuf, int i) {
+ return this.a.readBytes(bytebuf, i);
+ }
+
+ public ByteBuf readBytes(ByteBuf bytebuf, int i, int j) {
+ return this.a.readBytes(bytebuf, i, j);
+ }
+
+ public ByteBuf readBytes(byte[] abyte) {
+ return this.a.readBytes(abyte);
+ }
+
+ public ByteBuf readBytes(byte[] abyte, int i, int j) {
+ return this.a.readBytes(abyte, i, j);
+ }
+
+ public ByteBuf readBytes(ByteBuffer bytebuffer) {
+ return this.a.readBytes(bytebuffer);
+ }
+
+ public ByteBuf readBytes(OutputStream outputstream, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.readBytes(outputstream, i);
+ }
+
+ public int readBytes(GatheringByteChannel gatheringbytechannel, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.readBytes(gatheringbytechannel, i);
+ }
+
+ public ByteBuf skipBytes(int i) {
+ return this.a.skipBytes(i);
+ }
+
+ public ByteBuf writeBoolean(boolean flag) {
+ return this.a.writeBoolean(flag);
+ }
+
+ public ByteBuf writeByte(int i) {
+ return this.a.writeByte(i);
+ }
+
+ public ByteBuf writeShort(int i) {
+ return this.a.writeShort(i);
+ }
+
+ public ByteBuf writeMedium(int i) {
+ return this.a.writeMedium(i);
+ }
+
+ public ByteBuf writeInt(int i) {
+ return this.a.writeInt(i);
+ }
+
+ public ByteBuf writeLong(long i) {
+ return this.a.writeLong(i);
+ }
+
+ public ByteBuf writeChar(int i) {
+ return this.a.writeChar(i);
+ }
+
+ public ByteBuf writeFloat(float f) {
+ return this.a.writeFloat(f);
+ }
+
+ public ByteBuf writeDouble(double d0) {
+ return this.a.writeDouble(d0);
+ }
+
+ public ByteBuf writeBytes(ByteBuf bytebuf) {
+ return this.a.writeBytes(bytebuf);
+ }
+
+ public ByteBuf writeBytes(ByteBuf bytebuf, int i) {
+ return this.a.writeBytes(bytebuf, i);
+ }
+
+ public ByteBuf writeBytes(ByteBuf bytebuf, int i, int j) {
+ return this.a.writeBytes(bytebuf, i, j);
+ }
+
+ public ByteBuf writeBytes(byte[] abyte) {
+ return this.a.writeBytes(abyte);
+ }
+
+ public ByteBuf writeBytes(byte[] abyte, int i, int j) {
+ return this.a.writeBytes(abyte, i, j);
+ }
+
+ public ByteBuf writeBytes(ByteBuffer bytebuffer) {
+ return this.a.writeBytes(bytebuffer);
+ }
+
+ public int writeBytes(InputStream inputstream, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.writeBytes(inputstream, i);
+ }
+
+ public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) throws IOException { // CraftBukkit - throws IOException
+ return this.a.writeBytes(scatteringbytechannel, i);
+ }
+
+ public ByteBuf writeZero(int i) {
+ return this.a.writeZero(i);
+ }
+
+ public int indexOf(int i, int j, byte b0) {
+ return this.a.indexOf(i, j, b0);
+ }
+
+ public int bytesBefore(byte b0) {
+ return this.a.bytesBefore(b0);
+ }
+
+ public int bytesBefore(int i, byte b0) {
+ return this.a.bytesBefore(i, b0);
+ }
+
+ public int bytesBefore(int i, int j, byte b0) {
+ return this.a.bytesBefore(i, j, b0);
+ }
+
+ public int forEachByte(ByteBufProcessor bytebufprocessor) {
+ return this.a.forEachByte(bytebufprocessor);
+ }
+
+ public int forEachByte(int i, int j, ByteBufProcessor bytebufprocessor) {
+ return this.a.forEachByte(i, j, bytebufprocessor);
+ }
+
+ public int forEachByteDesc(ByteBufProcessor bytebufprocessor) {
+ return this.a.forEachByteDesc(bytebufprocessor);
+ }
+
+ public int forEachByteDesc(int i, int j, ByteBufProcessor bytebufprocessor) {
+ return this.a.forEachByteDesc(i, j, bytebufprocessor);
+ }
+
+ public ByteBuf copy() {
+ return this.a.copy();
+ }
+
+ public ByteBuf copy(int i, int j) {
+ return this.a.copy(i, j);
+ }
+
+ public ByteBuf slice() {
+ return this.a.slice();
+ }
+
+ public ByteBuf slice(int i, int j) {
+ return this.a.slice(i, j);
+ }
+
+ public ByteBuf duplicate() {
+ return this.a.duplicate();
+ }
+
+ public int nioBufferCount() {
+ return this.a.nioBufferCount();
+ }
+
+ public ByteBuffer nioBuffer() {
+ return this.a.nioBuffer();
+ }
+
+ public ByteBuffer nioBuffer(int i, int j) {
+ return this.a.nioBuffer(i, j);
+ }
+
+ public ByteBuffer internalNioBuffer(int i, int j) {
+ return this.a.internalNioBuffer(i, j);
+ }
+
+ public ByteBuffer[] nioBuffers() {
+ return this.a.nioBuffers();
+ }
+
+ public ByteBuffer[] nioBuffers(int i, int j) {
+ return this.a.nioBuffers(i, j);
+ }
+
+ public boolean hasArray() {
+ return this.a.hasArray();
+ }
+
+ public byte[] array() {
+ return this.a.array();
+ }
+
+ public int arrayOffset() {
+ return this.a.arrayOffset();
+ }
+
+ public boolean hasMemoryAddress() {
+ return this.a.hasMemoryAddress();
+ }
+
+ public long memoryAddress() {
+ return this.a.memoryAddress();
+ }
+
+ public String toString(Charset charset) {
+ return this.a.toString(charset);
+ }
+
+ public String toString(int i, int j, Charset charset) {
+ return this.a.toString(i, j, charset);
+ }
+
+ public int hashCode() {
+ return this.a.hashCode();
+ }
+
+ public boolean equals(Object object) {
+ return this.a.equals(object);
+ }
+
+ public int compareTo(ByteBuf bytebuf) {
+ return this.a.compareTo(bytebuf);
+ }
+
+ public String toString() {
+ return this.a.toString();
+ }
+
+ public ByteBuf retain(int i) {
+ return this.a.retain(i);
+ }
+
+ public ByteBuf retain() {
+ return this.a.retain();
+ }
+
+ public int refCnt() {
+ return this.a.refCnt();
+ }
+
+ public boolean release() {
+ return this.a.release();
+ }
+
+ public boolean release(int i) {
+ return this.a.release(i);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
new file mode 100644
index 0000000000..16d47650e2
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
@@ -0,0 +1,47 @@
+package net.minecraft.server;
+
+import java.io.IOException; // CraftBukkit
+
+public class PacketHandshakingInSetProtocol extends Packet {
+
+ private int a;
+ public String b; // CraftBukkit private -> public
+ public int c; // CraftBukkit private -> public
+ private EnumProtocol d;
+
+ public PacketHandshakingInSetProtocol() {}
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ this.a = packetdataserializer.a();
+ this.b = packetdataserializer.c(255);
+ this.c = packetdataserializer.readUnsignedShort();
+ this.d = EnumProtocol.a(packetdataserializer.a());
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ packetdataserializer.b(this.a);
+ packetdataserializer.a(this.b);
+ packetdataserializer.writeShort(this.c);
+ packetdataserializer.b(this.d.c());
+ }
+
+ public void a(PacketHandshakingInListener packethandshakinginlistener) {
+ packethandshakinginlistener.a(this);
+ }
+
+ public boolean a() {
+ return true;
+ }
+
+ public EnumProtocol c() {
+ return this.d;
+ }
+
+ public int d() {
+ return this.a;
+ }
+
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketHandshakingInListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayInChat.java b/src/main/java/net/minecraft/server/PacketPlayInChat.java
new file mode 100644
index 0000000000..604a7af572
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayInChat.java
@@ -0,0 +1,49 @@
+package net.minecraft.server;
+
+import java.io.IOException; // CraftBukkit
+
+public class PacketPlayInChat extends Packet {
+
+ private String message;
+
+ public PacketPlayInChat() {}
+
+ public PacketPlayInChat(String s) {
+ if (s.length() > 100) {
+ s = s.substring(0, 100);
+ }
+
+ this.message = s;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ this.message = packetdataserializer.c(100);
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ packetdataserializer.a(this.message);
+ }
+
+ public void a(PacketPlayInListener packetplayinlistener) {
+ packetplayinlistener.a(this);
+ }
+
+ public String b() {
+ return String.format("message=\'%s\'", new Object[] { this.message});
+ }
+
+ public String c() {
+ return this.message;
+ }
+
+ // CraftBukkit start - make chat async
+ @Override
+ public boolean a() {
+ return !this.message.startsWith("/");
+ }
+ // CraftBukkit end
+
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketPlayInListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java
new file mode 100644
index 0000000000..43df03a9ff
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java
@@ -0,0 +1,29 @@
+package net.minecraft.server;
+
+public class PacketPlayInCloseWindow extends Packet {
+
+ private int a;
+
+ public PacketPlayInCloseWindow() {}
+
+ // CraftBukkit start - Add constructor
+ public PacketPlayInCloseWindow(int id) {
+ this.a = id;
+ }
+ // CraftBukkit end
+ public void a(PacketPlayInListener packetplayinlistener) {
+ packetplayinlistener.a(this);
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) {
+ this.a = packetdataserializer.readByte();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) {
+ packetdataserializer.writeByte(this.a);
+ }
+
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketPlayInListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java
new file mode 100644
index 0000000000..5df99a4426
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayInCustomPayload.java
@@ -0,0 +1,45 @@
+package net.minecraft.server;
+
+import java.io.IOException; // CraftBukkit
+
+public class PacketPlayInCustomPayload extends Packet {
+
+ private String tag;
+ public int length; // CraftBukkit - private -> public
+ private byte[] data;
+
+ public PacketPlayInCustomPayload() {}
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ this.tag = packetdataserializer.c(20);
+ this.length = packetdataserializer.readShort();
+ if (this.length > 0 && this.length < 32767) {
+ this.data = new byte[this.length];
+ packetdataserializer.readBytes(this.data);
+ }
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ packetdataserializer.a(this.tag);
+ packetdataserializer.writeShort((short) this.length);
+ if (this.data != null) {
+ packetdataserializer.writeBytes(this.data);
+ }
+ }
+
+ public void a(PacketPlayInListener packetplayinlistener) {
+ packetplayinlistener.a(this);
+ }
+
+ public String c() {
+ return this.tag;
+ }
+
+ public byte[] e() {
+ return this.data;
+ }
+
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketPlayInListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
new file mode 100644
index 0000000000..a7a7adced5
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java
@@ -0,0 +1,48 @@
+package net.minecraft.server;
+
+public class PacketPlayOutBlockChange extends Packet {
+
+ private int a;
+ private int b;
+ private int c;
+ public Block block; // CraftBukkit - public
+ public int data; // CraftBukkit - public
+
+ public PacketPlayOutBlockChange() {}
+
+ public PacketPlayOutBlockChange(int i, int j, int k, World world) {
+ this.a = i;
+ this.b = j;
+ this.c = k;
+ this.block = world.getType(i, j, k);
+ this.data = world.getData(i, j, k);
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) {
+ this.a = packetdataserializer.readInt();
+ this.b = packetdataserializer.readUnsignedByte();
+ this.c = packetdataserializer.readInt();
+ this.block = Block.e(packetdataserializer.a());
+ this.data = packetdataserializer.readUnsignedByte();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) {
+ packetdataserializer.writeInt(this.a);
+ packetdataserializer.writeByte(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.b(Block.b(this.block));
+ packetdataserializer.writeByte(this.data);
+ }
+
+ public void a(PacketPlayOutListener packetplayoutlistener) {
+ packetplayoutlistener.a(this);
+ }
+
+ public String b() {
+ return String.format("type=%d, data=%d, x=%d, y=%d, z=%d", new Object[] { Integer.valueOf(Block.b(this.block)), Integer.valueOf(this.data), Integer.valueOf(this.a), Integer.valueOf(this.b), Integer.valueOf(this.c)});
+ }
+
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketPlayOutListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
similarity index 56%
rename from src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
rename to src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
index 04c44fccb4..3eac231d47 100644
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -1,19 +1,17 @@
package net.minecraft.server;
-import java.io.DataInput;
-import java.io.DataOutput;
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 {
+public class PacketPlayOutMapChunkBulk extends Packet {
+ private int[] a;
+ private int[] b;
private int[] c;
private int[] d;
- public int[] a;
- public int[] b;
private byte[] buffer;
private byte[][] inflatedBuffers;
private int size;
@@ -29,22 +27,22 @@ public class Packet56MapChunkBulk extends Packet {
};
// CraftBukkit end
- public Packet56MapChunkBulk() {}
+ public PacketPlayOutMapChunkBulk() {}
- public Packet56MapChunkBulk(List list) {
+ public PacketPlayOutMapChunkBulk(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.c = new int[i];
+ this.d = new int[i];
this.inflatedBuffers = new byte[i][];
this.h = !list.isEmpty() && !((Chunk) list.get(0)).world.worldProvider.g;
int j = 0;
for (int k = 0; k < i; ++k) {
Chunk chunk = (Chunk) list.get(k);
- ChunkMap chunkmap = Packet51MapChunk.a(chunk, true, '\uffff');
+ ChunkMap chunkmap = PacketPlayOutMapChunk.a(chunk, true, '\uffff');
if (buildBuffer.length < j + chunkmap.a.length) {
byte[] abyte = new byte[j + chunkmap.a.length];
@@ -55,10 +53,10 @@ public class Packet56MapChunkBulk extends Packet {
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.a[k] = chunk.locX;
+ this.b[k] = chunk.locZ;
+ this.c[k] = chunkmap.b;
+ this.d[k] = chunkmap.c;
this.inflatedBuffers[k] = chunkmap.a;
}
@@ -92,22 +90,26 @@ public class Packet56MapChunkBulk extends Packet {
}
// CraftBukkit end
- public void a(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainput.readShort();
+ public static int c() {
+ return 5;
+ }
- this.size = datainput.readInt();
- this.h = datainput.readBoolean();
- this.c = new int[short1];
- this.d = new int[short1];
+ public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - throws IOException
+ short short1 = packetdataserializer.readShort();
+
+ this.size = packetdataserializer.readInt();
+ this.h = packetdataserializer.readBoolean();
this.a = new int[short1];
this.b = new int[short1];
+ this.c = new int[short1];
+ this.d = new int[short1];
this.inflatedBuffers = new byte[short1][];
if (buildBuffer.length < this.size) {
buildBuffer = new byte[this.size];
}
- datainput.readFully(buildBuffer, 0, this.size);
- byte[] abyte = new byte[196864 * short1];
+ packetdataserializer.readBytes(buildBuffer, 0, this.size);
+ byte[] abyte = new byte[PacketPlayOutMapChunk.c() * short1];
Inflater inflater = new Inflater();
inflater.setInput(buildBuffer, 0, this.size);
@@ -123,18 +125,18 @@ public class Packet56MapChunkBulk extends Packet {
int i = 0;
for (int j = 0; j < short1; ++j) {
- this.c[j] = datainput.readInt();
- this.d[j] = datainput.readInt();
- this.a[j] = datainput.readShort();
- this.b[j] = datainput.readShort();
+ this.a[j] = packetdataserializer.readInt();
+ this.b[j] = packetdataserializer.readInt();
+ this.c[j] = packetdataserializer.readShort();
+ this.d[j] = packetdataserializer.readShort();
int k = 0;
int l = 0;
int i1;
for (i1 = 0; i1 < 16; ++i1) {
- k += this.a[j] >> i1 & 1;
- l += this.b[j] >> i1 & 1;
+ k += this.c[j] >> i1 & 1;
+ l += this.d[j] >> i1 & 1;
}
i1 = 2048 * 4 * k + 256;
@@ -149,30 +151,40 @@ public class Packet56MapChunkBulk extends Packet {
}
}
- public void a(DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
+ public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - throws IOException
compress(); // CraftBukkit
- dataoutput.writeShort(this.c.length);
- dataoutput.writeInt(this.size);
- dataoutput.writeBoolean(this.h);
- dataoutput.write(this.buffer, 0, this.size);
+ packetdataserializer.writeShort(this.a.length);
+ packetdataserializer.writeInt(this.size);
+ packetdataserializer.writeBoolean(this.h);
+ packetdataserializer.writeBytes(this.buffer, 0, this.size);
- for (int i = 0; i < this.c.length; ++i) {
- dataoutput.writeInt(this.c[i]);
- dataoutput.writeInt(this.d[i]);
- dataoutput.writeShort((short) (this.a[i] & '\uffff'));
- dataoutput.writeShort((short) (this.b[i] & '\uffff'));
+ for (int i = 0; i < this.a.length; ++i) {
+ packetdataserializer.writeInt(this.a[i]);
+ packetdataserializer.writeInt(this.b[i]);
+ packetdataserializer.writeShort((short) (this.c[i] & '\uffff'));
+ packetdataserializer.writeShort((short) (this.d[i] & '\uffff'));
}
}
- public void handle(Connection connection) {
- connection.a(this);
+ public void a(PacketPlayOutListener packetplayoutlistener) {
+ packetplayoutlistener.a(this);
}
- public int a() {
- return 6 + this.size + 12 * this.d();
+ public String b() {
+ StringBuilder stringbuilder = new StringBuilder();
+
+ for (int i = 0; i < this.a.length; ++i) {
+ if (i > 0) {
+ stringbuilder.append(", ");
+ }
+
+ stringbuilder.append(String.format("{x=%d, z=%d, sections=%d, adds=%d, data=%d}", new Object[] { Integer.valueOf(this.a[i]), Integer.valueOf(this.b[i]), Integer.valueOf(this.c[i]), Integer.valueOf(this.d[i]), Integer.valueOf(this.inflatedBuffers[i].length)}));
+ }
+
+ return String.format("size=%d, chunks=%d[%s]", new Object[] { Integer.valueOf(this.size), Integer.valueOf(this.a.length), stringbuilder});
}
- public int d() {
- return this.c.length;
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketPlayOutListener) packetlistener);
}
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
new file mode 100644
index 0000000000..8bab528198
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
@@ -0,0 +1,74 @@
+package net.minecraft.server;
+
+import java.util.List;
+
+import net.minecraft.util.com.mojang.authlib.GameProfile;
+
+import java.io.IOException; // CraftBukkit
+
+public class PacketPlayOutNamedEntitySpawn extends Packet {
+
+ private int a;
+ private GameProfile b;
+ private int c;
+ private int d;
+ private int e;
+ private byte f;
+ private byte g;
+ private int h;
+ private DataWatcher i;
+ private List j;
+
+ public PacketPlayOutNamedEntitySpawn() {}
+
+ public PacketPlayOutNamedEntitySpawn(EntityHuman entityhuman) {
+ this.a = entityhuman.getId();
+ this.b = entityhuman.getProfile();
+ this.c = MathHelper.floor(entityhuman.locX * 32.0D);
+ this.d = MathHelper.floor(entityhuman.locY * 32.0D);
+ this.e = MathHelper.floor(entityhuman.locZ * 32.0D);
+ this.f = (byte) ((int) (entityhuman.yaw * 256.0F / 360.0F));
+ this.g = (byte) ((int) (entityhuman.pitch * 256.0F / 360.0F));
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
+
+ this.h = itemstack == null ? 0 : Item.b(itemstack.getItem());
+ this.i = entityhuman.getDataWatcher();
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ this.a = packetdataserializer.a();
+ this.b = new GameProfile(packetdataserializer.c(36), packetdataserializer.c(16));
+ this.c = packetdataserializer.readInt();
+ this.d = packetdataserializer.readInt();
+ this.e = packetdataserializer.readInt();
+ this.f = packetdataserializer.readByte();
+ this.g = packetdataserializer.readByte();
+ this.h = packetdataserializer.readShort();
+ this.j = DataWatcher.b(packetdataserializer);
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws
+ packetdataserializer.b(this.a);
+ packetdataserializer.a(this.b.getId());
+ packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); // CraftBukkit - Limit name length to 16 characters
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeInt(this.e);
+ packetdataserializer.writeByte(this.f);
+ packetdataserializer.writeByte(this.g);
+ packetdataserializer.writeShort(this.h);
+ this.i.a(packetdataserializer);
+ }
+
+ public void a(PacketPlayOutListener packetplayoutlistener) {
+ packetplayoutlistener.a(this);
+ }
+
+ public String b() {
+ return String.format("id=%d, gameProfile=\'%s\', x=%.2f, y=%.2f, z=%.2f, carried=%d", new Object[] { Integer.valueOf(this.a), this.b, Float.valueOf((float) this.c / 32.0F), Float.valueOf((float) this.d / 32.0F), Float.valueOf((float) this.e / 32.0F), Integer.valueOf(this.h)});
+ }
+
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketPlayOutListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java
new file mode 100644
index 0000000000..92e40367e0
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java
@@ -0,0 +1,44 @@
+package net.minecraft.server;
+
+public class PacketPlayOutSpawnPosition extends Packet {
+
+ public int x; // CraftBukkit - private -> public
+ public int y; // CraftBukkit - private -> public
+ public int z; // CraftBukkit - private -> public
+
+ public PacketPlayOutSpawnPosition() {}
+
+ public PacketPlayOutSpawnPosition(int i, int j, int k) {
+ this.x = i;
+ this.y = j;
+ this.z = k;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer) {
+ this.x = packetdataserializer.readInt();
+ this.y = packetdataserializer.readInt();
+ this.z = packetdataserializer.readInt();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer) {
+ packetdataserializer.writeInt(this.x);
+ packetdataserializer.writeInt(this.y);
+ packetdataserializer.writeInt(this.z);
+ }
+
+ public void a(PacketPlayOutListener packetplayoutlistener) {
+ packetplayoutlistener.a(this);
+ }
+
+ public boolean a() {
+ return false;
+ }
+
+ public String b() {
+ return String.format("x=%d, y=%d, z=%d", new Object[] { Integer.valueOf(this.x), Integer.valueOf(this.y), Integer.valueOf(this.z)});
+ }
+
+ public void handle(PacketListener packetlistener) {
+ this.a((PacketPlayOutListener) packetlistener);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
new file mode 100644
index 0000000000..e4116e5e7c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
@@ -0,0 +1,62 @@
+package net.minecraft.server;
+
+import java.net.InetSocketAddress;
+
+import org.bukkit.craftbukkit.util.CraftIconCache; // CraftBukkit
+
+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
+
+public class PacketStatusListener implements PacketStatusInListener {
+
+ private final MinecraftServer minecraftServer;
+ private final NetworkManager networkManager;
+
+ public PacketStatusListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
+ this.minecraftServer = minecraftserver;
+ this.networkManager = networkmanager;
+ }
+
+ public void a(IChatBaseComponent ichatbasecomponent) {}
+
+ public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) {
+ if (enumprotocol1 != EnumProtocol.STATUS) {
+ throw new UnsupportedOperationException("Unexpected change in protocol to " + enumprotocol1);
+ }
+ }
+
+ public void a() {}
+
+ public void a(PacketStatusInStart packetstatusinstart) {
+ // CraftBukkit start - fire ping event
+ class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent {
+ CraftIconCache icon = minecraftServer.server.getServerIcon();
+
+ ServerListPingEvent() {
+ super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.getMotd(), minecraftServer.getPlayerList().getPlayerCount(), minecraftServer.getPlayerList().getMaxPlayers());
+ }
+
+ @Override
+ public void setServerIcon(org.bukkit.util.CachedServerIcon icon) {
+ if (!(icon instanceof CraftIconCache)) {
+ throw new IllegalArgumentException(icon + " was not created by " + org.bukkit.craftbukkit.CraftServer.class);
+ }
+ this.icon = (CraftIconCache) icon;
+ }
+ }
+
+ ServerListPingEvent event = new ServerListPingEvent();
+ this.minecraftServer.server.getPluginManager().callEvent(event);
+ ServerPing ping = new ServerPing();
+ ping.setFavicon(event.icon.value);
+ ping.setMOTD(new ChatComponentText(event.getMotd()));
+ ping.setPlayerSample(new ServerPingPlayerSample(event.getMaxPlayers(), minecraftServer.getPlayerList().getPlayerCount()));
+ ping.setServerInfo(new ServerPingServerData(minecraftServer.server.getVersion(), 4)); // MAGICAL VALUE FROM MinecraftServer
+
+ this.networkManager.handle(new PacketStatusOutServerInfo(ping), new GenericFutureListener[0]);
+ // CraftBukkit end
+ }
+
+ public void a(PacketStatusInPing packetstatusinping) {
+ this.networkManager.handle(new PacketStatusOutPong(packetstatusinping.c()), new GenericFutureListener[0]);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
index 557dad370f..5390ef112f 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
@@ -10,7 +10,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
}
public boolean a() {
- return !super.a() ? false : (!this.a.world.getGameRules().getBoolean("mobGriefing") ? false : !this.e.b_(this.a.world, this.b, this.c, this.d));
+ return !super.a() ? false : (!this.a.world.getGameRules().getBoolean("mobGriefing") ? false : !this.e.f((IBlockAccess) this.a.world, this.b, this.c, this.d)); // CraftBukkit - Fix decompilation issue by casting world to IBlockAccess
}
public void c() {
@@ -21,17 +21,17 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
public boolean b() {
double d0 = this.a.e((double) this.b, (double) this.c, (double) this.d);
- return this.i <= 240 && !this.e.b_(this.a.world, this.b, this.c, this.d) && d0 < 4.0D;
+ return this.i <= 240 && !this.e.f((IBlockAccess) this.a.world, this.b, this.c, this.d) && d0 < 4.0D; // CraftBukkit - Fix decompilation issue by casting world to IBlockAccess
}
public void d() {
super.d();
- this.a.world.f(this.a.id, this.b, this.c, this.d, -1);
+ this.a.world.d(this.a.getId(), this.b, this.c, this.d, -1);
}
public void e() {
super.e();
- if (this.a.aD().nextInt(20) == 0) {
+ if (this.a.aI().nextInt(20) == 0) {
this.a.world.triggerEffect(1010, this.b, this.c, this.d, 0);
}
@@ -39,11 +39,11 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
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.a.world.d(this.a.getId(), this.b, this.c, this.d, i);
this.j = i;
}
- if (this.i == 240 && this.a.world.difficulty == 3) {
+ if (this.i == 240 && this.a.world.difficulty == EnumDifficulty.HARD) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.a, this.b, this.c, this.d).isCancelled()) {
this.e();
@@ -53,7 +53,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
this.a.world.setAir(this.b, this.c, this.d);
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);
+ this.a.world.triggerEffect(2001, this.b, this.c, this.d, Block.b((Block) this.e));
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index 0c64660e81..50d4ff96dd 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.bY()) {
+ if (!this.d.cc()) {
return false;
} else {
this.e = this.f();
@@ -29,7 +29,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public boolean b() {
- return this.e.isAlive() && this.e.bY() && this.b < 60;
+ return this.e.isAlive() && this.e.cc() && this.b < 60;
}
public void d() {
@@ -38,7 +38,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public void e() {
- this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bp());
+ this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.x());
this.d.getNavigation().a((Entity) this.e, this.c);
++this.b;
if (this.b >= 60 && this.d.e(this.e) < 9.0D) {
@@ -74,14 +74,27 @@ public class PathfinderGoalBreed extends PathfinderGoal {
entityageable.persistent = true;
}
// CraftBukkit end
+ EntityHuman entityhuman = this.d.cb();
+
+ if (entityhuman == null && this.e.cb() != null) {
+ entityhuman = this.e.cb();
+ }
+
+ if (entityhuman != null) {
+ entityhuman.a(StatisticList.x);
+ if (this.d instanceof EntityCow) {
+ entityhuman.a((Statistic) AchievementList.H);
+ }
+ }
+
this.d.setAge(6000);
this.e.setAge(6000);
- this.d.bZ();
- this.e.bZ();
+ this.d.cd();
+ this.e.cd();
entityageable.setAge(-24000);
entityageable.setPositionRotation(this.d.locX, this.d.locY, this.d.locZ, 0.0F, 0.0F);
this.a.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
- Random random = this.d.aD();
+ Random random = this.d.aI();
for (int i = 0; i < 7; ++i) {
double d0 = random.nextGaussian() * 0.02D;
@@ -91,7 +104,9 @@ public class PathfinderGoalBreed extends PathfinderGoal {
this.a.addParticle("heart", this.d.locX + (double) (random.nextFloat() * this.d.width * 2.0F) - (double) this.d.width, this.d.locY + 0.5D + (double) (random.nextFloat() * this.d.length), this.d.locZ + (double) (random.nextFloat() * this.d.width * 2.0F) - (double) this.d.width, d0, d1, d2);
}
- this.a.addEntity(new EntityExperienceOrb(this.a, this.d.locX, this.d.locY, this.d.locZ, random.nextInt(7) + 1));
+ if (this.a.getGameRules().getBoolean("doMobLoot")) {
+ this.a.addEntity(new EntityExperienceOrb(this.a, this.d.locX, this.d.locY, this.d.locZ, random.nextInt(7) + 1));
+ }
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
index ed6811a508..5b75a158f3 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
@@ -18,14 +18,14 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
}
public boolean a() {
- if (this.b.aD().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
+ if (this.b.aI().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
return false;
} else {
int i = MathHelper.floor(this.b.locX);
int j = MathHelper.floor(this.b.locY);
int k = MathHelper.floor(this.b.locZ);
- return this.c.getTypeId(i, j, k) == Block.LONG_GRASS.id && this.c.getData(i, j, k) == 1 ? true : this.c.getTypeId(i, j - 1, k) == Block.GRASS.id;
+ return this.c.getType(i, j, k) == Blocks.LONG_GRASS && this.c.getData(i, j, k) == 1 ? true : this.c.getType(i, j - 1, k) == Blocks.GRASS;
}
}
@@ -54,21 +54,21 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
int j = MathHelper.floor(this.b.locY);
int k = MathHelper.floor(this.b.locZ);
- if (this.c.getTypeId(i, j, k) == Block.LONG_GRASS.id) {
- // CraftBukkit start
- if (!CraftEventFactory.callEntityChangeBlockEvent(this.b.getBukkitEntity(), this.b.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) {
+ if (this.c.getType(i, j, k) == Blocks.LONG_GRASS) {
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, this.b.world.getWorld().getBlockAt(i, j, k), Material.AIR, !this.c.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
this.c.setAir(i, j, k, false);
- this.b.n();
}
- // CraftBukkit end
- } else if (this.c.getTypeId(i, j - 1, k) == Block.GRASS.id) {
- // CraftBukkit start
- 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.setTypeIdAndData(i, j - 1, k, Block.DIRT.id, 0, 2);
- this.b.n();
+
+ this.b.p();
+ } else if (this.c.getType(i, j - 1, k) == Blocks.GRASS) {
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, this.b.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT, !this.c.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
+ this.c.triggerEffect(2001, i, j - 1, k, Block.b((Block) Blocks.GRASS));
+ this.c.setTypeAndData(i, j - 1, k, Blocks.DIRT, 0, 2);
}
- // CraftBukkit end
+
+ this.b.p();
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMakeLove.java b/src/main/java/net/minecraft/server/PathfinderGoalMakeLove.java
index 6102f9eb05..62891b565c 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalMakeLove.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalMakeLove.java
@@ -17,7 +17,7 @@ public class PathfinderGoalMakeLove extends PathfinderGoal {
public boolean a() {
if (this.b.getAge() != 0) {
return false;
- } else if (this.b.aD().nextInt(500) != 0) {
+ } else if (this.b.aI().nextInt(500) != 0) {
return false;
} else {
this.a = this.d.villages.getClosestVillage(MathHelper.floor(this.b.locX), MathHelper.floor(this.b.locY), MathHelper.floor(this.b.locZ), 0);
@@ -58,11 +58,11 @@ public class PathfinderGoalMakeLove extends PathfinderGoal {
this.b.getControllerLook().a(this.c, 10.0F, 30.0F);
if (this.b.e(this.c) > 2.25D) {
this.b.getNavigation().a((Entity) this.c, 0.25D);
- } else if (this.e == 0 && this.c.bU()) {
+ } else if (this.e == 0 && this.c.bY()) {
this.g();
}
- if (this.b.aD().nextInt(35) == 0) {
+ if (this.b.aI().nextInt(35) == 0) {
this.d.broadcastEntityEffect(this.b, (byte) 12);
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
index a07c6cf78e..f98e994873 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
@@ -12,6 +12,9 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
PathEntity f;
Class g;
private int h;
+ private double i;
+ private double j;
+ private double k;
public PathfinderGoalMeleeAttack(EntityCreature entitycreature, Class oclass, double d0, boolean flag) {
this(entitycreature, d0, flag);
@@ -67,23 +70,34 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
EntityLiving entityliving = this.b.getGoalTarget();
this.b.getControllerLook().a(entityliving, 30.0F, 30.0F);
- if ((this.e || this.b.getEntitySenses().canSee(entityliving)) && --this.h <= 0) {
- this.h = 4 + this.b.aD().nextInt(7);
- this.b.getNavigation().a((Entity) entityliving, this.d);
+ double d0 = this.b.e(entityliving.locX, entityliving.boundingBox.b, entityliving.locZ);
+ double d1 = (double) (this.b.width * 2.0F * this.b.width * 2.0F + entityliving.width);
+
+ --this.h;
+ if ((this.e || this.b.getEntitySenses().canSee(entityliving)) && this.h <= 0 && (this.i == 0.0D && this.j == 0.0D && this.k == 0.0D || entityliving.e(this.i, this.j, this.k) >= 1.0D || this.b.aI().nextFloat() < 0.05F)) {
+ this.i = entityliving.locX;
+ this.j = entityliving.boundingBox.b;
+ this.k = entityliving.locZ;
+ this.h = 4 + this.b.aI().nextInt(7);
+ if (d0 > 1024.0D) {
+ this.h += 10;
+ } else if (d0 > 256.0D) {
+ this.h += 5;
+ }
+
+ if (!this.b.getNavigation().a((Entity) entityliving, this.d)) {
+ this.h += 15;
+ }
}
this.c = Math.max(this.c - 1, 0);
- double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F + entityliving.width);
-
- if (this.b.e(entityliving.locX, entityliving.boundingBox.b, entityliving.locZ) <= d0) {
- if (this.c <= 0) {
- this.c = 20;
- if (this.b.aZ() != null) {
- this.b.aV();
- }
-
- this.b.m(entityliving);
+ if (d0 <= d1 && this.c <= 20) {
+ this.c = 20;
+ if (this.b.be() != null) {
+ this.b.ba();
}
+
+ this.b.m(entityliving);
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalPanic.java b/src/main/java/net/minecraft/server/PathfinderGoalPanic.java
index daa2f41311..082e7e484a 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalPanic.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalPanic.java
@@ -37,7 +37,7 @@ public class PathfinderGoalPanic extends PathfinderGoal {
public boolean b() {
// CraftBukkit start - introduce a temporary timeout hack until this is fixed properly
- if ((this.a.ticksLived - this.a.aF()) > 100) {
+ if ((this.a.ticksLived - this.a.aK()) > 100) {
this.a.b((EntityLiving) null);
return false;
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index 1da9a42c67..33aded0855 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -4,37 +4,41 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import org.bukkit.craftbukkit.util.UnsafeList; // CraftBukkit
public class PathfinderGoalSelector {
+ private static final Logger a = LogManager.getLogger();
// CraftBukkit start - ArrayList -> UnsafeList
- private List a = new UnsafeList();
private List b = new UnsafeList();
+ private List c = new UnsafeList();
// CraftBukkit end
- private final MethodProfiler c;
- private int d;
- private int e = 3;
+ private final MethodProfiler d;
+ private int e;
+ private int f = 3;
public PathfinderGoalSelector(MethodProfiler methodprofiler) {
- this.c = methodprofiler;
+ this.d = methodprofiler;
}
public void a(int i, PathfinderGoal pathfindergoal) {
- this.a.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal));
+ this.b.add(new PathfinderGoalSelectorItem(this, i, pathfindergoal));
}
public void a(PathfinderGoal pathfindergoal) {
- Iterator iterator = this.a.iterator();
+ Iterator iterator = this.b.iterator();
while (iterator.hasNext()) {
PathfinderGoalSelectorItem pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
PathfinderGoal pathfindergoal1 = pathfindergoalselectoritem.a;
if (pathfindergoal1 == pathfindergoal) {
- if (this.b.contains(pathfindergoalselectoritem)) {
+ if (this.c.contains(pathfindergoalselectoritem)) {
pathfindergoal1.d();
- this.b.remove(pathfindergoalselectoritem);
+ this.c.remove(pathfindergoalselectoritem);
}
iterator.remove();
@@ -47,12 +51,12 @@ public class PathfinderGoalSelector {
Iterator iterator;
PathfinderGoalSelectorItem pathfindergoalselectoritem;
- if (this.d++ % this.e == 0) {
- iterator = this.a.iterator();
+ if (this.e++ % this.f == 0) {
+ iterator = this.b.iterator();
while (iterator.hasNext()) {
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
- boolean flag = this.b.contains(pathfindergoalselectoritem);
+ boolean flag = this.c.contains(pathfindergoalselectoritem);
if (flag) {
if (this.b(pathfindergoalselectoritem) && this.a(pathfindergoalselectoritem)) {
@@ -60,7 +64,7 @@ public class PathfinderGoalSelector {
}
pathfindergoalselectoritem.a.d();
- this.b.remove(pathfindergoalselectoritem);
+ this.c.remove(pathfindergoalselectoritem);
}
if (this.b(pathfindergoalselectoritem) && pathfindergoalselectoritem.a.a()) {
@@ -68,11 +72,11 @@ public class PathfinderGoalSelector {
// arraylist.add(pathfindergoalselectoritem);
pathfindergoalselectoritem.a.c();
// CraftBukkit end
- this.b.add(pathfindergoalselectoritem);
+ this.c.add(pathfindergoalselectoritem);
}
}
} else {
- iterator = this.b.iterator();
+ iterator = this.c.iterator();
while (iterator.hasNext()) {
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
@@ -83,41 +87,41 @@ public class PathfinderGoalSelector {
}
}
- this.c.a("goalStart");
+ this.d.a("goalStart");
// CraftBukkit start - removed usage of arraylist
/*iterator = arraylist.iterator();
while (iterator.hasNext()) {
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
- this.c.a(pathfindergoalselectoritem.a.getClass().getSimpleName());
+ this.d.a(pathfindergoalselectoritem.a.getClass().getSimpleName());
pathfindergoalselectoritem.a.c();
- this.c.b();
+ this.d.b();
}*/
// CraftBukkit end
- this.c.b();
- this.c.a("goalTick");
- iterator = this.b.iterator();
+ this.d.b();
+ this.d.a("goalTick");
+ iterator = this.c.iterator();
while (iterator.hasNext()) {
pathfindergoalselectoritem = (PathfinderGoalSelectorItem) iterator.next();
pathfindergoalselectoritem.a.e();
}
- this.c.b();
+ this.d.b();
}
private boolean a(PathfinderGoalSelectorItem pathfindergoalselectoritem) {
- this.c.a("canContinue");
+ this.d.a("canContinue");
boolean flag = pathfindergoalselectoritem.a.b();
- this.c.b();
+ this.d.b();
return flag;
}
private boolean b(PathfinderGoalSelectorItem pathfindergoalselectoritem) {
- this.c.a("canUse");
- Iterator iterator = this.a.iterator();
+ this.d.a("canUse");
+ Iterator iterator = this.b.iterator();
while (iterator.hasNext()) {
PathfinderGoalSelectorItem pathfindergoalselectoritem1 = (PathfinderGoalSelectorItem) iterator.next();
@@ -125,21 +129,21 @@ public class PathfinderGoalSelector {
if (pathfindergoalselectoritem1 != pathfindergoalselectoritem) {
if (pathfindergoalselectoritem.b >= pathfindergoalselectoritem1.b) {
// CraftBukkit - switch order
- if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.b.contains(pathfindergoalselectoritem1)) {
- this.c.b();
+ if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.c.contains(pathfindergoalselectoritem1)) {
+ this.d.b();
((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
return false;
}
// CraftBukkit - switch order
- } else if (!pathfindergoalselectoritem1.a.i() && this.b.contains(pathfindergoalselectoritem1)) {
- this.c.b();
+ } else if (!pathfindergoalselectoritem1.a.i() && this.c.contains(pathfindergoalselectoritem1)) {
+ this.d.b();
((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
return false;
}
}
}
- this.c.b();
+ this.d.b();
return true;
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSit.java b/src/main/java/net/minecraft/server/PathfinderGoalSit.java
index 4a352dc737..c518a01a64 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSit.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSit.java
@@ -13,7 +13,7 @@ public class PathfinderGoalSit extends PathfinderGoal {
public boolean a() {
if (!this.entity.isTamed()) {
return this.willSit && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
- } else if (this.entity.H()) {
+ } else if (this.entity.M()) {
return false;
} else if (!this.entity.onGround) {
return false;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTame.java b/src/main/java/net/minecraft/server/PathfinderGoalTame.java
index ffc8a88a80..37ddec7812 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTame.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTame.java
@@ -40,19 +40,19 @@ public class PathfinderGoalTame extends PathfinderGoal {
}
public void e() {
- if (this.entity.aD().nextInt(50) == 0) {
+ if (this.entity.aI().nextInt(50) == 0) {
if (this.entity.passenger instanceof EntityHuman) {
int i = this.entity.getTemper();
int j = this.entity.getMaxDomestication();
// CraftBukkit
- if (j > 0 && this.entity.aD().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, (EntityHuman) this.entity.passenger).isCancelled() && this.entity.passenger instanceof EntityHuman) {
- this.entity.g((EntityHuman) this.entity.passenger);
+ if (j > 0 && this.entity.aI().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, (EntityHuman) this.entity.passenger).isCancelled() && this.entity.passenger instanceof EntityHuman) {
+ this.entity.h((EntityHuman) this.entity.passenger);
this.entity.world.broadcastEntityEffect(this.entity, (byte) 7);
return;
}
- this.entity.t(5);
+ this.entity.v(5);
}
// CraftBukkit start - Handle dismounting to account for VehicleExitEvent being fired.
@@ -65,7 +65,7 @@ public class PathfinderGoalTame extends PathfinderGoal {
}
// this.entity.passenger = null;
// CraftBukkit end
- this.entity.cD();
+ this.entity.cH();
this.entity.world.broadcastEntityEffect(this.entity, (byte) 6);
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
index 2e561a7f42..c7698f7a41 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-import org.apache.commons.lang3.StringUtils;
+import net.minecraft.util.org.apache.commons.lang3.StringUtils;
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftEntity;
@@ -47,7 +47,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
}
- return true;
+ return !(entityliving instanceof EntityPlayer) || !((EntityPlayer) entityliving).playerInteractManager.isCreative();
}
}
}
@@ -144,7 +144,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
private boolean a(EntityLiving entityliving) {
- this.e = 10 + this.c.aD().nextInt(5);
+ this.e = 10 + this.c.aI().nextInt(5);
PathEntity pathentity = this.c.getNavigation().a(entityliving);
if (pathentity == null) {
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
deleted file mode 100644
index 2a96168eac..0000000000
--- a/src/main/java/net/minecraft/server/PendingConnection.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package net.minecraft.server;
-
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import javax.crypto.SecretKey;
-
-public class PendingConnection extends Connection {
-
- private static Random random = new Random();
- private byte[] d;
- private final MinecraftServer server;
- public final NetworkManager networkManager;
- public boolean b;
- private int f;
- private String g;
- private volatile boolean h;
- private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix
- private boolean j;
- private SecretKey k;
- public String hostname = ""; // CraftBukkit - add field
-
- public PendingConnection(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException
- this.server = minecraftserver;
- this.networkManager = new NetworkManager(minecraftserver.getLogger(), socket, s, this, minecraftserver.H().getPrivate());
- this.networkManager.e = 0;
- }
-
- // CraftBukkit start
- public Socket getSocket() {
- return this.networkManager.getSocket();
- }
- // CraftBukkit end
-
- public void d() {
- if (this.h) {
- this.e();
- }
-
- if (this.f++ == 600) {
- this.disconnect("Took too long to log in");
- } else {
- this.networkManager.b();
- }
- }
-
- public void disconnect(String s) {
- try {
- this.server.getLogger().info("Disconnecting " + this.getName() + ": " + s);
- this.networkManager.queue(new Packet255KickDisconnect(s));
- this.networkManager.d();
- this.b = true;
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- }
-
- public void a(Packet2Handshake packet2handshake) {
- if (this.g != null) {
- this.disconnect("Quit repeating yourself!");
- } else {
- this.hostname = packet2handshake.c + ':' + packet2handshake.d; // CraftBukkit - initialize field
- this.g = packet2handshake.f();
- if (!this.g.equals(StripColor.a(this.g))) {
- this.disconnect("Invalid username!");
- } else {
- PublicKey publickey = this.server.H().getPublic();
-
- if (packet2handshake.d() != 78) {
- if (packet2handshake.d() > 78) {
- this.disconnect("Outdated server!");
- } else {
- this.disconnect("Outdated client!");
- }
- } else {
- 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 a(Packet252KeyResponse packet252keyresponse) {
- PrivateKey privatekey = this.server.H().getPrivate();
-
- this.k = packet252keyresponse.a(privatekey);
- if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) {
- this.disconnect("Invalid client reply");
- }
-
- this.networkManager.queue(new Packet252KeyResponse());
- }
-
- public void a(Packet205ClientCommand packet205clientcommand) {
- if (packet205clientcommand.a == 0) {
- if (this.j) {
- this.disconnect("Duplicate login");
- return;
- }
-
- this.j = true;
- if (this.server.getOnlineMode()) {
- (new ThreadLoginVerifier(this, server.server)).start(); // CraftBukkit - add CraftServer
- } else {
- this.h = true;
- }
- }
- }
-
- public void a(Packet1Login packet1login) {}
-
- public void e() {
- // CraftBukkit start
- EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.g, this.hostname);
-
- if (s == null) {
- // this.disconnect(s);
- return;
- // CraftBukkit end
- } else {
- EntityPlayer entityplayer = this.server.getPlayerList().processLogin(s); // CraftBukkit - this.g -> s
-
- if (entityplayer != null) {
- this.server.getPlayerList().a((INetworkManager) this.networkManager, entityplayer);
- }
- }
-
- this.b = true;
- }
-
- public void a(String s, Object[] aobject) {
- this.server.getLogger().info(this.getName() + " lost connection");
- this.b = true;
- }
-
- public void a(Packet254GetInfo packet254getinfo) {
- if (this.networkManager.getSocket() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
- try {
- PlayerList playerlist = this.server.getPlayerList();
- String s = null;
- // CraftBukkit
- org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers());
- if (packet254getinfo.d()) {
- // CraftBukkit
- s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
- } else {
- // CraftBukkit start - Don't create a list from an array
- Object[] list = new Object[] { 1, 78, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() };
-
- StringBuilder builder = new StringBuilder();
- for (Object object : list) {
- if (builder.length() == 0) {
- builder.append('\u00A7');
- } else {
- builder.append('\0');
- }
-
- builder.append(org.apache.commons.lang.StringUtils.replace(object.toString(), "\0", ""));
- }
- s = builder.toString();
- // CraftBukkit end
- }
-
- InetAddress inetaddress = null;
-
- if (this.networkManager.getSocket() != null) {
- inetaddress = this.networkManager.getSocket().getInetAddress();
- }
-
- this.networkManager.queue(new Packet255KickDisconnect(s));
- this.networkManager.d();
- if (inetaddress != null && this.server.ag() instanceof DedicatedServerConnection) {
- ((DedicatedServerConnection) this.server.ag()).a(inetaddress);
- }
-
- this.b = true;
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- }
-
- public void onUnhandledPacket(Packet packet) {
- this.disconnect("Protocol error");
- }
-
- public String getName() {
- return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
- }
-
- public boolean a() {
- return true;
- }
-
- public boolean c() {
- return this.b;
- }
-
- static String a(PendingConnection pendingconnection) {
- return pendingconnection.loginKey;
- }
-
- static MinecraftServer b(PendingConnection pendingconnection) {
- return pendingconnection.server;
- }
-
- static SecretKey c(PendingConnection pendingconnection) {
- return pendingconnection.k;
- }
-
- static String d(PendingConnection pendingconnection) {
- return pendingconnection.g;
- }
-
- static boolean a(PendingConnection pendingconnection, boolean flag) {
- return pendingconnection.h = flag;
- }
-}
diff --git a/src/main/java/net/minecraft/server/PlayerAbilities.java b/src/main/java/net/minecraft/server/PlayerAbilities.java
index 7acea6e9a4..88718ce01c 100644
--- a/src/main/java/net/minecraft/server/PlayerAbilities.java
+++ b/src/main/java/net/minecraft/server/PlayerAbilities.java
@@ -26,19 +26,19 @@ public class PlayerAbilities {
}
public void b(NBTTagCompound nbttagcompound) {
- if (nbttagcompound.hasKey("abilities")) {
+ if (nbttagcompound.hasKeyOfType("abilities", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("abilities");
this.isInvulnerable = nbttagcompound1.getBoolean("invulnerable");
this.isFlying = nbttagcompound1.getBoolean("flying");
this.canFly = nbttagcompound1.getBoolean("mayfly");
this.canInstantlyBuild = nbttagcompound1.getBoolean("instabuild");
- if (nbttagcompound1.hasKey("flySpeed")) {
+ if (nbttagcompound1.hasKeyOfType("flySpeed", 99)) {
this.flySpeed = nbttagcompound1.getFloat("flySpeed");
this.walkSpeed = nbttagcompound1.getFloat("walkSpeed");
}
- if (nbttagcompound1.hasKey("mayBuild")) {
+ if (nbttagcompound1.hasKeyOfType("mayBuild", 1)) {
this.mayBuild = nbttagcompound1.getBoolean("mayBuild");
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 90083150d2..93153028a3 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -11,9 +11,8 @@ class PlayerChunk {
private int dirtyCount;
private int f;
private long g;
- private boolean loaded = false; // CraftBukkit
-
final PlayerChunkMap playerChunkMap;
+ private boolean loaded = false; // CraftBukkit
public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) {
this.playerChunkMap = playerchunkmap;
@@ -38,12 +37,10 @@ class PlayerChunk {
}
this.b.add(entityplayer);
-
// CraftBukkit start
if (this.loaded) {
entityplayer.chunkCoordIntPairQueue.add(this.location);
} else {
- // Abuse getChunkAt to add another callback
this.playerChunkMap.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, new Runnable() {
public void run() {
entityplayer.chunkCoordIntPairQueue.add(PlayerChunk.this.location);
@@ -58,7 +55,10 @@ class PlayerChunk {
if (this.b.contains(entityplayer)) {
Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z);
- entityplayer.playerConnection.sendPacket(new Packet51MapChunk(chunk, true, 0));
+ if (chunk.k()) {
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0));
+ }
+
this.b.remove(entityplayer);
entityplayer.chunkCoordIntPairQueue.remove(this.location);
if (this.b.isEmpty()) {
@@ -81,7 +81,7 @@ class PlayerChunk {
}
private void a(Chunk chunk) {
- chunk.q += PlayerChunkMap.a(this.playerChunkMap).getTime() - this.g;
+ chunk.s += PlayerChunkMap.a(this.playerChunkMap).getTime() - this.g;
this.g = PlayerChunkMap.a(this.playerChunkMap).getTime();
}
@@ -124,8 +124,8 @@ class PlayerChunk {
i = this.location.x * 16 + (this.dirtyBlocks[0] >> 12 & 15);
j = this.dirtyBlocks[0] & 255;
k = this.location.z * 16 + (this.dirtyBlocks[0] >> 8 & 15);
- this.sendAll(new Packet53BlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap)));
- if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(i, j, k)) {
+ this.sendAll(new PacketPlayOutBlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap)));
+ if (PlayerChunkMap.a(this.playerChunkMap).getType(i, j, k).isTileEntity()) {
this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(i, j, k));
}
} else {
@@ -134,7 +134,7 @@ class PlayerChunk {
if (this.dirtyCount == 64) {
i = this.location.x * 16;
j = this.location.z * 16;
- this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
+ this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).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.f & 1 << k) != 0) {
@@ -147,13 +147,13 @@ class PlayerChunk {
}
}
} else {
- this.sendAll(new Packet52MultiBlockChange(this.location.x, this.location.z, this.dirtyBlocks, this.dirtyCount, PlayerChunkMap.a(this.playerChunkMap)));
+ this.sendAll(new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z)));
for (i = 0; i < this.dirtyCount; ++i) {
j = this.location.x * 16 + (this.dirtyBlocks[i] >> 12 & 15);
k = this.dirtyBlocks[i] & 255;
l = this.location.z * 16 + (this.dirtyBlocks[i] >> 8 & 15);
- if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(j, k, l)) {
+ if (PlayerChunkMap.a(this.playerChunkMap).getType(j, k, l).isTileEntity()) {
this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(j, k, l));
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e4cb5c7667..2419ac29e4 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1,7 +1,6 @@
package net.minecraft.server;
import java.io.ByteArrayInputStream;
-import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -9,7 +8,13 @@ import java.util.Iterator;
import java.util.Random;
import java.util.concurrent.Callable;
-import org.apache.commons.lang3.StringUtils;
+import net.minecraft.util.com.google.common.base.Charsets;
+import net.minecraft.util.com.google.common.collect.Lists;
+import net.minecraft.util.io.netty.buffer.Unpooled;
+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
+import net.minecraft.util.org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
// CraftBukkit start
import java.io.UnsupportedEncodingException;
@@ -17,12 +22,13 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.HashSet;
-import org.bukkit.craftbukkit.inventory.CraftInventoryView;
-import org.bukkit.craftbukkit.inventory.CraftItemStack;
-import org.bukkit.craftbukkit.util.LazyPlayerSet;
-import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
+import org.bukkit.craftbukkit.util.LazyPlayerSet;
+import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -51,11 +57,11 @@ import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.InventoryView;
// CraftBukkit end
-public class PlayerConnection extends Connection {
+public class PlayerConnection implements PacketPlayInListener {
- public final INetworkManager networkManager;
+ private static final Logger c = LogManager.getLogger();
+ public final NetworkManager networkManager;
private final MinecraftServer minecraftServer;
- public boolean disconnected;
public EntityPlayer player;
private int e;
private int f;
@@ -65,17 +71,17 @@ public class PlayerConnection extends Connection {
private static Random j = new Random();
private long k;
private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); // CraftBukkit - multithreaded field
- private int x = 0;
+ private int x;
+ private IntHashMap n = new IntHashMap();
private double y;
private double z;
- private double p;
+ private double q;
public boolean checkMovement = true; // CraftBukkit - private -> public
- private IntHashMap r = new IntHashMap();
- public PlayerConnection(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) {
+ public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
- this.networkManager = inetworkmanager;
- inetworkmanager.a(this);
+ this.networkManager = networkmanager;
+ networkmanager.a((PacketListener) this);
this.player = entityplayer;
entityplayer.playerConnection = this;
@@ -97,36 +103,34 @@ public class PlayerConnection extends Connection {
private float lastYaw = Float.MAX_VALUE;
private boolean justTeleported = false;
- // For the packet15 hack :(
+ // For the PacketPlayOutBlockPlace hack :(
Long lastPacket;
// Store the last block right clicked and what type it was
- private int lastMaterial;
+ private Item lastMaterial;
public CraftPlayer getPlayer() {
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
}
- private final static HashSet invalidItems = new HashSet(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 52, 55, 59, 60, 62, 63, 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 95, 104, 105, 115, 117, 118, 119, 125, 127, 132, 137, 140, 141, 142, 144)); // TODO: Check after every update.
+ private final static HashSet invalidItems = new HashSet(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 52, 55, 59, 60, 62, 63, 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, 119, 125, 127, 132, 137, 140, 141, 142, 144)); // TODO: Check after every update.
// CraftBukkit end
- public void e() {
+ public void a() {
this.g = false;
++this.e;
- this.minecraftServer.methodProfiler.a("packetflow");
- this.networkManager.b();
- this.minecraftServer.methodProfiler.c("keepAlive");
- if ((long) this.e - this.k > 20L) {
+ this.minecraftServer.methodProfiler.a("keepAlive");
+ if ((long) this.e - this.k > 40L) {
this.k = (long) this.e;
- this.i = System.nanoTime() / 1000000L;
- this.h = j.nextInt();
- this.sendPacket(new Packet0KeepAlive(this.h));
+ this.i = this.d();
+ this.h = (int) this.i;
+ this.sendPacket(new PacketPlayOutKeepAlive(this.h));
}
// CraftBukkit start
for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ;
/* Use thread-safe field access instead
- if (this.m > 0) {
- --this.m;
+ if (this.chatThrottle > 0) {
+ --this.chatThrottle;
}
*/
// CraftBukkit end
@@ -139,46 +143,38 @@ public class PlayerConnection extends Connection {
this.minecraftServer.methodProfiler.b();
}
+ public NetworkManager b() {
+ return this.networkManager;
+ }
+
public void disconnect(String s) {
- if (!this.disconnected) {
- // CraftBukkit start
- String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
+ // CraftBukkit start
+ String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
- PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
+ PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
- if (this.server.getServer().isRunning()) {
- this.server.getPluginManager().callEvent(event);
- }
-
- if (event.isCancelled()) {
- // Do not kick the player
- return;
- }
- // Send the possibly modified leave message
- s = event.getReason();
- // CraftBukkit end
-
- this.player.l();
- this.sendPacket(new Packet255KickDisconnect(s));
- this.networkManager.d();
-
- // CraftBukkit start
- leaveMessage = event.getLeaveMessage();
- if (leaveMessage != null && leaveMessage.length() > 0) {
- this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(leaveMessage));
- }
- // CraftBukkit end
-
- this.minecraftServer.getPlayerList().disconnect(this.player);
- this.disconnected = true;
+ if (this.server.getServer().isRunning()) {
+ this.server.getPluginManager().callEvent(event);
}
+
+ if (event.isCancelled()) {
+ // Do not kick the player
+ return;
+ }
+ // Send the possibly modified leave message
+ s = event.getReason();
+ // CraftBukkit end
+ ChatComponentText chatcomponenttext = new ChatComponentText(s);
+
+ this.networkManager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener[] { new PlayerConnectionFuture(this, chatcomponenttext)});
+ this.networkManager.g();
}
- public void a(Packet27PlayerInput packet27playerinput) {
- this.player.a(packet27playerinput.d(), packet27playerinput.f(), packet27playerinput.g(), packet27playerinput.h());
+ public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) {
+ this.player.a(packetplayinsteervehicle.c(), packetplayinsteervehicle.d(), packetplayinsteervehicle.e(), packetplayinsteervehicle.f());
}
- public void a(Packet10Flying packet10flying) {
+ public void a(PacketPlayInFlying packetplayinflying) {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
this.g = true;
@@ -186,8 +182,8 @@ public class PlayerConnection extends Connection {
double d0;
if (!this.checkMovement) {
- d0 = packet10flying.y - this.z;
- if (packet10flying.x == this.y && d0 * d0 < 0.01D && packet10flying.z == this.p) {
+ d0 = packetplayinflying.d() - this.z;
+ if (packetplayinflying.c() == this.y && d0 * d0 < 0.01D && packetplayinflying.e() == this.q) {
this.checkMovement = true;
}
}
@@ -198,16 +194,16 @@ public class PlayerConnection extends Connection {
Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
// If the packet contains movement information then we update the To location with the correct XYZ.
- if (packet10flying.hasPos && !(packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D)) {
- to.setX(packet10flying.x);
- to.setY(packet10flying.y);
- to.setZ(packet10flying.z);
+ if (packetplayinflying.hasPos && !(packetplayinflying.hasPos && packetplayinflying.y == -999.0D && packetplayinflying.stance == -999.0D)) {
+ to.setX(packetplayinflying.x);
+ to.setY(packetplayinflying.y);
+ to.setZ(packetplayinflying.z);
}
// If the packet contains look information then we update the To location with the correct Yaw & Pitch.
- if (packet10flying.hasLook) {
- to.setYaw(packet10flying.yaw);
- to.setPitch(packet10flying.pitch);
+ if (packetplayinflying.hasLook) {
+ to.setYaw(packetplayinflying.yaw);
+ to.setPitch(packetplayinflying.pitch);
}
// Prevent 40 event-calls for less than a single pixel of movement >.>
@@ -228,7 +224,7 @@ public class PlayerConnection extends Connection {
// If the event is cancelled we move the player back to their old location.
if (event.isCancelled()) {
- this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(from.getX(), from.getY() + 1.6200000047683716D, from.getY(), from.getZ(), from.getYaw(), from.getPitch(), false));
+ this.player.playerConnection.sendPacket(new PacketPlayOutPosition(from.getX(), from.getY() + 1.6200000047683716D, from.getZ(), from.getYaw(), from.getPitch(), false));
return;
}
@@ -249,7 +245,7 @@ public class PlayerConnection extends Connection {
}
}
- if (Double.isNaN(packet10flying.x) || Double.isNaN(packet10flying.y) || Double.isNaN(packet10flying.z) || Double.isNaN(packet10flying.stance)) {
+ if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z) || Double.isNaN(packetplayinflying.stance)) {
player.teleport(player.getWorld().getSpawnLocation(), PlayerTeleportEvent.TeleportCause.UNKNOWN);
System.err.println(player.getName() + " was caught trying to crash the server with an invalid position.");
player.kickPlayer("Nope!");
@@ -266,28 +262,28 @@ public class PlayerConnection extends Connection {
float f = this.player.yaw;
float f1 = this.player.pitch;
- this.player.vehicle.W();
+ this.player.vehicle.ac();
d1 = this.player.locX;
d2 = this.player.locY;
d3 = this.player.locZ;
- if (packet10flying.hasLook) {
- f = packet10flying.yaw;
- f1 = packet10flying.pitch;
+ if (packetplayinflying.k()) {
+ f = packetplayinflying.g();
+ f1 = packetplayinflying.h();
}
- this.player.onGround = packet10flying.g;
- this.player.h();
- this.player.X = 0.0F;
+ this.player.onGround = packetplayinflying.i();
+ this.player.i();
+ this.player.W = 0.0F;
this.player.setLocation(d1, d2, d3, f, f1);
if (this.player.vehicle != null) {
- this.player.vehicle.W();
+ this.player.vehicle.ac();
}
this.minecraftServer.getPlayerList().d(this.player);
if (this.checkMovement) {
this.y = this.player.locX;
this.z = this.player.locY;
- this.p = this.player.locZ;
+ this.q = this.player.locZ;
}
worldserver.playerJoinedWorld(this.player);
@@ -295,8 +291,8 @@ public class PlayerConnection extends Connection {
}
if (this.player.isSleeping()) {
- this.player.h();
- this.player.setLocation(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
+ this.player.i();
+ this.player.setLocation(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
worldserver.playerJoinedWorld(this.player);
return;
}
@@ -304,45 +300,44 @@ public class PlayerConnection extends Connection {
d0 = this.player.locY;
this.y = this.player.locX;
this.z = this.player.locY;
- this.p = this.player.locZ;
+ this.q = this.player.locZ;
d1 = this.player.locX;
d2 = this.player.locY;
d3 = this.player.locZ;
float f2 = this.player.yaw;
float f3 = this.player.pitch;
- if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
- packet10flying.hasPos = false;
+ if (packetplayinflying.j() && packetplayinflying.d() == -999.0D && packetplayinflying.f() == -999.0D) {
+ packetplayinflying.a(false);
}
double d4;
- if (packet10flying.hasPos) {
- d1 = packet10flying.x;
- d2 = packet10flying.y;
- d3 = packet10flying.z;
- d4 = packet10flying.stance - packet10flying.y;
+ if (packetplayinflying.j()) {
+ d1 = packetplayinflying.c();
+ d2 = packetplayinflying.d();
+ d3 = packetplayinflying.e();
+ d4 = packetplayinflying.f() - packetplayinflying.d();
if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) {
this.disconnect("Illegal stance");
- this.minecraftServer.getLogger().warning(this.player.getName() + " had an illegal stance: " + d4);
+ c.warn(this.player.getName() + " had an illegal stance: " + d4);
return;
}
- if (Math.abs(packet10flying.x) > 3.2E7D || Math.abs(packet10flying.z) > 3.2E7D) {
- // CraftBukkit - teleport to previous position instead of kicking, players get stuck
- this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
+ if (Math.abs(packetplayinflying.c()) > 3.2E7D || Math.abs(packetplayinflying.e()) > 3.2E7D) {
+ this.disconnect("Illegal position");
return;
}
}
- if (packet10flying.hasLook) {
- f2 = packet10flying.yaw;
- f3 = packet10flying.pitch;
+ if (packetplayinflying.k()) {
+ f2 = packetplayinflying.g();
+ f3 = packetplayinflying.h();
}
- this.player.h();
- this.player.X = 0.0F;
- this.player.setLocation(this.y, this.z, this.p, f2, f3);
+ this.player.i();
+ this.player.W = 0.0F;
+ this.player.setLocation(this.y, this.z, this.q, f2, f3);
if (!this.checkMovement) {
return;
}
@@ -357,21 +352,21 @@ public class PlayerConnection extends Connection {
// CraftBukkit end
double d10 = d7 * d7 + d8 * d8 + d9 * d9;
- if (d10 > 100.0D && this.checkMovement && (!this.minecraftServer.K() || !this.minecraftServer.J().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
- this.minecraftServer.getLogger().warning(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")");
- this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
+ if (d10 > 100.0D && this.checkMovement && (!this.minecraftServer.L() || !this.minecraftServer.K().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
+ c.warn(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")");
+ this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
return;
}
float f4 = 0.0625F;
boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
- if (this.player.onGround && !packet10flying.g && d5 > 0.0D) {
- this.player.a(0.2F);
+ if (this.player.onGround && !packetplayinflying.i() && d5 > 0.0D) {
+ this.player.bj();
}
this.player.move(d4, d5, d6);
- this.player.onGround = packet10flying.g;
+ this.player.onGround = packetplayinflying.i();
this.player.checkMovement(d4, d5, d6);
double d11 = d5;
@@ -387,14 +382,14 @@ public class PlayerConnection extends Connection {
if (d10 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) {
flag1 = true;
- this.minecraftServer.getLogger().warning(this.player.getName() + " moved wrongly!");
+ c.warn(this.player.getName() + " moved wrongly!");
}
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)).isEmpty();
if (flag && (flag1 || !flag2) && !this.player.isSleeping()) {
- this.a(this.y, this.z, this.p, f2, f3);
+ this.a(this.y, this.z, this.q, f2, f3);
return;
}
@@ -404,7 +399,7 @@ public class PlayerConnection extends Connection {
if (d11 >= -0.03125D) {
++this.f;
if (this.f > 80) {
- this.minecraftServer.getLogger().warning(this.player.getName() + " was kicked for floating too long!");
+ c.warn(this.player.getName() + " was kicked for floating too long!");
this.disconnect("Flying is not enabled on this server");
return;
}
@@ -413,12 +408,12 @@ public class PlayerConnection extends Connection {
this.f = 0;
}
- this.player.onGround = packet10flying.g;
+ this.player.onGround = packetplayinflying.i();
this.minecraftServer.getPlayerList().d(this.player);
if (this.player.playerInteractManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
- this.player.b(this.player.locY - d0, packet10flying.g);
+ this.player.b(this.player.locY - d0, packetplayinflying.i());
} else if (this.e % 20 == 0) {
- this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
+ this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
}
}
}
@@ -467,18 +462,17 @@ public class PlayerConnection extends Connection {
this.checkMovement = false;
this.y = d0;
this.z = d1;
- this.p = d2;
+ this.q = d2;
this.player.setLocation(d0, d1, d2, f, f1);
- this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false));
+ this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0, d1 + 1.6200000047683716D, d2, f, f1, false));
}
- public void a(Packet14BlockDig packet14blockdig) {
+ public void a(PacketPlayInBlockDig packetplayinblockdig) {
if (this.player.dead) return; // CraftBukkit
-
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
- this.player.u();
- if (packet14blockdig.e == 4) {
+ this.player.w();
+ if (packetplayinblockdig.g() == 4) {
// CraftBukkit start
// If the ticks aren't the same then the count starts from 0 and we update the lastDropTick.
if (this.lastDropTick != MinecraftServer.currentTick) {
@@ -488,35 +482,35 @@ public class PlayerConnection extends Connection {
// Else we increment the drop count and check the amount.
this.dropCount++;
if (this.dropCount >= 20) {
- this.minecraftServer.getLogger().warning(this.player.getName() + " dropped their items too quickly!");
+ this.c.warn(this.player.getName() + " dropped their items too quickly!");
this.disconnect("You dropped your items too quickly (Hacking?)");
return;
}
}
// CraftBukkit end
this.player.a(false);
- } else if (packet14blockdig.e == 3) {
+ } else if (packetplayinblockdig.g() == 3) {
this.player.a(true);
- } else if (packet14blockdig.e == 5) {
- this.player.bt();
+ } else if (packetplayinblockdig.g() == 5) {
+ this.player.by();
} else {
boolean flag = false;
- if (packet14blockdig.e == 0) {
+ if (packetplayinblockdig.g() == 0) {
flag = true;
}
- if (packet14blockdig.e == 1) {
+ if (packetplayinblockdig.g() == 1) {
flag = true;
}
- if (packet14blockdig.e == 2) {
+ if (packetplayinblockdig.g() == 2) {
flag = true;
}
- int i = packet14blockdig.a;
- int j = packet14blockdig.b;
- int k = packet14blockdig.c;
+ int i = packetplayinblockdig.c();
+ int j = packetplayinblockdig.d();
+ int k = packetplayinblockdig.e();
if (flag) {
double d0 = this.player.locX - ((double) i + 0.5D);
@@ -533,13 +527,13 @@ public class PlayerConnection extends Connection {
}
}
- if (packet14blockdig.e == 0) {
- // CraftBukkit start
+ if (packetplayinblockdig.g() == 0) {
if (!this.minecraftServer.a(worldserver, i, j, k, this.player)) {
- this.player.playerInteractManager.dig(i, j, k, packet14blockdig.face);
+ this.player.playerInteractManager.dig(i, j, k, packetplayinblockdig.f());
} else {
- CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, packet14blockdig.face, this.player.inventory.getItemInHand());
- this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
+ // CraftBukkit start
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, packetplayinblockdig.f(), this.player.inventory.getItemInHand());
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver));
// Update any tile entity data for this block
TileEntity tileentity = worldserver.getTileEntity(i, j, k);
if (tileentity != null) {
@@ -547,21 +541,21 @@ public class PlayerConnection extends Connection {
}
// CraftBukkit end
}
- } else if (packet14blockdig.e == 2) {
+ } else if (packetplayinblockdig.g() == 2) {
this.player.playerInteractManager.a(i, j, k);
- if (worldserver.getTypeId(i, j, k) != 0) {
- this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
+ if (worldserver.getType(i, j, k).getMaterial() != Material.AIR) {
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver));
}
- } else if (packet14blockdig.e == 1) {
+ } else if (packetplayinblockdig.g() == 1) {
this.player.playerInteractManager.c(i, j, k);
- if (worldserver.getTypeId(i, j, k) != 0) {
- this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
+ if (worldserver.getType(i, j, k).getMaterial() != Material.AIR) {
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver));
}
}
}
}
- public void a(Packet15Place packet15place) {
+ public void a(PacketPlayInBlockPlace packetplayinblockplace) {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
// CraftBukkit start
@@ -574,33 +568,30 @@ public class PlayerConnection extends Connection {
// If the time between packets is small enough, and the 'signature' similar, we discard the
// second one. This sadly has to remain until Mojang makes their packets saner. :(
// -- Grum
-
- this.player.u();
- if (packet15place.getFace() == 255) {
- if (packet15place.getItemStack() != null && packet15place.getItemStack().id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) {
+ if (packetplayinblockplace.getFace() == 255) {
+ if (packetplayinblockplace.getItemStack() != null && packetplayinblockplace.getItemStack().getItem() == this.lastMaterial && this.lastPacket != null && packetplayinblockplace.timestamp - this.lastPacket < 100) {
this.lastPacket = null;
return;
}
} else {
- this.lastMaterial = packet15place.getItemStack() == null ? -1 : packet15place.getItemStack().id;
- this.lastPacket = packet15place.timestamp;
+ this.lastMaterial = packetplayinblockplace.getItemStack() == null ? null : packetplayinblockplace.getItemStack().getItem();
+ this.lastPacket = packetplayinblockplace.timestamp;
}
-
- // CraftBukkit - if rightclick decremented the item, always send the update packet.
+ // CraftBukkit - if rightclick decremented the item, always send the update packet. */
// this is not here for CraftBukkit's own functionality; rather it is to fix
// a notch bug where the item doesn't update correctly.
boolean always = false;
-
// CraftBukkit end
ItemStack itemstack = this.player.inventory.getItemInHand();
boolean flag = false;
- int i = packet15place.d();
- int j = packet15place.f();
- int k = packet15place.g();
- int l = packet15place.getFace();
+ int i = packetplayinblockplace.c();
+ int j = packetplayinblockplace.d();
+ int k = packetplayinblockplace.e();
+ int l = packetplayinblockplace.getFace();
- if (packet15place.getFace() == 255) {
+ this.player.w();
+ if (packetplayinblockplace.getFace() == 255) {
if (itemstack == null) {
return;
}
@@ -617,8 +608,11 @@ public class PlayerConnection extends Connection {
// inventory update packet to get sent
always = (itemstack.count != itemstackAmount);
// CraftBukkit end
- } else if (packet15place.f() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packet15place.getFace() == 1 || packet15place.f() >= this.minecraftServer.getMaxBuildHeight())) {
- this.player.playerConnection.sendPacket(new Packet3Chat(ChatMessage.b("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())}).a(EnumChatFormat.RED)));
+ } else if (packetplayinblockplace.d() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packetplayinblockplace.getFace() == 1 || packetplayinblockplace.d() >= this.minecraftServer.getMaxBuildHeight())) {
+ ChatMessage chatmessage = new ChatMessage("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())});
+
+ chatmessage.b().setColor(EnumChatFormat.RED);
+ this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage));
flag = true;
} else {
// CraftBukkit start - Check if we can actually do something over this large a distance
@@ -627,14 +621,14 @@ public class PlayerConnection extends Connection {
return;
}
- this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.k(), packet15place.l());
+ this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j());
// CraftBukkit end
flag = true;
}
if (flag) {
- this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver));
if (l == 0) {
--j;
}
@@ -659,7 +653,7 @@ public class PlayerConnection extends Connection {
++i;
}
- this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver));
}
itemstack = this.player.inventory.getItemInHand();
@@ -676,45 +670,45 @@ public class PlayerConnection extends Connection {
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.getItemStack()) || always) {
- this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.g, this.player.inventory.getItemInHand()));
+ if (!ItemStack.matches(this.player.inventory.getItemInHand(), packetplayinblockplace.getItemStack()) || always) {
+ this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, this.player.inventory.getItemInHand()));
}
}
}
- public void a(String s, Object[] aobject) {
- if (this.disconnected) return; // CraftBukkit - Rarely it would send a disconnect line twice
+ public void a(IChatBaseComponent ichatbasecomponent) {
+ c.info(this.player.getName() + " lost connection: " + ichatbasecomponent.c()); // CraftBukkit - Don't toString the component
+ this.minecraftServer.au();
+ // CraftBukkit start - Replace vanilla quit message handling with our own.
+ /*
+ ChatMessage chatmessage = new ChatMessage("multiplayer.player.left", new Object[] { this.player.getScoreboardDisplayName()});
- this.minecraftServer.getLogger().info(this.player.getName() + " lost connection: " + s);
- // CraftBukkit start - We need to handle custom quit messages
+ chatmessage.b().setColor(EnumChatFormat.YELLOW);
+ this.minecraftServer.getPlayerList().sendMessage(chatmessage);
+ */
+
+ this.player.n();
String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player);
if ((quitMessage != null) && (quitMessage.length() > 0)) {
- this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(quitMessage));
+ this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage));
}
// CraftBukkit end
- this.disconnected = true;
- if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) {
- this.minecraftServer.getLogger().info("Stopping singleplayer server as player logged out");
+ if (this.minecraftServer.L() && this.player.getName().equals(this.minecraftServer.K())) {
+ c.info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown();
}
}
- public void onUnhandledPacket(Packet packet) {
- if (this.disconnected) return; // CraftBukkit
- this.minecraftServer.getLogger().warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
- this.disconnect("Protocol error, unexpected packet");
- }
-
public void sendPacket(Packet packet) {
- if (packet instanceof Packet3Chat) {
- Packet3Chat packet3chat = (Packet3Chat) packet;
- int i = this.player.getChatFlags();
+ if (packet instanceof PacketPlayOutChat) {
+ PacketPlayOutChat packetplayoutchat = (PacketPlayOutChat) packet;
+ EnumChatVisibility enumchatvisibility = this.player.getChatFlags();
- if (i == 2) {
+ if (enumchatvisibility == EnumChatVisibility.HIDDEN) {
return;
}
- if (i == 1 && !packet3chat.isServer()) {
+ if (enumchatvisibility == EnumChatVisibility.SYSTEM && !packetplayoutchat.d()) {
return;
}
}
@@ -722,133 +716,65 @@ public class PlayerConnection extends Connection {
// CraftBukkit start
if (packet == null) {
return;
- } else if (packet instanceof Packet6SpawnPosition) {
- Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
+ } else if (packet instanceof PacketPlayOutSpawnPosition) {
+ PacketPlayOutSpawnPosition packet6 = (PacketPlayOutSpawnPosition) packet;
this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
}
// CraftBukkit end
try {
- this.networkManager.queue(packet);
+ this.networkManager.handle(packet, new GenericFutureListener[0]);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
- crashreportsystemdetails.a("Packet ID", (Callable) (new CrashReportConnectionPacketID(this, packet)));
crashreportsystemdetails.a("Packet class", (Callable) (new CrashReportConnectionPacketClass(this, packet)));
throw new ReportedException(crashreport);
}
}
- public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
+ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
// CraftBukkit start
if (this.player.dead) return;
- if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) {
- PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
+ if (packetplayinhelditemslot.c() >= 0 && packetplayinhelditemslot.c() < PlayerInventory.getHotbarSize()) {
+ PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packetplayinhelditemslot.c());
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
- this.sendPacket(new Packet16BlockItemSwitch(this.player.inventory.itemInHandIndex));
- this.player.u();
+ this.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
+ this.player.w();
return;
}
// CraftBukkit end
- this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
- this.player.u();
+ this.player.inventory.itemInHandIndex = packetplayinhelditemslot.c();
+ this.player.w();
} else {
- this.minecraftServer.getLogger().warning(this.player.getName() + " tried to set an invalid carried item");
+ c.warn(this.player.getName() + " tried to set an invalid carried item");
this.disconnect("Nope!"); // CraftBukkit
}
}
- public void a(Packet3Chat packet3chat) {
- if (this.player.getChatFlags() == 2) {
- this.sendPacket(new Packet3Chat(ChatMessage.e("chat.cannotSend").a(EnumChatFormat.RED)));
+ public void a(PacketPlayInChat packetplayinchat) {
+ if (this.player.getChatFlags() == EnumChatVisibility.HIDDEN) {
+ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
+
+ chatmessage.b().setColor(EnumChatFormat.RED);
+ this.sendPacket(new PacketPlayOutChat(chatmessage));
} else {
- this.player.u();
- String s = packet3chat.message;
+ this.player.w();
+ String s = packetplayinchat.c();
- if (s.length() > 100) {
- // CraftBukkit start
- if (packet3chat.a_()) {
- Waitable waitable = new Waitable() {
- @Override
- protected Object evaluate() {
- PlayerConnection.this.disconnect("Chat message too long");
- return null;
- }
- };
+ s = StringUtils.normalizeSpace(s);
- this.minecraftServer.processQueue.add(waitable);
-
- try {
- waitable.get();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- } catch (ExecutionException e) {
- throw new RuntimeException(e);
- }
- } else {
- this.disconnect("Chat message too long");
- }
- // CraftBukkit end
- } else {
- s = StringUtils.normalizeSpace(s);
-
- for (int i = 0; i < s.length(); ++i) {
- if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
- // CraftBukkit start
- if (packet3chat.a_()) {
- Waitable waitable = new Waitable() {
- @Override
- protected Object evaluate() {
- PlayerConnection.this.disconnect("Illegal characters in chat");
- return null;
- }
- };
-
- this.minecraftServer.processQueue.add(waitable);
-
- try {
- waitable.get();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- } catch (ExecutionException e) {
- throw new RuntimeException(e);
- }
- } else {
- this.disconnect("Illegal characters in chat");
- }
- // CraftBukkit end
- return;
- }
- }
-
- // CraftBukkit start
- if (this.player.getChatFlags() == 1 && !s.startsWith("/")) {
- this.sendPacket(new Packet3Chat(ChatMessage.e("chat.cannotSend").a(EnumChatFormat.RED)));
- return;
- }
-
- if (!packet3chat.a_()) {
- try {
- this.minecraftServer.server.playerCommandState = true;
- this.chat(s, packet3chat.a_());
- } finally {
- this.minecraftServer.server.playerCommandState = false;
- }
- } else {
- this.chat(s, packet3chat.a_());
- }
-
- // This section stays because it is only applicable to packets
- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam
- if (packet3chat.a_()) {
+ for (int i = 0; i < s.length(); ++i) {
+ if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
+ // CraftBukkit start - threadsafety
+ if (packetplayinchat.a()) {
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
- PlayerConnection.this.disconnect("disconnect.spam");
+ PlayerConnection.this.disconnect("Illegal characters in chat");
return null;
}
};
@@ -863,28 +789,59 @@ public class PlayerConnection extends Connection {
throw new RuntimeException(e);
}
} else {
- this.disconnect("disconnect.spam");
+ this.disconnect("Illegal characters in chat");
}
+ // CraftBukkit end
+ return;
}
}
+
+ if (s.startsWith("/")) {
+ // CraftBukkit start
+ try {
+ this.minecraftServer.server.playerCommandState = true;
+ this.handleCommand(s);
+ } finally {
+ this.minecraftServer.server.playerCommandState = false;
+ }
+ } else if (s.isEmpty()) {
+ c.warn(this.player.getName() + " tried to send an empty message");
+ } else if (getPlayer().isConversing()) {
+ getPlayer().acceptConversationInput(s);
+ } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check
+ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
+
+ chatmessage.b().setColor(EnumChatFormat.RED);
+ this.sendPacket(new PacketPlayOutChat(chatmessage));
+ } else if (true) {
+ this.chat(s, packetplayinchat.a());
+ // CraftBukkit end - the below is for reference. :)
+ } else {
+ ChatMessage chatmessage1 = new ChatMessage("chat.type.text", new Object[] { this.player.getScoreboardDisplayName(), s});
+
+ this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false);
+ }
+
+ // CraftBukkit start - replaced with thread safe throttle
+ // this.chatThrottle += 20;
+ if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) {
+ // CraftBukkit end
+ this.disconnect("disconnect.spam");
+ }
}
}
+ // CraftBukkit start
public void chat(String s, boolean async) {
+ if (s.isEmpty()) {
+ return;
+ }
+
if (!this.player.dead) {
- if (s.length() == 0) {
- this.minecraftServer.getLogger().warning(this.player.getName() + " tried to send an empty message");
- return;
- }
-
- if (getPlayer().isConversing()) {
- getPlayer().acceptConversationInput(s);
- return;
- }
-
if (s.startsWith("/")) {
this.handleCommand(s);
- return;
+ } else if (this.player.getChatFlags() != EnumChatVisibility.FULL) {
+ // Do nothing, this is coming from a plugin
} else {
Player player = this.getPlayer();
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet());
@@ -907,7 +864,7 @@ public class PlayerConnection extends Connection {
PlayerConnection.this.minecraftServer.console.sendMessage(message);
if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) {
for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) {
- ((EntityPlayer) player).sendMessage(ChatMessage.d(message));
+ ((EntityPlayer) player).sendMessage(CraftChatMessage.fromString(message));
}
} else {
for (Player player : queueEvent.getRecipients()) {
@@ -937,7 +894,7 @@ public class PlayerConnection extends Connection {
minecraftServer.console.sendMessage(s);
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getPlayerList().players) {
- ((EntityPlayer) recipient).sendMessage(ChatMessage.d(s));
+ ((EntityPlayer) recipient).sendMessage(CraftChatMessage.fromString(s));
}
} else {
for (Player recipient : event.getRecipients()) {
@@ -947,8 +904,6 @@ public class PlayerConnection extends Connection {
}
}
}
-
- return;
}
// CraftBukkit end
@@ -964,7 +919,7 @@ public class PlayerConnection extends Connection {
}
try {
- this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit
+ this.c.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
return;
}
@@ -973,18 +928,14 @@ public class PlayerConnection extends Connection {
java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return;
}
+ //this.minecraftServer.getCommandHandler().a(this.player, s);
// CraftBukkit end
-
- /* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above.
- this.minecraftServer.getCommandHandler().a(this.player, s);
- // CraftBukkit end */
}
- public void a(Packet18ArmAnimation packet18armanimation) {
+ public void a(PacketPlayInArmAnimation packetplayinarmanimation) {
if (this.player.dead) return; // CraftBukkit
-
- this.player.u();
- if (packet18armanimation.b == 1) {
+ this.player.w();
+ if (packetplayinarmanimation.d() == 1) {
// CraftBukkit start - Raytrace to look for 'rogue armswings'
float f = 1.0F;
float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
@@ -1004,7 +955,7 @@ public class PlayerConnection extends Connection {
Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true);
- if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.TILE) {
+ if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.BLOCK) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand());
}
@@ -1015,17 +966,17 @@ public class PlayerConnection extends Connection {
if (event.isCancelled()) return;
// CraftBukkit end
- this.player.aV();
+ this.player.ba();
}
}
- public void a(Packet19EntityAction packet19entityaction) {
+ public void a(PacketPlayInEntityAction packetplayinentityaction) {
// CraftBukkit start
if (this.player.dead) return;
- this.player.u();
- if (packet19entityaction.animation == 1 || packet19entityaction.animation == 2) {
- PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packet19entityaction.animation == 1);
+ this.player.w();
+ if (packetplayinentityaction.d() == 1 || packetplayinentityaction.d() == 2) {
+ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packetplayinentityaction.d() == 1);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -1033,8 +984,8 @@ public class PlayerConnection extends Connection {
}
}
- if (packet19entityaction.animation == 4 || packet19entityaction.animation == 5) {
- PlayerToggleSprintEvent event = new PlayerToggleSprintEvent(this.getPlayer(), packet19entityaction.animation == 4);
+ if (packetplayinentityaction.d() == 4 || packetplayinentityaction.d() == 5) {
+ PlayerToggleSprintEvent event = new PlayerToggleSprintEvent(this.getPlayer(), packetplayinentityaction.d() == 4);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -1043,41 +994,32 @@ public class PlayerConnection extends Connection {
}
// CraftBukkit end
- if (packet19entityaction.animation == 1) {
+ if (packetplayinentityaction.d() == 1) {
this.player.setSneaking(true);
- } else if (packet19entityaction.animation == 2) {
+ } else if (packetplayinentityaction.d() == 2) {
this.player.setSneaking(false);
- } else if (packet19entityaction.animation == 4) {
+ } else if (packetplayinentityaction.d() == 4) {
this.player.setSprinting(true);
- } else if (packet19entityaction.animation == 5) {
+ } else if (packetplayinentityaction.d() == 5) {
this.player.setSprinting(false);
- } else if (packet19entityaction.animation == 3) {
+ } else if (packetplayinentityaction.d() == 3) {
this.player.a(false, true, true);
- // this.checkMovement = false; // CraftBukkit - this is handled in teleport
- } else if (packet19entityaction.animation == 6) {
+ //this.checkMovement = false; // CraftBukkit - this is handled in teleport
+ } else if (packetplayinentityaction.d() == 6) {
if (this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) {
- ((EntityHorse) this.player.vehicle).u(packet19entityaction.c);
+ ((EntityHorse) this.player.vehicle).w(packetplayinentityaction.e());
}
- } else if (packet19entityaction.animation == 7 && this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) {
- ((EntityHorse) this.player.vehicle).f(this.player);
+ } else if (packetplayinentityaction.d() == 7 && this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) {
+ ((EntityHorse) this.player.vehicle).g(this.player);
}
}
- public void a(Packet255KickDisconnect packet255kickdisconnect) {
- this.networkManager.a("disconnect.quitting", new Object[0]);
- }
-
- public int lowPriorityCount() {
- return this.networkManager.e();
- }
-
- public void a(Packet7UseEntity packet7useentity) {
+ public void a(PacketPlayInUseEntity packetplayinuseentity) {
if (this.player.dead) return; // CraftBukkit
-
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
- Entity entity = worldserver.getEntity(packet7useentity.target);
+ Entity entity = packetplayinuseentity.a((World) worldserver);
- this.player.u();
+ this.player.w();
if (entity != null) {
boolean flag = this.player.o(entity);
double d0 = 36.0D;
@@ -1088,47 +1030,49 @@ public class PlayerConnection extends Connection {
if (this.player.e(entity) < d0) {
ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit
- if (packet7useentity.action == 0) {
+ if (packetplayinuseentity.c() == EnumEntityUseAction.INTERACT) {
// CraftBukkit start
- boolean triggerTagUpdate = itemInHand != null && itemInHand.id == Item.NAME_TAG.id && entity instanceof EntityInsentient;
- boolean triggerChestUpdate = itemInHand != null && itemInHand.id == Block.CHEST.id && entity instanceof EntityHorse;
- boolean triggerLeashUpdate = itemInHand != null && itemInHand.id == Item.LEASH.id && entity instanceof EntityInsentient;
+ boolean triggerTagUpdate = itemInHand != null && itemInHand.getItem() == Items.NAME_TAG && entity instanceof EntityInsentient;
+ boolean triggerChestUpdate = itemInHand != null && itemInHand.getItem() == Item.getItemOf(Blocks.CHEST) && entity instanceof EntityHorse;
+ boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEASH && entity instanceof EntityInsentient;
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity());
this.server.getPluginManager().callEvent(event);
- if (triggerLeashUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Item.LEASH.id)) {
+ if (triggerLeashUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != Items.LEASH)) {
// Refresh the current leash state
- this.sendPacket(new Packet39AttachEntity(1, entity, ((EntityInsentient) entity).getLeashHolder()));
+ this.sendPacket(new PacketPlayOutAttachEntity(1, entity, ((EntityInsentient) entity).getLeashHolder()));
}
- if (triggerTagUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Item.NAME_TAG.id)) {
+ if (triggerTagUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != Items.NAME_TAG)) {
// Refresh the current entity metadata
- this.sendPacket(new Packet40EntityMetadata(entity.id, entity.datawatcher, true));
+ this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true));
}
- if (triggerChestUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Block.CHEST.id)) {
- this.sendPacket(new Packet40EntityMetadata(entity.id, entity.datawatcher, true));
+ if (triggerChestUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != Item.getItemOf(Blocks.CHEST))) {
+ this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true));
}
if (event.isCancelled()) {
return;
}
// CraftBukkit end
+
this.player.p(entity);
- // CraftBukkit start - Update the client if the item is an infinite one
+
+ // CraftBukkit start
if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer);
}
- } else if (packet7useentity.action == 1) {
- // CraftBukkit - Check for player
- if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow) || (entity == this.player)) {
- String type = entity.getClass().getSimpleName();
- disconnect("Attacking an " + type + " is not permitted");
- System.out.println("Player " + player.getName() + " tried to attack an " + type + ", so I have disconnected them for exploiting.");
+ // CraftBukkit end
+ } else if (packetplayinuseentity.c() == EnumEntityUseAction.ATTACK) {
+ if (entity instanceof EntityItem || entity instanceof EntityExperienceOrb || entity instanceof EntityArrow || entity == this.player) {
+ this.disconnect("Attempting to attack an invalid entity");
+ this.minecraftServer.warning("Player " + this.player.getName() + " tried to attack an invalid entity");
return;
}
this.player.attack(entity);
+ // CraftBukkit start
if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer);
}
@@ -1138,15 +1082,18 @@ public class PlayerConnection extends Connection {
}
}
- public void a(Packet205ClientCommand packet205clientcommand) {
- this.player.u();
- if (packet205clientcommand.a == 1) {
+ public void a(PacketPlayInClientCommand packetplayinclientcommand) {
+ this.player.w();
+ EnumClientCommand enumclientcommand = packetplayinclientcommand.c();
+
+ switch (ClientCommandOrdinalWrapper.a[enumclientcommand.ordinal()]) {
+ case 1:
if (this.player.viewingCredits) {
this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management
- } else if (this.player.p().getWorldData().isHardcore()) {
- if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) {
+ } else if (this.player.r().getWorldData().isHardcore()) {
+ if (this.minecraftServer.L() && this.player.getName().equals(this.minecraftServer.K())) {
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
- this.minecraftServer.R();
+ this.minecraftServer.S();
} else {
BanEntry banentry = new BanEntry(this.player.getName());
@@ -1161,35 +1108,37 @@ public class PlayerConnection extends Connection {
this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, false);
}
+ break;
+
+ case 2:
+ this.player.x().a(this.player);
+ break;
+
+ case 3:
+ this.player.a((Statistic) AchievementList.f);
}
}
- public boolean b() {
- return true;
- }
-
- public void a(Packet9Respawn packet9respawn) {}
-
- public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
+ public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
if (this.player.dead) return; // CraftBukkit
CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
- this.player.k();
+ this.player.m();
}
- public void a(Packet102WindowClick packet102windowclick) {
+ public void a(PacketPlayInWindowClick packetplayinwindowclick) {
if (this.player.dead) return; // CraftBukkit
- this.player.u();
- if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
+ this.player.w();
+ if (this.player.activeContainer.windowId == packetplayinwindowclick.c() && this.player.activeContainer.c(this.player)) {
// CraftBukkit start - Call InventoryClickEvent
- if (packet102windowclick.slot < -1 && packet102windowclick.slot != -999) {
+ if (packetplayinwindowclick.d() < -1 && packetplayinwindowclick.d() != -999) {
return;
}
InventoryView inventory = this.player.activeContainer.getBukkitView();
- SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot);
+ SlotType type = CraftInventoryView.getSlotType(inventory, packetplayinwindowclick.d());
InventoryClickEvent event = null;
ClickType click = ClickType.UNKNOWN;
@@ -1197,37 +1146,37 @@ public class PlayerConnection extends Connection {
ItemStack itemstack = null;
- if (packet102windowclick.slot == -1) {
+ if (packetplayinwindowclick.d() == -1) {
type = SlotType.OUTSIDE; // override
- click = packet102windowclick.button == 0 ? ClickType.WINDOW_BORDER_LEFT : ClickType.WINDOW_BORDER_RIGHT;
+ click = packetplayinwindowclick.e() == 0 ? ClickType.WINDOW_BORDER_LEFT : ClickType.WINDOW_BORDER_RIGHT;
action = InventoryAction.NOTHING;
- } else if (packet102windowclick.shift == 0) {
- if (packet102windowclick.button == 0) {
+ } else if (packetplayinwindowclick.h() == 0) {
+ if (packetplayinwindowclick.e() == 0) {
click = ClickType.LEFT;
- } else if (packet102windowclick.button == 1) {
+ } else if (packetplayinwindowclick.e() == 1) {
click = ClickType.RIGHT;
}
- if (packet102windowclick.button == 0 || packet102windowclick.button == 1) {
+ if (packetplayinwindowclick.e() == 0 || packetplayinwindowclick.e() == 1) {
action = InventoryAction.NOTHING; // Don't want to repeat ourselves
- if (packet102windowclick.slot == -999) {
+ if (packetplayinwindowclick.d() == -999) {
if (player.inventory.getCarried() != null) {
- action = packet102windowclick.button == 0 ? InventoryAction.DROP_ALL_CURSOR : InventoryAction.DROP_ONE_CURSOR;
+ action = packetplayinwindowclick.e() == 0 ? InventoryAction.DROP_ALL_CURSOR : InventoryAction.DROP_ONE_CURSOR;
}
} else {
- Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
+ Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d());
if (slot != null) {
ItemStack clickedItem = slot.getItem();
ItemStack cursor = player.inventory.getCarried();
if (clickedItem == null) {
if (cursor != null) {
- action = packet102windowclick.button == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE;
+ action = packetplayinwindowclick.e() == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE;
}
} else if (slot.a(player)) { // Should be Slot.isPlayerAllowed
if (cursor == null) {
- action = packet102windowclick.button == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF;
+ action = packetplayinwindowclick.e() == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF;
} else if (slot.isAllowed(cursor)) { // Should be Slot.isItemAllowed
if (clickedItem.doMaterialsMatch(cursor) && ItemStack.equals(clickedItem, cursor)) {
- int toPlace = packet102windowclick.button == 0 ? cursor.count : 1;
+ int toPlace = packetplayinwindowclick.e() == 0 ? cursor.count : 1;
toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.count);
toPlace = Math.min(toPlace, slot.inventory.getMaxStackSize() - clickedItem.count);
if (toPlace == 1) {
@@ -1242,7 +1191,7 @@ public class PlayerConnection extends Connection {
} else if (cursor.count <= slot.a()) { // Should be Slot.getMaxStackSize()
action = InventoryAction.SWAP_WITH_CURSOR;
}
- } else if (cursor.id == clickedItem.id && (!cursor.usesData() || cursor.getData() == clickedItem.getData()) && ItemStack.equals(cursor, clickedItem)) {
+ } else if (cursor.getItem() == clickedItem.getItem() && (!cursor.usesData() || cursor.getData() == clickedItem.getData()) && ItemStack.equals(cursor, clickedItem)) {
if (clickedItem.count >= 0) {
if (clickedItem.count + cursor.count <= cursor.getMaxStackSize()) {
// As of 1.5, this is result slots only
@@ -1254,17 +1203,17 @@ public class PlayerConnection extends Connection {
}
}
}
- } else if (packet102windowclick.shift == 1) {
- if (packet102windowclick.button == 0) {
+ } else if (packetplayinwindowclick.h() == 1) {
+ if (packetplayinwindowclick.e() == 0) {
click = ClickType.SHIFT_LEFT;
- } else if (packet102windowclick.button == 1) {
+ } else if (packetplayinwindowclick.e() == 1) {
click = ClickType.SHIFT_RIGHT;
}
- if (packet102windowclick.button == 0 || packet102windowclick.button == 1) {
- if (packet102windowclick.slot < 0) {
+ if (packetplayinwindowclick.e() == 0 || packetplayinwindowclick.e() == 1) {
+ if (packetplayinwindowclick.d() < 0) {
action = InventoryAction.NOTHING;
} else {
- Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
+ Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d());
if (slot != null && slot.a(this.player) && slot.e()) { // Should be Slot.hasItem()
action = InventoryAction.MOVE_TO_OTHER_INVENTORY;
} else {
@@ -1272,12 +1221,12 @@ public class PlayerConnection extends Connection {
}
}
}
- } else if (packet102windowclick.shift == 2) {
- if (packet102windowclick.button >= 0 && packet102windowclick.button < 9) {
+ } else if (packetplayinwindowclick.h() == 2) {
+ if (packetplayinwindowclick.e() >= 0 && packetplayinwindowclick.e() < 9) {
click = ClickType.NUMBER_KEY;
- Slot clickedSlot = this.player.activeContainer.getSlot(packet102windowclick.slot);
+ Slot clickedSlot = this.player.activeContainer.getSlot(packetplayinwindowclick.d());
if (clickedSlot.a(player)) {
- ItemStack hotbar = this.player.inventory.getItem(packet102windowclick.button);
+ ItemStack hotbar = this.player.inventory.getItem(packetplayinwindowclick.e());
boolean canCleanSwap = hotbar == null || (clickedSlot.inventory == player.inventory && clickedSlot.isAllowed(hotbar)); // the slot will accept the hotbar item
if (clickedSlot.e()) {
if (canCleanSwap) {
@@ -1299,15 +1248,15 @@ public class PlayerConnection extends Connection {
action = InventoryAction.NOTHING;
}
// Special constructor for number key
- event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button);
+ event = new InventoryClickEvent(inventory, type, packetplayinwindowclick.d(), click, action, packetplayinwindowclick.e());
}
- } else if (packet102windowclick.shift == 3) {
- if (packet102windowclick.button == 2) {
+ } else if (packetplayinwindowclick.h() == 3) {
+ if (packetplayinwindowclick.e() == 2) {
click = ClickType.MIDDLE;
- if (packet102windowclick.slot == -999) {
+ if (packetplayinwindowclick.d() == -999) {
action = InventoryAction.NOTHING;
} else {
- Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
+ Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d());
if (slot != null && slot.e() && player.abilities.canInstantlyBuild && player.inventory.getCarried() == null) {
action = InventoryAction.CLONE_STACK;
} else {
@@ -1318,20 +1267,20 @@ public class PlayerConnection extends Connection {
click = ClickType.UNKNOWN;
action = InventoryAction.UNKNOWN;
}
- } else if (packet102windowclick.shift == 4) {
- if (packet102windowclick.slot >= 0) {
- if (packet102windowclick.button == 0) {
+ } else if (packetplayinwindowclick.h() == 4) {
+ if (packetplayinwindowclick.d() >= 0) {
+ if (packetplayinwindowclick.e() == 0) {
click = ClickType.DROP;
- Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
- if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) {
+ Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d());
+ if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().getItem() != Item.getItemOf(Blocks.AIR)) {
action = InventoryAction.DROP_ONE_SLOT;
} else {
action = InventoryAction.NOTHING;
}
- } else if (packet102windowclick.button == 1) {
+ } else if (packetplayinwindowclick.e() == 1) {
click = ClickType.CONTROL_DROP;
- Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
- if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) {
+ Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d());
+ if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().getItem() != Item.getItemOf(Blocks.AIR)) {
action = InventoryAction.DROP_ALL_SLOT;
} else {
action = InventoryAction.NOTHING;
@@ -1340,42 +1289,42 @@ public class PlayerConnection extends Connection {
} else {
// Sane default (because this happens when they are holding nothing. Don't ask why.)
click = ClickType.LEFT;
- if (packet102windowclick.button == 1) {
+ if (packetplayinwindowclick.e() == 1) {
click = ClickType.RIGHT;
}
action = InventoryAction.NOTHING;
}
- } else if (packet102windowclick.shift == 5) {
- itemstack = this.player.activeContainer.clickItem(packet102windowclick.slot, packet102windowclick.button, 5, this.player);
- } else if (packet102windowclick.shift == 6) {
+ } else if (packetplayinwindowclick.h() == 5) {
+ itemstack = this.player.activeContainer.clickItem(packetplayinwindowclick.d(), packetplayinwindowclick.e(), 5, this.player);
+ } else if (packetplayinwindowclick.h() == 6) {
click = ClickType.DOUBLE_CLICK;
action = InventoryAction.NOTHING;
- if (packet102windowclick.slot >= 0 && this.player.inventory.getCarried() != null) {
+ if (packetplayinwindowclick.d() >= 0 && this.player.inventory.getCarried() != null) {
ItemStack cursor = this.player.inventory.getCarried();
action = InventoryAction.NOTHING;
// Quick check for if we have any of the item
- if (inventory.getTopInventory().contains(cursor.id) || inventory.getBottomInventory().contains(cursor.id)) {
+ if (inventory.getTopInventory().contains(org.bukkit.Material.getMaterial(Item.b(cursor.getItem()))) || inventory.getBottomInventory().contains(org.bukkit.Material.getMaterial(Item.b(cursor.getItem())))) {
action = InventoryAction.COLLECT_TO_CURSOR;
}
}
}
// TODO check on updates
- if (packet102windowclick.shift != 5) {
+ if (packetplayinwindowclick.h() != 5) {
if (click == ClickType.NUMBER_KEY) {
- event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button);
+ event = new InventoryClickEvent(inventory, type, packetplayinwindowclick.d(), click, action, packetplayinwindowclick.e());
} else {
- event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action);
+ event = new InventoryClickEvent(inventory, type, packetplayinwindowclick.d(), click, action);
}
org.bukkit.inventory.Inventory top = inventory.getTopInventory();
- if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) {
+ if (packetplayinwindowclick.d() == 0 && top instanceof CraftingInventory) {
org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe();
if (recipe != null) {
if (click == ClickType.NUMBER_KEY) {
- event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button);
+ event = new CraftItemEvent(recipe, inventory, type, packetplayinwindowclick.d(), click, action, packetplayinwindowclick.e());
} else {
- event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action);
+ event = new CraftItemEvent(recipe, inventory, type, packetplayinwindowclick.d(), click, action);
}
}
}
@@ -1385,7 +1334,7 @@ public class PlayerConnection extends Connection {
switch (event.getResult()) {
case ALLOW:
case DEFAULT:
- itemstack = this.player.activeContainer.clickItem(packet102windowclick.slot, packet102windowclick.button, packet102windowclick.shift, this.player);
+ itemstack = this.player.activeContainer.clickItem(packetplayinwindowclick.d(), packetplayinwindowclick.e(), packetplayinwindowclick.h(), this.player);
break;
case DENY:
/* Needs enum constructor in InventoryAction
@@ -1417,19 +1366,19 @@ public class PlayerConnection extends Connection {
case PLACE_SOME:
case PLACE_ONE:
case SWAP_WITH_CURSOR:
- this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried()));
- this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem()));
+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventory.getCarried()));
+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, packetplayinwindowclick.d(), this.player.activeContainer.getSlot(packetplayinwindowclick.d()).getItem()));
break;
// Modified clicked only
case DROP_ALL_SLOT:
case DROP_ONE_SLOT:
- this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem()));
+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, packetplayinwindowclick.d(), this.player.activeContainer.getSlot(packetplayinwindowclick.d()).getItem()));
break;
// Modified cursor only
case DROP_ALL_CURSOR:
case DROP_ONE_CURSOR:
case CLONE_STACK:
- this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried()));
+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventory.getCarried()));
break;
// Nothing
case NOTHING:
@@ -1440,15 +1389,15 @@ public class PlayerConnection extends Connection {
}
// CraftBukkit end
- if (ItemStack.matches(packet102windowclick.item, itemstack)) {
- this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
+ if (ItemStack.matches(packetplayinwindowclick.g(), itemstack)) {
+ this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.c(), packetplayinwindowclick.f(), true));
this.player.h = true;
this.player.activeContainer.b();
this.player.broadcastCarriedItem();
this.player.h = false;
} else {
- this.r.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
- this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
+ this.n.a(this.player.activeContainer.windowId, Short.valueOf(packetplayinwindowclick.f()));
+ this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.c(), packetplayinwindowclick.f(), false));
this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList();
@@ -1460,48 +1409,48 @@ public class PlayerConnection extends Connection {
// CraftBukkit start - Send a Set Slot to update the crafting result slot
if (type == SlotType.RESULT && itemstack != null) {
- this.player.playerConnection.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack)));
+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, 0, itemstack));
}
// CraftBukkit end
}
}
}
- public void a(Packet108ButtonClick packet108buttonclick) {
- this.player.u();
- if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) {
- this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b);
+ public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
+ this.player.w();
+ if (this.player.activeContainer.windowId == packetplayinenchantitem.c() && this.player.activeContainer.c(this.player)) {
+ this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.d());
this.player.activeContainer.b();
}
}
- public void a(Packet107SetCreativeSlot packet107setcreativeslot) {
+ public void a(PacketPlayInSetCreativeSlot packetplayinsetcreativeslot) {
if (this.player.playerInteractManager.isCreative()) {
- boolean flag = packet107setcreativeslot.slot < 0;
- ItemStack itemstack = packet107setcreativeslot.b;
- 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;
+ boolean flag = packetplayinsetcreativeslot.c() < 0;
+ ItemStack itemstack = packetplayinsetcreativeslot.d();
+ boolean flag1 = packetplayinsetcreativeslot.c() >= 1 && packetplayinsetcreativeslot.c() < 36 + PlayerInventory.getHotbarSize();
+ // CraftBukkit - Add invalidItems check
+ boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.b(itemstack.getItem()));
+ boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;
// CraftBukkit start - Call click event
- if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packet107setcreativeslot.slot).getItem(), packet107setcreativeslot.b))) { // Insist on valid slot
+ if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.c()).getItem(), packetplayinsetcreativeslot.d()))) { // Insist on valid slot
org.bukkit.entity.HumanEntity player = this.player.getBukkitEntity();
InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer);
- org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packet107setcreativeslot.b); // Should be packet107setcreativeslot.newitem
+ org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packetplayinsetcreativeslot.d()); // Should be packet107setcreativeslot.newitem
SlotType type = SlotType.QUICKBAR;
if (flag) {
type = SlotType.OUTSIDE;
- } else if (packet107setcreativeslot.slot < 36) {
- if (packet107setcreativeslot.slot >= 5 && packet107setcreativeslot.slot < 9) {
+ } else if (packetplayinsetcreativeslot.c() < 36) {
+ if (packetplayinsetcreativeslot.c() >= 5 && packetplayinsetcreativeslot.c() < 9) {
type = SlotType.ARMOR;
} else {
type = SlotType.CONTAINER;
}
}
- InventoryCreativeEvent event = new InventoryCreativeEvent(inventory, type, flag ? -999 : packet107setcreativeslot.slot, item);
+ InventoryCreativeEvent event = new InventoryCreativeEvent(inventory, type, flag ? -999 : packetplayinsetcreativeslot.c(), item);
server.getPluginManager().callEvent(event);
itemstack = CraftItemStack.asNMSCopy(event.getCursor());
@@ -1515,9 +1464,9 @@ public class PlayerConnection extends Connection {
break;
case DENY:
// Reset the slot
- if (packet107setcreativeslot.slot >= 0) {
- this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.slot, this.player.defaultContainer.getSlot(packet107setcreativeslot.slot).getItem()));
- this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, null));
+ if (packetplayinsetcreativeslot.c() >= 0) {
+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.player.defaultContainer.windowId, packetplayinsetcreativeslot.c(), this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.c()).getItem()));
+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, null));
}
return;
}
@@ -1526,47 +1475,47 @@ public class PlayerConnection extends Connection {
if (flag1 && flag2 && flag3) {
if (itemstack == null) {
- this.player.defaultContainer.setItem(packet107setcreativeslot.slot, (ItemStack) null);
+ this.player.defaultContainer.setItem(packetplayinsetcreativeslot.c(), (ItemStack) null);
} else {
- this.player.defaultContainer.setItem(packet107setcreativeslot.slot, itemstack);
+ this.player.defaultContainer.setItem(packetplayinsetcreativeslot.c(), itemstack);
}
this.player.defaultContainer.a(this.player, true);
} else if (flag && flag2 && flag3 && this.x < 200) {
this.x += 20;
- EntityItem entityitem = this.player.drop(itemstack);
+ EntityItem entityitem = this.player.drop(itemstack, true);
if (entityitem != null) {
- entityitem.c();
+ entityitem.e();
}
}
}
}
- public void a(Packet106Transaction packet106transaction) {
+ public void a(PacketPlayInTransaction packetplayintransaction) {
if (this.player.dead) return; // CraftBukkit
- Short oshort = (Short) this.r.get(this.player.activeContainer.windowId);
+ Short oshort = (Short) this.n.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 && packetplayintransaction.d() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.c() && !this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a(this.player, true);
}
}
- public void a(Packet130UpdateSign packet130updatesign) {
+ public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
if (this.player.dead) return; // CraftBukkit
- this.player.u();
+ this.player.w();
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
- if (worldserver.isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) {
- TileEntity tileentity = worldserver.getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z);
+ if (worldserver.isLoaded(packetplayinupdatesign.c(), packetplayinupdatesign.d(), packetplayinupdatesign.e())) {
+ TileEntity tileentity = worldserver.getTileEntity(packetplayinupdatesign.c(), packetplayinupdatesign.d(), packetplayinupdatesign.e());
if (tileentity instanceof TileEntitySign) {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
if (!tileentitysign.a() || tileentitysign.b() != this.player) {
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
- this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines)); // CraftBukkit
+ this.sendPacket(new PacketPlayOutUpdateSign(packetplayinupdatesign.c(), packetplayinupdatesign.d(), packetplayinupdatesign.e(), tileentitysign.lines)); // CraftBukkit
return;
}
}
@@ -1577,31 +1526,31 @@ public class PlayerConnection extends Connection {
for (j = 0; j < 4; ++j) {
boolean flag = true;
- if (packet130updatesign.lines[j].length() > 15) {
+ if (packetplayinupdatesign.f()[j].length() > 15) {
flag = false;
} else {
- for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
- if (SharedConstants.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) {
+ for (i = 0; i < packetplayinupdatesign.f()[j].length(); ++i) {
+ if (!SharedConstants.isAllowedChatCharacter(packetplayinupdatesign.f()[j].charAt(i))) {
flag = false;
}
}
}
if (!flag) {
- packet130updatesign.lines[j] = "!?";
+ packetplayinupdatesign.f()[j] = "!?";
}
}
if (tileentity instanceof TileEntitySign) {
- j = packet130updatesign.x;
- int k = packet130updatesign.y;
+ j = packetplayinupdatesign.c();
+ int k = packetplayinupdatesign.d();
- i = packet130updatesign.z;
+ i = packetplayinupdatesign.e();
TileEntitySign tileentitysign1 = (TileEntitySign) tileentity;
// CraftBukkit start
Player player = this.server.getPlayer(this.player);
- SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(j, k, i), this.server.getPlayer(this.player), packet130updatesign.lines);
+ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(j, k, i), this.server.getPlayer(this.player), packetplayinupdatesign.f());
this.server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@@ -1613,6 +1562,7 @@ public class PlayerConnection extends Connection {
}
tileentitysign1.isEditable = false;
}
+ // System.arraycopy(packetplayinupdatesign.f(), 0, tileentitysign1.lines, 0, 4);
// CraftBukkit end
tileentitysign1.update();
@@ -1621,25 +1571,25 @@ public class PlayerConnection extends Connection {
}
}
- public void a(Packet0KeepAlive packet0keepalive) {
- if (packet0keepalive.a == this.h) {
- int i = (int) (System.nanoTime() / 1000000L - this.i);
+ public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
+ if (packetplayinkeepalive.c() == this.h) {
+ int i = (int) (this.d() - this.i);
this.player.ping = (this.player.ping * 3 + i) / 4;
}
}
- public boolean a() {
- return true;
+ private long d() {
+ return System.nanoTime() / 1000000L;
}
- public void a(Packet202Abilities packet202abilities) {
+ public void a(PacketPlayInAbilities packetplayinabilities) {
// CraftBukkit start
- if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.f()) {
- PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.f());
+ if (this.player.abilities.canFly && this.player.abilities.isFlying != packetplayinabilities.f()) {
+ PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packetplayinabilities.f());
this.server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.player.abilities.isFlying = packet202abilities.f(); // Actually set the player's flying status
+ this.player.abilities.isFlying = packetplayinabilities.f(); // Actually set the player's flying status
}
else {
this.player.updateAbilities(); // Tell the player their ability was reverted
@@ -1648,78 +1598,74 @@ public class PlayerConnection extends Connection {
// CraftBukkit end
}
- public void a(Packet203TabComplete packet203tabcomplete) {
- StringBuilder stringbuilder = new StringBuilder();
+ public void a(PacketPlayInTabComplete packetplayintabcomplete) {
+ ArrayList arraylist = Lists.newArrayList();
+ Iterator iterator = this.minecraftServer.a(this.player, packetplayintabcomplete.c()).iterator();
- String s;
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
- for (Iterator iterator = this.minecraftServer.a(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
- }
+ arraylist.add(s);
}
- this.player.playerConnection.sendPacket(new Packet203TabComplete(stringbuilder.toString()));
+ this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete((String[]) arraylist.toArray(new String[arraylist.size()])));
}
- public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
- this.player.a(packet204localeandviewdistance);
+ public void a(PacketPlayInSettings packetplayinsettings) {
+ this.player.a(packetplayinsettings);
}
- public void a(Packet250CustomPayload packet250custompayload) {
- DataInputStream datainputstream;
+ public void a(PacketPlayInCustomPayload packetplayincustompayload) {
ItemStack itemstack;
ItemStack itemstack1;
// CraftBukkit start - Ignore empty payloads
- if (packet250custompayload.length <= 0) {
+ if (packetplayincustompayload.length <= 0) {
return;
}
// CraftBukkit end
- if ("MC|BEdit".equals(packet250custompayload.tag)) {
+ if ("MC|BEdit".equals(packetplayincustompayload.c())) {
try {
- datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
- itemstack = Packet.c(datainputstream);
+ itemstack = (new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()))).c();
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) {
+ if (itemstack.getItem() == Items.BOOK_AND_QUILL && itemstack.getItem() == itemstack1.getItem()) {
CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit
}
// CraftBukkit start
- } catch (Throwable exception) {
- this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BEdit data", exception);
+ } catch (Exception exception) {
+ c.error("Couldn\'t handle book info", exception);
this.disconnect("Invalid book data!");
// CraftBukkit end
}
- } else if ("MC|BSign".equals(packet250custompayload.tag)) {
+ } else if ("MC|BSign".equals(packetplayincustompayload.c())) {
try {
- datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
- itemstack = Packet.c(datainputstream);
+ itemstack = (new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()))).c();
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) {
+ if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.BOOK_AND_QUILL) {
CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit
}
// CraftBukkit start
- } catch (Throwable exception1) {
- this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BSign data", exception1);
+ } catch (Exception exception1) {
+ c.error("Couldn\'t sign book", exception1);
this.disconnect("Invalid book data!");
// CraftBukkit end
}
} else {
+ DataInputStream datainputstream;
int i;
- if ("MC|TrSel".equals(packet250custompayload.tag)) {
+ if ("MC|TrSel".equals(packetplayincustompayload.c())) {
try {
- datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
+ datainputstream = new DataInputStream(new ByteArrayInputStream(packetplayincustompayload.e()));
i = datainputstream.readInt();
Container container = this.player.activeContainer;
@@ -1728,104 +1674,121 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception2) {
// CraftBukkit start
- this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|TrSel data", exception2);
+ c.error("Couldn\'t select trade", exception2);
this.disconnect("Invalid trade data!");
// CraftBukkit end
}
- } else {
- int j;
-
- if ("MC|AdvCdm".equals(packet250custompayload.tag)) {
- if (!this.minecraftServer.getEnableCommandBlock()) {
- this.player.sendMessage(ChatMessage.e("advMode.notEnabled"));
- } else if (this.player.a(2, "") && this.player.abilities.canInstantlyBuild) {
- try {
- datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
- i = datainputstream.readInt();
- j = datainputstream.readInt();
- int k = datainputstream.readInt();
- String s = Packet.a((DataInput) datainputstream, 256);
- TileEntity tileentity = this.player.world.getTileEntity(i, j, k);
-
- if (tileentity != null && tileentity instanceof TileEntityCommand) {
- ((TileEntityCommand) tileentity).a(s);
- this.player.world.notify(i, j, k);
- this.player.sendMessage(ChatMessage.b("advMode.setCommand.success", new Object[] { s}));
- }
- } catch (Exception exception3) {
- // CraftBukkit start
- this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|AdvCdm data", exception3);
- this.disconnect("Invalid CommandBlock data!");
- // CraftBukkit end
- }
- } else {
- this.player.sendMessage(ChatMessage.e("advMode.notAllowed"));
- }
- } else if ("MC|Beacon".equals(packet250custompayload.tag)) {
- if (this.player.activeContainer instanceof ContainerBeacon) {
- try {
- datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
- i = datainputstream.readInt();
- j = datainputstream.readInt();
- ContainerBeacon containerbeacon = (ContainerBeacon) this.player.activeContainer;
- Slot slot = containerbeacon.getSlot(0);
-
- if (slot.e()) {
- slot.a(1);
- TileEntityBeacon tileentitybeacon = containerbeacon.e();
-
- tileentitybeacon.d(i);
- tileentitybeacon.e(j);
- tileentitybeacon.update();
- }
- } catch (Exception exception4) {
- // CraftBukkit start
- this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|Beacon data", exception4);
- this.disconnect("Invalid beacon data!");
- // CraftBukkit end
- }
- }
- } else if ("MC|ItemName".equals(packet250custompayload.tag) && this.player.activeContainer instanceof ContainerAnvil) {
- ContainerAnvil containeranvil = (ContainerAnvil) this.player.activeContainer;
-
- if (packet250custompayload.data != null && packet250custompayload.data.length >= 1) {
- String s1 = SharedConstants.a(new String(packet250custompayload.data));
-
- if (s1.length() <= 30) {
- containeranvil.a(s1);
- }
- } else {
- containeranvil.a("");
- }
- }
- // CraftBukkit start
- else if (packet250custompayload.tag.equals("REGISTER")) {
+ } else if ("MC|AdvCdm".equals(packetplayincustompayload.c())) {
+ if (!this.minecraftServer.getEnableCommandBlock()) {
+ this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0]));
+ } else if (this.player.a(2, "") && this.player.abilities.canInstantlyBuild) {
try {
- String channels = new String(packet250custompayload.data, "UTF8");
- for (String channel : channels.split("\0")) {
- getPlayer().addChannel(channel);
+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()));
+ byte b0 = packetdataserializer.readByte();
+ CommandBlockListenerAbstract commandblocklistenerabstract = null;
+
+ if (b0 == 0) {
+ TileEntity tileentity = this.player.world.getTileEntity(packetdataserializer.readInt(), packetdataserializer.readInt(), packetdataserializer.readInt());
+
+ if (tileentity instanceof TileEntityCommand) {
+ commandblocklistenerabstract = ((TileEntityCommand) tileentity).a();
+ }
+ } else if (b0 == 1) {
+ Entity entity = this.player.world.getEntity(packetdataserializer.readInt());
+
+ if (entity instanceof EntityMinecartCommandBlock) {
+ commandblocklistenerabstract = ((EntityMinecartCommandBlock) entity).e();
+ }
}
- } catch (UnsupportedEncodingException ex) {
- throw new AssertionError(ex);
- }
- } else if (packet250custompayload.tag.equals("UNREGISTER")) {
- try {
- String channels = new String(packet250custompayload.data, "UTF8");
- for (String channel : channels.split("\0")) {
- getPlayer().removeChannel(channel);
+
+ String s = packetdataserializer.c(packetdataserializer.readableBytes());
+
+ if (commandblocklistenerabstract != null) {
+ commandblocklistenerabstract.a(s);
+ commandblocklistenerabstract.e();
+ this.player.sendMessage(new ChatMessage("advMode.setCommand.success", new Object[] { s}));
}
- } catch (UnsupportedEncodingException ex) {
- throw new AssertionError(ex);
+ } catch (Exception exception3) {
+ // CraftBukkit start
+ c.error("Couldn\'t set command block", exception3);
+ this.disconnect("Invalid CommandBlock data!");
+ // CraftBukkit end
}
} else {
- server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data);
+ this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0]));
+ }
+ } else if ("MC|Beacon".equals(packetplayincustompayload.c())) {
+ if (this.player.activeContainer instanceof ContainerBeacon) {
+ try {
+ datainputstream = new DataInputStream(new ByteArrayInputStream(packetplayincustompayload.e()));
+ i = datainputstream.readInt();
+ int j = datainputstream.readInt();
+ ContainerBeacon containerbeacon = (ContainerBeacon) this.player.activeContainer;
+ Slot slot = containerbeacon.getSlot(0);
+
+ if (slot.e()) {
+ slot.a(1);
+ TileEntityBeacon tileentitybeacon = containerbeacon.e();
+
+ tileentitybeacon.d(i);
+ tileentitybeacon.e(j);
+ tileentitybeacon.update();
+ }
+ } catch (Exception exception4) {
+ // CraftBukkit start
+ c.error("Couldn\'t set beacon", exception4);
+ this.disconnect("Invalid beacon data!");
+ // CraftBukkit end
+ }
+ }
+ } else if ("MC|ItemName".equals(packetplayincustompayload.c()) && this.player.activeContainer instanceof ContainerAnvil) {
+ ContainerAnvil containeranvil = (ContainerAnvil) this.player.activeContainer;
+
+ if (packetplayincustompayload.e() != null && packetplayincustompayload.e().length >= 1) {
+ String s1 = SharedConstants.a(new String(packetplayincustompayload.e(), Charsets.UTF_8));
+
+ if (s1.length() <= 30) {
+ containeranvil.a(s1);
+ }
+ } else {
+ containeranvil.a("");
}
- // CraftBukkit end
}
+ // CraftBukkit start
+ else if (packetplayincustompayload.c().equals("REGISTER")) {
+ try {
+ String channels = new String(packetplayincustompayload.e(), "UTF8");
+ for (String channel : channels.split("\0")) {
+ getPlayer().addChannel(channel);
+ }
+ } catch (UnsupportedEncodingException ex) {
+ throw new AssertionError(ex);
+ }
+ } else if (packetplayincustompayload.c().equals("UNREGISTER")) {
+ try {
+ String channels = new String(packetplayincustompayload.e(), "UTF8");
+ for (String channel : channels.split("\0")) {
+ getPlayer().removeChannel(channel);
+ }
+ } catch (UnsupportedEncodingException ex) {
+ throw new AssertionError(ex);
+ }
+ } else {
+ server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.c(), packetplayincustompayload.e());
+ }
+ // CraftBukkit end
}
}
- public boolean c() {
- return this.disconnected;
+ public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) {
+ if (enumprotocol1 != EnumProtocol.PLAY) {
+ throw new IllegalStateException("Unexpected change in protocol!");
+ }
}
+
+ // CraftBukkit start - Add "isDisconnected" method
+ public final boolean isDisconnected() {
+ return !NetworkManager.a(this.networkManager).config().isAutoRead();
+ }
+ // CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 16420e46b5..3028404ace 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -56,24 +56,21 @@ public class PlayerInteractManager {
public void a() {
this.currentTick = MinecraftServer.currentTick; // CraftBukkit
- int i;
float f;
- int j;
+ int i;
if (this.j) {
- i = this.currentTick - this.n;
- int k = this.world.getTypeId(this.k, this.l, this.m);
+ int j = this.currentTick - this.n;
+ Block block = this.world.getType(this.k, this.l, this.m);
- if (k == 0) {
+ if (block.getMaterial() == Material.AIR) {
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;
+ f = block.getDamage(this.player, this.player.world, this.k, this.l, this.m) * (float) (j + 1);
+ i = (int) (f * 10.0F);
+ if (i != this.o) {
+ this.world.d(this.player.getId(), this.k, this.l, this.m, i);
+ this.o = i;
}
if (f >= 1.0F) {
@@ -82,36 +79,32 @@ public class PlayerInteractManager {
}
}
} else if (this.d) {
- i = this.world.getTypeId(this.f, this.g, this.h);
- Block block1 = Block.byId[i];
+ Block block1 = this.world.getType(this.f, this.g, this.h);
- if (block1 == null) {
- this.world.f(this.player.id, this.f, this.g, this.h, -1);
+ if (block1.getMaterial() == Material.AIR) {
+ this.world.d(this.player.getId(), this.f, this.g, this.h, -1);
this.o = -1;
this.d = false;
} else {
- int l = this.currentTick - this.lastDigTick;
+ int k = 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;
+ f = block1.getDamage(this.player, this.player.world, this.f, this.g, this.h) * (float) (k + 1);
+ i = (int) (f * 10.0F);
+ if (i != this.o) {
+ this.world.d(this.player.getId(), this.f, this.g, this.h, i);
+ this.o = i;
}
}
}
}
public void dig(int i, int j, int k, int l) {
- // this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
- // CraftBukkit
+ // CraftBukkit start
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
-
if (!this.gamemode.isAdventure() || this.player.d(i, j, k)) {
- // CraftBukkit start
if (event.isCancelled()) {
// Let the client know the block still exists
- ((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(i, j, k);
if (tileentity != null) {
@@ -125,36 +118,32 @@ public class PlayerInteractManager {
this.breakBlock(i, j, k);
}
} else {
- this.world.douseFire((EntityHuman) null, i, j, k, l);
+ // this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - Moved down
this.lastDigTick = this.currentTick;
float f = 1.0F;
- int i1 = this.world.getTypeId(i, j, k);
+ Block block = this.world.getType(i, j, k);
// CraftBukkit start - Swings at air do *NOT* exist.
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) {
+ if (block == Blocks.WOODEN_DOOR) {
// 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).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
- ((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
- } else if (i1 == Block.TRAP_DOOR.id) {
- ((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j + (bottom ? 1 : -1), k, this.world));
+ } else if (block == Blocks.TRAP_DOOR) {
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
}
- } else if (i1 > 0) {
- Block.byId[i1].attack(this.world, i, j, k, this.player);
+ } else if (block.getMaterial() != Material.AIR) {
+ block.attack(this.world, i, j, k, this.player);
+ f = block.getDamage(this.player, this.player.world, i, j, k);
// Allow fire punching to be blocked
this.world.douseFire((EntityHuman) null, i, j, k, l);
}
- // Handle hitting a block
- if (i1 > 0) {
- f = 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 (f > 1.0f) {
- ((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
}
return;
}
@@ -162,7 +151,7 @@ public class PlayerInteractManager {
if (blockEvent.isCancelled()) {
// Let the client know the block still exists
- ((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
return;
}
@@ -171,17 +160,17 @@ public class PlayerInteractManager {
}
// CraftBukkit end
- if (i1 > 0 && f >= 1.0F) {
+ if (block.getMaterial() != Material.AIR && f >= 1.0F) {
this.breakBlock(i, j, k);
} else {
this.d = true;
this.f = i;
this.g = j;
this.h = k;
- int j1 = (int) (f * 10.0F);
+ int i1 = (int) (f * 10.0F);
- this.world.f(this.player.id, i, j, k, j1);
- this.o = j1;
+ this.world.d(this.player.getId(), i, j, k, i1);
+ this.o = i1;
}
}
}
@@ -191,15 +180,14 @@ public class PlayerInteractManager {
if (i == this.f && j == this.g && k == this.h) {
this.currentTick = MinecraftServer.currentTick; // CraftBukkit
int l = this.currentTick - this.lastDigTick;
- int i1 = this.world.getTypeId(i, j, k);
+ Block block = this.world.getType(i, j, k);
- if (i1 != 0) {
- Block block = Block.byId[i1];
+ if (block.getMaterial() != Material.AIR) {
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.world.d(this.player.getId(), i, j, k, -1);
this.breakBlock(i, j, k);
} else if (!this.j) {
this.d = false;
@@ -212,27 +200,24 @@ public class PlayerInteractManager {
}
// CraftBukkit start - Force block reset to client
} else {
- this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
// CraftBukkit end
}
}
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);
+ this.world.d(this.player.getId(), this.f, this.g, this.h, -1);
}
private boolean d(int i, int j, int k) {
- Block block = Block.byId[this.world.getTypeId(i, j, k)];
+ Block block = this.world.getType(i, j, k);
int l = this.world.getData(i, j, k);
- if (block != null) {
- block.a(this.world, i, j, k, l, this.player);
- }
-
+ block.a(this.world, i, j, k, l, this.player);
boolean flag = this.world.setAir(i, j, k);
- if (block != null && flag) {
+ if (flag) {
block.postBreak(this.world, i, j, k, l);
}
@@ -248,9 +233,8 @@ public class PlayerInteractManager {
// Tell client the block is gone immediately then process events
if (world.getTileEntity(i, j, k) == null) {
- Packet53BlockChange packet = new Packet53BlockChange(i, j, k, this.world);
-
- packet.material = 0;
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(i, j, k, this.world);
+ packet.block = Blocks.AIR;
packet.data = 0;
((EntityPlayer) this.player).playerConnection.sendPacket(packet);
}
@@ -261,14 +245,14 @@ public class PlayerInteractManager {
event.setCancelled(this.gamemode.isAdventure() && !this.player.d(i, j, k));
// Sword + Creative mode pre-cancel
- event.setCancelled(event.isCancelled() || (this.gamemode.d() && this.player.aZ() != null && this.player.aZ().getItem() instanceof ItemSword));
+ event.setCancelled(event.isCancelled() || (this.gamemode.d() && this.player.be() != null && this.player.be().getItem() instanceof ItemSword));
// Calculate default block experience
- Block nmsBlock = Block.byId[block.getTypeId()];
+ Block nmsBlock = this.world.getType(i, j, k);
if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.a(nmsBlock)) {
- // Copied from Block.a(world, entityhuman, int, int, int, int)
- if (!(nmsBlock.r_() && EnchantmentManager.hasSilkTouchEnchantment(this.player))) {
+ // Copied from block.a(world, entityhuman, int, int, int, int)
+ if (!(nmsBlock.E() && EnchantmentManager.hasSilkTouchEnchantment(this.player))) {
int data = block.getData();
int bonusLevel = EnchantmentManager.getBonusBlockLootEnchantmentLevel(this.player);
@@ -280,7 +264,7 @@ public class PlayerInteractManager {
if (event.isCancelled()) {
// Let the client know the block still exists
- ((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(i, j, k);
if (tileentity != null) {
@@ -290,45 +274,47 @@ public class PlayerInteractManager {
}
}
- if (false) { // Never trigger
+ if (false && this.gamemode.isAdventure() && !this.player.d(i, j, k)) { // Never trigger
// CraftBukkit end
return false;
+ } else if (false && this.gamemode.d() && this.player.be() != null && this.player.be().getItem() instanceof ItemSword) { // CraftBukkit - never trigger
+ return false;
} else {
- int l = this.world.getTypeId(i, j, k);
- if (Block.byId[l] == null) return false; // CraftBukkit - A plugin set block to air without cancelling
- int i1 = this.world.getData(i, j, k);
+ Block block = this.world.getType(i, j, k);
+ if (block == Blocks.AIR) return false; // CraftBukkit - A plugin set block to air without cancelling
+ int l = this.world.getData(i, j, k);
// CraftBukkit start - Special case skulls, their item data comes from a tile entity
- if (l == Block.SKULL.id && !this.isCreative()) {
- Block.SKULL.dropNaturally(world, i, j, k, i1, 1.0F, 0);
+ if (block == Blocks.SKULL && !this.isCreative()) {
+ block.dropNaturally(world, i, j, k, l, 1.0F, 0);
return this.d(i, j, k);
}
// CraftBukkit end
- this.world.a(this.player, 2001, i, j, k, l + (this.world.getData(i, j, k) << 12));
+ this.world.a(this.player, 2001, i, j, k, Block.b(block) + (this.world.getData(i, j, k) << 12));
boolean flag = this.d(i, j, k);
if (this.isCreative()) {
- this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, this.world));
} else {
- ItemStack itemstack = this.player.by();
- boolean flag1 = this.player.a(Block.byId[l]);
+ ItemStack itemstack = this.player.bD();
+ boolean flag1 = this.player.a(block);
if (itemstack != null) {
- itemstack.a(this.world, l, i, j, k, this.player);
+ itemstack.a(this.world, block, i, j, k, this.player);
if (itemstack.count == 0) {
- this.player.bz();
+ this.player.bE();
}
}
if (flag && flag1) {
- Block.byId[l].a(this.world, this.player, i, j, k, i1);
+ block.a(this.world, this.player, i, j, k, l);
}
}
// CraftBukkit start - Drop event experience
if (flag && event != null) {
- Block.byId[l].j(this.world, i, j, k, event.getExpToDrop());
+ block.c(this.world, i, j, k, event.getExpToDrop());
}
// CraftBukkit end
@@ -356,7 +342,7 @@ public class PlayerInteractManager {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null;
}
- if (!entityhuman.br()) {
+ if (!entityhuman.bw()) {
((EntityPlayer) entityhuman).updateInventory(entityhuman.defaultContainer);
}
@@ -365,21 +351,36 @@ public class PlayerInteractManager {
}
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 - whole method
+ if ((!entityhuman.isSneaking() || entityhuman.be() == null) && world.getType(i, j, k).interact(world, i, j, k, entityhuman, l, f, f1, f2)) {
+ return true;
+ } else if (itemstack == null) {
+ return false;
+ } else if (this.isCreative()) {
+ int i1 = itemstack.getData();
+ int j1 = itemstack.count;
+ boolean flag = itemstack.placeItem(entityhuman, world, i, j, k, l, f, f1, f2);
- // CraftBukkit start - Interact
+ itemstack.setData(i1);
+ itemstack.count = j1;
+ return flag;
+ } else {
+ return itemstack.placeItem(entityhuman, world, i, j, k, l, f, f1, f2);
+ }
+ // Interract event */
+ Block block = world.getType(i, j, k);
boolean result = false;
- if (i1 > 0) {
+ if (block != Blocks.AIR) {
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);
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) {
+ if (block == Blocks.WOODEN_DOOR) {
boolean bottom = (world.getData(i, j, k) & 8) == 0;
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world));
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j + (bottom ? 1 : -1), k, world));
}
result = (event.useItemInHand() != Event.Result.ALLOW);
} else if (!entityhuman.isSneaking() || itemstack == null) {
- result = Block.byId[i1].interact(world, i, j, k, entityhuman, l, f, f1, f2);
+ result = block.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
if (itemstack != null && !result) {
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
index 7cf491aadc..c9cc47ad21 100644
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
@@ -63,10 +63,10 @@ public class PlayerInventory implements IInventory {
return 9;
}
- private int g(int i) {
- for (int j = 0; j < this.items.length; ++j) {
- if (this.items[j] != null && this.items[j].id == i) {
- return j;
+ private int c(Item item) {
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null && this.items[i].getItem() == item) {
+ return i;
}
}
@@ -75,7 +75,7 @@ public class PlayerInventory implements IInventory {
private int firstPartial(ItemStack itemstack) {
for (int i = 0; i < this.items.length; ++i) {
- if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData()) && ItemStack.equals(this.items[i], itemstack)) {
+ if (this.items[i] != null && this.items[i].getItem() == itemstack.getItem() && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData()) && ItemStack.equals(this.items[i], itemstack)) {
return i;
}
}
@@ -90,7 +90,7 @@ public class PlayerInventory implements IInventory {
if (this.items[i] == null) return itemstack.count;
// Taken from firstPartial(ItemStack)
- if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData())) {
+ if (this.items[i] != null && this.items[i].getItem() == itemstack.getItem() && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData()) && ItemStack.equals(this.items[i], itemstack)) {
remains -= (this.items[i].getMaxStackSize() < this.getMaxStackSize() ? this.items[i].getMaxStackSize() : this.getMaxStackSize()) - this.items[i].count;
}
if (remains <= 0) return itemstack.count;
@@ -109,93 +109,93 @@ public class PlayerInventory implements IInventory {
return -1;
}
- public int b(int i, int j) {
- int k = 0;
+ public int a(Item item, int i) {
+ int j = 0;
- int l;
+ int k;
ItemStack itemstack;
- for (l = 0; l < this.items.length; ++l) {
- itemstack = this.items[l];
- if (itemstack != null && (i <= -1 || itemstack.id == i) && (j <= -1 || itemstack.getData() == j)) {
- k += itemstack.count;
- this.items[l] = null;
+ for (k = 0; k < this.items.length; ++k) {
+ itemstack = this.items[k];
+ if (itemstack != null && (item == null || itemstack.getItem() == item) && (i <= -1 || itemstack.getData() == i)) {
+ j += itemstack.count;
+ this.items[k] = null;
}
}
- for (l = 0; l < this.armor.length; ++l) {
- itemstack = this.armor[l];
- if (itemstack != null && (i <= -1 || itemstack.id == i) && (j <= -1 || itemstack.getData() == j)) {
- k += itemstack.count;
- this.armor[l] = null;
+ for (k = 0; k < this.armor.length; ++k) {
+ itemstack = this.armor[k];
+ if (itemstack != null && (item == null || itemstack.getItem() == item) && (i <= -1 || itemstack.getData() == i)) {
+ j += itemstack.count;
+ this.armor[k] = null;
}
}
if (this.g != null) {
- if (i > -1 && this.g.id != i) {
- return k;
+ if (item != null && this.g.getItem() != item) {
+ return j;
}
- if (j > -1 && this.g.getData() != j) {
- return k;
+ if (i > -1 && this.g.getData() != i) {
+ return j;
}
- k += this.g.count;
+ j += this.g.count;
this.setCarried((ItemStack) null);
}
- return k;
+ return j;
}
private int e(ItemStack itemstack) {
- int i = itemstack.id;
- int j = itemstack.count;
- int k;
+ Item item = itemstack.getItem();
+ int i = itemstack.count;
+ int j;
if (itemstack.getMaxStackSize() == 1) {
- k = this.j();
- if (k < 0) {
- return j;
+ j = this.j();
+ if (j < 0) {
+ return i;
} else {
- if (this.items[k] == null) {
- this.items[k] = ItemStack.b(itemstack);
+ if (this.items[j] == null) {
+ this.items[j] = ItemStack.b(itemstack);
}
return 0;
}
} else {
- k = this.firstPartial(itemstack);
- if (k < 0) {
- k = this.j();
+ j = this.firstPartial(itemstack);
+ if (j < 0) {
+ j = this.j();
}
- if (k < 0) {
- return j;
+ if (j < 0) {
+ return i;
} else {
- if (this.items[k] == null) {
- this.items[k] = new ItemStack(i, 0, itemstack.getData());
+ if (this.items[j] == null) {
+ this.items[j] = new ItemStack(item, 0, itemstack.getData());
if (itemstack.hasTag()) {
- this.items[k].setTag((NBTTagCompound) itemstack.getTag().clone());
+ this.items[j].setTag((NBTTagCompound) itemstack.getTag().clone());
}
}
- int l = j;
+ int k = i;
- if (j > this.items[k].getMaxStackSize() - this.items[k].count) {
- l = this.items[k].getMaxStackSize() - this.items[k].count;
+ if (i > this.items[j].getMaxStackSize() - this.items[j].count) {
+ k = this.items[j].getMaxStackSize() - this.items[j].count;
}
- if (l > this.getMaxStackSize() - this.items[k].count) {
- l = this.getMaxStackSize() - this.items[k].count;
+ if (k > this.getMaxStackSize() - this.items[j].count) {
+ k = this.getMaxStackSize() - this.items[j].count;
}
- if (l == 0) {
- return j;
+ if (k == 0) {
+ return i;
} else {
- j -= l;
- this.items[k].count += l;
- this.items[k].c = 5;
- return j;
+ i -= k;
+ this.items[j].count += k;
+ this.items[j].c = 5;
+ return i;
}
}
}
@@ -209,32 +209,28 @@ public class PlayerInventory implements IInventory {
}
}
- public boolean d(int i) {
- int j = this.g(i);
+ public boolean a(Item item) {
+ int i = this.c(item);
- if (j < 0) {
+ if (i < 0) {
return false;
} else {
- if (--this.items[j].count <= 0) {
- this.items[j] = null;
+ if (--this.items[i].count <= 0) {
+ this.items[i] = null;
}
return true;
}
}
- public boolean e(int i) {
- int j = this.g(i);
+ public boolean b(Item item) {
+ int i = this.c(item);
- return j >= 0;
+ return i >= 0;
}
public boolean pickup(ItemStack itemstack) {
- if (itemstack == null) {
- return false;
- } else if (itemstack.count == 0) {
- return false;
- } else {
+ if (itemstack != null && itemstack.count != 0 && itemstack.getItem() != null) {
try {
int i;
@@ -268,11 +264,13 @@ public class PlayerInventory implements IInventory {
CrashReport crashreport = CrashReport.a(throwable, "Adding item to inventory");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Item being added");
- crashreportsystemdetails.a("Item ID", Integer.valueOf(itemstack.id));
+ crashreportsystemdetails.a("Item ID", Integer.valueOf(Item.b(itemstack.getItem())));
crashreportsystemdetails.a("Item data", Integer.valueOf(itemstack.getData()));
crashreportsystemdetails.a("Item name", (Callable) (new CrashReportItemName(this, itemstack)));
throw new ReportedException(crashreport);
}
+ } else {
+ return false;
}
}
@@ -373,7 +371,7 @@ public class PlayerInventory implements IInventory {
this.armor = new ItemStack[4];
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound = nbttaglist.get(i);
int j = nbttagcompound.getByte("Slot") & 255;
ItemStack itemstack = ItemStack.createStack(nbttagcompound);
@@ -404,20 +402,20 @@ public class PlayerInventory implements IInventory {
return aitemstack[i];
}
- public String getName() {
+ public String getInventoryName() {
return "container.inventory";
}
- public boolean c() {
+ public boolean k_() {
return false;
}
public int getMaxStackSize() {
- return maxStack;
+ return 64;
}
public boolean b(Block block) {
- if (block.material.isAlwaysDestroyable()) {
+ if (block.getMaterial().isAlwaysDestroyable()) {
return true;
} else {
ItemStack itemstack = this.getItem(this.itemInHandIndex);
@@ -426,7 +424,7 @@ public class PlayerInventory implements IInventory {
}
}
- public ItemStack f(int i) {
+ public ItemStack d(int i) {
return this.armor[i];
}
@@ -465,14 +463,14 @@ public class PlayerInventory implements IInventory {
for (i = 0; i < this.items.length; ++i) {
if (this.items[i] != null) {
- this.player.a(this.items[i], true);
+ this.player.a(this.items[i], true, false);
this.items[i] = null;
}
}
for (i = 0; i < this.armor.length; ++i) {
if (this.armor[i] != null) {
- this.player.a(this.armor[i], true);
+ this.player.a(this.armor[i], true, false);
this.armor[i] = null;
}
}
@@ -519,7 +517,7 @@ public class PlayerInventory implements IInventory {
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 5dafeaf3c4..df28a5931f 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1,6 +1,5 @@
package net.minecraft.server;
-import com.google.common.base.Charsets;
import java.io.File;
import java.net.SocketAddress;
import java.text.SimpleDateFormat;
@@ -13,6 +12,12 @@ import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+import net.minecraft.util.com.google.common.base.Charsets;
+import net.minecraft.util.com.google.common.collect.Maps;
+import net.minecraft.util.com.mojang.authlib.GameProfile;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
@@ -34,20 +39,22 @@ import org.bukkit.util.Vector;
public abstract class PlayerList {
- private static final SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
+ private static final Logger d = LogManager.getLogger();
+ private static final SimpleDateFormat e = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
private final MinecraftServer server;
public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
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
+ private final Set operators = new HashSet();
+ private final Set whitelist = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet
+ private final Map k = Maps.newHashMap();
public IPlayerFileData playerFileData; // CraftBukkit - private -> public
public boolean hasWhitelist; // CraftBukkit - private -> public
protected int maxPlayers;
protected int c;
- private EnumGamemode l;
- private boolean m;
- private int n;
+ private EnumGamemode n;
+ private boolean o;
+ private int p;
// CraftBukkit start
private CraftServer cserver;
@@ -65,47 +72,52 @@ public abstract class PlayerList {
this.maxPlayers = 8;
}
- public void a(INetworkManager inetworkmanager, EntityPlayer entityplayer) {
+ public void a(NetworkManager networkmanager, EntityPlayer entityplayer) {
NBTTagCompound nbttagcompound = this.a(entityplayer);
entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
String s = "local";
- if (inetworkmanager.getSocketAddress() != null) {
- s = inetworkmanager.getSocketAddress().toString();
+ if (networkmanager.getSocketAddress() != null) {
+ s = networkmanager.getSocketAddress().toString();
}
- // CraftBukkit - add world and location to 'logged in' message.
- this.server.getLogger().info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
+ // CraftBukkit - add world to 'logged in' message.
+ d.info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.getId() + " 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);
- PlayerConnection playerconnection = new PlayerConnection(this.server, inetworkmanager, entityplayer);
+ PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, 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;
}
- playerconnection.sendPacket(new Packet1Login(entityplayer.id, worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, worldserver.getHeight(), maxPlayers));
+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, maxPlayers, worldserver.getWorldData().getType()));
entityplayer.getBukkitEntity().sendSupportedChannels();
// CraftBukkit end
-
- playerconnection.sendPacket(new Packet250CustomPayload("MC|Brand", this.getServer().getServerModName().getBytes(Charsets.UTF_8)));
- playerconnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
- playerconnection.sendPacket(new Packet202Abilities(entityplayer.abilities));
- playerconnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
+ playerconnection.sendPacket(new PacketPlayOutCustomPayload("MC|Brand", this.getServer().getServerModName().getBytes(Charsets.UTF_8)));
+ playerconnection.sendPacket(new PacketPlayOutSpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
+ playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
+ playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
+ entityplayer.x().d();
+ entityplayer.x().b(entityplayer);
this.a((ScoreboardServer) worldserver.getScoreboard(), entityplayer);
- this.b(entityplayer, worldserver);
- // this.sendMessage(ChatMessage.b("multiplayer.player.joined", new Object[] { entityplayer.getScoreboardDisplayName()}).a(EnumChatFormat.YELLOW)); // CraftBukkit - handled in event
+ this.server.au();
+ /* CraftBukkit start - login message is handled in the event
+ ChatMessage chatmessage = new ChatMessage("multiplayer.player.joined", new Object[] { entityplayer.getScoreboardDisplayName()});
+
+ chatmessage.b().setColor(EnumChatFormat.YELLOW);
+ this.sendMessage(chatmessage);
+ // CraftBukkit end*/
this.c(entityplayer);
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
- this.server.ag().a(playerconnection);
- playerconnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
- if (this.server.getTexturePack().length() > 0) {
- entityplayer.a(this.server.getTexturePack(), this.server.U());
+ this.b(entityplayer, worldserver);
+ if (this.server.getResourcePack().length() > 0) {
+ entityplayer.a(this.server.getResourcePack());
}
Iterator iterator = entityplayer.getEffects().iterator();
@@ -113,18 +125,18 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
- playerconnection.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect));
+ playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
}
entityplayer.syncInventory();
- if (nbttagcompound != null && nbttagcompound.hasKey("Riding")) {
+ if (nbttagcompound != null && nbttagcompound.hasKeyOfType("Riding", 10)) {
Entity entity = EntityTypes.a(nbttagcompound.getCompound("Riding"), worldserver);
if (entity != null) {
- entity.p = true;
+ entity.o = true;
worldserver.addEntity(entity);
entityplayer.mount(entity);
- entity.p = false;
+ entity.o = false;
}
}
}
@@ -136,7 +148,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next();
- entityplayer.playerConnection.sendPacket(new Packet209SetScoreboardTeam(scoreboardteam, 0));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutScoreboardTeam(scoreboardteam, 0));
}
for (int i = 0; i < 3; ++i) {
@@ -163,7 +175,7 @@ public abstract class PlayerList {
}
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
- WorldServer worldserver1 = entityplayer.p();
+ WorldServer worldserver1 = entityplayer.r();
if (worldserver != null) {
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
@@ -178,13 +190,14 @@ public abstract class PlayerList {
}
public NBTTagCompound a(EntityPlayer entityplayer) {
- NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i(); // CraftBukkit
+ // CraftBukkit - fix reference to worldserver array
+ NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i();
NBTTagCompound nbttagcompound1;
- if (entityplayer.getName().equals(this.server.J()) && nbttagcompound != null) {
+ if (entityplayer.getName().equals(this.server.K()) && nbttagcompound != null) {
entityplayer.f(nbttagcompound);
nbttagcompound1 = nbttagcompound;
- System.out.println("loading single player");
+ d.debug("loading single player");
} else {
nbttagcompound1 = this.playerFileData.load(entityplayer);
}
@@ -194,22 +207,29 @@ public abstract class PlayerList {
protected void b(EntityPlayer entityplayer) {
this.playerFileData.save(entityplayer);
+ ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.k.get(entityplayer.getName());
+
+ if (serverstatisticmanager != null) {
+ serverstatisticmanager.b();
+ }
}
public void c(EntityPlayer entityplayer) {
cserver.detectListNameConflict(entityplayer); // CraftBukkit
- // this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below
+ // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below
this.players.add(entityplayer);
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
// CraftBukkit start
- PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " joined the game.");
this.cserver.getPluginManager().callEvent(playerJoinEvent);
String joinMessage = playerJoinEvent.getJoinMessage();
if ((joinMessage != null) && (joinMessage.length() > 0)) {
- this.server.getPlayerList().sendAll(new Packet3Chat(ChatMessage.d(joinMessage)));
+ for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) {
+ this.server.getPlayerList().sendAll(new PacketPlayOutChat(line));
+ }
}
this.cserver.onPlayerJoin(playerJoinEvent.getPlayer());
@@ -224,7 +244,7 @@ public abstract class PlayerList {
// CraftBukkit end
// CraftBukkit start - sendAll above replaced with this loop
- Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, true, 1000);
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, true, 1000);
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
@@ -237,44 +257,47 @@ public abstract class PlayerList {
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
- // CraftBukkit start - .name -> .listName
- if (entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
- entityplayer.playerConnection.sendPacket(new Packet201PlayerInfo(entityplayer1.listName, true, entityplayer1.ping));
+ // CraftBukkit start
+ if (!entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
+ continue;
}
+ // .name -> .listName
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(entityplayer1.getName(), true, entityplayer1.ping));
// CraftBukkit end
}
}
public void d(EntityPlayer entityplayer) {
- entityplayer.p().getPlayerChunkMap().movePlayer(entityplayer);
+ entityplayer.r().getPlayerChunkMap().movePlayer(entityplayer);
}
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
- if (entityplayer.playerConnection.disconnected) return null; // CraftBukkit - exploitsies fix
+ entityplayer.a(StatisticList.f);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
org.bukkit.craftbukkit.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer);
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game.");
this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
// CraftBukkit end
-
this.b(entityplayer);
- WorldServer worldserver = entityplayer.p();
+ WorldServer worldserver = entityplayer.r();
if (entityplayer.vehicle != null && !(entityplayer.vehicle instanceof EntityPlayer)) { // CraftBukkit - Don't remove players
worldserver.removeEntity(entityplayer.vehicle);
- // System.out.println("removing player mount"); // CraftBukkit - Removed debug message
+ d.debug("removing player mount");
}
worldserver.kill(entityplayer);
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
+ this.k.remove(entityplayer.getName());
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit
// CraftBukkit start - .name -> .listName, replace sendAll with loop
- Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, false, 9999);
+ // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), false, 9999));
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, false, 9999);
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
@@ -289,52 +312,56 @@ public abstract class PlayerList {
// CraftBukkit end
}
- // CraftBukkit start - Whole method and signature
- public EntityPlayer attemptLogin(PendingConnection pendingconnection, String s, String hostname) {
+ // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer
+ public EntityPlayer attemptLogin(LoginListener loginlistener, GameProfile gameprofile, 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.
- EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.O() ? new DemoPlayerInteractManager(this.server.getWorldServer(0)) : new PlayerInteractManager(this.server.getWorldServer(0)));
+ SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress();
+
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, new PlayerInteractManager(this.server.getWorldServer(0)));
Player player = entity.getBukkitEntity();
- PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, pendingconnection.getSocket().getInetAddress());
+ PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
- SocketAddress socketaddress = pendingconnection.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();
+ if (this.banByName.isBanned(gameprofile.getName())) {
+ BanEntry banentry = (BanEntry) this.banByName.getEntries().get(gameprofile.getName());
+ String s = "You are banned from this server!\nReason: " + banentry.getReason();
if (banentry.getExpires() != null) {
- s1 = s1 + "\nYour ban will be removed on " + d.format(banentry.getExpires());
+ s = s + "\nYour ban will be removed on " + e.format(banentry.getExpires());
}
- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s1);
- } else if (!this.isWhitelisted(s)) {
+ // return s;
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s);
+ } else if (!this.isWhitelisted(gameprofile.getName())) {
+ // return "You are not white-listed on this server!";
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
} else {
- String s2 = socketaddress.toString();
+ String s1 = 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();
+ s1 = s1.substring(s1.indexOf("/") + 1);
+ s1 = s1.substring(0, s1.indexOf(":"));
+ if (this.banByIP.isBanned(s1)) {
+ BanEntry banentry1 = (BanEntry) this.banByIP.getEntries().get(s1);
+ String s2 = "Your IP address is banned from this server!\nReason: " + banentry1.getReason();
if (banentry1.getExpires() != null) {
- s3 = s3 + "\nYour ban will be removed on " + d.format(banentry1.getExpires());
+ s2 = s2 + "\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!");
+ // return s2;
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s2);
} else {
- event.disallow(PlayerLoginEvent.Result.ALLOWED, s2);
+ // return this.players.size() >= this.maxPlayers ? "The server is full!" : null;
+ if (this.players.size() >= this.maxPlayers) {
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!");
+ }
}
}
this.cserver.getPluginManager().callEvent(event);
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
- pendingconnection.disconnect(event.getKickMessage());
+ loginlistener.disconnect(event.getKickMessage());
return null;
}
@@ -342,15 +369,14 @@ public abstract class PlayerList {
// CraftBukkit end
}
- public EntityPlayer processLogin(EntityPlayer player) { // CraftBukkit - String -> EntityPlayer
- String s = player.name; // CraftBukkit
+ public EntityPlayer processLogin(GameProfile gameprofile, EntityPlayer player) { // CraftBukkit - added EntityPlayer
ArrayList arraylist = new ArrayList();
EntityPlayer entityplayer;
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (EntityPlayer) this.players.get(i);
- if (entityplayer.getName().equalsIgnoreCase(s)) {
+ if (entityplayer.getName().equalsIgnoreCase(gameprofile.getName())) {
arraylist.add(entityplayer);
}
}
@@ -365,14 +391,14 @@ public abstract class PlayerList {
/* CraftBukkit start
Object object;
- if (this.server.O()) {
+ if (this.server.P()) {
object = new DemoPlayerInteractManager(this.server.getWorldServer(0));
} else {
object = new PlayerInteractManager(this.server.getWorldServer(0));
}
- return new EntityPlayer(this.server, this.server.getWorldServer(0), s, (PlayerInteractManager) object);
- */
+ return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object);
+ // */
return player;
// CraftBukkit end
}
@@ -384,22 +410,40 @@ public abstract class PlayerList {
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location, boolean avoidSuffocation) {
// CraftBukkit end
- entityplayer.p().getTracker().untrackPlayer(entityplayer);
- // entityplayer.p().getTracker().untrackEntity(entityplayer); // CraftBukkit
- entityplayer.p().getPlayerChunkMap().removePlayer(entityplayer);
+ entityplayer.r().getTracker().untrackPlayer(entityplayer);
+ // entityplayer.r().getTracker().untrackEntity(entityplayer); // CraftBukkit
+ entityplayer.r().getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
boolean flag1 = entityplayer.isRespawnForced();
- // CraftBukkit start
+ /* CraftBukkit start
+ entityplayer.dimension = i;
+ Object object;
+
+ if (this.server.P()) {
+ object = new DemoPlayerInteractManager(this.server.getWorldServer(entityplayer.dimension));
+ } else {
+ object = new PlayerInteractManager(this.server.getWorldServer(entityplayer.dimension));
+ }
+
+ EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object);
+ // */
EntityPlayer entityplayer1 = entityplayer;
org.bukkit.World fromWorld = entityplayer1.getBukkitEntity().getWorld();
entityplayer1.viewingCredits = false;
+ // CraftBukkit end
+
+ entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyTo(entityplayer, flag);
+ entityplayer1.d(entityplayer.getId());
+ // WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); // CraftBukkit - handled later
+ // this.a(entityplayer1, entityplayer, worldserver); // CraftBukkit - removed
ChunkCoordinates chunkcoordinates1;
+ // CraftBukkit start
if (location == null) {
boolean isBedSpawn = false;
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
@@ -410,7 +454,7 @@ public abstract class PlayerList {
location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
} else {
entityplayer1.setRespawnPosition(null, true);
- entityplayer1.playerConnection.sendPacket(new Packet70Bed(0, 0));
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0));
}
}
@@ -442,29 +486,30 @@ public abstract class PlayerList {
// CraftBukkit start
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
// Force the client to refresh their chunk cache.
- entityplayer1.playerConnection.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0), (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode()));
- entityplayer1.playerConnection.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode()));
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn((byte) (actualDimension >= 0 ? -1 : 0), worldserver.difficulty, worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode()));
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(actualDimension, worldserver.difficulty, worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode()));
entityplayer1.spawnIn(worldserver);
entityplayer1.dead = false;
entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
entityplayer1.setSneaking(false);
chunkcoordinates1 = worldserver.getSpawn();
+ // entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
// CraftBukkit end
- entityplayer1.playerConnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z));
- entityplayer1.playerConnection.sendPacket(new Packet43SetExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z));
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
this.b(entityplayer1, worldserver);
worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
worldserver.addEntity(entityplayer1);
this.players.add(entityplayer1);
// CraftBukkit start - Added from changeDimension
- this.updateClient(entityplayer1); // CraftBukkit
+ this.updateClient(entityplayer1); // Update health, etc...
entityplayer1.updateAbilities();
Iterator iterator = entityplayer1.getEffects().iterator();
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
- entityplayer1.playerConnection.sendPacket(new Packet41MobEffect(entityplayer1.id, mobeffect));
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer1.getId(), mobeffect));
}
// entityplayer1.syncInventory();
// CraftBukkit end
@@ -687,9 +732,7 @@ public abstract class PlayerList {
d1 = (double) MathHelper.a((int) d1, -29999872, 29999872);
*/
if (entity.isAlive()) {
- worldserver1.addEntity(entity);
// entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch)
- worldserver1.entityJoinedWorld(entity, false);
// worldserver1.s().a(entity, d3, d4, d5, f);
if (portal) {
Vector velocity = entity.getBukkitEntity().getVelocity();
@@ -699,6 +742,8 @@ public abstract class PlayerList {
entity.getBukkitEntity().setVelocity(velocity);
}
}
+ worldserver1.addEntity(entity);
+ worldserver1.entityJoinedWorld(entity, false);
}
worldserver.methodProfiler.b();
@@ -709,15 +754,15 @@ public abstract class PlayerList {
}
public void tick() {
- if (++this.n > 600) {
- this.n = 0;
+ if (++this.p > 600) {
+ this.p = 0;
}
/* CraftBukkit start - Remove updating of lag to players -- it spams way to much on big servers.
- if (this.n < this.players.size()) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n);
+ if (this.p < this.players.size()) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.p);
- this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, entityplayer.ping));
+ this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, entityplayer.ping));
}
// CraftBukkit end */
}
@@ -798,8 +843,8 @@ public abstract class PlayerList {
}
public boolean isOp(String s) {
- // CraftBukkit
- return this.operators.contains(s.trim().toLowerCase()) || this.server.K() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.J().equalsIgnoreCase(s) || this.m;
+ // CraftBukkit - fix reference to worldserver array
+ return this.operators.contains(s.trim().toLowerCase()) || this.server.L() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.K().equalsIgnoreCase(s) || this.o;
}
public EntityPlayer getPlayer(String s) {
@@ -841,7 +886,7 @@ public abstract class PlayerList {
for (int i2 = 0; i2 < this.players.size(); ++i2) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i2);
- if ((world == null || entityplayer.world == world) && (s == null || flag1 != s.equalsIgnoreCase(entityplayer.getLocalizedName()))) {
+ if ((world == null || entityplayer.world == world) && (s == null || flag1 != s.equalsIgnoreCase(entityplayer.getName()))) {
if (s1 != null) {
ScoreboardTeamBase scoreboardteambase = entityplayer.getScoreboardTeam();
String s2 = scoreboardteambase == null ? "" : scoreboardteambase.getName();
@@ -852,7 +897,7 @@ public abstract class PlayerList {
}
if (chunkcoordinates != null && (i > 0 || j > 0)) {
- float f = chunkcoordinates.e(entityplayer.b());
+ float f = chunkcoordinates.e(entityplayer.getChunkCoordinates());
if (i > 0 && f < (float) k1 || j > 0 && f > (float) l1) {
continue;
@@ -910,7 +955,7 @@ public abstract class PlayerList {
return false;
}
- ScoreboardScore scoreboardscore = entityhuman.getScoreboard().getPlayerScoreForObjective(entityhuman.getLocalizedName(), scoreboardobjective);
+ ScoreboardScore scoreboardscore = entityhuman.getScoreboard().getPlayerScoreForObjective(entityhuman.getName(), scoreboardobjective);
i = scoreboardscore.getScore();
if (i < ((Integer) entry.getValue()).intValue() && flag) {
@@ -937,6 +982,7 @@ public abstract class PlayerList {
continue;
}
// CraftBukkit end
+
if (entityplayer != entityhuman && entityplayer.dimension == i) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
@@ -974,16 +1020,21 @@ public abstract class PlayerList {
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
- entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
- if (worldserver.Q()) {
- entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
+ if (worldserver.P()) {
+ // CraftBukkit start - handle player weather
+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0.0F));
+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, worldserver.j(1.0F)));
+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, worldserver.h(1.0F)));
+ entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false);
+ // CraftBukkit end
}
}
public void updateClient(EntityPlayer entityplayer) {
entityplayer.updateInventory(entityplayer.defaultContainer);
entityplayer.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
- entityplayer.playerConnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
public int getPlayerCount() {
@@ -995,7 +1046,8 @@ public abstract class PlayerList {
}
public String[] getSeenPlayers() {
- return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers(); // CraftBukkit
+ // CraftBukkit - fix reference to worldserver array
+ return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers();
}
public boolean getHasWhitelist() {
@@ -1006,14 +1058,14 @@ public abstract class PlayerList {
this.hasWhitelist = flag;
}
- public List i(String s) {
+ public List h(String s) {
ArrayList arraylist = new ArrayList();
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- if (entityplayer.q().equals(s)) {
+ if (entityplayer.s().equals(s)) {
arraylist.add(entityplayer);
}
}
@@ -1036,25 +1088,45 @@ public abstract class PlayerList {
private void a(EntityPlayer entityplayer, EntityPlayer entityplayer1, World world) {
if (entityplayer1 != null) {
entityplayer.playerInteractManager.setGameMode(entityplayer1.playerInteractManager.getGameMode());
- } else if (this.l != null) {
- entityplayer.playerInteractManager.setGameMode(this.l);
+ } else if (this.n != null) {
+ entityplayer.playerInteractManager.setGameMode(this.n);
}
entityplayer.playerInteractManager.b(world.getWorldData().getGameType());
}
public void r() {
- while (!this.players.isEmpty()) {
- ((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
+ for (int i = 0; i < this.players.size(); ++i) {
+ ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
}
}
- public void sendMessage(ChatMessage chatmessage, boolean flag) {
- this.server.sendMessage(chatmessage);
- this.sendAll(new Packet3Chat(chatmessage, flag));
+ // CraftBukkit start - Support multi-line messages
+ public void sendMessage(IChatBaseComponent[] ichatbasecomponent) {
+ for (IChatBaseComponent component : ichatbasecomponent) {
+ sendMessage(component, true);
+ }
+ }
+ // CraftBukkit end
+
+ public void sendMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
+ this.server.sendMessage(ichatbasecomponent);
+ this.sendAll(new PacketPlayOutChat(ichatbasecomponent, flag));
}
- public void sendMessage(ChatMessage chatmessage) {
- this.sendMessage(chatmessage, true);
+ public void sendMessage(IChatBaseComponent ichatbasecomponent) {
+ this.sendMessage(ichatbasecomponent, true);
+ }
+
+ public ServerStatisticManager i(String s) {
+ ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.k.get(s);
+
+ if (serverstatisticmanager == null) {
+ serverstatisticmanager = new ServerStatisticManager(this.server, new File(this.server.getWorldServer(0).getDataManager().getDirectory(), "stats/" + s + ".json"));
+ serverstatisticmanager.a();
+ this.k.put(s, serverstatisticmanager);
+ }
+
+ return serverstatisticmanager;
}
}
diff --git a/src/main/java/net/minecraft/server/PortalCreator.java b/src/main/java/net/minecraft/server/PortalCreator.java
new file mode 100644
index 0000000000..416aaeaa4a
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PortalCreator.java
@@ -0,0 +1,191 @@
+package net.minecraft.server;
+
+import org.bukkit.event.world.PortalCreateEvent; // CraftBukkit
+
+public class PortalCreator {
+
+ private final World a;
+ private final int b;
+ private final int c;
+ private final int d;
+ private int e = 0;
+ private ChunkCoordinates f;
+ private int g;
+ private int h;
+ java.util.Collection blocks; // CraftBukkit
+
+ public PortalCreator(World world, int i, int j, int k, int l) {
+ this.a = world;
+ this.b = l;
+ this.d = BlockPortal.a[l][0];
+ this.c = BlockPortal.a[l][1];
+
+ for (int i1 = j; j > i1 - 21 && j > 0 && this.a(world.getType(i, j - 1, k)); --j) {
+ ;
+ }
+
+ int j1 = this.a(i, j, k, this.d) - 1;
+
+ if (j1 >= 0) {
+ this.f = new ChunkCoordinates(i + j1 * Direction.a[this.d], j, k + j1 * Direction.b[this.d]);
+ this.h = this.a(this.f.x, this.f.y, this.f.z, this.c);
+ if (this.h < 2 || this.h > 21) {
+ this.f = null;
+ this.h = 0;
+ }
+ }
+
+ if (this.f != null) {
+ this.g = this.a();
+ }
+ }
+
+ protected int a(int i, int j, int k, int l) {
+ int i1 = Direction.a[l];
+ int j1 = Direction.b[l];
+
+ int k1;
+ Block block;
+
+ for (k1 = 0; k1 < 22; ++k1) {
+ block = this.a.getType(i + i1 * k1, j, k + j1 * k1);
+ if (!this.a(block)) {
+ break;
+ }
+
+ Block block1 = this.a.getType(i + i1 * k1, j - 1, k + j1 * k1);
+
+ if (block1 != Blocks.OBSIDIAN) {
+ break;
+ }
+ }
+
+ block = this.a.getType(i + i1 * k1, j, k + j1 * k1);
+ return block == Blocks.OBSIDIAN ? k1 : 0;
+ }
+
+ protected int a() {
+ this.blocks = new java.util.HashSet(); // CraftBukkit
+ org.bukkit.World bworld = this.a.getWorld();
+ int i;
+ int j;
+ int k;
+ int l;
+
+ label56:
+ for (this.g = 0; this.g < 21; ++this.g) {
+ i = this.f.y + this.g;
+
+ for (j = 0; j < this.h; ++j) {
+ k = this.f.x + j * Direction.a[BlockPortal.a[this.b][1]];
+ l = this.f.z + j * Direction.b[BlockPortal.a[this.b][1]];
+ Block block = this.a.getType(k, i, l);
+
+ if (!this.a(block)) {
+ break label56;
+ }
+
+ if (block == Blocks.PORTAL) {
+ ++this.e;
+ }
+
+ if (j == 0) {
+ block = this.a.getType(k + Direction.a[BlockPortal.a[this.b][0]], i, l + Direction.b[BlockPortal.a[this.b][0]]);
+ if (block != Blocks.OBSIDIAN) {
+ break label56;
+ // CraftBukkit start - add the block to our list
+ } else {
+ blocks.add(bworld.getBlockAt(k + Direction.a[BlockPortal.a[this.b][0]], i, l + Direction.b[BlockPortal.a[this.b][0]]));
+ // CraftBukkit end
+ }
+ } else if (j == this.h - 1) {
+ block = this.a.getType(k + Direction.a[BlockPortal.a[this.b][1]], i, l + Direction.b[BlockPortal.a[this.b][1]]);
+ if (block != Blocks.OBSIDIAN) {
+ break label56;
+ // CraftBukkit start - add the block to our list
+ } else {
+ blocks.add(bworld.getBlockAt(k + Direction.a[BlockPortal.a[this.b][1]], i, l + Direction.b[BlockPortal.a[this.b][1]]));
+ // CraftBukkit end
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < this.h; ++i) {
+ j = this.f.x + i * Direction.a[BlockPortal.a[this.b][1]];
+ k = this.f.y + this.g;
+ l = this.f.z + i * Direction.b[BlockPortal.a[this.b][1]];
+ if (this.a.getType(j, k, l) != Blocks.OBSIDIAN) {
+ this.g = 0;
+ break;
+ }
+ }
+
+ if (this.g <= 21 && this.g >= 3) {
+ return this.g;
+ } else {
+ this.f = null;
+ this.h = 0;
+ this.g = 0;
+ return 0;
+ }
+ }
+
+ protected boolean a(Block block) {
+ return block.material == Material.AIR || block == Blocks.FIRE || block == Blocks.PORTAL;
+ }
+
+ public boolean b() {
+ return this.f != null && this.h >= 2 && this.h <= 21 && this.g >= 3 && this.g <= 21;
+ }
+
+ // CraftBukkit start - return boolean
+ public boolean c() {
+ org.bukkit.World bworld = this.a.getWorld();
+
+ // Copy below for loop
+ for (int i = 0; i < this.h; ++i) {
+ int j = this.f.x + Direction.a[this.c] * i;
+ int k = this.f.z + Direction.b[this.c] * i;
+
+ for (int l = 0; l < this.g; ++l) {
+ int i1 = this.f.y + l;
+
+ bworld.getBlockAt(j, i1, k);
+ }
+ }
+
+ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
+ this.a.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ // CraftBukkit end
+
+ for (int i = 0; i < this.h; ++i) {
+ int j = this.f.x + Direction.a[this.c] * i;
+ int k = this.f.z + Direction.b[this.c] * i;
+
+ for (int l = 0; l < this.g; ++l) {
+ int i1 = this.f.y + l;
+
+ this.a.setTypeAndData(j, i1, k, Blocks.PORTAL, this.b, 2);
+ }
+ }
+
+ return true; // CraftBukkit
+ }
+
+ static int a(PortalCreator portalcreator) {
+ return portalcreator.e;
+ }
+
+ static int b(PortalCreator portalcreator) {
+ return portalcreator.h;
+ }
+
+ static int c(PortalCreator portalcreator) {
+ return portalcreator.g;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 5ac2fddea7..9d954af5c8 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -54,7 +54,7 @@ public class PortalTravelAgent {
int i2 = k + i1 * b1 - l * b0;
boolean flag = j1 < 0;
- this.a.setTypeIdUpdate(k1, l1, i2, flag ? Block.OBSIDIAN.id : 0);
+ this.a.setTypeUpdate(k1, l1, i2, flag ? Blocks.OBSIDIAN : Blocks.AIR);
}
}
}
@@ -79,7 +79,7 @@ public class PortalTravelAgent {
int i2 = k + i1 * b1 - l * b0;
boolean flag = j1 < 0;
- if (this.a.getTypeId(k1, l1, i2) != (flag ? Block.OBSIDIAN.id : 0)) {
+ if (this.a.getType(k1, l1, i2) != (flag ? Blocks.OBSIDIAN : Blocks.AIR)) {
return null;
}
}
@@ -140,9 +140,9 @@ public class PortalTravelAgent {
for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) {
double d6 = (double) l1 + 0.5D - z; // CraftBukkit
- for (int i2 = this.a.S() - 1; i2 >= 0; --i2) {
- if (this.a.getTypeId(k1, i2, l1) == Block.PORTAL.id) {
- while (this.a.getTypeId(k1, i2 - 1, l1) == Block.PORTAL.id) {
+ for (int i2 = this.a.R() - 1; i2 >= 0; --i2) {
+ if (this.a.getType(k1, i2, l1) == Blocks.PORTAL) {
+ while (this.a.getType(k1, i2 - 1, l1) == Blocks.PORTAL) {
--i2;
}
@@ -199,23 +199,23 @@ public class PortalTravelAgent {
d4 = (double) k + 0.5D;
int j2 = -1;
- if (this.a.getTypeId(i - 1, j, k) == Block.PORTAL.id) {
+ if (this.a.getType(i - 1, j, k) == Blocks.PORTAL) {
j2 = 2;
}
- if (this.a.getTypeId(i + 1, j, k) == Block.PORTAL.id) {
+ if (this.a.getType(i + 1, j, k) == Blocks.PORTAL) {
j2 = 0;
}
- if (this.a.getTypeId(i, j, k - 1) == Block.PORTAL.id) {
+ if (this.a.getType(i, j, k - 1) == Blocks.PORTAL) {
j2 = 3;
}
- if (this.a.getTypeId(i, j, k + 1) == Block.PORTAL.id) {
+ if (this.a.getType(i, j, k + 1) == Blocks.PORTAL) {
j2 = 1;
}
- int k2 = entity.at();
+ int k2 = entity.ay();
if (j2 > -1) {
int l2 = Direction.h[j2];
@@ -364,7 +364,7 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - z; // CraftBukkit
label274:
- for (k2 = this.a.S() - 1; k2 >= 0; --k2) {
+ for (k2 = this.a.R() - 1; k2 >= 0; --k2) {
if (this.a.isEmpty(i2, k2, j2)) {
while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) {
--k2;
@@ -385,7 +385,7 @@ public class PortalTravelAgent {
j4 = k2 + l3;
int l4 = j2 + (i4 - 1) * k3 - j3 * l2;
- if (l3 < 0 && !this.a.getMaterial(k4, j4, l4).isBuildable() || l3 >= 0 && !this.a.isEmpty(k4, j4, l4)) {
+ if (l3 < 0 && !this.a.getType(k4, j4, l4).getMaterial().isBuildable() || l3 >= 0 && !this.a.isEmpty(k4, j4, l4)) {
continue label274;
}
}
@@ -415,7 +415,7 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - z; // CraftBukkit
label222:
- for (k2 = this.a.S() - 1; k2 >= 0; --k2) {
+ for (k2 = this.a.R() - 1; k2 >= 0; --k2) {
if (this.a.isEmpty(i2, k2, j2)) {
while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) {
--k2;
@@ -430,7 +430,7 @@ public class PortalTravelAgent {
l3 = i2 + (j3 - 1) * l2;
k4 = k2 + i4;
j4 = j2 + (j3 - 1) * k3;
- if (i4 < 0 && !this.a.getMaterial(l3, k4, j4).isBuildable() || i4 >= 0 && !this.a.isEmpty(l3, k4, j4)) {
+ if (i4 < 0 && !this.a.getType(l3, k4, j4).getMaterial().isBuildable() || i4 >= 0 && !this.a.isEmpty(l3, k4, j4)) {
continue label222;
}
}
@@ -471,8 +471,8 @@ public class PortalTravelAgent {
i1 = 70;
}
- if (i1 > this.a.S() - 10) {
- i1 = this.a.S() - 10;
+ if (i1 > this.a.R() - 10) {
+ i1 = this.a.R() - 10;
}
j5 = i1;
@@ -484,7 +484,7 @@ public class PortalTravelAgent {
j3 = j5 + l2;
i4 = j2 + (i3 - 1) * l5 - k2 * k5;
flag = l2 < 0;
- this.a.setTypeIdUpdate(k3, j3, i4, flag ? Block.OBSIDIAN.id : 0);
+ this.a.setTypeUpdate(k3, j3, i4, flag ? Blocks.OBSIDIAN : Blocks.AIR);
}
}
}
@@ -497,7 +497,7 @@ public class PortalTravelAgent {
j3 = j5 + l2;
i4 = j2 + (i3 - 1) * l5;
flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3;
- this.a.setTypeIdAndData(k3, j3, i4, flag ? Block.OBSIDIAN.id : Block.PORTAL.id, 0, 2);
+ this.a.setTypeAndData(k3, j3, i4, flag ? Blocks.OBSIDIAN : Blocks.PORTAL, 0, 2);
}
}
@@ -506,7 +506,7 @@ public class PortalTravelAgent {
k3 = i5 + (i3 - 1) * k5;
j3 = j5 + l2;
i4 = j2 + (i3 - 1) * l5;
- this.a.applyPhysics(k3, j3, i4, this.a.getTypeId(k3, j3, i4));
+ this.a.applyPhysics(k3, j3, i4, this.a.getType(k3, j3, i4));
}
}
}
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index 03aa2190a6..bb535c2fb4 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -5,20 +5,19 @@ 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;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import joptsimple.OptionSet; // CraftBukkit
public class PropertyManager {
+ private static final Logger loggingAgent = LogManager.getLogger();
public final Properties properties = new Properties(); // CraftBukkit - private -> public
- private final IConsoleLogManager loggingAgent;
private final File c;
- public PropertyManager(File file1, IConsoleLogManager iconsolelogmanager) {
+ public PropertyManager(File file1) {
this.c = file1;
- this.loggingAgent = iconsolelogmanager;
if (file1.exists()) {
FileInputStream fileinputstream = null;
@@ -26,7 +25,7 @@ public class PropertyManager {
fileinputstream = new FileInputStream(file1);
this.properties.load(fileinputstream);
} catch (Exception exception) {
- iconsolelogmanager.warning("Failed to load " + file1, exception);
+ loggingAgent.warn("Failed to load " + file1, exception);
this.a();
} finally {
if (fileinputstream != null) {
@@ -38,7 +37,7 @@ public class PropertyManager {
}
}
} else {
- iconsolelogmanager.warning(file1 + " does not exist");
+ loggingAgent.warn(file1 + " does not exist");
this.a();
}
}
@@ -46,8 +45,8 @@ public class PropertyManager {
// CraftBukkit start
private OptionSet options = null;
- public PropertyManager(final OptionSet options, IConsoleLogManager iconsolelogmanager) {
- this((File) options.valueOf("config"), iconsolelogmanager);
+ public PropertyManager(final OptionSet options) {
+ this((File) options.valueOf("config"));
this.options = options;
}
@@ -62,7 +61,7 @@ public class PropertyManager {
// CraftBukkit end
public void a() {
- this.loggingAgent.info("Generating new properties file");
+ loggingAgent.info("Generating new properties file");
this.savePropertiesFile();
}
@@ -78,7 +77,7 @@ public class PropertyManager {
fileoutputstream = new FileOutputStream(this.c);
this.properties.store(fileoutputstream, "Minecraft server properties");
} catch (Exception exception) {
- this.loggingAgent.warning("Failed to save " + this.c, exception);
+ loggingAgent.warn("Failed to save " + this.c, exception);
this.a();
} finally {
if (fileoutputstream != null) {
@@ -99,6 +98,7 @@ public class PropertyManager {
if (!this.properties.containsKey(s)) {
this.properties.setProperty(s, s1);
this.savePropertiesFile();
+ this.savePropertiesFile();
}
return this.getOverride(s, this.properties.getProperty(s, s1)); // CraftBukkit
@@ -109,6 +109,7 @@ public class PropertyManager {
return this.getOverride(s, Integer.parseInt(this.getString(s, "" + i))); // CraftBukkit
} catch (Exception exception) {
this.properties.setProperty(s, "" + i);
+ this.savePropertiesFile();
return this.getOverride(s, i); // CraftBukkit
}
}
@@ -118,6 +119,7 @@ public class PropertyManager {
return this.getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); // CraftBukkit
} catch (Exception exception) {
this.properties.setProperty(s, "" + flag);
+ this.savePropertiesFile();
return this.getOverride(s, flag); // CraftBukkit
}
}
diff --git a/src/main/java/net/minecraft/server/ProtocolOrdinalWrapper.java b/src/main/java/net/minecraft/server/ProtocolOrdinalWrapper.java
new file mode 100644
index 0000000000..d6e7f3620d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ProtocolOrdinalWrapper.java
@@ -0,0 +1,21 @@
+package net.minecraft.server;
+
+// CraftBukkit - import package private class
+class ProtocolOrdinalWrapper {
+
+ static final int[] a = new int[EnumProtocol.values().length];
+
+ static {
+ try {
+ a[EnumProtocol.LOGIN.ordinal()] = 1;
+ } catch (NoSuchFieldError nosuchfielderror) {
+ ;
+ }
+
+ try {
+ a[EnumProtocol.STATUS.ordinal()] = 2;
+ } catch (NoSuchFieldError nosuchfielderror1) {
+ ;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/QueuedPacket.java b/src/main/java/net/minecraft/server/QueuedPacket.java
new file mode 100644
index 0000000000..fdebf9dd32
--- /dev/null
+++ b/src/main/java/net/minecraft/server/QueuedPacket.java
@@ -0,0 +1,23 @@
+package net.minecraft.server;
+
+import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
+
+// CraftBukkit - imported class because the methods are package private
+class QueuedPacket {
+
+ private final Packet a;
+ private final GenericFutureListener[] b;
+
+ public QueuedPacket(Packet packet, GenericFutureListener... agenericfuturelistener) {
+ this.a = packet;
+ this.b = agenericfuturelistener;
+ }
+
+ static Packet a(QueuedPacket queuedpacket) {
+ return queuedpacket.a;
+ }
+
+ static GenericFutureListener[] b(QueuedPacket queuedpacket) {
+ return queuedpacket.b;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/RecipeArmorDye.java b/src/main/java/net/minecraft/server/RecipeArmorDye.java
index 0663e1206d..13bb70828a 100644
--- a/src/main/java/net/minecraft/server/RecipeArmorDye.java
+++ b/src/main/java/net/minecraft/server/RecipeArmorDye.java
@@ -6,7 +6,7 @@ public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // Cra
// CraftBukkit start - Delegate to new parent class with bogus info
public RecipeArmorDye() {
- super(new ItemStack(Item.LEATHER_HELMET, 0, 0), java.util.Arrays.asList(new ItemStack(Item.INK_SACK, 0, 5)));
+ super(new ItemStack(Items.LEATHER_HELMET, 0, 0), java.util.Arrays.asList(new ItemStack(Items.INK_SACK, 0, 5)));
}
// CraftBukkit end
@@ -21,13 +21,13 @@ public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // Cra
if (itemstack1.getItem() instanceof ItemArmor) {
ItemArmor itemarmor = (ItemArmor) itemstack1.getItem();
- if (itemarmor.d() != EnumArmorMaterial.CLOTH || itemstack != null) {
+ if (itemarmor.m_() != EnumArmorMaterial.CLOTH || itemstack != null) {
return false;
}
itemstack = itemstack1;
} else {
- if (itemstack1.id != Item.INK_SACK.id) {
+ if (itemstack1.getItem() != Items.INK_SACK) {
return false;
}
@@ -58,13 +58,13 @@ public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // Cra
if (itemstack1 != null) {
if (itemstack1.getItem() instanceof ItemArmor) {
itemarmor = (ItemArmor) itemstack1.getItem();
- if (itemarmor.d() != EnumArmorMaterial.CLOTH || itemstack != null) {
+ if (itemarmor.m_() != EnumArmorMaterial.CLOTH || itemstack != null) {
return null;
}
itemstack = itemstack1.cloneItemStack();
itemstack.count = 1;
- if (itemarmor.a(itemstack1)) {
+ if (itemarmor.c_(itemstack1)) {
l = itemarmor.b(itemstack);
f = (float) (l >> 16 & 255) / 255.0F;
f1 = (float) (l >> 8 & 255) / 255.0F;
@@ -77,11 +77,11 @@ public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // Cra
++j;
}
} else {
- if (itemstack1.id != Item.INK_SACK.id) {
+ if (itemstack1.getItem() != Items.INK_SACK) {
return null;
}
- float[] afloat = EntitySheep.bp[BlockCloth.j_(itemstack1.getData())];
+ float[] afloat = EntitySheep.bp[BlockCloth.b(itemstack1.getData())];
int j1 = (int) (afloat[0] * 255.0F);
int k1 = (int) (afloat[1] * 255.0F);
diff --git a/src/main/java/net/minecraft/server/RecipeFireworks.java b/src/main/java/net/minecraft/server/RecipeFireworks.java
index 780a417c5b..816df8c1c1 100644
--- a/src/main/java/net/minecraft/server/RecipeFireworks.java
+++ b/src/main/java/net/minecraft/server/RecipeFireworks.java
@@ -8,7 +8,7 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
// CraftBukkit start - Delegate to new parent class with bogus info
public RecipeFireworks() {
- super(new ItemStack(Item.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Item.SULPHUR, 0, 5)));
+ super(new ItemStack(Items.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Items.SULPHUR, 0, 5)));
}
// CraftBukkit end
@@ -25,26 +25,26 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
ItemStack itemstack = inventorycrafting.getItem(k1);
if (itemstack != null) {
- if (itemstack.id == Item.SULPHUR.id) {
+ if (itemstack.getItem() == Items.SULPHUR) {
++j;
- } else if (itemstack.id == Item.FIREWORKS_CHARGE.id) {
+ } else if (itemstack.getItem() == Items.FIREWORKS_CHARGE) {
++l;
- } else if (itemstack.id == Item.INK_SACK.id) {
+ } else if (itemstack.getItem() == Items.INK_SACK) {
++k;
- } else if (itemstack.id == Item.PAPER.id) {
+ } else if (itemstack.getItem() == Items.PAPER) {
++i;
- } else if (itemstack.id == Item.GLOWSTONE_DUST.id) {
+ } else if (itemstack.getItem() == Items.GLOWSTONE_DUST) {
++i1;
- } else if (itemstack.id == Item.DIAMOND.id) {
+ } else if (itemstack.getItem() == Items.DIAMOND) {
++i1;
- } else if (itemstack.id == Item.FIREBALL.id) {
+ } else if (itemstack.getItem() == Items.FIREBALL) {
++j1;
- } else if (itemstack.id == Item.FEATHER.id) {
+ } else if (itemstack.getItem() == Items.FEATHER) {
++j1;
- } else if (itemstack.id == Item.GOLD_NUGGET.id) {
+ } else if (itemstack.getItem() == Items.GOLD_NUGGET) {
++j1;
} else {
- if (itemstack.id != Item.SKULL.id) {
+ if (itemstack.getItem() != Items.SKULL) {
return false;
}
@@ -59,16 +59,16 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
NBTTagCompound nbttagcompound1;
if (j >= 1 && i == 1 && i1 == 0) {
- this.a = new ItemStack(Item.FIREWORKS);
+ this.a = new ItemStack(Items.FIREWORKS);
if (l > 0) {
nbttagcompound = new NBTTagCompound();
- nbttagcompound1 = new NBTTagCompound("Fireworks");
- NBTTagList nbttaglist = new NBTTagList("Explosions");
+ nbttagcompound1 = new NBTTagCompound();
+ NBTTagList nbttaglist = new NBTTagList();
for (int l1 = 0; l1 < inventorycrafting.getSize(); ++l1) {
ItemStack itemstack1 = inventorycrafting.getItem(l1);
- if (itemstack1 != null && itemstack1.id == Item.FIREWORKS_CHARGE.id && itemstack1.hasTag() && itemstack1.getTag().hasKey("Explosion")) {
+ if (itemstack1 != null && itemstack1.getItem() == Items.FIREWORKS_CHARGE && itemstack1.hasTag() && itemstack1.getTag().hasKeyOfType("Explosion", 10)) {
nbttaglist.add(itemstack1.getTag().getCompound("Explosion"));
}
}
@@ -81,9 +81,9 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
return true;
} else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) {
- this.a = new ItemStack(Item.FIREWORKS_CHARGE);
+ this.a = new ItemStack(Items.FIREWORKS_CHARGE);
nbttagcompound = new NBTTagCompound();
- nbttagcompound1 = new NBTTagCompound("Explosion");
+ nbttagcompound1 = new NBTTagCompound();
byte b0 = 0;
ArrayList arraylist = new ArrayList();
@@ -91,19 +91,19 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
ItemStack itemstack2 = inventorycrafting.getItem(i2);
if (itemstack2 != null) {
- if (itemstack2.id == Item.INK_SACK.id) {
+ if (itemstack2.getItem() == Items.INK_SACK) {
arraylist.add(Integer.valueOf(ItemDye.c[itemstack2.getData()]));
- } else if (itemstack2.id == Item.GLOWSTONE_DUST.id) {
+ } else if (itemstack2.getItem() == Items.GLOWSTONE_DUST) {
nbttagcompound1.setBoolean("Flicker", true);
- } else if (itemstack2.id == Item.DIAMOND.id) {
+ } else if (itemstack2.getItem() == Items.DIAMOND) {
nbttagcompound1.setBoolean("Trail", true);
- } else if (itemstack2.id == Item.FIREBALL.id) {
+ } else if (itemstack2.getItem() == Items.FIREBALL) {
b0 = 1;
- } else if (itemstack2.id == Item.FEATHER.id) {
+ } else if (itemstack2.getItem() == Items.FEATHER) {
b0 = 4;
- } else if (itemstack2.id == Item.GOLD_NUGGET.id) {
+ } else if (itemstack2.getItem() == Items.GOLD_NUGGET) {
b0 = 2;
- } else if (itemstack2.id == Item.SKULL.id) {
+ } else if (itemstack2.getItem() == Items.SKULL) {
b0 = 3;
}
}
@@ -127,9 +127,9 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
ItemStack itemstack3 = inventorycrafting.getItem(k2);
if (itemstack3 != null) {
- if (itemstack3.id == Item.INK_SACK.id) {
+ if (itemstack3.getItem() == Items.INK_SACK) {
arraylist1.add(Integer.valueOf(ItemDye.c[itemstack3.getData()]));
- } else if (itemstack3.id == Item.FIREWORKS_CHARGE.id) {
+ } else if (itemstack3.getItem() == Items.FIREWORKS_CHARGE) {
this.a = itemstack3.cloneItemStack();
this.a.count = 1;
}
diff --git a/src/main/java/net/minecraft/server/RecipeMapClone.java b/src/main/java/net/minecraft/server/RecipeMapClone.java
index 7e9e2c9dbb..793883feaf 100644
--- a/src/main/java/net/minecraft/server/RecipeMapClone.java
+++ b/src/main/java/net/minecraft/server/RecipeMapClone.java
@@ -4,7 +4,7 @@ public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // Cra
// CraftBukkit start - Delegate to new parent class
public RecipeMapClone() {
- super(new ItemStack(Item.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Item.MAP_EMPTY, 0, 0)));
+ super(new ItemStack(Items.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Items.MAP_EMPTY, 0, 0)));
}
// CraftBukkit end
@@ -16,14 +16,14 @@ public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // Cra
ItemStack itemstack1 = inventorycrafting.getItem(j);
if (itemstack1 != null) {
- if (itemstack1.id == Item.MAP.id) {
+ if (itemstack1.getItem() == Items.MAP) {
if (itemstack != null) {
return false;
}
itemstack = itemstack1;
} else {
- if (itemstack1.id != Item.MAP_EMPTY.id) {
+ if (itemstack1.getItem() != Items.MAP_EMPTY) {
return false;
}
@@ -43,14 +43,14 @@ public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // Cra
ItemStack itemstack1 = inventorycrafting.getItem(j);
if (itemstack1 != null) {
- if (itemstack1.id == Item.MAP.id) {
+ if (itemstack1.getItem() == Items.MAP) {
if (itemstack != null) {
return null;
}
itemstack = itemstack1;
} else {
- if (itemstack1.id != Item.MAP_EMPTY.id) {
+ if (itemstack1.getItem() != Items.MAP_EMPTY) {
return null;
}
@@ -60,7 +60,7 @@ public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // Cra
}
if (itemstack != null && i >= 1) {
- ItemStack itemstack2 = new ItemStack(Item.MAP, i + 1, itemstack.getData());
+ ItemStack itemstack2 = new ItemStack(Items.MAP, i + 1, itemstack.getData());
if (itemstack.hasName()) {
itemstack2.c(itemstack.getName());
diff --git a/src/main/java/net/minecraft/server/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java
index 47a1a3e9e3..85d760959b 100644
--- a/src/main/java/net/minecraft/server/RecipesFurnace.java
+++ b/src/main/java/net/minecraft/server/RecipesFurnace.java
@@ -1,7 +1,9 @@
package net.minecraft.server;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
public class RecipesFurnace {
@@ -9,47 +11,94 @@ public class RecipesFurnace {
public Map recipes = new HashMap(); // CraftBukkit - private -> public
private Map c = new HashMap();
- public static final RecipesFurnace getInstance() {
+ public static 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.35F);
- this.registerRecipe(Item.RAW_BEEF.id, new ItemStack(Item.COOKED_BEEF), 0.35F);
- this.registerRecipe(Item.RAW_CHICKEN.id, new ItemStack(Item.COOKED_CHICKEN), 0.35F);
- this.registerRecipe(Item.RAW_FISH.id, new ItemStack(Item.COOKED_FISH), 0.35F);
- this.registerRecipe(Block.COBBLESTONE.id, new ItemStack(Block.STONE), 0.1F);
- this.registerRecipe(Item.CLAY_BALL.id, new ItemStack(Item.CLAY_BRICK), 0.3F);
- this.registerRecipe(Block.CLAY.id, new ItemStack(Block.HARDENED_CLAY), 0.35F);
- 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.15F);
- this.registerRecipe(Block.EMERALD_ORE.id, new ItemStack(Item.EMERALD), 1.0F);
- this.registerRecipe(Item.POTATO.id, new ItemStack(Item.POTATO_BAKED), 0.35F);
- this.registerRecipe(Block.NETHERRACK.id, new ItemStack(Item.NETHER_BRICK), 0.1F);
- 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);
- this.registerRecipe(Block.QUARTZ_ORE.id, new ItemStack(Item.QUARTZ), 0.2F);
+ this.registerRecipe(Blocks.IRON_ORE, new ItemStack(Items.IRON_INGOT), 0.7F);
+ this.registerRecipe(Blocks.GOLD_ORE, new ItemStack(Items.GOLD_INGOT), 1.0F);
+ this.registerRecipe(Blocks.DIAMOND_ORE, new ItemStack(Items.DIAMOND), 1.0F);
+ this.registerRecipe(Blocks.SAND, new ItemStack(Blocks.GLASS), 0.1F);
+ this.a(Items.PORK, new ItemStack(Items.GRILLED_PORK), 0.35F);
+ this.a(Items.RAW_BEEF, new ItemStack(Items.COOKED_BEEF), 0.35F);
+ this.a(Items.RAW_CHICKEN, new ItemStack(Items.COOKED_CHICKEN), 0.35F);
+ this.registerRecipe(Blocks.COBBLESTONE, new ItemStack(Blocks.STONE), 0.1F);
+ this.a(Items.CLAY_BALL, new ItemStack(Items.CLAY_BRICK), 0.3F);
+ this.registerRecipe(Blocks.CLAY, new ItemStack(Blocks.HARDENED_CLAY), 0.35F);
+ this.registerRecipe(Blocks.CACTUS, new ItemStack(Items.INK_SACK, 1, 2), 0.2F);
+ this.registerRecipe(Blocks.LOG, new ItemStack(Items.COAL, 1, 1), 0.15F);
+ this.registerRecipe(Blocks.LOG2, new ItemStack(Items.COAL, 1, 1), 0.15F);
+ this.registerRecipe(Blocks.EMERALD_ORE, new ItemStack(Items.EMERALD), 1.0F);
+ this.a(Items.POTATO, new ItemStack(Items.POTATO_BAKED), 0.35F);
+ this.registerRecipe(Blocks.NETHERRACK, new ItemStack(Items.NETHER_BRICK), 0.1F);
+ EnumFish[] aenumfish = EnumFish.values();
+ int i = aenumfish.length;
+
+ for (int j = 0; j < i; ++j) {
+ EnumFish enumfish = aenumfish[j];
+
+ if (enumfish.i()) {
+ this.a(new ItemStack(Items.RAW_FISH, 1, enumfish.a()), new ItemStack(Items.COOKED_FISH, 1, enumfish.a()), 0.35F);
+ }
+ }
+
+ this.registerRecipe(Blocks.COAL_ORE, new ItemStack(Items.COAL), 0.1F);
+ this.registerRecipe(Blocks.REDSTONE_ORE, new ItemStack(Items.REDSTONE), 0.7F);
+ this.registerRecipe(Blocks.LAPIS_ORE, new ItemStack(Items.INK_SACK, 1, 4), 0.2F);
+ this.registerRecipe(Blocks.QUARTZ_ORE, new ItemStack(Items.QUARTZ), 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 void registerRecipe(Block block, ItemStack itemstack, float f) {
+ this.a(Item.getItemOf(block), itemstack, f);
}
- public ItemStack getResult(int i) {
- return (ItemStack) this.recipes.get(Integer.valueOf(i));
+ public void a(Item item, ItemStack itemstack, float f) {
+ this.a(new ItemStack(item, 1, 32767), itemstack, f);
+ }
+
+ public void a(ItemStack itemstack, ItemStack itemstack1, float f) {
+ this.recipes.put(itemstack, itemstack1);
+ this.c.put(itemstack1, Float.valueOf(f));
+ }
+
+ public ItemStack getResult(ItemStack itemstack) {
+ Iterator iterator = this.recipes.entrySet().iterator();
+
+ Entry entry;
+
+ do {
+ if (!iterator.hasNext()) {
+ return null;
+ }
+
+ entry = (Entry) iterator.next();
+ } while (!this.a(itemstack, (ItemStack) entry.getKey()));
+
+ return (ItemStack) entry.getValue();
+ }
+
+ private boolean a(ItemStack itemstack, ItemStack itemstack1) {
+ return itemstack1.getItem() == itemstack.getItem() && (itemstack1.getData() == 32767 || itemstack1.getData() == itemstack.getData());
}
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;
+ public float b(ItemStack itemstack) {
+ Iterator iterator = this.c.entrySet().iterator();
+
+ Entry entry;
+
+ do {
+ if (!iterator.hasNext()) {
+ return 0.0F;
+ }
+
+ entry = (Entry) iterator.next();
+ } while (!this.a(itemstack, (ItemStack) entry.getKey()));
+
+ return ((Float) entry.getValue()).floatValue();
}
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index e9cb09f9f6..a771a64089 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -244,7 +244,7 @@ public class RegionFile {
}
}
- this.b(i, j, (int) (MinecraftServer.aq() / 1000L));
+ this.b(i, j, (int) (MinecraftServer.ap() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
}
diff --git a/src/main/java/net/minecraft/server/RemoteControlCommandListener.java b/src/main/java/net/minecraft/server/RemoteControlCommandListener.java
new file mode 100644
index 0000000000..fd967c12ab
--- /dev/null
+++ b/src/main/java/net/minecraft/server/RemoteControlCommandListener.java
@@ -0,0 +1,47 @@
+package net.minecraft.server;
+
+public class RemoteControlCommandListener implements ICommandListener {
+
+ public static final RemoteControlCommandListener instance = new RemoteControlCommandListener();
+ private StringBuffer b = new StringBuffer();
+
+ public RemoteControlCommandListener() {}
+
+ public void e() {
+ this.b.setLength(0);
+ }
+
+ public String f() {
+ return this.b.toString();
+ }
+
+ public String getName() {
+ return "Rcon";
+ }
+
+ public IChatBaseComponent getScoreboardDisplayName() {
+ return new ChatComponentText(this.getName());
+ }
+
+ // CraftBukkit start - Send a String
+ public void sendMessage(String message) {
+ this.b.append(message);
+ }
+ // CraftBukkit end
+
+ public void sendMessage(IChatBaseComponent ichatbasecomponent) {
+ this.b.append(ichatbasecomponent.c());
+ }
+
+ public boolean a(int i, String s) {
+ return true;
+ }
+
+ public ChunkCoordinates getChunkCoordinates() {
+ return new ChunkCoordinates(0, 0, 0);
+ }
+
+ public World getWorld() {
+ return MinecraftServer.getServer().getWorld();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ScoreboardServer.java b/src/main/java/net/minecraft/server/ScoreboardServer.java
index 863b4db104..15910585ef 100644
--- a/src/main/java/net/minecraft/server/ScoreboardServer.java
+++ b/src/main/java/net/minecraft/server/ScoreboardServer.java
@@ -11,7 +11,7 @@ public class ScoreboardServer extends Scoreboard {
private final MinecraftServer a;
private final Set b = new HashSet();
- private ScoreboardSaveData c;
+ private PersistentScoreboard c;
public ScoreboardServer(MinecraftServer minecraftserver) {
this.a = minecraftserver;
@@ -20,7 +20,7 @@ public class ScoreboardServer extends Scoreboard {
public void handleScoreChanged(ScoreboardScore scoreboardscore) {
super.handleScoreChanged(scoreboardscore);
if (this.b.contains(scoreboardscore.getObjective())) {
- this.sendAll(new Packet207SetScoreboardScore(scoreboardscore, 0)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardScore(scoreboardscore, 0)); // CraftBukkit - Internal packet method
}
this.b();
@@ -28,7 +28,7 @@ public class ScoreboardServer extends Scoreboard {
public void handlePlayerRemoved(String s) {
super.handlePlayerRemoved(s);
- this.sendAll(new Packet207SetScoreboardScore(s)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardScore(s)); // CraftBukkit - Internal packet method
this.b();
}
@@ -38,7 +38,7 @@ public class ScoreboardServer extends Scoreboard {
super.setDisplaySlot(i, scoreboardobjective);
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
if (this.h(scoreboardobjective1) > 0) {
- this.sendAll(new Packet208SetScoreboardDisplayObjective(i, scoreboardobjective)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); // CraftBukkit - Internal packet method
} else {
this.g(scoreboardobjective1);
}
@@ -46,7 +46,7 @@ public class ScoreboardServer extends Scoreboard {
if (scoreboardobjective != null) {
if (this.b.contains(scoreboardobjective)) {
- this.sendAll(new Packet208SetScoreboardDisplayObjective(i, scoreboardobjective)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); // CraftBukkit - Internal packet method
} else {
this.e(scoreboardobjective);
}
@@ -55,15 +55,21 @@ public class ScoreboardServer extends Scoreboard {
this.b();
}
- public void addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
- super.addPlayerToTeam(s, scoreboardteam);
- this.sendAll(new Packet209SetScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 3)); // CraftBukkit - Internal packet method
- this.b();
+ public boolean addPlayerToTeam(String s, String s1) {
+ if (super.addPlayerToTeam(s, s1)) {
+ ScoreboardTeam scoreboardteam = this.getTeam(s1);
+
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 3)); // CraftBukkit - Internal packet method
+ this.b();
+ return true;
+ } else {
+ return false;
+ }
}
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
super.removePlayerFromTeam(s, scoreboardteam);
- this.sendAll(new Packet209SetScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 4)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 4)); // CraftBukkit - Internal packet method
this.b();
}
@@ -75,7 +81,7 @@ public class ScoreboardServer extends Scoreboard {
public void handleObjectiveChanged(ScoreboardObjective scoreboardobjective) {
super.handleObjectiveChanged(scoreboardobjective);
if (this.b.contains(scoreboardobjective)) {
- this.sendAll(new Packet206SetScoreboardObjective(scoreboardobjective, 2)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2)); // CraftBukkit - Internal packet method
}
this.b();
@@ -92,24 +98,24 @@ public class ScoreboardServer extends Scoreboard {
public void handleTeamAdded(ScoreboardTeam scoreboardteam) {
super.handleTeamAdded(scoreboardteam);
- this.sendAll(new Packet209SetScoreboardTeam(scoreboardteam, 0)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0)); // CraftBukkit - Internal packet method
this.b();
}
public void handleTeamChanged(ScoreboardTeam scoreboardteam) {
super.handleTeamChanged(scoreboardteam);
- this.sendAll(new Packet209SetScoreboardTeam(scoreboardteam, 2)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2)); // CraftBukkit - Internal packet method
this.b();
}
public void handleTeamRemoved(ScoreboardTeam scoreboardteam) {
super.handleTeamRemoved(scoreboardteam);
- this.sendAll(new Packet209SetScoreboardTeam(scoreboardteam, 1)); // CraftBukkit - Internal packet method
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1)); // CraftBukkit - Internal packet method
this.b();
}
- public void a(ScoreboardSaveData scoreboardsavedata) {
- this.c = scoreboardsavedata;
+ public void a(PersistentScoreboard persistentscoreboard) {
+ this.c = persistentscoreboard;
}
protected void b() {
@@ -121,11 +127,11 @@ public class ScoreboardServer extends Scoreboard {
public List getScoreboardScorePacketsForObjective(ScoreboardObjective scoreboardobjective) {
ArrayList arraylist = new ArrayList();
- arraylist.add(new Packet206SetScoreboardObjective(scoreboardobjective, 0));
+ arraylist.add(new PacketPlayOutScoreboardObjective(scoreboardobjective, 0));
for (int i = 0; i < 3; ++i) {
if (this.getObjectiveForSlot(i) == scoreboardobjective) {
- arraylist.add(new Packet208SetScoreboardDisplayObjective(i, scoreboardobjective));
+ arraylist.add(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
}
}
@@ -134,7 +140,7 @@ public class ScoreboardServer extends Scoreboard {
while (iterator.hasNext()) {
ScoreboardScore scoreboardscore = (ScoreboardScore) iterator.next();
- arraylist.add(new Packet207SetScoreboardScore(scoreboardscore, 0));
+ arraylist.add(new PacketPlayOutScoreboardScore(scoreboardscore, 0));
}
return arraylist;
@@ -162,11 +168,11 @@ public class ScoreboardServer extends Scoreboard {
public List f(ScoreboardObjective scoreboardobjective) {
ArrayList arraylist = new ArrayList();
- arraylist.add(new Packet206SetScoreboardObjective(scoreboardobjective, 1));
+ arraylist.add(new PacketPlayOutScoreboardObjective(scoreboardobjective, 1));
for (int i = 0; i < 3; ++i) {
if (this.getObjectiveForSlot(i) == scoreboardobjective) {
- arraylist.add(new Packet208SetScoreboardDisplayObjective(i, scoreboardobjective));
+ arraylist.add(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
}
}
diff --git a/src/main/java/net/minecraft/server/SecondaryWorldServer.java b/src/main/java/net/minecraft/server/SecondaryWorldServer.java
index 94a2f05d21..5236f81e98 100644
--- a/src/main/java/net/minecraft/server/SecondaryWorldServer.java
+++ b/src/main/java/net/minecraft/server/SecondaryWorldServer.java
@@ -1,9 +1,9 @@
package net.minecraft.server;
public class SecondaryWorldServer extends WorldServer {
- // CraftBukkit start - Changed signature
- public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, WorldServer worldserver, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(minecraftserver, idatamanager, s, i, worldsettings, methodprofiler, iconsolelogmanager, env, gen);
+ // CraftBukkit start - Add Environment and ChunkGenerator arguments
+ 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.scoreboard = worldserver.getScoreboard();
diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java
index 8f4246b00b..cc444db888 100644
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
@@ -11,11 +11,9 @@ public class ShapedRecipes implements IRecipe {
private int height;
private ItemStack[] items;
private ItemStack result;
- public final int a;
- private boolean f;
+ private boolean e;
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
- this.a = itemstack.id;
this.width = i;
this.height = j;
this.items = aitemstack;
@@ -70,7 +68,7 @@ public class ShapedRecipes implements IRecipe {
char c = 'a';
for (ItemStack stack : this.items) {
if (stack != null) {
- recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
+ recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
}
c++;
}
@@ -120,7 +118,7 @@ public class ShapedRecipes implements IRecipe {
return false;
}
- if (itemstack.id != itemstack1.id) {
+ if (itemstack.getItem() != itemstack1.getItem()) {
return false;
}
@@ -137,7 +135,7 @@ public class ShapedRecipes implements IRecipe {
public ItemStack a(InventoryCrafting inventorycrafting) {
ItemStack itemstack = this.b().cloneItemStack();
- if (this.f) {
+ if (this.e) {
for (int i = 0; i < inventorycrafting.getSize(); ++i) {
ItemStack itemstack1 = inventorycrafting.getItem(i);
@@ -155,7 +153,7 @@ public class ShapedRecipes implements IRecipe {
}
public ShapedRecipes c() {
- this.f = true;
+ this.e = true;
return this;
}
}
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
index fbdad80798..0fab83c6c2 100644
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
@@ -26,7 +26,7 @@ public class ShapelessRecipes implements IRecipe {
CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
for (ItemStack stack : (List) this.ingredients) {
if (stack != null) {
- recipe.addIngredient(org.bukkit.Material.getMaterial(stack.id), stack.getData());
+ recipe.addIngredient(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
}
}
return recipe;
@@ -51,7 +51,7 @@ public class ShapelessRecipes implements IRecipe {
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
- if (itemstack.id == itemstack1.id && (itemstack1.getData() == 32767 || itemstack.getData() == itemstack1.getData())) {
+ if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getData() == 32767 || itemstack.getData() == itemstack1.getData())) {
flag = true;
arraylist.remove(itemstack1);
break;
diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java
index 48d13e4298..2371c24377 100644
--- a/src/main/java/net/minecraft/server/Slot.java
+++ b/src/main/java/net/minecraft/server/Slot.java
@@ -4,7 +4,7 @@ public class Slot {
public final int index; // CraftBukkit - private -> public
public final IInventory inventory;
- public int g;
+ public int rawSlotIndex;
public int h;
public int i;
@@ -17,7 +17,7 @@ public class Slot {
public void a(ItemStack itemstack, ItemStack itemstack1) {
if (itemstack != null && itemstack1 != null) {
- if (itemstack.id == itemstack1.id) {
+ if (itemstack.getItem() == itemstack1.getItem()) {
int i = itemstack1.count - itemstack.count;
if (i > 0) {
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
index e0eaec94cf..8c177583b9 100644
--- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
@@ -41,7 +41,7 @@ public class SlotFurnaceResult extends Slot {
itemstack.a(this.a.world, this.a, this.b);
if (!this.a.world.isStatic) {
int i = this.b;
- float f = RecipesFurnace.getInstance().c(itemstack.id);
+ float f = RecipesFurnace.getInstance().b(itemstack);
int j;
if (f == 0.0F) {
@@ -60,7 +60,7 @@ public class SlotFurnaceResult extends Slot {
TileEntityFurnace furnace = ((TileEntityFurnace) this.inventory);
org.bukkit.block.Block block = a.world.getWorld().getBlockAt(furnace.x, furnace.y, furnace.z);
- FurnaceExtractEvent event = new FurnaceExtractEvent(player, block, org.bukkit.Material.getMaterial(itemstack.id), itemstack.count, i);
+ FurnaceExtractEvent event = new FurnaceExtractEvent(player, block, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(itemstack.getItem()), itemstack.count, i);
a.world.getServer().getPluginManager().callEvent(event);
i = event.getExpToDrop();
@@ -74,11 +74,11 @@ public class SlotFurnaceResult extends Slot {
}
this.b = 0;
- if (itemstack.id == Item.IRON_INGOT.id) {
+ if (itemstack.getItem() == Items.IRON_INGOT) {
this.a.a((Statistic) AchievementList.k, 1);
}
- if (itemstack.id == Item.COOKED_FISH.id) {
+ if (itemstack.getItem() == Items.COOKED_FISH) {
this.a.a((Statistic) AchievementList.p, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 9812538207..f514b78979 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -22,7 +22,7 @@ public final class SpawnerCreature {
Chunk chunk = world.getChunkAt(i, j);
int k = i * 16 + world.random.nextInt(16);
int l = j * 16 + world.random.nextInt(16);
- int i1 = world.random.nextInt(chunk == null ? world.S() : chunk.h() + 16 - 1);
+ int i1 = world.random.nextInt(chunk == null ? world.R() : chunk.h() + 16 - 1);
return new ChunkPosition(k, i1, l);
}
@@ -106,7 +106,7 @@ public final class SpawnerCreature {
int l1 = chunkposition.y;
int i2 = chunkposition.z;
- if (!worldserver.u(k1, l1, i2) && worldserver.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
+ if (!worldserver.getType(k1, l1, i2).r() && worldserver.getType(k1, l1, i2).getMaterial() == enumcreaturetype.c()) {
int j2 = 0;
int k2 = 0;
@@ -160,7 +160,7 @@ public final class SpawnerCreature {
groupdataentity = entityinsentient.a(groupdataentity);
worldserver.addEntity(entityinsentient, SpawnReason.NATURAL);
// CraftBukkit end
- if (j2 >= entityinsentient.bv()) {
+ if (j2 >= entityinsentient.bz()) {
continue label110;
}
}
@@ -191,13 +191,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.getMaterial(i, j - 1, k).isLiquid() && !world.u(i, j + 1, k);
- } else if (!world.w(i, j - 1, k)) {
+ return world.getType(i, j, k).getMaterial().isLiquid() && world.getType(i, j - 1, k).getMaterial().isLiquid() && !world.getType(i, j + 1, k).r();
+ } else if (!World.a((IBlockAccess) world, i, j - 1, k)) {
return false;
} else {
- int l = world.getTypeId(i, j - 1, k);
+ Block block = world.getType(i, j - 1, k);
- return l != Block.BEDROCK.id && !world.u(i, j, k) && !world.getMaterial(i, j, k).isLiquid() && !world.u(i, j + 1, k);
+ return block != Blocks.BEDROCK && !world.getType(i, j, k).r() && !world.getType(i, j, k).getMaterial().isLiquid() && !world.getType(i, j + 1, k).r();
}
}
@@ -205,7 +205,7 @@ public final class SpawnerCreature {
List list = biomebase.getMobs(EnumCreatureType.CREATURE);
if (!list.isEmpty()) {
- while (random.nextFloat() < biomebase.f()) {
+ while (random.nextFloat() < biomebase.g()) {
BiomeMeta biomemeta = (BiomeMeta) WeightedRandom.a(world.random, (Collection) list);
GroupDataEntity groupdataentity = null;
int i1 = biomemeta.c + random.nextInt(1 + biomemeta.d - biomemeta.c);
diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java
index 489e184601..1826d2a35d 100644
--- a/src/main/java/net/minecraft/server/ThreadCommandReader.java
+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java
@@ -10,7 +10,8 @@ class ThreadCommandReader extends Thread {
final DedicatedServer server;
- ThreadCommandReader(DedicatedServer dedicatedserver) {
+ ThreadCommandReader(DedicatedServer dedicatedserver, String s) {
+ super(s);
this.server = dedicatedserver;
}
@@ -38,8 +39,7 @@ class ThreadCommandReader extends Thread {
// CraftBukkit end
}
} catch (IOException ioexception) {
- // CraftBukkit
- java.util.logging.Logger.getLogger("").log(java.util.logging.Level.SEVERE, null, ioexception);
+ DedicatedServer.az().error("Exception handling console input", ioexception);
}
}
}
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
deleted file mode 100644
index 2ce2e3af33..0000000000
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package net.minecraft.server;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.math.BigInteger;
-import java.net.URL;
-import java.net.URLEncoder;
-
-// CraftBukkit start
-import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.craftbukkit.util.Waitable;
-import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
-import org.bukkit.event.player.PlayerPreLoginEvent;
-// CraftBukkit end
-
-class ThreadLoginVerifier extends Thread {
-
- final PendingConnection pendingConnection;
-
- // CraftBukkit start
- CraftServer server;
-
- ThreadLoginVerifier(PendingConnection pendingconnection, CraftServer server) {
- this.server = server;
- // CraftBukkit end
- this.pendingConnection = pendingconnection;
- }
-
- public void run() {
- try {
- String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).H().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16);
- URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openConnection(PendingConnection.b(this.pendingConnection).ap()).getInputStream()));
- String s1 = bufferedreader.readLine();
-
- bufferedreader.close();
- if (!"YES".equals(s1)) {
- this.pendingConnection.disconnect("Failed to verify username!");
- return;
- }
-
- // CraftBukkit start
- if (this.pendingConnection.getSocket() == null) {
- return;
- }
-
- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress());
- this.server.getPluginManager().callEvent(asyncEvent);
-
- if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
- final PlayerPreLoginEvent event = new PlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress());
- if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
- event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
- }
- Waitable waitable = new Waitable() {
- @Override
- protected PlayerPreLoginEvent.Result evaluate() {
- ThreadLoginVerifier.this.server.getPluginManager().callEvent(event);
- return event.getResult();
- }};
-
- PendingConnection.b(this.pendingConnection).processQueue.add(waitable);
- if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
- this.pendingConnection.disconnect(event.getKickMessage());
- return;
- }
- } else {
- if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
- this.pendingConnection.disconnect(asyncEvent.getKickMessage());
- return;
- }
- }
- // CraftBukkit end
-
- PendingConnection.a(this.pendingConnection, true);
- // CraftBukkit start
- } catch (java.io.IOException exception) {
- this.pendingConnection.disconnect("Failed to verify username, session authentication server unavailable!");
- } catch (Exception exception) {
- this.pendingConnection.disconnect("Failed to verify username!");
- server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + PendingConnection.d(this.pendingConnection), exception);
- // CraftBukkit end
- }
- }
-}
diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
new file mode 100644
index 0000000000..cc96775888
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
@@ -0,0 +1,82 @@
+package net.minecraft.server;
+
+import java.math.BigInteger;
+
+import net.minecraft.util.com.mojang.authlib.GameProfile;
+import net.minecraft.util.com.mojang.authlib.exceptions.AuthenticationUnavailableException;
+
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.Waitable;
+import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
+import org.bukkit.event.player.PlayerPreLoginEvent;
+// CraftBukkit end
+
+class ThreadPlayerLookupUUID extends Thread {
+
+ final LoginListener a;
+
+ ThreadPlayerLookupUUID(LoginListener loginlistener, String s) {
+ super(s);
+ this.a = loginlistener;
+ }
+
+ public void run() {
+ try {
+ String s = (new BigInteger(MinecraftEncryption.a(LoginListener.a(this.a), LoginListener.b(this.a).I().getPublic(), LoginListener.c(this.a)))).toString(16);
+
+ LoginListener.a(this.a, LoginListener.b(this.a).as().hasJoinedServer(new GameProfile((String) null, LoginListener.d(this.a).getName()), s));
+ if (LoginListener.d(this.a) != null) {
+ // CraftBukkit start
+ if (!this.a.networkManager.d()) {
+ return;
+ }
+
+ String playerName = LoginListener.d(this.a).getName();
+ java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress();
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.b(this.a).server;
+
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address);
+ server.getPluginManager().callEvent(asyncEvent);
+
+ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
+ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address);
+ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
+ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
+ }
+ Waitable waitable = new Waitable() {
+ @Override
+ protected PlayerPreLoginEvent.Result evaluate() {
+ server.getPluginManager().callEvent(event);
+ return event.getResult();
+ }};
+
+ LoginListener.b(this.a).processQueue.add(waitable);
+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
+ this.a.disconnect(event.getKickMessage());
+ return;
+ }
+ } else {
+ if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
+ this.a.disconnect(asyncEvent.getKickMessage());
+ return;
+ }
+ }
+ // CraftBukkit end
+
+ LoginListener.e().info("UUID of player " + LoginListener.d(this.a).getName() + " is " + LoginListener.d(this.a).getId());
+ LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT);
+ } else {
+ this.a.disconnect("Failed to verify username!");
+ LoginListener.e().error("Username \'" + LoginListener.d(this.a).getName() + "\' tried to join with an invalid session");
+ }
+ } catch (AuthenticationUnavailableException authenticationunavailableexception) {
+ this.a.disconnect("Authentication servers are down. Please try again later, sorry!");
+ LoginListener.e().error("Couldn\'t verify username because servers are unavailable");
+ // CraftBukkit start
+ } catch (Exception exception) {
+ this.a.disconnect("Failed to verify username!");
+ LoginListener.b(this.a).server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + LoginListener.d(this.a).getName(), exception);
+ // CraftBukkit end
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index f4be980b08..811f1a45f2 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -4,28 +4,32 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public class TileEntity {
- private static Map a = new HashMap();
- private static Map b = new HashMap();
+ private static final Logger a = LogManager.getLogger();
+ private static Map i = new HashMap();
+ private static Map j = new HashMap();
protected World world;
public int x;
public int y;
public int z;
- protected boolean o;
- public int p = -1;
- public Block q;
+ protected boolean f;
+ public int g = -1;
+ public Block h;
public TileEntity() {}
private static void a(Class oclass, String s) {
- if (a.containsKey(s)) {
+ if (i.containsKey(s)) {
throw new IllegalArgumentException("Duplicate id: " + s);
} else {
- a.put(s, oclass);
- b.put(oclass, s);
+ i.put(s, oclass);
+ j.put(oclass, s);
}
}
@@ -33,7 +37,7 @@ public class TileEntity {
return this.world;
}
- public void b(World world) {
+ public void a(World world) {
this.world = world;
}
@@ -48,7 +52,7 @@ public class TileEntity {
}
public void b(NBTTagCompound nbttagcompound) {
- String s = (String) b.get(this.getClass());
+ String s = (String) j.get(this.getClass());
if (s == null) {
throw new RuntimeException(this.getClass() + " is missing a mapping! This is a bug!");
@@ -66,7 +70,7 @@ public class TileEntity {
TileEntity tileentity = null;
try {
- Class oclass = (Class) a.get(nbttagcompound.getString("id"));
+ Class oclass = (Class) i.get(nbttagcompound.getString("id"));
if (oclass != null) {
tileentity = (TileEntity) oclass.newInstance();
@@ -78,36 +82,36 @@ public class TileEntity {
if (tileentity != null) {
tileentity.a(nbttagcompound);
} else {
- MinecraftServer.getServer().getLogger().warning("Skipping TileEntity with id " + nbttagcompound.getString("id"));
+ a.warn("Skipping BlockEntity with id " + nbttagcompound.getString("id"));
}
return tileentity;
}
public int p() {
- if (this.p == -1) {
- this.p = this.world.getData(this.x, this.y, this.z);
+ if (this.g == -1) {
+ this.g = this.world.getData(this.x, this.y, this.z);
}
- return this.p;
+ return this.g;
}
public void update() {
if (this.world != null) {
- this.p = this.world.getData(this.x, this.y, this.z);
+ this.g = this.world.getData(this.x, this.y, this.z);
this.world.b(this.x, this.y, this.z, this);
- if (this.q() != null) {
- this.world.m(this.x, this.y, this.z, this.q().id);
+ if (this.q() != Blocks.AIR) {
+ this.world.f(this.x, this.y, this.z, this.q());
}
}
}
public Block q() {
- if (this.q == null) {
- this.q = Block.byId[this.world.getTypeId(this.x, this.y, this.z)];
+ if (this.h == null) {
+ this.h = this.world.getType(this.x, this.y, this.z);
}
- return this.q;
+ return this.h;
}
public Packet getUpdatePacket() {
@@ -115,35 +119,35 @@ public class TileEntity {
}
public boolean r() {
- return this.o;
- }
-
- public void w_() {
- this.o = true;
+ return this.f;
}
public void s() {
- this.o = false;
+ this.f = true;
}
- public boolean b(int i, int j) {
+ public void t() {
+ this.f = false;
+ }
+
+ public boolean c(int i, int j) {
return false;
}
- public void i() {
- this.q = null;
- this.p = -1;
+ public void u() {
+ this.h = null;
+ this.g = -1;
}
public void a(CrashReportSystemDetails crashreportsystemdetails) {
crashreportsystemdetails.a("Name", (Callable) (new CrashReportTileEntityName(this)));
- CrashReportSystemDetails.a(crashreportsystemdetails, this.x, this.y, this.z, this.q().id, this.p());
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.x, this.y, this.z, this.q(), this.p());
crashreportsystemdetails.a("Actual block type", (Callable) (new CrashReportTileEntityType(this)));
crashreportsystemdetails.a("Actual block data value", (Callable) (new CrashReportTileEntityData(this)));
}
- static Map t() {
- return b;
+ static Map v() {
+ return j;
}
static {
@@ -166,6 +170,7 @@ public class TileEntity {
a(TileEntityLightDetector.class, "DLDetector");
a(TileEntityHopper.class, "Hopper");
a(TileEntityComparator.class, "Comparator");
+ a(TileEntityFlowerPot.class, "FlowerPot");
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 087b98fe10..cdbcf86d5c 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -11,12 +11,12 @@ import org.bukkit.entity.HumanEntity;
public class TileEntityBeacon extends TileEntity implements IInventory {
public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffectList.FASTER_MOVEMENT, MobEffectList.FASTER_DIG}, { MobEffectList.RESISTANCE, MobEffectList.JUMP}, { MobEffectList.INCREASE_DAMAGE}, { MobEffectList.REGENERATION}};
- private boolean d;
- private int e = -1;
- private int f;
- private int g;
+ private boolean k;
+ private int l = -1;
+ private int m;
+ private int n;
private ItemStack inventorySlot;
- private String i;
+ private String p;
// CraftBukkit start
public List transaction = new java.util.ArrayList();
private int maxStack = MAX_STACK;
@@ -46,17 +46,17 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
public void h() {
if (this.world.getTime() % 80L == 0L) {
- this.v();
- this.u();
+ this.y();
+ this.x();
}
}
- private void u() {
- if (this.d && this.e > 0 && !this.world.isStatic && this.f > 0) {
- double d0 = (double) (this.e * 10 + 10);
+ private void x() {
+ if (this.k && this.l > 0 && !this.world.isStatic && this.m > 0) {
+ double d0 = (double) (this.l * 10 + 10);
byte b0 = 0;
- if (this.e >= 4 && this.f == this.g) {
+ if (this.l >= 4 && this.m == this.n) {
b0 = 1;
}
@@ -70,42 +70,44 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
- entityhuman.addEffect(new MobEffect(this.f, 180, b0, true));
+ entityhuman.addEffect(new MobEffect(this.m, 180, b0, true));
}
- if (this.e >= 4 && this.f != this.g && this.g > 0) {
+ if (this.l >= 4 && this.m != this.n && this.n > 0) {
iterator = list.iterator();
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
- entityhuman.addEffect(new MobEffect(this.g, 180, 0, true));
+ entityhuman.addEffect(new MobEffect(this.n, 180, 0, true));
}
}
}
}
- private void v() {
- if (!this.world.l(this.x, this.y + 1, this.z)) {
- this.d = false;
- this.e = 0;
+ private void y() {
+ int i = this.l;
+
+ if (!this.world.i(this.x, this.y + 1, this.z)) {
+ this.k = false;
+ this.l = 0;
} else {
- this.d = true;
- this.e = 0;
+ this.k = true;
+ this.l = 0;
- for (int i = 1; i <= 4; this.e = i++) {
- int j = this.y - i;
+ for (int j = 1; j <= 4; this.l = j++) {
+ int k = this.y - j;
- if (j < 0) {
+ if (k < 0) {
break;
}
boolean flag = true;
- for (int k = this.x - i; k <= this.x + i && flag; ++k) {
- for (int l = this.z - i; l <= this.z + i; ++l) {
- int i1 = this.world.getTypeId(k, j, l);
+ for (int l = this.x - j; l <= this.x + j && flag; ++l) {
+ for (int i1 = this.z - j; i1 <= this.z + j; ++i1) {
+ Block block = this.world.getType(l, k, i1);
- if (i1 != Block.EMERALD_BLOCK.id && i1 != Block.GOLD_BLOCK.id && i1 != Block.DIAMOND_BLOCK.id && i1 != Block.IRON_BLOCK.id) {
+ if (block != Blocks.EMERALD_BLOCK && block != Blocks.GOLD_BLOCK && block != Blocks.DIAMOND_BLOCK && block != Blocks.IRON_BLOCK) {
flag = false;
break;
}
@@ -117,28 +119,38 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
}
- if (this.e == 0) {
- this.d = false;
+ if (this.l == 0) {
+ this.k = false;
+ }
+ }
+
+ if (!this.world.isStatic && this.l == 4 && i < this.l) {
+ Iterator iterator = this.world.a(EntityHuman.class, AxisAlignedBB.a().a((double) this.x, (double) this.y, (double) this.z, (double) this.x, (double) (this.y - 4), (double) this.z).grow(10.0D, 5.0D, 10.0D)).iterator();
+
+ while (iterator.hasNext()) {
+ EntityHuman entityhuman = (EntityHuman) iterator.next();
+
+ entityhuman.a((Statistic) AchievementList.K);
}
}
}
public int j() {
- return this.f;
+ return this.m;
}
public int k() {
- return this.g;
+ return this.n;
}
public int l() {
- return this.e;
+ return this.l;
}
public void d(int i) {
- this.f = 0;
+ this.m = 0;
- for (int j = 0; j < this.e && j < 3; ++j) {
+ for (int j = 0; j < this.l && j < 3; ++j) {
MobEffectList[] amobeffectlist = a[j];
int k = amobeffectlist.length;
@@ -146,7 +158,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
MobEffectList mobeffectlist = amobeffectlist[l];
if (mobeffectlist.id == i) {
- this.f = i;
+ this.m = i;
return;
}
}
@@ -154,8 +166,8 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
public void e(int i) {
- this.g = 0;
- if (this.e >= 4) {
+ this.n = 0;
+ if (this.l >= 4) {
for (int j = 0; j < 4; ++j) {
MobEffectList[] amobeffectlist = a[j];
int k = amobeffectlist.length;
@@ -164,7 +176,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
MobEffectList mobeffectlist = amobeffectlist[l];
if (mobeffectlist.id == i) {
- this.g = i;
+ this.n = i;
return;
}
}
@@ -176,21 +188,21 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.b(nbttagcompound);
- return new Packet132TileEntityData(this.x, this.y, this.z, 3, nbttagcompound);
+ return new PacketPlayOutTileEntityData(this.x, this.y, this.z, 3, nbttagcompound);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.f = nbttagcompound.getInt("Primary");
- this.g = nbttagcompound.getInt("Secondary");
- this.e = nbttagcompound.getInt("Levels");
+ this.m = nbttagcompound.getInt("Primary");
+ this.n = nbttagcompound.getInt("Secondary");
+ this.l = nbttagcompound.getInt("Levels");
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setInt("Primary", this.f);
- nbttagcompound.setInt("Secondary", this.g);
- nbttagcompound.setInt("Levels", this.e);
+ nbttagcompound.setInt("Primary", this.m);
+ nbttagcompound.setInt("Secondary", this.n);
+ nbttagcompound.setInt("Levels", this.l);
}
public int getSize() {
@@ -210,7 +222,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
return itemstack;
} else {
this.inventorySlot.count -= j;
- return new ItemStack(this.inventorySlot.id, j, this.inventorySlot.getData());
+ return new ItemStack(this.inventorySlot.getItem(), j, this.inventorySlot.getData());
}
} else {
return null;
@@ -234,16 +246,16 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
}
- public String getName() {
- return this.c() ? this.i : "container.beacon";
+ public String getInventoryName() {
+ return this.k_() ? this.p : "container.beacon";
}
- public boolean c() {
- return this.i != null && this.i.length() > 0;
+ public boolean k_() {
+ return this.p != null && this.p.length() > 0;
}
public void a(String s) {
- this.i = s;
+ this.p = s;
}
public int getMaxStackSize() {
@@ -256,9 +268,9 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
- return itemstack.id == Item.EMERALD.id || itemstack.id == Item.DIAMOND.id || itemstack.id == Item.GOLD_INGOT.id || itemstack.id == Item.IRON_INGOT.id;
+ return itemstack.getItem() == Items.EMERALD || itemstack.getItem() == Items.DIAMOND || itemstack.getItem() == Items.GOLD_INGOT || itemstack.getItem() == Items.IRON_INGOT;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
index e98e29bf3a..e3cd41e4b8 100644
--- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
+++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
@@ -11,12 +11,12 @@ import org.bukkit.event.inventory.BrewEvent;
public class TileEntityBrewingStand extends TileEntity implements IWorldInventory {
private static final int[] a = new int[] { 3};
- private static final int[] b = new int[] { 0, 1, 2};
+ private static final int[] i = new int[] { 0, 1, 2};
public ItemStack[] items = new ItemStack[4]; // CraftBukkit - private -> public
public int brewTime; // CraftBukkit - private -> public
- private int e;
- private int f;
- private String g;
+ private int l;
+ private Item m;
+ private String n;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit
public TileEntityBrewingStand() {}
@@ -46,16 +46,16 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
// CraftBukkit end
- public String getName() {
- return this.c() ? this.g : "container.brewing";
+ public String getInventoryName() {
+ return this.k_() ? this.n : "container.brewing";
}
- public boolean c() {
- return this.g != null && this.g.length() > 0;
+ public boolean k_() {
+ return this.n != null && this.n.length() > 0;
}
public void a(String s) {
- this.g = s;
+ this.n = s;
}
public int getSize() {
@@ -71,55 +71,55 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
this.brewTime -= elapsedTicks;
if (this.brewTime <= 0) { // == -> <=
// CraftBukkit end
- this.u();
+ this.l();
this.update();
- } else if (!this.l()) {
+ } else if (!this.k()) {
this.brewTime = 0;
this.update();
- } else if (this.f != this.items[3].id) {
+ } else if (this.m != this.items[3].getItem()) {
this.brewTime = 0;
this.update();
}
- } else if (this.l()) {
+ } else if (this.k()) {
this.brewTime = 400;
- this.f = this.items[3].id;
+ this.m = this.items[3].getItem();
}
int i = this.j();
- if (i != this.e) {
- this.e = i;
+ if (i != this.l) {
+ this.l = i;
this.world.setData(this.x, this.y, this.z, i, 2);
}
super.h();
}
- public int x_() {
+ public int i() {
return this.brewTime;
}
- private boolean l() {
+ private boolean k() {
if (this.items[3] != null && this.items[3].count > 0) {
ItemStack itemstack = this.items[3];
- if (!Item.byId[itemstack.id].x()) {
+ if (!itemstack.getItem().m(itemstack)) {
return false;
} else {
boolean flag = false;
for (int i = 0; i < 3; ++i) {
- if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
+ if (this.items[i] != null && this.items[i].getItem() == Items.POTION) {
int j = this.items[i].getData();
int k = this.c(j, itemstack);
- if (!ItemPotion.f(j) && ItemPotion.f(k)) {
+ if (!ItemPotion.g(j) && ItemPotion.g(k)) {
flag = true;
break;
}
- List list = Item.POTION.c(j);
- List list1 = Item.POTION.c(k);
+ List list = Items.POTION.c(j);
+ List list1 = Items.POTION.c(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
flag = true;
@@ -135,8 +135,8 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
}
- private void u() {
- if (this.l()) {
+ private void l() {
+ if (this.k()) {
ItemStack itemstack = this.items[3];
// CraftBukkit start
@@ -150,24 +150,24 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
// CraftBukkit end
for (int i = 0; i < 3; ++i) {
- if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
+ if (this.items[i] != null && this.items[i].getItem() == Items.POTION) {
int j = this.items[i].getData();
int k = this.c(j, itemstack);
- List list = Item.POTION.c(j);
- List list1 = Item.POTION.c(k);
+ List list = Items.POTION.c(j);
+ List list1 = Items.POTION.c(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
if (j != k) {
this.items[i].setData(k);
}
- } else if (!ItemPotion.f(j) && ItemPotion.f(k)) {
+ } else if (!ItemPotion.g(j) && ItemPotion.g(k)) {
this.items[i].setData(k);
}
}
}
- if (Item.byId[itemstack.id].u()) {
- this.items[3] = new ItemStack(Item.byId[itemstack.id].t());
+ if (itemstack.getItem().u()) {
+ this.items[3] = new ItemStack(itemstack.getItem().t());
} else {
--this.items[3].count;
if (this.items[3].count <= 0) {
@@ -178,17 +178,17 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
private int c(int i, ItemStack itemstack) {
- return itemstack == null ? i : (Item.byId[itemstack.id].x() ? PotionBrewer.a(i, Item.byId[itemstack.id].w()) : i);
+ return itemstack == null ? i : (itemstack.getItem().m(itemstack) ? PotionBrewer.a(i, itemstack.getItem().i(itemstack)) : i);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
+ NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.items.length) {
@@ -197,8 +197,8 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
this.brewTime = nbttagcompound.getShort("BrewTime");
- if (nbttagcompound.hasKey("CustomName")) {
- this.g = nbttagcompound.getString("CustomName");
+ if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
+ this.n = nbttagcompound.getString("CustomName");
}
}
@@ -218,8 +218,8 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
nbttagcompound.set("Items", nbttaglist);
- if (this.c()) {
- nbttagcompound.setString("CustomName", this.g);
+ if (this.k_()) {
+ nbttagcompound.setString("CustomName", this.n);
}
}
@@ -265,10 +265,10 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
- return i == 3 ? Item.byId[itemstack.id].x() : itemstack.id == Item.POTION.id || itemstack.id == Item.GLASS_BOTTLE.id;
+ return i == 3 ? itemstack.getItem().m(itemstack) : itemstack.getItem() == Items.POTION || itemstack.getItem() == Items.GLASS_BOTTLE;
}
public int j() {
@@ -284,7 +284,7 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
public int[] getSlotsForFace(int i) {
- return i == 1 ? a : b;
+ return i == 1 ? a : TileEntityBrewingStand.i; // CraftBukkit - decompilation error
}
public boolean canPlaceItemThroughFace(int i, ItemStack itemstack, int j) {
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 782913f989..51336f7b39 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -12,13 +12,13 @@ public class TileEntityChest extends TileEntity implements IInventory {
private ItemStack[] items = new ItemStack[27]; // CraftBukkit - 36 -> 27
public boolean a;
- public TileEntityChest b;
- public TileEntityChest c;
- public TileEntityChest d;
- public TileEntityChest e;
- public float f;
- public float g;
- public int h;
+ public TileEntityChest i;
+ public TileEntityChest j;
+ public TileEntityChest k;
+ public TileEntityChest l;
+ public float m;
+ public float n;
+ public int o;
private int ticks;
private int r = -1;
private String s;
@@ -101,11 +101,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
this.update();
}
- public String getName() {
- return this.c() ? this.s : "container.chest";
+ public String getInventoryName() {
+ return this.k_() ? this.s : "container.chest";
}
- public boolean c() {
+ public boolean k_() {
return this.s != null && this.s.length() > 0;
}
@@ -115,15 +115,15 @@ public class TileEntityChest extends TileEntity implements IInventory {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
+ NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
this.items = new ItemStack[this.getSize()];
- if (nbttagcompound.hasKey("CustomName")) {
+ if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
this.s = nbttagcompound.getString("CustomName");
}
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) {
@@ -147,7 +147,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
nbttagcompound.set("Items", nbttaglist);
- if (this.c()) {
+ if (this.k_()) {
nbttagcompound.setString("CustomName", this.s);
}
}
@@ -161,8 +161,8 @@ public class TileEntityChest 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 i() {
- super.i();
+ public void u() {
+ super.u();
this.a = false;
}
@@ -172,87 +172,87 @@ public class TileEntityChest extends TileEntity implements IInventory {
} else if (this.a) {
switch (i) {
case 0:
- if (this.e != tileentitychest) {
+ if (this.l != tileentitychest) {
this.a = false;
}
break;
case 1:
- if (this.d != tileentitychest) {
+ if (this.k != tileentitychest) {
this.a = false;
}
break;
case 2:
- if (this.b != tileentitychest) {
+ if (this.i != tileentitychest) {
this.a = false;
}
break;
case 3:
- if (this.c != tileentitychest) {
+ if (this.j != tileentitychest) {
this.a = false;
}
}
}
}
- public void j() {
+ public void i() {
if (!this.a) {
this.a = true;
- this.b = null;
- this.c = null;
- this.d = null;
- this.e = null;
+ this.i = null;
+ this.j = null;
+ this.k = null;
+ this.l = null;
if (this.a(this.x - 1, this.y, this.z)) {
- this.d = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z);
+ this.k = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z);
}
if (this.a(this.x + 1, this.y, this.z)) {
- this.c = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z);
+ this.j = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z);
}
if (this.a(this.x, this.y, this.z - 1)) {
- this.b = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1);
+ this.i = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1);
}
if (this.a(this.x, this.y, this.z + 1)) {
- this.e = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1);
+ this.l = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1);
}
- if (this.b != null) {
- this.b.a(this, 0);
+ if (this.i != null) {
+ this.i.a(this, 0);
}
- if (this.e != null) {
- this.e.a(this, 2);
+ if (this.l != null) {
+ this.l.a(this, 2);
}
- if (this.c != null) {
- this.c.a(this, 1);
+ if (this.j != null) {
+ this.j.a(this, 1);
}
- if (this.d != null) {
- this.d.a(this, 3);
+ if (this.k != null) {
+ this.k.a(this, 3);
}
}
}
private boolean a(int i, int j, int k) {
- Block block = Block.byId[this.world.getTypeId(i, j, k)];
+ Block block = this.world.getType(i, j, k);
- return block != null && block instanceof BlockChest ? ((BlockChest) block).a == this.l() : false;
+ return block instanceof BlockChest && ((BlockChest) block).a == this.j();
}
public void h() {
super.h();
if (this.world == null) return; // CraftBukkit
- this.j();
+ this.i();
++this.ticks;
float f;
- if (!this.world.isStatic && this.h != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) {
- this.h = 0;
+ if (!this.world.isStatic && this.o != 0 && (this.ticks + this.x + this.y + this.z) % 200 == 0) {
+ this.o = 0;
f = 5.0F;
List list = this.world.a(EntityHuman.class, AxisAlignedBB.a().a((double) ((float) this.x - f), (double) ((float) this.y - f), (double) ((float) this.z - f), (double) ((float) (this.x + 1) + f), (double) ((float) (this.y + 1) + f), (double) ((float) (this.z + 1) + f)));
Iterator iterator = list.iterator();
@@ -264,90 +264,90 @@ public class TileEntityChest extends TileEntity implements IInventory {
IInventory iinventory = ((ContainerChest) entityhuman.activeContainer).e();
if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).a((IInventory) this)) {
- ++this.h;
+ ++this.o;
}
}
}
}
- this.g = this.f;
+ this.n = this.m;
f = 0.1F;
double d0;
- if (this.h > 0 && this.f == 0.0F && this.b == null && this.d == null) {
+ if (this.o > 0 && this.m == 0.0F && this.i == null && this.k == null) {
double d1 = (double) this.x + 0.5D;
d0 = (double) this.z + 0.5D;
- if (this.e != null) {
+ if (this.l != null) {
d0 += 0.5D;
}
- if (this.c != null) {
+ if (this.j != null) {
d1 += 0.5D;
}
this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
}
- if (this.h == 0 && this.f > 0.0F || this.h > 0 && this.f < 1.0F) {
- float f1 = this.f;
+ if (this.o == 0 && this.m > 0.0F || this.o > 0 && this.m < 1.0F) {
+ float f1 = this.m;
- if (this.h > 0) {
- this.f += f;
+ if (this.o > 0) {
+ this.m += f;
} else {
- this.f -= f;
+ this.m -= f;
}
- if (this.f > 1.0F) {
- this.f = 1.0F;
+ if (this.m > 1.0F) {
+ this.m = 1.0F;
}
float f2 = 0.5F;
- if (this.f < f2 && f1 >= f2 && this.b == null && this.d == null) {
+ if (this.m < f2 && f1 >= f2 && this.i == null && this.k == null) {
d0 = (double) this.x + 0.5D;
double d2 = (double) this.z + 0.5D;
- if (this.e != null) {
+ if (this.l != null) {
d2 += 0.5D;
}
- if (this.c != null) {
+ if (this.j != null) {
d0 += 0.5D;
}
this.world.makeSound(d0, (double) this.y + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
}
- if (this.f < 0.0F) {
- this.f = 0.0F;
+ if (this.m < 0.0F) {
+ this.m = 0.0F;
}
}
}
- public boolean b(int i, int j) {
+ public boolean c(int i, int j) {
if (i == 1) {
- this.h = j;
+ this.o = j;
return true;
} else {
- return super.b(i, j);
+ return super.c(i, j);
}
}
public void startOpen() {
- if (this.h < 0) {
- this.h = 0;
+ if (this.o < 0) {
+ this.o = 0;
}
- int oldPower = Math.max(0, Math.min(15, this.h)); // CraftBukkit - Get power before new viewer is added
+ int oldPower = Math.max(0, Math.min(15, this.o)); // CraftBukkit - Get power before new viewer is added
- ++this.h;
+ ++this.o;
if (this.world == null) return; // CraftBukkit
- this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
+ this.world.playNote(this.x, this.y, this.z, this.q(), 1, this.o);
// CraftBukkit start - Call redstone event
- if (this.q().id == Block.TRAPPED_CHEST.id) {
- int newPower = Math.max(0, Math.min(15, this.h));
+ if (this.q() == Blocks.TRAPPED_CHEST) {
+ int newPower = Math.max(0, Math.min(15, this.o));
if (oldPower != newPower) {
org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, this.x, this.y, this.z, oldPower, newPower);
@@ -355,21 +355,21 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
// CraftBukkit end
- this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
- this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
+ this.world.applyPhysics(this.x, this.y, this.z, this.q());
+ this.world.applyPhysics(this.x, this.y - 1, this.z, this.q());
}
- public void g() {
- if (this.q() != null && this.q() instanceof BlockChest) {
- int oldPower = Math.max(0, Math.min(15, this.h)); // CraftBukkit - Get power before new viewer is added
+ public void l_() {
+ if (this.q() instanceof BlockChest) {
+ int oldPower = Math.max(0, Math.min(15, this.o)); // CraftBukkit - Get power before new viewer is added
- --this.h;
+ --this.o;
if (this.world == null) return; // CraftBukkit
- this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
+ this.world.playNote(this.x, this.y, this.z, this.q(), 1, this.o);
// CraftBukkit start - Call redstone event
- if (this.q().id == Block.TRAPPED_CHEST.id) {
- int newPower = Math.max(0, Math.min(15, this.h));
+ if (this.q() == Blocks.TRAPPED_CHEST) {
+ int newPower = Math.max(0, Math.min(15, this.o));
if (oldPower != newPower) {
org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, this.x, this.y, this.z, oldPower, newPower);
@@ -377,8 +377,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
// CraftBukkit end
- this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
- this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
+ this.world.applyPhysics(this.x, this.y, this.z, this.q());
+ this.world.applyPhysics(this.x, this.y - 1, this.z, this.q());
}
}
@@ -386,13 +386,13 @@ public class TileEntityChest extends TileEntity implements IInventory {
return true;
}
- public void w_() {
- super.w_();
+ public void s() {
+ super.s();
+ this.u();
this.i();
- this.j();
}
- public int l() {
+ public int j() {
if (this.r == -1) {
if (this.world == null || !(this.q() instanceof BlockChest)) {
return 0;
diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java
deleted file mode 100644
index e98c080f19..0000000000
--- a/src/main/java/net/minecraft/server/TileEntityCommand.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package net.minecraft.server;
-
-// CraftBukkit start
-import java.util.ArrayList;
-import com.google.common.base.Joiner;
-// CraftBukkit end
-
-public class TileEntityCommand extends TileEntity implements ICommandListener {
-
- private int a;
- public String b = ""; // CraftBukkit - private -> public
- private String c = "@";
- // CraftBukkit start
- private final org.bukkit.command.BlockCommandSender sender;
-
- public TileEntityCommand() {
- sender = new org.bukkit.craftbukkit.command.CraftBlockCommandSender(this);
- }
- // CraftBukkit end
-
- public void a(String s) {
- this.b = s;
- this.update();
- }
-
- public int a(World world) {
- if (world.isStatic) {
- return 0;
- } else {
- MinecraftServer minecraftserver = MinecraftServer.getServer();
-
- if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) {
- // CraftBukkit start - Handle command block commands using Bukkit dispatcher
- org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
- Joiner joiner = Joiner.on(" ");
- String command = this.b;
- if (this.b.startsWith("/")) {
- command = this.b.substring(1);
- }
- String[] args = command.split(" ");
- ArrayList commands = new ArrayList();
-
- // Block disallowed commands
- if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") ||
- args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") ||
- args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) {
- return 0;
- }
-
- // Make sure this is a valid command
- if (commandMap.getCommand(args[0]) == null) {
- return 0;
- }
-
- // If the world has no players don't run
- if (this.world.players.isEmpty()) {
- return 0;
- }
-
- // testfor command requires special handling
- if (args[0].equalsIgnoreCase("testfor")) {
- if (args.length < 2) {
- return 0;
- }
-
- EntityPlayer[] players = PlayerSelector.getPlayers(this, args[1]);
-
- if (players != null && players.length > 0) {
- return players.length;
- } else {
- EntityPlayer player = MinecraftServer.getServer().getPlayerList().getPlayer(args[1]);
- if (player == null) {
- return 0;
- } else {
- return 1;
- }
- }
- }
-
- commands.add(args);
-
- // Find positions of command block syntax, if any
- ArrayList newCommands = new ArrayList();
- for (int i = 0; i < args.length; i++) {
- if (PlayerSelector.isPattern(args[i])) {
- for (int j = 0; j < commands.size(); j++) {
- newCommands.addAll(this.buildCommands(commands.get(j), i));
- }
- ArrayList temp = commands;
- commands = newCommands;
- newCommands = temp;
- newCommands.clear();
- }
- }
-
- int completed = 0;
-
- // Now dispatch all of the commands we ended up with
- for (int i = 0; i < commands.size(); i++) {
- try {
- if (commandMap.dispatch(sender, joiner.join(java.util.Arrays.asList(commands.get(i))))) {
- completed++;
- }
- } catch (Throwable exception) {
- minecraftserver.getLogger().warning(String.format("CommandBlock at (%d,%d,%d) failed to handle command", this.x, this.y, this.z), exception);
- }
- }
-
- return completed;
- // CraftBukkit end
- } else {
- return 0;
- }
- }
- }
-
- // CraftBukkit start
- private ArrayList buildCommands(String[] args, int pos) {
- ArrayList commands = new ArrayList();
- EntityPlayer[] players = PlayerSelector.getPlayers(this, args[pos]);
- if (players != null) {
- for (EntityPlayer player : players) {
- if (player.world != this.world) {
- continue;
- }
- String[] command = args.clone();
- command[pos] = player.getLocalizedName();
- commands.add(command);
- }
- }
-
- return commands;
- }
- // CraftBukkit end
-
- public String getName() {
- return this.c;
- }
-
- public void b(String s) {
- this.c = s;
- }
-
- public void sendMessage(ChatMessage chatmessage) {}
-
- public boolean a(int i, String s) {
- return i <= 2;
- }
-
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- nbttagcompound.setString("Command", this.b);
- nbttagcompound.setInt("SuccessCount", this.a);
- nbttagcompound.setString("CustomName", this.c);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- this.b = nbttagcompound.getString("Command");
- this.a = nbttagcompound.getInt("SuccessCount");
- if (nbttagcompound.hasKey("CustomName")) {
- this.c = nbttagcompound.getString("CustomName");
- }
- }
-
- public ChunkCoordinates b() {
- return new ChunkCoordinates(this.x, this.y, this.z);
- }
-
- public World f_() {
- return this.getWorld();
- }
-
- public Packet getUpdatePacket() {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
-
- this.b(nbttagcompound);
- return new Packet132TileEntityData(this.x, this.y, this.z, 2, nbttagcompound);
- }
-
- public int f() {
- return this.a;
- }
-
- public void a(int i) {
- this.a = i;
- }
-}
diff --git a/src/main/java/net/minecraft/server/TileEntityCommandListener.java b/src/main/java/net/minecraft/server/TileEntityCommandListener.java
new file mode 100644
index 0000000000..8a5f92e3d4
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityCommandListener.java
@@ -0,0 +1,29 @@
+package net.minecraft.server;
+
+// CraftBukkit - package-private -> public
+public class TileEntityCommandListener extends CommandBlockListenerAbstract {
+
+ final TileEntityCommand a;
+
+ TileEntityCommandListener(TileEntityCommand tileentitycommand) {
+ this.a = tileentitycommand;
+ sender = new org.bukkit.craftbukkit.command.CraftBlockCommandSender(this); // CraftBukkit - add sender
+ }
+
+ public ChunkCoordinates getChunkCoordinates() {
+ return new ChunkCoordinates(this.a.x, this.a.y, this.a.z);
+ }
+
+ public World getWorld() {
+ return this.a.getWorld();
+ }
+
+ public void a(String s) {
+ super.a(s);
+ this.a.update();
+ }
+
+ public void e() {
+ this.a.getWorld().notify(this.a.x, this.a.y, this.a.z);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index 347672087f..ab914623d3 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -12,7 +12,7 @@ import org.bukkit.entity.HumanEntity;
public class TileEntityDispenser extends TileEntity implements IInventory {
private ItemStack[] items = new ItemStack[9];
- private Random c = new Random();
+ private Random j = new Random();
protected String a;
// CraftBukkit start
@@ -84,12 +84,12 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
}
- public int j() {
+ public int i() {
int i = -1;
int j = 1;
for (int k = 0; k < this.items.length; ++k) {
- if (this.items[k] != null && this.c.nextInt(j++) == 0) {
+ if (this.items[k] != null && this.j.nextInt(j++) == 0) {
if (this.items[k].count == 0) continue; // CraftBukkit
i = k;
}
@@ -109,7 +109,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
public int addItem(ItemStack itemstack) {
for (int i = 0; i < this.items.length; ++i) {
- if (this.items[i] == null || this.items[i].id == 0) {
+ if (this.items[i] == null || this.items[i].getItem() == null) {
this.setItem(i, itemstack);
return i;
}
@@ -118,26 +118,26 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
return -1;
}
- public String getName() {
- return this.c() ? this.a : "container.dispenser";
+ public String getInventoryName() {
+ return this.k_() ? this.a : "container.dispenser";
}
public void a(String s) {
this.a = s;
}
- public boolean c() {
+ public boolean k_() {
return this.a != null;
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
+ NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) {
@@ -145,7 +145,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
}
- if (nbttagcompound.hasKey("CustomName")) {
+ if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
this.a = nbttagcompound.getString("CustomName");
}
}
@@ -165,7 +165,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
nbttagcompound.set("Items", nbttaglist);
- if (this.c()) {
+ if (this.k_()) {
nbttagcompound.setString("CustomName", this.a);
}
}
@@ -180,7 +180,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index 01293b6099..8fd6407cda 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -12,14 +12,14 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
public class TileEntityFurnace extends TileEntity implements IWorldInventory {
- private static final int[] d = new int[] { 0};
- private static final int[] e = new int[] { 2, 1};
- private static final int[] f = new int[] { 1};
+ private static final int[] k = new int[] { 0};
+ private static final int[] l = new int[] { 2, 1};
+ private static final int[] m = new int[] { 1};
private ItemStack[] items = new ItemStack[3];
public int burnTime;
public int ticksForCurrentFuel;
public int cookTime;
- private String h;
+ private String o;
// CraftBukkit start
private int lastTick = MinecraftServer.currentTick;
@@ -96,26 +96,26 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
}
}
- public String getName() {
- return this.c() ? this.h : "container.furnace";
+ public String getInventoryName() {
+ return this.k_() ? this.o : "container.furnace";
}
- public boolean c() {
- return this.h != null && this.h.length() > 0;
+ public boolean k_() {
+ return this.o != null && this.o.length() > 0;
}
public void a(String s) {
- this.h = s;
+ this.o = s;
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
+ NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.items.length) {
@@ -126,8 +126,8 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
this.burnTime = nbttagcompound.getShort("BurnTime");
this.cookTime = nbttagcompound.getShort("CookTime");
this.ticksForCurrentFuel = fuelTime(this.items[1]);
- if (nbttagcompound.hasKey("CustomName")) {
- this.h = nbttagcompound.getString("CustomName");
+ if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
+ this.o = nbttagcompound.getString("CustomName");
}
}
@@ -148,8 +148,8 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
}
nbttagcompound.set("Items", nbttaglist);
- if (this.c()) {
- nbttagcompound.setString("CustomName", this.h);
+ if (this.k_()) {
+ nbttagcompound.setString("CustomName", this.o);
}
}
@@ -242,7 +242,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
if (this.items[0] == null) {
return false;
} else {
- ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0].getItem().id);
+ ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);
// 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())));
@@ -251,7 +251,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
public void burn() {
if (this.canBurn()) {
- ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0].getItem().id);
+ ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);
// CraftBukkit start
CraftItemStack source = CraftItemStack.asCraftMirror(this.items[0]);
@@ -268,7 +268,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
if (this.items[2] == null) {
this.items[2] = itemstack.cloneItemStack();
- } else if (this.items[2].id == itemstack.id) {
+ } else if (this.items[2].getItem() == itemstack.getItem()) {
// CraftBukkit - compare damage too
if (this.items[2].getData() == itemstack.getData()) {
this.items[2].count += itemstack.count;
@@ -287,26 +287,25 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
if (itemstack == null) {
return 0;
} else {
- int i = itemstack.getItem().id;
Item item = itemstack.getItem();
- if (i < 256 && Block.byId[i] != null) {
- Block block = Block.byId[i];
+ if (item instanceof ItemBlock && Block.a(item) != Blocks.AIR) {
+ Block block = Block.a(item);
- if (block == Block.WOOD_STEP) {
+ if (block == Blocks.WOOD_STEP) {
return 150;
}
- if (block.material == Material.WOOD) {
+ if (block.getMaterial() == Material.WOOD) {
return 300;
}
- if (block == Block.COAL_BLOCK) {
+ if (block == Blocks.COAL_BLOCK) {
return 16000;
}
}
- return item instanceof ItemTool && ((ItemTool) item).g().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword) item).i().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe) item).g().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)))))));
+ return item instanceof ItemTool && ((ItemTool) item).j().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword) item).j().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe) item).i().equals("WOOD") ? 200 : (item == Items.STICK ? 100 : (item == Items.COAL ? 1600 : (item == Items.LAVA_BUCKET ? 20000 : (item == Item.getItemOf(Blocks.SAPLING) ? 100 : (item == Items.BLAZE_ROD ? 2400 : 0)))))));
}
}
@@ -320,14 +319,14 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return i == 2 ? false : (i == 1 ? isFuel(itemstack) : true);
}
public int[] getSlotsForFace(int i) {
- return i == 0 ? e : (i == 1 ? d : f);
+ return i == 0 ? l : (i == 1 ? k : m);
}
public boolean canPlaceItemThroughFace(int i, ItemStack itemstack, int j) {
@@ -335,6 +334,6 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
}
public boolean canTakeItemThroughFace(int i, ItemStack itemstack, int j) {
- return j != 0 || i != 1 || itemstack.id == Item.BUCKET.id;
+ return j != 0 || i != 1 || itemstack.getItem() == Items.BUCKET;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index e8cd5259fe..730eb78c59 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -14,8 +14,8 @@ import org.bukkit.inventory.Inventory;
public class TileEntityHopper extends TileEntity implements IHopper {
private ItemStack[] a = new ItemStack[5];
- private String b;
- private int c = -1;
+ private String i;
+ private int j = -1;
// CraftBukkit start
public List transaction = new java.util.ArrayList();
@@ -46,17 +46,17 @@ public class TileEntityHopper extends TileEntity implements IHopper {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
+ NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);
this.a = new ItemStack[this.getSize()];
- if (nbttagcompound.hasKey("CustomName")) {
- this.b = nbttagcompound.getString("CustomName");
+ if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
+ this.i = nbttagcompound.getString("CustomName");
}
- this.c = nbttagcompound.getInt("TransferCooldown");
+ this.j = nbttagcompound.getInt("TransferCooldown");
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.a.length) {
@@ -80,9 +80,9 @@ public class TileEntityHopper extends TileEntity implements IHopper {
}
nbttagcompound.set("Items", nbttaglist);
- nbttagcompound.setInt("TransferCooldown", this.c);
- if (this.c()) {
- nbttagcompound.setString("CustomName", this.b);
+ nbttagcompound.setInt("TransferCooldown", this.j);
+ if (this.k_()) {
+ nbttagcompound.setString("CustomName", this.i);
}
}
@@ -137,16 +137,16 @@ public class TileEntityHopper extends TileEntity implements IHopper {
}
}
- public String getName() {
- return this.c() ? this.b : "container.hopper";
+ public String getInventoryName() {
+ return this.k_() ? this.i : "container.hopper";
}
- public boolean c() {
- return this.b != null && this.b.length() > 0;
+ public boolean k_() {
+ return this.i != null && this.i.length() > 0;
}
public void a(String s) {
- this.b = s;
+ this.i = s;
}
public int getMaxStackSize() {
@@ -159,7 +159,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
public void startOpen() {}
- public void g() {}
+ public void l_() {}
public boolean b(int i, ItemStack itemstack) {
return true;
@@ -167,18 +167,18 @@ public class TileEntityHopper extends TileEntity implements IHopper {
public void h() {
if (this.world != null && !this.world.isStatic) {
- --this.c;
- if (!this.l()) {
+ --this.j;
+ if (!this.j()) {
this.c(0);
- this.j();
+ this.i();
}
}
}
- public boolean j() {
+ public boolean i() {
if (this.world != null && !this.world.isStatic) {
- if (!this.l() && BlockHopper.d(this.p())) {
- boolean flag = this.u();
+ if (!this.j() && BlockHopper.c(this.p())) {
+ boolean flag = this.k();
flag = suckInItems(this) || flag;
if (flag) {
@@ -194,8 +194,8 @@ public class TileEntityHopper extends TileEntity implements IHopper {
}
}
- private boolean u() {
- IInventory iinventory = this.v();
+ private boolean k() {
+ IInventory iinventory = this.l();
if (iinventory == null) {
return false;
@@ -221,7 +221,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
this.c(8); // Delay hopper checks
return false;
}
- ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.c(this.p())]);
+ ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.b(this.p())]);
if (itemstack1 == null || itemstack1.count == 0) {
if (event.getItem().equals(oitemstack)) {
@@ -266,7 +266,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
}
}
} else {
- EntityItem entityitem = getEntityItemAt(ihopper.getWorld(), ihopper.aA(), ihopper.aB() + 1.0D, ihopper.aC());
+ EntityItem entityitem = getEntityItemAt(ihopper.getWorld(), ihopper.x(), ihopper.aD() + 1.0D, ihopper.aE());
if (entityitem != null) {
return addEntityItem(ihopper, entityitem);
@@ -416,14 +416,14 @@ public class TileEntityHopper extends TileEntity implements IHopper {
return itemstack;
}
- private IInventory v() {
- int i = BlockHopper.c(this.p());
+ private IInventory l() {
+ int i = BlockHopper.b(this.p());
return getInventoryAt(this.getWorld(), (double) (this.x + Facing.b[i]), (double) (this.y + Facing.c[i]), (double) (this.z + Facing.d[i]));
}
public static IInventory getSourceInventory(IHopper ihopper) {
- return getInventoryAt(ihopper.getWorld(), ihopper.aA(), ihopper.aB() + 1.0D, ihopper.aC());
+ return getInventoryAt(ihopper.getWorld(), ihopper.x(), ihopper.aD() + 1.0D, ihopper.aE());
}
public static EntityItem getEntityItemAt(World world, double d0, double d1, double d2) {
@@ -442,11 +442,10 @@ public class TileEntityHopper extends TileEntity implements IHopper {
if (tileentity != null && tileentity instanceof IInventory) {
iinventory = (IInventory) tileentity;
if (iinventory instanceof TileEntityChest) {
- int l = world.getTypeId(i, j, k);
- Block block = Block.byId[l];
+ Block block = world.getType(i, j, k);
if (block instanceof BlockChest) {
- iinventory = ((BlockChest) block).g_(world, i, j, k);
+ iinventory = ((BlockChest) block).m(world, i, j, k);
}
}
}
@@ -463,26 +462,26 @@ public class TileEntityHopper extends TileEntity implements IHopper {
}
private static boolean canMergeItems(ItemStack itemstack, ItemStack itemstack1) {
- return itemstack.id != itemstack1.id ? false : (itemstack.getData() != itemstack1.getData() ? false : (itemstack.count > itemstack.getMaxStackSize() ? false : ItemStack.equals(itemstack, itemstack1)));
+ return itemstack.getItem() != itemstack1.getItem() ? false : (itemstack.getData() != itemstack1.getData() ? false : (itemstack.count > itemstack.getMaxStackSize() ? false : ItemStack.equals(itemstack, itemstack1)));
}
- public double aA() {
+ public double x() {
return (double) this.x;
}
- public double aB() {
+ public double aD() {
return (double) this.y;
}
- public double aC() {
+ public double aE() {
return (double) this.z;
}
public void c(int i) {
- this.c = i;
+ this.j = i;
}
- public boolean l() {
- return this.c > 0;
+ public boolean j() {
+ return this.j > 0;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityNote.java b/src/main/java/net/minecraft/server/TileEntityNote.java
index 46bb08d1ff..b42928628b 100644
--- a/src/main/java/net/minecraft/server/TileEntityNote.java
+++ b/src/main/java/net/minecraft/server/TileEntityNote.java
@@ -3,7 +3,7 @@ package net.minecraft.server;
public class TileEntityNote extends TileEntity {
public byte note;
- public boolean b;
+ public boolean i;
public TileEntityNote() {}
@@ -30,8 +30,8 @@ public class TileEntityNote extends TileEntity {
}
public void play(World world, int i, int j, int k) {
- if (world.getMaterial(i, j + 1, k) == Material.AIR) {
- Material material = world.getMaterial(i, j - 1, k);
+ if (world.getType(i, j + 1, k).getMaterial() == Material.AIR) {
+ Material material = world.getType(i, j - 1, k).getMaterial();
byte b0 = 0;
if (material == Material.STONE) {
@@ -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, Block.NOTE_BLOCK.id, event.getInstrument().getType(), event.getNote().getId());
+ this.world.playNote(i, j, k, Blocks.NOTE_BLOCK, 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 74d9c5d3f6..3e5e8f0857 100644
--- a/src/main/java/net/minecraft/server/TileEntityPiston.java
+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java
@@ -6,39 +6,39 @@ import java.util.List;
public class TileEntityPiston extends TileEntity {
- private int a;
- private int b;
- private int c;
- private boolean d;
- private boolean e;
- private float f;
- private float g;
- private List h = new ArrayList();
+ private Block a;
+ private int i;
+ private int j;
+ private boolean k;
+ private boolean l;
+ private float m;
+ private float n;
+ private List o = new ArrayList();
public TileEntityPiston() {}
- public TileEntityPiston(int i, int j, int k, boolean flag, boolean flag1) {
- this.a = i;
- this.b = j;
- this.c = k;
- this.d = flag;
- this.e = flag1;
+ public TileEntityPiston(Block block, int i, int j, boolean flag, boolean flag1) {
+ this.a = block;
+ this.i = i;
+ this.j = j;
+ this.k = flag;
+ this.l = flag1;
}
- public int a() {
+ public Block a() {
return this.a;
}
public int p() {
- return this.b;
+ return this.i;
}
public boolean b() {
- return this.d;
+ return this.k;
}
public int c() {
- return this.c;
+ return this.j;
}
public float a(float f) {
@@ -46,44 +46,44 @@ public class TileEntityPiston extends TileEntity {
f = 1.0F;
}
- return this.g + (this.f - this.g) * f;
+ return this.n + (this.m - this.n) * f;
}
private void a(float f, float f1) {
- if (this.d) {
+ if (this.k) {
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);
+ AxisAlignedBB axisalignedbb = Blocks.PISTON_MOVING.a(this.world, this.x, this.y, this.z, this.a, f, this.j);
if (axisalignedbb != null) {
List list = this.world.getEntities((Entity) null, axisalignedbb);
if (!list.isEmpty()) {
- this.h.addAll(list);
- Iterator iterator = this.h.iterator();
+ this.o.addAll(list);
+ Iterator iterator = this.o.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- entity.move((double) (f1 * (float) Facing.b[this.c]), (double) (f1 * (float) Facing.c[this.c]), (double) (f1 * (float) Facing.d[this.c]));
+ entity.move((double) (f1 * (float) Facing.b[this.j]), (double) (f1 * (float) Facing.c[this.j]), (double) (f1 * (float) Facing.d[this.j]));
}
- this.h.clear();
+ this.o.clear();
}
}
}
public void f() {
- if (this.g < 1.0F && this.world != null) {
- this.g = this.f = 1.0F;
- this.world.s(this.x, this.y, this.z);
- this.w_();
- if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
- this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b, 3);
- this.world.g(this.x, this.y, this.z, this.a);
+ if (this.n < 1.0F && this.world != null) {
+ this.n = this.m = 1.0F;
+ this.world.p(this.x, this.y, this.z);
+ this.s();
+ if (this.world.getType(this.x, this.y, this.z) == Blocks.PISTON_MOVING) {
+ this.world.setTypeAndData(this.x, this.y, this.z, this.a, this.i, 3);
+ this.world.e(this.x, this.y, this.z, this.a);
}
}
}
@@ -91,42 +91,42 @@ public class TileEntityPiston extends TileEntity {
public void h() {
if (this.world == null) return; // CraftBukkit
- this.g = this.f;
- if (this.g >= 1.0F) {
+ this.n = this.m;
+ if (this.n >= 1.0F) {
this.a(1.0F, 0.25F);
- this.world.s(this.x, this.y, this.z);
- this.w_();
- if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
- this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b, 3);
- this.world.g(this.x, this.y, this.z, this.a);
+ this.world.p(this.x, this.y, this.z);
+ this.s();
+ if (this.world.getType(this.x, this.y, this.z) == Blocks.PISTON_MOVING) {
+ this.world.setTypeAndData(this.x, this.y, this.z, this.a, this.i, 3);
+ this.world.e(this.x, this.y, this.z, this.a);
}
} else {
- this.f += 0.5F;
- if (this.f >= 1.0F) {
- this.f = 1.0F;
+ this.m += 0.5F;
+ if (this.m >= 1.0F) {
+ this.m = 1.0F;
}
- if (this.d) {
- this.a(this.f, this.f - this.g + 0.0625F);
+ if (this.k) {
+ this.a(this.m, this.m - this.n + 0.0625F);
}
}
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.a = nbttagcompound.getInt("blockId");
- this.b = nbttagcompound.getInt("blockData");
- this.c = nbttagcompound.getInt("facing");
- this.g = this.f = nbttagcompound.getFloat("progress");
- this.d = nbttagcompound.getBoolean("extending");
+ this.a = Block.e(nbttagcompound.getInt("blockId"));
+ this.i = nbttagcompound.getInt("blockData");
+ this.j = nbttagcompound.getInt("facing");
+ this.n = this.m = nbttagcompound.getFloat("progress");
+ this.k = nbttagcompound.getBoolean("extending");
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setInt("blockId", this.a);
- nbttagcompound.setInt("blockData", this.b);
- nbttagcompound.setInt("facing", this.c);
- nbttagcompound.setFloat("progress", this.g);
- nbttagcompound.setBoolean("extending", this.d);
+ nbttagcompound.setInt("blockId", Block.b(this.a));
+ nbttagcompound.setInt("blockData", this.i);
+ nbttagcompound.setInt("facing", this.j);
+ nbttagcompound.setFloat("progress", this.n);
+ nbttagcompound.setBoolean("extending", this.k);
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityRecordPlayer.java b/src/main/java/net/minecraft/server/TileEntityRecordPlayer.java
index 48a435ac87..d668b1c0ca 100644
--- a/src/main/java/net/minecraft/server/TileEntityRecordPlayer.java
+++ b/src/main/java/net/minecraft/server/TileEntityRecordPlayer.java
@@ -8,18 +8,18 @@ public class TileEntityRecordPlayer extends TileEntity {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- if (nbttagcompound.hasKey("RecordItem")) {
+ if (nbttagcompound.hasKeyOfType("RecordItem", 10)) {
this.setRecord(ItemStack.createStack(nbttagcompound.getCompound("RecordItem")));
} else if (nbttagcompound.getInt("Record") > 0) {
- this.setRecord(new ItemStack(nbttagcompound.getInt("Record"), 1, 0));
+ this.setRecord(new ItemStack(Item.d(nbttagcompound.getInt("Record")), 1, 0));
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
if (this.getRecord() != null) {
- nbttagcompound.setCompound("RecordItem", this.getRecord().save(new NBTTagCompound()));
- nbttagcompound.setInt("Record", this.getRecord().id);
+ nbttagcompound.set("RecordItem", this.getRecord().save(new NBTTagCompound()));
+ nbttagcompound.setInt("Record", Item.b(this.getRecord().getItem()));
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 98b30fbf8e..c504dbe641 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -3,9 +3,9 @@ package net.minecraft.server;
public class TileEntitySign extends TileEntity {
public String[] lines = new String[] { "", "", "", ""};
- public int b = -1;
+ public int i = -1;
public boolean isEditable = true; // CraftBukkit - private -> public
- private EntityHuman d;
+ private EntityHuman k;
public TileEntitySign() {}
@@ -42,7 +42,7 @@ public class TileEntitySign extends TileEntity {
}
// CraftBukkit end
- return new Packet130UpdateSign(this.x, this.y, this.z, astring);
+ return new PacketPlayOutUpdateSign(this.x, this.y, this.z, astring);
}
public boolean a() {
@@ -50,10 +50,10 @@ public class TileEntitySign extends TileEntity {
}
public void a(EntityHuman entityhuman) {
- this.d = entityhuman;
+ this.k = entityhuman;
}
public EntityHuman b() {
- return this.d;
+ return this.k;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index b49f731614..c4946ed4f2 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -3,24 +3,24 @@ package net.minecraft.server;
public class TileEntitySkull extends TileEntity {
private int a;
- private int b;
- private String c = "";
+ private int i;
+ private String j = "";
public TileEntitySkull() {}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setByte("SkullType", (byte) (this.a & 255));
- nbttagcompound.setByte("Rot", (byte) (this.b & 255));
- nbttagcompound.setString("ExtraType", this.c);
+ nbttagcompound.setByte("Rot", (byte) (this.i & 255));
+ nbttagcompound.setString("ExtraType", this.j);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.a = nbttagcompound.getByte("SkullType");
- this.b = nbttagcompound.getByte("Rot");
- if (nbttagcompound.hasKey("ExtraType")) {
- this.c = nbttagcompound.getString("ExtraType");
+ this.i = nbttagcompound.getByte("Rot");
+ if (nbttagcompound.hasKeyOfType("ExtraType", 8)) {
+ this.j = nbttagcompound.getString("ExtraType");
}
}
@@ -28,12 +28,12 @@ public class TileEntitySkull extends TileEntity {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.b(nbttagcompound);
- return new Packet132TileEntityData(this.x, this.y, this.z, 4, nbttagcompound);
+ return new PacketPlayOutTileEntityData(this.x, this.y, this.z, 4, nbttagcompound);
}
public void setSkullType(int i, String s) {
this.a = i;
- this.c = s;
+ this.j = s;
}
public int getSkullType() {
@@ -41,16 +41,16 @@ public class TileEntitySkull extends TileEntity {
}
public void setRotation(int i) {
- this.b = i;
+ this.i = i;
}
// CraftBukkit start
public int getRotation() {
- return this.b;
+ return this.i;
}
// CraftBukkit end
public String getExtraType() {
- return this.c;
+ return this.j;
}
}
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index 02bce3d592..1e08de2b0f 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -72,7 +72,7 @@ public class Village {
}
private boolean b(int i, int j, int k, int l, int i1, int j1) {
- if (!this.world.w(i, j - 1, k)) {
+ if (!World.a((IBlockAccess) this.world, i, j - 1, k)) {
return false;
} else {
int k1 = i - l / 2;
@@ -81,7 +81,7 @@ public class Village {
for (int i2 = k1; i2 < k1 + l; ++i2) {
for (int j2 = j; j2 < j + i1; ++j2) {
for (int k2 = l1; k2 < l1 + j1; ++k2) {
- if (this.world.u(i2, j2, k2)) {
+ if (this.world.getType(i2, j2, k2).r()) {
return false;
}
}
@@ -309,9 +309,7 @@ public class Village {
}
private boolean isDoor(int i, int j, int k) {
- int l = this.world.getTypeId(i, j, k);
-
- return l <= 0 ? false : l == Block.WOODEN_DOOR.id;
+ return this.world.getType(i, j, k) == Blocks.WOODEN_DOOR;
}
private void n() {
@@ -365,19 +363,19 @@ public class Village {
this.c.x = nbttagcompound.getInt("ACX");
this.c.y = nbttagcompound.getInt("ACY");
this.c.z = nbttagcompound.getInt("ACZ");
- NBTTagList nbttaglist = nbttagcompound.getList("Doors");
+ NBTTagList nbttaglist = nbttagcompound.getList("Doors", 10);
for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
VillageDoor villagedoor = new VillageDoor(nbttagcompound1.getInt("X"), nbttagcompound1.getInt("Y"), nbttagcompound1.getInt("Z"), nbttagcompound1.getInt("IDX"), nbttagcompound1.getInt("IDZ"), nbttagcompound1.getInt("TS"));
this.doors.add(villagedoor);
}
- NBTTagList nbttaglist1 = nbttagcompound.getList("Players");
+ NBTTagList nbttaglist1 = nbttagcompound.getList("Players", 10);
for (int j = 0; j < nbttaglist1.size(); ++j) {
- NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.get(j);
+ NBTTagCompound nbttagcompound2 = nbttaglist1.get(j);
this.playerStandings.put(nbttagcompound2.getString("Name"), Integer.valueOf(nbttagcompound2.getInt("S")));
}
@@ -396,12 +394,12 @@ public class Village {
nbttagcompound.setInt("ACX", this.c.x);
nbttagcompound.setInt("ACY", this.c.y);
nbttagcompound.setInt("ACZ", this.c.z);
- NBTTagList nbttaglist = new NBTTagList("Doors");
+ NBTTagList nbttaglist = new NBTTagList();
Iterator iterator = this.doors.iterator();
while (iterator.hasNext()) {
VillageDoor villagedoor = (VillageDoor) iterator.next();
- NBTTagCompound nbttagcompound1 = new NBTTagCompound("Door");
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setInt("X", villagedoor.locX);
nbttagcompound1.setInt("Y", villagedoor.locY);
@@ -413,12 +411,12 @@ public class Village {
}
nbttagcompound.set("Doors", nbttaglist);
- NBTTagList nbttaglist1 = new NBTTagList("Players");
+ NBTTagList nbttaglist1 = new NBTTagList();
Iterator iterator1 = this.playerStandings.keySet().iterator();
while (iterator1.hasNext()) {
String s = (String) iterator1.next();
- NBTTagCompound nbttagcompound2 = new NBTTagCompound(s);
+ NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.setString("Name", s);
nbttagcompound2.setInt("S", ((Integer) this.playerStandings.get(s)).intValue());
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 7affabd959..7cf4fbe453 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -150,7 +150,7 @@ public class VillageSiege {
this.world.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit
ChunkCoordinates chunkcoordinates = this.f.getCenter();
- entityzombie.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, this.f.getSize());
+ entityzombie.a(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, this.f.getSize());
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 3924a5cf5a..67247f60f5 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -44,46 +44,52 @@ public abstract class World implements IBlockAccess {
protected float o;
protected float p;
public int q;
- public boolean callingPlaceEvent = false; // CraftBukkit
- public int difficulty;
+ public EnumDifficulty difficulty;
public Random random = new Random();
public WorldProvider worldProvider; // CraftBukkit - remove final
protected List u = new ArrayList();
- public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
+ public IChunkProvider chunkProvider; // CraftBukkit - public
protected final IDataManager dataManager;
- public WorldData worldData; // CraftBukkit - protected -> public
+ public WorldData worldData; // CraftBukkit - public
public boolean isLoading;
- public WorldMapCollection worldMaps;
- public final VillageCollection villages;
+ public PersistentCollection worldMaps;
+ public final PersistentVillage villages;
protected final VillageSiege siegeManager = new VillageSiege(this);
public final MethodProfiler methodProfiler;
private final Vec3DPool J = new Vec3DPool(300, 2000);
private final Calendar K = Calendar.getInstance();
public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public
- private final IConsoleLogManager logAgent;
- private UnsafeList M = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
- private boolean N;
+ public boolean isStatic;
// CraftBukkit start - public, longhashset
- public boolean allowMonsters = true;
- public boolean allowAnimals = true;
protected LongHashSet chunkTickList = new LongHashSet();
+ private int L;
+ public boolean allowMonsters;
+ public boolean allowAnimals;
+ // Added the following
+ public boolean callingPlaceEvent = false;
public long ticksPerAnimalSpawns;
public long ticksPerMonsterSpawns;
// CraftBukkit end
- private int O;
- int[] H;
- public boolean isStatic;
+ private ArrayList M;
+ private boolean N;
+ int[] I;
public BiomeBase getBiome(int i, int j) {
if (this.isLoaded(i, 0, j)) {
Chunk chunk = this.getChunkAtWorldCoords(i, j);
- if (chunk != null) {
+ try {
return chunk.a(i & 15, j & 15, this.worldProvider.e);
- }
- }
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Getting biome");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Coordinates of biome request");
- return this.worldProvider.e.getBiome(i, j);
+ crashreportsystemdetails.a("Location", (Callable) (new CrashReportWorldLocation(this, i, j)));
+ throw new ReportedException(crashreport);
+ }
+ } else {
+ return this.worldProvider.e.getBiome(i, j);
+ }
}
public WorldChunkManager getWorldChunkManager() {
@@ -108,20 +114,22 @@ public abstract class World implements IBlockAccess {
return (CraftServer) Bukkit.getServer();
}
- // Changed signature
- public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, ChunkGenerator gen, org.bukkit.World.Environment env) {
+ // Changed signature - added gen and env
+ 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);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
- this.O = this.random.nextInt(12000);
- this.H = new int['\u8000'];
+ this.L = this.random.nextInt(12000);
+ this.allowMonsters = true;
+ this.allowAnimals = true;
+ this.M = new ArrayList();
+ this.I = new int['\u8000'];
this.dataManager = idatamanager;
this.methodProfiler = methodprofiler;
- this.worldMaps = new WorldMapCollection(idatamanager);
- this.logAgent = iconsolelogmanager;
+ this.worldMaps = new PersistentCollection(idatamanager);
this.worldData = idatamanager.getWorldData();
if (worldprovider != null) {
this.worldProvider = worldprovider;
@@ -157,13 +165,13 @@ public abstract class World implements IBlockAccess {
this.worldData.d(true);
}
- VillageCollection villagecollection = (VillageCollection) this.worldMaps.get(VillageCollection.class, "villages");
+ PersistentVillage persistentvillage = (PersistentVillage) this.worldMaps.get(PersistentVillage.class, "villages");
- if (villagecollection == null) {
- this.villages = new VillageCollection(this);
+ if (persistentvillage == null) {
+ this.villages = new PersistentVillage(this);
this.worldMaps.a("villages", this.villages);
} else {
- this.villages = villagecollection;
+ this.villages = persistentvillage;
this.villages.a(this);
}
@@ -179,56 +187,38 @@ public abstract class World implements IBlockAccess {
this.worldData.d(true);
}
- public int b(int i, int j) {
+ public Block b(int i, int j) {
int k;
for (k = 63; !this.isEmpty(i, k + 1, j); ++k) {
;
}
- return this.getTypeId(i, k, j);
+ return this.getType(i, k, j);
}
- public int getTypeId(int i, int j, int k) {
- if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
- if (j < 0) {
- return 0;
- } else if (j >= 256) {
- return 0;
- } else {
- Chunk chunk = null;
+ public Block getType(int i, int j, int k) {
+ if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j >= 0 && j < 256) {
+ Chunk chunk = null;
- try {
- chunk = this.getChunkAt(i >> 4, k >> 4);
- return chunk.getTypeId(i & 15, j, k & 15);
- } catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Exception getting block type in world");
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Requested block coordinates");
+ try {
+ chunk = this.getChunkAt(i >> 4, k >> 4);
+ return chunk.getType(i & 15, j, k & 15);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception getting block type in world");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Requested block coordinates");
- crashreportsystemdetails.a("Found chunk", Boolean.valueOf(chunk == null));
- crashreportsystemdetails.a("Location", CrashReportSystemDetails.a(i, j, k));
- throw new ReportedException(crashreport);
- }
+ crashreportsystemdetails.a("Found chunk", Boolean.valueOf(chunk == null));
+ crashreportsystemdetails.a("Location", CrashReportSystemDetails.a(i, j, k));
+ throw new ReportedException(crashreport);
}
} else {
- return 0;
+ return Blocks.AIR;
}
}
public boolean isEmpty(int i, int j, int k) {
- return this.getTypeId(i, j, k) == 0;
- }
-
- public boolean isTileEntity(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- return Block.byId[l] != null && Block.byId[l].t();
- }
-
- public int e(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- return Block.byId[l] != null ? Block.byId[l].d() : -1;
+ return this.getType(i, j, k).getMaterial() == Material.AIR;
}
public boolean isLoaded(int i, int j, int k) {
@@ -236,10 +226,10 @@ public abstract class World implements IBlockAccess {
}
public boolean areChunksLoaded(int i, int j, int k, int l) {
- return this.e(i - l, j - l, k - l, i + l, j + l, k + l);
+ return this.b(i - l, j - l, k - l, i + l, j + l, k + l);
}
- public boolean e(int i, int j, int k, int l, int i1, int j1) {
+ public boolean b(int i, int j, int k, int l, int i1, int j1) {
if (i1 >= 0 && j < 256) {
i >>= 4;
k >>= 4;
@@ -269,8 +259,8 @@ public abstract class World implements IBlockAccess {
return this.getChunkAt(i >> 4, j >> 4);
}
- // CraftBukkit start
public Chunk getChunkAt(int i, int j) {
+ // CraftBukkit start
Chunk result = null;
synchronized (this.chunkLock) {
if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) {
@@ -281,10 +271,10 @@ public abstract class World implements IBlockAccess {
result = this.lastChunkAccessed;
}
return result;
+ // CraftBukkit end
}
- // CraftBukkit end
- public boolean setTypeIdAndData(int i, int j, int k, int l, int i1, int j1) {
+ public boolean setTypeAndData(int i, int j, int k, Block block, int l, int i1) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
@@ -292,28 +282,26 @@ public abstract class World implements IBlockAccess {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- int k1 = 0;
+ Block block1 = null;
- if ((j1 & 1) != 0) {
- k1 = chunk.getTypeId(i & 15, j, k & 15);
+ if ((i1 & 1) != 0) {
+ block1 = chunk.getType(i & 15, j, k & 15);
}
- boolean flag = chunk.a(i & 15, j, k & 15, l, i1);
+ boolean flag = chunk.a(i & 15, j, k & 15, block, l);
this.methodProfiler.a("checkLight");
- this.A(i, j, k);
+ this.t(i, j, k);
this.methodProfiler.b();
if (flag) {
- if ((j1 & 2) != 0 && (!this.isStatic || (j1 & 4) == 0)) {
+ if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0) && chunk.k()) {
this.notify(i, j, k);
}
- if (!this.isStatic && (j1 & 1) != 0) {
- this.update(i, j, k, k1);
- Block block = Block.byId[l];
-
- if (block != null && block.q_()) {
- this.m(i, j, k, l);
+ if (!this.isStatic && (i1 & 1) != 0) {
+ this.update(i, j, k, block1);
+ if (block.M()) {
+ this.f(i, j, k, block);
}
}
}
@@ -325,12 +313,6 @@ public abstract class World implements IBlockAccess {
}
}
- public Material getMaterial(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- return l == 0 ? Material.AIR : Block.byId[l].material;
- }
-
public int getData(int i, int j, int k) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
@@ -359,21 +341,19 @@ public abstract class World implements IBlockAccess {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
int j1 = i & 15;
int k1 = k & 15;
- boolean flag = chunk.b(j1, j, k1, l);
+ boolean flag = chunk.a(j1, j, k1, l);
if (flag) {
- int l1 = chunk.getTypeId(j1, j, k1);
+ Block block = chunk.getType(j1, j, k1);
- if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0)) {
+ if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0) && chunk.k()) {
this.notify(i, j, k);
}
if (!this.isStatic && (i1 & 1) != 0) {
- this.update(i, j, k, l1);
- Block block = Block.byId[l1];
-
- if (block != null && block.q_()) {
- this.m(i, j, k, l1);
+ this.update(i, j, k, block);
+ if (block.M()) {
+ this.f(i, j, k, block);
}
}
}
@@ -386,28 +366,28 @@ public abstract class World implements IBlockAccess {
}
public boolean setAir(int i, int j, int k) {
- return this.setTypeIdAndData(i, j, k, 0, 0, 3);
+ return this.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
}
public boolean setAir(int i, int j, int k, boolean flag) {
- int l = this.getTypeId(i, j, k);
+ Block block = this.getType(i, j, k);
- if (l > 0) {
- int i1 = this.getData(i, j, k);
+ if (block.getMaterial() == Material.AIR) {
+ return false;
+ } else {
+ int l = this.getData(i, j, k);
- this.triggerEffect(2001, i, j, k, l + (i1 << 12));
+ this.triggerEffect(2001, i, j, k, Block.b(block) + (l << 12));
if (flag) {
- Block.byId[l].c(this, i, j, k, i1, 0);
+ block.b(this, i, j, k, l, 0);
}
- return this.setTypeIdAndData(i, j, k, 0, 0, 3);
- } else {
- return false;
+ return this.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
}
}
- public boolean setTypeIdUpdate(int i, int j, int k, int l) {
- return this.setTypeIdAndData(i, j, k, l, 0, 3);
+ public boolean setTypeUpdate(int i, int j, int k, Block block) {
+ return this.setTypeAndData(i, j, k, block, 0, 3);
}
public void notify(int i, int j, int k) {
@@ -416,11 +396,11 @@ public abstract class World implements IBlockAccess {
}
}
- public void update(int i, int j, int k, int l) {
- this.applyPhysics(i, j, k, l);
+ public void update(int i, int j, int k, Block block) {
+ this.applyPhysics(i, j, k, block);
}
- public void e(int i, int j, int k, int l) {
+ public void b(int i, int j, int k, int l) {
int i1;
if (k > l) {
@@ -435,99 +415,96 @@ public abstract class World implements IBlockAccess {
}
}
- this.g(i, k, j, i, l, j);
+ this.c(i, k, j, i, l, j);
}
- public void g(int i, int j, int k, int l, int i1, int j1) {
+ public void c(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 applyPhysics(int i, int j, int k, int l) {
- this.g(i - 1, j, k, l);
- this.g(i + 1, j, k, l);
- this.g(i, j - 1, k, l);
- this.g(i, j + 1, k, l);
- this.g(i, j, k - 1, l);
- this.g(i, j, k + 1, l);
+ public void applyPhysics(int i, int j, int k, Block block) {
+ this.e(i - 1, j, k, block);
+ this.e(i + 1, j, k, block);
+ this.e(i, j - 1, k, block);
+ this.e(i, j + 1, k, block);
+ this.e(i, j, k - 1, block);
+ this.e(i, j, k + 1, block);
}
- public void c(int i, int j, int k, int l, int i1) {
- if (i1 != 4) {
- this.g(i - 1, j, k, l);
+ public void b(int i, int j, int k, Block block, int l) {
+ if (l != 4) {
+ this.e(i - 1, j, k, block);
}
- if (i1 != 5) {
- this.g(i + 1, j, k, l);
+ if (l != 5) {
+ this.e(i + 1, j, k, block);
}
- if (i1 != 0) {
- this.g(i, j - 1, k, l);
+ if (l != 0) {
+ this.e(i, j - 1, k, block);
}
- if (i1 != 1) {
- this.g(i, j + 1, k, l);
+ if (l != 1) {
+ this.e(i, j + 1, k, block);
}
- if (i1 != 2) {
- this.g(i, j, k - 1, l);
+ if (l != 2) {
+ this.e(i, j, k - 1, block);
}
- if (i1 != 3) {
- this.g(i, j, k + 1, l);
+ if (l != 3) {
+ this.e(i, j, k + 1, block);
}
}
- public void g(int i, int j, int k, int l) {
+ public void e(int i, int j, int k, Block block) {
if (!this.isStatic) {
- int i1 = this.getTypeId(i, j, k);
- Block block = Block.byId[i1];
+ Block block1 = this.getType(i, j, k);
- if (block != null) {
- try {
- // CraftBukkit start
- CraftWorld world = ((WorldServer) this).getWorld();
- if (world != null) {
- BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
- this.getServer().getPluginManager().callEvent(event);
+ try {
+ // CraftBukkit start
+ CraftWorld world = ((WorldServer) this).getWorld();
+ if (world != null) {
+ BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
+ this.getServer().getPluginManager().callEvent(event);
- if (event.isCancelled()) {
- return;
- }
+ if (event.isCancelled()) {
+ return;
}
- // CraftBukkit end
-
- block.doPhysics(this, i, j, k, l);
- } catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
-
- int j1;
-
- try {
- j1 = this.getData(i, j, k);
- } catch (Throwable throwable1) {
- j1 = -1;
- }
-
- crashreportsystemdetails.a("Source block type", (Callable) (new CrashReportSourceBlockType(this, l)));
- CrashReportSystemDetails.a(crashreportsystemdetails, i, j, k, i1, j1);
- throw new ReportedException(crashreport);
}
+ // CraftBukkit end
+
+ block1.doPhysics(this, i, j, k, block);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated");
+
+ int l;
+
+ try {
+ l = this.getData(i, j, k);
+ } catch (Throwable throwable1) {
+ l = -1;
+ }
+
+ crashreportsystemdetails.a("Source block type", (Callable) (new CrashReportSourceBlockType(this, block)));
+ CrashReportSystemDetails.a(crashreportsystemdetails, i, j, k, block1, l);
+ throw new ReportedException(crashreport);
}
}
}
- public boolean a(int i, int j, int k, int l) {
+ public boolean a(int i, int j, int k, Block block) {
return false;
}
- public boolean l(int i, int j, int k) {
+ public boolean i(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 j(int i, int j, int k) {
if (j < 0) {
return 0;
} else {
@@ -535,7 +512,7 @@ public abstract class World implements IBlockAccess {
j = 255;
}
- return this.getChunkAt(i >> 4, k >> 4).c(i & 15, j, k & 15, 0);
+ return this.getChunkAt(i >> 4, k >> 4).b(i & 15, j, k & 15, 0);
}
}
@@ -545,37 +522,31 @@ public abstract class World implements IBlockAccess {
public int b(int i, int j, int k, boolean flag) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
- if (flag) {
- int l = this.getTypeId(i, j, k);
+ if (flag && this.getType(i, j, k).n()) {
+ int l = this.b(i, j + 1, k, false);
+ int i1 = this.b(i + 1, j, k, false);
+ int j1 = this.b(i - 1, j, k, false);
+ int k1 = this.b(i, j, k + 1, false);
+ int l1 = this.b(i, j, k - 1, false);
- if (Block.x[l]) {
- int i1 = this.b(i, j + 1, k, false);
- int j1 = this.b(i + 1, j, k, false);
- int k1 = this.b(i - 1, j, k, false);
- int l1 = this.b(i, j, k + 1, false);
- int i2 = this.b(i, j, k - 1, false);
-
- if (j1 > i1) {
- i1 = j1;
- }
-
- if (k1 > i1) {
- i1 = k1;
- }
-
- if (l1 > i1) {
- i1 = l1;
- }
-
- if (i2 > i1) {
- i1 = i2;
- }
-
- return i1;
+ if (i1 > l) {
+ l = i1;
}
- }
- if (j < 0) {
+ if (j1 > l) {
+ l = j1;
+ }
+
+ if (k1 > l) {
+ l = k1;
+ }
+
+ if (l1 > l) {
+ l = l1;
+ }
+
+ return l;
+ } else if (j < 0) {
return 0;
} else {
if (j >= 256) {
@@ -586,7 +557,7 @@ public abstract class World implements IBlockAccess {
i &= 15;
k &= 15;
- return chunk.c(i, j, k, this.j);
+ return chunk.b(i, j, k, this.j);
}
} else {
return 15;
@@ -603,7 +574,7 @@ public abstract class World implements IBlockAccess {
return chunk.b(i & 15, j & 15);
}
} else {
- return 0;
+ return 64;
}
}
@@ -614,10 +585,10 @@ public abstract class World implements IBlockAccess {
} else {
Chunk chunk = this.getChunkAt(i >> 4, j >> 4);
- return chunk.p;
+ return chunk.r;
}
} else {
- return 0;
+ return 64;
}
}
@@ -664,13 +635,13 @@ public abstract class World implements IBlockAccess {
}
}
- public void p(int i, int j, int k) {
+ public void m(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 float q(int i, int j, int k) {
+ public float n(int i, int j, int k) {
return this.worldProvider.h[this.getLightLevel(i, j, k)];
}
@@ -679,14 +650,14 @@ public abstract class World implements IBlockAccess {
}
public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) {
- return this.rayTrace(vec3d, vec3d1, false, false);
+ return this.rayTrace(vec3d, vec3d1, false, false, false);
}
public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag) {
- return this.rayTrace(vec3d, vec3d1, flag, false);
+ return this.rayTrace(vec3d, vec3d1, flag, false, false);
}
- public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag, boolean flag1) {
+ public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag, boolean flag1, boolean flag2) {
if (!Double.isNaN(vec3d.c) && !Double.isNaN(vec3d.d) && !Double.isNaN(vec3d.e)) {
if (!Double.isNaN(vec3d1.c) && !Double.isNaN(vec3d1.d) && !Double.isNaN(vec3d1.e)) {
int i = MathHelper.floor(vec3d1.c);
@@ -695,11 +666,10 @@ public abstract class World implements IBlockAccess {
int l = MathHelper.floor(vec3d.c);
int i1 = MathHelper.floor(vec3d.d);
int j1 = MathHelper.floor(vec3d.e);
- int k1 = this.getTypeId(l, i1, j1);
- int l1 = this.getData(l, i1, j1);
- Block block = Block.byId[k1];
+ Block block = this.getType(l, i1, j1);
+ int k1 = this.getData(l, i1, j1);
- if ((!flag1 || block == null || block.b(this, l, i1, j1) != null) && k1 > 0 && block.a(l1, flag)) {
+ if ((!flag1 || block.a(this, l, i1, j1) != null) && block.a(k1, flag)) {
MovingObjectPosition movingobjectposition = block.a(this, l, i1, j1, vec3d, vec3d1);
if (movingobjectposition != null) {
@@ -707,6 +677,8 @@ public abstract class World implements IBlockAccess {
}
}
+ MovingObjectPosition movingobjectposition1 = null;
+
k1 = 200;
while (k1-- >= 0) {
@@ -715,12 +687,12 @@ public abstract class World implements IBlockAccess {
}
if (l == i && i1 == j && j1 == k) {
- return null;
+ return flag2 ? movingobjectposition1 : null;
}
- boolean flag2 = true;
boolean flag3 = true;
boolean flag4 = true;
+ boolean flag5 = true;
double d0 = 999.0D;
double d1 = 999.0D;
double d2 = 999.0D;
@@ -730,7 +702,7 @@ public abstract class World implements IBlockAccess {
} else if (i < l) {
d0 = (double) l + 0.0D;
} else {
- flag2 = false;
+ flag3 = false;
}
if (j > i1) {
@@ -738,7 +710,7 @@ public abstract class World implements IBlockAccess {
} else if (j < i1) {
d1 = (double) i1 + 0.0D;
} else {
- flag3 = false;
+ flag4 = false;
}
if (k > j1) {
@@ -746,7 +718,7 @@ public abstract class World implements IBlockAccess {
} else if (k < j1) {
d2 = (double) j1 + 0.0D;
} else {
- flag4 = false;
+ flag5 = false;
}
double d3 = 999.0D;
@@ -756,19 +728,19 @@ public abstract class World implements IBlockAccess {
double d7 = vec3d1.d - vec3d.d;
double d8 = vec3d1.e - vec3d.e;
- if (flag2) {
+ if (flag3) {
d3 = (d0 - vec3d.c) / d6;
}
- if (flag3) {
+ if (flag4) {
d4 = (d1 - vec3d.d) / d7;
}
- if (flag4) {
+ if (flag5) {
d5 = (d2 - vec3d.e) / d8;
}
- boolean flag5 = false;
+ boolean flag6 = false;
byte b0;
if (d3 < d4 && d3 < d5) {
@@ -823,22 +795,25 @@ public abstract class World implements IBlockAccess {
++vec3d2.e;
}
- int i2 = this.getTypeId(l, i1, j1);
- int j2 = this.getData(l, i1, j1);
- Block block1 = Block.byId[i2];
+ Block block1 = this.getType(l, i1, j1);
+ int l1 = this.getData(l, i1, j1);
- if ((!flag1 || block1 == null || block1.b(this, l, i1, j1) != null) && i2 > 0 && block1.a(j2, flag)) {
- MovingObjectPosition movingobjectposition1 = block1.a(this, l, i1, j1, vec3d, vec3d1);
+ if (!flag1 || block1.a(this, l, i1, j1) != null) {
+ if (block1.a(l1, flag)) {
+ MovingObjectPosition movingobjectposition2 = block1.a(this, l, i1, j1, vec3d, vec3d1);
- if (movingobjectposition1 != null) {
- vec3d2.b.release(vec3d2); // CraftBukkit
- return movingobjectposition1;
+ if (movingobjectposition2 != null) {
+ vec3d2.b.release(vec3d2); // CraftBukkit
+ return movingobjectposition2;
+ }
+ } else {
+ movingobjectposition1 = new MovingObjectPosition(l, i1, j1, b0, vec3d, false);
}
}
vec3d2.b.release(vec3d2); // CraftBukkit
}
- return null;
+ return flag2 ? movingobjectposition1 : null;
} else {
return null;
}
@@ -848,26 +823,20 @@ public abstract class World implements IBlockAccess {
}
public void makeSound(Entity entity, String s, float f, float f1) {
- if (entity != null && s != null) {
- 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);
- }
+ 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);
}
}
public void a(EntityHuman entityhuman, String s, float f, float f1) {
- if (entityhuman != null && s != null) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
- }
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
}
}
public void makeSound(double d0, double d1, double d2, String s, float f, float f1) {
- if (s != null) {
- for (int i = 0; i < this.u.size(); ++i) {
- ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1);
- }
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1);
}
}
@@ -890,8 +859,8 @@ public abstract class World implements IBlockAccess {
return true;
}
- // CraftBukkit start - Used for entities other than creatures
public boolean addEntity(Entity entity) {
+ // CraftBukkit start - Used for entities other than creatures
return this.addEntity(entity, SpawnReason.DEFAULT); // Set reason as DEFAULT
}
@@ -901,7 +870,7 @@ public abstract class World implements IBlockAccess {
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
- boolean flag = entity.p;
+ boolean flag = entity.o;
if (entity instanceof EntityHuman) {
flag = true;
@@ -991,10 +960,10 @@ public abstract class World implements IBlockAccess {
this.everyoneSleeping();
}
- int i = entity.aj;
- int j = entity.al;
+ int i = entity.ai;
+ int j = entity.ak;
- if (entity.ai && this.isChunkLoaded(i, j)) {
+ if (entity.ah && this.isChunkLoaded(i, j)) {
this.getChunkAt(i, j).b(entity);
}
@@ -1019,11 +988,15 @@ public abstract class World implements IBlockAccess {
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)];
+ Block block;
- if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.M, entity);
+ if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) {
+ block = this.getType(k1, i2, l1);
+ } else {
+ block = Blocks.STONE;
}
+
+ block.a(this, k1, i2, l1, axisalignedbb, this.M, entity);
}
}
}
@@ -1033,7 +1006,7 @@ public abstract class World implements IBlockAccess {
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
for (int j2 = 0; j2 < list.size(); ++j2) {
- AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).E();
+ AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).J();
if (axisalignedbb1 != null && axisalignedbb1.b(axisalignedbb)) {
this.M.add(axisalignedbb1);
@@ -1061,11 +1034,15 @@ public abstract class World implements IBlockAccess {
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)];
+ Block block;
- if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null);
+ if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) {
+ block = this.getType(k1, i2, l1);
+ } else {
+ block = Blocks.BEDROCK;
}
+
+ block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null);
}
}
}
@@ -1087,7 +1064,7 @@ public abstract class World implements IBlockAccess {
}
f2 = 1.0F - f2;
- f2 = (float) ((double) f2 * (1.0D - (double) (this.i(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.h(f) * 5.0F) / 16.0D));
f2 = 1.0F - f2;
return (int) (f2 * 11.0F);
@@ -1118,9 +1095,9 @@ public abstract class World implements IBlockAccess {
i &= 15;
for (j &= 15; k > 0; --k) {
- int l = chunk.getTypeId(i, k, j);
+ Block block = chunk.getType(i, k, j);
- if (l != 0 && Block.byId[l].material.isSolid() && Block.byId[l].material != Material.LEAVES) {
+ if (block.getMaterial().isSolid() && block.getMaterial() != Material.LEAVES) {
return k + 1;
}
}
@@ -1128,11 +1105,11 @@ public abstract class World implements IBlockAccess {
return -1;
}
- public void a(int i, int j, int k, int l, int i1) {}
+ public void a(int i, int j, int k, Block block, int l) {}
- public void a(int i, int j, int k, int l, int i1, int j1) {}
+ public void a(int i, int j, int k, Block block, int l, int i1) {}
- public void b(int i, int j, int k, int l, int i1, int j1) {}
+ public void b(int i, int j, int k, Block block, int l, int i1) {}
public void tickEntities() {
this.methodProfiler.a("entities");
@@ -1158,7 +1135,7 @@ public abstract class World implements IBlockAccess {
try {
++entity.ticksLived;
- entity.l_();
+ entity.h();
} catch (Throwable throwable) {
crashreport = CrashReport.a(throwable, "Ticking entity");
crashreportsystemdetails = crashreport.a("Entity being ticked");
@@ -1184,9 +1161,9 @@ public abstract class World implements IBlockAccess {
for (i = 0; i < this.f.size(); ++i) {
entity = (Entity) this.f.get(i);
- j = entity.aj;
- k = entity.al;
- if (entity.ai && this.isChunkLoaded(j, k)) {
+ j = entity.ai;
+ k = entity.ak;
+ if (entity.ah && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
}
@@ -1232,9 +1209,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.b();
this.methodProfiler.a("remove");
if (entity.dead) {
- j = entity.aj;
- k = entity.al;
- if (entity.ai && this.isChunkLoaded(j, k)) {
+ j = entity.ai;
+ k = entity.ak;
+ if (entity.ah && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
@@ -1245,7 +1222,7 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.b();
}
- this.methodProfiler.c("tileEntities");
+ this.methodProfiler.c("blockEntities");
this.N = true;
Iterator iterator = this.tileEntityList.iterator();
@@ -1262,8 +1239,8 @@ public abstract class World implements IBlockAccess {
try {
tileentity.h();
} catch (Throwable throwable2) {
- crashreport = CrashReport.a(throwable2, "Ticking tile entity");
- crashreportsystemdetails = crashreport.a("Tile entity being ticked");
+ crashreport = CrashReport.a(throwable2, "Ticking block entity");
+ crashreportsystemdetails = crashreport.a("Block entity being ticked");
tileentity.a(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
@@ -1287,7 +1264,7 @@ public abstract class World implements IBlockAccess {
this.b.clear();
}
- this.methodProfiler.c("pendingTileEntities");
+ this.methodProfiler.c("pendingBlockEntities");
if (!this.a.isEmpty()) {
for (int l = 0; l < this.a.size(); ++l) {
TileEntity tileentity1 = (TileEntity) this.a.get(l);
@@ -1340,32 +1317,32 @@ public abstract class World implements IBlockAccess {
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
- if (!flag || this.e(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
- entity.U = entity.locX;
- entity.V = entity.locY;
- entity.W = entity.locZ;
+ if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
+ entity.T = entity.locX;
+ entity.U = entity.locY;
+ entity.V = entity.locZ;
entity.lastYaw = entity.yaw;
entity.lastPitch = entity.pitch;
- if (flag && entity.ai) {
+ if (flag && entity.ah) {
++entity.ticksLived;
if (entity.vehicle != null) {
- entity.V();
+ entity.ab();
} else {
- entity.l_();
+ entity.h();
}
}
this.methodProfiler.a("chunkCheck");
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
- entity.locX = entity.U;
+ entity.locX = entity.T;
}
if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) {
- entity.locY = entity.V;
+ entity.locY = entity.U;
}
if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) {
- entity.locZ = entity.W;
+ entity.locZ = entity.V;
}
if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) {
@@ -1380,21 +1357,21 @@ public abstract class World implements IBlockAccess {
int l = MathHelper.floor(entity.locY / 16.0D);
int i1 = MathHelper.floor(entity.locZ / 16.0D);
- if (!entity.ai || entity.aj != k || entity.ak != l || entity.al != i1) {
- if (entity.ai && this.isChunkLoaded(entity.aj, entity.al)) {
- this.getChunkAt(entity.aj, entity.al).a(entity, entity.ak);
+ if (!entity.ah || entity.ai != k || entity.aj != l || entity.ak != i1) {
+ if (entity.ah && this.isChunkLoaded(entity.ai, entity.ak)) {
+ this.getChunkAt(entity.ai, entity.ak).a(entity, entity.aj);
}
if (this.isChunkLoaded(k, i1)) {
- entity.ai = true;
+ entity.ah = true;
this.getChunkAt(k, i1).a(entity);
} else {
- entity.ai = false;
+ entity.ah = false;
}
}
this.methodProfiler.b();
- if (flag && entity.ai && entity.passenger != null) {
+ if (flag && entity.ah && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger);
} else {
@@ -1415,7 +1392,7 @@ public abstract class World implements IBlockAccess {
for (int i = 0; i < list.size(); ++i) {
Entity entity1 = (Entity) list.get(i);
- if (!entity1.dead && entity1.m && entity1 != entity) {
+ if (!entity1.dead && entity1.l && entity1 != entity) {
return false;
}
}
@@ -1446,9 +1423,9 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null) {
+ if (block.getMaterial() != Material.AIR) {
return true;
}
}
@@ -1481,9 +1458,9 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null && block.material.isLiquid()) {
+ if (block.getMaterial().isLiquid()) {
return true;
}
}
@@ -1501,13 +1478,13 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (this.e(i, k, i1, j, l, j1)) {
+ if (this.b(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) {
- int j2 = this.getTypeId(k1, l1, i2);
+ Block block = this.getType(k1, l1, i2);
- if (j2 == Block.FIRE.id || j2 == Block.LAVA.id || j2 == Block.STATIONARY_LAVA.id) {
+ if (block == Blocks.FIRE || block == Blocks.LAVA || block == Blocks.STATIONARY_LAVA) {
return true;
}
}
@@ -1526,7 +1503,7 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (!this.e(i, k, i1, j, l, j1)) {
+ if (!this.b(i, k, i1, j, l, j1)) {
return false;
} else {
boolean flag = false;
@@ -1535,10 +1512,10 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null && block.material == material) {
- double d0 = (double) ((float) (l1 + 1) - BlockFluids.d(this.getData(k1, l1, i2)));
+ if (block.getMaterial() == material) {
+ double d0 = (double) ((float) (l1 + 1) - BlockFluids.b(this.getData(k1, l1, i2)));
if ((double) l >= d0) {
flag = true;
@@ -1549,7 +1526,7 @@ public abstract class World implements IBlockAccess {
}
}
- if (vec3d.b() > 0.0D && entity.ax()) {
+ if (vec3d.b() > 0.0D && entity.aC()) {
vec3d = vec3d.a();
double d1 = 0.014D;
@@ -1574,9 +1551,7 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
-
- if (block != null && block.material == material) {
+ if (this.getType(k1, l1, i2).getMaterial() == material) {
return true;
}
}
@@ -1597,9 +1572,9 @@ public abstract class World implements IBlockAccess {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
- Block block = Block.byId[this.getTypeId(k1, l1, i2)];
+ Block block = this.getType(k1, l1, i2);
- if (block != null && block.material == material) {
+ if (block.getMaterial() == material) {
int j2 = this.getData(k1, l1, i2);
double d0 = (double) (l1 + 1);
@@ -1685,7 +1660,7 @@ public abstract class World implements IBlockAccess {
++i;
}
- if (this.getTypeId(i, j, k) == Block.FIRE.id) {
+ if (this.getType(i, j, k) == Blocks.FIRE) {
this.a(entityhuman, 1004, i, j, k, 0);
this.setAir(i, j, k);
return true;
@@ -1746,7 +1721,7 @@ public abstract class World implements IBlockAccess {
TileEntity tileentity1 = (TileEntity) iterator.next();
if (tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
- tileentity1.w_();
+ tileentity1.s();
iterator.remove();
}
}
@@ -1763,11 +1738,11 @@ public abstract class World implements IBlockAccess {
}
}
- public void s(int i, int j, int k) {
+ public void p(int i, int j, int k) {
TileEntity tileentity = this.getTileEntity(i, j, k);
if (tileentity != null && this.N) {
- tileentity.w_();
+ tileentity.s();
this.a.remove(tileentity);
} else {
if (tileentity != null) {
@@ -1787,36 +1762,17 @@ public abstract class World implements IBlockAccess {
this.b.add(tileentity);
}
- public boolean t(int i, int j, int k) {
- Block block = Block.byId[this.getTypeId(i, j, k)];
+ public boolean q(int i, int j, int k) {
+ AxisAlignedBB axisalignedbb = this.getType(i, j, k).a(this, i, j, k);
- return block == null ? false : block.c();
+ return axisalignedbb != null && axisalignedbb.b() >= 1.0D;
}
- public boolean u(int i, int j, int k) {
- return Block.l(this.getTypeId(i, j, k));
- }
+ public static boolean a(IBlockAccess iblockaccess, int i, int j, int k) {
+ Block block = iblockaccess.getType(i, j, k);
+ int l = iblockaccess.getData(i, j, k);
- public boolean v(int i, int j, int k) {
- int l = this.getTypeId(i, j, k);
-
- if (l != 0 && Block.byId[l] != null) {
- AxisAlignedBB axisalignedbb = Block.byId[l].b(this, i, j, k);
-
- return axisalignedbb != null && axisalignedbb.b() >= 1.0D;
- } else {
- return false;
- }
- }
-
- public boolean w(int i, int j, int k) {
- Block block = Block.byId[this.getTypeId(i, j, k)];
-
- return this.a(block, this.getData(i, j, k));
- }
-
- public boolean a(Block block, int i) {
- return block == null ? false : (block.material.k() && block.b() ? true : (block instanceof BlockStairs ? (i & 4) == 4 : (block instanceof BlockStepAbstract ? (i & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (i & 7) == 7 : false)))));
+ return block.getMaterial().k() && block.d() ? true : (block instanceof BlockStairs ? (l & 4) == 4 : (block instanceof BlockStepAbstract ? (l & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (l & 7) == 7 : false))));
}
public boolean c(int i, int j, int k, boolean flag) {
@@ -1824,9 +1780,9 @@ public abstract class World implements IBlockAccess {
Chunk chunk = this.chunkProvider.getOrCreateChunk(i >> 4, k >> 4);
if (chunk != null && !chunk.isEmpty()) {
- Block block = Block.byId[this.getTypeId(i, j, k)];
+ Block block = this.getType(i, j, k);
- return block == null ? false : block.material.k() && block.b();
+ return block.getMaterial().k() && block.d();
} else {
return flag;
}
@@ -1863,88 +1819,73 @@ public abstract class World implements IBlockAccess {
protected void o() {
if (!this.worldProvider.g) {
- int i = this.worldData.getThunderDuration();
+ if (!this.isStatic) {
+ int i = this.worldData.getThunderDuration();
- if (i <= 0) {
- if (this.worldData.isThundering()) {
- this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
- } else {
- this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
- }
- } else {
- --i;
- this.worldData.setThunderDuration(i);
if (i <= 0) {
- // CraftBukkit start
- ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
- this.getServer().getPluginManager().callEvent(thunder);
- if (!thunder.isCancelled()) {
- this.worldData.setThundering(!this.worldData.isThundering());
+ if (this.worldData.isThundering()) {
+ this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
+ } else {
+ this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
}
- // CraftBukkit end
- }
- }
-
- int j = this.worldData.getWeatherDuration();
-
- if (j <= 0) {
- if (this.worldData.hasStorm()) {
- this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
} else {
- this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
- }
- } else {
- --j;
- this.worldData.setWeatherDuration(j);
- if (j <= 0) {
- // CraftBukkit start
- WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
- this.getServer().getPluginManager().callEvent(weather);
-
- if (!weather.isCancelled()) {
- this.worldData.setStorm(!this.worldData.hasStorm());
+ --i;
+ this.worldData.setThunderDuration(i);
+ if (i <= 0) {
+ // CraftBukkit start
+ ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
+ this.getServer().getPluginManager().callEvent(thunder);
+ if (!thunder.isCancelled()) {
+ this.worldData.setThundering(!this.worldData.isThundering());
+ }
+ // CraftBukkit end
}
- // CraftBukkit end
}
- }
- this.m = this.n;
- if (this.worldData.hasStorm()) {
- this.n = (float) ((double) this.n + 0.01D);
- } else {
- this.n = (float) ((double) this.n - 0.01D);
- }
+ this.o = this.p;
+ if (this.worldData.isThundering()) {
+ this.p = (float) ((double) this.p + 0.01D);
+ } else {
+ this.p = (float) ((double) this.p - 0.01D);
+ }
- if (this.n < 0.0F) {
- this.n = 0.0F;
- }
+ this.p = MathHelper.a(this.p, 0.0F, 1.0F);
+ int j = this.worldData.getWeatherDuration();
- if (this.n > 1.0F) {
- this.n = 1.0F;
- }
+ if (j <= 0) {
+ if (this.worldData.hasStorm()) {
+ this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
+ } else {
+ this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
+ }
+ } else {
+ --j;
+ this.worldData.setWeatherDuration(j);
+ if (j <= 0) {
+ // CraftBukkit start
+ WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
+ this.getServer().getPluginManager().callEvent(weather);
- this.o = this.p;
- if (this.worldData.isThundering()) {
- this.p = (float) ((double) this.p + 0.01D);
- } else {
- this.p = (float) ((double) this.p - 0.01D);
- }
+ if (!weather.isCancelled()) {
+ this.worldData.setStorm(!this.worldData.hasStorm());
+ }
+ // CraftBukkit end
+ }
+ }
- if (this.p < 0.0F) {
- this.p = 0.0F;
- }
+ this.m = this.n;
+ if (this.worldData.hasStorm()) {
+ this.n = (float) ((double) this.n + 0.01D);
+ } else {
+ this.n = (float) ((double) this.n - 0.01D);
+ }
- if (this.p > 1.0F) {
- this.p = 1.0F;
+ this.n = MathHelper.a(this.n, 0.0F, 1.0F);
}
}
}
- public void B() {
- this.worldData.setWeatherDuration(1);
- }
-
- protected void C() {
+ protected void B() {
// this.chunkTickList.clear(); // CraftBukkit - removed
this.methodProfiler.a("buildList");
@@ -1974,8 +1915,8 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.b();
- if (this.O > 0) {
- --this.O;
+ if (this.L > 0) {
+ --this.L;
}
this.methodProfiler.a("playerCheckLight");
@@ -1986,7 +1927,7 @@ public abstract class World implements IBlockAccess {
k = MathHelper.floor(entityhuman.locY) + this.random.nextInt(11) - 5;
int j1 = MathHelper.floor(entityhuman.locZ) + this.random.nextInt(11) - 5;
- this.A(j, k, j1);
+ this.t(j, k, j1);
}
this.methodProfiler.b();
@@ -1994,22 +1935,22 @@ public abstract class World implements IBlockAccess {
protected void a(int i, int j, Chunk chunk) {
this.methodProfiler.c("moodSound");
- if (this.O == 0 && !this.isStatic) {
+ if (this.L == 0 && !this.isStatic) {
this.k = this.k * 3 + 1013904223;
int k = this.k >> 2;
int l = k & 15;
int i1 = k >> 8 & 15;
- int j1 = k >> 16 & 255; // CraftBukkit - 127 -> 255
- int k1 = chunk.getTypeId(l, j1, i1);
+ int j1 = k >> 16 & 255;
+ Block block = chunk.getType(l, j1, i1);
l += i;
i1 += j;
- if (k1 == 0 && this.m(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
+ if (block.getMaterial() == Material.AIR && this.j(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.O = this.random.nextInt(12000) + 6000;
+ this.L = this.random.nextInt(12000) + 6000;
}
}
}
@@ -2019,47 +1960,47 @@ public abstract class World implements IBlockAccess {
}
protected void g() {
- this.C();
+ this.B();
}
- public boolean x(int i, int j, int k) {
+ public boolean r(int i, int j, int k) {
return this.d(i, j, k, false);
}
- public boolean y(int i, int j, int k) {
+ public boolean s(int i, int j, int k) {
return this.d(i, j, k, true);
}
public boolean d(int i, int j, int k, boolean flag) {
BiomeBase biomebase = this.getBiome(i, k);
- float f = biomebase.j();
+ float f = biomebase.a(i, j, k);
if (f > 0.15F) {
return false;
} else {
if (j >= 0 && j < 256 && this.b(EnumSkyBlock.BLOCK, i, j, k) < 10) {
- int l = this.getTypeId(i, j, k);
+ Block block = this.getType(i, j, k);
- if ((l == Block.STATIONARY_WATER.id || l == Block.WATER.id) && this.getData(i, j, k) == 0) {
+ if ((block == Blocks.STATIONARY_WATER || block == Blocks.WATER) && this.getData(i, j, k) == 0) {
if (!flag) {
return true;
}
boolean flag1 = true;
- if (flag1 && this.getMaterial(i - 1, j, k) != Material.WATER) {
+ if (flag1 && this.getType(i - 1, j, k).getMaterial() != Material.WATER) {
flag1 = false;
}
- if (flag1 && this.getMaterial(i + 1, j, k) != Material.WATER) {
+ if (flag1 && this.getType(i + 1, j, k).getMaterial() != Material.WATER) {
flag1 = false;
}
- if (flag1 && this.getMaterial(i, j, k - 1) != Material.WATER) {
+ if (flag1 && this.getType(i, j, k - 1).getMaterial() != Material.WATER) {
flag1 = false;
}
- if (flag1 && this.getMaterial(i, j, k + 1) != Material.WATER) {
+ if (flag1 && this.getType(i, j, k + 1).getMaterial() != Material.WATER) {
flag1 = false;
}
@@ -2073,18 +2014,19 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean z(int i, int j, int k) {
+ public boolean e(int i, int j, int k, boolean flag) {
BiomeBase biomebase = this.getBiome(i, k);
- float f = biomebase.j();
+ float f = biomebase.a(i, j, k);
if (f > 0.15F) {
return false;
+ } else if (!flag) {
+ return true;
} else {
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);
+ Block block = this.getType(i, j, k);
- if (i1 == 0 && Block.SNOW.canPlace(this, i, j, k) && l != 0 && l != Block.ICE.id && Block.byId[l].material.isSolid()) {
+ if (block.getMaterial() == Material.AIR && Blocks.SNOW.canPlace(this, i, j, k)) {
return true;
}
}
@@ -2093,57 +2035,62 @@ public abstract class World implements IBlockAccess {
}
}
- public void A(int i, int j, int k) {
+ public boolean t(int i, int j, int k) {
+ boolean flag = false;
+
if (!this.worldProvider.g) {
- this.c(EnumSkyBlock.SKY, i, j, k);
+ flag |= this.c(EnumSkyBlock.SKY, i, j, k);
}
- this.c(EnumSkyBlock.BLOCK, i, j, k);
+ flag |= this.c(EnumSkyBlock.BLOCK, i, j, k);
+ return flag;
}
private int a(int i, int j, int k, EnumSkyBlock enumskyblock) {
- if (enumskyblock == EnumSkyBlock.SKY && this.l(i, j, k)) {
+ if (enumskyblock == EnumSkyBlock.SKY && this.i(i, j, k)) {
return 15;
} else {
- int l = this.getTypeId(i, j, k);
- int i1 = enumskyblock == EnumSkyBlock.SKY ? 0 : Block.lightEmission[l];
- int j1 = Block.lightBlock[l];
+ Block block = this.getType(i, j, k);
+ int l = enumskyblock == EnumSkyBlock.SKY ? 0 : block.m();
+ int i1 = block.k();
- if (j1 >= 15 && Block.lightEmission[l] > 0) {
- j1 = 1;
+ if (i1 >= 15 && block.m() > 0) {
+ i1 = 1;
}
- if (j1 < 1) {
- j1 = 1;
+ if (i1 < 1) {
+ i1 = 1;
}
- if (j1 >= 15) {
+ if (i1 >= 15) {
return 0;
- } else if (i1 >= 14) {
- return i1;
+ } else if (l >= 14) {
+ return l;
} else {
- for (int k1 = 0; k1 < 6; ++k1) {
- int l1 = i + Facing.b[k1];
- int i2 = j + Facing.c[k1];
- int j2 = k + Facing.d[k1];
- int k2 = this.b(enumskyblock, l1, i2, j2) - j1;
+ for (int j1 = 0; j1 < 6; ++j1) {
+ int k1 = i + Facing.b[j1];
+ int l1 = j + Facing.c[j1];
+ int i2 = k + Facing.d[j1];
+ int j2 = this.b(enumskyblock, k1, l1, i2) - i1;
- if (k2 > i1) {
- i1 = k2;
+ if (j2 > l) {
+ l = j2;
}
- if (i1 >= 14) {
- return i1;
+ if (l >= 14) {
+ return l;
}
}
- return i1;
+ return l;
}
}
}
- public void c(EnumSkyBlock enumskyblock, int i, int j, int k) {
- if (this.areChunksLoaded(i, j, k, 17)) {
+ public boolean c(EnumSkyBlock enumskyblock, int i, int j, int k) {
+ if (!this.areChunksLoaded(i, j, k, 17)) {
+ return false;
+ } else {
int l = 0;
int i1 = 0;
@@ -2161,12 +2108,12 @@ public abstract class World implements IBlockAccess {
int l3;
if (k1 > j1) {
- this.H[i1++] = 133152;
+ this.I[i1++] = 133152;
} else if (k1 < j1) {
- this.H[i1++] = 133152 | j1 << 18;
+ this.I[i1++] = 133152 | j1 << 18;
while (l < i1) {
- l1 = this.H[l++];
+ l1 = this.I[l++];
i2 = (l1 & 63) - 32 + i;
j2 = (l1 >> 6 & 63) - 32 + j;
k2 = (l1 >> 12 & 63) - 32 + k;
@@ -2183,11 +2130,11 @@ public abstract class World implements IBlockAccess {
int j4 = i2 + Facing.b[i4];
int k4 = j2 + Facing.c[i4];
int l4 = k2 + Facing.d[i4];
- int i5 = Math.max(1, Block.lightBlock[this.getTypeId(j4, k4, l4)]);
+ int i5 = Math.max(1, this.getType(j4, k4, l4).k());
i3 = this.b(enumskyblock, j4, k4, l4);
- if (i3 == l2 - i5 && i1 < this.H.length) {
- this.H[i1++] = j4 - i + 32 | k4 - j + 32 << 6 | l4 - k + 32 << 12 | l2 - i5 << 18;
+ if (i3 == l2 - i5 && i1 < this.I.length) {
+ this.I[i1++] = j4 - i + 32 | k4 - j + 32 << 6 | l4 - k + 32 << 12 | l2 - i5 << 18;
}
}
}
@@ -2202,7 +2149,7 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("checkedPosition < toCheckCount");
while (l < i1) {
- l1 = this.H[l++];
+ l1 = this.I[l++];
i2 = (l1 & 63) - 32 + i;
j2 = (l1 >> 6 & 63) - 32 + j;
k2 = (l1 >> 12 & 63) - 32 + k;
@@ -2214,31 +2161,31 @@ public abstract class World implements IBlockAccess {
j3 = Math.abs(i2 - i);
l3 = Math.abs(j2 - j);
k3 = Math.abs(k2 - k);
- boolean flag = i1 < this.H.length - 6;
+ boolean flag = i1 < this.I.length - 6;
if (j3 + l3 + k3 < 17 && flag) {
if (this.b(enumskyblock, i2 - 1, j2, k2) < i3) {
- this.H[i1++] = i2 - 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 - 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2 + 1, j2, k2) < i3) {
- this.H[i1++] = i2 + 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 + 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2 - 1, k2) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 - 1 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 - 1 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2 + 1, k2) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 + 1 - j + 32 << 6) + (k2 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 + 1 - j + 32 << 6) + (k2 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2, k2 - 1) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 - 1 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 - 1 - k + 32 << 12);
}
if (this.b(enumskyblock, i2, j2, k2 + 1) < i3) {
- this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 + 1 - k + 32 << 12);
+ this.I[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 + 1 - k + 32 << 12);
}
}
}
@@ -2246,6 +2193,7 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.b();
+ return true;
}
}
@@ -2345,9 +2293,10 @@ public abstract class World implements IBlockAccess {
}
if (oclass.isAssignableFrom(entity.getClass())) {
+ // if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) {
+ // CraftBukkit end
++i;
}
- // CraftBukkit end
}
return i;
@@ -2355,7 +2304,9 @@ public abstract class World implements IBlockAccess {
public void a(List list) {
// CraftBukkit start
+ // this.entityList.addAll(list);
Entity entity = null;
+
for (int i = 0; i < list.size(); ++i) {
entity = (Entity) list.get(i);
if (entity == null) {
@@ -2371,28 +2322,12 @@ public abstract class World implements IBlockAccess {
this.f.addAll(list);
}
- public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1, Entity entity, ItemStack itemstack) {
- int j1 = this.getTypeId(j, k, l);
- Block block = Block.byId[j1];
- Block block1 = Block.byId[i];
- AxisAlignedBB axisalignedbb = block1.b(this, j, k, l);
+ public boolean mayPlace(Block block, int i, int j, int k, boolean flag, int l, Entity entity, ItemStack itemstack) {
+ Block block1 = this.getType(i, j, k);
+ AxisAlignedBB axisalignedbb = flag ? null : block.a(this, i, j, k);
- if (flag) {
- axisalignedbb = null;
- }
-
- boolean defaultReturn; // CraftBukkit - store the default action
-
- 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.isReplaceable())) {
- block = null;
- }
-
- // CraftBukkit
- defaultReturn = block != null && block.material == Material.ORIENTABLE && block1 == Block.ANVIL ? true : i > 0 && block == null && block1.canPlace(this, j, k, l, i1, itemstack);
- }
+ // CraftBukkit start - store default return
+ boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb, entity) ? false : (block1.getMaterial() == Material.ORIENTABLE && block == Blocks.ANVIL ? true : block1.getMaterial().isReplaceable() && block.canPlace(this, i, j, k, l, itemstack));
// CraftBukkit start
BlockCanBuildEvent event = new BlockCanBuildEvent(this.getWorld().getBlockAt(j, k, l), i, defaultReturn);
@@ -2441,9 +2376,7 @@ public abstract class World implements IBlockAccess {
}
public int getBlockPower(int i, int j, int k, int l) {
- int i1 = this.getTypeId(i, j, k);
-
- return i1 == 0 ? 0 : Block.byId[i1].c(this, i, j, k, l);
+ return this.getType(i, j, k).c(this, i, j, k, l);
}
public int getBlockPower(int i, int j, int k) {
@@ -2483,13 +2416,7 @@ public abstract class World implements IBlockAccess {
}
public int getBlockFacePower(int i, int j, int k, int l) {
- if (this.u(i, j, k)) {
- return this.getBlockPower(i, j, k);
- } else {
- int i1 = this.getTypeId(i, j, k);
-
- return i1 == 0 ? 0 : Block.byId[i1].b(this, i, j, k, l);
- }
+ return this.getType(i, j, k).r() ? this.getBlockPower(i, j, k) : this.getType(i, j, k).b(this, i, j, k, l);
}
public boolean isBlockIndirectlyPowered(int i, int j, int k) {
@@ -2565,7 +2492,7 @@ public abstract class World implements IBlockAccess {
}
if (entityhuman1.isInvisible()) {
- float f = entityhuman1.bx();
+ float f = entityhuman1.bC();
if (f < 0.1F) {
f = 0.1F;
@@ -2594,7 +2521,7 @@ public abstract class World implements IBlockAccess {
return null;
}
- public void G() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ public void F() throws ExceptionWorldConflict { // CraftBukkit - added throws
this.dataManager.checkSession();
}
@@ -2618,20 +2545,22 @@ public abstract class World implements IBlockAccess {
return new ChunkCoordinates(this.worldData.c(), this.worldData.d(), this.worldData.e());
}
+ public void x(int i, int j, int k) {
+ this.worldData.setSpawn(i, j, k);
+ }
+
public boolean a(EntityHuman entityhuman, int i, int j, int k) {
return true;
}
public void broadcastEntityEffect(Entity entity, byte b0) {}
- public IChunkProvider L() {
+ public IChunkProvider K() {
return this.chunkProvider;
}
- 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);
- }
+ public void playNote(int i, int j, int k, Block block, int l, int i1) {
+ block.a(this, i, j, k, l, i1);
}
public IDataManager getDataManager() {
@@ -2659,46 +2588,46 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
public float h(float f) {
- return (this.o + (this.p - this.o) * f) * this.i(f);
+ return (this.o + (this.p - this.o) * f) * this.j(f);
}
- public float i(float f) {
+ public float j(float f) {
return this.m + (this.n - this.m) * f;
}
- public boolean P() {
+ public boolean O() {
return (double) this.h(1.0F) > 0.9D;
}
- public boolean Q() {
- return (double) this.i(1.0F) > 0.2D;
+ public boolean P() {
+ return (double) this.j(1.0F) > 0.2D;
}
public boolean isRainingAt(int i, int j, int k) {
- if (!this.Q()) {
+ if (!this.P()) {
return false;
- } else if (!this.l(i, j, k)) {
+ } else if (!this.i(i, j, k)) {
return false;
} else if (this.h(i, k) > j) {
return false;
} else {
BiomeBase biomebase = this.getBiome(i, k);
- return biomebase.c() ? false : biomebase.d();
+ return biomebase.d() ? false : (this.e(i, j, k, false) ? false : biomebase.e());
}
}
- public boolean G(int i, int j, int k) {
+ public boolean z(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
- return biomebase.e();
+ return biomebase.f();
}
- public void a(String s, WorldMapBase worldmapbase) {
- this.worldMaps.a(s, worldmapbase);
+ public void a(String s, PersistentBase persistentbase) {
+ this.worldMaps.a(s, persistentbase);
}
- public WorldMapBase a(Class oclass, String s) {
+ public PersistentBase a(Class oclass, String s) {
return this.worldMaps.get(oclass, s);
}
@@ -2706,7 +2635,7 @@ public abstract class World implements IBlockAccess {
return this.worldMaps.a(s);
}
- public void d(int i, int j, int k, int l, int i1) {
+ public void b(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(i, j, k, l, i1);
}
@@ -2737,15 +2666,11 @@ public abstract class World implements IBlockAccess {
return 256;
}
- public int S() {
+ public int R() {
return this.worldProvider.g ? 128 : 256;
}
- public IUpdatePlayerListBox a(EntityMinecartAbstract entityminecartabstract) {
- return null;
- }
-
- public Random H(int i, int j, int k) {
+ public Random A(int i, int j, int k) {
long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k;
this.random.setSeed(l);
@@ -2753,7 +2678,7 @@ public abstract class World implements IBlockAccess {
}
public ChunkPosition b(String s, int i, int j, int k) {
- return this.L().findNearestMapFeature(this, s, i, j, k);
+ return this.K().findNearestMapFeature(this, s, i, j, k);
}
public CrashReportSystemDetails a(CrashReport crashreport) {
@@ -2772,7 +2697,7 @@ public abstract class World implements IBlockAccess {
return crashreportsystemdetails;
}
- public void f(int i, int j, int k, int l, int i1) {
+ public void d(int i, int j, int k, int l, int i1) {
for (int j1 = 0; j1 < this.u.size(); ++j1) {
IWorldAccess iworldaccess = (IWorldAccess) this.u.get(j1);
@@ -2784,9 +2709,9 @@ public abstract class World implements IBlockAccess {
return this.J;
}
- public Calendar W() {
+ public Calendar V() {
if (this.getTime() % 600L == 0L) {
- this.K.setTimeInMillis(MinecraftServer.aq());
+ this.K.setTimeInMillis(MinecraftServer.ap());
}
return this.K;
@@ -2796,53 +2721,55 @@ public abstract class World implements IBlockAccess {
return this.scoreboard;
}
- public void m(int i, int j, int k, int l) {
- for (int i1 = 0; i1 < 4; ++i1) {
- int j1 = i + Direction.a[i1];
- int k1 = k + Direction.b[i1];
- int l1 = this.getTypeId(j1, j, k1);
+ public void f(int i, int j, int k, Block block) {
+ for (int l = 0; l < 4; ++l) {
+ int i1 = i + Direction.a[l];
+ int j1 = k + Direction.b[l];
+ Block block1 = this.getType(i1, j, j1);
- if (l1 != 0) {
- Block block = Block.byId[l1];
+ if (Blocks.REDSTONE_COMPARATOR_OFF.e(block1)) {
+ block1.doPhysics(this, i1, j, j1, block);
+ } else if (block1.r()) {
+ i1 += Direction.a[l];
+ j1 += Direction.b[l];
+ Block block2 = this.getType(i1, j, j1);
- if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) {
- block.doPhysics(this, j1, j, k1, l);
- } else if (Block.l(l1)) {
- j1 += Direction.a[i1];
- k1 += Direction.b[i1];
- l1 = this.getTypeId(j1, j, k1);
- block = Block.byId[l1];
- if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) {
- block.doPhysics(this, j1, j, k1, l);
- }
+ if (Blocks.REDSTONE_COMPARATOR_OFF.e(block2)) {
+ block2.doPhysics(this, i1, j, j1, block);
}
}
}
}
- public IConsoleLogManager getLogger() {
- return this.logAgent;
- }
-
public float b(double d0, double d1, double d2) {
- return this.I(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
+ return this.B(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
- public float I(int i, int j, int k) {
+ public float B(int i, int j, int k) {
float f = 0.0F;
- boolean flag = this.difficulty == 3;
+ boolean flag = this.difficulty == EnumDifficulty.HARD;
if (this.isLoaded(i, j, k)) {
float f1 = this.x();
- f += MathHelper.a((float) this.getChunkAtWorldCoords(i, k).q / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F);
+ f += MathHelper.a((float) this.getChunkAtWorldCoords(i, k).s / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F);
f += f1 * 0.25F;
}
- if (this.difficulty < 2) {
- f *= (float) this.difficulty / 2.0F;
+ if (this.difficulty == EnumDifficulty.EASY || this.difficulty == EnumDifficulty.PEACEFUL) {
+ f *= (float) this.difficulty.a() / 2.0F;
}
return MathHelper.a(f, 0.0F, flag ? 1.5F : 1.0F);
}
+
+ public void X() {
+ Iterator iterator = this.u.iterator();
+
+ while (iterator.hasNext()) {
+ IWorldAccess iworldaccess = (IWorldAccess) iterator.next();
+
+ iworldaccess.b();
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldGenAcaciaTree.java b/src/main/java/net/minecraft/server/WorldGenAcaciaTree.java
new file mode 100644
index 0000000000..9ed8492aae
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenAcaciaTree.java
@@ -0,0 +1,169 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
+
+public class WorldGenAcaciaTree extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
+
+ public WorldGenAcaciaTree(boolean flag) {
+ super(flag);
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ // CraftBukkit start - Moved to generate
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
+ }
+
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
+ // CraftBukkit end
+ int l = random.nextInt(3) + random.nextInt(3) + 5;
+ boolean flag = true;
+
+ if (j >= 1 && j + l + 1 <= 256) {
+ int i1;
+ int j1;
+
+ for (int k1 = j; k1 <= j + 1 + l; ++k1) {
+ byte b0 = 1;
+
+ if (k1 == j) {
+ b0 = 0;
+ }
+
+ if (k1 >= j + 1 + l - 2) {
+ b0 = 2;
+ }
+
+ for (i1 = i - b0; i1 <= i + b0 && flag; ++i1) {
+ for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) {
+ if (k1 >= 0 && k1 < 256) {
+ Block block = world.getType(i1, k1, j1);
+
+ if (!this.a(block)) {
+ flag = false;
+ }
+ } else {
+ flag = false;
+ }
+ }
+ }
+ }
+
+ if (!flag) {
+ return false;
+ } else {
+ Block block1 = world.getType(i, j - 1, k);
+
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
+ int l1 = random.nextInt(4);
+
+ i1 = l - random.nextInt(4) - 1;
+ j1 = 3 - random.nextInt(3);
+ int i2 = i;
+ int j2 = k;
+ int k2 = 0;
+
+ int l2;
+ int i3;
+
+ for (l2 = 0; l2 < l; ++l2) {
+ i3 = j + l2;
+ if (l2 >= i1 && j1 > 0) {
+ i2 += Direction.a[l1];
+ j2 += Direction.b[l1];
+ --j1;
+ }
+
+ Block block2 = world.getType(i2, i3, j2);
+
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i2, i3, j2, Blocks.LOG2, 0);
+ k2 = i3;
+ }
+ }
+
+ for (l2 = -1; l2 <= 1; ++l2) {
+ for (i3 = -1; i3 <= 1; ++i3) {
+ this.a(world, i2 + l2, k2 + 1, j2 + i3);
+ }
+ }
+
+ this.a(world, i2 + 2, k2 + 1, j2);
+ this.a(world, i2 - 2, k2 + 1, j2);
+ this.a(world, i2, k2 + 1, j2 + 2);
+ this.a(world, i2, k2 + 1, j2 - 2);
+
+ for (l2 = -3; l2 <= 3; ++l2) {
+ for (i3 = -3; i3 <= 3; ++i3) {
+ if (Math.abs(l2) != 3 || Math.abs(i3) != 3) {
+ this.a(world, i2 + l2, k2, j2 + i3);
+ }
+ }
+ }
+
+ i2 = i;
+ j2 = k;
+ l2 = random.nextInt(4);
+ if (l2 != l1) {
+ i3 = i1 - random.nextInt(2) - 1;
+ int j3 = 1 + random.nextInt(3);
+
+ k2 = 0;
+
+ int k3;
+ int l3;
+
+ for (l3 = i3; l3 < l && j3 > 0; --j3) {
+ if (l3 >= 1) {
+ k3 = j + l3;
+ i2 += Direction.a[l2];
+ j2 += Direction.b[l2];
+ Block block3 = world.getType(i2, k3, j2);
+
+ if (block3.getMaterial() == Material.AIR || block3.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i2, k3, j2, Blocks.LOG2, 0);
+ k2 = k3;
+ }
+ }
+
+ ++l3;
+ }
+
+ if (k2 > 0) {
+ for (l3 = -1; l3 <= 1; ++l3) {
+ for (k3 = -1; k3 <= 1; ++k3) {
+ this.a(world, i2 + l3, k2 + 1, j2 + k3);
+ }
+ }
+
+ for (l3 = -2; l3 <= 2; ++l3) {
+ for (k3 = -2; k3 <= 2; ++k3) {
+ if (Math.abs(l3) != 2 || Math.abs(k3) != 2) {
+ this.a(world, i2 + l3, k2, j2 + k3);
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+
+ // CraftBukkit - Changed signature
+ private void a(CraftBlockChangeDelegate world, int i, int j, int k) {
+ Block block = world.getType(i, j, k);
+
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j, k, Blocks.LEAVES2, 0);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java
index 2404b1d9b2..d4de58addb 100644
--- a/src/main/java/net/minecraft/server/WorldGenBigTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java
@@ -2,13 +2,13 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenBigTree extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenBigTree extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
static final byte[] a = new byte[] { (byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1};
Random b = new Random();
- BlockChangeDelegate world; // CraftBukkit
+ CraftBlockChangeDelegate world; // CraftBukkit - Change type
int[] d = new int[] { 0, 0, 0};
int e;
int f;
@@ -96,33 +96,33 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
System.arraycopy(aint, 0, this.o, 0, k);
}
- void a(int i, int j, int k, float f, byte b0, int l) {
- int i1 = (int) ((double) f + 0.618D);
+ void a(int i, int j, int k, float f, byte b0, Block block) {
+ int l = (int) ((double) f + 0.618D);
byte b1 = a[b0];
byte b2 = a[b0 + 3];
int[] aint = new int[] { i, j, k};
int[] aint1 = new int[] { 0, 0, 0};
- int j1 = -i1;
- int k1 = -i1;
+ int i1 = -l;
+ int j1 = -l;
- for (aint1[b0] = aint[b0]; j1 <= i1; ++j1) {
- aint1[b1] = aint[b1] + j1;
- k1 = -i1;
+ for (aint1[b0] = aint[b0]; i1 <= l; ++i1) {
+ aint1[b1] = aint[b1] + i1;
+ j1 = -l;
- while (k1 <= i1) {
- double d0 = Math.pow((double) Math.abs(j1) + 0.5D, 2.0D) + Math.pow((double) Math.abs(k1) + 0.5D, 2.0D);
+ while (j1 <= l) {
+ double d0 = Math.pow((double) Math.abs(i1) + 0.5D, 2.0D) + Math.pow((double) Math.abs(j1) + 0.5D, 2.0D);
if (d0 > (double) (f * f)) {
- ++k1;
+ ++j1;
} else {
- aint1[b2] = aint[b2] + k1;
- int l1 = this.world.getTypeId(aint1[0], aint1[1], aint1[2]);
+ aint1[b2] = aint[b2] + j1;
+ Block block1 = this.world.getType(aint1[0], aint1[1], aint1[2]);
- if (l1 != 0 && l1 != Block.LEAVES.id) {
- ++k1;
+ if (block1.getMaterial() != Material.AIR && block1.getMaterial() != Material.LEAVES) {
+ ++j1;
} else {
- this.setTypeAndData(this.world, aint1[0], aint1[1], aint1[2], l, 0);
- ++k1;
+ this.setTypeAndData(this.world, aint1[0], aint1[1], aint1[2], block, 0);
+ ++j1;
}
}
}
@@ -160,11 +160,11 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
for (int i1 = j + this.n; l < i1; ++l) {
float f = this.b(l - j);
- this.a(i, l, k, f, (byte) 1, Block.LEAVES.id);
+ this.a(i, l, k, f, (byte) 1, Blocks.LEAVES);
}
}
- void a(int[] aint, int[] aint1, int i) {
+ void a(int[] aint, int[] aint1, Block block) {
int[] aint2 = new int[] { 0, 0, 0};
byte b0 = 0;
@@ -191,26 +191,26 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
double d0 = (double) aint2[b2] / (double) aint2[b1];
double d1 = (double) aint2[b3] / (double) aint2[b1];
int[] aint3 = new int[] { 0, 0, 0};
- int j = 0;
+ int i = 0;
- for (int k = aint2[b1] + b4; j != k; j += b4) {
- aint3[b1] = MathHelper.floor((double) (aint[b1] + j) + 0.5D);
- aint3[b2] = MathHelper.floor((double) aint[b2] + (double) j * d0 + 0.5D);
- aint3[b3] = MathHelper.floor((double) aint[b3] + (double) j * d1 + 0.5D);
+ for (int j = aint2[b1] + b4; i != j; i += b4) {
+ aint3[b1] = MathHelper.floor((double) (aint[b1] + i) + 0.5D);
+ aint3[b2] = MathHelper.floor((double) aint[b2] + (double) i * d0 + 0.5D);
+ aint3[b3] = MathHelper.floor((double) aint[b3] + (double) i * d1 + 0.5D);
byte b5 = 0;
- int l = Math.abs(aint3[0] - aint[0]);
- int i1 = Math.abs(aint3[2] - aint[2]);
- int j1 = Math.max(l, i1);
+ int k = Math.abs(aint3[0] - aint[0]);
+ int l = Math.abs(aint3[2] - aint[2]);
+ int i1 = Math.max(k, l);
- if (j1 > 0) {
- if (l == j1) {
+ if (i1 > 0) {
+ if (k == i1) {
b5 = 4;
- } else if (i1 == j1) {
+ } else if (l == i1) {
b5 = 8;
}
}
- this.setTypeAndData(this.world, aint3[0], aint3[1], aint3[2], i, b5);
+ this.setTypeAndData(this.world, aint3[0], aint3[1], aint3[2], block, b5);
}
}
}
@@ -239,17 +239,17 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
int[] aint = new int[] { i, j, l};
int[] aint1 = new int[] { i, k, l};
- this.a(aint, aint1, Block.LOG.id);
+ this.a(aint, aint1, Blocks.LOG);
if (this.l == 2) {
++aint[0];
++aint1[0];
- this.a(aint, aint1, Block.LOG.id);
+ this.a(aint, aint1, Blocks.LOG);
++aint[2];
++aint1[2];
- this.a(aint, aint1, Block.LOG.id);
+ this.a(aint, aint1, Blocks.LOG);
aint[0] += -1;
aint1[0] += -1;
- this.a(aint, aint1, Block.LOG.id);
+ this.a(aint, aint1, Blocks.LOG);
}
}
@@ -265,7 +265,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
int k = aint[1] - this.d[1];
if (this.c(k)) {
- this.a(aint, aint2, (byte) Block.LOG.id);
+ this.a(aint, aint2, Blocks.LOG);
}
}
}
@@ -307,9 +307,9 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
aint3[b1] = aint[b1] + i;
aint3[b2] = MathHelper.floor((double) aint[b2] + (double) i * d0);
aint3[b3] = MathHelper.floor((double) aint[b3] + (double) i * d1);
- int k = this.world.getTypeId(aint3[0], aint3[1], aint3[2]);
+ Block block = this.world.getType(aint3[0], aint3[1], aint3[2]);
- if ((k != 0 && k != Block.LEAVES.id) || aint3[1] >= 256) { // CraftBukkit - fix trees wrapping around
+ if (!this.a(block) || aint[1] >= 256) { // CraftBukkit - fix trees wrapping around
break;
}
}
@@ -321,19 +321,19 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
boolean e() {
int[] aint = new int[] { this.d[0], this.d[1], this.d[2]};
int[] aint1 = new int[] { this.d[0], this.d[1] + this.e - 1, this.d[2]};
- int i = this.world.getTypeId(this.d[0], this.d[1] - 1, this.d[2]);
+ Block block = this.world.getType(this.d[0], this.d[1] - 1, this.d[2]);
- if (i != 2 && i != 3) {
+ if (block != Blocks.DIRT && block != Blocks.GRASS && block != Blocks.SOIL) {
return false;
} else {
- int j = this.a(aint, aint1);
+ int i = this.a(aint, aint1);
- if (j == -1) {
+ if (i == -1) {
return true;
- } else if (j < 6) {
+ } else if (i < 6) {
return false;
} else {
- this.e = j;
+ this.e = i;
return true;
}
}
@@ -355,10 +355,10 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
// 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
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
this.world = world;
long l = random.nextLong();
diff --git a/src/main/java/net/minecraft/server/WorldGenForest.java b/src/main/java/net/minecraft/server/WorldGenForest.java
index 993be98edb..25f4549a30 100644
--- a/src/main/java/net/minecraft/server/WorldGenForest.java
+++ b/src/main/java/net/minecraft/server/WorldGenForest.java
@@ -2,46 +2,53 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenForest extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenForest extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
- public WorldGenForest(boolean flag) {
+ private boolean a;
+
+ public WorldGenForest(boolean flag, boolean flag1) {
super(flag);
+ this.a = flag1;
}
public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - Moved to generate
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
int l = random.nextInt(3) + 5;
+
+ if (this.a) {
+ l += random.nextInt(7);
+ }
+
boolean flag = true;
if (j >= 1 && j + l + 1 <= 256) {
int i1;
int j1;
- int k1;
- int l1;
- for (i1 = j; i1 <= j + 1 + l; ++i1) {
+ for (int k1 = j; k1 <= j + 1 + l; ++k1) {
byte b0 = 1;
- if (i1 == j) {
+ if (k1 == j) {
b0 = 0;
}
- if (i1 >= j + 1 + l - 2) {
+ if (k1 >= j + 1 + l - 2) {
b0 = 2;
}
- for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
- for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
- if (i1 >= 0 && i1 < 256) {
- l1 = world.getTypeId(j1, i1, k1);
- if (l1 != 0 && l1 != Block.LEAVES.id) {
+ for (i1 = i - b0; i1 <= i + b0 && flag; ++i1) {
+ for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) {
+ if (k1 >= 0 && k1 < 256) {
+ Block block = world.getType(i1, k1, j1);
+
+ if (!this.a(block)) {
flag = false;
}
} else {
@@ -54,37 +61,39 @@ public class WorldGenForest extends WorldGenerator implements BlockSapling.TreeG
if (!flag) {
return false;
} else {
- i1 = world.getTypeId(i, j - 1, k);
- if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 256 - l - 1) {
- this.setType(world, i, j - 1, k, Block.DIRT.id);
+ Block block1 = world.getType(i, j - 1, k);
- int i2;
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT || block1 == Blocks.SOIL) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
- for (i2 = j - 3 + l; i2 <= j + l; ++i2) {
- j1 = i2 - (j + l);
- k1 = 1 - j1 / 2;
+ int l1;
- for (l1 = i - k1; l1 <= i + k1; ++l1) {
- int j2 = l1 - i;
+ for (l1 = j - 3 + l; l1 <= j + l; ++l1) {
+ i1 = l1 - (j + l);
+ j1 = 1 - i1 / 2;
- for (int k2 = k - k1; k2 <= k + k1; ++k2) {
+ for (int i2 = i - j1; i2 <= i + j1; ++i2) {
+ int j2 = i2 - i;
+
+ for (int k2 = k - j1; k2 <= k + j1; ++k2) {
int l2 = k2 - k;
- if (Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) {
- int i3 = world.getTypeId(l1, i2, k2);
+ if (Math.abs(j2) != j1 || Math.abs(l2) != j1 || random.nextInt(2) != 0 && i1 != 0) {
+ Block block2 = world.getType(i2, l1, k2);
- if (i3 == 0 || i3 == Block.LEAVES.id) {
- this.setTypeAndData(world, l1, i2, k2, Block.LEAVES.id, 2);
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i2, l1, k2, Blocks.LEAVES, 2);
}
}
}
}
}
- for (i2 = 0; i2 < l; ++i2) {
- j1 = world.getTypeId(i, j + i2, k);
- if (j1 == 0 || j1 == Block.LEAVES.id) {
- this.setTypeAndData(world, i, j + i2, k, Block.LOG.id, 2);
+ for (l1 = 0; l1 < l; ++l1) {
+ Block block3 = world.getType(i, j + l1, k);
+
+ if (block3.getMaterial() == Material.AIR || block3.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + l1, k, Blocks.LOG, 2);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenForestTree.java b/src/main/java/net/minecraft/server/WorldGenForestTree.java
new file mode 100644
index 0000000000..71ce9734a8
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenForestTree.java
@@ -0,0 +1,175 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
+
+public class WorldGenForestTree extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
+
+ public WorldGenForestTree(boolean flag) {
+ super(flag);
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ // CraftBukkit start - Moved to generate
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
+ }
+
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
+ // CraftBukkit end
+ int l = random.nextInt(3) + random.nextInt(2) + 6;
+ boolean flag = true;
+
+ if (j >= 1 && j + l + 1 <= 256) {
+ int i1;
+ int j1;
+
+ for (int k1 = j; k1 <= j + 1 + l; ++k1) {
+ byte b0 = 1;
+
+ if (k1 == j) {
+ b0 = 0;
+ }
+
+ if (k1 >= j + 1 + l - 2) {
+ b0 = 2;
+ }
+
+ for (i1 = i - b0; i1 <= i + b0 && flag; ++i1) {
+ for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) {
+ if (k1 >= 0 && k1 < 256) {
+ Block block = world.getType(i1, k1, j1);
+
+ if (!this.a(block)) {
+ flag = false;
+ }
+ } else {
+ flag = false;
+ }
+ }
+ }
+ }
+
+ if (!flag) {
+ return false;
+ } else {
+ Block block1 = world.getType(i, j - 1, k);
+
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
+ this.setType(world, i + 1, j - 1, k, Blocks.DIRT);
+ this.setType(world, i + 1, j - 1, k + 1, Blocks.DIRT);
+ this.setType(world, i, j - 1, k + 1, Blocks.DIRT);
+ int l1 = random.nextInt(4);
+
+ i1 = l - random.nextInt(4);
+ j1 = 2 - random.nextInt(3);
+ int i2 = i;
+ int j2 = k;
+ int k2 = 0;
+
+ int l2;
+ int i3;
+
+ for (l2 = 0; l2 < l; ++l2) {
+ i3 = j + l2;
+ if (l2 >= i1 && j1 > 0) {
+ i2 += Direction.a[l1];
+ j2 += Direction.b[l1];
+ --j1;
+ }
+
+ Block block2 = world.getType(i2, i3, j2);
+
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i2, i3, j2, Blocks.LOG2, 1);
+ this.setTypeAndData(world, i2 + 1, i3, j2, Blocks.LOG2, 1);
+ this.setTypeAndData(world, i2, i3, j2 + 1, Blocks.LOG2, 1);
+ this.setTypeAndData(world, i2 + 1, i3, j2 + 1, Blocks.LOG2, 1);
+ k2 = i3;
+ }
+ }
+
+ for (l2 = -2; l2 <= 0; ++l2) {
+ for (i3 = -2; i3 <= 0; ++i3) {
+ byte b1 = -1;
+
+ this.a(world, i2 + l2, k2 + b1, j2 + i3);
+ this.a(world, 1 + i2 - l2, k2 + b1, j2 + i3);
+ this.a(world, i2 + l2, k2 + b1, 1 + j2 - i3);
+ this.a(world, 1 + i2 - l2, k2 + b1, 1 + j2 - i3);
+ if ((l2 > -2 || i3 > -1) && (l2 != -1 || i3 != -2)) {
+ byte b2 = 1;
+
+ this.a(world, i2 + l2, k2 + b2, j2 + i3);
+ this.a(world, 1 + i2 - l2, k2 + b2, j2 + i3);
+ this.a(world, i2 + l2, k2 + b2, 1 + j2 - i3);
+ this.a(world, 1 + i2 - l2, k2 + b2, 1 + j2 - i3);
+ }
+ }
+ }
+
+ if (random.nextBoolean()) {
+ this.a(world, i2, k2 + 2, j2);
+ this.a(world, i2 + 1, k2 + 2, j2);
+ this.a(world, i2 + 1, k2 + 2, j2 + 1);
+ this.a(world, i2, k2 + 2, j2 + 1);
+ }
+
+ for (l2 = -3; l2 <= 4; ++l2) {
+ for (i3 = -3; i3 <= 4; ++i3) {
+ if ((l2 != -3 || i3 != -3) && (l2 != -3 || i3 != 4) && (l2 != 4 || i3 != -3) && (l2 != 4 || i3 != 4) && (Math.abs(l2) < 3 || Math.abs(i3) < 3)) {
+ this.a(world, i2 + l2, k2, j2 + i3);
+ }
+ }
+ }
+
+ for (l2 = -1; l2 <= 2; ++l2) {
+ for (i3 = -1; i3 <= 2; ++i3) {
+ if ((l2 < 0 || l2 > 1 || i3 < 0 || i3 > 1) && random.nextInt(3) <= 0) {
+ int j3 = random.nextInt(3) + 2;
+
+ int k3;
+
+ for (k3 = 0; k3 < j3; ++k3) {
+ this.setTypeAndData(world, i + l2, k2 - k3 - 1, k + i3, Blocks.LOG2, 1);
+ }
+
+ int l3;
+
+ for (k3 = -1; k3 <= 1; ++k3) {
+ for (l3 = -1; l3 <= 1; ++l3) {
+ this.a(world, i2 + l2 + k3, k2 - 0, j2 + i3 + l3);
+ }
+ }
+
+ for (k3 = -2; k3 <= 2; ++k3) {
+ for (l3 = -2; l3 <= 2; ++l3) {
+ if (Math.abs(k3) != 2 || Math.abs(l3) != 2) {
+ this.a(world, i2 + l2 + k3, k2 - 1, j2 + i3 + l3);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+
+ // CraftBukkit - Changed signature
+ private void a(CraftBlockChangeDelegate world, int i, int j, int k) {
+ Block block = world.getType(i, j, k);
+
+ if (block.getMaterial() == Material.AIR) {
+ this.setTypeAndData(world, i, j, k, Blocks.LEAVES2, 1);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
index eb0240d5d3..5d70f55a2f 100644
--- a/src/main/java/net/minecraft/server/WorldGenGroundBush.java
+++ b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
@@ -2,49 +2,51 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenGroundBush extends WorldGenTrees {
private int a;
private int b;
public WorldGenGroundBush(int i, int j) {
+ super(false);
this.b = i;
this.a = j;
}
public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - Moved to generate
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ @Override
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
- int l;
+ Block block;
- for (boolean flag = false; ((l = world.getTypeId(i, j, k)) == 0 || l == Block.LEAVES.id) && j > 0; --j) {
- ;
+ while (((block = world.getType(i, j, k)).getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) && j > 0) {
+ --j;
}
- int i1 = world.getTypeId(i, j, k);
+ Block block1 = world.getType(i, j, k);
- if (i1 == Block.DIRT.id || i1 == Block.GRASS.id) {
+ if (block1 == Blocks.DIRT || block1 == Blocks.GRASS) {
++j;
- this.setTypeAndData(world, i, j, k, Block.LOG.id, this.b);
+ this.setTypeAndData(world, i, j, k, Blocks.LOG, this.b);
- for (int j1 = j; j1 <= j + 2; ++j1) {
- int k1 = j1 - j;
- int l1 = 2 - k1;
+ for (int l = j; l <= j + 2; ++l) {
+ int i1 = l - j;
+ int j1 = 2 - i1;
- for (int i2 = i - l1; i2 <= i + l1; ++i2) {
- int j2 = i2 - i;
+ for (int k1 = i - j1; k1 <= i + j1; ++k1) {
+ int l1 = k1 - i;
- for (int k2 = k - l1; k2 <= k + l1; ++k2) {
- int l2 = k2 - k;
+ for (int i2 = k - j1; i2 <= k + j1; ++i2) {
+ int j2 = i2 - k;
- if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && !Block.t[world.getTypeId(i2, j1, k2)]) {
- this.setTypeAndData(world, i2, j1, k2, Block.LEAVES.id, this.a);
+ if ((Math.abs(l1) != j1 || Math.abs(j2) != j1 || random.nextInt(2) != 0) && !world.getType(k1, l, i2).j()) {
+ this.setTypeAndData(world, k1, l, i2, Blocks.LEAVES, this.a);
}
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
index 303644f9f8..160fc7ed19 100644
--- a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
+++ b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
@@ -3,7 +3,7 @@ package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
-import org.bukkit.BlockChangeDelegate;
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate;
import org.bukkit.block.BlockState;
import org.bukkit.material.MaterialData;
// CraftBukkit end
@@ -23,14 +23,14 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
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);
+ return grow(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k, null, null, null);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
return grow(world, random, i, j, k, null, null, null);
}
- public boolean grow(BlockChangeDelegate world, Random random, int i, int j, int k, org.bukkit.event.world.StructureGrowEvent event, ItemStack itemstack, org.bukkit.craftbukkit.CraftWorld bukkitWorld) {
+ public boolean grow(CraftBlockChangeDelegate world, Random random, int i, int j, int k, org.bukkit.event.world.StructureGrowEvent event, ItemStack itemstack, org.bukkit.craftbukkit.CraftWorld bukkitWorld) {
// CraftBukkit end
int l = random.nextInt(2);
@@ -44,21 +44,20 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
if (j >= 1 && j + i1 + 1 < 256) {
int j1;
int k1;
- int l1;
- int i2;
- for (j1 = j; j1 <= j + 1 + i1; ++j1) {
+ for (int l1 = j; l1 <= j + 1 + i1; ++l1) {
byte b0 = 3;
- if (j1 <= j + 3) {
+ if (l1 <= j + 3) {
b0 = 0;
}
- for (k1 = i - b0; k1 <= i + b0 && flag; ++k1) {
- for (l1 = k - b0; l1 <= k + b0 && flag; ++l1) {
- if (j1 >= 0 && j1 < 256) {
- i2 = world.getTypeId(k1, j1, l1);
- if (i2 != 0 && i2 != Block.LEAVES.id) {
+ for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
+ for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
+ if (l1 >= 0 && l1 < 256) {
+ Block block = world.getType(j1, l1, k1);
+
+ if (block.getMaterial() != Material.AIR && block.getMaterial() != Material.LEAVES) {
flag = false;
}
} else {
@@ -71,105 +70,107 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
if (!flag) {
return false;
} else {
- j1 = world.getTypeId(i, j - 1, k);
- if (j1 != Block.DIRT.id && j1 != Block.GRASS.id && j1 != Block.MYCEL.id) {
+ Block block1 = world.getType(i, j - 1, k);
+
+ if (block1 != Blocks.DIRT && block1 != Blocks.GRASS && block1 != Blocks.MYCEL) {
return false;
} else {
// CraftBukkit start
if (event == null) {
- this.setTypeAndData(world, i, j - 1, k, Block.DIRT.id, 0);
+ this.setTypeAndData(world, i, j - 1, k, Blocks.DIRT, 0);
} else {
BlockState dirtState = bukkitWorld.getBlockAt(i, j - 1, k).getState();
- dirtState.setTypeId(Block.DIRT.id);
+ dirtState.setTypeId(Block.b(Blocks.DIRT));
event.getBlocks().add(dirtState);
}
// CraftBukkit end
- int j2 = j + i1;
+
+ int i2 = j + i1;
if (l == 1) {
- j2 = j + i1 - 3;
+ i2 = j + i1 - 3;
}
- for (k1 = j2; k1 <= j + i1; ++k1) {
- l1 = 1;
- if (k1 < j + i1) {
- ++l1;
+ for (j1 = i2; j1 <= j + i1; ++j1) {
+ k1 = 1;
+ if (j1 < j + i1) {
+ ++k1;
}
if (l == 0) {
- l1 = 3;
+ k1 = 3;
}
- for (i2 = i - l1; i2 <= i + l1; ++i2) {
- for (int k2 = k - l1; k2 <= k + l1; ++k2) {
+ for (int j2 = i - k1; j2 <= i + k1; ++j2) {
+ for (int k2 = k - k1; k2 <= k + k1; ++k2) {
int l2 = 5;
- if (i2 == i - l1) {
+ if (j2 == i - k1) {
--l2;
}
- if (i2 == i + l1) {
+ if (j2 == i + k1) {
++l2;
}
- if (k2 == k - l1) {
+ if (k2 == k - k1) {
l2 -= 3;
}
- if (k2 == k + l1) {
+ if (k2 == k + k1) {
l2 += 3;
}
- if (l == 0 || k1 < j + i1) {
- if ((i2 == i - l1 || i2 == i + l1) && (k2 == k - l1 || k2 == k + l1)) {
+ if (l == 0 || j1 < j + i1) {
+ if ((j2 == i - k1 || j2 == i + k1) && (k2 == k - k1 || k2 == k + k1)) {
continue;
}
- if (i2 == i - (l1 - 1) && k2 == k - l1) {
+ if (j2 == i - (k1 - 1) && k2 == k - k1) {
l2 = 1;
}
- if (i2 == i - l1 && k2 == k - (l1 - 1)) {
+ if (j2 == i - k1 && k2 == k - (k1 - 1)) {
l2 = 1;
}
- if (i2 == i + (l1 - 1) && k2 == k - l1) {
+ if (j2 == i + (k1 - 1) && k2 == k - k1) {
l2 = 3;
}
- if (i2 == i + l1 && k2 == k - (l1 - 1)) {
+ if (j2 == i + k1 && k2 == k - (k1 - 1)) {
l2 = 3;
}
- if (i2 == i - (l1 - 1) && k2 == k + l1) {
+ if (j2 == i - (k1 - 1) && k2 == k + k1) {
l2 = 7;
}
- if (i2 == i - l1 && k2 == k + (l1 - 1)) {
+ if (j2 == i - k1 && k2 == k + (k1 - 1)) {
l2 = 7;
}
- if (i2 == i + (l1 - 1) && k2 == k + l1) {
+ if (j2 == i + (k1 - 1) && k2 == k + k1) {
l2 = 9;
}
- if (i2 == i + l1 && k2 == k + (l1 - 1)) {
+ if (j2 == i + k1 && k2 == k + (k1 - 1)) {
l2 = 9;
}
}
- if (l2 == 5 && k1 < j + i1) {
+ if (l2 == 5 && j1 < j + i1) {
l2 = 0;
}
- if ((l2 != 0 || j >= j + i1 - 1) && !Block.t[world.getTypeId(i2, k1, k2)]) {
+ if ((l2 != 0 || j >= j + i1 - 1) && !world.getType(j2, j1, k2).j()) {
// CraftBukkit start
if (event == null) {
- this.setTypeAndData(world, i2, k1, k2, Block.BIG_MUSHROOM_1.id + l, l2);
+ this.setTypeAndData(world, j2, j1, k2, Block.e(Block.b(Blocks.BIG_MUSHROOM_1) + l), l2);
} else {
BlockState state = bukkitWorld.getBlockAt(i2, k1, k2).getState();
- state.setTypeId(Block.BIG_MUSHROOM_1.id + l);
- state.setData(new MaterialData(Block.BIG_MUSHROOM_1.id + l, (byte) l2));
+ state.setTypeId(Block.b(Blocks.BIG_MUSHROOM_1) + l);
+ state.setData(new MaterialData(Block.b(Blocks.BIG_MUSHROOM_1) + l, (byte) l2));
event.getBlocks().add(state);
}
// CraftBukkit end
@@ -178,16 +179,17 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
}
}
- for (k1 = 0; k1 < i1; ++k1) {
- l1 = world.getTypeId(i, j + k1, k);
- if (!Block.t[l1]) {
+ for (j1 = 0; j1 < i1; ++j1) {
+ Block block2 = world.getType(i, j + j1, k);
+
+ if (!block2.j()) {
// CraftBukkit start
if (event == null) {
- this.setTypeAndData(world, i, j + k1, k, Block.BIG_MUSHROOM_1.id + l, 10);
+ this.setTypeAndData(world, i, j + j1, k, Block.e(Block.b(Blocks.BIG_MUSHROOM_1) + l), 10);
} else {
- BlockState state = bukkitWorld.getBlockAt(i, j + k1, k).getState();
- state.setTypeId(Block.BIG_MUSHROOM_1.id + l);
- state.setData(new MaterialData(Block.BIG_MUSHROOM_1.id + l, (byte) 10));
+ BlockState state = bukkitWorld.getBlockAt(i, j + j1, k).getState();
+ state.setTypeId(Block.b(Blocks.BIG_MUSHROOM_1) + l);
+ state.setData(new MaterialData(Block.b(Blocks.BIG_MUSHROOM_1) + l, (byte) 10));
event.getBlocks().add(state);
}
// CraftBukkit end
@@ -203,7 +205,6 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
}
}
// CraftBukkit end
-
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenJungleTree.java b/src/main/java/net/minecraft/server/WorldGenJungleTree.java
new file mode 100644
index 0000000000..182232d71d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenJungleTree.java
@@ -0,0 +1,124 @@
+package net.minecraft.server;
+
+import java.util.Random;
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
+
+public class WorldGenJungleTree extends WorldGenMegaTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
+
+ public WorldGenJungleTree(boolean flag, int i, int j, int k, int l) {
+ super(flag, i, j, k, l);
+ }
+
+ public boolean a(World world, Random random, int i, int j, int k) {
+ // CraftBukkit start - Moved to generate
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
+ }
+
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
+ // CraftBukkit end
+ int l = this.a(random);
+
+ if (!this.a(world, random, i, j, k, l)) {
+ return false;
+ } else {
+ this.c(world, i, k, j + l, 2, random);
+
+ for (int i1 = j + l - 2 - random.nextInt(4); i1 > j + l / 2; i1 -= 2 + random.nextInt(4)) {
+ float f = random.nextFloat() * 3.1415927F * 2.0F;
+ int j1 = i + (int) (0.5F + MathHelper.cos(f) * 4.0F);
+ int k1 = k + (int) (0.5F + MathHelper.sin(f) * 4.0F);
+
+ int l1;
+
+ for (l1 = 0; l1 < 5; ++l1) {
+ j1 = i + (int) (1.5F + MathHelper.cos(f) * (float) l1);
+ k1 = k + (int) (1.5F + MathHelper.sin(f) * (float) l1);
+ this.setTypeAndData(world, j1, i1 - 3 + l1 / 2, k1, Blocks.LOG, this.b);
+ }
+
+ l1 = 1 + random.nextInt(2);
+ int i2 = i1;
+
+ for (int j2 = i1 - l1; j2 <= i2; ++j2) {
+ int k2 = j2 - i2;
+
+ this.b(world, j1, j2, k1, 1 - k2, random);
+ }
+ }
+
+ for (int l2 = 0; l2 < l; ++l2) {
+ Block block = world.getType(i, j + l2, k);
+
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + l2, k, Blocks.LOG, this.b);
+ if (l2 > 0) {
+ if (random.nextInt(3) > 0 && world.isEmpty(i - 1, j + l2, k)) {
+ this.setTypeAndData(world, i - 1, j + l2, k, Blocks.VINE, 8);
+ }
+
+ if (random.nextInt(3) > 0 && world.isEmpty(i, j + l2, k - 1)) {
+ this.setTypeAndData(world, i, j + l2, k - 1, Blocks.VINE, 1);
+ }
+ }
+ }
+
+ if (l2 < l - 1) {
+ block = world.getType(i + 1, j + l2, k);
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i + 1, j + l2, k, Blocks.LOG, this.b);
+ if (l2 > 0) {
+ if (random.nextInt(3) > 0 && world.isEmpty(i + 2, j + l2, k)) {
+ this.setTypeAndData(world, i + 2, j + l2, k, Blocks.VINE, 2);
+ }
+
+ if (random.nextInt(3) > 0 && world.isEmpty(i + 1, j + l2, k - 1)) {
+ this.setTypeAndData(world, i + 1, j + l2, k - 1, Blocks.VINE, 1);
+ }
+ }
+ }
+
+ block = world.getType(i + 1, j + l2, k + 1);
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i + 1, j + l2, k + 1, Blocks.LOG, this.b);
+ if (l2 > 0) {
+ if (random.nextInt(3) > 0 && world.isEmpty(i + 2, j + l2, k + 1)) {
+ this.setTypeAndData(world, i + 2, j + l2, k + 1, Blocks.VINE, 2);
+ }
+
+ if (random.nextInt(3) > 0 && world.isEmpty(i + 1, j + l2, k + 2)) {
+ this.setTypeAndData(world, i + 1, j + l2, k + 2, Blocks.VINE, 4);
+ }
+ }
+ }
+
+ block = world.getType(i, j + l2, k + 1);
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + l2, k + 1, Blocks.LOG, this.b);
+ if (l2 > 0) {
+ if (random.nextInt(3) > 0 && world.isEmpty(i - 1, j + l2, k + 1)) {
+ this.setTypeAndData(world, i - 1, j + l2, k + 1, Blocks.VINE, 8);
+ }
+
+ if (random.nextInt(3) > 0 && world.isEmpty(i, j + l2, k + 2)) {
+ this.setTypeAndData(world, i, j + l2, k + 2, Blocks.VINE, 4);
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+
+ // CraftBukkit - Changed signature
+ private void c(CraftBlockChangeDelegate world, int i, int j, int k, int l, Random random) {
+ byte b0 = 2;
+
+ for (int i1 = k - b0; i1 <= k; ++i1) {
+ int j1 = i1 - k;
+
+ this.a(world, i, i1, j, l + 1 - j1, random);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenMegaTree.java b/src/main/java/net/minecraft/server/WorldGenMegaTree.java
index 6ffae2fb78..f83894f591 100644
--- a/src/main/java/net/minecraft/server/WorldGenMegaTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenMegaTree.java
@@ -2,180 +2,123 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenMegaTree extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenMegaTree extends WorldGenMegaTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
- private final int a;
- private final int b;
- private final int c;
+ private boolean e;
- public WorldGenMegaTree(boolean flag, int i, int j, int k) {
- super(flag);
- this.a = i;
- this.b = j;
- this.c = k;
+ public WorldGenMegaTree(boolean flag, boolean flag1) {
+ super(flag, 13, 15, 1, 1);
+ this.e = flag1;
}
public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - Moved to generate
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
- int l = random.nextInt(3) + this.a;
- boolean flag = true;
+ int l = this.a(random);
- if (j >= 1 && j + l + 1 <= 256) {
- int i1;
- int j1;
- int k1;
- int l1;
-
- for (i1 = j; i1 <= j + 1 + l; ++i1) {
- byte b0 = 2;
-
- if (i1 == j) {
- b0 = 1;
- }
-
- if (i1 >= j + 1 + l - 2) {
- b0 = 2;
- }
-
- for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
- for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
- if (i1 >= 0 && i1 < 256) {
- l1 = world.getTypeId(j1, i1, k1);
- if (l1 != 0 && l1 != Block.LEAVES.id && l1 != Block.GRASS.id && l1 != Block.DIRT.id && l1 != Block.LOG.id && l1 != Block.SAPLING.id) {
- flag = false;
- }
- } else {
- flag = false;
- }
- }
- }
- }
-
- if (!flag) {
- return false;
- } else {
- i1 = world.getTypeId(i, j - 1, k);
- if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 256 - l - 1) {
- world.setTypeIdAndData(i, j - 1, k, Block.DIRT.id, 0);
- world.setTypeIdAndData(i + 1, j - 1, k, Block.DIRT.id, 0);
- world.setTypeIdAndData(i, j - 1, k + 1, Block.DIRT.id, 0);
- world.setTypeIdAndData(i + 1, j - 1, k + 1, Block.DIRT.id, 0);
- this.a(world, i, k, j + l, 2, random);
-
- for (int i2 = j + l - 2 - random.nextInt(4); i2 > j + l / 2; i2 -= 2 + random.nextInt(4)) {
- float f = random.nextFloat() * 3.1415927F * 2.0F;
-
- k1 = i + (int) (0.5F + MathHelper.cos(f) * 4.0F);
- l1 = k + (int) (0.5F + MathHelper.sin(f) * 4.0F);
- this.a(world, k1, l1, i2, 0, random);
-
- for (int j2 = 0; j2 < 5; ++j2) {
- k1 = i + (int) (1.5F + MathHelper.cos(f) * (float) j2);
- l1 = k + (int) (1.5F + MathHelper.sin(f) * (float) j2);
- this.setTypeAndData(world, k1, i2 - 3 + j2 / 2, l1, Block.LOG.id, this.b);
- }
- }
-
- for (j1 = 0; j1 < l; ++j1) {
- k1 = world.getTypeId(i, j + j1, k);
- if (k1 == 0 || k1 == Block.LEAVES.id) {
- this.setTypeAndData(world, i, j + j1, k, Block.LOG.id, this.b);
- if (j1 > 0) {
- if (random.nextInt(3) > 0 && world.isEmpty(i - 1, j + j1, k)) {
- this.setTypeAndData(world, i - 1, j + j1, k, Block.VINE.id, 8);
- }
-
- if (random.nextInt(3) > 0 && world.isEmpty(i, j + j1, k - 1)) {
- this.setTypeAndData(world, i, j + j1, k - 1, Block.VINE.id, 1);
- }
- }
- }
-
- if (j1 < l - 1) {
- k1 = world.getTypeId(i + 1, j + j1, k);
- if (k1 == 0 || k1 == Block.LEAVES.id) {
- this.setTypeAndData(world, i + 1, j + j1, k, Block.LOG.id, this.b);
- if (j1 > 0) {
- if (random.nextInt(3) > 0 && world.isEmpty(i + 2, j + j1, k)) {
- this.setTypeAndData(world, i + 2, j + j1, k, Block.VINE.id, 2);
- }
-
- if (random.nextInt(3) > 0 && world.isEmpty(i + 1, j + j1, k - 1)) {
- this.setTypeAndData(world, i + 1, j + j1, k - 1, Block.VINE.id, 1);
- }
- }
- }
-
- k1 = world.getTypeId(i + 1, j + j1, k + 1);
- if (k1 == 0 || k1 == Block.LEAVES.id) {
- this.setTypeAndData(world, i + 1, j + j1, k + 1, Block.LOG.id, this.b);
- if (j1 > 0) {
- if (random.nextInt(3) > 0 && world.isEmpty(i + 2, j + j1, k + 1)) {
- this.setTypeAndData(world, i + 2, j + j1, k + 1, Block.VINE.id, 2);
- }
-
- if (random.nextInt(3) > 0 && world.isEmpty(i + 1, j + j1, k + 2)) {
- this.setTypeAndData(world, i + 1, j + j1, k + 2, Block.VINE.id, 4);
- }
- }
- }
-
- k1 = world.getTypeId(i, j + j1, k + 1);
- if (k1 == 0 || k1 == Block.LEAVES.id) {
- this.setTypeAndData(world, i, j + j1, k + 1, Block.LOG.id, this.b);
- if (j1 > 0) {
- if (random.nextInt(3) > 0 && world.isEmpty(i - 1, j + j1, k + 1)) {
- this.setTypeAndData(world, i - 1, j + j1, k + 1, Block.VINE.id, 8);
- }
-
- if (random.nextInt(3) > 0 && world.isEmpty(i, j + j1, k + 2)) {
- this.setTypeAndData(world, i, j + j1, k + 2, Block.VINE.id, 4);
- }
- }
- }
- }
- }
-
- return true;
- } else {
- return false;
- }
- }
- } else {
+ if (!this.a(world, random, i, j, k, l)) {
return false;
+ } else {
+ this.c(world, i, k, j + l, 0, random);
+
+ for (int i1 = 0; i1 < l; ++i1) {
+ Block block = world.getType(i, j + i1, k);
+
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + i1, k, Blocks.LOG, this.b);
+ }
+
+ if (i1 < l - 1) {
+ block = world.getType(i + 1, j + i1, k);
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i + 1, j + i1, k, Blocks.LOG, this.b);
+ }
+
+ block = world.getType(i + 1, j + i1, k + 1);
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i + 1, j + i1, k + 1, Blocks.LOG, this.b);
+ }
+
+ block = world.getType(i, j + i1, k + 1);
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + i1, k + 1, Blocks.LOG, this.b);
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ // CraftBukkit - Changed signature
+ private void c(CraftBlockChangeDelegate world, int i, int j, int k, int l, Random random) {
+ int i1 = random.nextInt(5);
+
+ if (this.e) {
+ i1 += this.a;
+ } else {
+ i1 += 3;
+ }
+
+ int j1 = 0;
+
+ for (int k1 = k - i1; k1 <= k; ++k1) {
+ int l1 = k - k1;
+ int i2 = l + MathHelper.d((float) l1 / (float) i1 * 3.5F);
+
+ this.a(world, i, k1, j, i2 + (l1 > 0 && i2 == j1 && (k1 & 1) == 0 ? 1 : 0), random);
+ j1 = i2;
}
}
// CraftBukkit - Changed signature
- private void a(BlockChangeDelegate world, int i, int j, int k, int l, Random random) {
- byte b0 = 2;
+ public void b(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
+ this.c(world, random, i - 1, j, k - 1);
+ this.c(world, random, i + 2, j, k - 1);
+ this.c(world, random, i - 1, j, k + 2);
+ this.c(world, random, i + 2, j, k + 2);
- for (int i1 = k - b0; i1 <= k; ++i1) {
- int j1 = i1 - k;
- int k1 = l + 1 - j1;
+ for (int l = 0; l < 5; ++l) {
+ int i1 = random.nextInt(64);
+ int j1 = i1 % 8;
+ int k1 = i1 / 8;
- for (int l1 = i - k1; l1 <= i + k1 + 1; ++l1) {
- int i2 = l1 - i;
+ if (j1 == 0 || j1 == 7 || k1 == 0 || k1 == 7) {
+ this.c(world, random, i - 3 + j1, j, k - 3 + k1);
+ }
+ }
+ }
- for (int j2 = j - k1; j2 <= j + k1 + 1; ++j2) {
- int k2 = j2 - j;
-
- if ((i2 >= 0 || k2 >= 0 || i2 * i2 + k2 * k2 <= k1 * k1) && (i2 <= 0 && k2 <= 0 || i2 * i2 + k2 * k2 <= (k1 + 1) * (k1 + 1)) && (random.nextInt(4) != 0 || i2 * i2 + k2 * k2 <= (k1 - 1) * (k1 - 1))) {
- int l2 = world.getTypeId(l1, i1, j2);
-
- if (l2 == 0 || l2 == Block.LEAVES.id) {
- this.setTypeAndData(world, l1, i1, j2, Block.LEAVES.id, this.c);
- }
- }
+ // CraftBukkit - Changed signature
+ private void c(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
+ for (int l = -2; l <= 2; ++l) {
+ for (int i1 = -2; i1 <= 2; ++i1) {
+ if (Math.abs(l) != 2 || Math.abs(i1) != 2) {
+ this.a(world, i + l, j, k + i1);
}
}
}
}
+
+ // CraftBukkit - Changed signature
+ private void a(CraftBlockChangeDelegate world, int i, int j, int k) {
+ for (int l = j + 2; l >= j - 3; --l) {
+ Block block = world.getType(i, l, k);
+
+ if (block == Blocks.GRASS || block == Blocks.DIRT) {
+ this.setTypeAndData(world, i, l, k, Blocks.DIRT, 2);
+ break;
+ }
+
+ if (block.getMaterial() != Material.AIR && l < j) {
+ break;
+ }
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldGenMegaTreeAbstract.java b/src/main/java/net/minecraft/server/WorldGenMegaTreeAbstract.java
new file mode 100644
index 0000000000..cabbb9f5c6
--- /dev/null
+++ b/src/main/java/net/minecraft/server/WorldGenMegaTreeAbstract.java
@@ -0,0 +1,133 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
+
+public abstract class WorldGenMegaTreeAbstract extends WorldGenTreeAbstract {
+
+ protected final int a;
+ protected final int b;
+ protected final int c;
+ protected int d;
+
+ public WorldGenMegaTreeAbstract(boolean flag, int i, int j, int k, int l) {
+ super(flag);
+ this.a = i;
+ this.d = j;
+ this.b = k;
+ this.c = l;
+ }
+
+ protected int a(Random random) {
+ int i = random.nextInt(3) + this.a;
+
+ if (this.d > 1) {
+ i += random.nextInt(this.d);
+ }
+
+ return i;
+ }
+
+ // CraftBukkit - Changed world to CraftBlockChangeDelegate
+ private boolean b(CraftBlockChangeDelegate world, Random random, int i, int j, int k, int l) {
+ boolean flag = true;
+
+ if (j >= 1 && j + l + 1 <= 256) {
+ for (int i1 = j; i1 <= j + 1 + l; ++i1) {
+ byte b0 = 2;
+
+ if (i1 == j) {
+ b0 = 1;
+ }
+
+ if (i1 >= j + 1 + l - 2) {
+ b0 = 2;
+ }
+
+ for (int j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
+ for (int k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
+ if (i1 >= 0 && i1 < 256) {
+ Block block = world.getType(j1, i1, k1);
+
+ // CraftBukkit - ignore our own saplings
+ if (block != Blocks.SAPLING && !this.a(block)) {
+ flag = false;
+ }
+ } else {
+ flag = false;
+ }
+ }
+ }
+ }
+
+ return flag;
+ } else {
+ return false;
+ }
+ }
+
+ // CraftBukkit - Change world to CraftBlockChangeDelegate
+ private boolean c(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
+ Block block = world.getType(i, j - 1, k);
+
+ if ((block == Blocks.GRASS || block == Blocks.DIRT) && j >= 2) {
+ world.setTypeAndData(i, j - 1, k, Blocks.DIRT, 0, 2);
+ world.setTypeAndData(i + 1, j - 1, k, Blocks.DIRT, 0, 2);
+ world.setTypeAndData(i, j - 1, k + 1, Blocks.DIRT, 0, 2);
+ world.setTypeAndData(i + 1, j - 1, k + 1, Blocks.DIRT, 0, 2);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // CraftBukkit - Change world to CraftBlockChangeDelegate
+ protected boolean a(CraftBlockChangeDelegate world, Random random, int i, int j, int k, int l) {
+ return this.b(world, random, i, j, k, l) && this.c(world, random, i, j, k);
+ }
+
+ // CraftBukkit - Change world to CraftBlockChangeDelegate
+ protected void a(CraftBlockChangeDelegate world, int i, int j, int k, int l, Random random) {
+ int i1 = l * l;
+
+ for (int j1 = i - l; j1 <= i + l + 1; ++j1) {
+ int k1 = j1 - i;
+
+ for (int l1 = k - l; l1 <= k + l + 1; ++l1) {
+ int i2 = l1 - k;
+ int j2 = k1 - 1;
+ int k2 = i2 - 1;
+
+ if (k1 * k1 + i2 * i2 <= i1 || j2 * j2 + k2 * k2 <= i1 || k1 * k1 + k2 * k2 <= i1 || j2 * j2 + i2 * i2 <= i1) {
+ Block block = world.getType(j1, j, l1);
+
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, j1, j, l1, Blocks.LEAVES, this.c);
+ }
+ }
+ }
+ }
+ }
+
+ // CraftBukkit - Change world to CraftBlockChangeDelegate
+ protected void b(CraftBlockChangeDelegate world, int i, int j, int k, int l, Random random) {
+ int i1 = l * l;
+
+ for (int j1 = i - l; j1 <= i + l; ++j1) {
+ int k1 = j1 - i;
+
+ for (int l1 = k - l; l1 <= k + l; ++l1) {
+ int i2 = l1 - k;
+
+ if (k1 * k1 + i2 * i2 <= i1) {
+ Block block = world.getType(j1, j, l1);
+
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, j1, j, l1, Blocks.LEAVES, this.c);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/WorldGenSwampTree.java b/src/main/java/net/minecraft/server/WorldGenSwampTree.java
index 7f92b86d22..3f051648b5 100644
--- a/src/main/java/net/minecraft/server/WorldGenSwampTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenSwampTree.java
@@ -2,52 +2,53 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenSwampTree extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenSwampTree extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
- public WorldGenSwampTree() {}
+ public WorldGenSwampTree() {
+ super(false);
+ }
public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - Moved to generate
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate 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.getType(i, j - 1, k).getMaterial() == Material.WATER; --j) {
;
}
boolean flag = true;
- if (j >= 1 && j + l + 1 <= 128) {
+ if (j >= 1 && j + l + 1 <= 256) {
int i1;
int j1;
- int k1;
- int l1;
- for (i1 = j; i1 <= j + 1 + l; ++i1) {
+ for (int k1 = j; k1 <= j + 1 + l; ++k1) {
byte b0 = 1;
- if (i1 == j) {
+ if (k1 == j) {
b0 = 0;
}
- if (i1 >= j + 1 + l - 2) {
+ if (k1 >= j + 1 + l - 2) {
b0 = 3;
}
- for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) {
- for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) {
- if (i1 >= 0 && i1 < 128) {
- l1 = world.getTypeId(j1, i1, k1);
- if (l1 != 0 && l1 != Block.LEAVES.id) {
- if (l1 != Block.STATIONARY_WATER.id && l1 != Block.WATER.id) {
+ for (i1 = i - b0; i1 <= i + b0 && flag; ++i1) {
+ for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) {
+ if (k1 >= 0 && k1 < 256) {
+ Block block = world.getType(i1, k1, j1);
+
+ if (block.getMaterial() != Material.AIR && block.getMaterial() != Material.LEAVES) {
+ if (block != Blocks.STATIONARY_WATER && block != Blocks.WATER) {
flag = false;
- } else if (i1 > j) {
+ } else if (k1 > j) {
flag = false;
}
}
@@ -61,58 +62,61 @@ public class WorldGenSwampTree extends WorldGenerator implements BlockSapling.Tr
if (!flag) {
return false;
} else {
- i1 = world.getTypeId(i, j - 1, k);
- if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
- this.setType(world, i, j - 1, k, Block.DIRT.id);
+ Block block1 = world.getType(i, j - 1, k);
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
+
+ int l1;
int i2;
int j2;
for (j2 = j - 3 + l; j2 <= j + l; ++j2) {
- j1 = j2 - (j + l);
- k1 = 2 - j1 / 2;
+ i1 = j2 - (j + l);
+ j1 = 2 - i1 / 2;
- for (l1 = i - k1; l1 <= i + k1; ++l1) {
- i2 = l1 - i;
+ for (i2 = i - j1; i2 <= i + j1; ++i2) {
+ l1 = i2 - i;
- for (int k2 = k - k1; k2 <= k + k1; ++k2) {
+ for (int k2 = k - j1; k2 <= k + j1; ++k2) {
int l2 = k2 - k;
- if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.t[world.getTypeId(l1, j2, k2)]) {
- this.setType(world, l1, j2, k2, Block.LEAVES.id);
+ if ((Math.abs(l1) != j1 || Math.abs(l2) != j1 || random.nextInt(2) != 0 && i1 != 0) && !world.getType(i2, j2, k2).j()) {
+ this.setType(world, i2, j2, k2, Blocks.LEAVES);
}
}
}
}
for (j2 = 0; j2 < l; ++j2) {
- j1 = world.getTypeId(i, j + j2, k);
- if (j1 == 0 || j1 == Block.LEAVES.id || j1 == Block.WATER.id || j1 == Block.STATIONARY_WATER.id) {
- this.setType(world, i, j + j2, k, Block.LOG.id);
+ Block block2 = world.getType(i, j + j2, k);
+
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES || block2 == Blocks.WATER || block2 == Blocks.STATIONARY_WATER) {
+ this.setType(world, i, j + j2, k, Blocks.LOG);
}
}
for (j2 = j - 3 + l; j2 <= j + l; ++j2) {
- j1 = j2 - (j + l);
- k1 = 2 - j1 / 2;
+ i1 = j2 - (j + l);
+ j1 = 2 - i1 / 2;
- for (l1 = i - k1; l1 <= i + k1; ++l1) {
- for (i2 = k - k1; i2 <= k + k1; ++i2) {
- if (world.getTypeId(l1, j2, i2) == Block.LEAVES.id) {
- if (random.nextInt(4) == 0 && world.getTypeId(l1 - 1, j2, i2) == 0) {
- this.b(world, l1 - 1, j2, i2, 8);
+ for (i2 = i - j1; i2 <= i + j1; ++i2) {
+ for (l1 = k - j1; l1 <= k + j1; ++l1) {
+ if (world.getType(i2, j2, l1).getMaterial() == Material.LEAVES) {
+ if (random.nextInt(4) == 0 && world.getType(i2 - 1, j2, l1).getMaterial() == Material.AIR) {
+ this.a(world, i2 - 1, j2, l1, 8);
}
- if (random.nextInt(4) == 0 && world.getTypeId(l1 + 1, j2, i2) == 0) {
- this.b(world, l1 + 1, j2, i2, 2);
+ if (random.nextInt(4) == 0 && world.getType(i2 + 1, j2, l1).getMaterial() == Material.AIR) {
+ this.a(world, i2 + 1, j2, l1, 2);
}
- if (random.nextInt(4) == 0 && world.getTypeId(l1, j2, i2 - 1) == 0) {
- this.b(world, l1, j2, i2 - 1, 1);
+ if (random.nextInt(4) == 0 && world.getType(i2, j2, l1 - 1).getMaterial() == Material.AIR) {
+ this.a(world, i2, j2, l1 - 1, 1);
}
- if (random.nextInt(4) == 0 && world.getTypeId(l1, j2, i2 + 1) == 0) {
- this.b(world, l1, j2, i2 + 1, 4);
+ if (random.nextInt(4) == 0 && world.getType(i2, j2, l1 + 1).getMaterial() == Material.AIR) {
+ this.a(world, i2, j2, l1 + 1, 4);
}
}
}
@@ -130,17 +134,17 @@ public class WorldGenSwampTree extends WorldGenerator implements BlockSapling.Tr
}
// CraftBukkit - change signature
- private void b(BlockChangeDelegate world, int i, int j, int k, int l) {
- this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
+ private void a(CraftBlockChangeDelegate world, int i, int j, int k, int l) {
+ this.setTypeAndData(world, i, j, k, Blocks.VINE, l);
int i1 = 4;
while (true) {
--j;
- if (world.getTypeId(i, j, k) != 0 || i1 <= 0) {
+ if (world.getType(i, j, k).getMaterial() != Material.AIR || i1 <= 0) {
return;
}
- this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
+ this.setTypeAndData(world, i, j, k, Blocks.VINE, l);
--i1;
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga1.java b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
index e9a99b7b8b..c6bfc91ccc 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga1.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
@@ -2,18 +2,20 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenTaiga1 extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
- public WorldGenTaiga1() {}
+ public WorldGenTaiga1() {
+ super(false);
+ }
public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - Moved to generate
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
int l = random.nextInt(5) + 7;
int i1 = l - random.nextInt(2) - 3;
@@ -21,27 +23,26 @@ public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeG
int k1 = 1 + random.nextInt(j1 + 1);
boolean flag = true;
- if (j >= 1 && j + l + 1 <= 128) {
+ if (j >= 1 && j + l + 1 <= 256) {
int l1;
int i2;
int j2;
- int k2;
- int l2;
- for (l1 = j; l1 <= j + 1 + l && flag; ++l1) {
+ for (int k2 = j; k2 <= j + 1 + l && flag; ++k2) {
boolean flag1 = true;
- if (l1 - j < i1) {
- l2 = 0;
+ if (k2 - j < i1) {
+ j2 = 0;
} else {
- l2 = k1;
+ j2 = k1;
}
- for (i2 = i - l2; i2 <= i + l2 && flag; ++i2) {
- for (j2 = k - l2; j2 <= k + l2 && flag; ++j2) {
- if (l1 >= 0 && l1 < 128) {
- k2 = world.getTypeId(i2, l1, j2);
- if (k2 != 0 && k2 != Block.LEAVES.id) {
+ for (l1 = i - j2; l1 <= i + j2 && flag; ++l1) {
+ for (i2 = k - j2; i2 <= k + j2 && flag; ++i2) {
+ if (k2 >= 0 && k2 < 256) {
+ Block block = world.getType(l1, k2, i2);
+
+ if (!this.a(block)) {
flag = false;
}
} else {
@@ -54,35 +55,37 @@ public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeG
if (!flag) {
return false;
} else {
- l1 = world.getTypeId(i, j - 1, k);
- if ((l1 == Block.GRASS.id || l1 == Block.DIRT.id) && j < 128 - l - 1) {
- this.setType(world, i, j - 1, k, Block.DIRT.id);
- l2 = 0;
+ Block block1 = world.getType(i, j - 1, k);
- for (i2 = j + l; i2 >= j + i1; --i2) {
- for (j2 = i - l2; j2 <= i + l2; ++j2) {
- k2 = j2 - i;
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
+ j2 = 0;
- for (int i3 = k - l2; i3 <= k + l2; ++i3) {
+ for (l1 = j + l; l1 >= j + i1; --l1) {
+ for (i2 = i - j2; i2 <= i + j2; ++i2) {
+ int l2 = i2 - i;
+
+ for (int i3 = k - j2; i3 <= k + j2; ++i3) {
int j3 = i3 - k;
- if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.t[world.getTypeId(j2, i2, i3)]) {
- this.setTypeAndData(world, j2, i2, i3, Block.LEAVES.id, 1);
+ if ((Math.abs(l2) != j2 || Math.abs(j3) != j2 || j2 <= 0) && !world.getType(i2, l1, i3).j()) {
+ this.setTypeAndData(world, i2, l1, i3, Blocks.LEAVES, 1);
}
}
}
- if (l2 >= 1 && i2 == j + i1 + 1) {
- --l2;
- } else if (l2 < k1) {
- ++l2;
+ if (j2 >= 1 && l1 == j + i1 + 1) {
+ --j2;
+ } else if (j2 < k1) {
+ ++j2;
}
}
- for (i2 = 0; i2 < l - 1; ++i2) {
- j2 = world.getTypeId(i, j + i2, k);
- if (j2 == 0 || j2 == Block.LEAVES.id) {
- this.setTypeAndData(world, i, j + i2, k, Block.LOG.id, 1);
+ for (l1 = 0; l1 < l - 1; ++l1) {
+ Block block2 = world.getType(i, j + l1, k);
+
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + l1, k, Blocks.LOG, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
index 8d9ba5e99d..24fd27e141 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
@@ -2,9 +2,9 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenTaiga2 extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
public WorldGenTaiga2(boolean flag) {
super(flag);
@@ -12,10 +12,10 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG
public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - Moved to generate
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
int l = random.nextInt(4) + 6;
int i1 = 1 + random.nextInt(2);
@@ -26,23 +26,22 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG
if (j >= 1 && j + l + 1 <= 256) {
int l1;
int i2;
- int j2;
- int k2;
- for (l1 = j; l1 <= j + 1 + l && flag; ++l1) {
+ for (int j2 = j; j2 <= j + 1 + l && flag; ++j2) {
boolean flag1 = true;
- if (l1 - j < i1) {
- k2 = 0;
+ if (j2 - j < i1) {
+ i2 = 0;
} else {
- k2 = k1;
+ i2 = k1;
}
- for (i2 = i - k2; i2 <= i + k2 && flag; ++i2) {
- for (int l2 = k - k2; l2 <= k + k2 && flag; ++l2) {
- if (l1 >= 0 && l1 < 256) {
- j2 = world.getTypeId(i2, l1, l2);
- if (j2 != 0 && j2 != Block.LEAVES.id) {
+ for (l1 = i - i2; l1 <= i + i2 && flag; ++l1) {
+ for (int k2 = k - i2; k2 <= k + i2 && flag; ++k2) {
+ if (j2 >= 0 && j2 < 256) {
+ Block block = world.getType(l1, j2, k2);
+
+ if (block.getMaterial() != Material.AIR && block.getMaterial() != Material.LEAVES) {
flag = false;
}
} else {
@@ -55,49 +54,51 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG
if (!flag) {
return false;
} else {
- l1 = world.getTypeId(i, j - 1, k);
- if ((l1 == Block.GRASS.id || l1 == Block.DIRT.id) && j < 256 - l - 1) {
- this.setType(world, i, j - 1, k, Block.DIRT.id);
- k2 = random.nextInt(2);
- i2 = 1;
+ Block block1 = world.getType(i, j - 1, k);
+
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT || block1 == Blocks.SOIL) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
+ i2 = random.nextInt(2);
+ l1 = 1;
byte b0 = 0;
+ int l2;
int i3;
- int j3;
- for (j2 = 0; j2 <= j1; ++j2) {
- j3 = j + l - j2;
+ for (i3 = 0; i3 <= j1; ++i3) {
+ l2 = j + l - i3;
- for (i3 = i - k2; i3 <= i + k2; ++i3) {
- int k3 = i3 - i;
+ for (int j3 = i - i2; j3 <= i + i2; ++j3) {
+ int k3 = j3 - i;
- for (int l3 = k - k2; l3 <= k + k2; ++l3) {
+ for (int l3 = k - i2; l3 <= k + i2; ++l3) {
int i4 = l3 - k;
- if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.t[world.getTypeId(i3, j3, l3)]) {
- this.setTypeAndData(world, i3, j3, l3, Block.LEAVES.id, 1);
+ if ((Math.abs(k3) != i2 || Math.abs(i4) != i2 || i2 <= 0) && !world.getType(j3, l2, l3).j()) {
+ this.setTypeAndData(world, j3, l2, l3, Blocks.LEAVES, 1);
}
}
}
- if (k2 >= i2) {
- k2 = b0;
+ if (i2 >= l1) {
+ i2 = b0;
b0 = 1;
- ++i2;
- if (i2 > k1) {
- i2 = k1;
+ ++l1;
+ if (l1 > k1) {
+ l1 = k1;
}
} else {
- ++k2;
+ ++i2;
}
}
- j2 = random.nextInt(3);
+ i3 = random.nextInt(3);
- for (j3 = 0; j3 < l - j2; ++j3) {
- i3 = world.getTypeId(i, j + j3, k);
- if (i3 == 0 || i3 == Block.LEAVES.id) {
- this.setTypeAndData(world, i, j + j3, k, Block.LOG.id, 1);
+ for (l2 = 0; l2 < l - i3; ++l2) {
+ Block block2 = world.getType(i, j + l2, k);
+
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + l2, k, Blocks.LOG, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java
index 9354c865b2..065a3b2558 100644
--- a/src/main/java/net/minecraft/server/WorldGenTrees.java
+++ b/src/main/java/net/minecraft/server/WorldGenTrees.java
@@ -2,9 +2,9 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
-public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGenerator { // CraftBukkit add interface
+public class WorldGenTrees extends WorldGenTreeAbstract implements BlockSapling.TreeGenerator { // CraftBukkit - add interface
private final int a;
private final boolean b;
@@ -25,35 +25,34 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe
public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - Moved to generate
- return this.generate((BlockChangeDelegate) world, random, i, j, k);
+ return this.generate(new CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k);
}
- public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
+ public boolean generate(CraftBlockChangeDelegate world, Random random, int i, int j, int k) {
// CraftBukkit end
int l = random.nextInt(3) + this.a;
boolean flag = true;
if (j >= 1 && j + l + 1 <= 256) {
- int i1;
byte b0;
- int j1;
- int k1;
+ int i1;
+ Block block;
- for (i1 = j; i1 <= j + 1 + l; ++i1) {
+ for (int j1 = j; j1 <= j + 1 + l; ++j1) {
b0 = 1;
- if (i1 == j) {
+ if (j1 == j) {
b0 = 0;
}
- if (i1 >= j + 1 + l - 2) {
+ if (j1 >= j + 1 + l - 2) {
b0 = 2;
}
- for (int l1 = i - b0; l1 <= i + b0 && flag; ++l1) {
- for (j1 = k - b0; j1 <= k + b0 && flag; ++j1) {
- if (i1 >= 0 && i1 < 256) {
- k1 = world.getTypeId(l1, i1, j1);
- if (k1 != 0 && k1 != Block.LEAVES.id && k1 != Block.GRASS.id && k1 != Block.DIRT.id && k1 != Block.LOG.id) {
+ for (int k1 = i - b0; k1 <= i + b0 && flag; ++k1) {
+ for (i1 = k - b0; i1 <= k + b0 && flag; ++i1) {
+ if (j1 >= 0 && j1 < 256) {
+ block = world.getType(k1, j1, i1);
+ if (!this.a(block)) {
flag = false;
}
} else {
@@ -66,83 +65,85 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe
if (!flag) {
return false;
} else {
- i1 = world.getTypeId(i, j - 1, k);
- if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 256 - l - 1) {
- this.setType(world, i, j - 1, k, Block.DIRT.id);
+ Block block1 = world.getType(i, j - 1, k);
+
+ if ((block1 == Blocks.GRASS || block1 == Blocks.DIRT || block1 == Blocks.SOIL) && j < 256 - l - 1) {
+ this.setType(world, i, j - 1, k, Blocks.DIRT);
b0 = 3;
byte b1 = 0;
+ int l1;
int i2;
int j2;
int k2;
- for (j1 = j - b0 + l; j1 <= j + l; ++j1) {
- k1 = j1 - (j + l);
- i2 = b1 + 1 - k1 / 2;
+ for (i1 = j - b0 + l; i1 <= j + l; ++i1) {
+ k2 = i1 - (j + l);
+ l1 = b1 + 1 - k2 / 2;
- for (j2 = i - i2; j2 <= i + i2; ++j2) {
- k2 = j2 - i;
+ for (i2 = i - l1; i2 <= i + l1; ++i2) {
+ j2 = i2 - i;
- for (int l2 = k - i2; l2 <= k + i2; ++l2) {
+ for (int l2 = k - l1; l2 <= k + l1; ++l2) {
int i3 = l2 - k;
- if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || random.nextInt(2) != 0 && k1 != 0) {
- int j3 = world.getTypeId(j2, j1, l2);
+ if (Math.abs(j2) != l1 || Math.abs(i3) != l1 || random.nextInt(2) != 0 && k2 != 0) {
+ Block block2 = world.getType(i2, i1, l2);
- if (j3 == 0 || j3 == Block.LEAVES.id) {
- this.setTypeAndData(world, j2, j1, l2, Block.LEAVES.id, this.d);
+ if (block2.getMaterial() == Material.AIR || block2.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i2, i1, l2, Blocks.LEAVES, this.d);
}
}
}
}
}
- for (j1 = 0; j1 < l; ++j1) {
- k1 = world.getTypeId(i, j + j1, k);
- if (k1 == 0 || k1 == Block.LEAVES.id) {
- this.setTypeAndData(world, i, j + j1, k, Block.LOG.id, this.c);
- if (this.b && j1 > 0) {
- if (random.nextInt(3) > 0 && world.isEmpty(i - 1, j + j1, k)) {
- this.setTypeAndData(world, i - 1, j + j1, k, Block.VINE.id, 8);
+ for (i1 = 0; i1 < l; ++i1) {
+ block = world.getType(i, j + i1, k);
+ if (block.getMaterial() == Material.AIR || block.getMaterial() == Material.LEAVES) {
+ this.setTypeAndData(world, i, j + i1, k, Blocks.LOG, this.c);
+ if (this.b && i1 > 0) {
+ if (random.nextInt(3) > 0 && world.isEmpty(i - 1, j + i1, k)) {
+ this.setTypeAndData(world, i - 1, j + i1, k, Blocks.VINE, 8);
}
- if (random.nextInt(3) > 0 && world.isEmpty(i + 1, j + j1, k)) {
- this.setTypeAndData(world, i + 1, j + j1, k, Block.VINE.id, 2);
+ if (random.nextInt(3) > 0 && world.isEmpty(i + 1, j + i1, k)) {
+ this.setTypeAndData(world, i + 1, j + i1, k, Blocks.VINE, 2);
}
- if (random.nextInt(3) > 0 && world.isEmpty(i, j + j1, k - 1)) {
- this.setTypeAndData(world, i, j + j1, k - 1, Block.VINE.id, 1);
+ if (random.nextInt(3) > 0 && world.isEmpty(i, j + i1, k - 1)) {
+ this.setTypeAndData(world, i, j + i1, k - 1, Blocks.VINE, 1);
}
- if (random.nextInt(3) > 0 && world.isEmpty(i, j + j1, k + 1)) {
- this.setTypeAndData(world, i, j + j1, k + 1, Block.VINE.id, 4);
+ if (random.nextInt(3) > 0 && world.isEmpty(i, j + i1, k + 1)) {
+ this.setTypeAndData(world, i, j + i1, k + 1, Blocks.VINE, 4);
}
}
}
}
if (this.b) {
- for (j1 = j - 3 + l; j1 <= j + l; ++j1) {
- k1 = j1 - (j + l);
- i2 = 2 - k1 / 2;
+ for (i1 = j - 3 + l; i1 <= j + l; ++i1) {
+ k2 = i1 - (j + l);
+ l1 = 2 - k2 / 2;
- for (j2 = i - i2; j2 <= i + i2; ++j2) {
- for (k2 = k - i2; k2 <= k + i2; ++k2) {
- if (world.getTypeId(j2, j1, k2) == Block.LEAVES.id) {
- if (random.nextInt(4) == 0 && world.getTypeId(j2 - 1, j1, k2) == 0) {
- this.b(world, j2 - 1, j1, k2, 8);
+ for (i2 = i - l1; i2 <= i + l1; ++i2) {
+ for (j2 = k - l1; j2 <= k + l1; ++j2) {
+ if (world.getType(i2, i1, j2).getMaterial() == Material.LEAVES) {
+ if (random.nextInt(4) == 0 && world.getType(i2 - 1, i1, j2).getMaterial() == Material.AIR) {
+ this.a(world, i2 - 1, i1, j2, 8);
}
- if (random.nextInt(4) == 0 && world.getTypeId(j2 + 1, j1, k2) == 0) {
- this.b(world, j2 + 1, j1, k2, 2);
+ if (random.nextInt(4) == 0 && world.getType(i2 + 1, i1, j2).getMaterial() == Material.AIR) {
+ this.a(world, i2 + 1, i1, j2, 2);
}
- if (random.nextInt(4) == 0 && world.getTypeId(j2, j1, k2 - 1) == 0) {
- this.b(world, j2, j1, k2 - 1, 1);
+ if (random.nextInt(4) == 0 && world.getType(i2, i1, j2 - 1).getMaterial() == Material.AIR) {
+ this.a(world, i2, i1, j2 - 1, 1);
}
- if (random.nextInt(4) == 0 && world.getTypeId(j2, j1, k2 + 1) == 0) {
- this.b(world, j2, j1, k2 + 1, 4);
+ if (random.nextInt(4) == 0 && world.getType(i2, i1, j2 + 1).getMaterial() == Material.AIR) {
+ this.a(world, i2, i1, j2 + 1, 4);
}
}
}
@@ -150,11 +151,11 @@ 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.f[k1]], j + l - 5 + j1, k + Direction.b[Direction.f[k1]], Block.COCOA.id, i2 << 2 | k1);
+ for (i1 = 0; i1 < 2; ++i1) {
+ for (k2 = 0; k2 < 4; ++k2) {
+ if (random.nextInt(4 - i1) == 0) {
+ l1 = random.nextInt(3);
+ this.setTypeAndData(world, i + Direction.a[Direction.f[k2]], j + l - 5 + i1, k + Direction.b[Direction.f[k2]], Blocks.COCOA, l1 << 2 | k2);
}
}
}
@@ -172,17 +173,17 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe
}
// CraftBukkit - Changed world to BlockChangeDelegate
- private void b(BlockChangeDelegate world, int i, int j, int k, int l) {
- this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
+ private void a(CraftBlockChangeDelegate world, int i, int j, int k, int l) {
+ this.setTypeAndData(world, i, j, k, Blocks.VINE, l);
int i1 = 4;
while (true) {
--j;
- if (world.getTypeId(i, j, k) != 0 || i1 <= 0) {
+ if (world.getType(i, j, k).getMaterial() != Material.AIR || i1 <= 0) {
return;
}
- this.setTypeAndData(world, i, j, k, Block.VINE.id, l);
+ this.setTypeAndData(world, i, j, k, Blocks.VINE, l);
--i1;
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenerator.java b/src/main/java/net/minecraft/server/WorldGenerator.java
index ffb18f7f99..f79a0fbaef 100644
--- a/src/main/java/net/minecraft/server/WorldGenerator.java
+++ b/src/main/java/net/minecraft/server/WorldGenerator.java
@@ -2,7 +2,7 @@ package net.minecraft.server;
import java.util.Random;
-import org.bukkit.BlockChangeDelegate; // CraftBukkit
+import org.bukkit.craftbukkit.CraftBlockChangeDelegate; // CraftBukkit
public abstract class WorldGenerator {
@@ -21,21 +21,20 @@ public abstract class WorldGenerator {
public void a(double d0, double d1, double d2) {}
// CraftBukkit - change signature
- protected void setType(BlockChangeDelegate world, int i, int j, int k, int l) {
- this.setTypeAndData(world, i, j, k, l, 0);
+ protected void setType(CraftBlockChangeDelegate world, int i, int j, int k, Block block) {
+ this.setTypeAndData(world, i, j, k, block, 0);
}
// CraftBukkit - change signature
- protected void setTypeAndData(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
+ protected void setTypeAndData(CraftBlockChangeDelegate world, int i, int j, int k, Block block, int l) {
if (this.a) {
- // CraftBukkit - BlockChangeDelegate doesn't have the 6th parameter
- world.setTypeIdAndData(i, j, k, l, i1);
+ world.setTypeAndData(i, j, k, block, l, 3);
} else {
// CraftBukkit start - Layering violation :(
- if (world instanceof World) {
- ((World) world).setTypeIdAndData(i, j, k, l, i1, 2);
+ if (world.getDelegate() instanceof World) {
+ ((World) world.getDelegate()).setTypeAndData(i, j, k, block, l, 2);
} else {
- world.setRawTypeIdAndData(i, j, k, l, i1);
+ world.setTypeAndData(i, j, k, block, l, 2);
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java
index d1a02e6b91..b3499024ed 100644
--- a/src/main/java/net/minecraft/server/WorldManager.java
+++ b/src/main/java/net/minecraft/server/WorldManager.java
@@ -24,12 +24,12 @@ public class WorldManager implements IWorldAccess {
public void a(String s, double d0, double d1, double d2, float f, float f1) {
// CraftBukkit - this.world.dimension
- this.server.getPlayerList().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
+ this.server.getPlayerList().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(s, d0, d1, d2, f, f1));
}
public void a(EntityHuman entityhuman, String s, double d0, double d1, double d2, float f, float f1) {
// CraftBukkit - this.world.dimension
- this.server.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
+ this.server.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new PacketPlayOutNamedSoundEffect(s, d0, d1, d2, f, f1));
}
public void a(int i, int j, int k, int l, int i1, int j1) {}
@@ -44,11 +44,11 @@ public class WorldManager implements IWorldAccess {
public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) {
// CraftBukkit - this.world.dimension
- this.server.getPlayerList().sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new Packet61WorldEvent(i, j, k, l, i1, false));
+ this.server.getPlayerList().sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new PacketPlayOutWorldEvent(i, j, k, l, i1, false));
}
public void a(int i, int j, int k, int l, int i1) {
- this.server.getPlayerList().sendAll(new Packet61WorldEvent(i, j, k, l, i1, true));
+ this.server.getPlayerList().sendAll(new PacketPlayOutWorldEvent(i, j, k, l, i1, true));
}
public void b(int i, int j, int k, int l, int i1) {
@@ -57,15 +57,17 @@ public class WorldManager implements IWorldAccess {
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- if (entityplayer != null && entityplayer.world == this.world && entityplayer.id != i) {
+ if (entityplayer != null && entityplayer.world == this.world && entityplayer.getId() != 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.playerConnection.sendPacket(new Packet55BlockBreakAnimation(i, j, k, l, i1));
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, j, k, l, i1));
}
}
}
}
+
+ public void b() {}
}
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index 10dff050ac..d21b4a5cbb 100644
--- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -14,7 +14,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.map.CraftMapView;
// CraftBukkit end
-public class WorldMap extends WorldMapBase {
+public class WorldMap extends PersistentBase {
public int centerX;
public int centerZ;
@@ -158,7 +158,7 @@ public class WorldMap extends WorldMapBase {
}
if (itemstack.A()) {
- this.a(1, entityhuman.world, "frame-" + itemstack.B().id, (double) itemstack.B().x, (double) itemstack.B().z, (double) (itemstack.B().direction * 90));
+ this.a(1, entityhuman.world, "frame-" + itemstack.B().getId(), (double) itemstack.B().x, (double) itemstack.B().z, (double) (itemstack.B().direction * 90));
}
}
diff --git a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
index 22d9c7e65a..ec708d1adb 100644
--- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
+++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
@@ -12,7 +12,6 @@ public class WorldMapHumanTracker {
private byte[] h;
public int d;
private boolean i;
-
final WorldMap worldMap;
public WorldMapHumanTracker(WorldMap worldmap, EntityHuman entityhuman) {
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index 321f65b951..c7ec2fdca4 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -9,6 +9,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import java.util.UUID;
@@ -17,11 +20,12 @@ import org.bukkit.craftbukkit.entity.CraftPlayer;
public class WorldNBTStorage implements IDataManager, IPlayerFileData {
+ private static final Logger a = LogManager.getLogger();
private final File baseDir;
private final File playerDir;
private final File dataDir;
- private final long sessionId = MinecraftServer.aq();
- private final String e;
+ private final long sessionId = MinecraftServer.ap();
+ private final String f;
private UUID uuid = null; // CraftBukkit
public WorldNBTStorage(File file1, String s, boolean flag) {
@@ -30,7 +34,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
this.playerDir = new File(this.baseDir, "players");
this.dataDir = new File(this.baseDir, "data");
this.dataDir.mkdirs();
- this.e = s;
+ this.f = s;
if (flag) {
this.playerDir.mkdirs();
}
@@ -54,7 +58,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
}
}
- public File getDirectory() { // CraftBukkit - protected to public
+ public File getDirectory() {
return this.baseDir;
}
@@ -183,7 +187,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
file1.renameTo(file2);
} catch (Exception exception) {
- MinecraftServer.getServer().getLogger().warning("Failed to save player data for " + entityhuman.getName());
+ a.warn("Failed to save player data for " + entityhuman.getName());
}
}
@@ -194,7 +198,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
// CraftBukkit start
if (entityhuman instanceof EntityPlayer) {
CraftPlayer player = (CraftPlayer) entityhuman.bukkitEntity;
- player.setFirstPlayed(new File(playerDir, entityhuman.name + ".dat").lastModified());
+ player.setFirstPlayed(new File(playerDir, entityhuman.getName() + ".dat").lastModified());
}
// CraftBukkit end
entityhuman.f(nbttagcompound);
@@ -211,7 +215,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
return NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1)));
}
} catch (Exception exception) {
- MinecraftServer.getServer().getLogger().warning("Failed to load player data for " + s);
+ a.warn("Failed to load player data for " + s);
}
return null;
@@ -240,7 +244,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
}
public String g() {
- return this.e;
+ return this.f;
}
// CraftBukkit start
@@ -253,7 +257,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
dis = new DataInputStream(new FileInputStream(file1));
return uuid = new UUID(dis.readLong(), dis.readLong());
} catch (IOException ex) {
- MinecraftServer.getServer().getLogger().severe("Failed to read " + file1 + ", generating new random UUID", ex);
+ a.warn("Failed to read " + file1 + ", generating new random UUID", ex);
} finally {
if (dis != null) {
try {
@@ -271,7 +275,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
dos.writeLong(uuid.getMostSignificantBits());
dos.writeLong(uuid.getLeastSignificantBits());
} catch (IOException ex) {
- MinecraftServer.getServer().getLogger().severe("Failed to write " + file1, ex);
+ a.warn("Failed to write " + file1, ex);
} finally {
if (dos != null) {
try {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 73c1ac73ae..b9b967f376 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -9,6 +9,9 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
// CraftBukkit start
import org.bukkit.WeatherType;
import org.bukkit.block.BlockState;
@@ -22,28 +25,30 @@ import org.bukkit.event.weather.WeatherChangeEvent;
public class WorldServer extends World implements org.bukkit.BlockChangeDelegate {
// CraftBukkit end
+ private static final Logger a = LogManager.getLogger();
private final MinecraftServer server;
public EntityTracker tracker; // CraftBukkit - private final -> public
private final PlayerChunkMap manager;
- private Set L;
- private TreeSet M;
+ private Set M;
+ private TreeSet N;
public ChunkProviderServer chunkProviderServer;
public boolean savingDisabled;
- private boolean N;
+ private boolean O;
private int emptyTime;
- private final PortalTravelAgent P;
- private final SpawnerCreature Q = new SpawnerCreature();
- private NoteDataList[] R = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
- private int S;
- private static final StructurePieceTreasure[] T = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)};
- private List U = new ArrayList();
+ private final PortalTravelAgent Q;
+ private final SpawnerCreature R = new SpawnerCreature();
+ private NoteDataList[] S = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
+ private int T;
+ private static final StructurePieceTreasure[] U = new StructurePieceTreasure[] { new StructurePieceTreasure(Items.STICK, 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.WOOD), 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG), 0, 1, 3, 10), new StructurePieceTreasure(Items.STONE_AXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOOD_AXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.STONE_PICKAXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOOD_PICKAXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.APPLE, 0, 2, 3, 5), new StructurePieceTreasure(Items.BREAD, 0, 2, 3, 3), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG2), 0, 1, 3, 10)};
+ private List V = new ArrayList();
private IntHashMap entitiesById;
// CraftBukkit start
public final int dimension;
- public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(idatamanager, s, worldsettings, WorldProvider.byDimension(env.getId()), methodprofiler, iconsolelogmanager, gen, env);
+ // Add env and gen to constructor
+ 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(env.getId()), methodprofiler, gen, env);
this.dimension = i;
this.pvpMode = minecraftserver.getPvP();
// CraftBukkit end
@@ -54,78 +59,78 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.entitiesById = new IntHashMap();
}
- if (this.L == null) {
- this.L = new HashSet();
- }
-
if (this.M == null) {
- this.M = new TreeSet();
+ this.M = new HashSet();
}
- this.P = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
+ if (this.N == null) {
+ this.N = new TreeSet();
+ }
+
+ this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
this.scoreboard = new ScoreboardServer(minecraftserver);
- ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData) this.worldMaps.get(ScoreboardSaveData.class, "scoreboard");
+ PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard.class, "scoreboard");
- if (scoreboardsavedata == null) {
- scoreboardsavedata = new ScoreboardSaveData();
- this.worldMaps.a("scoreboard", scoreboardsavedata);
+ if (persistentscoreboard == null) {
+ persistentscoreboard = new PersistentScoreboard();
+ this.worldMaps.a("scoreboard", persistentscoreboard);
}
- scoreboardsavedata.a(this.scoreboard);
- ((ScoreboardServer) this.scoreboard).a(scoreboardsavedata);
+ persistentscoreboard.a(this.scoreboard);
+ ((ScoreboardServer) this.scoreboard).a(persistentscoreboard);
}
// CraftBukkit start
@Override
public TileEntity getTileEntity(int i, int j, int k) {
TileEntity result = super.getTileEntity(i, j, k);
- int type = getTypeId(i, j, k);
+ Block type = getType(i, j, k);
- if (type == Block.CHEST.id) {
+ if (type == Blocks.CHEST) {
if (!(result instanceof TileEntityChest)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.FURNACE.id) {
+ } else if (type == Blocks.FURNACE) {
if (!(result instanceof TileEntityFurnace)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.DROPPER.id) {
+ } else if (type == Blocks.DROPPER) {
if (!(result instanceof TileEntityDropper)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.DISPENSER.id) {
+ } else if (type == Blocks.DISPENSER) {
if (!(result instanceof TileEntityDispenser)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.JUKEBOX.id) {
+ } else if (type == Blocks.JUKEBOX) {
if (!(result instanceof TileEntityRecordPlayer)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.NOTE_BLOCK.id) {
+ } else if (type == Blocks.NOTE_BLOCK) {
if (!(result instanceof TileEntityNote)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.MOB_SPAWNER.id) {
+ } else if (type == Blocks.MOB_SPAWNER) {
if (!(result instanceof TileEntityMobSpawner)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if ((type == Block.SIGN_POST.id) || (type == Block.WALL_SIGN.id)) {
+ } else if ((type == Blocks.SIGN_POST) || (type == Blocks.WALL_SIGN)) {
if (!(result instanceof TileEntitySign)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.ENDER_CHEST.id) {
+ } else if (type == Blocks.ENDER_CHEST) {
if (!(result instanceof TileEntityEnderChest)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.BREWING_STAND.id) {
+ } else if (type == Blocks.BREWING_STAND) {
if (!(result instanceof TileEntityBrewingStand)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.BEACON.id) {
+ } else if (type == Blocks.BEACON) {
if (!(result instanceof TileEntityBeacon)) {
result = fixTileEntity(i, j, k, type, result);
}
- } else if (type == Block.HOPPER.id) {
+ } else if (type == Blocks.HOPPER) {
if (!(result instanceof TileEntityHopper)) {
result = fixTileEntity(i, j, k, type, result);
}
@@ -134,12 +139,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
return result;
}
- private TileEntity fixTileEntity(int x, int y, int z, int type, TileEntity found) {
- this.getServer().getLogger().severe("Block at " + x + "," + y + "," + z + " is " + org.bukkit.Material.getMaterial(type).toString() + " but has " + found + ". "
+ private TileEntity fixTileEntity(int x, int y, int z, Block type, TileEntity found) {
+ this.getServer().getLogger().severe("Block at " + x + "," + y + "," + z + " is " + org.bukkit.Material.getMaterial(Block.b(type)).toString() + " but has " + found + ". "
+ "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]).b(this);
+ if (type instanceof IContainer) {
+ TileEntity replacement = ((IContainer) type).a(this, this.getData(x, y, z));
replacement.world = this;
this.setTileEntity(x, y, z, replacement);
return replacement;
@@ -160,8 +165,8 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public void doTick() {
super.doTick();
- if (this.getWorldData().isHardcore() && this.difficulty < 3) {
- this.difficulty = 3;
+ if (this.getWorldData().isHardcore() && this.difficulty != EnumDifficulty.HARD) {
+ this.difficulty = EnumDifficulty.HARD;
}
this.worldProvider.e.b();
@@ -179,9 +184,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// 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.getGameRules().getBoolean("doMobSpawning") && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) {
- this.Q.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
+ this.R.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
+ // CraftBukkit end
}
- // CraftBukkit end
+
this.methodProfiler.c("chunkSource");
this.chunkProvider.unloadChunks();
int j = this.a(1.0F);
@@ -197,7 +203,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.methodProfiler.c("tickPending");
this.a(false);
- this.methodProfiler.c("tickTiles");
+ this.methodProfiler.c("tickBlocks");
this.g();
this.methodProfiler.c("chunkMap");
this.manager.flush();
@@ -205,35 +211,35 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.villages.tick();
this.siegeManager.a();
this.methodProfiler.c("portalForcer");
- this.P.a(this.getTime());
+ this.Q.a(this.getTime());
this.methodProfiler.b();
- this.aa();
+ this.Z();
this.getWorld().processChunkGC(); // CraftBukkit
}
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
- List list = this.L().getMobsFor(enumcreaturetype, i, j, k);
+ List list = this.K().getMobsFor(enumcreaturetype, i, j, k);
return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null;
}
public void everyoneSleeping() {
- this.N = !this.players.isEmpty();
+ this.O = !this.players.isEmpty();
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (!entityhuman.isSleeping() && !entityhuman.fauxSleeping) { // CraftBukkit
- this.N = false;
+ this.O = false;
break;
}
}
}
protected void d() {
- this.N = false;
+ this.O = false;
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
@@ -244,10 +250,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- this.Z();
+ this.Y();
}
- private void Z() {
+ private void Y() {
// CraftBukkit start
WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
this.getServer().getPluginManager().callEvent(weather);
@@ -266,7 +272,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public boolean everyoneDeeplySleeping() {
- if (this.N && !this.isStatic) {
+ if (this.O && !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
@@ -301,9 +307,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// Iterator iterator = this.chunkTickList.iterator();
for (long chunkCoord : this.chunkTickList.popAll()) {
+ // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
int chunkX = LongHash.msw(chunkCoord);
int chunkZ = LongHash.lsw(chunkCoord);
- // ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
int k = chunkX * 16;
int l = chunkZ * 16;
@@ -313,14 +319,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.a(k, l, chunk);
this.methodProfiler.c("tickChunk");
- chunk.k();
+ chunk.b(false);
this.methodProfiler.c("thunder");
int i1;
int j1;
int k1;
int l1;
- if (this.random.nextInt(100000) == 0 && this.Q() && this.P()) {
+ if (this.random.nextInt(100000) == 0 && this.P() && this.O()) {
this.k = this.k * 3 + 1013904223;
i1 = this.k >> 2;
j1 = k + (i1 & 15);
@@ -332,18 +338,16 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
this.methodProfiler.c("iceandsnow");
- int i2;
-
if (this.random.nextInt(16) == 0) {
this.k = this.k * 3 + 1013904223;
i1 = this.k >> 2;
j1 = i1 & 15;
k1 = i1 >> 8 & 15;
l1 = this.h(j1 + k, k1 + l);
- if (this.y(j1 + k, l1 - 1, k1 + l)) {
+ if (this.s(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);
+ blockState.setTypeId(Block.b(Blocks.ICE));
BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(iceBlockForm);
@@ -353,10 +357,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.Q() && this.z(j1 + k, l1, k1 + l)) {
+ if (this.P() && this.e(j1 + k, l1, k1 + l, true)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState();
- blockState.setTypeId(Block.SNOW.id);
+ blockState.setTypeId(Block.b(Blocks.SNOW));
BlockFormEvent snow = new BlockFormEvent(blockState.getBlock(), blockState);
this.getServer().getPluginManager().callEvent(snow);
@@ -366,19 +370,16 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.Q()) {
+ if (this.P()) {
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].g(this, j1 + k, l1 - 1, k1 + l);
- }
+ if (biomebase.e()) {
+ this.getType(j1 + k, l1 - 1, k1 + l).l(this, j1 + k, l1 - 1, k1 + l);
}
}
}
- this.methodProfiler.c("tickTiles");
+ this.methodProfiler.c("tickBlocks");
ChunkSection[] achunksection = chunk.i();
j1 = achunksection.length;
@@ -387,18 +388,17 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
ChunkSection chunksection = achunksection[k1];
if (chunksection != null && chunksection.shouldTick()) {
- for (int j2 = 0; j2 < 3; ++j2) {
+ for (int i2 = 0; i2 < 3; ++i2) {
this.k = this.k * 3 + 1013904223;
- i2 = this.k >> 2;
- int k2 = i2 & 15;
- int l2 = i2 >> 8 & 15;
- int i3 = i2 >> 16 & 15;
- int j3 = chunksection.getTypeId(k2, i3, l2);
+ int j2 = this.k >> 2;
+ int k2 = j2 & 15;
+ int l2 = j2 >> 8 & 15;
+ int i3 = j2 >> 16 & 15;
++j;
- Block block = Block.byId[j3];
+ Block block = chunksection.getTypeId(k2, i3, l2);
- if (block != null && block.isTicking()) {
+ if (block.isTicking()) {
++i;
block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random);
}
@@ -410,61 +410,61 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- public boolean a(int i, int j, int k, int l) {
- NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+ public boolean a(int i, int j, int k, Block block) {
+ NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, block);
- return this.U.contains(nextticklistentry);
+ return this.V.contains(nextticklistentry);
}
- public void a(int i, int j, int k, int l, int i1) {
- this.a(i, j, k, l, i1, 0);
+ public void a(int i, int j, int k, Block block, int l) {
+ this.a(i, j, k, block, l, 0);
}
- public void a(int i, int j, int k, int l, int i1, int j1) {
- NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+ public void a(int i, int j, int k, Block block, int l, int i1) {
+ NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, block);
byte b0 = 0;
- if (this.d && l > 0) {
- if (Block.byId[l].l()) {
+ if (this.d && block.getMaterial() != Material.AIR) {
+ if (block.L()) {
b0 = 8;
- if (this.e(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
- int k1 = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
+ if (this.b(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
+ Block block1 = this.getType(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
- if (k1 == nextticklistentry.d && k1 > 0) {
- Block.byId[k1].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
+ if (block1.getMaterial() != Material.AIR && block1 == nextticklistentry.a()) {
+ block1.a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
}
}
return;
}
- i1 = 1;
+ l = 1;
}
- if (this.e(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
- if (l > 0) {
- nextticklistentry.a((long) i1 + this.worldData.getTime());
- nextticklistentry.a(j1);
+ if (this.b(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ if (block.getMaterial() != Material.AIR) {
+ nextticklistentry.a((long) l + this.worldData.getTime());
+ nextticklistentry.a(i1);
}
- if (!this.L.contains(nextticklistentry)) {
- this.L.add(nextticklistentry);
+ if (!this.M.contains(nextticklistentry)) {
this.M.add(nextticklistentry);
+ this.N.add(nextticklistentry);
}
}
}
- public void b(int i, int j, int k, int l, int i1, int j1) {
- NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+ public void b(int i, int j, int k, Block block, int l, int i1) {
+ NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, block);
- nextticklistentry.a(j1);
- if (l > 0) {
- nextticklistentry.a((long) i1 + this.worldData.getTime());
+ nextticklistentry.a(i1);
+ if (block.getMaterial() != Material.AIR) {
+ nextticklistentry.a((long) l + this.worldData.getTime());
}
- if (!this.L.contains(nextticklistentry)) {
- this.L.add(nextticklistentry);
+ if (!this.M.contains(nextticklistentry)) {
this.M.add(nextticklistentry);
+ this.N.add(nextticklistentry);
}
}
@@ -485,9 +485,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public boolean a(boolean flag) {
- int i = this.M.size();
+ int i = this.N.size();
- if (i != this.L.size()) {
+ if (i != this.M.size()) {
throw new IllegalStateException("TickNextTick list out of synch");
} else {
if (i > 1000) {
@@ -505,55 +505,55 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
NextTickListEntry nextticklistentry;
for (int j = 0; j < i; ++j) {
- nextticklistentry = (NextTickListEntry) this.M.first();
- if (!flag && nextticklistentry.e > this.worldData.getTime()) {
+ nextticklistentry = (NextTickListEntry) this.N.first();
+ if (!flag && nextticklistentry.d > this.worldData.getTime()) {
break;
}
+ this.N.remove(nextticklistentry);
this.M.remove(nextticklistentry);
- this.L.remove(nextticklistentry);
- this.U.add(nextticklistentry);
+ this.V.add(nextticklistentry);
}
this.methodProfiler.b();
this.methodProfiler.a("ticking");
- Iterator iterator = this.U.iterator();
+ Iterator iterator = this.V.iterator();
while (iterator.hasNext()) {
nextticklistentry = (NextTickListEntry) iterator.next();
iterator.remove();
byte b0 = 0;
- if (this.e(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 (this.b(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
+ Block block = this.getType(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
- if (k > 0 && Block.b(k, nextticklistentry.d)) {
+ if (block.getMaterial() != Material.AIR && Block.a(block, nextticklistentry.a())) {
try {
- Block.byId[k].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
+ block.a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while ticking a block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being ticked");
- int l;
+ int k;
try {
- l = this.getData(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
+ k = this.getData(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
} catch (Throwable throwable1) {
- l = -1;
+ k = -1;
}
- CrashReportSystemDetails.a(crashreportsystemdetails, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, k, l);
+ CrashReportSystemDetails.a(crashreportsystemdetails, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, block, k);
throw new ReportedException(crashreport);
}
}
} else {
- this.a(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, nextticklistentry.d, 0);
+ this.a(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, nextticklistentry.a(), 0);
}
}
this.methodProfiler.b();
- this.U.clear();
- return !this.M.isEmpty();
+ this.V.clear();
+ return !this.N.isEmpty();
}
}
@@ -569,14 +569,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
Iterator iterator;
if (i1 == 0) {
- iterator = this.M.iterator();
+ iterator = this.N.iterator();
} else {
- iterator = this.U.iterator();
- /* CraftBukkit start - Comment out debug spam
- if (!this.U.isEmpty()) {
- System.out.println(this.U.size());
+ iterator = this.V.iterator();
+ if (!this.V.isEmpty()) {
+ a.debug("toBeTicked = " + this.V.size());
}
- // CraftBukkit end */
}
while (iterator.hasNext()) {
@@ -584,7 +582,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) {
if (flag) {
- this.L.remove(nextticklistentry);
+ this.M.remove(nextticklistentry);
iterator.remove();
}
@@ -669,12 +667,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.entitiesById = new IntHashMap();
}
- if (this.L == null) {
- this.L = new HashSet();
+ if (this.M == null) {
+ this.M = new HashSet();
}
- if (this.M == null) {
- this.M = new TreeSet();
+ if (this.N == null) {
+ this.N = new TreeSet();
}
this.b(worldsettings);
@@ -715,7 +713,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
i = chunkposition.x;
k = chunkposition.z;
} else {
- this.getLogger().warning("Unable to find spawn biome");
+ a.warn("Unable to find spawn biome");
}
int l = 0;
@@ -738,7 +736,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void k() {
- WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(T, 10);
+ WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(U, 10);
for (int i = 0; i < 10; ++i) {
int j = this.worldData.c() + this.random.nextInt(6) - this.random.nextInt(6);
@@ -777,7 +775,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws
- this.G();
+ this.F();
this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().q());
// CraftBukkit start - save worldMaps once, rather than once per shared world
if (!(this instanceof SecondaryWorldServer)) {
@@ -788,24 +786,24 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
protected void a(Entity entity) {
super.a(entity);
- this.entitiesById.a(entity.id, entity);
- Entity[] aentity = entity.ao();
+ this.entitiesById.a(entity.getId(), entity);
+ Entity[] aentity = entity.at();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
- this.entitiesById.a(aentity[i].id, aentity[i]);
+ this.entitiesById.a(aentity[i].getId(), aentity[i]);
}
}
}
protected void b(Entity entity) {
super.b(entity);
- this.entitiesById.d(entity.id);
- Entity[] aentity = entity.ao();
+ this.entitiesById.d(entity.getId());
+ Entity[] aentity = entity.at();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
- this.entitiesById.d(aentity[i].id);
+ this.entitiesById.d(aentity[i].getId());
}
}
}
@@ -824,7 +822,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
if (super.strikeLightning(entity)) {
- this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new Packet71Weather(entity));
+ this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new PacketPlayOutSpawnEntityWeather(entity));
// CraftBukkit end
return true;
} else {
@@ -833,9 +831,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public void broadcastEntityEffect(Entity entity, byte b0) {
- Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
-
- this.getTracker().sendPacketToEntity(entity, packet38entitystatus);
+ this.getTracker().sendPacketToEntity(entity, new PacketPlayOutEntityStatus(entity, b0));
}
public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
@@ -864,22 +860,22 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (entityhuman.e(d0, d1, d2) < 4096.0D) {
- ((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet60Explosion(d0, d1, d2, f, explosion.blocks, (Vec3D) explosion.b().get(entityhuman)));
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutExplosion(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, int j1) {
- NoteBlockData noteblockdata = new NoteBlockData(i, j, k, l, i1, j1);
- Iterator iterator = this.R[this.S].iterator();
+ public void playNote(int i, int j, int k, Block block, int l, int i1) {
+ NoteBlockData noteblockdata = new NoteBlockData(i, j, k, block, l, i1);
+ Iterator iterator = this.S[this.T].iterator();
NoteBlockData noteblockdata1;
do {
if (!iterator.hasNext()) {
- this.R[this.S].add(noteblockdata);
+ this.S[this.T].add(noteblockdata);
return;
}
@@ -888,30 +884,30 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
- private void aa() {
- while (!this.R[this.S].isEmpty()) {
- int i = this.S;
+ private void Z() {
+ while (!this.S[this.T].isEmpty()) {
+ int i = this.T;
- this.S ^= 1;
- Iterator iterator = this.R[i].iterator();
+ this.T ^= 1;
+ Iterator iterator = this.S[i].iterator();
while (iterator.hasNext()) {
NoteBlockData noteblockdata = (NoteBlockData) iterator.next();
if (this.a(noteblockdata)) {
// CraftBukkit - this.worldProvider.dimension -> this.dimension
- this.server.getPlayerList().sendPacketNearby((double) noteblockdata.a(), (double) noteblockdata.b(), (double) noteblockdata.c(), 64.0D, this.dimension, new Packet54PlayNoteBlock(noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.f(), noteblockdata.d(), noteblockdata.e()));
+ this.server.getPlayerList().sendPacketNearby((double) noteblockdata.a(), (double) noteblockdata.b(), (double) noteblockdata.c(), 64.0D, this.dimension, new PacketPlayOutBlockAction(noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.f(), noteblockdata.d(), noteblockdata.e()));
}
}
- this.R[i].clear();
+ this.S[i].clear();
}
}
private boolean a(NoteBlockData noteblockdata) {
- int i = this.getTypeId(noteblockdata.a(), noteblockdata.b(), noteblockdata.c());
+ Block block = this.getType(noteblockdata.a(), noteblockdata.b(), noteblockdata.c());
- return i == noteblockdata.f() ? Block.byId[i].b(this, noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.d(), noteblockdata.e()) : false;
+ return block == noteblockdata.f() ? block.a(this, noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.d(), noteblockdata.e()) : false;
}
public void saveLevel() {
@@ -919,11 +915,31 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void o() {
- boolean flag = this.Q();
+ boolean flag = this.P();
super.o();
- if (flag != this.Q()) {
- // CraftBukkit start - Only send weather packets to those affected
+ /* CraftBukkit start
+ if (this.m != this.n) {
+ this.server.getPlayerList().a(new PacketPlayOutGameStateChange(7, this.n), this.worldProvider.dimension);
+ }
+
+ if (this.o != this.p) {
+ this.server.getPlayerList().a(new PacketPlayOutGameStateChange(8, this.p), this.worldProvider.dimension);
+ }
+
+ if (flag != this.P()) {
+ if (flag) {
+ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(2, 0.0F));
+ } else {
+ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(1, 0.0F));
+ }
+
+ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.n));
+ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.p));
+ }
+ // */
+ if (flag != this.P()) {
+ // Only send weather packets to those affected
for (int i = 0; i < this.players.size(); ++i) {
if (((EntityPlayer) this.players.get(i)).world == this) {
((EntityPlayer) this.players.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
@@ -946,24 +962,45 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public PortalTravelAgent t() {
- return this.P;
+ return this.Q;
+ }
+
+ public void a(String s, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
+ PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(s, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
+
+ for (int j = 0; j < this.players.size(); ++j) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
+ ChunkCoordinates chunkcoordinates = entityplayer.getChunkCoordinates();
+ double d7 = d0 - (double) chunkcoordinates.x;
+ double d8 = d1 - (double) chunkcoordinates.y;
+ double d9 = d2 - (double) chunkcoordinates.z;
+ double d10 = d7 * d7 + d8 * d8 + d9 * d9;
+
+ if (d10 <= 256.0D) {
+ entityplayer.playerConnection.sendPacket(packetplayoutworldparticles);
+ }
+ }
}
// CraftBukkit start - Compatibility methods for BlockChangeDelegate
public boolean setRawTypeId(int x, int y, int z, int typeId) {
- return this.setTypeIdAndData(x, y, z, typeId, 0, 4);
+ return this.setTypeAndData(x, y, z, Block.e(typeId), 0, 4);
}
public boolean setRawTypeIdAndData(int x, int y, int z, int typeId, int data) {
- return this.setTypeIdAndData(x, y, z, typeId, data, 4);
+ return this.setTypeAndData(x, y, z, Block.e(typeId), data, 4);
}
public boolean setTypeId(int x, int y, int z, int typeId) {
- return this.setTypeIdAndData(x, y, z, typeId, 0, 3);
+ return this.setTypeAndData(x, y, z, Block.e(typeId), 0, 3);
}
public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data) {
- return this.setTypeIdAndData(x, y, z, typeId, data, 3);
+ return this.setTypeAndData(x, y, z, Block.e(typeId), data, 3);
+ }
+
+ public int getTypeId(int x, int y, int z) {
+ return Block.b(getType(x, y, z));
}
// CraftBukkit end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftAchievement.java b/src/main/java/org/bukkit/craftbukkit/CraftAchievement.java
new file mode 100644
index 0000000000..f5897e5835
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/CraftAchievement.java
@@ -0,0 +1,44 @@
+package org.bukkit.craftbukkit;
+
+import org.bukkit.Achievement;
+
+import com.google.common.base.CaseFormat;
+import com.google.common.collect.BiMap;
+import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.ImmutableMap;
+
+public class CraftAchievement {
+ private static final BiMap achievements;
+ static {
+ ImmutableMap specialCases = ImmutableMap.builder()
+ .put("achievement.buildWorkBench", Achievement.BUILD_WORKBENCH)
+ .put("achievement.diamonds", Achievement.GET_DIAMONDS)
+ .put("achievement.portal", Achievement.NETHER_PORTAL)
+ .put("achievement.ghast", Achievement.GHAST_RETURN)
+ .put("achievement.theEnd", Achievement.END_PORTAL)
+ .put("achievement.theEnd2", Achievement.THE_END)
+ .put("achievement.blazeRod", Achievement.GET_BLAZE_ROD)
+ .put("achievement.potion", Achievement.BREW_POTION)
+ .build();
+
+ ImmutableBiMap.Builder builder = ImmutableBiMap.builder();
+ for (Achievement achievement : Achievement.values()) {
+ if (specialCases.values().contains(achievement)) {
+ continue;
+ }
+ builder.put("achievement."+CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, achievement.name()), achievement);
+ }
+
+ builder.putAll(specialCases);
+
+ achievements = builder.build();
+ }
+
+ public static String getAchievementName(Achievement material) {
+ return achievements.inverse().get(material);
+ }
+
+ public static Achievement getAchievement(String name) {
+ return achievements.get(name);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftBlockChangeDelegate.java b/src/main/java/org/bukkit/craftbukkit/CraftBlockChangeDelegate.java
new file mode 100644
index 0000000000..470828a222
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/CraftBlockChangeDelegate.java
@@ -0,0 +1,29 @@
+package org.bukkit.craftbukkit;
+
+import net.minecraft.server.Block;
+
+import org.bukkit.BlockChangeDelegate;
+
+public class CraftBlockChangeDelegate {
+ private final BlockChangeDelegate delegate;
+
+ public CraftBlockChangeDelegate(BlockChangeDelegate delegate) {
+ this.delegate = delegate;
+ }
+
+ public BlockChangeDelegate getDelegate() {
+ return delegate;
+ }
+
+ public Block getType(int x, int y, int z) {
+ return Block.e(this.delegate.getTypeId(x, y, z));
+ }
+
+ public void setTypeAndData(int x, int y, int z, Block block, int data, int light) {
+ delegate.setRawTypeIdAndData(x, y, z, Block.b(block), data);
+ }
+
+ public boolean isEmpty(int x, int y, int z) {
+ return delegate.isEmpty(x, y, z);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 1a2151604a..b2c6ef4578 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -33,8 +33,8 @@ public class CraftChunk implements Chunk {
}
worldServer = (WorldServer) getHandle().world;
- x = getHandle().x;
- z = getHandle().z;
+ x = getHandle().locX;
+ z = getHandle().locZ;
}
public World getWorld() {
@@ -114,7 +114,7 @@ public class CraftChunk implements Chunk {
}
ChunkPosition position = (ChunkPosition) obj;
- entities[index++] = worldServer.getWorld().getBlockAt(position.x + (chunk.x << 4), position.y, position.z + (chunk.z << 4)).getState();
+ entities[index++] = worldServer.getWorld().getBlockAt(position.x + (chunk.locX << 4), position.y, position.z + (chunk.locZ << 4)).getState();
}
return entities;
}
@@ -228,7 +228,7 @@ public class CraftChunk implements Chunk {
if (includeBiomeTempRain) {
biomeTemp = new double[256];
biomeRain = new double[256];
- float[] dat = wcm.getTemperatures(null, getX() << 4, getZ() << 4, 16, 16);
+ float[] dat = getTemperatures(wcm, getX() << 4, getZ() << 4);
for (int i = 0; i < 256; i++) {
biomeTemp[i] = dat[i];
@@ -264,7 +264,7 @@ public class CraftChunk implements Chunk {
if (includeBiomeTempRain) {
biomeTemp = new double[256];
biomeRain = new double[256];
- float[] dat = wcm.getTemperatures(null, x << 4, z << 4, 16, 16);
+ float[] dat = getTemperatures(wcm, x << 4, z << 4);
for (int i = 0; i < 256; i++) {
biomeTemp[i] = dat[i];
@@ -297,6 +297,23 @@ public class CraftChunk implements Chunk {
return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, blockData, skyLight, emitLight, empty, new int[256], biome, biomeTemp, biomeRain);
}
+ private static float[] getTemperatures(WorldChunkManager chunkmanager, int chunkX, int chunkZ) {
+ BiomeBase[] biomes = chunkmanager.getBiomes(null, chunkX, chunkZ, 16, 16);
+ float[] temps = new float[biomes.length];
+
+ for (int i = 0; i < biomes.length; i++) {
+ float temp = biomes[i].temperature; // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F
+
+ if (temp > 1F) {
+ temp = 1F;
+ }
+
+ temps[i] = temp;
+ }
+
+ return temps;
+ }
+
static {
Arrays.fill(emptySkyLight, (byte) 0xFF);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
index cb6dc22969..e08afce57b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftCrashReport.java
@@ -12,7 +12,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
import net.minecraft.server.MinecraftServer;
-public class CraftCrashReport implements Callable {
+public class CraftCrashReport implements Callable