Update CraftBukkit to Minecraft 1.5

This commit is contained in:
Travis Watkins 2013-03-13 17:33:27 -05:00
parent ba6e4c38cf
commit 83d29e461c
246 changed files with 8499 additions and 6759 deletions

View file

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.4.7-R1.1-SNAPSHOT</version>
<version>1.5-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>http://www.bukkit.org</url>
@ -12,8 +12,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version>
<junit.version>4.11</junit.version>
<minecraft.version>1.4.7</minecraft.version>
<minecraft_version>1_4_R1</minecraft_version>
<minecraft.version>1.5</minecraft.version>
<minecraft_version>1_5_R1</minecraft_version>
</properties>
<scm>

View file

@ -6,177 +6,188 @@ import java.util.Random;
public class Block {
private CreativeModeTab creativeTab;
public static final StepSound d = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound e = new StepSound("wood", 1.0F, 1.0F);
public static final StepSound f = new StepSound("gravel", 1.0F, 1.0F);
public static final StepSound g = new StepSound("grass", 1.0F, 1.0F);
public static final StepSound h = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound i = new StepSound("stone", 1.0F, 1.5F);
public static final StepSound j = new StepSoundStone("stone", 1.0F, 1.0F);
public static final StepSound k = new StepSound("cloth", 1.0F, 1.0F);
public static final StepSound l = new StepSound("sand", 1.0F, 1.0F);
public static final StepSound m = new StepSound("snow", 1.0F, 1.0F);
public static final StepSound n = new StepSoundLadder("ladder", 1.0F, 1.0F);
public static final StepSound o = new StepSoundAnvil("anvil", 0.3F, 1.0F);
public static final StepSound f = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound g = new StepSound("wood", 1.0F, 1.0F);
public static final StepSound h = new StepSound("gravel", 1.0F, 1.0F);
public static final StepSound i = new StepSound("grass", 1.0F, 1.0F);
public static final StepSound j = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound k = new StepSound("stone", 1.0F, 1.5F);
public static final StepSound l = new StepSoundStone("stone", 1.0F, 1.0F);
public static final StepSound m = new StepSound("cloth", 1.0F, 1.0F);
public static final StepSound n = new StepSound("sand", 1.0F, 1.0F);
public static final StepSound o = new StepSound("snow", 1.0F, 1.0F);
public static final StepSound p = new StepSoundLadder("ladder", 1.0F, 1.0F);
public static final StepSound q = new StepSoundAnvil("anvil", 0.3F, 1.0F);
public static final Block[] byId = new Block[4096];
public static final boolean[] q = new boolean[4096];
public static final int[] lightBlock = new int[4096];
public static final boolean[] s = new boolean[4096];
public static final int[] lightEmission = new int[4096];
public static final int[] lightBlock = new int[4096];
public static final boolean[] u = new boolean[4096];
public static boolean[] v = new boolean[4096];
public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).b("stone");
public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).b("grass");
public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).b("dirt");
public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stonebrick").a(CreativeModeTab.b);
public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(e).b("wood").r();
public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).b("sapling").r();
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).s().b(6000000.0F).a(h).b("bedrock").D().a(CreativeModeTab.b);
public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).h(3).b("water").D().r();
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).h(3).b("water").D().r();
public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).h(255).b("lava").D().r();
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).h(255).b("lava").D().r();
public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).b("sand");
public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).b("gravel");
public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).b("oreGold");
public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).b("oreIron");
public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).b("oreCoal");
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).b("log").r();
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).h(1).a(g).b("leaves").r();
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).b("sponge");
public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).b("glass");
public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).b("oreLapis");
public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).b("blockLapis").a(CreativeModeTab.b);
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).b("dispenser").r();
public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).b("sandStone").r();
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).b("musicBlock").r();
public static final Block BED = (new BlockBed(26)).c(0.2F).b("bed").D().r();
public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).b("goldenRail").r();
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).b("detectorRail").r();
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).b("pistonStickyBase").r();
public static final Block WEB = (new BlockWeb(30, 11)).h(1).c(4.0F).b("web");
public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).b("tallgrass");
public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).b("deadbush");
public static final Block PISTON = (new BlockPiston(33, 107, false)).b("pistonBase").r();
public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).r();
public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).b("cloth").r();
public static final int[] lightEmission = new int[4096];
public static boolean[] w = new boolean[4096];
public static final Block STONE = (new BlockStone(1)).c(1.5F).b(10.0F).a(j).c("stone");
public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(i).c("grass");
public static final Block DIRT = (new BlockDirt(3)).c(0.5F).a(h).c("dirt");
public static final Block COBBLESTONE = (new Block(4, Material.STONE)).c(2.0F).b(10.0F).a(j).c("stonebrick").a(CreativeModeTab.b);
public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(g).c("wood");
public static final Block SAPLING = (new BlockSapling(6)).c(0.0F).a(i).c("sapling");
public static final Block BEDROCK = (new Block(7, Material.STONE)).r().b(6000000.0F).a(j).c("bedrock").D().a(CreativeModeTab.b);
public static final BlockFluids WATER = (BlockFluids) (new BlockFlowing(8, Material.WATER)).c(100.0F).k(3).c("water").D();
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).k(3).c("water").D();
public static final BlockFluids LAVA = (BlockFluids) (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).c("lava").D();
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).c("lava").D();
public static final Block SAND = (new BlockSand(12)).c(0.5F).a(n).c("sand");
public static final Block GRAVEL = (new BlockGravel(13)).c(0.6F).a(h).c("gravel");
public static final Block GOLD_ORE = (new BlockOre(14)).c(3.0F).b(5.0F).a(j).c("oreGold");
public static final Block IRON_ORE = (new BlockOre(15)).c(3.0F).b(5.0F).a(j).c("oreIron");
public static final Block COAL_ORE = (new BlockOre(16)).c(3.0F).b(5.0F).a(j).c("oreCoal");
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(g).c("log");
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18)).c(0.2F).k(1).a(i).c("leaves");
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(i).c("sponge");
public static final Block GLASS = (new BlockGlass(20, Material.SHATTERABLE, false)).c(0.3F).a(l).c("glass");
public static final Block LAPIS_ORE = (new BlockOre(21)).c(3.0F).b(5.0F).a(j).c("oreLapis");
public static final Block LAPIS_BLOCK = (new Block(22, Material.STONE)).c(3.0F).b(5.0F).a(j).c("blockLapis").a(CreativeModeTab.b);
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(j).c("dispenser");
public static final Block SANDSTONE = (new BlockSandStone(24)).a(j).c(0.8F).c("sandStone");
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).c("musicBlock");
public static final Block BED = (new BlockBed(26)).c(0.2F).c("bed").D();
public static final Block GOLDEN_RAIL = (new BlockPoweredRail(27)).c(0.7F).a(k).c("goldenRail");
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28)).c(0.7F).a(k).c("detectorRail");
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");
public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31)).c(0.0F).a(i).c("tallgrass");
public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32)).c(0.0F).a(i).c("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()).c(0.8F).a(m).c("cloth");
public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).b("flower");
public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).b("rose");
public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, 29)).c(0.0F).a(g).a(0.125F).b("mushroom");
public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, 28)).c(0.0F).a(g).b("mushroom");
public static final Block GOLD_BLOCK = (new BlockOreBlock(41, 23)).c(3.0F).b(10.0F).a(i).b("blockGold");
public static final Block IRON_BLOCK = (new BlockOreBlock(42, 22)).c(5.0F).b(10.0F).a(i).b("blockIron");
public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
public static final Block BRICK = (new Block(45, 7, Material.STONE)).c(2.0F).b(10.0F).a(h).b("brick").a(CreativeModeTab.b);
public static final Block TNT = (new BlockTNT(46, 8)).c(0.0F).a(g).b("tnt");
public static final Block BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).b("bookshelf");
public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stoneMoss").a(CreativeModeTab.b);
public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(50.0F).b(2000.0F).a(h).b("obsidian");
public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).b("torch").r();
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).b("fire").D();
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).b("mobSpawner").D();
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).b("stairsWood").r();
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).b("chest").r();
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).b("redstoneDust").D().r();
public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).b("oreDiamond");
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).b("blockDiamond");
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).b("workbench");
public static final Block CROPS = (new BlockCrops(59, 88)).b("crops");
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).b("farmland").r();
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).b("furnace").r().a(CreativeModeTab.c);
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).b("furnace").r();
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).b("sign").D().r();
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).b("doorWood").D().r();
public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(n).b("ladder").r();
public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).b("rail").r();
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).b("stairsStone").r();
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).b("sign").D().r();
public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).b("lever").r();
public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).b("pressurePlate").r();
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).b("doorIron").D().r();
public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).b("pressurePlate").r();
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).b("oreRedstone").r().a(CreativeModeTab.b);
public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).b("oreRedstone").r();
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).b("notGate").r();
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).b("notGate").r().a(CreativeModeTab.d);
public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId, false)).c(0.5F).a(h).b("button").r();
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(m).b("snow").r().h(0);
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).h(3).a(j).b("ice");
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(m).b("snow");
public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).b("cactus");
public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).b("clay");
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).b("reeds").D();
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).b("jukebox").r();
public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).b("fence");
public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).b("pumpkin").r();
public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).b("hellrock");
public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).b("hellsand");
public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).b("lightgem");
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).b("portal");
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).b("litpumpkin").r();
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).b("cake").D().r();
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).b("diode").D().r();
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).b("diode").D().r();
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).b("lockedchest").b(true).r();
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).b("trapdoor").D().r();
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).b("monsterStoneEgg");
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).b("stonebricksmooth");
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).b("mushroom").r();
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).b("mushroom").r();
public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).b("fenceIron");
public static final Block THIN_GLASS = (new BlockThinFence(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).b("thinGlass");
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).b("melon");
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).b("pumpkinStem").r();
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).b("pumpkinStem").r();
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).b("vine").r();
public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).b("fenceGate").r();
public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).b("stairsBrick").r();
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).b("stairsStoneBrickSmooth").r();
public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(g).b("mycel");
public static final Block WATER_LILY = (new BlockWaterLily(111, 76)).c(0.0F).a(g).b("waterlily");
public static final Block NETHER_BRICK = (new Block(112, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherBrick").a(CreativeModeTab.b);
public static final Block NETHER_FENCE = (new BlockFence(113, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherFence");
public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).b("stairsNetherBrick").r();
public static final Block NETHER_WART = (new BlockNetherWart(115)).b("netherStalk").r();
public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).b("enchantmentTable");
public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).b("brewingStand").r();
public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).b("cauldron").r();
public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37)).c(0.0F).a(i).c("flower");
public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38)).c(0.0F).a(i).c("rose");
public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, "mushroom_brown")).c(0.0F).a(i).a(0.125F).c("mushroom");
public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, "mushroom_red")).c(0.0F).a(i).c("mushroom");
public static final Block GOLD_BLOCK = (new BlockOreBlock(41)).c(3.0F).b(10.0F).a(k).c("blockGold");
public static final Block IRON_BLOCK = (new BlockOreBlock(42)).c(5.0F).b(10.0F).a(k).c("blockIron");
public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(j).c("stoneSlab");
public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(j).c("stoneSlab");
public static final Block BRICK = (new Block(45, Material.STONE)).c(2.0F).b(10.0F).a(j).c("brick").a(CreativeModeTab.b);
public static final Block TNT = (new BlockTNT(46)).c(0.0F).a(i).c("tnt");
public static final Block BOOKSHELF = (new BlockBookshelf(47)).c(1.5F).a(g).c("bookshelf");
public static final Block MOSSY_COBBLESTONE = (new Block(48, Material.STONE)).c(2.0F).b(10.0F).a(j).c("stoneMoss").a(CreativeModeTab.b);
public static final Block OBSIDIAN = (new BlockObsidian(49)).c(50.0F).b(2000.0F).a(j).c("obsidian");
public static final Block TORCH = (new BlockTorch(50)).c(0.0F).a(0.9375F).a(g).c("torch");
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51)).c(0.0F).a(1.0F).a(g).c("fire").D();
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52)).c(5.0F).a(k).c("mobSpawner").D();
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(g).c("chest");
public static final BlockRedstoneWire REDSTONE_WIRE = (BlockRedstoneWire) (new BlockRedstoneWire(55)).c(0.0F).a(f).c("redstoneDust").D();
public static final Block DIAMOND_ORE = (new BlockOre(56)).c(3.0F).b(5.0F).a(j).c("oreDiamond");
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57)).c(5.0F).b(10.0F).a(k).c("blockDiamond");
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(g).c("workbench");
public static final Block CROPS = (new BlockCrops(59)).c("crops");
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(h).c("farmland");
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(j).c("furnace").a(CreativeModeTab.c);
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(j).a(0.875F).c("furnace");
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(g).c("sign").D();
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(g).c("doorWood").D();
public static final Block LADDER = (new BlockLadder(65)).c(0.4F).a(p).c("ladder");
public static final Block RAILS = (new BlockMinecartTrack(66)).c(0.7F).a(k).c("rail");
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(g).c("sign").D();
public static final Block LEVER = (new BlockLever(69)).c(0.5F).a(g).c("lever");
public static final Block STONE_PLATE = (new BlockPressurePlateBinary(70, "stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(j).c("pressurePlate");
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(k).c("doorIron").D();
public static final Block WOOD_PLATE = (new BlockPressurePlateBinary(72, "wood", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(g).c("pressurePlate");
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, false)).c(3.0F).b(5.0F).a(j).c("oreRedstone").a(CreativeModeTab.b);
public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, true)).a(0.625F).c(3.0F).b(5.0F).a(j).c("oreRedstone");
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, false)).c(0.0F).a(g).c("notGate");
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, true)).c(0.0F).a(0.5F).a(g).c("notGate").a(CreativeModeTab.d);
public static final Block STONE_BUTTON = (new BlockStoneButton(77)).c(0.5F).a(j).c("button");
public static final Block SNOW = (new BlockSnow(78)).c(0.1F).a(o).c("snow").k(0);
public static final Block ICE = (new BlockIce(79)).c(0.5F).k(3).a(l).c("ice");
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80)).c(0.2F).a(o).c("snow");
public static final Block CACTUS = (new BlockCactus(81)).c(0.4F).a(m).c("cactus");
public static final Block CLAY = (new BlockClay(82)).c(0.6F).a(h).c("clay");
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83)).c(0.0F).a(i).c("reeds").D();
public static final Block JUKEBOX = (new BlockJukeBox(84)).c(2.0F).b(10.0F).a(j).c("jukebox");
public static final Block FENCE = (new BlockFence(85, "wood", Material.WOOD)).c(2.0F).b(5.0F).a(g).c("fence");
public static final Block PUMPKIN = (new BlockPumpkin(86, false)).c(1.0F).a(g).c("pumpkin");
public static final Block NETHERRACK = (new BlockBloodStone(87)).c(0.4F).a(j).c("hellrock");
public static final Block SOUL_SAND = (new BlockSlowSand(88)).c(0.5F).a(n).c("hellsand");
public static final Block GLOWSTONE = (new BlockLightStone(89, Material.SHATTERABLE)).c(0.3F).a(l).a(1.0F).c("lightgem");
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90)).c(-1.0F).a(l).a(0.75F).c("portal");
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, true)).c(1.0F).a(g).a(1.0F).c("litpumpkin");
public static final Block CAKE_BLOCK = (new BlockCake(92)).c(0.5F).a(m).c("cake").D();
public static final BlockRepeater DIODE_OFF = (BlockRepeater) (new BlockRepeater(93, false)).c(0.0F).a(g).c("diode").D();
public static final BlockRepeater DIODE_ON = (BlockRepeater) (new BlockRepeater(94, true)).c(0.0F).a(0.625F).a(g).c("diode").D();
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(g).c("lockedchest").b(true);
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(g).c("trapdoor").D();
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(j).c("stonebricksmooth");
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 0)).c(0.2F).a(g).c("mushroom");
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 1)).c(0.2F).a(g).c("mushroom");
public static final Block IRON_FENCE = (new BlockThinFence(101, "fenceIron", "fenceIron", Material.ORE, true)).c(5.0F).b(10.0F).a(k).c("fenceIron");
public static final Block THIN_GLASS = (new BlockThinFence(102, "glass", "thinglass_top", Material.SHATTERABLE, false)).c(0.3F).a(l).c("thinGlass");
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(g).c("melon");
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(g).c("pumpkinStem");
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(g).c("pumpkinStem");
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(i).c("vine");
public static final Block FENCE_GATE = (new BlockFenceGate(107)).c(2.0F).b(5.0F).a(g).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(i).c("mycel");
public static final Block WATER_LILY = (new BlockWaterLily(111)).c(0.0F).a(i).c("waterlily");
public static final Block NETHER_BRICK = (new Block(112, Material.STONE)).c(2.0F).b(10.0F).a(j).c("netherBrick").a(CreativeModeTab.b);
public static final Block NETHER_FENCE = (new BlockFence(113, "netherBrick", Material.STONE)).c(2.0F).b(10.0F).a(j).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");
public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).c("enchantmentTable");
public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).c("brewingStand");
public static final BlockCauldron CAULDRON = (BlockCauldron) (new BlockCauldron(118)).c(2.0F).c("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(j).a(0.125F).c(-1.0F).b("endPortalFrame").r().b(6000000.0F).a(CreativeModeTab.c);
public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).b("whiteStone").a(CreativeModeTab.b);
public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).b("dragonEgg");
public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).b("redstoneLight").a(CreativeModeTab.d);
public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).b("redstoneLight");
public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(e).b("woodSlab");
public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(e).b("woodSlab");
public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(e).b("cocoa").r();
public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).b("stairsSandStone").r();
public static final Block EMERALD_ORE = (new BlockOre(129, 171)).c(3.0F).b(5.0F).a(h).b("oreEmerald");
public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(h).b("enderChest").r().a(0.5F);
public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).b("tripWireSource").r();
public static final Block TRIPWIRE = (new BlockTripwire(132)).b("tripWire").r();
public static final Block EMERALD_BLOCK = (new BlockOreBlock(133, 25)).c(5.0F).b(10.0F).a(i).b("blockEmerald");
public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).b("stairsWoodSpruce").r();
public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).b("stairsWoodBirch").r();
public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).b("stairsWoodJungle").r();
public static final Block COMMAND = (new BlockCommand(137)).b("commandBlock");
public static final Block BEACON = (new BlockBeacon(138)).b("beacon").a(1.0F);
public static final Block COBBLE_WALL = (new BlockCobbleWall(139, COBBLESTONE)).b("cobbleWall");
public static final Block FLOWER_POT = (new BlockFlowerPot(140)).c(0.0F).a(d).b("flowerPot");
public static final Block CARROTS = (new BlockCarrots(141)).b("carrots");
public static final Block POTATOES = (new BlockPotatoes(142)).b("potatoes");
public static final Block WOOD_BUTTON = (new BlockButton(143, WOOD.textureId, true)).c(0.5F).a(e).b("button").r();
public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(h).b("skull").r();
public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(o).b(2000.0F).b("anvil").r();
public int textureId;
public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(l).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c);
public static final Block WHITESTONE = (new Block(121, Material.STONE)).c(3.0F).b(15.0F).a(j).c("whiteStone").a(CreativeModeTab.b);
public static final Block DRAGON_EGG = (new BlockDragonEgg(122)).c(3.0F).b(15.0F).a(j).a(0.125F).c("dragonEgg");
public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(l).c("redstoneLight").a(CreativeModeTab.d);
public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(l).c("redstoneLight");
public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(g).c("woodSlab");
public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(g).c("woodSlab");
public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(g).c("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(j).c("oreEmerald");
public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(j).c("enderChest").a(0.5F);
public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).c("tripWireSource");
public static final Block TRIPWIRE = (new BlockTripwire(132)).c("tripWire");
public static final Block EMERALD_BLOCK = (new BlockOreBlock(133)).c(5.0F).b(10.0F).a(k).c("blockEmerald");
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)).c("commandBlock");
public static final BlockBeacon BEACON = (BlockBeacon) (new BlockBeacon(138)).c("beacon").a(1.0F);
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(f).c("flowerPot");
public static final Block CARROTS = (new BlockCarrots(141)).c("carrots");
public static final Block POTATOES = (new BlockPotatoes(142)).c("potatoes");
public static final Block WOOD_BUTTON = (new BlockWoodButton(143)).c(0.5F).a(g).c("button");
public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(j).c("skull");
public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(q).b(2000.0F).c("anvil");
public static final Block TRAPPED_CHEST = (new BlockChest(146, 1)).c(2.5F).a(g).c("chestTrap");
public static final Block GOLD_PLATE = (new BlockPressurePlateWeighted(147, "blockGold", Material.ORE, 64)).c(0.5F).a(g).c("weightedPlate_light");
public static final Block IRON_PLATE = (new BlockPressurePlateWeighted(148, "blockIron", Material.ORE, 640)).c(0.5F).a(g).c("weightedPlate_heavy");
public static final BlockRedstoneComparator REDSTONE_COMPARATOR_OFF = (BlockRedstoneComparator) (new BlockRedstoneComparator(149, false)).c(0.0F).a(g).c("comparator").D();
public static final BlockRedstoneComparator REDSTONE_COMPARATOR_ON = (BlockRedstoneComparator) (new BlockRedstoneComparator(150, true)).c(0.0F).a(0.625F).a(g).c("comparator").D();
public static final BlockDaylightDetector DAYLIGHT_DETECTOR = (BlockDaylightDetector) (new BlockDaylightDetector(151)).c(0.2F).a(g).c("daylightDetector");
public static final Block REDSTONE_BLOCK = (new BlockRedstone(152)).c(5.0F).b(10.0F).a(k).c("blockRedstone");
public static final Block QUARTZ_ORE = (new BlockOre(153)).c(3.0F).b(5.0F).a(j).c("netherquartz");
public static final BlockHopper HOPPER = (BlockHopper) (new BlockHopper(154)).c(3.0F).b(8.0F).a(g).c("hopper");
public static final Block QUARTZ_BLOCK = (new BlockQuartz(155)).a(j).c(0.8F).c("quartzBlock");
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(k).c("activatorRail");
public static final Block DROPPER = (new BlockDropper(158)).c(3.5F).a(j).c("dropper");
public final int id;
protected float strength;
protected float durability;
protected boolean cp;
protected boolean cq;
protected boolean cr;
protected boolean cC = true;
protected boolean cD = true;
protected boolean cE;
protected boolean isTileEntity;
protected double minX;
protected double minY;
@ -185,16 +196,14 @@ public class Block {
protected double maxY;
protected double maxZ;
public StepSound stepSound;
public float cA;
public float cN;
public final Material material;
public float frictionFactor;
private String name;
protected Block(int i, Material material) {
this.cp = true;
this.cq = true;
this.stepSound = d;
this.cA = 1.0F;
this.stepSound = f;
this.cN = 1.0F;
this.frictionFactor = 0.6F;
if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
@ -203,30 +212,20 @@ public class Block {
byId[i] = this;
this.id = i;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
q[i] = this.c();
s[i] = this.c();
lightBlock[i] = this.c() ? 255 : 0;
s[i] = !material.blocksLight();
u[i] = !material.blocksLight();
}
}
protected Block r() {
u[this.id] = true;
return this;
}
protected void t_() {}
protected Block(int i, int j, Material material) {
this(i, material);
this.textureId = j;
}
protected void s_() {}
protected Block a(StepSound stepsound) {
this.stepSound = stepsound;
return this;
}
protected Block h(int i) {
protected Block k(int i) {
lightBlock[this.id] = i;
return this;
}
@ -241,17 +240,17 @@ public class Block {
return this;
}
public static boolean i(int i) {
public static boolean l(int i) {
Block block = byId[i];
return block == null ? false : block.material.k() && block.b();
return block == null ? false : block.material.k() && block.b() && !block.isPowerSource();
}
public boolean b() {
return true;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return !this.material.isSolid();
}
@ -268,25 +267,25 @@ public class Block {
return this;
}
protected Block s() {
protected Block r() {
this.c(-1.0F);
return this;
}
public float m(World world, int i, int j, int k) {
public float l(World world, int i, int j, int k) {
return this.strength;
}
protected Block b(boolean flag) {
this.cr = flag;
this.cE = flag;
return this;
}
public boolean isTicking() {
return this.cr;
return this.cE;
}
public boolean u() {
public boolean t() {
return this.isTileEntity;
}
@ -303,23 +302,15 @@ public class Block {
return iblockaccess.getMaterial(i, j, k).isBuildable();
}
public int a(int i, int j) {
return this.a(i);
}
public int a(int i) {
return this.textureId;
}
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
AxisAlignedBB axisalignedbb1 = this.e(world, i, j, k);
AxisAlignedBB axisalignedbb1 = this.b(world, i, j, k);
if (axisalignedbb1 != null && axisalignedbb.a(axisalignedbb1)) {
list.add(axisalignedbb1);
}
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(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);
}
@ -335,13 +326,13 @@ public class Block {
return true;
}
public void b(World world, int i, int j, int k, Random random) {}
public void a(World world, int i, int j, int k, Random random) {}
public void postBreak(World world, int i, int j, int k, int l) {}
public void doPhysics(World world, int i, int j, int k, int l) {}
public int r_() {
public int a(World world) {
return 10;
}
@ -358,9 +349,9 @@ public class Block {
}
public float getDamage(EntityHuman entityhuman, World world, int i, int j, int k) {
float f = this.m(world, i, j, k);
float f = this.l(world, i, j, k);
return f < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / f / 100.0F : entityhuman.a(this) / f / 30.0F);
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) {
@ -397,7 +388,7 @@ public class Block {
}
}
protected void f(World world, int i, int j, int k, int l) {
protected void j(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
while (l > 0) {
int i1 = EntityExperienceOrb.getOrbValue(l);
@ -522,7 +513,11 @@ public class Block {
return vec3d == null ? false : vec3d.c >= this.minX && vec3d.c <= this.maxX && vec3d.d >= this.minY && vec3d.d <= this.maxY;
}
public void wasExploded(World world, int i, int j, int k) {}
public void wasExploded(World world, int i, int j, int k, Explosion explosion) {}
public boolean canPlace(World world, int i, int j, int k, int l, ItemStack itemstack) {
return this.canPlace(world, i, j, k, l);
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return this.canPlace(world, i, j, k);
@ -550,32 +545,32 @@ public class Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {}
public final double v() {
public final double u() {
return this.minX;
}
public final double w() {
public final double v() {
return this.maxX;
}
public final double x() {
public final double w() {
return this.minY;
}
public final double y() {
public final double x() {
return this.maxY;
}
public final double z() {
public final double y() {
return this.minZ;
}
public final double A() {
public final double z() {
return this.maxZ;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return 0;
}
public boolean isPowerSource() {
@ -584,17 +579,17 @@ public class Block {
public void a(World world, int i, int j, int k, Entity entity) {}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return 0;
}
public void f() {}
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.j(0.025F);
if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.f_(l);
if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.c_(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
@ -606,14 +601,14 @@ public class Block {
}
}
protected boolean s_() {
protected boolean r_() {
return this.b() && !this.isTileEntity;
}
protected ItemStack f_(int i) {
protected ItemStack c_(int i) {
int j = 0;
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].l()) {
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].m()) {
j = i;
}
@ -624,16 +619,16 @@ public class Block {
return this.a(random);
}
public boolean d(World world, int i, int j, int k) {
public boolean f(World world, int i, int j, int k) {
return true;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {}
public void postPlace(World world, int i, int j, int k, int l) {}
public Block b(String s) {
this.name = "tile." + s;
public Block c(String s) {
this.name = s;
return this;
}
@ -642,21 +637,23 @@ public class Block {
}
public String a() {
return this.name;
return "tile." + this.name;
}
public void b(World world, int i, int j, int k, int l, int i1) {}
public boolean b(World world, int i, int j, int k, int l, int i1) {
return false;
}
public boolean C() {
return this.cq;
return this.cD;
}
protected Block D() {
this.cq = false;
this.cD = false;
return this;
}
public int q_() {
public int h() {
return this.material.getPushReaction();
}
@ -673,9 +670,9 @@ public class Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
public void h(World world, int i, int j, int k, int l) {}
public void l(World world, int i, int j, int k, int l) {}
public void f(World world, int i, int j, int k) {}
public void g(World world, int i, int j, int k) {}
public boolean l() {
return true;
@ -685,6 +682,22 @@ public class Block {
return true;
}
public boolean i(int i) {
return this.id == i;
}
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 boolean q_() {
return false;
}
public int b_(World world, int i, int j, int k, int l) {
return 0;
}
static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
Item.byId[LOG.id] = (new ItemMultiTexture(LOG.id - 256, LOG, BlockLog.a)).b("log");
@ -692,6 +705,7 @@ public class Block {
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");
@ -700,6 +714,7 @@ public class Block {
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);
@ -715,7 +730,7 @@ public class Block {
if (byId[i] != null) {
if (Item.byId[i] == null) {
Item.byId[i] = new ItemBlock(i - 256);
byId[i].t_();
byId[i].s_();
}
boolean flag = false;
@ -732,7 +747,7 @@ public class Block {
flag = true;
}
if (s[i]) {
if (u[i]) {
flag = true;
}
@ -740,11 +755,11 @@ public class Block {
flag = true;
}
v[i] = flag;
w[i] = flag;
}
}
s[0] = true;
u[0] = true;
StatisticList.b();
}

View file

@ -4,8 +4,8 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockBloodStone extends Block {
public BlockBloodStone(int i, int j) {
super(i, j, Material.STONE);
public BlockBloodStone(int i) {
super(i, Material.STONE);
this.a(CreativeModeTab.b);
}

View file

@ -8,22 +8,22 @@ import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.entity.EntityInteractEvent;
// CraftBukkit end
public class BlockButton extends Block {
public abstract class BlockButtonAbstract extends Block {
private final boolean a;
protected BlockButton(int i, int j, boolean flag) {
super(i, j, Material.ORIENTABLE);
protected BlockButtonAbstract(int i, boolean flag) {
super(i, Material.ORIENTABLE);
this.b(true);
this.a(CreativeModeTab.d);
this.a = flag;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
public int r_() {
public int a(World world) {
return this.a ? 30 : 20;
}
@ -36,11 +36,11 @@ public class BlockButton extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)));
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)));
}
public boolean canPlace(World world, int i, int j, int k) {
return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : world.t(i, j, k + 1)));
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)));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@ -48,57 +48,57 @@ public class BlockButton extends Block {
int k1 = j1 & 8;
j1 &= 7;
if (l == 2 && world.t(i, j, k + 1)) {
if (l == 2 && world.u(i, j, k + 1)) {
j1 = 4;
} else if (l == 3 && world.t(i, j, k - 1)) {
} else if (l == 3 && world.u(i, j, k - 1)) {
j1 = 3;
} else if (l == 4 && world.t(i + 1, j, k)) {
} else if (l == 4 && world.u(i + 1, j, k)) {
j1 = 2;
} else if (l == 5 && world.t(i - 1, j, k)) {
} else if (l == 5 && world.u(i - 1, j, k)) {
j1 = 1;
} else {
j1 = this.l(world, i, j, k);
j1 = this.k(world, i, j, k);
}
return j1 + k1;
}
private int l(World world, int i, int j, int k) {
return world.t(i - 1, j, k) ? 1 : (world.t(i + 1, j, k) ? 2 : (world.t(i, j, k - 1) ? 3 : (world.t(i, j, k + 1) ? 4 : 1)));
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)));
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (this.n(world, i, j, k)) {
if (this.m(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
if (!world.t(i - 1, j, k) && i1 == 1) {
if (!world.u(i - 1, j, k) && i1 == 1) {
flag = true;
}
if (!world.t(i + 1, j, k) && i1 == 2) {
if (!world.u(i + 1, j, k) && i1 == 2) {
flag = true;
}
if (!world.t(i, j, k - 1) && i1 == 3) {
if (!world.u(i, j, k - 1) && i1 == 3) {
flag = true;
}
if (!world.t(i, j, k + 1) && i1 == 4) {
if (!world.u(i, j, k + 1) && i1 == 4) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
}
private boolean n(World world, int i, int j, int 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);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
return false;
} else {
return true;
@ -108,10 +108,10 @@ public class BlockButton extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
this.e(l);
this.d(l);
}
private void e(int i) {
private void d(int i) {
int j = i & 7;
boolean flag = (i & 8) > 0;
float f = 0.375F;
@ -146,8 +146,8 @@ public class BlockButton extends Block {
} else {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
int old = (k1 != 8) ? 1 : 0;
int current = (k1 == 8) ? 1 : 0;
int old = (k1 != 8) ? 15 : 0;
int current = (k1 == 8) ? 15 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
@ -157,11 +157,11 @@ public class BlockButton extends Block {
}
// CraftBukkit end
world.setData(i, j, k, j1 + k1);
world.e(i, j, k, i, j, k);
world.setData(i, j, k, j1 + k1, 3);
world.g(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.r_());
world.a(i, j, k, this.id, this.a(world));
return true;
}
}
@ -176,19 +176,19 @@ public class BlockButton extends Block {
super.remove(world, i, j, k, l, i1);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) > 0;
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) > 0 ? 15 : 0;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if ((i1 & 8) == 0) {
return false;
return 0;
} else {
int j1 = i1 & 7;
return j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5)));
return j1 == 5 && l == 1 ? 15 : (j1 == 4 && l == 2 ? 15 : (j1 == 3 && l == 3 ? 15 : (j1 == 2 && l == 4 ? 15 : (j1 == 1 && l == 5 ? 15 : 0))));
}
}
@ -196,7 +196,7 @@ public class BlockButton extends Block {
return true;
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@ -204,7 +204,7 @@ public class BlockButton extends Block {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
world.getServer().getPluginManager().callEvent(eventRedstone);
if (eventRedstone.getNewCurrent() > 0) {
@ -213,20 +213,20 @@ public class BlockButton extends Block {
// CraftBukkit end
if (this.a) {
this.o(world, i, j, k);
this.n(world, i, j, k);
} else {
world.setData(i, j, k, l & 7);
world.setData(i, j, k, l & 7, 3);
int i1 = l & 7;
this.d(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.e(i, j, k, i, j, k);
world.g(i, j, k, i, j, k);
}
}
}
}
public void f() {
public void g() {
float f = 0.1875F;
float f1 = 0.125F;
float f2 = 0.125F;
@ -246,37 +246,38 @@ public class BlockButton extends Block {
return;
}
// CraftBukkit end
this.o(world, i, j, k);
this.n(world, i, j, k);
}
}
}
}
private void o(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);
int i1 = l & 7;
boolean flag = (l & 8) != 0;
this.e(l);
this.d(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();
if (flag1 && !flag) {
world.setData(i, j, k, i1 | 8);
world.setData(i, j, k, i1 | 8, 3);
this.d(world, i, j, k, i1);
world.e(i, j, k, i, j, k);
world.g(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);
world.setData(i, j, k, i1, 3);
this.d(world, i, j, k, i1);
world.e(i, j, k, i, j, k);
world.g(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.r_());
world.a(i, j, k, this.id, this.a(world));
}
}

View file

@ -6,13 +6,13 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent; // CraftBukkit
public class BlockCactus extends Block {
protected BlockCactus(int i, int j) {
super(i, j, Material.CACTUS);
protected BlockCactus(int i) {
super(i, Material.CACTUS);
this.b(true);
this.a(CreativeModeTab.c);
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (world.isEmpty(i, j + 1, k)) {
int l;
@ -25,24 +25,21 @@ public class BlockCactus extends Block {
if (i1 == 15) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
world.setData(i, j, k, 0);
world.setData(i, j, k, 0, 4);
this.doPhysics(world, i, j + 1, k, this.id);
} else {
world.setData(i, j, k, i1 + 1);
world.setData(i, j, k, i1 + 1, 4);
}
}
}
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(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 int a(int i) {
return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId + 1 : this.textureId);
}
public boolean b() {
return false;
}
@ -56,17 +53,16 @@ public class BlockCactus extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return !super.canPlace(world, i, j, k) ? false : this.d(world, i, j, k);
return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.d(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
if (!this.f(world, i, j, k)) {
world.setAir(i, j, k, true);
}
}
public boolean d(World world, int i, int j, int k) {
public boolean f(World world, int i, int j, int k) {
if (world.getMaterial(i - 1, j, k).isBuildable()) {
return false;
} else if (world.getMaterial(i + 1, j, k).isBuildable()) {

View file

@ -4,34 +4,36 @@ import java.util.Random;
public class BlockCocoa extends BlockDirectional {
public static final String[] a = new String[] { "cocoa_0", "cocoa_1", "cocoa_2"};
public BlockCocoa(int i) {
super(i, 168, Material.PLANT);
super(i, Material.PLANT);
this.b(true);
}
public void b(World world, int i, int j, int k, Random random) {
if (!this.d(world, i, j, k)) {
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.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
} 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 | e(l)); // CraftBukkit
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, i1 << 2 | j(l)); // CraftBukkit
}
}
}
public boolean d(World world, int i, int j, int k) {
int l = e(world.getData(i, j, k));
public boolean f(World world, int i, int j, int k) {
int l = j(world.getData(i, j, k));
i += Direction.a[l];
k += Direction.b[l];
int i1 = world.getTypeId(i, j, k);
return i1 == Block.LOG.id && BlockLog.e(world.getData(i, j, k)) == 3;
return i1 == Block.LOG.id && BlockLog.d(world.getData(i, j, k)) == 3;
}
public int d() {
@ -46,14 +48,14 @@ public class BlockCocoa extends BlockDirectional {
return false;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.e(world, i, j, k);
return super.b(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
int i1 = e(l);
int i1 = j(l);
int j1 = c(l);
int k1 = 4 + j1 * 2;
int l1 = 5 + j1 * 2;
@ -77,10 +79,10 @@ public class BlockCocoa extends BlockDirectional {
}
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 0) % 4;
world.setData(i, j, k, l);
world.setData(i, j, k, l, 2);
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@ -92,9 +94,9 @@ public class BlockCocoa extends BlockDirectional {
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.d(world, i, j, k)) {
if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}

View file

@ -7,10 +7,10 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockCommand extends BlockContainer {
public BlockCommand(int i) {
super(i, 184, Material.ORE);
super(i, Material.ORE);
}
public TileEntity a(World world) {
public TileEntity b(World world) {
return new TileEntityCommand();
}
@ -22,31 +22,34 @@ public class BlockCommand extends BlockContainer {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
int old = flag1 ? 1 : 0;
int current = flag ? 1 : 0;
int old = flag1 ? 15 : 0;
int current = flag ? 15 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
// CraftBukkit end
if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
world.setRawData(i, j, k, i1 | 1);
world.a(i, j, k, this.id, this.r_());
world.setData(i, j, k, i1 | 1, 4);
world.a(i, j, k, this.id, this.a(world));
} else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
world.setRawData(i, j, k, i1 & -2);
world.setData(i, j, k, i1 & -2, 4);
}
}
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
TileEntity tileentity = world.getTileEntity(i, j, k);
if (tileentity != null && tileentity instanceof TileEntityCommand) {
((TileEntityCommand) tileentity).a(world);
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
tileentitycommand.a(tileentitycommand.a(world));
world.m(i, j, k, this.id);
}
}
public int r_() {
public int a(World world) {
return 1;
}
@ -59,4 +62,22 @@ public class BlockCommand extends BlockContainer {
return true;
}
public boolean q_() {
return true;
}
public int b_(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).d() : 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.c(itemstack.getName());
}
}
}

View file

@ -4,31 +4,29 @@ import java.util.Random;
public class BlockCrops extends BlockFlower {
protected BlockCrops(int i, int j) {
super(i, j);
this.textureId = j;
protected BlockCrops(int i) {
super(i);
this.b(true);
float f = 0.5F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
this.a((CreativeModeTab) null);
this.c(0.0F);
this.a(g);
this.a(Block.i); // CraftBukkit - i -> Block.i, decompile error
this.D();
this.r();
}
protected boolean d_(int i) {
protected boolean f_(int i) {
return i == Block.SOIL.id;
}
public void b(World world, int i, int j, int k, Random random) {
super.b(world, i, j, k, random);
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) {
int l = world.getData(i, j, k);
if (l < 7) {
float f = this.l(world, i, j, k);
float f = this.k(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
@ -37,11 +35,17 @@ public class BlockCrops extends BlockFlower {
}
}
public void c_(World world, int i, int j, int k) {
world.setData(i, j, k, 7);
public void e_(World world, int i, int j, int k) {
int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
if (l > 7) {
l = 7;
}
world.setData(i, j, k, l, 2);
}
private float l(World world, int i, int j, int k) {
private float k(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);
@ -82,23 +86,15 @@ public class BlockCrops extends BlockFlower {
return f;
}
public int a(int i, int j) {
if (j < 0) {
j = 7;
}
return this.textureId + j;
}
public int d() {
return 6;
}
protected int h() {
protected int j() {
return Item.SEEDS.id;
}
protected int j() {
protected int k() {
return Item.WHEAT.id;
}
@ -110,7 +106,7 @@ 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.h(), 1, 0));
this.b(world, i, j, k, new ItemStack(this.j(), 1, 0));
}
}
}
@ -118,7 +114,7 @@ public class BlockCrops extends BlockFlower {
}
public int getDropType(int i, Random random, int j) {
return i == 7 ? this.j() : this.h();
return i == 7 ? this.k() : this.j();
}
public int a(Random random) {

View file

@ -1,228 +0,0 @@
package net.minecraft.server;
import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockDiode extends BlockDirectional {
public static final double[] a = new double[] { -0.0625D, 0.0625D, 0.1875D, 0.3125D};
private static final int[] b = new int[] { 1, 2, 3, 4};
private final boolean c;
protected BlockDiode(int i, boolean flag) {
super(i, 6, Material.ORIENTABLE);
this.c = flag;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
public boolean b() {
return false;
}
public boolean canPlace(World world, int i, int j, int k) {
return !world.v(i, j - 1, k) ? false : super.canPlace(world, i, j, k);
}
public boolean d(World world, int i, int j, int k) {
return !world.v(i, j - 1, k) ? false : super.d(world, i, j, k);
}
public void b(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
boolean flag = this.e(world, i, j, k, l);
if (!flag) {
boolean flag1 = this.i(world, i, j, k, l);
if (this.c && !flag1) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
return;
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.DIODE_OFF.id, l);
} else if (!this.c) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
return;
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.DIODE_ON.id, l);
if (!flag1) {
int i1 = (l & 12) >> 2;
world.a(i, j, k, Block.DIODE_ON.id, b[i1] * 2);
}
}
}
}
public int a(int i, int j) {
return i == 0 ? (this.c ? 99 : 115) : (i == 1 ? (this.c ? 147 : 131) : 5);
}
public int d() {
return 15;
}
public int a(int i) {
return this.a(i, 0);
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return this.b(iblockaccess, i, j, k, l);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (!this.c) {
return false;
} else {
int i1 = e(iblockaccess.getData(i, j, k));
return i1 == 0 && l == 3 ? true : (i1 == 1 && l == 4 ? true : (i1 == 2 && l == 2 ? true : i1 == 3 && l == 5));
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.d(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
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);
} else {
int i1 = world.getData(i, j, k);
boolean flag = this.e(world, i, j, k, i1);
if (!flag) {
boolean flag1 = this.i(world, i, j, k, i1);
int j1 = (i1 & 12) >> 2;
if (this.c && !flag1 || !this.c && flag1) {
byte b0 = 0;
if (this.d(world, i, j, k, i1)) {
b0 = -1;
}
world.a(i, j, k, this.id, b[j1] * 2, b0);
}
}
}
}
private boolean i(World world, int i, int j, int k, int l) {
int i1 = e(l);
switch (i1) {
case 0:
return world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) || world.getTypeId(i, j, k + 1) == Block.REDSTONE_WIRE.id && world.getData(i, j, k + 1) > 0;
case 1:
return world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) || world.getTypeId(i - 1, j, k) == Block.REDSTONE_WIRE.id && world.getData(i - 1, j, k) > 0;
case 2:
return world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) || world.getTypeId(i, j, k - 1) == Block.REDSTONE_WIRE.id && world.getData(i, j, k - 1) > 0;
case 3:
return world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) || world.getTypeId(i + 1, j, k) == Block.REDSTONE_WIRE.id && world.getData(i + 1, j, k) > 0;
default:
return false;
}
}
public boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = e(l);
switch (i1) {
case 0:
case 2:
return iblockaccess.isBlockFacePowered(i - 1, j, k, 4) && c(iblockaccess.getTypeId(i - 1, j, k)) || iblockaccess.isBlockFacePowered(i + 1, j, k, 5) && c(iblockaccess.getTypeId(i + 1, j, k));
case 1:
case 3:
return iblockaccess.isBlockFacePowered(i, j, k + 1, 3) && c(iblockaccess.getTypeId(i, j, k + 1)) || iblockaccess.isBlockFacePowered(i, j, k - 1, 2) && c(iblockaccess.getTypeId(i, j, k - 1));
default:
return false;
}
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
int i1 = world.getData(i, j, k);
int j1 = (i1 & 12) >> 2;
j1 = j1 + 1 << 2 & 12;
world.setData(i, j, k, j1 | i1 & 3);
return true;
}
public boolean isPowerSource() {
return true;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
world.setData(i, j, k, l);
boolean flag = this.i(world, i, j, k, l);
if (flag) {
world.a(i, j, k, this.id, 1);
}
}
public void onPlace(World world, int i, int j, int 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);
}
public void postBreak(World world, int i, int j, int k, int l) {
if (this.c) {
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);
}
super.postBreak(world, i, j, k, l);
}
public boolean c() {
return false;
}
public int getDropType(int i, Random random, int j) {
return Item.DIODE.id;
}
public static boolean c(int i) {
return i == Block.DIODE_ON.id || i == Block.DIODE_OFF.id;
}
public boolean d(World world, int i, int j, int k, int l) {
int i1 = e(l);
if (c(world.getTypeId(i - Direction.a[i1], j, k - Direction.b[i1]))) {
int j1 = world.getData(i - Direction.a[i1], j, k - Direction.b[i1]);
int k1 = e(j1);
return k1 != i1;
} else {
return false;
}
}
}

View file

@ -0,0 +1,261 @@
package net.minecraft.server;
import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public abstract class BlockDiodeAbstract extends BlockDirectional {
protected final boolean a;
protected BlockDiodeAbstract(int i, boolean flag) {
super(i, Material.ORIENTABLE);
this.a = flag;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
public boolean b() {
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);
}
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 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.a && !flag) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
return;
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, this.j().id, l, 2);
} else if (!this.a) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
return;
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, this.i().id, l, 2);
if (!flag) {
world.a(i, j, k, this.i().id, this.h(l), -1);
}
}
}
}
public int d() {
return 36;
}
protected boolean c(int i) {
return this.a;
}
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return this.b(iblockaccess, i, j, k, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if (!this.c(i1)) {
return 0;
} else {
int j1 = j(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)));
}
}
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.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);
} else {
this.f(world, i, j, k, l);
}
}
protected void f(World world, int i, int j, int k, int l) {
int i1 = 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.a && !flag || !this.a && flag) && !world.a(i, j, k, this.id)) {
byte b0 = -1;
if (this.h(world, i, j, k, i1)) {
b0 = -3;
} else if (this.a) {
b0 = -2;
}
world.a(i, j, k, this.id, this.i_(i1), b0);
}
}
}
public boolean e(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 int e(World world, int i, int j, int k, int l) {
int i1 = j(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);
}
protected int f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = j(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));
case 1:
case 3:
return Math.max(this.g(iblockaccess, i, j, k + 1, 3), this.g(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);
return this.e(i1) ? (i1 == Block.REDSTONE_WIRE.id ? iblockaccess.getData(i, j, k) : iblockaccess.getBlockPower(i, j, k, l)) : 0;
}
public boolean isPowerSource() {
return true;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
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);
if (flag) {
world.a(i, j, k, this.id, 1);
}
}
public void onPlace(World world, int i, int j, int k) {
this.h_(world, i, j, k);
}
protected void h_(World world, int i, int j, int k) {
int l = j(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);
}
if (l == 3) {
world.g(i - 1, j, k, this.id);
world.c(i - 1, j, k, this.id, 5);
}
if (l == 2) {
world.g(i, j, k + 1, this.id);
world.c(i, j, k + 1, this.id, 2);
}
if (l == 0) {
world.g(i, j, k - 1, this.id);
world.c(i, j, k - 1, this.id, 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);
}
super.postBreak(world, i, j, k, l);
}
public boolean c() {
return false;
}
protected boolean e(int i) {
Block block = Block.byId[i];
return block != null && block.isPowerSource();
}
protected int d(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 boolean g(int i) {
return i == this.i().id || i == this.j().id;
}
public boolean h(World world, int i, int j, int k, int l) {
int i1 = j(l);
if (f(world.getTypeId(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);
return k1 != i1;
} else {
return false;
}
}
protected int h(int i) {
return this.i_(i);
}
protected abstract int i_(int i);
protected abstract BlockDiodeAbstract i();
protected abstract BlockDiodeAbstract j();
public boolean i(int i) {
return this.g(i);
}
}

View file

@ -5,29 +5,24 @@ import java.util.Random;
public class BlockDispenser extends BlockContainer {
public static final IRegistry a = new RegistryDefault(new DispenseBehaviorItem());
protected Random b = new Random();
public static boolean eventFired = false; // CraftBukkit
private Random b = new Random();
protected BlockDispenser(int i) {
super(i, Material.STONE);
this.textureId = 45;
this.a(CreativeModeTab.d);
}
public int r_() {
public int a(World world) {
return 4;
}
public int getDropType(int i, Random random, int j) {
return Block.DISPENSER.id;
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
this.l(world, i, j, k);
this.k(world, i, j, k);
}
private void l(World world, int i, int j, int k) {
private void k(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);
@ -35,30 +30,26 @@ public class BlockDispenser extends BlockContainer {
int k1 = world.getTypeId(i + 1, j, k);
byte b0 = 3;
if (Block.q[l] && !Block.q[i1]) {
if (Block.s[l] && !Block.s[i1]) {
b0 = 3;
}
if (Block.q[i1] && !Block.q[l]) {
if (Block.s[i1] && !Block.s[l]) {
b0 = 2;
}
if (Block.q[j1] && !Block.q[k1]) {
if (Block.s[j1] && !Block.s[k1]) {
b0 = 5;
}
if (Block.q[k1] && !Block.q[j1]) {
if (Block.s[k1] && !Block.s[j1]) {
b0 = 4;
}
world.setData(i, j, k, b0);
world.setData(i, j, k, b0, 2);
}
}
public int a(int i) {
return i == 1 ? this.textureId + 17 : (i == 0 ? this.textureId + 17 : (i == 3 ? this.textureId + 1 : this.textureId));
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
@ -79,13 +70,13 @@ public class BlockDispenser extends BlockContainer {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
if (tileentitydispenser != null) {
int l = tileentitydispenser.i();
int l = tileentitydispenser.j();
if (l < 0) {
world.triggerEffect(1001, i, j, k, 0);
} else {
ItemStack itemstack = tileentitydispenser.getItem(l);
IDispenseBehavior idispensebehavior = (IDispenseBehavior) a.a(itemstack.getItem());
IDispenseBehavior idispensebehavior = this.a(itemstack);
if (idispensebehavior != IDispenseBehavior.a) {
ItemStack itemstack1 = idispensebehavior.a(sourceblock, itemstack);
@ -97,43 +88,39 @@ public class BlockDispenser extends BlockContainer {
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (l > 0 && Block.byId[l].isPowerSource()) {
boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
protected IDispenseBehavior a(ItemStack itemstack) {
return (IDispenseBehavior) a.a(itemstack.getItem());
}
if (flag) {
world.a(i, j, k, this.id, this.r_());
}
public void doPhysics(World world, int i, int j, int k, int l) {
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;
if (flag && !flag1) {
world.a(i, j, k, this.id, this.a(world));
world.setData(i, j, k, i1 | 8, 4);
} else if (!flag && flag1) {
world.setData(i, j, k, i1 & -9, 4);
}
}
public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic && (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k))) {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
this.dispense(world, i, j, k);
}
}
public TileEntity a(World world) {
public TileEntity b(World world) {
return new TileEntityDispenser();
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = BlockPiston.a(world, i, j, k, entityliving);
if (l == 0) {
world.setData(i, j, k, 2);
}
if (l == 1) {
world.setData(i, j, k, 5);
}
if (l == 2) {
world.setData(i, j, k, 3);
}
if (l == 3) {
world.setData(i, j, k, 4);
world.setData(i, j, k, l, 2);
if (itemstack.hasName()) {
((TileEntityDispenser) world.getTileEntity(i, j, k)).a(itemstack.getName());
}
}
@ -178,11 +165,23 @@ public class BlockDispenser extends BlockContainer {
}
public static IPosition a(ISourceBlock isourceblock) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = j_(isourceblock.h());
double d0 = isourceblock.getX() + 0.7D * (double) enumfacing.c();
double d1 = isourceblock.getY();
double d1 = isourceblock.getY() + 0.7D * (double) enumfacing.d();
double d2 = isourceblock.getZ() + 0.7D * (double) enumfacing.e();
return new Position(d0, d1, d2);
}
public static EnumFacing j_(int i) {
return EnumFacing.a(i & 7);
}
public boolean q_() {
return true;
}
public int b_(World world, int i, int j, int k, int l) {
return Container.b((IInventory) world.getTileEntity(i, j, k));
}
}

View file

@ -6,11 +6,15 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockDoor extends Block {
private static final String[] a = new String[] { "doorWood_lower", "doorWood_upper", "doorIron_lower", "doorIron_upper"};
private final int b;
protected BlockDoor(int i, Material material) {
super(i, material);
this.textureId = 97;
if (material == Material.ORE) {
++this.textureId;
this.b = 2;
} else {
this.b = 0;
}
float f = 0.5F;
@ -23,8 +27,8 @@ public class BlockDoor extends Block {
return false;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
int l = this.b_(iblockaccess, i, j, k);
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
int l = this.c_(iblockaccess, i, j, k);
return (l & 4) != 0;
}
@ -37,24 +41,24 @@ public class BlockDoor extends Block {
return 7;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.e(world, i, j, k);
return super.b(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.e(this.b_(iblockaccess, i, j, k));
this.d(this.c_(iblockaccess, i, j, k));
}
public int d(IBlockAccess iblockaccess, int i, int j, int k) {
return this.b_(iblockaccess, i, j, k) & 3;
return this.c_(iblockaccess, i, j, k) & 3;
}
public boolean a_(IBlockAccess iblockaccess, int i, int j, int k) {
return (this.b_(iblockaccess, i, j, k) & 4) != 0;
public boolean b_(IBlockAccess iblockaccess, int i, int j, int k) {
return (this.c_(iblockaccess, i, j, k) & 4) != 0;
}
private void e(int i) {
private void d(int i) {
float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
@ -111,16 +115,16 @@ public class BlockDoor extends Block {
if (this.material == Material.ORE) {
return true;
} else {
int i1 = this.b_(world, i, j, k);
int i1 = this.c_(world, i, j, k);
int j1 = i1 & 7;
j1 ^= 4;
if ((i1 & 8) == 0) {
world.setData(i, j, k, j1);
world.e(i, j, k, i, j, k);
world.setData(i, j, k, j1, 2);
world.g(i, j, k, i, j, k);
} else {
world.setData(i, j - 1, k, j1);
world.e(i, j - 1, k, i, j, k);
world.setData(i, j - 1, k, j1, 2);
world.g(i, j - 1, k, i, j, k);
}
world.a(entityhuman, 1003, i, j, k, 0);
@ -129,7 +133,7 @@ public class BlockDoor extends Block {
}
public void setDoor(World world, int i, int j, int k, boolean flag) {
int l = this.b_(world, i, j, k);
int l = this.c_(world, i, j, k);
boolean flag1 = (l & 4) != 0;
if (flag1 != flag) {
@ -137,11 +141,11 @@ public class BlockDoor extends Block {
i1 ^= 4;
if ((l & 8) == 0) {
world.setData(i, j, k, i1);
world.e(i, j, k, i, j, k);
world.setData(i, j, k, i1, 2);
world.g(i, j, k, i, j, k);
} else {
world.setData(i, j - 1, k, i1);
world.e(i, j - 1, k, i, j, k);
world.setData(i, j - 1, k, i1, 2);
world.g(i, j - 1, k, i, j, k);
}
world.a((EntityHuman) null, 1003, i, j, k, 0);
@ -155,15 +159,15 @@ public class BlockDoor extends Block {
boolean flag = false;
if (world.getTypeId(i, j + 1, k) != this.id) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
flag = true;
}
if (!world.v(i, j - 1, k)) {
world.setTypeId(i, j, k, 0);
if (!world.w(i, j - 1, k)) {
world.setAir(i, j, k);
flag = true;
if (world.getTypeId(i, j + 1, k) == this.id) {
world.setTypeId(i, j + 1, k, 0);
world.setAir(i, j + 1, k);
}
}
@ -192,8 +196,9 @@ public class BlockDoor extends Block {
}
} else {
if (world.getTypeId(i, j - 1, k) != this.id) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
else if (l > 0 && l != this.id) { // CraftBukkit
this.doPhysics(world, i, j - 1, k, l);
}
@ -210,14 +215,14 @@ public class BlockDoor extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return j >= 255 ? false : world.v(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
return j >= 255 ? false : world.w(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
public int q_() {
public int h() {
return 1;
}
public int b_(IBlockAccess iblockaccess, int i, int j, int k) {
public int c_(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
boolean flag = (l & 8) != 0;
int i1;
@ -238,7 +243,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) {
world.setTypeId(i, j - 1, k, 0);
world.setAir(i, j - 1, k);
}
}
}

View file

@ -6,56 +6,56 @@ import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
public class BlockDragonEgg extends Block {
public BlockDragonEgg(int i, int j) {
super(i, j, Material.DRAGON_EGG);
public BlockDragonEgg(int i) {
super(i, 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.r_());
world.a(i, j, k, this.id, this.a(world));
}
public void doPhysics(World world, int i, int j, int k, int l) {
world.a(i, j, k, this.id, this.r_());
world.a(i, j, k, this.id, this.a(world));
}
public void b(World world, int i, int j, int k, Random random) {
this.l(world, i, j, k);
public void a(World world, int i, int j, int k, Random random) {
this.k(world, i, j, k);
}
private void l(World world, int i, int j, int k) {
private void k(World world, int i, int j, int k) {
if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
if (!BlockSand.instaFall && world.d(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (!BlockSand.instaFall && world.e(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));
world.addEntity(entityfallingblock);
} else {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
while (BlockSand.canFall(world, i, j - 1, k) && j > 0) {
--j;
}
if (j > 0) {
world.setTypeId(i, j, k, this.id);
world.setTypeIdAndData(i, j, k, this.id, 0, 2);
}
}
}
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
this.n(world, i, j, k);
this.m(world, i, j, k);
return true;
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.n(world, i, j, k);
this.m(world, i, j, k);
}
private void n(World world, int i, int j, int k) {
private void m(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
for (int l = 0; l < 1000; ++l) {
int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
@ -79,8 +79,8 @@ public class BlockDragonEgg extends Block {
// CraftBukkit end
if (!world.isStatic) {
world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k));
world.setTypeId(i, j, k, 0);
world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k), 2);
world.setAir(i, j, k);
} else {
short short1 = 128;
@ -103,7 +103,7 @@ public class BlockDragonEgg extends Block {
}
}
public int r_() {
public int a(World world) {
return 5;
}

View file

@ -10,11 +10,11 @@ public class BlockEnderPortal extends BlockContainer {
public static boolean a = false;
protected BlockEnderPortal(int i, Material material) {
super(i, 0, material);
super(i, material);
this.a(1.0F);
}
public TileEntity a(World world) {
public TileEntity b(World world) {
return new TileEntityEnderPortal();
}
@ -44,7 +44,7 @@ public class BlockEnderPortal extends BlockContainer {
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), i, j, k));
world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
entity.b(1);
entity.c(1);
}
}
@ -55,7 +55,7 @@ public class BlockEnderPortal extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {
if (!a) {
if (world.worldProvider.dimension != 0) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
}

View file

@ -13,12 +13,12 @@ public class BlockFire extends Block {
private int[] a = new int[256];
private int[] b = new int[256];
protected BlockFire(int i, int j) {
super(i, j, Material.FIRE);
protected BlockFire(int i) {
super(i, Material.FIRE);
this.b(true);
}
public void t_() {
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);
@ -41,7 +41,7 @@ public class BlockFire extends Block {
this.b[i] = k;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@ -61,11 +61,11 @@ public class BlockFire extends Block {
return 0;
}
public int r_() {
public int a(World world) {
return 30;
}
public void b(World world, int i, int j, int k, Random random) {
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;
@ -77,24 +77,24 @@ public class BlockFire extends Block {
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
if (!flag && world.N() && (world.D(i, j, k) || world.D(i - 1, j, k) || world.D(i + 1, j, k) || world.D(i, j, k - 1) || world.D(i, j, k + 1))) {
if (!flag && world.O() && (world.F(i, j, k) || world.F(i - 1, j, k) || world.F(i + 1, j, k) || world.F(i, j, k - 1) || world.F(i, j, k + 1))) {
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
} else {
int l = world.getData(i, j, k);
if (l < 15) {
world.setRawData(i, j, k, l + random.nextInt(3) / 2);
world.setData(i, j, k, l + random.nextInt(3) / 2, 4);
}
world.a(i, j, k, this.id, this.r_() + random.nextInt(10));
if (!flag && !this.l(world, i, j, k)) {
if (!world.v(i, j - 1, k) || l > 3) {
world.setTypeId(i, j, k, 0);
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.setAir(i, j, k);
}
} else if (!flag && !this.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
} else {
boolean flag1 = world.E(i, j, k);
boolean flag1 = world.G(i, j, k);
byte b0 = 0;
if (flag1) {
@ -126,7 +126,7 @@ public class BlockFire extends Block {
l1 += (k1 - (j + 1)) * 100;
}
int i2 = this.n(world, i1, k1, j1);
int i2 = this.m(world, i1, k1, j1);
if (i2 > 0) {
int j2 = (i2 + 40 + world.difficulty * 7) / (l + 30);
@ -135,7 +135,7 @@ public class BlockFire extends Block {
j2 /= 2;
}
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.N() || !world.D(i1, k1, j1)) && !world.D(i1 - 1, k1, k) && !world.D(i1 + 1, k1, j1) && !world.D(i1, k1, j1 - 1) && !world.D(i1, k1, j1 + 1)) {
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.O() || !world.F(i1, k1, j1)) && !world.F(i1 - 1, k1, k) && !world.F(i1 + 1, k1, j1) && !world.F(i1, k1, j1 - 1) && !world.F(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) {
@ -197,16 +197,16 @@ public class BlockFire extends Block {
}
// CraftBukkit end
if (random.nextInt(i1 + 10) < 5 && !world.D(i, j, k)) {
if (random.nextInt(i1 + 10) < 5 && !world.F(i, j, k)) {
int k1 = i1 + random.nextInt(5) / 4;
if (k1 > 15) {
k1 = 15;
}
world.setTypeIdAndData(i, j, k, this.id, k1);
world.setTypeIdAndData(i, j, k, this.id, k1, 3);
} else {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
if (flag) {
@ -215,11 +215,11 @@ public class BlockFire extends Block {
}
}
private boolean l(World world, int i, int j, int k) {
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 int n(World world, int i, int j, int k) {
private int m(World world, int i, int j, int k) {
byte b0 = 0;
if (!world.isEmpty(i, j, k)) {
@ -251,21 +251,21 @@ public class BlockFire extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return world.v(i, j - 1, k) || this.l(world, i, j, k);
return world.w(i, j - 1, k) || this.k(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.v(i, j - 1, k) && !this.l(world, i, j, k)) {
if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone
}
}
public void onPlace(World world, int i, int j, int k) {
if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.i_(world, i, j, k)) {
if (!world.v(i, j - 1, k) && !this.l(world, i, j, k)) {
if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.n_(world, i, j, k)) {
if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
} else {
world.a(i, j, k, this.id, this.r_() + world.random.nextInt(10));
world.a(i, j, k, this.id, this.a(world) + world.random.nextInt(10));
}
}
}
@ -273,7 +273,7 @@ public class BlockFire extends Block {
// CraftBukkit start
private void fireExtinguished(World world, int x, int y, int z) {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled() == false) {
world.setTypeId(x, y, z, 0);
world.setAir(x, y, z);
}
}
// CraftBukkit end

View file

@ -17,25 +17,24 @@ public class BlockFlowing extends BlockFluids {
super(i, material);
}
private void l(World world, int i, int j, int k) {
private void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
world.setRawTypeIdAndData(i, j, k, this.id + 1, l);
world.e(i, j, k, i, j, k);
world.setTypeIdAndData(i, j, k, this.id + 1, l, 2);
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.Server server = world.getServer();
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
// CraftBukkit end
int l = this.f_(world, i, j, k);
int l = this.k_(world, i, j, k);
byte b0 = 1;
if (this.material == Material.LAVA && !world.worldProvider.e) {
@ -59,8 +58,8 @@ public class BlockFlowing extends BlockFluids {
i1 = -1;
}
if (this.f_(world, i, j + 1, k) >= 0) {
int k1 = this.f_(world, i, j + 1, k);
if (this.k_(world, i, j + 1, k) >= 0) {
int k1 = this.k_(world, i, j + 1, k);
if (k1 >= 8) {
i1 = k1;
@ -72,7 +71,7 @@ public class BlockFlowing extends BlockFluids {
if (this.a >= 2 && this.material == Material.WATER) {
if (world.getMaterial(i, j - 1, k).isBuildable()) {
i1 = 0;
} else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j, k) == 0) {
} else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j - 1, k) == 0) {
i1 = 0;
}
}
@ -84,23 +83,23 @@ public class BlockFlowing extends BlockFluids {
if (i1 == l) {
if (flag) {
this.l(world, i, j, k);
this.k(world, i, j, k);
}
} else {
l = i1;
if (i1 < 0) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
} else {
world.setData(i, j, k, i1);
world.a(i, j, k, this.id, this.r_());
world.setData(i, j, k, i1, 2);
world.a(i, j, k, this.id, this.a(world));
world.applyPhysics(i, j, k, this.id);
}
}
} else {
this.l(world, i, j, k);
this.k(world, i, j, k);
}
if (this.p(world, i, j - 1, k)) {
if (this.o(world, i, j - 1, k)) {
// CraftBukkit start - send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
if (server != null) {
@ -109,7 +108,7 @@ public class BlockFlowing extends BlockFluids {
if (!event.isCancelled()) {
if (this.material == Material.LAVA && world.getMaterial(i, j - 1, k) == Material.WATER) {
world.setTypeId(i, j - 1, k, Block.STONE.id);
world.setTypeIdUpdate(i, j - 1, k, Block.STONE.id);
this.fizz(world, i, j - 1, k);
return;
}
@ -121,8 +120,8 @@ public class BlockFlowing extends BlockFluids {
}
}
// CraftBukkit end
} else if (l >= 0 && (l == 0 || this.o(world, i, j - 1, k))) {
boolean[] aboolean = this.n(world, i, j, k);
} else if (l >= 0 && (l == 0 || this.n(world, i, j - 1, k))) {
boolean[] aboolean = this.m(world, i, j, k);
i1 = l + b0;
if (l >= 8) {
@ -156,7 +155,7 @@ public class BlockFlowing extends BlockFluids {
}
private void flow(World world, int i, int j, int k, int l) {
if (this.p(world, i, j, k)) {
if (this.o(world, i, j, k)) {
int i1 = world.getTypeId(i, j, k);
if (i1 > 0) {
@ -167,7 +166,7 @@ public class BlockFlowing extends BlockFluids {
}
}
world.setTypeIdAndData(i, j, k, this.id, l);
world.setTypeIdAndData(i, j, k, this.id, l, 3);
}
}
@ -195,8 +194,8 @@ public class BlockFlowing extends BlockFluids {
++i2;
}
if (!this.o(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
if (!this.o(world, l1, j - 1, i2)) {
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)) {
return l;
}
@ -214,7 +213,7 @@ public class BlockFlowing extends BlockFluids {
return j1;
}
private boolean[] n(World world, int i, int j, int k) {
private boolean[] m(World world, int i, int j, int k) {
int l;
int i1;
@ -239,8 +238,8 @@ public class BlockFlowing extends BlockFluids {
++j1;
}
if (!this.o(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
if (this.o(world, i1, j - 1, j1)) {
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);
} else {
this.c[l] = 0;
@ -263,7 +262,7 @@ public class BlockFlowing extends BlockFluids {
return this.b;
}
private boolean o(World world, int i, int j, int k) {
private boolean n(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
if (l != Block.WOODEN_DOOR.id && l != Block.IRON_DOOR_BLOCK.id && l != Block.SIGN_POST.id && l != Block.LADDER.id && l != Block.SUGAR_CANE_BLOCK.id) {
@ -280,7 +279,7 @@ public class BlockFlowing extends BlockFluids {
}
protected int d(World world, int i, int j, int k, int l) {
int i1 = this.f_(world, i, j, k);
int i1 = this.k_(world, i, j, k);
if (i1 < 0) {
return l;
@ -297,16 +296,16 @@ public class BlockFlowing extends BlockFluids {
}
}
private boolean p(World world, int i, int j, int k) {
private boolean o(World world, int i, int j, int k) {
Material material = world.getMaterial(i, j, k);
return material == this.material ? false : (material == Material.LAVA ? false : !this.o(world, i, j, k));
return material == this.material ? false : (material == Material.LAVA ? false : !this.n(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.r_());
world.a(i, j, k, this.id, this.a(world));
}
}

View file

@ -12,16 +12,11 @@ public class BlockGrass extends Block {
protected BlockGrass(int i) {
super(i, Material.GRASS);
this.textureId = 3;
this.b(true);
this.a(CreativeModeTab.b);
}
public int a(int i, int j) {
return i == 1 ? 0 : (i == 0 ? 2 : 3);
}
public void b(World world, int i, int j, int k, Random random) {
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) {
// CraftBukkit start

View file

@ -4,8 +4,8 @@ import java.util.Random;
public class BlockIce extends BlockHalfTransparant {
public BlockIce(int i, int j) {
super(i, j, Material.ICE, false);
public BlockIce(int i) {
super(i, "ice", Material.ICE, false);
this.frictionFactor = 0.98F;
this.b(true);
this.a(CreativeModeTab.b);
@ -14,15 +14,15 @@ public class BlockIce extends BlockHalfTransparant {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.j(0.025F);
if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.f_(l);
if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.c_(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
}
} else {
if (world.worldProvider.e) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
return;
}
@ -32,7 +32,7 @@ public class BlockIce extends BlockHalfTransparant {
Material material = world.getMaterial(i, j - 1, k);
if (material.isSolid() || material.isLiquid()) {
world.setTypeId(i, j, k, Block.WATER.id);
world.setTypeIdUpdate(i, j, k, Block.WATER.id);
}
}
}
@ -41,7 +41,7 @@ public class BlockIce extends BlockHalfTransparant {
return 0;
}
public void b(World world, int i, int j, int k, Random random) {
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]) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
@ -50,16 +50,16 @@ public class BlockIce extends BlockHalfTransparant {
// CraftBukkit end
if (world.worldProvider.e) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
return;
}
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, Block.STATIONARY_WATER.id);
world.setTypeIdUpdate(i, j, k, Block.STATIONARY_WATER.id);
}
}
public int q_() {
public int h() {
return 0;
}
}

View file

@ -1,77 +0,0 @@
package net.minecraft.server;
public class BlockJukeBox extends BlockContainer {
protected BlockJukeBox(int i, int j) {
super(i, j, Material.WOOD);
this.a(CreativeModeTab.c);
}
public int a(int i) {
return this.textureId + (i == 1 ? 1 : 0);
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.getData(i, j, k) == 0) {
return false;
} else {
this.dropRecord(world, i, j, k);
return true;
}
}
public void a(World world, int i, int j, int k, ItemStack itemstack) {
if (!world.isStatic) {
TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
if (tileentityrecordplayer != null) {
tileentityrecordplayer.record = itemstack.cloneItemStack();
tileentityrecordplayer.record.count = 1; // CraftBukkit - There can be only one
tileentityrecordplayer.update();
world.setData(i, j, k, 1);
}
}
}
public void dropRecord(World world, int i, int j, int k) {
if (!world.isStatic) {
TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
if (tileentityrecordplayer != null) {
ItemStack itemstack = tileentityrecordplayer.record;
if (itemstack != null) {
world.triggerEffect(1005, i, j, k, 0);
world.a((String) null, i, j, k);
tileentityrecordplayer.record = null;
tileentityrecordplayer.update();
world.setData(i, j, k, 0);
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
ItemStack itemstack1 = itemstack.cloneItemStack();
EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, itemstack1);
entityitem.pickupDelay = 10;
world.addEntity(entityitem);
}
}
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
this.dropRecord(world, i, j, k);
super.remove(world, i, j, k, l, i1);
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) {
super.dropNaturally(world, i, j, k, l, f, 0);
}
}
public TileEntity a(World world) {
return new TileEntityRecordPlayer();
}
}

View file

@ -6,13 +6,13 @@ import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
public class BlockLeaves extends BlockTransparant {
private int cD;
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
int[] b;
public static final String[][] b = new String[][] { { "leaves", "leaves_spruce", "leaves", "leaves_jungle"}, { "leaves_opaque", "leaves_spruce_opaque", "leaves_opaque", "leaves_jungle_opaque"}};
private IIcon[][] cR = new IIcon[2][];
int[] c;
protected BlockLeaves(int i, int j) {
super(i, j, Material.LEAVES, false);
this.cD = j;
protected BlockLeaves(int i) {
super(i, Material.LEAVES, false);
this.b(true);
this.a(CreativeModeTab.c);
}
@ -21,7 +21,7 @@ public class BlockLeaves extends BlockTransparant {
byte b0 = 1;
int j1 = b0 + 1;
if (world.d(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
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) {
@ -30,7 +30,7 @@ public class BlockLeaves extends BlockTransparant {
if (j2 == Block.LEAVES.id) {
int k2 = world.getData(i + k1, j + l1, k + i2);
world.setRawData(i + k1, j + l1, k + i2, k2 | 8);
world.setData(i + k1, j + l1, k + i2, k2 | 8, 4);
}
}
}
@ -38,7 +38,7 @@ public class BlockLeaves extends BlockTransparant {
}
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@ -49,13 +49,13 @@ public class BlockLeaves extends BlockTransparant {
int j1 = b1 * b1;
int k1 = b1 / 2;
if (this.b == null) {
this.b = new int[b1 * b1 * b1];
if (this.c == null) {
this.c = new int[b1 * b1 * b1];
}
int l1;
if (world.d(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
if (world.e(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
int i2;
int j2;
int k2;
@ -65,11 +65,11 @@ public class BlockLeaves extends BlockTransparant {
for (j2 = -b0; j2 <= b0; ++j2) {
k2 = world.getTypeId(i + l1, j + i2, k + j2);
if (k2 == Block.LOG.id) {
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
} else if (k2 == Block.LEAVES.id) {
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
} else {
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
}
}
}
@ -79,29 +79,29 @@ public class BlockLeaves extends BlockTransparant {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
for (k2 = -b0; k2 <= b0; ++k2) {
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
if (this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
if (this.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;
}
if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
if (this.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.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
if (this.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.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
if (this.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.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
if (this.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.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
}
}
}
@ -110,17 +110,17 @@ public class BlockLeaves extends BlockTransparant {
}
}
l1 = this.b[k1 * j1 + k1 * b1 + k1];
l1 = this.c[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) {
world.setRawData(i, j, k, l & -9);
world.setData(i, j, k, l & -9, 4);
} else {
this.l(world, i, j, k);
this.k(world, i, j, k);
}
}
}
}
private void l(World world, int i, int j, int k) {
private void k(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);
@ -131,7 +131,7 @@ public class BlockLeaves extends BlockTransparant {
// CraftBukkit end
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
public int a(Random random) {
@ -144,26 +144,41 @@ public class BlockLeaves extends BlockTransparant {
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) {
byte b0 = 20;
int j1 = 20;
if ((l & 3) == 3) {
b0 = 40;
j1 = 40;
}
if (world.random.nextInt(b0) == 0) {
int j1 = this.getDropType(l, world.random, i1);
this.b(world, i, j, k, new ItemStack(j1, 1, this.getDropData(l)));
if (i1 > 0) {
j1 -= 2 << i1;
if (j1 < 10) {
j1 = 10;
}
}
if ((l & 3) == 0 && world.random.nextInt(200) == 0) {
if (world.random.nextInt(j1) == 0) {
int k1 = this.getDropType(l, world.random, i1);
this.b(world, i, j, k, new ItemStack(k1, 1, this.getDropData(l)));
}
j1 = 200;
if (i1 > 0) {
j1 -= 10 << i1;
if (j1 < 40) {
j1 = 40;
}
}
if ((l & 3) == 0 && world.random.nextInt(j1) == 0) {
this.b(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
}
}
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
if (!world.isStatic && entityhuman.cb() != null && entityhuman.cb().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));
} else {
@ -176,14 +191,10 @@ public class BlockLeaves extends BlockTransparant {
}
public boolean c() {
return !this.c;
return !this.d;
}
public int a(int i, int j) {
return (j & 3) == 1 ? this.textureId + 80 : ((j & 3) == 3 ? this.textureId + 144 : this.textureId);
}
protected ItemStack f_(int i) {
protected ItemStack c_(int i) {
return new ItemStack(this.id, 1, i & 3);
}
}

View file

@ -4,12 +4,12 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockLever extends Block {
protected BlockLever(int i, int j) {
super(i, j, Material.ORIENTABLE);
protected BlockLever(int i) {
super(i, Material.ORIENTABLE);
this.a(CreativeModeTab.d);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@ -26,46 +26,66 @@ public class BlockLever extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 0 && world.t(i, j + 1, k) ? true : (l == 1 && world.v(i, j - 1, k) ? true : (l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)))));
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)))));
}
public boolean canPlace(World world, int i, int j, int k) {
return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : (world.t(i, j, k + 1) ? true : (world.v(i, j - 1, k) ? true : world.t(i, j + 1, k)))));
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)))));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
int j1 = i1 & 8;
int k1 = i1 & 7;
byte b0 = -1;
k1 = -1;
if (l == 0 && world.t(i, j + 1, k)) {
k1 = world.random.nextBoolean() ? 0 : 7;
if (l == 0 && world.u(i, j + 1, k)) {
b0 = 0;
}
if (l == 1 && world.v(i, j - 1, k)) {
k1 = 5 + world.random.nextInt(2);
if (l == 1 && world.w(i, j - 1, k)) {
b0 = 5;
}
if (l == 2 && world.t(i, j, k + 1)) {
k1 = 4;
if (l == 2 && world.u(i, j, k + 1)) {
b0 = 4;
}
if (l == 3 && world.t(i, j, k - 1)) {
k1 = 3;
if (l == 3 && world.u(i, j, k - 1)) {
b0 = 3;
}
if (l == 4 && world.t(i + 1, j, k)) {
k1 = 2;
if (l == 4 && world.u(i + 1, j, k)) {
b0 = 2;
}
if (l == 5 && world.t(i - 1, j, k)) {
k1 = 1;
if (l == 5 && world.u(i - 1, j, k)) {
b0 = 1;
}
return k1 + j1;
return b0 + j1;
}
public static int e(int i) {
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = world.getData(i, j, k);
int i1 = l & 7;
int j1 = l & 8;
if (i1 == d(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)) {
if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
world.setData(i, j, k, 7 | j1, 2);
} else {
world.setData(i, j, k, 0 | j1, 2);
}
}
}
public static int d(int i) {
switch (i) {
case 0:
return 0;
@ -91,53 +111,53 @@ public class BlockLever extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (this.l(world, i, j, k)) {
if (this.k(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
if (!world.t(i - 1, j, k) && i1 == 1) {
if (!world.u(i - 1, j, k) && i1 == 1) {
flag = true;
}
if (!world.t(i + 1, j, k) && i1 == 2) {
if (!world.u(i + 1, j, k) && i1 == 2) {
flag = true;
}
if (!world.t(i, j, k - 1) && i1 == 3) {
if (!world.u(i, j, k - 1) && i1 == 3) {
flag = true;
}
if (!world.t(i, j, k + 1) && i1 == 4) {
if (!world.u(i, j, k + 1) && i1 == 4) {
flag = true;
}
if (!world.v(i, j - 1, k) && i1 == 5) {
if (!world.w(i, j - 1, k) && i1 == 5) {
flag = true;
}
if (!world.v(i, j - 1, k) && i1 == 6) {
if (!world.w(i, j - 1, k) && i1 == 6) {
flag = true;
}
if (!world.t(i, j + 1, k) && i1 == 0) {
if (!world.u(i, j + 1, k) && i1 == 0) {
flag = true;
}
if (!world.t(i, j + 1, k) && i1 == 7) {
if (!world.u(i, j + 1, k) && i1 == 7) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
}
private boolean l(World world, int i, int j, int k) {
private boolean k(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);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
return false;
} else {
return true;
@ -167,8 +187,6 @@ public class BlockLever extends Block {
}
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
@ -179,8 +197,8 @@ public class BlockLever extends Block {
// CraftBukkit start - Interact Lever
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
int old = (k1 != 8) ? 1 : 0;
int current = (k1 == 8) ? 1 : 0;
int old = (k1 != 8) ? 15 : 0;
int current = (k1 == 8) ? 15 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
@ -190,8 +208,7 @@ public class BlockLever extends Block {
}
// CraftBukkit end
world.setData(i, j, k, j1 + k1);
world.e(i, j, k, i, j, k);
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);
if (j1 == 1) {
@ -239,19 +256,19 @@ public class BlockLever extends Block {
super.remove(world, i, j, k, l, i1);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) > 0;
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) > 0 ? 15 : 0;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if ((i1 & 8) == 0) {
return false;
return 0;
} else {
int j1 = i1 & 7;
return j1 == 0 && l == 0 ? true : (j1 == 7 && l == 0 ? true : (j1 == 6 && l == 1 ? true : (j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5))))));
return j1 == 0 && l == 0 ? 15 : (j1 == 7 && l == 0 ? 15 : (j1 == 6 && l == 1 ? 15 : (j1 == 5 && l == 1 ? 15 : (j1 == 4 && l == 2 ? 15 : (j1 == 3 && l == 3 ? 15 : (j1 == 2 && l == 4 ? 15 : (j1 == 1 && l == 5 ? 15 : 0)))))));
}
}

View file

@ -5,14 +5,14 @@ import java.util.Random;
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockMinecartDetector extends BlockMinecartTrack {
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public BlockMinecartDetector(int i, int j) {
super(i, j, true);
public BlockMinecartDetector(int i) {
super(i, true);
this.b(true);
}
public int r_() {
public int a(World world) {
return 20;
}
@ -30,7 +30,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
}
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@ -40,19 +40,19 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
}
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) != 0;
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) != 0 ? 15 : 0;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) == 0 ? false : l == 1;
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
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) {
boolean flag = (l & 8) != 0;
boolean flag1 = false;
float f = 0.125F;
List list = world.a(EntityMinecart.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
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)));
if (!list.isEmpty()) {
flag1 = true;
@ -62,7 +62,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
if (flag != flag1) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0);
world.getServer().getPluginManager().callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0;
@ -70,21 +70,45 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
// CraftBukkit end
if (flag1 && !flag) {
world.setData(i, j, k, l | 8);
world.setData(i, j, k, l | 8, 3);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.e(i, j, k, i, j, k);
world.g(i, j, k, i, j, k);
}
if (!flag1 && flag) {
world.setData(i, j, k, l & 7);
world.setData(i, j, k, l & 7, 3);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.e(i, j, k, i, j, k);
world.g(i, j, k, i, j, k);
}
if (flag1) {
world.a(i, j, k, this.id, this.r_());
world.a(i, j, k, this.id, this.a(world));
}
world.m(i, j, k, this.id);
}
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));
}
public boolean q_() {
return true;
}
public int b_(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);
if (list.size() > 0) {
return Container.b((IInventory) list.get(0));
}
}
return 0;
}
}

View file

@ -4,11 +4,11 @@ import java.util.Random;
public class BlockMobSpawner extends BlockContainer {
protected BlockMobSpawner(int i, int j) {
super(i, j, Material.STONE);
protected BlockMobSpawner(int i) {
super(i, Material.STONE);
}
public TileEntity a(World world) {
public TileEntity b(World world) {
return new TileEntityMobSpawner();
}
@ -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.f(world, i, j, k, j1);*/
this.j(world, i, j, k, j1);*/
}
public int getExpDrop(World world, int data, int enchantmentLevel) {

View file

@ -14,15 +14,18 @@ import org.bukkit.event.world.StructureGrowEvent;
public class BlockMushroom extends BlockFlower {
protected BlockMushroom(int i, int j) {
super(i, j);
private final String a;
protected BlockMushroom(int i, String s) {
super(i);
this.a = s;
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);
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
if (random.nextInt(25) == 0) {
byte b0 = 4;
@ -50,7 +53,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.d(world, i1, j1, k1)) {
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
@ -61,7 +64,7 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
}
if (world.isEmpty(i1, j1, k1) && this.d(world, i1, j1, k1)) {
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
@ -79,18 +82,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.d(world, i, j, k);
return super.canPlace(world, i, j, k) && this.f(world, i, j, k);
}
protected boolean d_(int i) {
return Block.q[i];
protected boolean f_(int i) {
return Block.s[i];
}
public boolean d(World world, int i, int j, int k) {
public boolean f(World world, int i, int j, int k) {
if (j >= 0 && j < 256) {
int l = world.getTypeId(i, j - 1, k);
return l == Block.MYCEL.id || world.l(i, j, k) < 13 && this.d_(l);
return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.f_(l);
} else {
return false;
}
@ -100,7 +103,7 @@ public class BlockMushroom extends BlockFlower {
public boolean grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
int l = world.getData(i, j, k);
world.setRawTypeId(i, j, k, 0);
world.setAir(i, j, k);
// CraftBukkit start
boolean grown = false;
StructureGrowEvent event = null;
@ -122,7 +125,7 @@ public class BlockMushroom extends BlockFlower {
}
}
if (!grown || event.isCancelled()) {
world.setRawTypeIdAndData(i, j, k, this.id, l);
world.setTypeIdAndData(i, j, k, this.id, l, 3);
return false;
}
return true;

View file

@ -12,16 +12,11 @@ public class BlockMycel extends Block {
protected BlockMycel(int i) {
super(i, Material.GRASS);
this.textureId = 77;
this.b(true);
this.a(CreativeModeTab.b);
}
public int a(int i, int j) {
return i == 1 ? 78 : (i == 0 ? 2 : 77);
}
public void b(World world, int i, int j, int k, Random random) {
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) {
// CraftBukkit start

View file

@ -4,8 +4,10 @@ import java.util.Random;
public class BlockNetherWart extends BlockFlower {
private static final String[] a = new String[] { "netherStalk_0", "netherStalk_1", "netherStalk_2"};
protected BlockNetherWart(int i) {
super(i, 226);
super(i);
this.b(true);
float f = 0.5F;
@ -13,26 +15,22 @@ public class BlockNetherWart extends BlockFlower {
this.a((CreativeModeTab) null);
}
protected boolean d_(int i) {
protected boolean f_(int i) {
return i == Block.SOUL_SAND.id;
}
public boolean d(World world, int i, int j, int k) {
return this.d_(world.getTypeId(i, j - 1, k));
public boolean f(World world, int i, int j, int k) {
return this.f_(world.getTypeId(i, j - 1, k));
}
public void b(World world, int i, int j, int k, Random random) {
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
}
super.b(world, i, j, k, random);
}
public int a(int i, int j) {
return j >= 3 ? this.textureId + 2 : (j > 0 ? this.textureId + 1 : this.textureId);
super.a(world, i, j, k, random);
}
public int d() {

View file

@ -4,13 +4,13 @@ import java.util.Random;
public class BlockOre extends Block {
public BlockOre(int i, int j) {
super(i, j, Material.STONE);
public BlockOre(int i) {
super(i, 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)));
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 int a(Random random) {
@ -45,9 +45,11 @@ public class BlockOre extends Block {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.LAPIS_ORE.id) {
j1 = MathHelper.nextInt(world.random, 2, 5);
} else if (this.id == Block.QUARTZ_ORE.id) {
j1 = MathHelper.nextInt(world.random, 2, 5);
}
this.f(world, i, j, k, j1);
this.j(world, i, j, k, j1);
} */
}
@ -63,6 +65,8 @@ public class BlockOre extends Block {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.LAPIS_ORE.id) {
j1 = MathHelper.nextInt(world.random, 2, 5);
} else if (this.id == Block.QUARTZ_ORE.id) {
j1 = MathHelper.nextInt(world.random, 2, 5);
}
return j1;

View file

@ -10,22 +10,16 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
public class BlockPiston extends Block {
private boolean a;
private final boolean a;
public BlockPiston(int i, int j, boolean flag) {
super(i, j, Material.PISTON);
public BlockPiston(int i, boolean flag) {
super(i, Material.PISTON);
this.a = flag;
this.a(h);
this.a(j);
this.c(0.5F);
this.a(CreativeModeTab.d);
}
public int a(int i, int j) {
int k = e(j);
return k > 5 ? this.textureId : (i == k ? (!f(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == Facing.OPPOSITE_FACING[k] ? 109 : 108));
}
public int d() {
return 16;
}
@ -38,37 +32,37 @@ public class BlockPiston extends Block {
return false;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
int l = b(world, i, j, k, (EntityHuman) entityliving);
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = a(world, i, j, k, entityliving);
world.setData(i, j, k, l);
world.setData(i, j, k, l, 2);
if (!world.isStatic) {
this.l(world, i, j, k);
this.k(world, i, j, k);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
this.l(world, i, j, k);
this.k(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.l(world, i, j, k);
this.k(world, i, j, k);
}
}
private void l(World world, int i, int j, int k) {
private void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = e(l);
int i1 = d(l);
if (i1 != 7) {
boolean flag = this.d(world, i, j, k, i1);
if (flag && !f(l)) {
if (flag && !e(l)) {
// CraftBukkit start
int length = i(world, i, j, k, i1);
int length = e(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));
@ -81,7 +75,7 @@ public class BlockPiston extends Block {
world.playNote(i, j, k, this.id, 0, i1);
}
} else if (!flag && f(l)) {
} else if (!flag && e(l)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, CraftBlock.notchToBlockFace(i1));
@ -92,29 +86,37 @@ public class BlockPiston extends Block {
}
// CraftBukkit end
world.setData(i, j, k, i1, 2);
world.playNote(i, j, k, this.id, 1, i1);
}
}
}
private boolean d(World world, int i, int j, int k, int l) {
return l != 0 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : (world.isBlockFaceIndirectlyPowered(i, j, k, 0) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 2, k, 1) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFaceIndirectlyPowered(i - 1, j + 1, k, 4) ? true : world.isBlockFaceIndirectlyPowered(i + 1, j + 1, k, 5)))))))))));
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 void b(World world, int i, int j, int k, int l, int i1) {
if (l == 0) {
world.setRawData(i, j, k, i1 | 8);
} else {
world.setRawData(i, j, k, i1);
public boolean b(World world, int i, int j, int k, int l, int i1) {
if (!world.isStatic) {
boolean flag = this.d(world, i, j, k, i1);
if (flag && l == 1) {
world.setData(i, j, k, i1 | 8, 2);
return false;
}
if (!flag && l == 0) {
return false;
}
}
if (l == 0) {
if (this.j(world, i, j, k, i1)) {
world.setData(i, j, k, i1 | 8);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
} else {
world.setRawData(i, j, k, i1);
if (!this.f(world, i, j, k, i1)) {
return false;
}
world.setData(i, j, k, i1 | 8, 2);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
} else if (l == 1) {
TileEntity tileentity = world.getTileEntity(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
@ -122,7 +124,7 @@ public class BlockPiston extends Block {
((TileEntityPiston) tileentity).f();
}
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(this.id, i1, i1, false, true));
if (this.a) {
int j1 = i + Facing.b[i1] * 2;
@ -130,7 +132,7 @@ public class BlockPiston extends Block {
int l1 = k + Facing.d[i1] * 2;
int i2 = world.getTypeId(j1, k1, l1);
int j2 = world.getData(j1, k1, l1);
boolean flag = false;
boolean flag1 = false;
if (i2 == Block.PISTON_MOVING.id) {
TileEntity tileentity1 = world.getTileEntity(j1, k1, l1);
@ -142,34 +144,36 @@ public class BlockPiston extends Block {
tileentitypiston.f();
i2 = tileentitypiston.a();
j2 = tileentitypiston.p();
flag = true;
flag1 = true;
}
}
}
if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].q_() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
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)) {
i += Facing.b[i1];
j += Facing.c[i1];
k += Facing.d[i1];
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2);
world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
world.setTypeId(j1, k1, l1, 0);
} else if (!flag) {
world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
world.setAir(j1, k1, l1);
} else if (!flag1) {
world.setAir(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
}
} else {
world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
world.setAir(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
}
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.in", 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
}
return true;
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
if (f(l)) {
switch (e(l)) {
if (e(l)) {
switch (d(l)) {
case 0:
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
@ -198,7 +202,7 @@ public class BlockPiston extends Block {
}
}
public void f() {
public void g() {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@ -207,27 +211,27 @@ public class BlockPiston extends Block {
super.a(world, i, j, k, axisalignedbb, list, entity);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.e(world, i, j, k);
return super.b(world, i, j, k);
}
public boolean b() {
return false;
}
public static int e(int i) {
public static int d(int i) {
if ((i & 7) >= Facing.OPPOSITE_FACING.length) return 7; // CraftBukkit - check for AIOOB on piston data
return i & 7;
}
public static boolean f(int i) {
public static boolean e(int i) {
return (i & 8) != 0;
}
public static int b(World world, int i, int j, int k, EntityHuman entityhuman) {
if (MathHelper.abs((float) entityhuman.locX - (float) i) < 2.0F && MathHelper.abs((float) entityhuman.locZ - (float) k) < 2.0F) {
double d0 = entityhuman.locY + 1.82D - (double) entityhuman.height;
public static int a(World world, int i, int j, int k, EntityLiving entityliving) {
if (MathHelper.abs((float) entityliving.locX - (float) i) < 2.0F && MathHelper.abs((float) entityliving.locZ - (float) k) < 2.0F) {
double d0 = entityliving.locY + 1.82D - (double) entityliving.height;
if (d0 - (double) j > 2.0D) {
return 1;
@ -238,7 +242,7 @@ public class BlockPiston extends Block {
}
}
int l = MathHelper.floor((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3;
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
return l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
}
@ -248,27 +252,31 @@ public class BlockPiston extends Block {
return false;
} else {
if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) {
if (Block.byId[i].m(world, j, k, l) == -1.0F) {
if (Block.byId[i].l(world, j, k, l) == -1.0F) {
return false;
}
if (Block.byId[i].q_() == 2) {
if (Block.byId[i].h() == 2) {
return false;
}
if (!flag && Block.byId[i].q_() == 1) {
return false;
if (Block.byId[i].h() == 1) {
if (!flag) {
return false;
}
return true;
}
} else if (f(world.getData(j, k, l))) {
} else if (e(world.getData(j, k, l))) {
return false;
}
return !(Block.byId[i] instanceof BlockContainer);
return !(Block.byId[i] instanceof IContainer);
}
}
// CraftBukkit - boolean -> int return
private static int i(World world, int i, int j, int k, int l) {
private static int e(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];
@ -287,7 +295,7 @@ public class BlockPiston extends Block {
return -1; // CraftBukkit
}
if (Block.byId[i2].q_() != 1) {
if (Block.byId[i2].h() != 1) {
if (l1 == 12) {
return -1; // CraftBukkit
}
@ -305,7 +313,7 @@ public class BlockPiston extends Block {
}
}
private boolean j(World world, int i, int j, int k, int l) {
private boolean f(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];
@ -325,7 +333,7 @@ public class BlockPiston extends Block {
return false;
}
if (Block.byId[i2].q_() != 1) {
if (Block.byId[i2].h() != 1) {
if (l1 == 12) {
return false;
}
@ -338,28 +346,51 @@ public class BlockPiston extends Block {
}
Block.byId[i2].c(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
world.setTypeId(i1, j1, k1, 0);
world.setAir(i1, j1, k1);
}
}
while (i1 != i || j1 != j || k1 != k) {
l1 = i1 - Facing.b[l];
i2 = j1 - Facing.c[l];
int j2 = k1 - Facing.d[l];
int k2 = world.getTypeId(l1, i2, j2);
int l2 = world.getData(l1, i2, j2);
l1 = i1;
i2 = j1;
int j2 = k1;
int k2 = 0;
if (k2 == this.id && l1 == i && i2 == j && j2 == k) {
world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0), false);
int[] aint;
int l2;
int i3;
int j3;
for (aint = new int[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);
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));
} else {
world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l2, false);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k2, l2, l, true, false));
world.setTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l3, 4);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k3, l3, l, true, false));
}
i1 = l1;
j1 = i2;
k1 = j2;
aint[k2++] = k3;
i1 = l2;
j1 = i3;
}
i1 = l1;
j1 = i2;
k1 = j2;
for (k2 = 0; i1 != i || j1 != j || k1 != k; k1 = j3) {
l2 = i1 - Facing.b[l];
i3 = j1 - Facing.c[l];
j3 = k1 - Facing.d[l];
world.applyPhysics(l2, i3, j3, aint[k2++]);
i1 = l2;
j1 = i3;
}
return true;

View file

@ -5,18 +5,18 @@ import java.util.Random;
public class BlockPistonExtension extends Block {
private int a = -1;
private IIcon a = null;
public BlockPistonExtension(int i, int j) {
super(i, j, Material.PISTON);
this.a(h);
public BlockPistonExtension(int i) {
super(i, Material.PISTON);
this.a(j);
this.c(0.5F);
}
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[f(i1)];
int j1 = Facing.OPPOSITE_FACING[d(i1)];
i += Facing.b[j1];
j += Facing.c[j1];
@ -25,19 +25,13 @@ public class BlockPistonExtension extends Block {
if (k1 == Block.PISTON.id || k1 == Block.PISTON_STICKY.id) {
i1 = world.getData(i, j, k);
if (BlockPiston.f(i1)) {
if (BlockPiston.e(i1)) {
Block.byId[k1].c(world, i, j, k, i1, 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
}
public int a(int i, int j) {
int k = f(j);
return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (k < 6 && i == Facing.OPPOSITE_FACING[k] ? 107 : 108);
}
public int d() {
return 17;
}
@ -65,7 +59,7 @@ public class BlockPistonExtension extends Block {
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
int l = world.getData(i, j, k);
switch (f(l)) {
switch (d(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);
@ -114,7 +108,7 @@ public class BlockPistonExtension extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
switch (f(l)) {
switch (d(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
break;
@ -141,18 +135,18 @@ public class BlockPistonExtension extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = f(world.getData(i, j, k));
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]);
if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
} else {
Block.byId[j1].doPhysics(world, i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1], l);
}
}
public static int f(int i) {
public static int d(int i) {
return i & 7;
}
}

View file

@ -9,31 +9,31 @@ import org.bukkit.event.world.PortalCreateEvent;
public class BlockPortal extends BlockHalfTransparant {
public BlockPortal(int i, int j) {
super(i, j, Material.PORTAL, false);
public BlockPortal(int i) {
super(i, "portal", Material.PORTAL, false);
this.b(true);
}
public void b(World world, int i, int j, int k, Random random) {
super.b(world, i, j, k, random);
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) {
int l;
for (l = j; !world.v(i, l, k) && l > 0; --l) {
for (l = j; !world.w(i, l, k) && l > 0; --l) {
;
}
if (l > 0 && !world.t(i, l + 1, k)) {
if (l > 0 && !world.u(i, l + 1, k)) {
Entity entity = ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
if (entity != null) {
entity.portalCooldown = entity.ab();
entity.portalCooldown = entity.aa();
}
}
}
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@ -60,7 +60,7 @@ public class BlockPortal extends BlockHalfTransparant {
return false;
}
public boolean i_(World world, int i, int j, int k) {
public boolean n_(World world, int i, int j, int k) {
byte b0 = 0;
byte b1 = 0;
@ -123,15 +123,12 @@ public class BlockPortal extends BlockHalfTransparant {
}
// CraftBukkit end
world.suppressPhysics = true;
for (l = 0; l < 2; ++l) {
for (i1 = 0; i1 < 3; ++i1) {
world.setTypeId(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id);
world.setTypeIdAndData(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id, 0, 2);
}
}
world.suppressPhysics = false;
return true;
}
}
@ -152,7 +149,7 @@ public class BlockPortal extends BlockHalfTransparant {
}
if (world.getTypeId(i, i1 - 1, k) != Block.OBSIDIAN.id) {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
} else {
int j1;
@ -165,14 +162,14 @@ public class BlockPortal extends BlockHalfTransparant {
boolean flag1 = world.getTypeId(i, j, k - 1) == this.id || world.getTypeId(i, j, k + 1) == this.id;
if (flag && flag1) {
world.setTypeId(i, j, k, 0);
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.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
} else {
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
}
@ -188,7 +185,7 @@ public class BlockPortal extends BlockHalfTransparant {
world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
entity.aa();
entity.Z();
}
}
}

View file

@ -1,207 +0,0 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
// CraftBukkit start
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.entity.EntityInteractEvent;
// CraftBukkit end
public class BlockPressurePlate extends Block {
private EnumMobType a;
protected BlockPressurePlate(int i, int j, EnumMobType enummobtype, Material material) {
super(i, j, material);
this.a = enummobtype;
this.a(CreativeModeTab.d);
this.b(true);
float f = 0.0625F;
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
}
public int r_() {
return 20;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
return null;
}
public boolean c() {
return false;
}
public boolean b() {
return false;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
public boolean canPlace(World world, int i, int j, int k) {
return world.v(i, j - 1, k) || BlockFence.c(world.getTypeId(i, j - 1, k));
}
public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false;
if (!world.v(i, j - 1, k) && !BlockFence.c(world.getTypeId(i, j - 1, k))) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
}
}
public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getData(i, j, k) != 0) {
this.l(world, i, j, k);
}
}
}
public void a(World world, int i, int j, int k, Entity entity) {
if (!world.isStatic) {
if (world.getData(i, j, k) != 1) {
this.l(world, i, j, k);
}
}
}
private void l(World world, int i, int j, int k) {
boolean flag = world.getData(i, j, k) == 1;
boolean flag1 = false;
float f = 0.125F;
List list = null;
if (this.a == EnumMobType.EVERYTHING) {
list = world.getEntities((Entity) null, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
}
if (this.a == EnumMobType.MOBS) {
list = world.a(EntityLiving.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
}
if (this.a == EnumMobType.PLAYERS) {
list = world.a(EntityHuman.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
}
if (!list.isEmpty()) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
if (!entity.au()) {
flag1 = true;
break;
}
}
}
// CraftBukkit start - Interact Pressure Plate
org.bukkit.World bworld = world.getWorld();
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
if (flag != flag1) {
if (flag1) {
for (Object object : list) {
if (object != null) {
org.bukkit.event.Cancellable cancellable;
if (object instanceof EntityHuman) {
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
} else if (object instanceof Entity) {
cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), bworld.getBlockAt(i, j, k));
manager.callEvent((EntityInteractEvent) cancellable);
} else {
continue;
}
if (cancellable.isCancelled()) {
return;
}
}
}
}
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), flag ? 1 : 0, flag1 ? 1 : 0);
manager.callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0;
}
// CraftBukkit end
if (flag1 && !flag) {
world.setData(i, j, k, 1);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.e(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
}
if (!flag1 && flag) {
world.setData(i, j, k, 0);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.e(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
}
if (flag1) {
world.a(i, j, k, this.id, this.r_());
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
if (i1 > 0) {
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
}
super.remove(world, i, j, k, l, i1);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
boolean flag = iblockaccess.getData(i, j, k) == 1;
float f = 0.0625F;
if (flag) {
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
} else {
this.a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
}
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return iblockaccess.getData(i, j, k) > 0;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return iblockaccess.getData(i, j, k) == 0 ? false : l == 1;
}
public boolean isPowerSource() {
return true;
}
public void f() {
float f = 0.5F;
float f1 = 0.125F;
float f2 = 0.5F;
this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
}
public int q_() {
return 1;
}
}

View file

@ -0,0 +1,174 @@
package net.minecraft.server;
import java.util.Random;
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public abstract class BlockPressurePlateAbstract extends Block {
private String a;
protected BlockPressurePlateAbstract(int i, String s, Material material) {
super(i, material);
this.a = s;
this.a(CreativeModeTab.d);
this.b(true);
this.b_(this.d(15));
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.b_(iblockaccess.getData(i, j, k));
}
protected void b_(int i) {
boolean flag = this.c(i) > 0;
float f = 0.0625F;
if (flag) {
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
} else {
this.a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
}
}
public int a(World world) {
return 20;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
public boolean c() {
return false;
}
public boolean b() {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
public boolean canPlace(World world, int i, int j, int k) {
return world.w(i, j - 1, k) || BlockFence.l_(world.getTypeId(i, j - 1, k));
}
public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false;
if (!world.w(i, j - 1, k) && !BlockFence.l_(world.getTypeId(i, j - 1, k))) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = this.c(world.getData(i, j, k));
if (l > 0) {
this.b(world, i, j, k, l);
}
}
}
public void a(World world, int i, int j, int k, Entity entity) {
if (!world.isStatic) {
int l = this.c(world.getData(i, j, k));
if (l == 0) {
this.b(world, i, j, k, l);
}
}
}
protected void b(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;
// CraftBukkit start - Interact Pressure Plate
org.bukkit.World bworld = world.getWorld();
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
if (flag != flag1) {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), l, i1);
manager.callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0;
i1 = eventRedstone.getNewCurrent();
}
// CraftBukkit end
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);
}
if (!flag1 && flag) {
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
} else if (flag1 && !flag) {
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
}
if (flag1) {
world.a(i, j, k, this.id, this.a(world));
}
}
protected AxisAlignedBB a(int i, int j, int k) {
float f = 0.125F;
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);
}
super.remove(world, i, j, k, l, i1);
}
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);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return this.c(iblockaccess.getData(i, j, k));
}
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return l == 1 ? this.c(iblockaccess.getData(i, j, k)) : 0;
}
public boolean isPowerSource() {
return true;
}
public void g() {
float f = 0.5F;
float f1 = 0.125F;
float f2 = 0.5F;
this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
}
public int h() {
return 1;
}
protected abstract int e(World world, int i, int j, int k);
protected abstract int c(int i);
protected abstract int d(int i);
}

View file

@ -0,0 +1,71 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
private EnumMobType a;
protected BlockPressurePlateBinary(int i, String s, Material material, EnumMobType enummobtype) {
super(i, s, material);
this.a = enummobtype;
}
protected int d(int i) {
return i > 0 ? 1 : 0;
}
protected int c(int i) {
return i == 1 ? 15 : 0;
}
protected int e(World world, int i, int j, int k) {
List list = null;
if (this.a == EnumMobType.EVERYTHING) {
list = world.getEntities((Entity) null, this.a(i, j, k));
}
if (this.a == EnumMobType.MOBS) {
list = world.a(EntityLiving.class, this.a(i, j, k));
}
if (this.a == EnumMobType.PLAYERS) {
list = world.a(EntityHuman.class, this.a(i, j, k));
}
if (!list.isEmpty()) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
org.bukkit.event.Cancellable cancellable;
if (entity instanceof EntityHuman) {
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
} else {
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(i, j, k));
manager.callEvent((EntityInteractEvent) cancellable);
}
if (cancellable.isCancelled()) {
return 0;
}
// CraftBukkit end
if (!entity.at()) {
return 15;
}
}
}
return 0;
}
}

View file

@ -10,34 +10,13 @@ public class BlockPumpkin extends BlockDirectional {
private boolean a;
protected BlockPumpkin(int i, int j, boolean flag) {
protected BlockPumpkin(int i, boolean flag) {
super(i, Material.PUMPKIN);
this.textureId = j;
this.b(true);
this.a = flag;
this.a(CreativeModeTab.b);
}
public int a(int i, int j) {
if (i == 1) {
return this.textureId;
} else if (i == 0) {
return this.textureId;
} else {
int k = this.textureId + 1 + 16;
if (this.a) {
++k;
}
return j == 2 && i == 2 ? k : (j == 3 && i == 5 ? k : (j == 0 && i == 3 ? k : (j == 1 && i == 4 ? k : this.textureId + 16)));
}
}
public int a(int i) {
return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16));
}
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) {
@ -100,13 +79,13 @@ 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.v(i, j - 1, k);
return (l == 0 || Block.byId[l].material.isReplaceable()) && world.w(i, j - 1, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 2.5D) & 3;
world.setData(i, j, k, l);
world.setData(i, j, k, l, 2);
}
// CraftBukkit start

View file

@ -9,11 +9,10 @@ public class BlockRedstoneLamp extends Block {
private final boolean a;
public BlockRedstoneLamp(int i, boolean flag) {
super(i, 211, Material.BUILDABLE_GLASS);
super(i, Material.BUILDABLE_GLASS);
this.a = flag;
if (flag) {
this.a(1.0F);
++this.textureId;
}
}
@ -28,7 +27,7 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
}
}
}
@ -44,12 +43,12 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
}
}
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic && this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
@ -57,7 +56,7 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_OFF.id);
world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_OFF.id, 0, 2);
}
}

View file

@ -8,8 +8,8 @@ public class BlockRedstoneOre extends Block {
private boolean a;
public BlockRedstoneOre(int i, int j, boolean flag) {
super(i, j, Material.STONE);
public BlockRedstoneOre(int i, boolean flag) {
super(i, Material.STONE);
if (flag) {
this.b(true);
}
@ -17,12 +17,12 @@ public class BlockRedstoneOre extends Block {
this.a = flag;
}
public int r_() {
public int a(World world) {
return 30;
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.l(world, i, j, k);
this.k(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.l(world, i, j, k);
this.k(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.l(world, i, j, k);
this.k(world, i, j, k);
super.b(world, i, j, k, entity);
}
}
@ -46,20 +46,20 @@ 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.l(world, i, j, k);
this.k(world, i, j, k);
return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
private void l(World world, int i, int j, int k) {
this.n(world, i, j, k);
private void k(World world, int i, int j, int k) {
this.m(world, i, j, k);
if (this.id == Block.REDSTONE_ORE.id) {
world.setTypeId(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
world.setTypeIdUpdate(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
}
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (this.id == Block.GLOWING_REDSTONE_ORE.id) {
world.setTypeId(i, j, k, Block.REDSTONE_ORE.id);
world.setTypeIdUpdate(i, j, k, Block.REDSTONE_ORE.id);
}
}
@ -81,7 +81,7 @@ public class BlockRedstoneOre extends Block {
if (this.getDropType(l, world.random, i1) != this.id) {
int j1 = 1 + world.random.nextInt(5);
this.f(world, i, j, k, j1);
this.j(world, i, j, k, j1);
} */
}
@ -96,7 +96,7 @@ public class BlockRedstoneOre extends Block {
// CraftBukkit end
}
private void n(World world, int i, int j, int k) {
private void m(World world, int i, int j, int k) {
Random random = world.random;
double d0 = 0.0625D;
@ -105,27 +105,27 @@ public class BlockRedstoneOre extends Block {
double d2 = (double) ((float) j + random.nextFloat());
double d3 = (double) ((float) k + random.nextFloat());
if (l == 0 && !world.s(i, j + 1, k)) {
if (l == 0 && !world.t(i, j + 1, k)) {
d2 = (double) (j + 1) + d0;
}
if (l == 1 && !world.s(i, j - 1, k)) {
if (l == 1 && !world.t(i, j - 1, k)) {
d2 = (double) (j + 0) - d0;
}
if (l == 2 && !world.s(i, j, k + 1)) {
if (l == 2 && !world.t(i, j, k + 1)) {
d3 = (double) (k + 1) + d0;
}
if (l == 3 && !world.s(i, j, k - 1)) {
if (l == 3 && !world.t(i, j, k - 1)) {
d3 = (double) (k + 0) - d0;
}
if (l == 4 && !world.s(i + 1, j, k)) {
if (l == 4 && !world.t(i + 1, j, k)) {
d1 = (double) (i + 1) + d0;
}
if (l == 5 && !world.s(i - 1, j, k)) {
if (l == 5 && !world.t(i - 1, j, k)) {
d1 = (double) (i + 0) - d0;
}
@ -135,7 +135,7 @@ public class BlockRedstoneOre extends Block {
}
}
protected ItemStack f_(int i) {
protected ItemStack c_(int i) {
return new ItemStack(Block.REDSTONE_ORE);
}
}

View file

@ -13,10 +13,6 @@ public class BlockRedstoneTorch extends BlockTorch {
private boolean isOn = false;
private static Map b = new HashMap();
public int a(int i, int j) {
return i == 1 ? Block.REDSTONE_WIRE.a(i, j) : super.a(i, j);
}
private boolean a(World world, int i, int j, int k, boolean flag) {
if (!b.containsKey(world)) {
b.put(world, new ArrayList());
@ -44,14 +40,14 @@ public class BlockRedstoneTorch extends BlockTorch {
return false;
}
protected BlockRedstoneTorch(int i, int j, boolean flag) {
super(i, j);
protected BlockRedstoneTorch(int i, boolean flag) {
super(i);
this.isOn = flag;
this.b(true);
this.a((CreativeModeTab) null);
}
public int r_() {
public int a(World world) {
return 2;
}
@ -81,24 +77,24 @@ public class BlockRedstoneTorch extends BlockTorch {
}
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (!this.isOn) {
return false;
return 0;
} else {
int i1 = iblockaccess.getData(i, j, k);
return i1 == 5 && l == 1 ? false : (i1 == 3 && l == 3 ? false : (i1 == 4 && l == 2 ? false : (i1 == 1 && l == 5 ? false : i1 != 2 || l != 4)));
return i1 == 5 && l == 1 ? 0 : (i1 == 3 && l == 3 ? 0 : (i1 == 4 && l == 2 ? 0 : (i1 == 1 && l == 5 ? 0 : (i1 == 2 && l == 4 ? 0 : 15))));
}
}
private boolean l(World world, int i, int j, int k) {
private boolean m(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
return l == 5 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l == 3 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l == 4 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l == 1 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : l == 2 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5))));
return l == 5 && world.isBlockFacePowered(i, j - 1, k, 0) ? true : (l == 3 && world.isBlockFacePowered(i, j, k - 1, 2) ? true : (l == 4 && world.isBlockFacePowered(i, j, k + 1, 3) ? true : (l == 1 && world.isBlockFacePowered(i - 1, j, k, 4) ? true : l == 2 && world.isBlockFacePowered(i + 1, j, k, 5))));
}
public void b(World world, int i, int j, int k, Random random) {
boolean flag = this.l(world, i, j, k);
public void a(World world, int i, int j, int k, Random random) {
boolean flag = this.m(world, i, j, k);
List list = (List) b.get(world);
while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).d > 60L) {
@ -125,7 +121,7 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, 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);
@ -149,17 +145,22 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k), 3);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l);
world.a(i, j, k, this.id, this.r_());
if (!this.d(world, i, j, k, l)) {
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));
}
}
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return l == 0 ? this.b(iblockaccess, i, j, k, l) : false;
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return l == 0 ? this.b(iblockaccess, i, j, k, l) : 0;
}
public int getDropType(int i, Random random, int j) {
@ -169,4 +170,8 @@ public class BlockRedstoneTorch extends BlockTorch {
public boolean isPowerSource() {
return true;
}
public boolean i(int i) {
return i == Block.REDSTONE_TORCH_OFF.id || i == Block.REDSTONE_TORCH_ON.id;
}
}

View file

@ -10,18 +10,14 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockRedstoneWire extends Block {
private boolean a = true;
private Set b = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet
private Set b = new HashSet();
public BlockRedstoneWire(int i, int j) {
super(i, j, Material.ORIENTABLE);
public BlockRedstoneWire(int i) {
super(i, Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
}
public int a(int i, int j) {
return this.textureId;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@ -38,10 +34,10 @@ public class BlockRedstoneWire extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return world.v(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
return world.w(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
}
private void l(World world, int i, int j, int k) {
private void k(World world, int i, int j, int k) {
this.a(world, i, j, k, i, j, k);
ArrayList arraylist = new ArrayList(this.b);
@ -56,56 +52,62 @@ public class BlockRedstoneWire extends Block {
private void a(World world, int i, int j, int k, int l, int i1, int j1) {
int k1 = world.getData(i, j, k);
int l1 = 0;
byte b0 = 0;
int l1 = this.getPower(world, l, i1, j1, b0);
this.a = false;
boolean flag = world.isBlockIndirectlyPowered(i, j, k);
int i2 = world.getHighestNeighborSignal(i, j, k);
this.a = true;
int i2;
int j2;
int k2;
if (i2 > 0 && i2 > l1 - 1) {
l1 = i2;
}
if (flag) {
l1 = 15;
int j2 = 0;
for (int k2 = 0; k2 < 4; ++k2) {
int l2 = i;
int i3 = k;
if (k2 == 0) {
l2 = i - 1;
}
if (k2 == 1) {
++l2;
}
if (k2 == 2) {
i3 = k - 1;
}
if (k2 == 3) {
++i3;
}
if (l2 != l || i3 != j1) {
j2 = this.getPower(world, l2, j, i3, j2);
}
if (world.u(l2, j, i3) && !world.u(i, j + 1, k)) {
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) {
j2 = this.getPower(world, l2, j - 1, i3, j2);
}
}
if (j2 > l1) {
l1 = j2 - 1;
} else if (l1 > 0) {
--l1;
} else {
for (i2 = 0; i2 < 4; ++i2) {
j2 = i;
k2 = k;
if (i2 == 0) {
j2 = i - 1;
}
l1 = 0;
}
if (i2 == 1) {
++j2;
}
if (i2 == 2) {
k2 = k - 1;
}
if (i2 == 3) {
++k2;
}
if (j2 != l || j != i1 || k2 != j1) {
l1 = this.getPower(world, j2, j, k2, l1);
}
if (world.t(j2, j, k2) && !world.t(i, j + 1, k)) {
if (j2 != l || j + 1 != i1 || k2 != j1) {
l1 = this.getPower(world, j2, j + 1, k2, l1);
}
} else if (!world.t(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
l1 = this.getPower(world, j2, j - 1, k2, l1);
}
}
if (l1 > 0) {
--l1;
} else {
l1 = 0;
}
if (i2 > l1 - 1) {
l1 = i2;
}
// CraftBukkit start
@ -118,72 +120,18 @@ public class BlockRedstoneWire extends Block {
// CraftBukkit end
if (k1 != l1) {
world.suppressPhysics = true;
world.setData(i, j, k, l1);
world.e(i, j, k, i, j, k);
world.suppressPhysics = false;
for (i2 = 0; i2 < 4; ++i2) {
j2 = i;
k2 = k;
int l2 = j - 1;
if (i2 == 0) {
j2 = i - 1;
}
if (i2 == 1) {
++j2;
}
if (i2 == 2) {
k2 = k - 1;
}
if (i2 == 3) {
++k2;
}
if (world.t(j2, j, k2)) {
l2 += 2;
}
boolean flag1 = false;
int i3 = this.getPower(world, j2, j, k2, -1);
l1 = world.getData(i, j, k);
if (l1 > 0) {
--l1;
}
if (i3 >= 0 && i3 != l1) {
this.a(world, j2, j, k2, i, j, k);
}
i3 = this.getPower(world, j2, l2, k2, -1);
l1 = world.getData(i, j, k);
if (l1 > 0) {
--l1;
}
if (i3 >= 0 && i3 != l1) {
this.a(world, j2, l2, k2, i, j, k);
}
}
if (k1 < l1 || l1 == 0) {
this.b.add(new ChunkPosition(i, j, k));
this.b.add(new ChunkPosition(i - 1, j, k));
this.b.add(new ChunkPosition(i + 1, j, k));
this.b.add(new ChunkPosition(i, j - 1, k));
this.b.add(new ChunkPosition(i, j + 1, k));
this.b.add(new ChunkPosition(i, j, k - 1));
this.b.add(new ChunkPosition(i, j, k + 1));
}
world.setData(i, j, k, l1, 2);
this.b.add(new ChunkPosition(i, j, k));
this.b.add(new ChunkPosition(i - 1, j, k));
this.b.add(new ChunkPosition(i + 1, j, k));
this.b.add(new ChunkPosition(i, j - 1, k));
this.b.add(new ChunkPosition(i, j + 1, k));
this.b.add(new ChunkPosition(i, j, k - 1));
this.b.add(new ChunkPosition(i, j, k + 1));
}
}
private void n(World world, int i, int j, int k) {
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);
@ -198,35 +146,35 @@ public class BlockRedstoneWire extends Block {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (!world.isStatic) {
this.l(world, i, j, k);
this.k(world, i, j, k);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
this.n(world, i - 1, j, k);
this.n(world, i + 1, j, k);
this.n(world, i, j, k - 1);
this.n(world, i, j, k + 1);
if (world.t(i - 1, j, k)) {
this.n(world, i - 1, j + 1, 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)) {
this.m(world, i - 1, j + 1, k);
} else {
this.n(world, i - 1, j - 1, k);
this.m(world, i - 1, j - 1, k);
}
if (world.t(i + 1, j, k)) {
this.n(world, i + 1, j + 1, k);
if (world.u(i + 1, j, k)) {
this.m(world, i + 1, j + 1, k);
} else {
this.n(world, i + 1, j - 1, k);
this.m(world, i + 1, j - 1, k);
}
if (world.t(i, j, k - 1)) {
this.n(world, i, j + 1, k - 1);
if (world.u(i, j, k - 1)) {
this.m(world, i, j + 1, k - 1);
} else {
this.n(world, i, j - 1, k - 1);
this.m(world, i, j - 1, k - 1);
}
if (world.t(i, j, k + 1)) {
this.n(world, i, j + 1, k + 1);
if (world.u(i, j, k + 1)) {
this.m(world, i, j + 1, k + 1);
} else {
this.n(world, i, j - 1, k + 1);
this.m(world, i, j - 1, k + 1);
}
}
}
@ -240,33 +188,33 @@ public class BlockRedstoneWire extends Block {
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k - 1, this.id);
this.l(world, i, j, k);
this.n(world, i - 1, j, k);
this.n(world, i + 1, j, k);
this.n(world, i, j, k - 1);
this.n(world, i, j, k + 1);
if (world.t(i - 1, j, k)) {
this.n(world, i - 1, j + 1, k);
this.k(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)) {
this.m(world, i - 1, j + 1, k);
} else {
this.n(world, i - 1, j - 1, k);
this.m(world, i - 1, j - 1, k);
}
if (world.t(i + 1, j, k)) {
this.n(world, i + 1, j + 1, k);
if (world.u(i + 1, j, k)) {
this.m(world, i + 1, j + 1, k);
} else {
this.n(world, i + 1, j - 1, k);
this.m(world, i + 1, j - 1, k);
}
if (world.t(i, j, k - 1)) {
this.n(world, i, j + 1, k - 1);
if (world.u(i, j, k - 1)) {
this.m(world, i, j + 1, k - 1);
} else {
this.n(world, i, j - 1, k - 1);
this.m(world, i, j - 1, k - 1);
}
if (world.t(i, j, k + 1)) {
this.n(world, i, j + 1, k + 1);
if (world.u(i, j, k + 1)) {
this.m(world, i, j + 1, k + 1);
} else {
this.n(world, i, j - 1, k + 1);
this.m(world, i, j - 1, k + 1);
}
}
}
@ -284,14 +232,13 @@ public class BlockRedstoneWire extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
int i1 = world.getData(i, j, k);
boolean flag = this.canPlace(world, i, j, k);
if (flag) {
this.l(world, i, j, k);
this.k(world, i, j, k);
} else {
this.c(world, i, j, k, i1, 0);
world.setTypeId(i, j, k, 0);
this.c(world, i, j, k, 0, 0);
world.setAir(i, j, k);
}
super.doPhysics(world, i, j, k, l);
@ -302,42 +249,46 @@ public class BlockRedstoneWire extends Block {
return Item.REDSTONE.id;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return !this.a ? false : this.b(iblockaccess, i, j, k, l);
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return !this.a ? 0 : this.b(iblockaccess, i, j, k, l);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (!this.a) {
return false;
} else if (iblockaccess.getData(i, j, k) == 0) {
return false;
} else if (l == 1) {
return true;
return 0;
} else {
boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
int i1 = iblockaccess.getData(i, j, k);
if (!iblockaccess.t(i, j + 1, k)) {
if (iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
flag = true;
if (i1 == 0) {
return 0;
} 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);
if (!iblockaccess.u(i, j + 1, k)) {
if (iblockaccess.u(i - 1, j, k) && 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)) {
flag1 = true;
}
if (iblockaccess.u(i, j, k - 1) && 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)) {
flag3 = true;
}
}
if (iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
flag1 = true;
}
if (iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
flag2 = true;
}
if (iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
flag3 = true;
}
return !flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5 ? i1 : (l == 2 && flag2 && !flag && !flag1 ? i1 : (l == 3 && flag3 && !flag && !flag1 ? i1 : (l == 4 && flag && !flag2 && !flag3 ? i1 : (l == 5 && flag1 && !flag2 && !flag3 ? i1 : 0))));
}
return !flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5 ? true : (l == 2 && flag2 && !flag && !flag1 ? true : (l == 3 && flag3 && !flag && !flag1 ? true : (l == 4 && flag && !flag2 && !flag3 ? true : l == 5 && flag1 && !flag2 && !flag3)));
}
}
@ -352,7 +303,7 @@ public class BlockRedstoneWire extends Block {
return true;
} else if (i1 == 0) {
return false;
} else if (i1 != Block.DIODE_OFF.id && i1 != Block.DIODE_ON.id) {
} else if (!Block.DIODE_OFF.g(i1)) {
return Block.byId[i1].isPowerSource() && l != -1;
} else {
int j1 = iblockaccess.getData(i, j, k);

View file

@ -4,16 +4,15 @@ import java.util.Random;
public class BlockReed extends Block {
protected BlockReed(int i, int j) {
protected BlockReed(int i) {
super(i, Material.PLANT);
this.textureId = j;
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);
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (world.isEmpty(i, j + 1, k)) {
int l;
@ -26,9 +25,9 @@ public class BlockReed extends Block {
if (i1 == 15) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
world.setData(i, j, k, 0);
world.setData(i, j, k, 0, 4);
} else {
world.setData(i, j, k, i1 + 1);
world.setData(i, j, k, i1 + 1, 4);
}
}
}
@ -41,21 +40,21 @@ public class BlockReed extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
this.k_(world, i, j, k);
this.p_(world, i, j, k);
}
protected final void k_(World world, int i, int j, int k) {
if (!this.d(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);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
public boolean d(World world, int i, int j, int k) {
public boolean f(World world, int i, int j, int k) {
return this.canPlace(world, i, j, k);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}

View file

@ -1,78 +0,0 @@
package net.minecraft.server;
import java.util.Random;
public class BlockSand extends Block {
public static boolean instaFall = false;
public BlockSand(int i, int j) {
super(i, j, Material.SAND);
this.a(CreativeModeTab.b);
}
public BlockSand(int i, int j, Material material) {
super(i, j, material);
}
public void onPlace(World world, int i, int j, int k) {
world.a(i, j, k, this.id, this.r_());
}
public void doPhysics(World world, int i, int j, int k, int l) {
world.a(i, j, k, this.id, this.r_());
}
public void b(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
this.l(world, i, j, k);
}
}
private void l(World world, int i, int j, int k) {
if (canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
if (!instaFall && world.d(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (!world.isStatic) {
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));
this.a(entityfallingblock);
world.addEntity(entityfallingblock);
}
} else {
world.setTypeId(i, j, k, 0);
while (canFall(world, i, j - 1, k) && j > 0) {
--j;
}
if (j > 0) {
world.setTypeId(i, j, k, this.id);
}
}
}
}
protected void a(EntityFallingBlock entityfallingblock) {}
public int r_() {
return 5;
}
public static boolean canFall(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
if (l == 0) {
return true;
} else if (l == Block.FIRE.id) {
return true;
} else {
Material material = Block.byId[l].material;
return material == Material.WATER ? true : material == Material.LAVA;
}
}
public void a_(World world, int i, int j, int k, int l) {}
}

View file

@ -12,38 +12,40 @@ import org.bukkit.event.world.StructureGrowEvent;
public class BlockSapling extends BlockFlower {
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
private static final String[] b = new String[] { "sapling", "sapling_spruce", "sapling_birch", "sapling_jungle"};
protected BlockSapling(int i, int j) {
super(i, j);
protected BlockSapling(int i) {
super(i);
float f = 0.4F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
this.a(CreativeModeTab.c);
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
super.b(world, i, j, k, random);
super.a(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
int l = world.getData(i, j, k);
if ((l & 8) == 0) {
world.setData(i, j, k, l | 8);
} else {
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
}
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
}
}
}
public int a(int i, int j) {
j &= 3;
return j == 1 ? 63 : (j == 2 ? 79 : (j == 3 ? 30 : super.a(i, j)));
// CraftBukkit - added bonemeal, player and itemstack
public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
int l = world.getData(i, j, k);
if ((l & 8) == 0) {
world.setData(i, j, k, l | 8, 4);
} else {
this.d(world, i, j, k, random, bonemeal, player, itemstack); // CraftBukkit
}
}
// CraftBukkit - added bonemeal, player and itemstack
public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
public void d(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
int l = world.getData(i, j, k) & 3;
Object object = null;
int i1 = 0;
int j1 = 0;
boolean flag = false;
@ -91,12 +93,12 @@ public class BlockSapling extends BlockFlower {
}
if (flag) {
world.setRawTypeId(i + i1, j, k + j1, 0);
world.setRawTypeId(i + i1 + 1, j, k + j1, 0);
world.setRawTypeId(i + i1, j, k + j1 + 1, 0);
world.setRawTypeId(i + i1 + 1, j, k + j1 + 1, 0);
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);
} else {
world.setRawTypeId(i, j, k, 0);
world.setTypeIdAndData(i, j, k, 0, 0, 4);
}
grownTree = gen.generate(delegate, random, i + i1, j, k + j1);
@ -117,12 +119,12 @@ public class BlockSapling extends BlockFlower {
}
if (!grownTree) {
if (flag) {
world.setRawTypeIdAndData(i + i1, j, k + j1, this.id, l);
world.setRawTypeIdAndData(i + i1 + 1, j, k + j1, this.id, l);
world.setRawTypeIdAndData(i + i1, j, k + j1 + 1, this.id, l);
world.setRawTypeIdAndData(i + i1 + 1, j, k + j1 + 1, this.id, l);
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);
} else {
world.setRawTypeIdAndData(i, j, k, this.id, l);
world.setTypeIdAndData(i, j, k, this.id, l, 4);
}
}
// CraftBukkit end

View file

@ -12,7 +12,6 @@ public class BlockSign extends BlockContainer {
protected BlockSign(int i, Class oclass, boolean flag) {
super(i, Material.WOOD);
this.b = flag;
this.textureId = 4;
this.a = oclass;
float f = 0.25F;
float f1 = 1.0F;
@ -20,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 e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@ -60,7 +59,7 @@ public class BlockSign extends BlockContainer {
return false;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
@ -68,7 +67,7 @@ public class BlockSign extends BlockContainer {
return false;
}
public TileEntity a(World world) {
public TileEntity b(World world) {
try {
return (TileEntity) this.a.newInstance();
} catch (Exception exception) {
@ -110,7 +109,7 @@ public class BlockSign extends BlockContainer {
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
super.doPhysics(world, i, j, k, l);

View file

@ -11,7 +11,6 @@ public class BlockSkull extends BlockContainer {
protected BlockSkull(int i) {
super(i, Material.ORIENTABLE);
this.textureId = 104;
this.a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
}
@ -53,18 +52,18 @@ public class BlockSkull extends BlockContainer {
}
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.e(world, i, j, k);
return super.b(world, i, j, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 2.5D) & 3;
world.setData(i, j, k, l);
world.setData(i, j, k, l, 2);
}
public TileEntity a(World world) {
public TileEntity b(World world) {
return new TileEntitySkull();
}
@ -97,7 +96,7 @@ public class BlockSkull extends BlockContainer {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild) {
l |= 8;
world.setData(i, j, k, l);
world.setData(i, j, k, l, 4);
}
super.a(world, i, j, k, l, entityhuman);
@ -128,7 +127,7 @@ public class BlockSkull extends BlockContainer {
}
public void a(World world, int i, int j, int k, TileEntitySkull tileentityskull) {
if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty > 0) {
if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty > 0 && !world.isStatic) {
int l = Block.SOUL_SAND.id;
int i1;
@ -140,9 +139,9 @@ public class BlockSkull extends BlockContainer {
// CraftBukkit start - use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
world.setRawData(i, j, k + i1, 8);
world.setRawData(i, j, k + i1 + 1, 8);
world.setRawData(i, j, k + i1 + 2, 8);
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);
blockList.setTypeId(i, j, k + i1, 0);
blockList.setTypeId(i, j, k + i1 + 1, 0);
@ -155,7 +154,7 @@ public class BlockSkull extends BlockContainer {
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.ax = 90.0F;
entitywither.ay = 90.0F;
entitywither.m();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
@ -177,9 +176,9 @@ public class BlockSkull extends BlockContainer {
// CraftBukkit start - use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
world.setRawData(i + i1, j, k, 8);
world.setRawData(i + i1 + 1, j, k, 8);
world.setRawData(i + i1 + 2, j, k, 8);
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);

View file

@ -4,17 +4,19 @@ import java.util.Random;
public class BlockSnow extends Block {
protected BlockSnow(int i, int j) {
super(i, j, Material.SNOW_LAYER);
protected BlockSnow(int i) {
super(i, Material.SNOW_LAYER);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
this.b(true);
this.a(CreativeModeTab.c);
this.d(0);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
int l = world.getData(i, j, k) & 7;
float f = 0.125F;
return l >= 3 ? AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + 0.5F), (double) k + this.maxZ) : null;
return AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + (float) l * f), (double) k + this.maxZ);
}
public boolean c() {
@ -25,9 +27,17 @@ public class BlockSnow extends Block {
return false;
}
public void g() {
this.d(0);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k) & 7;
float f = (float) (2 * (1 + l)) / 16.0F;
this.d(iblockaccess.getData(i, j, k));
}
protected void d(int i) {
int j = i & 7;
float f = (float) (2 * (1 + j)) / 16.0F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
}
@ -35,18 +45,17 @@ public class BlockSnow extends Block {
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j - 1, k);
return l != 0 && (l == Block.LEAVES.id || Block.byId[l].c()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
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()));
}
public void doPhysics(World world, int i, int j, int k, int l) {
this.n(world, i, j, k);
this.m(world, i, j, k);
}
private boolean n(World world, int i, int j, int 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);
world.setRawTypeId(i, j, k, 0); // CraftBukkit
world.notify(i, j, k); // CraftBukkit - Notify clients of the reversion
world.setAir(i, j, k);
return false;
} else {
return true;
@ -55,9 +64,10 @@ 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;
this.b(world, i, j, k, new ItemStack(i1, 1, 0));
world.setTypeId(i, j, k, 0);
this.b(world, i, j, k, new ItemStack(i1, j1 + 1, 0));
world.setAir(i, j, k);
entityhuman.a(StatisticList.C[this.id], 1);
}
@ -69,7 +79,7 @@ public class BlockSnow extends Block {
return 0;
}
public void b(World world, int i, int j, int k, Random random) {
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()) {
@ -78,7 +88,7 @@ public class BlockSnow extends Block {
// CraftBukkit end
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
}

View file

@ -11,13 +11,12 @@ public class BlockSoil extends Block {
protected BlockSoil(int i) {
super(i, Material.EARTH);
this.textureId = 87;
this.b(true);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
this.h(255);
this.k(255);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(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));
}
@ -29,17 +28,13 @@ public class BlockSoil extends Block {
return false;
}
public int a(int i, int j) {
return i == 1 && j > 0 ? this.textureId - 1 : (i == 1 ? this.textureId : 2);
}
public void b(World world, int i, int j, int k, Random random) {
if (!this.n(world, i, j, k) && !world.D(i, j + 1, k)) {
public void a(World world, int i, int j, int k, Random random) {
if (!this.m(world, i, j, k) && !world.F(i, j + 1, k)) {
int l = world.getData(i, j, k);
if (l > 0) {
world.setData(i, j, k, l - 1);
} else if (!this.l(world, i, j, k)) {
world.setData(i, j, k, l - 1, 2);
} else if (!this.k(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()) {
@ -47,10 +42,10 @@ public class BlockSoil extends Block {
}
// CraftBukkit end
world.setTypeId(i, j, k, Block.DIRT.id);
world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
}
} else {
world.setData(i, j, k, 7);
world.setData(i, j, k, 7, 2);
}
}
@ -74,11 +69,11 @@ public class BlockSoil extends Block {
}
// CraftBukkit end
world.setTypeId(i, j, k, Block.DIRT.id);
world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
}
}
private boolean l(World world, int i, int j, int k) {
private boolean k(World world, int i, int j, int k) {
byte b0 = 0;
for (int l = i - b0; l <= i + b0; ++l) {
@ -94,7 +89,7 @@ public class BlockSoil extends Block {
return false;
}
private boolean n(World world, int i, int j, int k) {
private boolean m(World world, int i, int j, int k) {
for (int l = i - 4; l <= i + 4; ++l) {
for (int i1 = j; i1 <= j + 1; ++i1) {
for (int j1 = k - 4; j1 <= k + 4; ++j1) {
@ -113,7 +108,7 @@ public class BlockSoil extends Block {
Material material = world.getMaterial(i, j + 1, k);
if (material.isBuildable()) {
world.setTypeId(i, j, k, Block.DIRT.id);
world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
}
}

View file

@ -17,28 +17,25 @@ public class BlockStationary extends BlockFluids {
}
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
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.l(world, i, j, k);
this.k(world, i, j, k);
}
}
private void l(World world, int i, int j, int k) {
private void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
world.suppressPhysics = true;
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
world.e(i, j, k, i, j, k);
world.a(i, j, k, this.id - 1, this.r_());
world.suppressPhysics = false;
world.setTypeIdAndData(i, j, k, this.id - 1, l, 2);
world.a(i, j, k, this.id - 1, this.a(world));
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (this.material == Material.LAVA) {
int l = random.nextInt(3);
@ -56,7 +53,7 @@ public class BlockStationary extends BlockFluids {
k += random.nextInt(3) - 1;
j1 = world.getTypeId(i, j, k);
if (j1 == 0) {
if (this.n(world, i - 1, j, k) || this.n(world, i + 1, j, k) || this.n(world, i, j, k - 1) || this.n(world, i, j, k + 1) || this.n(world, i, j - 1, k) || this.n(world, i, j + 1, k)) {
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)) {
// CraftBukkit start - prevent lava putting something on fire
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
if (block.getTypeId() != Block.FIRE.id) {
@ -66,7 +63,7 @@ public class BlockStationary extends BlockFluids {
}
// CraftBukkit end
world.setTypeId(i, j, k, Block.FIRE.id);
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
return;
}
} else if (Block.byId[j1].material.isSolid()) {
@ -81,7 +78,7 @@ public class BlockStationary extends BlockFluids {
for (int k1 = 0; k1 < 3; ++k1) {
i = i1 + random.nextInt(3) - 1;
k = j1 + random.nextInt(3) - 1;
if (world.isEmpty(i, j + 1, k) && this.n(world, i, j, k)) {
if (world.isEmpty(i, j + 1, k) && this.m(world, i, j, k)) {
// CraftBukkit start - prevent lava putting something on fire
org.bukkit.block.Block block = bworld.getBlockAt(i, j + 1, k);
if (block.getTypeId() != Block.FIRE.id) {
@ -91,14 +88,14 @@ public class BlockStationary extends BlockFluids {
}
// CraftBukkit end
world.setTypeId(i, j + 1, k, Block.FIRE.id);
world.setTypeIdUpdate(i, j + 1, k, Block.FIRE.id);
}
}
}
}
}
private boolean n(World world, int i, int j, int k) {
private boolean m(World world, int i, int j, int k) {
return world.getMaterial(i, j, k).isBurnable();
}
}

View file

@ -6,10 +6,10 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockStem extends BlockFlower {
private Block blockFruit;
private final Block blockFruit;
protected BlockStem(int i, Block block) {
super(i, 111);
super(i);
this.blockFruit = block;
this.b(true);
float f = 0.125F;
@ -18,21 +18,20 @@ public class BlockStem extends BlockFlower {
this.a((CreativeModeTab) null);
}
protected boolean d_(int i) {
protected boolean f_(int i) {
return i == Block.SOIL.id;
}
public void b(World world, int i, int j, int k, Random random) {
super.b(world, i, j, k, random);
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.n(world, i, j, k);
float f = this.m(world, i, j, k);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
int l = world.getData(i, j, k);
if (l < 7) {
++l;
CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, l); // CraftBukkit
CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
} else {
if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
return;
@ -80,11 +79,17 @@ public class BlockStem extends BlockFlower {
}
}
public void l(World world, int i, int j, int k) {
world.setData(i, j, k, 7);
public void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
if (l > 7) {
l = 7;
}
world.setData(i, j, k, l, 2);
}
private float n(World world, int i, int j, int k) {
private float m(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);
@ -125,11 +130,7 @@ public class BlockStem extends BlockFlower {
return f;
}
public int a(int i, int j) {
return this.textureId;
}
public void f() {
public void g() {
float f = 0.125F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);

View file

@ -1,79 +0,0 @@
package net.minecraft.server;
import java.util.Random;
public class BlockTNT extends Block {
public BlockTNT(int i, int j) {
super(i, j, Material.TNT);
this.a(CreativeModeTab.d);
}
public int a(int i) {
return i == 0 ? this.textureId + 2 : (i == 1 ? this.textureId + 1 : this.textureId);
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (!world.suppressPhysics && world.isBlockIndirectlyPowered(i, j, k)) { // CraftBukkit
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (l > 0 && Block.byId[l].isPowerSource() && world.isBlockIndirectlyPowered(i, j, k)) {
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
}
}
public int a(Random random) {
return 1;
}
public void wasExploded(World world, int i, int j, int k) {
if (!world.isStatic) {
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8;
world.addEntity(entitytntprimed);
}
}
public void postBreak(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
if ((l & 1) == 1) {
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
world.addEntity(entitytntprimed);
world.makeSound(entitytntprimed, "random.fuse", 1.0F, 1.0F);
}
}
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (entityhuman.bS() != null && entityhuman.bS().id == Item.FLINT_AND_STEEL.id) {
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
return true;
} else {
return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
}
public void a(World world, int i, int j, int k, Entity entity) {
if (entity instanceof EntityArrow && !world.isStatic) {
EntityArrow entityarrow = (EntityArrow) entity;
if (entityarrow.isBurning()) {
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
}
}
}
public boolean a(Explosion explosion) {
return false;
}
}

View file

@ -6,11 +6,6 @@ public class BlockTrapdoor extends Block {
protected BlockTrapdoor(int i, Material material) {
super(i, material);
this.textureId = 84;
if (material == Material.ORE) {
++this.textureId;
}
float f = 0.5F;
float f1 = 1.0F;
@ -26,30 +21,30 @@ public class BlockTrapdoor extends Block {
return false;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return !g(iblockaccess.getData(i, j, k));
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return !f(iblockaccess.getData(i, j, k));
}
public int d() {
return 0;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.e(world, i, j, k);
return super.b(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.e(iblockaccess.getData(i, j, k));
this.d(iblockaccess.getData(i, j, k));
}
public void f() {
public void g() {
float f = 0.1875F;
this.a(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F);
}
public void e(int i) {
public void d(int i) {
float f = 0.1875F;
if ((i & 8) != 0) {
@ -58,7 +53,7 @@ public class BlockTrapdoor extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
}
if (g(i)) {
if (f(i)) {
if ((i & 3) == 0) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
@ -85,7 +80,7 @@ public class BlockTrapdoor extends Block {
} else {
int i1 = world.getData(i, j, k);
world.setData(i, j, k, i1 ^ 4);
world.setData(i, j, k, i1 ^ 4, 2);
world.a(entityhuman, 1003, i, j, k, 0);
return true;
}
@ -96,7 +91,7 @@ public class BlockTrapdoor extends Block {
boolean flag1 = (l & 4) > 0;
if (flag1 != flag) {
world.setData(i, j, k, l ^ 4);
world.setData(i, j, k, l ^ 4, 2);
world.a((EntityHuman) null, 1003, i, j, k, 0);
}
}
@ -123,8 +118,8 @@ public class BlockTrapdoor extends Block {
--j1;
}
if (!j(world.getTypeId(j1, j, k1))) {
world.setTypeId(i, j, k, 0);
if (!g(world.getTypeId(j1, j, k1))) {
world.setAir(i, j, k);
this.c(world, i, j, k, i1, 0);
}
@ -200,15 +195,15 @@ public class BlockTrapdoor extends Block {
--i;
}
return j(world.getTypeId(i, j, k));
return g(world.getTypeId(i, j, k));
}
}
public static boolean g(int i) {
public static boolean f(int i) {
return (i & 4) != 0;
}
private static boolean j(int i) {
private static boolean g(int i) {
if (i <= 0) {
return false;
} else {

View file

@ -9,16 +9,16 @@ import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
public class BlockTripwire extends Block {
public BlockTripwire(int i) {
super(i, 173, Material.ORIENTABLE);
super(i, Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
this.b(true);
}
public int r_() {
public int a(World world) {
return 10;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@ -41,11 +41,11 @@ public class BlockTripwire extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
boolean flag = (i1 & 2) == 2;
boolean flag1 = !world.v(i, j - 1, k);
boolean flag1 = !world.w(i, j - 1, k);
if (flag != flag1) {
this.c(world, i, j, k, i1, 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
@ -64,9 +64,9 @@ public class BlockTripwire extends Block {
}
public void onPlace(World world, int i, int j, int k) {
int l = world.v(i, j - 1, k) ? 0 : 2;
int l = world.w(i, j - 1, k) ? 0 : 2;
world.setData(i, j, k, l);
world.setData(i, j, k, l, 3);
this.d(world, i, j, k, l);
}
@ -76,8 +76,8 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (!world.isStatic) {
if (entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
world.setData(i, j, k, l | 8);
if (entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) {
world.setData(i, j, k, l | 8, 4);
}
}
}
@ -115,20 +115,20 @@ 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.l(world, i, j, k);
this.k(world, i, j, k);
}
}
}
public void b(World world, int i, int j, int k, Random random) {
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.l(world, i, j, k);
this.k(world, i, j, k);
}
}
}
private void l(World world, int i, int j, int k) {
private void k(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.at()) {
flag1 = true;
break;
}
@ -184,12 +184,12 @@ public class BlockTripwire extends Block {
}
if (flag1 != flag) {
world.setData(i, j, k, l);
world.setData(i, j, k, l, 3);
this.d(world, i, j, k, l);
}
if (flag1) {
world.a(i, j, k, this.id, this.r_());
world.a(i, j, k, this.id, this.a(world));
}
}
}

View file

@ -7,12 +7,12 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTripwireHook extends Block {
public BlockTripwireHook(int i) {
super(i, 172, Material.ORIENTABLE);
super(i, Material.ORIENTABLE);
this.a(CreativeModeTab.d);
this.b(true);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@ -28,34 +28,34 @@ public class BlockTripwireHook extends Block {
return 29;
}
public int r_() {
public int a(World world) {
return 10;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)));
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)));
}
public boolean canPlace(World world, int i, int j, int k) {
return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : world.t(i, j, k + 1)));
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)));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
byte b0 = 0;
if (l == 2 && world.b(i, j, k + 1, true)) {
if (l == 2 && world.c(i, j, k + 1, true)) {
b0 = 2;
}
if (l == 3 && world.b(i, j, k - 1, true)) {
if (l == 3 && world.c(i, j, k - 1, true)) {
b0 = 0;
}
if (l == 4 && world.b(i + 1, j, k, true)) {
if (l == 4 && world.c(i + 1, j, k, true)) {
b0 = 1;
}
if (l == 5 && world.b(i - 1, j, k, true)) {
if (l == 5 && world.c(i - 1, j, k, true)) {
b0 = 3;
}
@ -68,30 +68,30 @@ public class BlockTripwireHook extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
if (l != this.id) {
if (this.l(world, i, j, k)) {
if (this.k(world, i, j, k)) {
int i1 = world.getData(i, j, k);
int j1 = i1 & 3;
boolean flag = false;
if (!world.t(i - 1, j, k) && j1 == 3) {
if (!world.u(i - 1, j, k) && j1 == 3) {
flag = true;
}
if (!world.t(i + 1, j, k) && j1 == 1) {
if (!world.u(i + 1, j, k) && j1 == 1) {
flag = true;
}
if (!world.t(i, j, k - 1) && j1 == 0) {
if (!world.u(i, j, k - 1) && j1 == 0) {
flag = true;
}
if (!world.t(i, j, k + 1) && j1 == 2) {
if (!world.u(i, j, k + 1) && j1 == 2) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, i1, 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
}
@ -103,7 +103,7 @@ public class BlockTripwireHook extends Block {
boolean flag2 = (i1 & 8) == 8;
boolean flag3 = l == Block.TRIPWIRE_SOURCE.id;
boolean flag4 = false;
boolean flag5 = !world.v(i, j - 1, k);
boolean flag5 = !world.w(i, j - 1, k);
int i2 = Direction.a[l1];
int j2 = Direction.b[l1];
int k2 = 0;
@ -140,7 +140,7 @@ public class BlockTripwireHook extends Block {
flag4 |= flag6 && flag7;
aint[i3] = l3;
if (i3 == j1) {
world.a(i, j, k, l, this.r_());
world.a(i, j, k, l, this.a(world));
flag3 &= flag6;
}
}
@ -154,7 +154,7 @@ public class BlockTripwireHook extends Block {
l2 = i + i2 * k2;
k3 = k + j2 * k2;
j3 = Direction.f[l1];
world.setData(l2, j, k3, j3 | i3);
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);
}
@ -162,7 +162,7 @@ public class BlockTripwireHook extends Block {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
world.getServer().getPluginManager().callEvent(eventRedstone);
if (eventRedstone.getNewCurrent() > 0) {
@ -172,7 +172,7 @@ public class BlockTripwireHook extends Block {
this.a(world, i, j, k, flag3, flag4, flag1, flag2);
if (l > 0) {
world.setData(i, j, k, i1);
world.setData(i, j, k, i1, 3);
if (flag) {
this.d(world, i, j, k, l1);
}
@ -190,13 +190,13 @@ public class BlockTripwireHook extends Block {
l3 &= -5;
}
world.setData(k3, j, j3, l3);
world.setData(k3, j, j3, l3, 3);
}
}
}
}
public void b(World world, int i, int j, int k, Random random) {
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);
}
@ -225,10 +225,10 @@ public class BlockTripwireHook extends Block {
}
}
private boolean l(World world, int i, int j, int k) {
private boolean k(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);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
return false;
} else {
return true;
@ -276,19 +276,19 @@ public class BlockTripwireHook extends Block {
super.remove(world, i, j, k, l, i1);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) == 8;
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) == 8 ? 15 : 0;
}
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if ((i1 & 8) != 8) {
return false;
return 0;
} else {
int j1 = i1 & 3;
return j1 == 2 && l == 2 ? true : (j1 == 0 && l == 3 ? true : (j1 == 1 && l == 4 ? true : j1 == 3 && l == 5));
return j1 == 2 && l == 2 ? 15 : (j1 == 0 && l == 3 ? 15 : (j1 == 1 && l == 4 ? 15 : (j1 == 3 && l == 5 ? 15 : 0)));
}
}

View file

@ -7,12 +7,12 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockVine extends Block {
public BlockVine(int i) {
super(i, 143, Material.REPLACEABLE_PLANT);
super(i, Material.REPLACEABLE_PLANT);
this.b(true);
this.a(CreativeModeTab.c);
}
public void f() {
public void g() {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@ -78,7 +78,7 @@ public class BlockVine extends Block {
flag = true;
}
if (!flag && this.e(iblockaccess.getTypeId(i, j + 1, k))) {
if (!flag && this.d(iblockaccess.getTypeId(i, j + 1, k))) {
f1 = Math.min(f1, 0.9375F);
f4 = 1.0F;
f = 0.0F;
@ -90,33 +90,33 @@ public class BlockVine extends Block {
this.a(f, f1, f2, f3, f4, f5);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
public AxisAlignedBB b(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.e(world.getTypeId(i, j + 1, k));
return this.d(world.getTypeId(i, j + 1, k));
case 2:
return this.e(world.getTypeId(i, j, k + 1));
return this.d(world.getTypeId(i, j, k + 1));
case 3:
return this.e(world.getTypeId(i, j, k - 1));
return this.d(world.getTypeId(i, j, k - 1));
case 4:
return this.e(world.getTypeId(i + 1, j, k));
return this.d(world.getTypeId(i + 1, j, k));
case 5:
return this.e(world.getTypeId(i - 1, j, k));
return this.d(world.getTypeId(i - 1, j, k));
default:
return false;
}
}
private boolean e(int i) {
private boolean d(int i) {
if (i == 0) {
return false;
} else {
@ -126,7 +126,7 @@ public class BlockVine extends Block {
}
}
private boolean l(World world, int i, int j, int k) {
private boolean k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = l;
@ -134,17 +134,17 @@ public class BlockVine extends Block {
for (int j1 = 0; j1 <= 3; ++j1) {
int k1 = 1 << j1;
if ((l & k1) != 0 && !this.e(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.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)) {
i1 &= ~k1;
}
}
}
if (i1 == 0 && !this.e(world.getTypeId(i, j + 1, k))) {
if (i1 == 0 && !this.d(world.getTypeId(i, j + 1, k))) {
return false;
} else {
if (i1 != l) {
world.setData(i, j, k, i1);
world.setData(i, j, k, i1, 2);
}
return true;
@ -152,13 +152,13 @@ public class BlockVine extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic && !this.l(world, i, j, k)) {
if (!world.isStatic && !this.k(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
}
}
public void b(World world, int i, int j, int k, Random random) {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic && world.random.nextInt(4) == 0) {
byte b0 = 4;
int l = 5;
@ -197,7 +197,7 @@ public class BlockVine extends Block {
l1 = world.random.nextInt(16) & i1;
if (l1 > 0) {
for (i2 = 0; i2 <= 3; ++i2) {
if (!this.e(world.getTypeId(i + Direction.a[i2], j + 1, k + Direction.b[i2]))) {
if (!this.d(world.getTypeId(i + Direction.a[i2], j + 1, k + Direction.b[i2]))) {
l1 &= ~(1 << i2);
}
}
@ -206,7 +206,7 @@ public class BlockVine extends Block {
// CraftBukkit start - fire 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);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1);
// CraftBukkit end
}
}
@ -221,25 +221,26 @@ public class BlockVine extends Block {
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);
world.setData(i, j, k, i1 | 1 << k1, 2);
}
} else {
i2 = k1 + 1 & 3;
j2 = k1 + 3 & 3;
// CraftBukkit start - fire 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.e(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) {
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.e(world.getTypeId(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) {
} 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.e(world.getTypeId(i + Direction.a[i2], j, k + Direction.b[i2]))) {
} 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.e(world.getTypeId(i + Direction.a[j2], j, k + Direction.b[j2]))) {
} 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.e(world.getTypeId(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
} else if (this.d(world.getTypeId(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 0);
}
// CraftBukkit end
@ -259,7 +260,7 @@ public class BlockVine extends Block {
i2 = world.random.nextInt(16) & i1;
j2 = world.getData(i, j - 1, k);
if (j2 != (j2 | i2)) {
world.setData(i, j - 1, k, j2 | i2);
world.setData(i, j - 1, k, j2 | i2, 2);
}
}
}
@ -299,7 +300,7 @@ public class BlockVine extends Block {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
if (!world.isStatic && entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.VINE, 1, 0));
} else {

View file

@ -159,7 +159,7 @@ public class Chunk {
if (chunksection != null) {
chunksection.c(j, i1 & 15, k, l);
this.world.o((this.x << 4) + j, i1, (this.z << 4) + k);
this.world.p((this.x << 4) + j, i1, (this.z << 4) + k);
}
}
@ -262,7 +262,7 @@ public class Chunk {
}
if (i1 != l) {
this.world.g(i + this.x * 16, k + this.z * 16, i1, l);
this.world.e(i + this.x * 16, k + this.z * 16, i1, l);
this.heightMap[k << 4 | i] = i1;
int j1 = this.x * 16 + i;
int k1 = this.z * 16 + k;
@ -277,7 +277,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 15);
this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
} else {
@ -285,7 +285,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 0);
this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
}
@ -361,10 +361,6 @@ public class Chunk {
}
}
public boolean a(int i, int j, int k, int l) {
return this.a(i, j, k, l, 0);
}
public boolean a(int i, int j, int k, int l, int i1) {
int j1 = k << 4 | i;
@ -387,7 +383,7 @@ public class Chunk {
return false;
}
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f);
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f);
flag = j >= k1;
}
@ -395,15 +391,15 @@ public class Chunk {
int k2 = this.z * 16 + k;
if (l1 != 0 && !this.world.isStatic) {
Block.byId[l1].h(this.world, j2, j, k2, i2);
Block.byId[l1].l(this.world, j2, j, k2, i2);
}
chunksection.a(i, j & 15, k, l);
if (l1 != 0) {
if (!this.world.isStatic) {
Block.byId[l1].remove(this.world, j2, j, k2, l1, i2);
} else if (Block.byId[l1] instanceof BlockContainer && l1 != l) {
this.world.r(j2, j, k2);
} else if (Block.byId[l1] instanceof IContainer && l1 != l) {
this.world.s(j2, j, k2);
}
}
@ -433,7 +429,7 @@ public class Chunk {
Block.byId[l].onPlace(this.world, j2, j, k2);
}
if (Block.byId[l] instanceof BlockContainer) {
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;
@ -442,18 +438,18 @@ public class Chunk {
tileentity = this.e(i, j, k);
if (tileentity == null) {
tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
tileentity = ((IContainer) Block.byId[l]).b(this.world);
this.world.setTileEntity(j2, j, k2, tileentity);
}
if (tileentity != null) {
tileentity.h();
tileentity.i();
}
}
} else if (l1 > 0 && Block.byId[l1] instanceof BlockContainer) {
} else if (l1 > 0 && Block.byId[l1] instanceof IContainer) {
tileentity = this.e(i, j, k);
if (tileentity != null) {
tileentity.h();
tileentity.i();
}
}
@ -478,11 +474,11 @@ public class Chunk {
chunksection.b(i, j & 15, k, l);
int j1 = chunksection.a(i, j & 15, k);
if (j1 > 0 && Block.byId[j1] instanceof BlockContainer) {
if (j1 > 0 && Block.byId[j1] instanceof IContainer) {
TileEntity tileentity = this.e(i, j, k);
if (tileentity != null) {
tileentity.h();
tileentity.i();
tileentity.p = l;
}
}
@ -502,7 +498,7 @@ public class Chunk {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f);
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f);
this.initLighting();
}
@ -562,15 +558,15 @@ public class Chunk {
k = this.entitySlices.length - 1;
}
entity.ah = true;
entity.ai = this.x;
entity.aj = k;
entity.ak = this.z;
entity.ai = true;
entity.aj = this.x;
entity.ak = k;
entity.al = this.z;
this.entitySlices[k].add(entity);
}
public void b(Entity entity) {
this.a(entity, entity.aj);
this.a(entity, entity.ak);
}
public void a(Entity entity, int i) {
@ -596,12 +592,12 @@ public class Chunk {
if (tileentity == null) {
int l = this.getTypeId(i, j, k);
if (l <= 0 || !Block.byId[l].u()) {
if (l <= 0 || !Block.byId[l].t()) {
return null;
}
if (tileentity == null) {
tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
tileentity = ((IContainer) Block.byId[l]).b(this.world);
this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity);
}
@ -634,7 +630,11 @@ public class Chunk {
tileentity.x = this.x * 16 + i;
tileentity.y = j;
tileentity.z = this.z * 16 + k;
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof IContainer) {
if (this.tileEntities.containsKey(chunkposition)) {
((TileEntity) this.tileEntities.get(chunkposition)).w_();
}
tileentity.s();
this.tileEntities.put(chunkposition, tileentity);
// CraftBukkit start
@ -700,16 +700,18 @@ public class Chunk {
this.l = true;
}
public void a(Entity entity, AxisAlignedBB axisalignedbb, List list) {
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);
}
for (int k = i; k <= j; ++k) {
@ -718,14 +720,14 @@ public class Chunk {
for (int l = 0; l < list1.size(); ++l) {
Entity entity1 = (Entity) list1.get(l);
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
Entity[] aentity = entity1.ao();
Entity[] aentity = entity1.an();
if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) {
entity1 = aentity[i1];
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
}
}
@ -766,7 +768,7 @@ public class Chunk {
public boolean a(boolean flag) {
if (flag) {
if (this.m && this.world.getTime() != this.n) {
if (this.m && this.world.getTime() != this.n || this.l) {
return true;
}
} else if (this.m && this.world.getTime() >= this.n + 600L) {
@ -906,30 +908,30 @@ public class Chunk {
if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].a(k, k1, l) == 0) {
if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) {
this.world.z(i1, l1 - 1, j1);
this.world.A(i1, l1 - 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) {
this.world.z(i1, l1 + 1, j1);
this.world.A(i1, l1 + 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) {
this.world.z(i1 - 1, l1, j1);
this.world.A(i1 - 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) {
this.world.z(i1 + 1, l1, j1);
this.world.A(i1 + 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) {
this.world.z(i1, l1, j1 - 1);
this.world.A(i1, l1, j1 - 1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) {
this.world.z(i1, l1, j1 + 1);
this.world.A(i1, l1, j1 + 1);
}
this.world.z(i1, l1, j1);
this.world.A(i1, l1, j1);
}
}
}

View file

@ -159,8 +159,8 @@ 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) {
MinecraftServer.log.severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
MinecraftServer.log.severe(chunk.getClass().getName());
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());
Throwable ex = new Throwable();
ex.fillInStackTrace();
ex.printStackTrace();

View file

@ -85,16 +85,16 @@ 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")) {
System.out.println("Chunk file at " + i + "," + j + " is missing level data, skipping");
world.getLogger().severe("Chunk file at " + i + "," + j + " is missing level data, skipping");
return null;
} else if (!nbttagcompound.getCompound("Level").hasKey("Sections")) {
System.out.println("Chunk file at " + i + "," + j + " is missing block data, skipping");
world.getLogger().severe("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)) {
System.out.println("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
world.getLogger().severe("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
chunk = this.a(world, nbttagcompound.getCompound("Level"));
@ -112,7 +112,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void a(World world, Chunk chunk) {
// CraftBukkit start - "handle" exception
try {
world.D();
world.E();
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
}
@ -236,9 +236,9 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
chunk.m = true;
nbttagcompound1 = new NBTTagCompound();
if (entity.c(nbttagcompound1)) {
if (entity.d(nbttagcompound1)) {
chunk.m = true;
nbttaglist1.add(nbttagcompound1);
}
}
@ -274,6 +274,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound2.setInt("y", nextticklistentry.b);
nbttagcompound2.setInt("z", nextticklistentry.c);
nbttagcompound2.setInt("t", (int) (nextticklistentry.e - k));
nbttagcompound2.setInt("p", nextticklistentry.f);
nbttaglist3.add(nbttagcompound2);
}
@ -335,6 +336,18 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
chunk.m = true;
if (entity != null) {
chunk.a(entity);
Entity entity1 = entity;
for (NBTTagCompound nbttagcompound3 = nbttagcompound2; nbttagcompound3.hasKey("Riding"); nbttagcompound3 = nbttagcompound3.getCompound("Riding")) {
Entity entity2 = EntityTypes.a(nbttagcompound3.getCompound("Riding"), world);
if (entity2 != null) {
chunk.a(entity2);
entity1.mount(entity2);
}
entity1 = entity2;
}
}
}
}
@ -343,8 +356,8 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
if (nbttaglist2 != null) {
for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) {
NBTTagCompound nbttagcompound3 = (NBTTagCompound) nbttaglist2.get(i1);
TileEntity tileentity = TileEntity.c(nbttagcompound3);
NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist2.get(i1);
TileEntity tileentity = TileEntity.c(nbttagcompound4);
if (tileentity != null) {
chunk.a(tileentity);
@ -357,9 +370,9 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
if (nbttaglist3 != null) {
for (int j1 = 0; j1 < nbttaglist3.size(); ++j1) {
NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist3.get(j1);
NBTTagCompound nbttagcompound5 = (NBTTagCompound) nbttaglist3.get(j1);
world.b(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z"), nbttagcompound4.getInt("i"), nbttagcompound4.getInt("t"));
world.b(nbttagcompound5.getInt("x"), nbttagcompound5.getInt("y"), nbttagcompound5.getInt("z"), nbttagcompound5.getInt("i"), nbttagcompound5.getInt("t"), nbttagcompound5.getInt("p"));
}
}
}

View file

@ -9,41 +9,32 @@ import java.util.logging.LogRecord;
import java.util.regex.Pattern; // CraftBukkit
final class ConsoleLogFormatter extends Formatter {
class ConsoleLogFormatter extends Formatter {
private SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// CraftBukkit start - add color stripping, change constructor to take it
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;
ConsoleLogFormatter(boolean strip) {
this.strip = strip;
}
// 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.a.format(Long.valueOf(logrecord.getMillis())));
Level level = logrecord.getLevel();
if (level == Level.FINEST) {
stringbuilder.append(" [FINEST] ");
} else if (level == Level.FINER) {
stringbuilder.append(" [FINER] ");
} else if (level == Level.FINE) {
stringbuilder.append(" [FINE] ");
} else if (level == Level.INFO) {
stringbuilder.append(" [INFO] ");
} else if (level == Level.WARNING) {
stringbuilder.append(" [WARNING] ");
} else if (level == Level.SEVERE) {
stringbuilder.append(" [SEVERE] ");
} else { // CraftBukkit
stringbuilder.append(" [").append(level.getLocalizedName()).append("] ");
stringbuilder.append(this.b.format(Long.valueOf(logrecord.getMillis())));
if (ConsoleLogManager.a(this.a) != null) {
stringbuilder.append(ConsoleLogManager.a(this.a));
}
stringbuilder.append(formatMessage(logrecord)); // CraftBukkit
stringbuilder.append(" [").append(logrecord.getLevel().getName()).append("] ");
stringbuilder.append(this.formatMessage(logrecord));
stringbuilder.append('\n');
Throwable throwable = logrecord.getThrown();
@ -62,4 +53,8 @@ final class ConsoleLogFormatter extends Formatter {
}
// CraftBukkit end
}
ConsoleLogFormatter(ConsoleLogManager consolelogmanager, EmptyClass3 emptyclass3) {
this(consolelogmanager);
}
}

View file

@ -2,24 +2,50 @@ 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 {
public class ConsoleLogManager implements IConsoleLogManager {
public static Logger a = Logger.getLogger("Minecraft");
private final Logger a;
private final String b;
private final String c;
private final String d;
public static Logger global = Logger.getLogger(""); // CraftBukkit
// CraftBukkit - change of method signature!
public static void init(MinecraftServer server) {
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(server.options.has("log-strip-color")); // CraftBukkit - pass strip color option
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);
a.setUseParentHandlers(false);
// 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);
}
@ -28,8 +54,6 @@ public class ConsoleLogManager {
global.addHandler(consolehandler);
// CraftBukkit end
a.addHandler(consolehandler);
try {
// CraftBukkit start
String pattern = (String) server.options.valueOf("log-pattern");
@ -49,26 +73,26 @@ public class ConsoleLogManager {
parentPath = parent.getPath();
}
int i = 0;
while (i < parentPath.length()) {
char ch = parentPath.charAt(i);
int j = 0;
while (j < parentPath.length()) {
char ch = parentPath.charAt(j);
char ch2 = 0;
if (i + 1 < parentPath.length()) {
ch2 = Character.toLowerCase(pattern.charAt(i + 1));
if (j + 1 < parentPath.length()) {
ch2 = Character.toLowerCase(pattern.charAt(j + 1));
}
if (ch == '%') {
if (ch2 == 'h') {
i += 2;
j += 2;
fixedPattern.append(homeDir);
continue;
} else if (ch2 == 't') {
i += 2;
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
i += 2;
j += 2;
fixedPattern.append("%%");
continue;
} else if (ch2 != 0) {
@ -77,7 +101,7 @@ public class ConsoleLogManager {
}
fixedPattern.append(ch);
i++;
j++;
}
// Try to create needed parent directories
@ -93,10 +117,42 @@ public class ConsoleLogManager {
// CraftBukkit end
filehandler.setFormatter(consolelogformatter);
a.addHandler(filehandler);
this.a.addHandler(filehandler);
global.addHandler(filehandler); // CraftBukkit
} catch (Exception exception) {
a.log(Level.WARNING, "Failed to log to server.log", 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;
}
}

View file

@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@ -16,8 +17,11 @@ public abstract class Container {
public List c = new ArrayList();
public int windowId = 0;
private short a = 0;
private int f = -1;
private int g = 0;
private final Set h = new HashSet();
protected List listeners = new ArrayList();
private Set f = new HashSet();
private Set i = new HashSet();
// CraftBukkit start
public boolean checkReachable = true;
@ -105,168 +109,276 @@ public abstract class Container {
public ItemStack clickItem(int i, int j, int k, EntityHuman entityhuman) {
ItemStack itemstack = null;
PlayerInventory playerinventory = entityhuman.inventory;
Slot slot;
ItemStack itemstack1;
int l;
ItemStack itemstack2;
ItemStack itemstack1;
if ((k == 0 || k == 1) && (j == 0 || j == 1)) {
if (i == -999) {
if (playerinventory.getCarried() != null && i == -999) {
if (j == 0) {
entityhuman.drop(playerinventory.getCarried());
playerinventory.setCarried((ItemStack) null);
if (k == 5) {
int i1 = this.g;
this.g = c(j);
if ((i1 != 1 || this.g != 2) && i1 != this.g) {
this.d();
} else if (playerinventory.getCarried() == null) {
this.d();
} else if (this.g == 0) {
this.f = b(j);
if (d(this.f)) {
this.g = 1;
this.h.clear();
} else {
this.d();
}
} else if (this.g == 1) {
Slot slot = (Slot) this.c.get(i);
if (slot != null && a(slot, playerinventory.getCarried(), true) && slot.isAllowed(playerinventory.getCarried()) && playerinventory.getCarried().count > this.h.size() && this.b(slot)) {
this.h.add(slot);
}
} else if (this.g == 2) {
if (!this.h.isEmpty()) {
itemstack1 = playerinventory.getCarried().cloneItemStack();
l = playerinventory.getCarried().count;
Iterator iterator = this.h.iterator();
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
if (slot1 != null && a(slot1, playerinventory.getCarried(), true) && slot1.isAllowed(playerinventory.getCarried()) && playerinventory.getCarried().count >= this.h.size() && this.b(slot1)) {
ItemStack itemstack2 = itemstack1.cloneItemStack();
int j1 = slot1.d() ? slot1.getItem().count : 0;
a(this.h, this.f, itemstack2, j1);
if (itemstack2.count > itemstack2.getMaxStackSize()) {
itemstack2.count = itemstack2.getMaxStackSize();
}
if (itemstack2.count > slot1.a()) {
itemstack2.count = slot1.a();
}
l -= itemstack2.count - j1;
slot1.set(itemstack2);
}
}
if (j == 1) {
// CraftBukkit start - store a reference
ItemStack itemstack3 = playerinventory.getCarried();
if (itemstack3.count > 0) {
entityhuman.drop(itemstack3.a(1));
}
itemstack1.count = l;
if (itemstack1.count <= 0) {
itemstack1 = null;
}
if (itemstack3.count == 0) {
// CraftBukkit end
playerinventory.setCarried(itemstack1);
}
this.d();
} else {
this.d();
}
} else if (this.g != 0) {
this.d();
} else {
Slot slot2;
int k1;
ItemStack itemstack3;
if ((k == 0 || k == 1) && (j == 0 || j == 1)) {
if (i == -999) {
if (playerinventory.getCarried() != null && i == -999) {
if (j == 0) {
entityhuman.drop(playerinventory.getCarried());
playerinventory.setCarried((ItemStack) null);
}
}
}
} else if (k == 1) {
slot = (Slot) this.c.get(i);
if (slot != null && slot.a(entityhuman)) {
itemstack1 = this.b(entityhuman, i);
if (itemstack1 != null) {
int i1 = itemstack1.id;
itemstack = itemstack1.cloneItemStack();
if (slot != null && slot.getItem() != null && slot.getItem().id == i1) {
this.a(i, j, true, entityhuman);
}
}
}
} else {
if (i < 0) {
return null;
}
slot = (Slot) this.c.get(i);
if (slot != null) {
itemstack1 = slot.getItem();
ItemStack itemstack3 = playerinventory.getCarried();
if (itemstack1 != null) {
itemstack = itemstack1.cloneItemStack();
}
if (itemstack1 == null) {
if (itemstack3 != null && slot.isAllowed(itemstack3)) {
l = j == 0 ? itemstack3.count : 1;
if (l > slot.a()) {
l = slot.a();
if (j == 1) {
// CraftBukkit start - store a reference
ItemStack itemstack4 = playerinventory.getCarried();
if (itemstack4.count > 0) {
entityhuman.drop(itemstack4.a(1));
}
// CraftBukkit start
if (itemstack3.count >= l) {
slot.set(itemstack3.a(l));
}
// CraftBukkit end
if (itemstack3.count == 0) {
if (itemstack4.count == 0) {
// CraftBukkit end
playerinventory.setCarried((ItemStack) null);
}
}
} else if (slot.a(entityhuman)) {
if (itemstack3 == null) {
l = j == 0 ? itemstack1.count : (itemstack1.count + 1) / 2;
itemstack2 = slot.a(l);
playerinventory.setCarried(itemstack2);
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
}
} else if (k == 1) {
if (i < 0) {
return null;
}
slot2 = (Slot) this.c.get(i);
if (slot2 != null && slot2.a(entityhuman)) {
itemstack1 = this.b(entityhuman, i);
if (itemstack1 != null) {
l = itemstack1.id;
itemstack = itemstack1.cloneItemStack();
if (slot2 != null && slot2.getItem() != null && slot2.getItem().id == l) {
this.a(i, j, true, entityhuman);
}
}
}
} else {
if (i < 0) {
return null;
}
slot.a(entityhuman, playerinventory.getCarried());
} else if (slot.isAllowed(itemstack3)) {
if (itemstack1.id == itemstack3.id && itemstack1.getData() == itemstack3.getData() && ItemStack.equals(itemstack1, itemstack3)) {
l = j == 0 ? itemstack3.count : 1;
if (l > slot.a() - itemstack1.count) {
l = slot.a() - itemstack1.count;
slot2 = (Slot) this.c.get(i);
if (slot2 != null) {
itemstack1 = slot2.getItem();
ItemStack itemstack4 = playerinventory.getCarried();
if (itemstack1 != null) {
itemstack = itemstack1.cloneItemStack();
}
if (itemstack1 == null) {
if (itemstack4 != null && slot2.isAllowed(itemstack4)) {
k1 = j == 0 ? itemstack4.count : 1;
if (k1 > slot2.a()) {
k1 = slot2.a();
}
if (l > itemstack3.getMaxStackSize() - itemstack1.count) {
l = itemstack3.getMaxStackSize() - itemstack1.count;
// CraftBukkit start
if (itemstack4.count >= k1) {
slot2.set(itemstack4.a(k1));
}
// CraftBukkit end
itemstack3.a(l);
if (itemstack3.count == 0) {
if (itemstack4.count == 0) {
playerinventory.setCarried((ItemStack) null);
}
itemstack1.count += l;
} else if (itemstack3.count <= slot.a()) {
slot.set(itemstack3);
playerinventory.setCarried(itemstack1);
}
} else if (itemstack1.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) {
l = itemstack1.count;
if (l > 0 && l + itemstack3.count <= itemstack3.getMaxStackSize()) {
itemstack3.count += l;
itemstack1 = slot.a(l);
} else if (slot2.a(entityhuman)) {
if (itemstack4 == null) {
k1 = j == 0 ? itemstack1.count : (itemstack1.count + 1) / 2;
itemstack3 = slot2.a(k1);
playerinventory.setCarried(itemstack3);
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
slot2.set((ItemStack) null);
}
slot.a(entityhuman, playerinventory.getCarried());
slot2.a(entityhuman, playerinventory.getCarried());
} else if (slot2.isAllowed(itemstack4)) {
if (itemstack1.id == itemstack4.id && 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;
}
if (k1 > itemstack4.getMaxStackSize() - itemstack1.count) {
k1 = itemstack4.getMaxStackSize() - itemstack1.count;
}
itemstack4.a(k1);
if (itemstack4.count == 0) {
playerinventory.setCarried((ItemStack) null);
}
itemstack1.count += k1;
} else if (itemstack4.count <= slot2.a()) {
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)) {
k1 = itemstack1.count;
if (k1 > 0 && k1 + itemstack4.count <= itemstack4.getMaxStackSize()) {
itemstack4.count += k1;
itemstack1 = slot2.a(k1);
if (itemstack1.count == 0) {
slot2.set((ItemStack) null);
}
slot2.a(entityhuman, playerinventory.getCarried());
}
}
}
slot2.e();
}
}
} else if (k == 2 && j >= 0 && j < 9) {
slot2 = (Slot) this.c.get(i);
if (slot2.a(entityhuman)) {
itemstack1 = playerinventory.getItem(j);
boolean flag = itemstack1 == null || slot2.inventory == playerinventory && slot2.isAllowed(itemstack1);
k1 = -1;
if (!flag) {
k1 = playerinventory.j();
flag |= k1 > -1;
}
if (slot2.d() && flag) {
itemstack3 = slot2.getItem();
playerinventory.setItem(j, itemstack3);
if ((slot2.inventory != playerinventory || !slot2.isAllowed(itemstack1)) && itemstack1 != null) {
if (k1 > -1) {
playerinventory.pickup(itemstack1);
slot2.a(itemstack3.count);
slot2.set((ItemStack) null);
slot2.a(entityhuman, itemstack3);
}
} else {
slot2.a(itemstack3.count);
slot2.set(itemstack1);
slot2.a(entityhuman, itemstack3);
}
} else if (!slot2.d() && itemstack1 != null && slot2.isAllowed(itemstack1)) {
playerinventory.setItem(j, (ItemStack) null);
slot2.set(itemstack1);
}
}
} else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i >= 0) {
slot2 = (Slot) this.c.get(i);
if (slot2 != null && slot2.d()) {
itemstack1 = slot2.getItem().cloneItemStack();
itemstack1.count = itemstack1.getMaxStackSize();
playerinventory.setCarried(itemstack1);
}
} else if (k == 4 && playerinventory.getCarried() == null && i >= 0) {
slot2 = (Slot) this.c.get(i);
if (slot2 != null && slot2.d()) {
itemstack1 = slot2.a(j == 0 ? 1 : slot2.getItem().count);
slot2.a(entityhuman, itemstack1);
entityhuman.drop(itemstack1);
}
} else if (k == 6 && i >= 0) {
slot2 = (Slot) this.c.get(i);
itemstack1 = playerinventory.getCarried();
if (itemstack1 != null && (slot2 == null || !slot2.d() || !slot2.a(entityhuman))) {
l = j == 0 ? 0 : this.c.size() - 1;
k1 = j == 0 ? 1 : -1;
for (int l1 = 0; l1 < 2; ++l1) {
for (int i2 = l; i2 >= 0 && i2 < this.c.size() && itemstack1.count < itemstack1.getMaxStackSize(); i2 += k1) {
Slot slot3 = (Slot) this.c.get(i2);
if (slot3.d() && a(slot3, itemstack1, true) && slot3.a(entityhuman) && this.a(itemstack1, slot3) && (l1 != 0 || slot3.getItem().count != slot3.getItem().getMaxStackSize())) {
int j2 = Math.min(itemstack1.getMaxStackSize() - itemstack1.count, slot3.getItem().count);
ItemStack itemstack5 = slot3.a(j2);
itemstack1.count += j2;
if (itemstack5.count <= 0) {
slot3.set((ItemStack) null);
}
slot3.a(entityhuman, itemstack5);
}
}
}
slot.e();
}
}
} else if (k == 2 && j >= 0 && j < 9) {
slot = (Slot) this.c.get(i);
if (slot.a(entityhuman)) {
itemstack1 = playerinventory.getItem(j);
boolean flag = itemstack1 == null || slot.inventory == playerinventory && slot.isAllowed(itemstack1);
l = -1;
if (!flag) {
l = playerinventory.i();
flag |= l > -1;
}
if (slot.d() && flag) {
itemstack2 = slot.getItem();
playerinventory.setItem(j, itemstack2);
if ((slot.inventory != playerinventory || !slot.isAllowed(itemstack1)) && itemstack1 != null) {
if (l > -1) {
playerinventory.pickup(itemstack1);
slot.a(itemstack2.count);
slot.set((ItemStack) null);
slot.a(entityhuman, itemstack2);
}
} else {
slot.a(itemstack2.count);
slot.set(itemstack1);
slot.a(entityhuman, itemstack2);
}
} else if (!slot.d() && itemstack1 != null && slot.isAllowed(itemstack1)) {
playerinventory.setItem(j, (ItemStack) null);
slot.set(itemstack1);
}
}
} else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i >= 0) {
slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
itemstack1 = slot.getItem().cloneItemStack();
itemstack1.count = itemstack1.getMaxStackSize();
playerinventory.setCarried(itemstack1);
this.b();
}
}
return itemstack;
}
public boolean a(ItemStack itemstack, Slot slot) {
return true;
}
protected void a(int i, int j, boolean flag, EntityHuman entityhuman) {
this.clickItem(i, j, 1, entityhuman);
}
@ -289,14 +401,14 @@ public abstract class Container {
}
public boolean c(EntityHuman entityhuman) {
return !this.f.contains(entityhuman);
return !this.i.contains(entityhuman);
}
public void a(EntityHuman entityhuman, boolean flag) {
if (flag) {
this.f.remove(entityhuman);
this.i.remove(entityhuman);
} else {
this.f.add(entityhuman);
this.i.add(entityhuman);
}
}
@ -369,4 +481,71 @@ public abstract class Container {
return flag1;
}
public static int b(int i) {
return i >> 2 & 3;
}
public static int c(int i) {
return i & 3;
}
public static boolean d(int i) {
return i == 0 || i == 1;
}
protected void d() {
this.g = 0;
this.h.clear();
}
public static boolean a(Slot slot, ItemStack itemstack, boolean flag) {
boolean flag1 = slot == null || !slot.d();
if (slot != null && slot.d() && itemstack != null && itemstack.doMaterialsMatch(slot.getItem()) && ItemStack.equals(slot.getItem(), itemstack)) {
int i = flag ? 0 : itemstack.count;
flag1 |= slot.getItem().count + i <= itemstack.getMaxStackSize();
}
return flag1;
}
public static void a(Set set, int i, ItemStack itemstack, int j) {
switch (i) {
case 0:
itemstack.count = MathHelper.d((float) itemstack.count / (float) set.size());
break;
case 1:
itemstack.count = 1;
}
itemstack.count += j;
}
public boolean b(Slot slot) {
return true;
}
public static int b(IInventory iinventory) {
if (iinventory == null) {
return 0;
} else {
int i = 0;
float f = 0.0F;
for (int j = 0; j < iinventory.getSize(); ++j) {
ItemStack itemstack = iinventory.getItem(j);
if (itemstack != null) {
f += (float) itemstack.count / (float) Math.min(iinventory.getMaxStackSize(), itemstack.getMaxStackSize());
++i;
}
}
f /= (float) iinventory.getSize();
return MathHelper.d(f * 14.0F) + (i > 0 ? 1 : 0);
}
}
}

View file

@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerAnvil extends Container {
private IInventory f = new InventoryCraftResult();
private IInventory g = new ContainerAnvilInventory(this, "Repair", 2);
private IInventory g = new ContainerAnvilInventory(this, "Repair", true, 2);
private World h;
private int i;
private int j;
@ -53,11 +53,11 @@ public class ContainerAnvil extends Container {
public void a(IInventory iinventory) {
super.a(iinventory);
if (iinventory == this.g) {
this.d();
this.e();
}
}
public void d() {
public void e() {
ItemStack itemstack = this.g.getItem(0);
this.a = 0;
@ -86,8 +86,8 @@ public class ContainerAnvil extends Container {
if (itemstack2 != null) {
flag = itemstack2.id == Item.ENCHANTED_BOOK.id && Item.ENCHANTED_BOOK.g(itemstack2).size() > 0;
if (itemstack1.f() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
l = Math.min(itemstack1.i(), itemstack1.k() / 4);
if (itemstack1.g() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
l = Math.min(itemstack1.j(), itemstack1.l() / 4);
if (l <= 0) {
this.f.setItem(0, (ItemStack) null);
this.a = 0;
@ -95,27 +95,27 @@ public class ContainerAnvil extends Container {
}
for (i1 = 0; l > 0 && i1 < itemstack2.count; ++i1) {
j1 = itemstack1.i() - l;
j1 = itemstack1.j() - l;
itemstack1.setData(j1);
i += Math.max(1, l / 100) + map.size();
l = Math.min(itemstack1.i(), itemstack1.k() / 4);
l = Math.min(itemstack1.j(), itemstack1.l() / 4);
}
this.l = i1;
} else {
if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.f())) {
if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.g())) {
this.f.setItem(0, (ItemStack) null);
this.a = 0;
return;
}
if (itemstack1.f() && !flag) {
l = itemstack.k() - itemstack.i();
i1 = itemstack2.k() - itemstack2.i();
j1 = i1 + itemstack1.k() * 12 / 100;
if (itemstack1.g() && !flag) {
l = itemstack.l() - itemstack.j();
i1 = itemstack2.l() - itemstack2.j();
j1 = i1 + itemstack1.l() * 12 / 100;
int i2 = l + j1;
k1 = itemstack1.k() - i2;
k1 = itemstack1.l() - i2;
if (k1 < 0) {
k1 = 0;
}
@ -206,10 +206,10 @@ public class ContainerAnvil extends Container {
}
}
if (this.m != null && !this.m.equalsIgnoreCase(itemstack.r()) && this.m.length() > 0) {
j = itemstack.f() ? 7 : itemstack.count * 5;
if (this.m != null && !this.m.equalsIgnoreCase(itemstack.getName()) && this.m.length() > 0) {
j = itemstack.g() ? 7 : itemstack.count * 5;
i += j;
if (itemstack.s()) {
if (itemstack.hasName()) {
k += j / 2;
}
@ -264,7 +264,7 @@ public class ContainerAnvil extends Container {
}
if (j == i && j > 0 && this.a >= 40) {
//System.out.println("Naming an item only, cost too high; giving discount to cap cost to 39 levels"); // CraftBukkit -remove debug
// this.h.getLogger().info("Naming an item only, cost too high; giving discount to cap cost to 39 levels"); // CraftBukkit - remove debug
this.a = 39;
}
@ -278,7 +278,7 @@ public class ContainerAnvil extends Container {
i1 = itemstack2.getRepairCost();
}
if (itemstack1.s()) {
if (itemstack1.hasName()) {
i1 -= 9;
}
@ -363,7 +363,7 @@ public class ContainerAnvil extends Container {
this.getSlot(2).getItem().c(this.m);
}
this.d();
this.e();
}
static IInventory a(ContainerAnvil containeranvil) {

View file

@ -40,8 +40,8 @@ public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBuk
}
// CraftBukkit end
ContainerAnvilInventory(ContainerAnvil containeranvil, String s, int i) {
super(s, i);
ContainerAnvilInventory(ContainerAnvil containeranvil, String s, boolean flag, int i) {
super(s, flag, i);
this.a = containeranvil;
this.setMaxStackSize(1); // CraftBukkit
}
@ -50,4 +50,8 @@ public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBuk
super.update();
this.a.a((IInventory) this);
}
public boolean b(int i, ItemStack itemstack) {
return true;
}
}

View file

@ -37,9 +37,9 @@ public class ContainerBeacon extends Container {
this.a(new Slot(playerinventory, i, b0 + i * 18, 58 + short1));
}
this.g = tileentitybeacon.k();
this.h = tileentitybeacon.i();
this.i = tileentitybeacon.j();
this.g = tileentitybeacon.l();
this.h = tileentitybeacon.j();
this.i = tileentitybeacon.k();
}
public void addSlotListener(ICrafting icrafting) {
@ -53,13 +53,13 @@ public class ContainerBeacon extends Container {
super.b();
}
public TileEntityBeacon d() {
public TileEntityBeacon e() {
return this.a;
}
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.a.a_(entityhuman);
return this.a.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {

View file

@ -57,7 +57,7 @@ public class ContainerBrewingStand extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.brewingStand.a_(entityhuman);
return this.brewingStand.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {

View file

@ -64,7 +64,7 @@ public class ContainerChest extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.container.a_(entityhuman);
return this.container.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
@ -95,10 +95,10 @@ public class ContainerChest extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
this.container.f();
this.container.g();
}
public IInventory d() {
public IInventory e() {
return this.container;
}
}

View file

@ -42,7 +42,7 @@ public class ContainerDispenser extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.items.a_(entityhuman);
return this.items.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {

View file

@ -17,7 +17,7 @@ import org.bukkit.entity.Player;
public class ContainerEnchantTable extends Container {
// CraftBukkit - make type specific (changed from IInventory)
public ContainerEnchantTableInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", 1);
public ContainerEnchantTableInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", true, 1);
private World world;
private int x;
private int y;
@ -79,7 +79,7 @@ public class ContainerEnchantTable extends Container {
ItemStack itemstack = iinventory.getItem(0);
int i;
if (itemstack != null && itemstack.v()) {
if (itemstack != null && itemstack.w()) {
this.f = this.l.nextLong();
if (!this.world.isStatic) {
i = 0;

View file

@ -40,8 +40,8 @@ public class ContainerEnchantTableInventory extends InventorySubcontainer { // C
}
// CraftBukkit end
ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, int i) {
super(s, i);
ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, boolean flag, int i) {
super(s, flag, i);
this.enchantTable = containerenchanttable;
this.setMaxStackSize(1); // CraftBukkit
}
@ -54,4 +54,8 @@ public class ContainerEnchantTableInventory extends InventorySubcontainer { // C
super.update();
this.enchantTable.a((IInventory) this);
}
public boolean b(int i, ItemStack itemstack) {
return true;
}
}

View file

@ -80,7 +80,7 @@ public class ContainerFurnace extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.furnace.a_(entityhuman);
return this.furnace.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {

View file

@ -0,0 +1,85 @@
package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
// CraftBukkit end
public class ContainerHopper extends Container {
private final IInventory a;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {
return bukkitEntity;
}
CraftInventory inventory = new CraftInventory(this.a); // Should be this.hopper
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
// CraftBukkit end
public ContainerHopper(PlayerInventory playerinventory, IInventory iinventory) {
this.a = iinventory;
this.player = playerinventory; // CraftBukkit - save player
iinventory.startOpen();
byte b0 = 51;
int i;
for (i = 0; i < iinventory.getSize(); ++i) {
this.a(new Slot(iinventory, i, 44 + i * 18, 20));
}
for (i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.a(new Slot(playerinventory, j + i * 9 + 9, 8 + j * 18, i * 18 + b0));
}
}
for (i = 0; i < 9; ++i) {
this.a(new Slot(playerinventory, i, 8 + i * 18, 58 + b0));
}
}
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.a.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
if (slot != null && slot.d()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if (i < this.a.getSize()) {
if (!this.a(itemstack1, this.a.getSize(), this.c.size(), true)) {
return null;
}
} else if (!this.a(itemstack1, 0, this.a.getSize(), false)) {
return null;
}
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
slot.e();
}
}
return itemstack;
}
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
this.a.g();
}
}

View file

@ -56,11 +56,11 @@ public class ContainerMerchant extends Container {
}
public void a(IInventory iinventory) {
this.f.g();
this.f.h();
super.a(iinventory);
}
public void b(int i) {
public void e(int i) {
this.f.c(i);
}
@ -112,7 +112,7 @@ public class ContainerMerchant extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
this.merchant.b_((EntityHuman) null);
this.merchant.a((EntityHuman) null);
super.b(entityhuman);
if (!this.g.isStatic) {
ItemStack itemstack = this.f.splitWithoutUpdate(0);

View file

@ -105,8 +105,8 @@ public class ContainerPlayer extends Container {
if (!this.a(itemstack1, 9, 45, false)) {
return null;
}
} else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.c.get(5 + ((ItemArmor) itemstack.getItem()).a)).d()) {
int j = 5 + ((ItemArmor) itemstack.getItem()).a;
} else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.c.get(5 + ((ItemArmor) itemstack.getItem()).b)).d()) {
int j = 5 + ((ItemArmor) itemstack.getItem()).b;
if (!this.a(itemstack1, j, j + 1, false)) {
return null;
@ -139,6 +139,10 @@ public class ContainerPlayer extends Container {
return itemstack;
}
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}
// CraftBukkit start
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {

View file

@ -127,6 +127,10 @@ public class ContainerWorkbench extends Container {
return itemstack;
}
public boolean a(ItemStack itemstack, Slot slot) {
return slot.inventory != this.resultInventory && super.a(itemstack, slot);
}
// CraftBukkit start
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {

View file

@ -53,20 +53,20 @@ public class ControllerLook {
// CraftBukkit end
this.a.pitch = this.a(this.a.pitch, f1, this.c);
this.a.az = this.a(this.a.az, f, this.b);
this.a.aA = this.a(this.a.aA, f, this.b);
} else {
this.a.az = this.a(this.a.az, this.a.ax, 10.0F);
this.a.aA = this.a(this.a.aA, this.a.ax, 10.0F);
}
float f2 = MathHelper.g(this.a.az - this.a.ax);
float f2 = MathHelper.g(this.a.aA - this.a.ay);
if (!this.a.getNavigation().f()) {
if (f2 < -75.0F) {
this.a.az = this.a.ax - 75.0F;
this.a.aA = this.a.ay - 75.0F;
}
if (f2 > 75.0F) {
this.a.az = this.a.ax + 75.0F;
this.a.aA = this.a.ay + 75.0F;
}
}
}

View file

@ -47,7 +47,7 @@ public class ControllerMove {
float f = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
this.a.e(this.e * this.a.bB());
this.a.e(this.e * this.a.bE());
if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) {
this.a.getControllerJump().a();
}

View file

@ -45,9 +45,11 @@ public class CraftingManager {
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});
@ -56,6 +58,7 @@ public class CraftingManager {
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)});
@ -78,6 +81,7 @@ public class CraftingManager {
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});
@ -85,6 +89,8 @@ public class CraftingManager {
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});
@ -101,6 +107,7 @@ public class CraftingManager {
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_NUGGET, Character.valueOf('X'), Item.APPLE});
@ -110,6 +117,7 @@ public class CraftingManager {
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});
@ -117,7 +125,10 @@ public class CraftingManager {
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});
@ -126,6 +137,8 @@ public class CraftingManager {
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});
// Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
this.sort(); // CraftBukkit - call new sort method
System.out.println(this.recipes.size() + " recipes");
@ -173,7 +186,7 @@ public class CraftingManager {
if (aobject[i + 1] instanceof Item) {
itemstack1 = new ItemStack((Item) aobject[i + 1]);
} else if (aobject[i + 1] instanceof Block) {
itemstack1 = new ItemStack((Block) aobject[i + 1], 1, -1);
itemstack1 = new ItemStack((Block) aobject[i + 1], 1, 32767);
} else if (aobject[i + 1] instanceof ItemStack) {
itemstack1 = (ItemStack) aobject[i + 1];
}
@ -247,10 +260,10 @@ public class CraftingManager {
}
}
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].n()) {
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].o()) {
Item item = Item.byId[itemstack.id];
int k = item.getMaxDurability() - itemstack.i();
int l = item.getMaxDurability() - itemstack1.i();
int k = item.getMaxDurability() - itemstack.j();
int l = item.getMaxDurability() - itemstack1.j();
int i1 = k + l + item.getMaxDurability() * 5 / 100;
int j1 = item.getMaxDurability() - i1;

View file

@ -11,8 +11,6 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
public class CrashReport {
@ -132,7 +130,7 @@ public class CrashReport {
return stringbuilder.toString();
}
public boolean a(File file1) {
public boolean a(File file1, IConsoleLogManager iconsolelogmanager) {
if (this.e != null) {
return false;
} else {
@ -148,7 +146,7 @@ public class CrashReport {
this.e = file1;
return true;
} catch (Throwable throwable) {
Logger.getLogger("Minecraft").log(Level.SEVERE, "Could not save crash report to " + file1, throwable);
iconsolelogmanager.severe("Could not save crash report to " + file1, throwable);
return false;
}
}

View file

@ -8,10 +8,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.logging.Level;
// CraftBukkit start
import java.io.PrintStream;
import java.util.logging.Level;
import org.bukkit.craftbukkit.LoggerOutputStream;
import org.bukkit.event.server.ServerCommandEvent;
@ -19,7 +19,8 @@ import org.bukkit.event.server.ServerCommandEvent;
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private final List l = Collections.synchronizedList(new ArrayList());
private final List k = Collections.synchronizedList(new ArrayList());
private final IConsoleLogManager l;
private RemoteStatusListener m;
private RemoteControlListener n;
public PropertyManager propertyManager; // CraftBukkit - private -> public
@ -32,6 +33,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public DedicatedServer(joptsimple.OptionSet options) {
super(options);
// CraftBukkit end
this.l = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument
new ThreadSleepForever(this);
}
@ -40,20 +42,19 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
threadcommandreader.setDaemon(true);
threadcommandreader.start();
ConsoleLogManager.init(this); // CraftBukkit
// CraftBukkit start
System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
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
log.info("Starting minecraft server version 1.4.7");
this.getLogger().info("Starting minecraft server version 1.5");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
this.getLogger().warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
log.info("Loading properties");
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
this.getLogger().info("Loading properties");
this.propertyManager = new PropertyManager(this.options, this.getLogger()); // CraftBukkit - CLI argument support
if (this.I()) {
this.d("127.0.0.1");
} else {
@ -77,7 +78,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
this.q = WorldSettings.a(i);
log.info("Default game type: " + this.q);
this.getLogger().info("Default game type: " + this.q);
InetAddress inetaddress = null;
if (this.getServerIp().length() > 0) {
@ -88,26 +89,26 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.setPort(this.propertyManager.getInt("server-port", 25565));
}
log.info("Generating keypair");
this.getLogger().info("Generating keypair");
this.a(MinecraftEncryption.b());
log.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.G());
this.getLogger().info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.G());
try {
this.r = new DedicatedServerConnection(this, inetaddress, this.G());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
log.warning("**** FAILED TO BIND TO PORT!");
log.log(Level.WARNING, "The exception was: " + ioexception.toString());
log.warning("Perhaps a server is already running on that port?");
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?");
return false;
}
this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
if (!this.getOnlineMode()) {
log.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
log.warning("The server will make no attempt to authenticate usernames. Beware.");
log.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
log.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
this.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.");
}
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
@ -145,20 +146,20 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.d((this.getMaxBuildHeight() + 8) / 16 * 16);
this.d(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
log.info("Preparing level \"" + this.J() + "\"");
this.getLogger().info("Preparing level \"" + this.J() + "\"");
this.a(this.J(), this.J(), k, worldtype, s2);
long i1 = System.nanoTime() - j;
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
log.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
this.getLogger().info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
if (this.propertyManager.getBoolean("enable-query", false)) {
log.info("Starting GS4 status listener");
this.getLogger().info("Starting GS4 status listener");
this.m = new RemoteStatusListener(this);
this.m.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false)) {
log.info("Starting remote control listener");
this.getLogger().info("Starting remote control listener");
this.n = new RemoteControlListener(this);
this.n.a();
this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
@ -166,7 +167,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
// CraftBukkit start
if (this.server.getBukkitSpawnRadius() > -1) {
log.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
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.");
this.propertyManager.properties.remove("spawn-protection");
this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
this.server.removeBukkitSpawnRadius();
@ -199,7 +200,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
protected void a(CrashReport crashreport) {
while (this.isRunning()) {
this.al();
this.am();
try {
Thread.sleep(10L);
@ -220,9 +221,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.exit(0);
}
public void r() {
public void r() { // CraftBukkit - protected -> public
super.r();
this.al();
this.am();
}
public boolean getAllowNether() {
@ -234,8 +235,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.am().getHasWhitelist()));
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.am().getWhitelisted().size()));
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.an().getHasWhitelist()));
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.an().getWhitelisted().size()));
super.a(mojangstatisticsgenerator);
}
@ -244,12 +245,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void issueCommand(String s, ICommandListener icommandlistener) {
this.l.add(new ServerCommand(s, icommandlistener));
this.k.add(new ServerCommand(s, icommandlistener));
}
public void al() {
while (!this.l.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
public void am() {
while (!this.k.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.k.remove(0);
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
@ -266,7 +267,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return true;
}
public DedicatedPlayerList am() {
public DedicatedPlayerList an() {
return (DedicatedPlayerList) super.getPlayerList();
}
@ -300,7 +301,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return file1 != null ? file1.getAbsolutePath() : "No settings file";
}
public void an() {
public void ao() {
ServerGUI.a(this);
this.s = true;
}
@ -321,7 +322,30 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return this.propertyManager.getInt("spawn-protection", super.getSpawnProtection());
}
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.worldProvider.dimension != 0) {
return false;
} else if (this.an().getOPs().isEmpty()) {
return false;
} else if (this.an().isOp(entityhuman.name)) {
return false;
} else if (this.getSpawnProtection() <= 0) {
return false;
} else {
ChunkCoordinates chunkcoordinates = world.getSpawn();
int l = MathHelper.a(i - chunkcoordinates.x);
int i1 = MathHelper.a(k - chunkcoordinates.z);
int j1 = Math.max(l, i1);
return j1 <= this.getSpawnProtection();
}
}
public IConsoleLogManager getLogger() {
return this.l;
}
public PlayerList getPlayerList() {
return this.am();
return this.an();
}
}

View file

@ -8,47 +8,44 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DedicatedServerConnectionThread extends Thread {
private static Logger a = Logger.getLogger("Minecraft");
private final List b = Collections.synchronizedList(new ArrayList());
private final HashMap c = new HashMap();
private int d = 0;
private final ServerSocket e;
private ServerConnection f;
private final InetAddress g;
private final int h;
private final List a = Collections.synchronizedList(new ArrayList());
private final HashMap b = new HashMap();
private int c = 0;
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.f = serverconnection;
this.h = i;
this.e = new ServerSocket(i, 0, inetaddress);
this.g = inetaddress == null ? this.e.getInetAddress() : inetaddress;
this.e.setPerformancePreferences(0, 2, 1);
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.b;
List list = this.a;
synchronized (this.b) {
for (int i = 0; i < this.b.size(); ++i) {
PendingConnection pendingconnection = (PendingConnection) this.b.get(i);
synchronized (this.a) {
for (int i = 0; i < this.a.size(); ++i) {
PendingConnection pendingconnection = (PendingConnection) this.a.get(i);
try {
pendingconnection.c();
} catch (Exception exception) {
pendingconnection.disconnect("Internal server error");
a.log(Level.WARNING, "Failed to handle packet for " + pendingconnection.getName() + ": " + exception, exception);
this.e.d().getLogger().warning("Failed to handle packet for " + pendingconnection.getName() + ": " + exception, (Throwable) exception);
}
if (pendingconnection.c) {
this.b.remove(i--);
if (pendingconnection.b) {
this.a.remove(i--);
}
pendingconnection.networkManager.a();
@ -57,51 +54,51 @@ public class DedicatedServerConnectionThread extends Thread {
}
public void run() {
while (this.f.b) {
while (this.e.a) {
try {
Socket socket = this.e.accept();
Socket socket = this.d.accept();
InetAddress inetaddress = socket.getInetAddress();
long i = System.currentTimeMillis();
HashMap hashmap = this.c;
HashMap hashmap = this.b;
// CraftBukkit start
if (((MinecraftServer) this.f.d()).server == null) {
if (((MinecraftServer) this.e.d()).server == null) {
socket.close();
continue;
}
connectionThrottle = ((MinecraftServer) this.f.d()).server.getConnectionThrottle();
connectionThrottle = ((MinecraftServer) this.e.d()).server.getConnectionThrottle();
// CraftBukkit end
synchronized (this.c) {
if (this.c.containsKey(inetaddress) && !b(inetaddress) && i - ((Long) this.c.get(inetaddress)).longValue() < connectionThrottle) {
this.c.put(inetaddress, Long.valueOf(i));
synchronized (this.b) {
if (this.b.containsKey(inetaddress) && !b(inetaddress) && i - ((Long) this.b.get(inetaddress)).longValue() < connectionThrottle) {
this.b.put(inetaddress, Long.valueOf(i));
socket.close();
continue;
}
this.c.put(inetaddress, Long.valueOf(i));
this.b.put(inetaddress, Long.valueOf(i));
}
PendingConnection pendingconnection = new PendingConnection(this.f.d(), socket, "Connection #" + this.d++);
PendingConnection pendingconnection = new PendingConnection(this.e.d(), socket, "Connection #" + this.c++);
this.a(pendingconnection);
} catch (IOException ioexception) {
a.warning("DSCT: " + ioexception.getMessage()); // CraftBukkit
this.e.d().getLogger().warning("DSCT: " + ioexception.getMessage()); // CraftBukkit
}
}
System.out.println("Closing listening thread");
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.b;
List list = this.a;
synchronized (this.b) {
this.b.add(pendingconnection);
synchronized (this.a) {
this.a.add(pendingconnection);
}
}
}
@ -112,17 +109,17 @@ public class DedicatedServerConnectionThread extends Thread {
public void a(InetAddress inetaddress) {
if (inetaddress != null) {
HashMap hashmap = this.c;
HashMap hashmap = this.b;
synchronized (this.c) {
this.c.remove(inetaddress);
synchronized (this.b) {
this.b.remove(inetaddress);
}
}
}
public void b() {
try {
this.e.close();
this.d.close();
} catch (Throwable throwable) {
;
}

View file

@ -5,25 +5,20 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
final class DispenseBehaviorBoat extends DispenseBehaviorItem {
private final DispenseBehaviorItem c;
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
final MinecraftServer b;
public DispenseBehaviorBoat(MinecraftServer minecraftserver) {
this.b = minecraftserver;
this.c = new DispenseBehaviorItem();
}
DispenseBehaviorBoat() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY();
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
double d2 = isourceblock.getZ() + (double) ((float) enumfacing.e() * 1.125F);
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
Material material = world.getMaterial(i, j, k);
double d3;
@ -32,7 +27,7 @@ public class DispenseBehaviorBoat extends DispenseBehaviorItem {
d3 = 1.0D;
} else {
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getMaterial(i, j - 1, k))) {
return this.c.a(isourceblock, itemstack);
return this.b.a(isourceblock, itemstack);
}
d3 = 0.0D;

View file

@ -5,22 +5,17 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
private final DispenseBehaviorItem c;
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
final MinecraftServer b;
public DispenseBehaviorEmptyBucket(MinecraftServer minecraftserver) {
this.b = minecraftserver;
this.c = new DispenseBehaviorItem();
}
DispenseBehaviorEmptyBucket() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
Material material = world.getMaterial(i, j, k);
int l = world.getData(i, j, k);
@ -60,12 +55,12 @@ public class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
}
// CraftBukkit end
world.setTypeId(i, j, k, 0);
world.setAir(i, j, k);
if (--itemstack.count == 0) {
itemstack.id = item.id;
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
this.c.a(isourceblock, new ItemStack(item));
this.b.a(isourceblock, new ItemStack(item));
}
return itemstack;

View file

@ -5,23 +5,18 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
private final DispenseBehaviorItem c;
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
final MinecraftServer b;
public DispenseBehaviorFilledBucket(MinecraftServer minecraftserver) {
this.b = minecraftserver;
this.c = new DispenseBehaviorItem();
}
DispenseBehaviorFilledBucket() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
int i = isourceblock.getBlockX();
int j = isourceblock.getBlockY();
int k = isourceblock.getBlockZ();
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
// CraftBukkit start
World world = isourceblock.k();
@ -61,13 +56,13 @@ public class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
itemstack.id = item.id;
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
this.c.a(isourceblock, new ItemStack(item));
this.b.a(isourceblock, new ItemStack(item));
}
// CraftBukkit end
return itemstack;
} else {
return this.c.a(isourceblock, itemstack);
return this.b.a(isourceblock, itemstack);
}
}
}

View file

@ -7,24 +7,20 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DispenseBehaviorFireball extends DispenseBehaviorItem {
final class DispenseBehaviorFireball extends DispenseBehaviorItem {
final MinecraftServer b;
public DispenseBehaviorFireball(MinecraftServer minecraftserver) {
this.b = minecraftserver;
}
DispenseBehaviorFireball() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
double d0 = iposition.getX() + (double) ((float) enumfacing.c() * 0.3F);
double d1 = iposition.getY();
double d1 = iposition.getY() + (double) ((float) enumfacing.c() * 0.3F);
double d2 = iposition.getZ() + (double) ((float) enumfacing.e() * 0.3F);
World world = isourceblock.k();
Random random = world.random;
double d3 = random.nextGaussian() * 0.05D + (double) enumfacing.c();
double d4 = random.nextGaussian() * 0.05D;
double d4 = random.nextGaussian() * 0.05D + (double) enumfacing.d();
double d5 = random.nextGaussian() * 0.05D + (double) enumfacing.e();
// CraftBukkit start

View file

@ -5,16 +5,12 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DispenseBehaviorFireworks extends DispenseBehaviorItem {
final class DispenseBehaviorFireworks extends DispenseBehaviorItem {
final MinecraftServer b;
public DispenseBehaviorFireworks(MinecraftServer minecraftserver) {
this.b = minecraftserver;
}
DispenseBehaviorFireworks() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();

View file

@ -13,12 +13,12 @@ public class DispenseBehaviorItem implements IDispenseBehavior {
ItemStack itemstack1 = this.b(isourceblock, itemstack);
this.a(isourceblock);
this.a(isourceblock, EnumFacing.a(isourceblock.h()));
this.a(isourceblock, BlockDispenser.j_(isourceblock.h()));
return itemstack1;
}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
ItemStack itemstack1 = itemstack.a(1);

View file

@ -5,34 +5,29 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DispenseBehaviorMinecart extends DispenseBehaviorItem {
final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
private final DispenseBehaviorItem c;
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
final MinecraftServer b;
public DispenseBehaviorMinecart(MinecraftServer minecraftserver) {
this.b = minecraftserver;
this.c = new DispenseBehaviorItem();
}
DispenseBehaviorMinecart() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY();
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
double d2 = isourceblock.getZ() + (double) ((float) enumfacing.e() * 1.125F);
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
int l = world.getTypeId(i, j, k);
double d3;
if (BlockMinecartTrack.e(l)) {
if (BlockMinecartTrackAbstract.d_(l)) {
d3 = 0.0D;
} else {
if (l != 0 || !BlockMinecartTrack.e(world.getTypeId(i, j - 1, k))) {
return this.c.a(isourceblock, itemstack);
if (l != 0 || !BlockMinecartTrackAbstract.d_(world.getTypeId(i, j - 1, k))) {
return this.b.a(isourceblock, itemstack);
}
d3 = -1.0D;
@ -65,10 +60,10 @@ public class DispenseBehaviorMinecart extends DispenseBehaviorItem {
}
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
EntityMinecart entityminecart = new EntityMinecart(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).a);
EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).a);
// CraftBukkit end
world.addEntity(entityminecart);
world.addEntity(entityminecartabstract);
// itemstack.a(1); // CraftBukkit - handled during event processing
return itemstack;
}

View file

@ -5,16 +5,12 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
public class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
final MinecraftServer b;
public DispenseBehaviorMonsterEgg(MinecraftServer minecraftserver) {
this.b = minecraftserver;
}
DispenseBehaviorMonsterEgg() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();
@ -47,7 +43,13 @@ public class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
}
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
ItemMonsterEgg.a(isourceblock.k(), itemstack1.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
Entity entity = ItemMonsterEgg.a(isourceblock.k(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
if (entity instanceof EntityLiving && itemstack.hasName()) {
((EntityLiving) entity).setCustomName(itemstack.getName());
}
// itemstack.a(1); // Handled during event processing
// CraftBukkit end
return itemstack;

View file

@ -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 = EnumFacing.a(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
IProjectile iprojectile = this.a(world, iposition);
// CraftBukkit start
@ -20,7 +20,7 @@ public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
org.bukkit.block.Block block = 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((double) enumfacing.c(), 0.10000000149011612D, (double) enumfacing.e()));
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumfacing.c(), (double) ((float) enumfacing.d() + 0.1F), (double) enumfacing.e()));
if (!BlockDispenser.eventFired) {
world.getServer().getPluginManager().callEvent(event);
}

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,9 @@
package net.minecraft.server;
public abstract class EntityAgeable extends EntityCreature {
private float d = -1.0F;
private float e;
public boolean ageLocked = false; // CraftBukkit
public EntityAgeable(World world) {
@ -9,7 +12,7 @@ public abstract class EntityAgeable extends EntityCreature {
public abstract EntityAgeable createChild(EntityAgeable entityageable);
public boolean a(EntityHuman entityhuman) {
public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id && !this.world.isStatic) {
@ -22,9 +25,13 @@ public abstract class EntityAgeable extends EntityCreature {
entityageable.setAge(-24000);
entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
if (itemstack.hasName()) {
entityageable.setCustomName(itemstack.getName());
}
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinit"
if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite"
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
}
@ -32,7 +39,7 @@ public abstract class EntityAgeable extends EntityCreature {
}
}
return super.a(entityhuman);
return super.a_(entityhuman);
}
protected void a() {
@ -46,6 +53,7 @@ public abstract class EntityAgeable extends EntityCreature {
public void setAge(int i) {
this.datawatcher.watch(12, Integer.valueOf(i));
this.a(this.isBaby());
}
public void b(NBTTagCompound nbttagcompound) {
@ -62,19 +70,40 @@ public abstract class EntityAgeable extends EntityCreature {
public void c() {
super.c();
int i = this.getAge();
if (this.world.isStatic || this.ageLocked) { // CraftBukkit
this.a(this.isBaby());
} else {
int i = this.getAge();
if (ageLocked) return; // CraftBukkit
if (i < 0) {
++i;
this.setAge(i);
} else if (i > 0) {
--i;
this.setAge(i);
if (i < 0) {
++i;
this.setAge(i);
} else if (i > 0) {
--i;
this.setAge(i);
}
}
}
public boolean isBaby() {
return this.getAge() < 0;
}
public void a(boolean flag) {
this.j(flag ? 0.5F : 1.0F);
}
protected final void a(float f, float f1) {
boolean flag = this.d > 0.0F;
this.d = f;
this.e = f1;
if (!flag) {
this.j(1.0F);
}
}
private void j(float f) {
super.a(this.d * f, this.e * f);
}
}

View file

@ -21,9 +21,9 @@ public class EntityArrow extends Entity implements IProjectile {
public int shake = 0;
public Entity shooter;
private int j;
private int at = 0;
private int au = 0;
private double damage = 2.0D;
private int av;
private int aw;
public EntityArrow(World world) {
super(world);
@ -49,7 +49,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.locY = entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D;
double d0 = entityliving1.locX - entityliving.locX;
double d1 = entityliving1.locY + (double) entityliving1.getHeadHeight() - 0.699999988079071D - this.locY;
double d1 = entityliving1.boundingBox.b + (double) (entityliving1.length / 3.0F) - this.locY;
double d2 = entityliving1.locZ - entityliving.locZ;
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
@ -98,9 +98,9 @@ public class EntityArrow extends Entity implements IProjectile {
d0 /= (double) f2;
d1 /= (double) f2;
d2 /= (double) f2;
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d0 += this.random.nextGaussian() * (double) (this.random.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) f1;
d1 += this.random.nextGaussian() * (double) (this.random.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) f1;
d2 += this.random.nextGaussian() * (double) (this.random.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) f1;
d0 *= (double) f;
d1 *= (double) f;
d2 *= (double) f;
@ -114,8 +114,8 @@ public class EntityArrow extends Entity implements IProjectile {
this.j = 0;
}
public void j_() {
super.j_();
public void l_() {
super.l_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@ -127,7 +127,7 @@ public class EntityArrow extends Entity implements IProjectile {
if (i > 0) {
Block.byId[i].updateShape(this.world, this.d, this.e, this.f);
AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.d, this.e, this.f);
AxisAlignedBB axisalignedbb = Block.byId[i].b(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;
@ -153,10 +153,10 @@ public class EntityArrow extends Entity implements IProjectile {
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
this.at = 0;
this.au = 0;
}
} else {
++this.at;
++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);
@ -177,7 +177,7 @@ public class EntityArrow extends Entity implements IProjectile {
for (l = 0; l < list.size(); ++l) {
Entity entity1 = (Entity) list.get(l);
if (entity1.L() && (entity1 != this.shooter || this.at >= 5)) {
if (entity1.K() && (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);
@ -197,6 +197,14 @@ public class EntityArrow extends Entity implements IProjectile {
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null && movingobjectposition.entity != null && movingobjectposition.entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) movingobjectposition.entity;
if (entityhuman.abilities.isInvulnerable || this.shooter instanceof EntityHuman && !((EntityHuman) this.shooter).a(entityhuman)) {
movingobjectposition = null;
}
}
float f2;
float f3;
@ -206,6 +214,7 @@ public class EntityArrow extends Entity implements IProjectile {
ProjectileHitEvent phe = new ProjectileHitEvent(projectile);
this.world.getServer().getPluginManager().callEvent(phe);
// CraftBukkit end
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);
@ -224,7 +233,7 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit start - moved damage call
if (movingobjectposition.entity.damageEntity(damagesource, i1)) {
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.
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);
@ -239,14 +248,13 @@ public class EntityArrow extends Entity implements IProjectile {
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
if (!this.world.isStatic) {
entityliving.r(entityliving.bJ() + 1);
entityliving.r(entityliving.bM() + 1);
}
if (this.av > 0) {
if (this.aw > 0) {
f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (f3 > 0.0F) {
movingobjectposition.entity.g(this.motX * (double) this.av * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.av * 0.6000000238418579D / (double) f3);
movingobjectposition.entity.g(this.motX * (double) this.aw * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.aw * 0.6000000238418579D / (double) f3);
}
}
@ -269,7 +277,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.motZ *= -0.10000000149011612D;
this.yaw += 180.0F;
this.lastYaw += 180.0F;
this.at = 0;
this.au = 0;
}
} else {
this.d = movingobjectposition.b;
@ -287,9 +295,9 @@ public class EntityArrow extends Entity implements IProjectile {
this.makeSound("random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.shake = 7;
this.e(false);
this.a(false);
if (this.g != 0) {
Block.byId[this.g].a(this.world, this.d, this.e, this.f, this);
Block.byId[this.g].a(this.world, this.d, this.e, this.f, (Entity) this);
}
}
}
@ -327,7 +335,7 @@ public class EntityArrow extends Entity implements IProjectile {
float f4 = 0.99F;
f1 = 0.05F;
if (this.H()) {
if (this.G()) {
for (int j1 = 0; j1 < 4; ++j1) {
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);
@ -341,7 +349,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.motZ *= (double) f4;
this.motY -= (double) f1;
this.setPosition(this.locX, this.locY, this.locZ);
this.D();
this.C();
}
}
@ -376,7 +384,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
public void c_(EntityHuman entityhuman) {
public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic && this.inGround && this.shake <= 0) {
// CraftBukkit start
ItemStack itemstack = new ItemStack(Item.ARROW);
@ -420,14 +428,14 @@ public class EntityArrow extends Entity implements IProjectile {
}
public void a(int i) {
this.av = i;
this.aw = i;
}
public boolean aq() {
public boolean ap() {
return false;
}
public void e(boolean flag) {
public void a(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {

View file

@ -10,7 +10,7 @@ public class EntityBlaze extends EntityMonster {
super(world);
this.texture = "/mob/fire.png";
this.fireProof = true;
this.bd = 10;
this.be = 10;
}
public int getMaxHealth() {
@ -22,15 +22,15 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.a(16, new Byte((byte) 0));
}
protected String aY() {
protected String bb() {
return "mob.blaze.breathe";
}
protected String aZ() {
protected String bc() {
return "mob.blaze.hit";
}
protected String ba() {
protected String bd() {
return "mob.blaze.death";
}
@ -40,7 +40,7 @@ public class EntityBlaze extends EntityMonster {
public void c() {
if (!this.world.isStatic) {
if (this.G()) {
if (this.F()) {
this.damageEntity(DamageSource.DROWN, 1);
}
@ -83,13 +83,13 @@ public class EntityBlaze extends EntityMonster {
++this.f;
if (this.f == 1) {
this.attackTicks = 60;
this.f(true);
this.a(true);
} else if (this.f <= 4) {
this.attackTicks = 6;
} else {
this.attackTicks = 100;
this.f = 0;
this.f(false);
this.a(false);
}
if (this.f > 1) {
@ -140,7 +140,7 @@ public class EntityBlaze extends EntityMonster {
return (this.datawatcher.getByte(16) & 1) != 0;
}
public void f(boolean flag) {
public void a(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {

View file

@ -66,11 +66,11 @@ public class EntityBoat extends Entity {
return entity.boundingBox;
}
public AxisAlignedBB E() {
public AxisAlignedBB D() {
return this.boundingBox;
}
public boolean M() {
public boolean L() {
return true;
}
@ -87,7 +87,7 @@ public class EntityBoat extends Entity {
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
public double X() {
public double W() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@ -109,14 +109,12 @@ public class EntityBoat extends Entity {
// CraftBukkit end
this.h(-this.h());
this.g(10);
this.b(10);
this.setDamage(this.getDamage() + i * 10);
this.K();
if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
this.setDamage(100);
}
this.J();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (this.getDamage() > 40) {
if (flag || this.getDamage() > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
@ -131,7 +129,10 @@ public class EntityBoat extends Entity {
this.passenger.mount(this);
}
this.a(Item.BOAT.id, 1, 0.0F);
if (!flag) {
this.a(Item.BOAT.id, 1, 0.0F);
}
this.die();
}
@ -141,11 +142,11 @@ public class EntityBoat extends Entity {
}
}
public boolean L() {
public boolean K() {
return !this.dead;
}
public void j_() {
public void l_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@ -154,9 +155,9 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
super.j_();
super.l_();
if (this.g() > 0) {
this.g(this.g() - 1);
this.b(this.g() - 1);
}
if (this.getDamage() > 0) {
@ -363,7 +364,7 @@ public class EntityBoat extends Entity {
for (l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l);
if (entity != this.passenger && entity.M() && entity instanceof EntityBoat) {
if (entity != this.passenger && entity.L() && entity instanceof EntityBoat) {
entity.collide(this);
}
}
@ -376,13 +377,11 @@ public class EntityBoat extends Entity {
for (int k1 = 0; k1 < 2; ++k1) {
int l1 = MathHelper.floor(this.locY) + k1;
int i2 = this.world.getTypeId(i1, l1, j1);
int j2 = this.world.getData(i1, l1, j1);
if (i2 == Block.SNOW.id) {
this.world.setTypeId(i1, l1, j1, 0);
this.world.setAir(i1, l1, j1);
} else if (i2 == Block.WATER_LILY.id) {
Block.WATER_LILY.dropNaturally(this.world, i1, l1, j1, j2, 0.3F, 0);
this.world.setTypeId(i1, l1, j1, 0);
this.world.setAir(i1, l1, j1, true);
}
}
}
@ -395,12 +394,12 @@ public class EntityBoat extends Entity {
}
}
public void V() {
public void U() {
if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
this.passenger.setPosition(this.locX + d0, this.locY + this.X() + this.passenger.W(), this.locZ + d1);
this.passenger.setPosition(this.locX + d0, this.locY + this.W() + this.passenger.V(), this.locZ + d1);
}
}
@ -408,7 +407,7 @@ public class EntityBoat extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
public boolean a(EntityHuman entityhuman) {
public boolean a_(EntityHuman entityhuman) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
} else {
@ -428,7 +427,7 @@ public class EntityBoat extends Entity {
return this.datawatcher.getInt(19);
}
public void g(int i) {
public void b(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}

View file

@ -27,7 +27,7 @@ public class EntityChicken extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
public boolean be() {
public boolean bh() {
return true;
}
@ -67,15 +67,15 @@ public class EntityChicken extends EntityAnimal {
protected void a(float f) {}
protected String aY() {
protected String bb() {
return "mob.chicken.say";
}
protected String aZ() {
protected String bc() {
return "mob.chicken.hurt";
}
protected String ba() {
protected String bd() {
return "mob.chicken.hurt";
}

View file

@ -22,7 +22,7 @@ public class EntityCow extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
public boolean be() {
public boolean bh() {
return true;
}
@ -30,15 +30,15 @@ public class EntityCow extends EntityAnimal {
return 10;
}
protected String aY() {
protected String bb() {
return "mob.cow.say";
}
protected String aZ() {
protected String bc() {
return "mob.cow.hurt";
}
protected String ba() {
protected String bd() {
return "mob.cow.hurt";
}
@ -46,7 +46,7 @@ public class EntityCow extends EntityAnimal {
this.makeSound("mob.cow.step", 0.15F, 1.0F);
}
protected float aX() {
protected float ba() {
return 0.4F;
}
@ -75,7 +75,7 @@ public class EntityCow extends EntityAnimal {
// CraftBukkit end
}
public boolean a(EntityHuman entityhuman) {
public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
@ -96,7 +96,7 @@ public class EntityCow extends EntityAnimal {
return true;
} else {
return super.a(entityhuman);
return super.a_(entityhuman);
}
}

View file

@ -20,7 +20,7 @@ public abstract class EntityCreature extends EntityLiving {
return false;
}
protected void bn() {
protected void bq() {
this.world.methodProfiler.a("ai");
if (this.c > 0) {
--this.c;
@ -73,13 +73,13 @@ public abstract class EntityCreature extends EntityLiving {
this.world.methodProfiler.b();
if (!this.b && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
} else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bB < 100) {
} else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bC < 100) {
this.i();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
boolean flag = this.H();
boolean flag1 = this.J();
boolean flag = this.G();
boolean flag1 = this.I();
this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
@ -97,7 +97,7 @@ public abstract class EntityCreature extends EntityLiving {
}
}
this.bF = false;
this.bG = false;
if (vec3d != null) {
double d1 = vec3d.c - this.locX;
double d2 = vec3d.e - this.locZ;
@ -106,7 +106,7 @@ public abstract class EntityCreature extends EntityLiving {
float f2 = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = MathHelper.g(f2 - this.yaw);
this.bD = this.bH;
this.bE = this.bI;
if (f3 > 30.0F) {
f3 = 30.0F;
}
@ -123,12 +123,12 @@ public abstract class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
this.bC = -MathHelper.sin(f3) * this.bD * 1.0F;
this.bD = MathHelper.cos(f3) * this.bD * 1.0F;
this.bD = -MathHelper.sin(f3) * this.bE * 1.0F;
this.bE = MathHelper.cos(f3) * this.bE * 1.0F;
}
if (d3 > 0.0D) {
this.bF = true;
this.bG = true;
}
}
@ -137,16 +137,16 @@ public abstract class EntityCreature extends EntityLiving {
}
if (this.positionChanged && !this.k()) {
this.bF = true;
this.bG = true;
}
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
this.bF = true;
this.bG = true;
}
this.world.methodProfiler.b();
} else {
super.bn();
super.bq();
this.pathEntity = null;
}
}
@ -215,10 +215,10 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity;
}
public float bB() {
float f = super.bB();
public float bE() {
float f = super.bE();
if (this.c > 0 && !this.be()) {
if (this.c > 0 && !this.bh()) {
f *= 2.0F;
}

View file

@ -27,11 +27,11 @@ public class EntityCreeper extends EntityMonster {
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
public boolean be() {
public boolean bh() {
return true;
}
public int as() {
public int ar() {
return this.getGoalTarget() == null ? 3 : 3 + (this.health - 1);
}
@ -75,7 +75,7 @@ public class EntityCreeper extends EntityMonster {
}
}
public void j_() {
public void l_() {
if (this.isAlive()) {
this.d = this.fuseTicks;
int i = this.o();
@ -109,14 +109,14 @@ public class EntityCreeper extends EntityMonster {
}
}
super.j_();
super.l_();
}
protected String aZ() {
protected String bc() {
return "mob.creeper.say";
}
protected String ba() {
protected String bd() {
return "mob.creeper.death";
}

View file

@ -9,16 +9,21 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
this.owner = entity1;
}
public Entity f() {
return this.r;
public Entity h() {
return this.p;
}
public Entity getEntity() {
return this.owner;
}
public String getLocalizedDeathMessage(EntityHuman entityhuman) {
return LocaleI18n.get("death." + this.translationIndex, new Object[] { entityhuman.name, this.owner == null ? this.r.getLocalizedName() : this.owner.getLocalizedName()});
public String getLocalizedDeathMessage(EntityLiving entityliving) {
String s = this.owner == null ? this.p.getScoreboardDisplayName() : this.owner.getScoreboardDisplayName();
ItemStack itemstack = this.owner instanceof EntityLiving ? ((EntityLiving) this.owner).bG() : null;
String s1 = "death.attack." + this.translationIndex;
String s2 = s1 + ".item";
return itemstack != null && itemstack.hasName() && LocaleI18n.b(s2) ? LocaleI18n.get(s2, new Object[] { entityliving.getScoreboardDisplayName(), s, itemstack.getName()}) : LocaleI18n.get(s1, new Object[] { entityliving.getScoreboardDisplayName(), s});
}
// CraftBukkit start

View file

@ -22,7 +22,7 @@ public class EntityEnderCrystal extends Entity {
this.datawatcher.a(8, Integer.valueOf(this.b));
}
public void j_() {
public void l_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@ -33,7 +33,7 @@ public class EntityEnderCrystal extends Entity {
int k = MathHelper.floor(this.locZ);
if (this.world.getTypeId(i, j, k) != Block.FIRE.id) {
this.world.setTypeId(i, j, k, Block.FIRE.id);
this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
}
@ -41,7 +41,7 @@ public class EntityEnderCrystal extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
public boolean L() {
public boolean K() {
return true;
}

View file

@ -25,27 +25,27 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
public EntityComplexPart h;
public EntityComplexPart i;
public EntityComplexPart j;
public EntityComplexPart bJ;
public EntityComplexPart bK;
public EntityComplexPart bL;
public float bM = 0.0F;
public EntityComplexPart bM;
public float bN = 0.0F;
public boolean bO = false;
public float bO = 0.0F;
public boolean bP = false;
private Entity bS;
public int bQ = 0;
public EntityEnderCrystal bR = null;
public boolean bQ = false;
private Entity bT;
public int bR = 0;
public EntityEnderCrystal bS = null;
public EntityEnderDragon(World world) {
super(world);
this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bJ = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bM = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
this.setHealth(this.getMaxHealth());
this.texture = "/mob/enderdragon/ender.png";
this.a(16.0F, 8.0F);
this.Y = true;
this.Z = true;
this.fireProof = true;
this.b = 100.0D;
this.al = true;
this.am = true;
}
public int getMaxHealth() {
@ -57,7 +57,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.datawatcher.a(16, new Integer(this.getMaxHealth()));
}
public double[] a(int i, float f) {
public double[] b(int i, float f) {
if (this.health <= 0) {
f = 0.0F;
}
@ -84,14 +84,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
if (!this.world.isStatic) {
this.datawatcher.watch(16, Integer.valueOf(this.getScaledHealth())); // CraftBukkit - this.health -> this.getScaledHealth()
} else {
f = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
f1 = MathHelper.cos(this.bM * 3.1415927F * 2.0F);
f = MathHelper.cos(this.bO * 3.1415927F * 2.0F);
f1 = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
if (f1 <= -0.3F && f >= -0.3F) {
this.world.a(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F, false);
}
}
this.bM = this.bN;
this.bN = this.bO;
float f2;
if (this.health <= 0) {
@ -103,10 +103,10 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.h();
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motY);
if (this.bP) {
this.bN += f * 0.5F;
if (this.bQ) {
this.bO += f * 0.5F;
} else {
this.bN += f;
this.bO += f;
}
this.yaw = MathHelper.g(this.yaw);
@ -130,14 +130,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
float f3;
if (this.world.isStatic) {
if (this.bt > 0) {
d0 = this.locX + (this.bt - this.locX) / (double) this.bt;
d1 = this.locY + (this.bu - this.locY) / (double) this.bt;
d2 = this.locZ + (this.bv - this.locZ) / (double) this.bt;
d3 = MathHelper.g(this.bw - (double) this.yaw);
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bt);
this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bt);
--this.bt;
if (this.bu > 0) {
d0 = this.locX + (this.bv - this.locX) / (double) this.bu;
d1 = this.locY + (this.bw - this.locY) / (double) this.bu;
d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu;
d3 = MathHelper.g(this.by - (double) this.yaw);
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bu);
this.pitch = (float) ((double) this.pitch + (this.bz - (double) this.pitch) / (double) this.bu);
--this.bu;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
}
@ -146,9 +146,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d1 = this.b - this.locY;
d2 = this.c - this.locZ;
d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (this.bS != null) {
this.a = this.bS.locX;
this.c = this.bS.locZ;
if (this.bT != null) {
this.a = this.bT.locX;
this.c = this.bT.locZ;
double d4 = this.a - this.locX;
double d5 = this.c - this.locZ;
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
@ -158,13 +158,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d7 = 10.0D;
}
this.b = this.bS.boundingBox.b + d7;
this.b = this.bT.boundingBox.b + d7;
} else {
this.a += this.random.nextGaussian() * 2.0D;
this.c += this.random.nextGaussian() * 2.0D;
}
if (this.bO || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
if (this.bP || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.H) {
this.i();
}
@ -199,7 +199,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
f4 = 0.0F;
}
this.bE *= 0.8F;
this.bF *= 0.8F;
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
@ -207,13 +207,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d10 = 40.0D;
}
this.bE = (float) ((double) this.bE + d9 * (0.699999988079071D / d10 / (double) f5));
this.yaw += this.bE * 0.1F;
this.bF = (float) ((double) this.bF + d9 * (0.699999988079071D / d10 / (double) f5));
this.yaw += this.bF * 0.1F;
float f6 = (float) (2.0D / (d10 + 1.0D));
float f7 = 0.06F;
this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6)));
if (this.bP) {
if (this.bQ) {
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
} else {
this.move(this.motX, this.motY, this.motZ);
@ -228,43 +228,43 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.motY *= 0.9100000262260437D;
}
this.ax = this.yaw;
this.ay = this.yaw;
this.g.width = this.g.length = 3.0F;
this.i.width = this.i.length = 2.0F;
this.j.width = this.j.length = 2.0F;
this.bJ.width = this.bJ.length = 2.0F;
this.bK.width = this.bK.length = 2.0F;
this.h.length = 3.0F;
this.h.width = 5.0F;
this.bK.length = 2.0F;
this.bK.width = 4.0F;
this.bL.length = 3.0F;
this.bL.length = 2.0F;
this.bL.width = 4.0F;
f1 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
this.bM.length = 3.0F;
this.bM.width = 4.0F;
f1 = (float) (this.b(5, 1.0F)[1] - this.b(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
f2 = MathHelper.cos(f1);
float f9 = -MathHelper.sin(f1);
float f10 = this.yaw * 3.1415927F / 180.0F;
float f11 = MathHelper.sin(f10);
float f12 = MathHelper.cos(f10);
this.h.j_();
this.h.l_();
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
this.bK.j_();
this.bK.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
this.bL.j_();
this.bL.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
this.bL.l_();
this.bL.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
this.bM.l_();
this.bM.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.bK.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.a(this.world.getEntities(this, this.bL.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.a(this.world.getEntities(this, this.bM.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D)));
}
double[] adouble = this.a(5, 1.0F);
double[] adouble1 = this.a(0, 1.0F);
double[] adouble = this.b(5, 1.0F);
double[] adouble1 = this.b(0, 1.0F);
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bE * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bE * 0.01F);
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
this.g.j_();
this.g.l_();
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F);
for (int j = 0; j < 3; ++j) {
@ -279,41 +279,41 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
if (j == 2) {
entitycomplexpart = this.bJ;
entitycomplexpart = this.bK;
}
double[] adouble2 = this.a(12 + j * 2, 1.0F);
double[] adouble2 = this.b(12 + j * 2, 1.0F);
float f14 = this.yaw * 3.1415927F / 180.0F + this.b(adouble2[0] - adouble[0]) * 3.1415927F / 180.0F * 1.0F;
float f15 = MathHelper.sin(f14);
float f16 = MathHelper.cos(f14);
float f17 = 1.5F;
float f18 = (float) (j + 1) * 2.0F;
entitycomplexpart.j_();
entitycomplexpart.l_();
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);
}
if (!this.world.isStatic) {
this.bO = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
this.bQ = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
}
}
}
private void h() {
if (this.bR != null) {
if (this.bR.dead) {
if (this.bS != null) {
if (this.bS.dead) {
if (!this.world.isStatic) {
this.a(this.g, DamageSource.EXPLOSION, 10);
this.a(this.g, DamageSource.explosion((Explosion) null), 10);
}
this.bR = null;
this.bS = null;
} else if (this.ticksLived % 10 == 0 && this.health < this.maxHealth) { // CraftBukkit - this.getMaxHealth() -> this.maxHealth
// CraftBukkit start
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.health += event.getAmount();
this.setHealth(this.getHealth() + event.getAmount());
}
// CraftBukkit end
}
@ -336,7 +336,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
this.bR = entityendercrystal;
this.bS = entityendercrystal;
}
}
@ -382,9 +382,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
private void i() {
this.bO = false;
this.bP = false;
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
this.bS = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
this.bT = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
} else {
boolean flag = false;
@ -401,7 +401,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
} while (!flag);
this.bS = null;
this.bT = null;
}
}
@ -431,9 +431,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
if (j2 != 0) {
if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id) {
flag1 = true;
// CraftBukkit start - add blocks to list rather than destroying them
// this.world.setTypeId(k1, l1, i2, 0);
// flag1 = this.world.setAir(k1, l1, i2) || flag1;
flag1 = true;
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
// CraftBukkit end
} else {
@ -482,8 +482,8 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.a = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.b = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.bS = null;
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
this.bT = null;
if (damagesource.getEntity() instanceof EntityHuman || damagesource.c()) {
this.dealDamage(damagesource, i);
}
@ -498,9 +498,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return super.damageEntity(damagesource, i);
}
protected void aP() {
++this.bQ;
if (this.bQ >= 180 && this.bQ <= 200) {
protected void aS() {
++this.bR;
if (this.bR >= 180 && this.bR <= 200) {
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
@ -512,7 +512,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
int j;
if (!this.world.isStatic) {
if (this.bQ > 150 && this.bQ % 5 == 0) {
if (this.bR > 150 && this.bR % 5 == 0) {
i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
while (i > 0) {
@ -522,14 +522,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
if (this.bQ == 1) {
this.world.e(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
if (this.bR == 1) {
this.world.d(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
}
this.move(0.0D, 0.10000000149011612D, 0.0D);
this.ax = this.yaw += 20.0F;
if (this.bQ == 200 && !this.world.isStatic) {
this.ay = this.yaw += 20.0F;
if (this.bR == 200 && !this.world.isStatic) {
i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
while (i > 0) {
@ -609,13 +609,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
BlockEnderPortal.a = false;
}
protected void bk() {}
protected void bn() {}
public Entity[] ao() {
public Entity[] an() {
return this.children;
}
public boolean L() {
public boolean K() {
return false;
}
@ -623,15 +623,15 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return this.world;
}
protected String aY() {
protected String bb() {
return "mob.enderdragon.growl";
}
protected String aZ() {
protected String bc() {
return "mob.enderdragon.hit";
}
protected float aX() {
protected float ba() {
return 5.0F;
}

View file

@ -15,9 +15,9 @@ public class EntityEnderman extends EntityMonster {
public EntityEnderman(World world) {
super(world);
this.texture = "/mob/enderman.png";
this.bH = 0.2F;
this.bI = 0.2F;
this.a(0.6F, 2.9F);
this.X = 1.0F;
this.Y = 1.0F;
}
public int getMaxHealth() {
@ -47,14 +47,14 @@ public class EntityEnderman extends EntityMonster {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
if (entityhuman != null) {
if (this.d(entityhuman)) {
if (this.e(entityhuman)) {
if (this.f == 0) {
this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F);
}
if (this.f++ == 5) {
this.f = 0;
this.f(true);
this.a(true);
return entityhuman;
}
} else {
@ -65,7 +65,7 @@ public class EntityEnderman extends EntityMonster {
return null;
}
private boolean d(EntityHuman entityhuman) {
private boolean e(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.armor[3];
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
@ -83,11 +83,11 @@ public class EntityEnderman extends EntityMonster {
}
public void c() {
if (this.G()) {
if (this.F()) {
this.damageEntity(DamageSource.DROWN, 1);
}
this.bH = this.target != null ? 6.5F : 0.3F;
this.bI = this.target != null ? 6.5F : 0.3F;
int i;
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
@ -106,7 +106,7 @@ public class EntityEnderman extends EntityMonster {
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.setCarriedData(this.world.getData(i, j, k));
this.world.setTypeId(i, j, k, 0);
this.world.setTypeIdUpdate(i, j, k, 0);
}
// CraftBukkit end
}
@ -121,7 +121,7 @@ public class EntityEnderman extends EntityMonster {
if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
// 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());
this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3);
this.setCarriedId(0);
}
// CraftBukkit end
@ -136,29 +136,29 @@ public class EntityEnderman extends EntityMonster {
if (this.world.u() && !this.world.isStatic) {
float f = this.c(1.0F);
if (f > 0.5F && this.world.k(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
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) {
this.target = null;
this.f(false);
this.a(false);
this.m();
}
}
if (this.G() || this.isBurning()) {
if (this.F() || this.isBurning()) {
this.target = null;
this.f(false);
this.a(false);
this.m();
}
this.bF = false;
this.bG = false;
if (this.target != null) {
this.a(this.target, 100.0F, 100.0F);
}
if (!this.world.isStatic && this.isAlive()) {
if (this.target != null) {
if (this.target instanceof EntityHuman && this.d((EntityHuman) this.target)) {
this.bC = this.bD = 0.0F;
this.bH = 0.0F;
if (this.target instanceof EntityHuman && this.e((EntityHuman) this.target)) {
this.bD = this.bE = 0.0F;
this.bI = 0.0F;
if (this.target.e((Entity) this) < 16.0D) {
this.m();
}
@ -168,7 +168,7 @@ public class EntityEnderman extends EntityMonster {
this.e = 0;
}
} else {
this.f(false);
this.a(false);
this.e = 0;
}
}
@ -265,15 +265,15 @@ public class EntityEnderman extends EntityMonster {
}
}
protected String aY() {
protected String bb() {
return this.q() ? "mob.endermen.scream" : "mob.endermen.idle";
}
protected String aZ() {
protected String bc() {
return "mob.endermen.hit";
}
protected String ba() {
protected String bd() {
return "mob.endermen.death";
}
@ -318,7 +318,7 @@ public class EntityEnderman extends EntityMonster {
if (this.isInvulnerable()) {
return false;
} else {
this.f(true);
this.a(true);
if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
if (this.m()) {
@ -337,7 +337,7 @@ public class EntityEnderman extends EntityMonster {
return this.datawatcher.getByte(18) > 0;
}
public void f(boolean flag) {
public void a(boolean flag) {
this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
}

View file

@ -39,8 +39,8 @@ public class EntityExperienceOrb extends Entity {
protected void a() {}
public void j_() {
super.j_();
public void l_() {
super.l_();
if (this.c > 0) {
--this.c;
}
@ -114,7 +114,7 @@ public class EntityExperienceOrb extends Entity {
}
}
public boolean I() {
public boolean H() {
return this.world.a(this.boundingBox, Material.WATER, (Entity) this);
}
@ -126,7 +126,7 @@ public class EntityExperienceOrb extends Entity {
if (this.isInvulnerable()) {
return false;
} else {
this.K();
this.J();
this.d -= i;
if (this.d <= 0) {
this.die();
@ -148,10 +148,10 @@ public class EntityExperienceOrb extends Entity {
this.value = nbttagcompound.getShort("Value");
}
public void c_(EntityHuman entityhuman) {
public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
if (this.c == 0 && entityhuman.bS == 0) {
entityhuman.bS = 2;
if (this.c == 0 && entityhuman.bT == 0) {
entityhuman.bT = 2;
this.makeSound("random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
entityhuman.receive(this, 1);
entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value to event.getAmount()
@ -187,7 +187,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 ap() {
return false;
}
}

Some files were not shown because too many files have changed in this diff Show more