3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

Update CraftBukkit to Minecraft 1.7.2

Dieser Commit ist enthalten in:
mbax 2013-11-04 07:07:38 -06:00 committet von Wesley Wolfe
Ursprung ff8b70fbb7
Commit 2726696652
349 geänderte Dateien mit 14339 neuen und 11287 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.6.4-R2.1-SNAPSHOT</version>
<version>1.7.2-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.6.4</minecraft.version>
<minecraft_version>1_6_R3</minecraft_version>
<minecraft.version>1.7.2</minecraft.version>
<minecraft_version>1_7_R1</minecraft_version>
<buildtag.prefix>git-Bukkit-</buildtag.prefix>
<buildtag.suffix></buildtag.suffix>
</properties>

Datei anzeigen

@ -1,199 +1,36 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
public class Block {
public static final RegistryMaterials REGISTRY = new RegistryBlocks("air");
private CreativeModeTab creativeTab;
protected String f;
public static final StepSound g = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound h = new StepSound("wood", 1.0F, 1.0F);
public static final StepSound i = new StepSound("gravel", 1.0F, 1.0F);
public static final StepSound j = new StepSound("grass", 1.0F, 1.0F);
public static final StepSound k = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound l = new StepSound("stone", 1.0F, 1.5F);
public static final StepSound m = new StepSoundStone("stone", 1.0F, 1.0F);
public static final StepSound n = new StepSound("cloth", 1.0F, 1.0F);
public static final StepSound o = new StepSound("sand", 1.0F, 1.0F);
public static final StepSound p = new StepSound("snow", 1.0F, 1.0F);
public static final StepSound q = new StepSoundLadder("ladder", 1.0F, 1.0F);
public static final StepSound r = new StepSoundAnvil("anvil", 0.3F, 1.0F);
public static final Block[] byId = new Block[4096];
public static final boolean[] t = new boolean[4096];
public static final int[] lightBlock = new int[4096];
public static final boolean[] v = new boolean[4096];
public static final int[] lightEmission = new int[4096];
public static boolean[] x = new boolean[4096];
public static final Block STONE = (new BlockStone(1)).c(1.5F).b(10.0F).a(k).c("stone").d("stone");
public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(j).c("grass").d("grass");
public static final Block DIRT = (new BlockDirt(3)).c(0.5F).a(i).c("dirt").d("dirt");
public static final Block COBBLESTONE = (new Block(4, Material.STONE)).c(2.0F).b(10.0F).a(k).c("stonebrick").a(CreativeModeTab.b).d("cobblestone");
public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(h).c("wood").d("planks");
public static final Block SAPLING = (new BlockSapling(6)).c(0.0F).a(j).c("sapling").d("sapling");
public static final Block BEDROCK = (new Block(7, Material.STONE)).r().b(6000000.0F).a(k).c("bedrock").C().a(CreativeModeTab.b).d("bedrock");
public static final BlockFluids WATER = (BlockFluids) (new BlockFlowing(8, Material.WATER)).c(100.0F).k(3).c("water").C().d("water_flow");
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).k(3).c("water").C().d("water_still");
public static final BlockFluids LAVA = (BlockFluids) (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).c("lava").C().d("lava_flow");
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).c("lava").C().d("lava_still");
public static final Block SAND = (new BlockSand(12)).c(0.5F).a(o).c("sand").d("sand");
public static final Block GRAVEL = (new BlockGravel(13)).c(0.6F).a(i).c("gravel").d("gravel");
public static final Block GOLD_ORE = (new BlockOre(14)).c(3.0F).b(5.0F).a(k).c("oreGold").d("gold_ore");
public static final Block IRON_ORE = (new BlockOre(15)).c(3.0F).b(5.0F).a(k).c("oreIron").d("iron_ore");
public static final Block COAL_ORE = (new BlockOre(16)).c(3.0F).b(5.0F).a(k).c("oreCoal").d("coal_ore");
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(h).c("log").d("log");
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18)).c(0.2F).k(1).a(j).c("leaves").d("leaves");
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(j).c("sponge").d("sponge");
public static final Block GLASS = (new BlockGlass(20, Material.SHATTERABLE, false)).c(0.3F).a(m).c("glass").d("glass");
public static final Block LAPIS_ORE = (new BlockOre(21)).c(3.0F).b(5.0F).a(k).c("oreLapis").d("lapis_ore");
public static final Block LAPIS_BLOCK = (new Block(22, Material.STONE)).c(3.0F).b(5.0F).a(k).c("blockLapis").a(CreativeModeTab.b).d("lapis_block");
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(k).c("dispenser").d("dispenser");
public static final Block SANDSTONE = (new BlockSandStone(24)).a(k).c(0.8F).c("sandStone").d("sandstone");
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).c("musicBlock").d("noteblock");
public static final Block BED = (new BlockBed(26)).c(0.2F).c("bed").C().d("bed");
public static final Block GOLDEN_RAIL = (new BlockPoweredRail(27)).c(0.7F).a(l).c("goldenRail").d("rail_golden");
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28)).c(0.7F).a(l).c("detectorRail").d("rail_detector");
public static final BlockPiston PISTON_STICKY = (BlockPiston) (new BlockPiston(29, true)).c("pistonStickyBase");
public static final Block WEB = (new BlockWeb(30)).k(1).c(4.0F).c("web").d("web");
public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31)).c(0.0F).a(j).c("tallgrass");
public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32)).c(0.0F).a(j).c("deadbush").d("deadbush");
public static final BlockPiston PISTON = (BlockPiston) (new BlockPiston(33, false)).c("pistonBase");
public static final BlockPistonExtension PISTON_EXTENSION = new BlockPistonExtension(34);
public static final Block WOOL = (new BlockCloth(35, Material.CLOTH)).c(0.8F).a(n).c("cloth").d("wool_colored");
public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37)).c(0.0F).a(j).c("flower").d("flower_dandelion");
public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38)).c(0.0F).a(j).c("rose").d("flower_rose");
public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39)).c(0.0F).a(j).a(0.125F).c("mushroom").d("mushroom_brown");
public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40)).c(0.0F).a(j).c("mushroom").d("mushroom_red");
public static final Block GOLD_BLOCK = (new BlockOreBlock(41)).c(3.0F).b(10.0F).a(l).c("blockGold").d("gold_block");
public static final Block IRON_BLOCK = (new BlockOreBlock(42)).c(5.0F).b(10.0F).a(l).c("blockIron").d("iron_block");
public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(k).c("stoneSlab");
public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(k).c("stoneSlab");
public static final Block BRICK = (new Block(45, Material.STONE)).c(2.0F).b(10.0F).a(k).c("brick").a(CreativeModeTab.b).d("brick");
public static final Block TNT = (new BlockTNT(46)).c(0.0F).a(j).c("tnt").d("tnt");
public static final Block BOOKSHELF = (new BlockBookshelf(47)).c(1.5F).a(h).c("bookshelf").d("bookshelf");
public static final Block MOSSY_COBBLESTONE = (new Block(48, Material.STONE)).c(2.0F).b(10.0F).a(k).c("stoneMoss").a(CreativeModeTab.b).d("cobblestone_mossy");
public static final Block OBSIDIAN = (new BlockObsidian(49)).c(50.0F).b(2000.0F).a(k).c("obsidian").d("obsidian");
public static final Block TORCH = (new BlockTorch(50)).c(0.0F).a(0.9375F).a(h).c("torch").d("torch_on");
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51)).c(0.0F).a(1.0F).a(h).c("fire").C().d("fire");
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52)).c(5.0F).a(l).c("mobSpawner").C().d("mob_spawner");
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).c("stairsWood");
public static final BlockChest CHEST = (BlockChest) (new BlockChest(54, 0)).c(2.5F).a(h).c("chest");
public static final BlockRedstoneWire REDSTONE_WIRE = (BlockRedstoneWire) (new BlockRedstoneWire(55)).c(0.0F).a(g).c("redstoneDust").C().d("redstone_dust");
public static final Block DIAMOND_ORE = (new BlockOre(56)).c(3.0F).b(5.0F).a(k).c("oreDiamond").d("diamond_ore");
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57)).c(5.0F).b(10.0F).a(l).c("blockDiamond").d("diamond_block");
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(h).c("workbench").d("crafting_table");
public static final Block CROPS = (new BlockCrops(59)).c("crops").d("wheat");
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(i).c("farmland").d("farmland");
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(k).c("furnace").a(CreativeModeTab.c);
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(k).a(0.875F).c("furnace");
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(h).c("sign").C();
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(h).c("doorWood").C().d("door_wood");
public static final Block LADDER = (new BlockLadder(65)).c(0.4F).a(q).c("ladder").d("ladder");
public static final Block RAILS = (new BlockMinecartTrack(66)).c(0.7F).a(l).c("rail").d("rail_normal");
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).c("stairsStone");
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(h).c("sign").C();
public static final Block LEVER = (new BlockLever(69)).c(0.5F).a(h).c("lever").d("lever");
public static final Block STONE_PLATE = (new BlockPressurePlateBinary(70, "stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(k).c("pressurePlate");
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(l).c("doorIron").C().d("door_iron");
public static final Block WOOD_PLATE = (new BlockPressurePlateBinary(72, "planks_oak", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(h).c("pressurePlate");
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, false)).c(3.0F).b(5.0F).a(k).c("oreRedstone").a(CreativeModeTab.b).d("redstone_ore");
public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, true)).a(0.625F).c(3.0F).b(5.0F).a(k).c("oreRedstone").d("redstone_ore");
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, false)).c(0.0F).a(h).c("notGate").d("redstone_torch_off");
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, true)).c(0.0F).a(0.5F).a(h).c("notGate").a(CreativeModeTab.d).d("redstone_torch_on");
public static final Block STONE_BUTTON = (new BlockStoneButton(77)).c(0.5F).a(k).c("button");
public static final Block SNOW = (new BlockSnow(78)).c(0.1F).a(p).c("snow").k(0).d("snow");
public static final Block ICE = (new BlockIce(79)).c(0.5F).k(3).a(m).c("ice").d("ice");
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80)).c(0.2F).a(p).c("snow").d("snow");
public static final Block CACTUS = (new BlockCactus(81)).c(0.4F).a(n).c("cactus").d("cactus");
public static final Block CLAY = (new BlockClay(82)).c(0.6F).a(i).c("clay").d("clay");
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83)).c(0.0F).a(j).c("reeds").C().d("reeds");
public static final Block JUKEBOX = (new BlockJukeBox(84)).c(2.0F).b(10.0F).a(k).c("jukebox").d("jukebox");
public static final Block FENCE = (new BlockFence(85, "planks_oak", Material.WOOD)).c(2.0F).b(5.0F).a(h).c("fence");
public static final Block PUMPKIN = (new BlockPumpkin(86, false)).c(1.0F).a(h).c("pumpkin").d("pumpkin");
public static final Block NETHERRACK = (new BlockBloodStone(87)).c(0.4F).a(k).c("hellrock").d("netherrack");
public static final Block SOUL_SAND = (new BlockSlowSand(88)).c(0.5F).a(o).c("hellsand").d("soul_sand");
public static final Block GLOWSTONE = (new BlockLightStone(89, Material.SHATTERABLE)).c(0.3F).a(m).a(1.0F).c("lightgem").d("glowstone");
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90)).c(-1.0F).a(m).a(0.75F).c("portal").d("portal");
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, true)).c(1.0F).a(h).a(1.0F).c("litpumpkin").d("pumpkin");
public static final Block CAKE_BLOCK = (new BlockCake(92)).c(0.5F).a(n).c("cake").C().d("cake");
public static final BlockRepeater DIODE_OFF = (BlockRepeater) (new BlockRepeater(93, false)).c(0.0F).a(h).c("diode").C().d("repeater_off");
public static final BlockRepeater DIODE_ON = (BlockRepeater) (new BlockRepeater(94, true)).c(0.0F).a(0.625F).a(h).c("diode").C().d("repeater_on");
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(h).c("lockedchest").b(true);
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(h).c("trapdoor").C().d("trapdoor");
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).c("monsterStoneEgg");
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(k).c("stonebricksmooth").d("stonebrick");
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 0)).c(0.2F).a(h).c("mushroom").d("mushroom_block");
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 1)).c(0.2F).a(h).c("mushroom").d("mushroom_block");
public static final Block IRON_FENCE = (new BlockThinFence(101, "iron_bars", "iron_bars", Material.ORE, true)).c(5.0F).b(10.0F).a(l).c("fenceIron");
public static final Block THIN_GLASS = (new BlockThinFence(102, "glass", "glass_pane_top", Material.SHATTERABLE, false)).c(0.3F).a(m).c("thinGlass");
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(h).c("melon").d("melon");
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(h).c("pumpkinStem").d("pumpkin_stem");
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(h).c("pumpkinStem").d("melon_stem");
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(j).c("vine").d("vine");
public static final Block FENCE_GATE = (new BlockFenceGate(107)).c(2.0F).b(5.0F).a(h).c("fenceGate");
public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).c("stairsBrick");
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).c("stairsStoneBrickSmooth");
public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(j).c("mycel").d("mycelium");
public static final Block WATER_LILY = (new BlockWaterLily(111)).c(0.0F).a(j).c("waterlily").d("waterlily");
public static final Block NETHER_BRICK = (new Block(112, Material.STONE)).c(2.0F).b(10.0F).a(k).c("netherBrick").a(CreativeModeTab.b).d("nether_brick");
public static final Block NETHER_FENCE = (new BlockFence(113, "nether_brick", Material.STONE)).c(2.0F).b(10.0F).a(k).c("netherFence");
public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).c("stairsNetherBrick");
public static final Block NETHER_WART = (new BlockNetherWart(115)).c("netherStalk").d("nether_wart");
public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).c("enchantmentTable").d("enchanting_table");
public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).c("brewingStand").d("brewing_stand");
public static final BlockCauldron CAULDRON = (BlockCauldron) (new BlockCauldron(118)).c(2.0F).c("cauldron").d("cauldron");
public static final Block ENDER_PORTAL = (new BlockEnderPortal(119, Material.PORTAL)).c(-1.0F).b(6000000.0F);
public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(m).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c).d("endframe");
public static final Block WHITESTONE = (new Block(121, Material.STONE)).c(3.0F).b(15.0F).a(k).c("whiteStone").a(CreativeModeTab.b).d("end_stone");
public static final Block DRAGON_EGG = (new BlockDragonEgg(122)).c(3.0F).b(15.0F).a(k).a(0.125F).c("dragonEgg").d("dragon_egg");
public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(m).c("redstoneLight").a(CreativeModeTab.d).d("redstone_lamp_off");
public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(m).c("redstoneLight").d("redstone_lamp_on");
public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(h).c("woodSlab");
public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(h).c("woodSlab");
public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(h).c("cocoa").d("cocoa");
public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).c("stairsSandStone");
public static final Block EMERALD_ORE = (new BlockOre(129)).c(3.0F).b(5.0F).a(k).c("oreEmerald").d("emerald_ore");
public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(k).c("enderChest").a(0.5F);
public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).c("tripWireSource").d("trip_wire_source");
public static final Block TRIPWIRE = (new BlockTripwire(132)).c("tripWire").d("trip_wire");
public static final Block EMERALD_BLOCK = (new BlockOreBlock(133)).c(5.0F).b(10.0F).a(l).c("blockEmerald").d("emerald_block");
public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).c("stairsWoodSpruce");
public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).c("stairsWoodBirch");
public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).c("stairsWoodJungle");
public static final Block COMMAND = (new BlockCommand(137)).r().b(6000000.0F).c("commandBlock").d("command_block");
public static final BlockBeacon BEACON = (BlockBeacon) (new BlockBeacon(138)).c("beacon").a(1.0F).d("beacon");
public static final Block COBBLE_WALL = (new BlockCobbleWall(139, COBBLESTONE)).c("cobbleWall");
public static final Block FLOWER_POT = (new BlockFlowerPot(140)).c(0.0F).a(g).c("flowerPot").d("flower_pot");
public static final Block CARROTS = (new BlockCarrots(141)).c("carrots").d("carrots");
public static final Block POTATOES = (new BlockPotatoes(142)).c("potatoes").d("potatoes");
public static final Block WOOD_BUTTON = (new BlockWoodButton(143)).c(0.5F).a(h).c("button");
public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(k).c("skull").d("skull");
public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(r).b(2000.0F).c("anvil");
public static final Block TRAPPED_CHEST = (new BlockChest(146, 1)).c(2.5F).a(h).c("chestTrap");
public static final Block GOLD_PLATE = (new BlockPressurePlateWeighted(147, "gold_block", Material.ORE, 64)).c(0.5F).a(h).c("weightedPlate_light");
public static final Block IRON_PLATE = (new BlockPressurePlateWeighted(148, "iron_block", Material.ORE, 640)).c(0.5F).a(h).c("weightedPlate_heavy");
public static final BlockRedstoneComparator REDSTONE_COMPARATOR_OFF = (BlockRedstoneComparator) (new BlockRedstoneComparator(149, false)).c(0.0F).a(h).c("comparator").C().d("comparator_off");
public static final BlockRedstoneComparator REDSTONE_COMPARATOR_ON = (BlockRedstoneComparator) (new BlockRedstoneComparator(150, true)).c(0.0F).a(0.625F).a(h).c("comparator").C().d("comparator_on");
public static final BlockDaylightDetector DAYLIGHT_DETECTOR = (BlockDaylightDetector) (new BlockDaylightDetector(151)).c(0.2F).a(h).c("daylightDetector").d("daylight_detector");
public static final Block REDSTONE_BLOCK = (new BlockRedstone(152)).c(5.0F).b(10.0F).a(l).c("blockRedstone").d("redstone_block");
public static final Block QUARTZ_ORE = (new BlockOre(153)).c(3.0F).b(5.0F).a(k).c("netherquartz").d("quartz_ore");
public static final BlockHopper HOPPER = (BlockHopper) (new BlockHopper(154)).c(3.0F).b(8.0F).a(h).c("hopper").d("hopper");
public static final Block QUARTZ_BLOCK = (new BlockQuartz(155)).a(k).c(0.8F).c("quartzBlock").d("quartz_block");
public static final Block QUARTZ_STAIRS = (new BlockStairs(156, QUARTZ_BLOCK, 0)).c("stairsQuartz");
public static final Block ACTIVATOR_RAIL = (new BlockPoweredRail(157)).c(0.7F).a(l).c("activatorRail").d("rail_activator");
public static final Block DROPPER = (new BlockDropper(158)).c(3.5F).a(k).c("dropper").d("dropper");
public static final Block STAINED_HARDENED_CLAY = (new BlockCloth(159, Material.STONE)).c(1.25F).b(7.0F).a(k).c("clayHardenedStained").d("hardened_clay_stained");
public static final Block HAY_BLOCK = (new BlockHay(170)).c(0.5F).a(j).c("hayBlock").a(CreativeModeTab.b).d("hay_block");
public static final Block WOOL_CARPET = (new BlockCarpet(171)).c(0.1F).a(n).c("woolCarpet").k(0);
public static final Block HARDENED_CLAY = (new Block(172, Material.STONE)).c(1.25F).b(7.0F).a(k).c("clayHardened").a(CreativeModeTab.b).d("hardened_clay");
public static final Block COAL_BLOCK = (new Block(173, Material.STONE)).c(5.0F).b(10.0F).a(k).c("blockCoal").a(CreativeModeTab.b).d("coal_block");
public final int id;
protected String d;
public static final StepSound e = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound f = new StepSound("wood", 1.0F, 1.0F);
public static final StepSound g = new StepSound("gravel", 1.0F, 1.0F);
public static final StepSound h = new StepSound("grass", 1.0F, 1.0F);
public static final StepSound i = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound j = new StepSound("stone", 1.0F, 1.5F);
public static final StepSound k = new StepSoundStone("stone", 1.0F, 1.0F);
public static final StepSound l = new StepSound("cloth", 1.0F, 1.0F);
public static final StepSound m = new StepSound("sand", 1.0F, 1.0F);
public static final StepSound n = new StepSound("snow", 1.0F, 1.0F);
public static final StepSound o = new StepSoundLadder("ladder", 1.0F, 1.0F);
public static final StepSound p = new StepSoundAnvil("anvil", 0.3F, 1.0F);
protected boolean q;
protected int r;
protected boolean s;
protected int t;
protected boolean u;
protected float strength;
protected float durability;
protected boolean cI = true;
protected boolean cJ = true;
protected boolean cK;
protected boolean x = true;
protected boolean y = true;
protected boolean z;
protected boolean isTileEntity;
protected double minX;
protected double minY;
@ -202,42 +39,298 @@ public class Block {
protected double maxY;
protected double maxZ;
public StepSound stepSound;
public float cT;
public final Material material;
public float I;
protected final Material material;
public float frictionFactor;
private String name;
protected Block(int i, Material material) {
this.stepSound = g;
this.cT = 1.0F;
this.frictionFactor = 0.6F;
if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
public static int b(Block block) {
return REGISTRY.b(block);
}
public static Block e(int i) {
return (Block) REGISTRY.a(i);
}
public static Block a(Item item) {
return e(Item.b(item));
}
public static Block b(String s) {
if (REGISTRY.b(s)) {
return (Block) REGISTRY.a(s);
} else {
this.material = material;
byId[i] = this;
this.id = i;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
t[i] = this.c();
lightBlock[i] = this.c() ? 255 : 0;
v[i] = !material.blocksLight();
try {
return (Block) REGISTRY.a(Integer.parseInt(s));
} catch (NumberFormatException numberformatexception) {
return null;
}
}
}
protected void s_() {}
public boolean j() {
return this.q;
}
public int k() {
return this.r;
}
public int m() {
return this.t;
}
public boolean n() {
return this.u;
}
public Material getMaterial() {
return this.material;
}
public MaterialMapColor f(int i) {
return this.getMaterial().r();
}
public static void p() {
REGISTRY.a(0, "air", (new BlockAir()).c("air"));
REGISTRY.a(1, "stone", (new BlockStone()).c(1.5F).b(10.0F).a(i).c("stone").d("stone"));
REGISTRY.a(2, "grass", (new BlockGrass()).c(0.6F).a(h).c("grass").d("grass"));
REGISTRY.a(3, "dirt", (new BlockDirt()).c(0.5F).a(g).c("dirt").d("dirt"));
Block block = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("stonebrick").a(CreativeModeTab.b).d("cobblestone");
REGISTRY.a(4, "cobblestone", block);
Block block1 = (new BlockWood()).c(2.0F).b(5.0F).a(f).c("wood").d("planks");
REGISTRY.a(5, "planks", block1);
REGISTRY.a(6, "sapling", (new BlockSapling()).c(0.0F).a(h).c("sapling").d("sapling"));
REGISTRY.a(7, "bedrock", (new Block(Material.STONE)).s().b(6000000.0F).a(i).c("bedrock").H().a(CreativeModeTab.b).d("bedrock"));
REGISTRY.a(8, "flowing_water", (new BlockFlowing(Material.WATER)).c(100.0F).g(3).c("water").H().d("water_flow"));
REGISTRY.a(9, "water", (new BlockStationary(Material.WATER)).c(100.0F).g(3).c("water").H().d("water_still"));
REGISTRY.a(10, "flowing_lava", (new BlockFlowing(Material.LAVA)).c(100.0F).a(1.0F).c("lava").H().d("lava_flow"));
REGISTRY.a(11, "lava", (new BlockStationary(Material.LAVA)).c(100.0F).a(1.0F).c("lava").H().d("lava_still"));
REGISTRY.a(12, "sand", (new BlockSand()).c(0.5F).a(m).c("sand").d("sand"));
REGISTRY.a(13, "gravel", (new BlockGravel()).c(0.6F).a(g).c("gravel").d("gravel"));
REGISTRY.a(14, "gold_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreGold").d("gold_ore"));
REGISTRY.a(15, "iron_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreIron").d("iron_ore"));
REGISTRY.a(16, "coal_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreCoal").d("coal_ore"));
REGISTRY.a(17, "log", (new BlockLog1()).c("log").d("log"));
REGISTRY.a(18, "leaves", (new BlockLeaves1()).c("leaves").d("leaves"));
REGISTRY.a(19, "sponge", (new BlockSponge()).c(0.6F).a(h).c("sponge").d("sponge"));
REGISTRY.a(20, "glass", (new BlockGlass(Material.SHATTERABLE, false)).c(0.3F).a(k).c("glass").d("glass"));
REGISTRY.a(21, "lapis_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreLapis").d("lapis_ore"));
REGISTRY.a(22, "lapis_block", (new BlockOreBlock(MaterialMapColor.H)).c(3.0F).b(5.0F).a(i).c("blockLapis").a(CreativeModeTab.b).d("lapis_block"));
REGISTRY.a(23, "dispenser", (new BlockDispenser()).c(3.5F).a(i).c("dispenser").d("dispenser"));
Block block2 = (new BlockSandStone()).a(i).c(0.8F).c("sandStone").d("sandstone");
REGISTRY.a(24, "sandstone", block2);
REGISTRY.a(25, "noteblock", (new BlockNote()).c(0.8F).c("musicBlock").d("noteblock"));
REGISTRY.a(26, "bed", (new BlockBed()).c(0.2F).c("bed").H().d("bed"));
REGISTRY.a(27, "golden_rail", (new BlockPoweredRail()).c(0.7F).a(j).c("goldenRail").d("rail_golden"));
REGISTRY.a(28, "detector_rail", (new BlockMinecartDetector()).c(0.7F).a(j).c("detectorRail").d("rail_detector"));
REGISTRY.a(29, "sticky_piston", (new BlockPiston(true)).c("pistonStickyBase"));
REGISTRY.a(30, "web", (new BlockWeb()).g(1).c(4.0F).c("web").d("web"));
REGISTRY.a(31, "tallgrass", (new BlockLongGrass()).c(0.0F).a(h).c("tallgrass"));
REGISTRY.a(32, "deadbush", (new BlockDeadBush()).c(0.0F).a(h).c("deadbush").d("deadbush"));
REGISTRY.a(33, "piston", (new BlockPiston(false)).c("pistonBase"));
REGISTRY.a(34, "piston_head", new BlockPistonExtension());
REGISTRY.a(35, "wool", (new BlockCloth(Material.CLOTH)).c(0.8F).a(l).c("cloth").d("wool_colored"));
REGISTRY.a(36, "piston_extension", new BlockPistonMoving());
REGISTRY.a(37, "yellow_flower", (new BlockFlowers(0)).c(0.0F).a(h).c("flower1").d("flower_dandelion"));
REGISTRY.a(38, "red_flower", (new BlockFlowers(1)).c(0.0F).a(h).c("flower2").d("flower_rose"));
REGISTRY.a(39, "brown_mushroom", (new BlockMushroom()).c(0.0F).a(h).a(0.125F).c("mushroom").d("mushroom_brown"));
REGISTRY.a(40, "red_mushroom", (new BlockMushroom()).c(0.0F).a(h).c("mushroom").d("mushroom_red"));
REGISTRY.a(41, "gold_block", (new BlockOreBlock(MaterialMapColor.F)).c(3.0F).b(10.0F).a(j).c("blockGold").d("gold_block"));
REGISTRY.a(42, "iron_block", (new BlockOreBlock(MaterialMapColor.h)).c(5.0F).b(10.0F).a(j).c("blockIron").d("iron_block"));
REGISTRY.a(43, "double_stone_slab", (new BlockStep(true)).c(2.0F).b(10.0F).a(i).c("stoneSlab"));
REGISTRY.a(44, "stone_slab", (new BlockStep(false)).c(2.0F).b(10.0F).a(i).c("stoneSlab"));
Block block3 = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("brick").a(CreativeModeTab.b).d("brick");
REGISTRY.a(45, "brick_block", block3);
REGISTRY.a(46, "tnt", (new BlockTNT()).c(0.0F).a(h).c("tnt").d("tnt"));
REGISTRY.a(47, "bookshelf", (new BlockBookshelf()).c(1.5F).a(f).c("bookshelf").d("bookshelf"));
REGISTRY.a(48, "mossy_cobblestone", (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("stoneMoss").a(CreativeModeTab.b).d("cobblestone_mossy"));
REGISTRY.a(49, "obsidian", (new BlockObsidian()).c(50.0F).b(2000.0F).a(i).c("obsidian").d("obsidian"));
REGISTRY.a(50, "torch", (new BlockTorch()).c(0.0F).a(0.9375F).a(f).c("torch").d("torch_on"));
REGISTRY.a(51, "fire", (new BlockFire()).c(0.0F).a(1.0F).a(f).c("fire").H().d("fire"));
REGISTRY.a(52, "mob_spawner", (new BlockMobSpawner()).c(5.0F).a(j).c("mobSpawner").H().d("mob_spawner"));
REGISTRY.a(53, "oak_stairs", (new BlockStairs(block1, 0)).c("stairsWood"));
REGISTRY.a(54, "chest", (new BlockChest(0)).c(2.5F).a(f).c("chest"));
REGISTRY.a(55, "redstone_wire", (new BlockRedstoneWire()).c(0.0F).a(e).c("redstoneDust").H().d("redstone_dust"));
REGISTRY.a(56, "diamond_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreDiamond").d("diamond_ore"));
REGISTRY.a(57, "diamond_block", (new BlockOreBlock(MaterialMapColor.G)).c(5.0F).b(10.0F).a(j).c("blockDiamond").d("diamond_block"));
REGISTRY.a(58, "crafting_table", (new BlockWorkbench()).c(2.5F).a(f).c("workbench").d("crafting_table"));
REGISTRY.a(59, "wheat", (new BlockCrops()).c("crops").d("wheat"));
Block block4 = (new BlockSoil()).c(0.6F).a(g).c("farmland").d("farmland");
REGISTRY.a(60, "farmland", block4);
REGISTRY.a(61, "furnace", (new BlockFurnace(false)).c(3.5F).a(i).c("furnace").a(CreativeModeTab.c));
REGISTRY.a(62, "lit_furnace", (new BlockFurnace(true)).c(3.5F).a(i).a(0.875F).c("furnace"));
REGISTRY.a(63, "standing_sign", (new BlockSign(TileEntitySign.class, true)).c(1.0F).a(f).c("sign").H());
REGISTRY.a(64, "wooden_door", (new BlockDoor(Material.WOOD)).c(3.0F).a(f).c("doorWood").H().d("door_wood"));
REGISTRY.a(65, "ladder", (new BlockLadder()).c(0.4F).a(o).c("ladder").d("ladder"));
REGISTRY.a(66, "rail", (new BlockMinecartTrack()).c(0.7F).a(j).c("rail").d("rail_normal"));
REGISTRY.a(67, "stone_stairs", (new BlockStairs(block, 0)).c("stairsStone"));
REGISTRY.a(68, "wall_sign", (new BlockSign(TileEntitySign.class, false)).c(1.0F).a(f).c("sign").H());
REGISTRY.a(69, "lever", (new BlockLever()).c(0.5F).a(f).c("lever").d("lever"));
REGISTRY.a(70, "stone_pressure_plate", (new BlockPressurePlateBinary("stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(i).c("pressurePlate"));
REGISTRY.a(71, "iron_door", (new BlockDoor(Material.ORE)).c(5.0F).a(j).c("doorIron").H().d("door_iron"));
REGISTRY.a(72, "wooden_pressure_plate", (new BlockPressurePlateBinary("planks_oak", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(f).c("pressurePlate"));
REGISTRY.a(73, "redstone_ore", (new BlockRedstoneOre(false)).c(3.0F).b(5.0F).a(i).c("oreRedstone").a(CreativeModeTab.b).d("redstone_ore"));
REGISTRY.a(74, "lit_redstone_ore", (new BlockRedstoneOre(true)).a(0.625F).c(3.0F).b(5.0F).a(i).c("oreRedstone").d("redstone_ore"));
REGISTRY.a(75, "unlit_redstone_torch", (new BlockRedstoneTorch(false)).c(0.0F).a(f).c("notGate").d("redstone_torch_off"));
REGISTRY.a(76, "redstone_torch", (new BlockRedstoneTorch(true)).c(0.0F).a(0.5F).a(f).c("notGate").a(CreativeModeTab.d).d("redstone_torch_on"));
REGISTRY.a(77, "stone_button", (new BlockStoneButton()).c(0.5F).a(i).c("button"));
REGISTRY.a(78, "snow_layer", (new BlockSnow()).c(0.1F).a(n).c("snow").g(0).d("snow"));
REGISTRY.a(79, "ice", (new BlockIce()).c(0.5F).g(3).a(k).c("ice").d("ice"));
REGISTRY.a(80, "snow", (new BlockSnowBlock()).c(0.2F).a(n).c("snow").d("snow"));
REGISTRY.a(81, "cactus", (new BlockCactus()).c(0.4F).a(l).c("cactus").d("cactus"));
REGISTRY.a(82, "clay", (new BlockClay()).c(0.6F).a(g).c("clay").d("clay"));
REGISTRY.a(83, "reeds", (new BlockReed()).c(0.0F).a(h).c("reeds").H().d("reeds"));
REGISTRY.a(84, "jukebox", (new BlockJukeBox()).c(2.0F).b(10.0F).a(i).c("jukebox").d("jukebox"));
REGISTRY.a(85, "fence", (new BlockFence("planks_oak", Material.WOOD)).c(2.0F).b(5.0F).a(f).c("fence"));
Block block5 = (new BlockPumpkin(false)).c(1.0F).a(f).c("pumpkin").d("pumpkin");
REGISTRY.a(86, "pumpkin", block5);
REGISTRY.a(87, "netherrack", (new BlockBloodStone()).c(0.4F).a(i).c("hellrock").d("netherrack"));
REGISTRY.a(88, "soul_sand", (new BlockSlowSand()).c(0.5F).a(m).c("hellsand").d("soul_sand"));
REGISTRY.a(89, "glowstone", (new BlockLightStone(Material.SHATTERABLE)).c(0.3F).a(k).a(1.0F).c("lightgem").d("glowstone"));
REGISTRY.a(90, "portal", (new BlockPortal()).c(-1.0F).a(k).a(0.75F).c("portal").d("portal"));
REGISTRY.a(91, "lit_pumpkin", (new BlockPumpkin(true)).c(1.0F).a(f).a(1.0F).c("litpumpkin").d("pumpkin"));
REGISTRY.a(92, "cake", (new BlockCake()).c(0.5F).a(l).c("cake").H().d("cake"));
REGISTRY.a(93, "unpowered_repeater", (new BlockRepeater(false)).c(0.0F).a(f).c("diode").H().d("repeater_off"));
REGISTRY.a(94, "powered_repeater", (new BlockRepeater(true)).c(0.0F).a(0.625F).a(f).c("diode").H().d("repeater_on"));
REGISTRY.a(95, "stained_glass", (new BlockStainedGlass(Material.SHATTERABLE)).c(0.3F).a(k).c("stainedGlass").d("glass"));
REGISTRY.a(96, "trapdoor", (new BlockTrapdoor(Material.WOOD)).c(3.0F).a(f).c("trapdoor").H().d("trapdoor"));
REGISTRY.a(97, "monster_egg", (new BlockMonsterEggs()).c(0.75F).c("monsterStoneEgg"));
Block block6 = (new BlockSmoothBrick()).c(1.5F).b(10.0F).a(i).c("stonebricksmooth").d("stonebrick");
REGISTRY.a(98, "stonebrick", block6);
REGISTRY.a(99, "brown_mushroom_block", (new BlockHugeMushroom(Material.WOOD, 0)).c(0.2F).a(f).c("mushroom").d("mushroom_block"));
REGISTRY.a(100, "red_mushroom_block", (new BlockHugeMushroom(Material.WOOD, 1)).c(0.2F).a(f).c("mushroom").d("mushroom_block"));
REGISTRY.a(101, "iron_bars", (new BlockThin("iron_bars", "iron_bars", Material.ORE, true)).c(5.0F).b(10.0F).a(j).c("fenceIron"));
REGISTRY.a(102, "glass_pane", (new BlockThin("glass", "glass_pane_top", Material.SHATTERABLE, false)).c(0.3F).a(k).c("thinGlass"));
Block block7 = (new BlockMelon()).c(1.0F).a(f).c("melon").d("melon");
REGISTRY.a(103, "melon_block", block7);
REGISTRY.a(104, "pumpkin_stem", (new BlockStem(block5)).c(0.0F).a(f).c("pumpkinStem").d("pumpkin_stem"));
REGISTRY.a(105, "melon_stem", (new BlockStem(block7)).c(0.0F).a(f).c("pumpkinStem").d("melon_stem"));
REGISTRY.a(106, "vine", (new BlockVine()).c(0.2F).a(h).c("vine").d("vine"));
REGISTRY.a(107, "fence_gate", (new BlockFenceGate()).c(2.0F).b(5.0F).a(f).c("fenceGate"));
REGISTRY.a(108, "brick_stairs", (new BlockStairs(block3, 0)).c("stairsBrick"));
REGISTRY.a(109, "stone_brick_stairs", (new BlockStairs(block6, 0)).c("stairsStoneBrickSmooth"));
REGISTRY.a(110, "mycelium", (new BlockMycel()).c(0.6F).a(h).c("mycel").d("mycelium"));
REGISTRY.a(111, "waterlily", (new BlockWaterLily()).c(0.0F).a(h).c("waterlily").d("waterlily"));
Block block8 = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("netherBrick").a(CreativeModeTab.b).d("nether_brick");
REGISTRY.a(112, "nether_brick", block8);
REGISTRY.a(113, "nether_brick_fence", (new BlockFence("nether_brick", Material.STONE)).c(2.0F).b(10.0F).a(i).c("netherFence"));
REGISTRY.a(114, "nether_brick_stairs", (new BlockStairs(block8, 0)).c("stairsNetherBrick"));
REGISTRY.a(115, "nether_wart", (new BlockNetherWart()).c("netherStalk").d("nether_wart"));
REGISTRY.a(116, "enchanting_table", (new BlockEnchantmentTable()).c(5.0F).b(2000.0F).c("enchantmentTable").d("enchanting_table"));
REGISTRY.a(117, "brewing_stand", (new BlockBrewingStand()).c(0.5F).a(0.125F).c("brewingStand").d("brewing_stand"));
REGISTRY.a(118, "cauldron", (new BlockCauldron()).c(2.0F).c("cauldron").d("cauldron"));
REGISTRY.a(119, "end_portal", (new BlockEnderPortal(Material.PORTAL)).c(-1.0F).b(6000000.0F));
REGISTRY.a(120, "end_portal_frame", (new BlockEnderPortalFrame()).a(k).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c).d("endframe"));
REGISTRY.a(121, "end_stone", (new Block(Material.STONE)).c(3.0F).b(15.0F).a(i).c("whiteStone").a(CreativeModeTab.b).d("end_stone"));
REGISTRY.a(122, "dragon_egg", (new BlockDragonEgg()).c(3.0F).b(15.0F).a(i).a(0.125F).c("dragonEgg").d("dragon_egg"));
REGISTRY.a(123, "redstone_lamp", (new BlockRedstoneLamp(false)).c(0.3F).a(k).c("redstoneLight").a(CreativeModeTab.d).d("redstone_lamp_off"));
REGISTRY.a(124, "lit_redstone_lamp", (new BlockRedstoneLamp(true)).c(0.3F).a(k).c("redstoneLight").d("redstone_lamp_on"));
REGISTRY.a(125, "double_wooden_slab", (new BlockWoodStep(true)).c(2.0F).b(5.0F).a(f).c("woodSlab"));
REGISTRY.a(126, "wooden_slab", (new BlockWoodStep(false)).c(2.0F).b(5.0F).a(f).c("woodSlab"));
REGISTRY.a(127, "cocoa", (new BlockCocoa()).c(0.2F).b(5.0F).a(f).c("cocoa").d("cocoa"));
REGISTRY.a(128, "sandstone_stairs", (new BlockStairs(block2, 0)).c("stairsSandStone"));
REGISTRY.a(129, "emerald_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreEmerald").d("emerald_ore"));
REGISTRY.a(130, "ender_chest", (new BlockEnderChest()).c(22.5F).b(1000.0F).a(i).c("enderChest").a(0.5F));
REGISTRY.a(131, "tripwire_hook", (new BlockTripwireHook()).c("tripWireSource").d("trip_wire_source"));
REGISTRY.a(132, "tripwire", (new BlockTripwire()).c("tripWire").d("trip_wire"));
REGISTRY.a(133, "emerald_block", (new BlockOreBlock(MaterialMapColor.I)).c(5.0F).b(10.0F).a(j).c("blockEmerald").d("emerald_block"));
REGISTRY.a(134, "spruce_stairs", (new BlockStairs(block1, 1)).c("stairsWoodSpruce"));
REGISTRY.a(135, "birch_stairs", (new BlockStairs(block1, 2)).c("stairsWoodBirch"));
REGISTRY.a(136, "jungle_stairs", (new BlockStairs(block1, 3)).c("stairsWoodJungle"));
REGISTRY.a(137, "command_block", (new BlockCommand()).s().b(6000000.0F).c("commandBlock").d("command_block"));
REGISTRY.a(138, "beacon", (new BlockBeacon()).c("beacon").a(1.0F).d("beacon"));
REGISTRY.a(139, "cobblestone_wall", (new BlockCobbleWall(block)).c("cobbleWall"));
REGISTRY.a(140, "flower_pot", (new BlockFlowerPot()).c(0.0F).a(e).c("flowerPot").d("flower_pot"));
REGISTRY.a(141, "carrots", (new BlockCarrots()).c("carrots").d("carrots"));
REGISTRY.a(142, "potatoes", (new BlockPotatoes()).c("potatoes").d("potatoes"));
REGISTRY.a(143, "wooden_button", (new BlockWoodButton()).c(0.5F).a(f).c("button"));
REGISTRY.a(144, "skull", (new BlockSkull()).c(1.0F).a(i).c("skull").d("skull"));
REGISTRY.a(145, "anvil", (new BlockAnvil()).c(5.0F).a(p).b(2000.0F).c("anvil"));
REGISTRY.a(146, "trapped_chest", (new BlockChest(1)).c(2.5F).a(f).c("chestTrap"));
REGISTRY.a(147, "light_weighted_pressure_plate", (new BlockPressurePlateWeighted("gold_block", Material.ORE, 15)).c(0.5F).a(f).c("weightedPlate_light"));
REGISTRY.a(148, "heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted("iron_block", Material.ORE, 150)).c(0.5F).a(f).c("weightedPlate_heavy"));
REGISTRY.a(149, "unpowered_comparator", (new BlockRedstoneComparator(false)).c(0.0F).a(f).c("comparator").H().d("comparator_off"));
REGISTRY.a(150, "powered_comparator", (new BlockRedstoneComparator(true)).c(0.0F).a(0.625F).a(f).c("comparator").H().d("comparator_on"));
REGISTRY.a(151, "daylight_detector", (new BlockDaylightDetector()).c(0.2F).a(f).c("daylightDetector").d("daylight_detector"));
REGISTRY.a(152, "redstone_block", (new BlockRedstone(MaterialMapColor.f)).c(5.0F).b(10.0F).a(j).c("blockRedstone").d("redstone_block"));
REGISTRY.a(153, "quartz_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("netherquartz").d("quartz_ore"));
REGISTRY.a(154, "hopper", (new BlockHopper()).c(3.0F).b(8.0F).a(f).c("hopper").d("hopper"));
Block block9 = (new BlockQuartz()).a(i).c(0.8F).c("quartzBlock").d("quartz_block");
REGISTRY.a(155, "quartz_block", block9);
REGISTRY.a(156, "quartz_stairs", (new BlockStairs(block9, 0)).c("stairsQuartz"));
REGISTRY.a(157, "activator_rail", (new BlockPoweredRail()).c(0.7F).a(j).c("activatorRail").d("rail_activator"));
REGISTRY.a(158, "dropper", (new BlockDropper()).c(3.5F).a(i).c("dropper").d("dropper"));
REGISTRY.a(159, "stained_hardened_clay", (new BlockCloth(Material.STONE)).c(1.25F).b(7.0F).a(i).c("clayHardenedStained").d("hardened_clay_stained"));
REGISTRY.a(160, "stained_glass_pane", (new BlockStainedGlassPane()).c(0.3F).a(k).c("thinStainedGlass").d("glass"));
REGISTRY.a(161, "leaves2", (new BlockLeaves2()).c("leaves").d("leaves"));
REGISTRY.a(162, "log2", (new BlockLog2()).c("log").d("log"));
REGISTRY.a(163, "acacia_stairs", (new BlockStairs(block1, 4)).c("stairsWoodAcacia"));
REGISTRY.a(164, "dark_oak_stairs", (new BlockStairs(block1, 5)).c("stairsWoodDarkOak"));
REGISTRY.a(170, "hay_block", (new BlockHay()).c(0.5F).a(h).c("hayBlock").a(CreativeModeTab.b).d("hay_block"));
REGISTRY.a(171, "carpet", (new BlockCarpet()).c(0.1F).a(l).c("woolCarpet").g(0));
REGISTRY.a(172, "hardened_clay", (new BlockHardenedClay()).c(1.25F).b(7.0F).a(i).c("clayHardened").d("hardened_clay"));
REGISTRY.a(173, "coal_block", (new Block(Material.STONE)).c(5.0F).b(10.0F).a(i).c("blockCoal").a(CreativeModeTab.b).d("coal_block"));
REGISTRY.a(174, "packed_ice", (new BlockPackedIce()).c(0.5F).a(k).c("icePacked").d("ice_packed"));
REGISTRY.a(175, "double_plant", new BlockTallPlant());
Iterator iterator = REGISTRY.iterator();
while (iterator.hasNext()) {
Block block10 = (Block) iterator.next();
if (block10.material == Material.AIR) {
block10.u = false;
} else {
boolean flag = false;
boolean flag1 = block10.b() == 10;
boolean flag2 = block10 instanceof BlockStepAbstract;
boolean flag3 = block10 == block4;
boolean flag4 = block10.s;
boolean flag5 = block10.r == 0;
if (flag1 || flag2 || flag3 || flag4 || flag5) {
flag = true;
}
block10.u = flag;
}
}
}
protected Block(Material material) {
this.stepSound = e;
this.I = 1.0F;
this.frictionFactor = 0.6F;
this.material = material;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
this.q = this.c();
this.r = this.c() ? 255 : 0;
this.s = !material.blocksLight();
}
protected Block a(StepSound stepsound) {
this.stepSound = stepsound;
return this;
}
protected Block k(int i) {
lightBlock[this.id] = i;
protected Block g(int i) {
this.r = i;
return this;
}
protected Block a(float f) {
lightEmission[this.id] = (int) (15.0F * f);
this.t = (int) (15.0F * f);
return this;
}
@ -246,13 +339,11 @@ public class Block {
return this;
}
public static boolean l(int i) {
Block block = byId[i];
return block == null ? false : block.material.k() && block.b() && !block.isPowerSource();
public boolean r() {
return this.material.k() && this.d() && !this.isPowerSource();
}
public boolean b() {
public boolean d() {
return true;
}
@ -260,7 +351,7 @@ public class Block {
return !this.material.isSolid();
}
public int d() {
public int b() {
return 0;
}
@ -273,25 +364,25 @@ public class Block {
return this;
}
protected Block r() {
protected Block s() {
this.c(-1.0F);
return this;
}
public float l(World world, int i, int j, int k) {
public float f(World world, int i, int j, int k) {
return this.strength;
}
protected Block b(boolean flag) {
this.cK = flag;
protected Block a(boolean flag) {
this.z = flag;
return this;
}
public boolean isTicking() {
return this.cK;
return this.z;
}
public boolean t() {
public boolean isTileEntity() {
return this.isTileEntity;
}
@ -304,19 +395,19 @@ public class Block {
this.maxZ = (double) f5;
}
public boolean a_(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return iblockaccess.getMaterial(i, j, k).isBuildable();
public boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return iblockaccess.getType(i, j, k).getMaterial().isBuildable();
}
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
AxisAlignedBB axisalignedbb1 = this.b(world, i, j, k);
AxisAlignedBB axisalignedbb1 = this.a(world, i, j, k);
if (axisalignedbb1 != null && axisalignedbb.b(axisalignedbb1)) {
list.add(axisalignedbb1);
}
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ);
}
@ -325,10 +416,10 @@ public class Block {
}
public boolean a(int i, boolean flag) {
return this.m();
return this.v();
}
public boolean m() {
public boolean v() {
return true;
}
@ -336,7 +427,7 @@ public class Block {
public void postBreak(World world, int i, int j, int k, int l) {}
public void doPhysics(World world, int i, int j, int k, int l) {}
public void doPhysics(World world, int i, int j, int k, Block block) {}
public int a(World world) {
return 10;
@ -344,23 +435,23 @@ public class Block {
public void onPlace(World world, int i, int j, int k) {}
public void remove(World world, int i, int j, int k, int l, int i1) {}
public void remove(World world, int i, int j, int k, Block block, int l) {}
public int a(Random random) {
return 1;
}
public int getDropType(int i, Random random, int j) {
return this.id;
public Item getDropType(int i, Random random, int j) {
return Item.getItemOf(this);
}
public float getDamage(EntityHuman entityhuman, World world, int i, int j, int k) {
float f = this.l(world, i, j, k);
float f = this.f(world, i, j, k);
return f < 0.0F ? 0.0F : (!entityhuman.a(this) ? entityhuman.a(this, false) / f / 100.0F : entityhuman.a(this, true) / f / 30.0F);
}
public final void c(World world, int i, int j, int k, int l, int i1) {
public final void b(World world, int i, int j, int k, int l, int i1) {
this.dropNaturally(world, i, j, k, l, 1.0F, i1);
}
@ -371,17 +462,17 @@ public class Block {
for (int k1 = 0; k1 < j1; ++k1) {
// CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
if (world.random.nextFloat() < f) {
int l1 = this.getDropType(l, world.random, i1);
Item item = this.getDropType(l, world.random, i1);
if (l1 > 0) {
this.b(world, i, j, k, new ItemStack(l1, 1, this.getDropData(l)));
if (item != null) {
this.a(world, i, j, k, new ItemStack(item, 1, this.getDropData(l)));
}
}
}
}
}
protected void b(World world, int i, int j, int k, ItemStack itemstack) {
protected void a(World world, int i, int j, int k, ItemStack itemstack) {
if (!world.isStatic && world.getGameRules().getBoolean("doTileDrops")) {
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
@ -394,7 +485,7 @@ public class Block {
}
}
protected void j(World world, int i, int j, int k, int l) {
protected void dropExperience(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
while (l > 0) {
int i1 = EntityExperienceOrb.getOrbValue(l);
@ -530,9 +621,7 @@ public class Block {
}
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
return l == 0 || byId[l].material.isReplaceable();
return world.getType(i, j, k).material.isReplaceable();
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
@ -551,27 +640,27 @@ public class Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {}
public final double u() {
public final double x() {
return this.minX;
}
public final double v() {
public final double y() {
return this.maxX;
}
public final double w() {
public final double z() {
return this.minY;
}
public final double x() {
public final double A() {
return this.maxY;
}
public final double y() {
public final double B() {
return this.minZ;
}
public final double z() {
public final double C() {
return this.maxZ;
}
@ -592,40 +681,41 @@ public class Block {
public void g() {}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.a(StatisticList.C[b(this)], 1);
entityhuman.a(0.025F);
if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.d_(l);
if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.j(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
this.a(world, i, j, k, itemstack);
}
} else {
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
this.c(world, i, j, k, l, i1);
this.b(world, i, j, k, l, i1);
}
}
protected boolean r_() {
return this.b() && !this.isTileEntity;
protected boolean E() {
return this.d() && !this.isTileEntity;
}
protected ItemStack d_(int i) {
protected ItemStack j(int i) {
int j = 0;
Item item = Item.getItemOf(this);
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].n()) {
if (item != null && item.n()) {
j = i;
}
return new ItemStack(this.id, 1, j);
return new ItemStack(item, 1, j);
}
public int getDropCount(int i, Random random) {
return this.a(random);
}
public boolean f(World world, int i, int j, int k) {
public boolean j(World world, int i, int j, int k) {
return true;
}
@ -646,16 +736,16 @@ public class Block {
return "tile." + this.name;
}
public boolean b(World world, int i, int j, int k, int l, int i1) {
public boolean a(World world, int i, int j, int k, int l, int i1) {
return false;
}
public boolean B() {
return this.cJ;
public boolean G() {
return this.y;
}
protected Block C() {
this.cJ = false;
protected Block H() {
this.y = false;
return this;
}
@ -676,11 +766,11 @@ public class Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
public void l(World world, int i, int j, int k, int l) {}
public void f(World world, int i, int j, int k, int l) {}
public void g(World world, int i, int j, int k) {}
public void l(World world, int i, int j, int k) {}
public boolean l() {
public boolean L() {
return true;
}
@ -688,94 +778,27 @@ public class Block {
return true;
}
public boolean i(int i) {
return this.id == i;
public boolean c(Block block) {
return this == block;
}
public static boolean b(int i, int j) {
return i == j ? true : (i != 0 && j != 0 && byId[i] != null && byId[j] != null ? byId[i].i(j) : false);
public static boolean a(Block block, Block block1) {
return block != null && block1 != null ? (block == block1 ? true : block.c(block1)) : false;
}
public boolean q_() {
public boolean M() {
return false;
}
public int b_(World world, int i, int j, int k, int l) {
public int g(World world, int i, int j, int k, int l) {
return 0;
}
protected Block d(String s) {
this.f = s;
this.d = s;
return this;
}
static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
Item.byId[STAINED_HARDENED_CLAY.id] = (new ItemCloth(STAINED_HARDENED_CLAY.id - 256)).b("clayHardenedStained");
Item.byId[WOOL_CARPET.id] = (new ItemCloth(WOOL_CARPET.id - 256)).b("woolCarpet");
Item.byId[LOG.id] = (new ItemMultiTexture(LOG.id - 256, LOG, BlockLog.b)).b("log");
Item.byId[WOOD.id] = (new ItemMultiTexture(WOOD.id - 256, WOOD, BlockWood.a)).b("wood");
Item.byId[MONSTER_EGGS.id] = (new ItemMultiTexture(MONSTER_EGGS.id - 256, MONSTER_EGGS, BlockMonsterEggs.a)).b("monsterStoneEgg");
Item.byId[SMOOTH_BRICK.id] = (new ItemMultiTexture(SMOOTH_BRICK.id - 256, SMOOTH_BRICK, BlockSmoothBrick.a)).b("stonebricksmooth");
Item.byId[SANDSTONE.id] = (new ItemMultiTexture(SANDSTONE.id - 256, SANDSTONE, BlockSandStone.a)).b("sandStone");
Item.byId[QUARTZ_BLOCK.id] = (new ItemMultiTexture(QUARTZ_BLOCK.id - 256, QUARTZ_BLOCK, BlockQuartz.a)).b("quartzBlock");
Item.byId[STEP.id] = (new ItemStep(STEP.id - 256, STEP, DOUBLE_STEP, false)).b("stoneSlab");
Item.byId[DOUBLE_STEP.id] = (new ItemStep(DOUBLE_STEP.id - 256, STEP, DOUBLE_STEP, true)).b("stoneSlab");
Item.byId[WOOD_STEP.id] = (new ItemStep(WOOD_STEP.id - 256, WOOD_STEP, WOOD_DOUBLE_STEP, false)).b("woodSlab");
Item.byId[WOOD_DOUBLE_STEP.id] = (new ItemStep(WOOD_DOUBLE_STEP.id - 256, WOOD_STEP, WOOD_DOUBLE_STEP, true)).b("woodSlab");
Item.byId[SAPLING.id] = (new ItemMultiTexture(SAPLING.id - 256, SAPLING, BlockSapling.a)).b("sapling");
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).b("leaves");
Item.byId[VINE.id] = new ItemWithAuxData(VINE.id - 256, false);
Item.byId[LONG_GRASS.id] = (new ItemWithAuxData(LONG_GRASS.id - 256, true)).a(new String[] { "shrub", "grass", "fern"});
Item.byId[SNOW.id] = new ItemSnow(SNOW.id - 256, SNOW);
Item.byId[WATER_LILY.id] = new ItemWaterLily(WATER_LILY.id - 256);
Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256);
Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256);
Item.byId[COBBLE_WALL.id] = (new ItemMultiTexture(COBBLE_WALL.id - 256, COBBLE_WALL, BlockCobbleWall.a)).b("cobbleWall");
Item.byId[ANVIL.id] = (new ItemAnvil(ANVIL)).b("anvil");
// CraftBukkit start
Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, true);
Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, true);
Item.byId[MOB_SPAWNER.id] = new ItemWithAuxData(MOB_SPAWNER.id - 256, true);
// CraftBukkit end
for (int i = 0; i < 256; ++i) {
if (byId[i] != null) {
if (Item.byId[i] == null) {
Item.byId[i] = new ItemBlock(i - 256);
byId[i].s_();
}
boolean flag = false;
if (i > 0 && byId[i].d() == 10) {
flag = true;
}
if (i > 0 && byId[i] instanceof BlockStepAbstract) {
flag = true;
}
if (i == SOIL.id) {
flag = true;
}
if (v[i]) {
flag = true;
}
if (lightBlock[i] == 0) {
flag = true;
}
x[i] = flag;
}
}
v[0] = true;
StatisticList.b();
}
// CraftBukkit start
public int getExpDrop(World world, int data, int enchantmentLevel) {
return 0;

Datei anzeigen

@ -4,14 +4,18 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockBloodStone extends Block {
public BlockBloodStone(int i) {
super(i, Material.STONE);
public BlockBloodStone() {
super(Material.STONE);
this.a(CreativeModeTab.b);
}
public MaterialMapColor f(int i) {
return MaterialMapColor.K;
}
// CraftBukkit start
public void doPhysics(World world, int i, int j, int k, int l) {
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
if (net.minecraft.server.Block.e(l) != null && net.minecraft.server.Block.e(l).isPowerSource()) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
int power = block.getBlockPower();

Datei anzeigen

@ -12,14 +12,14 @@ public abstract class BlockButtonAbstract extends Block {
private final boolean a;
protected BlockButtonAbstract(int i, boolean flag) {
super(i, Material.ORIENTABLE);
this.b(true);
protected BlockButtonAbstract(boolean flag) {
super(Material.ORIENTABLE);
this.a(true);
this.a(CreativeModeTab.d);
this.a = flag;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -31,16 +31,16 @@ public abstract class BlockButtonAbstract extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)));
return l == 2 && world.getType(i, j, k + 1).r() ? true : (l == 3 && world.getType(i, j, k - 1).r() ? true : (l == 4 && world.getType(i + 1, j, k).r() ? true : l == 5 && world.getType(i - 1, j, k).r()));
}
public boolean canPlace(World world, int i, int j, int k) {
return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : world.u(i, j, k + 1)));
return world.getType(i - 1, j, k).r() ? true : (world.getType(i + 1, j, k).r() ? true : (world.getType(i, j, k - 1).r() ? true : world.getType(i, j, k + 1).r()));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@ -48,48 +48,48 @@ public abstract class BlockButtonAbstract extends Block {
int k1 = j1 & 8;
j1 &= 7;
if (l == 2 && world.u(i, j, k + 1)) {
if (l == 2 && world.getType(i, j, k + 1).r()) {
j1 = 4;
} else if (l == 3 && world.u(i, j, k - 1)) {
} else if (l == 3 && world.getType(i, j, k - 1).r()) {
j1 = 3;
} else if (l == 4 && world.u(i + 1, j, k)) {
} else if (l == 4 && world.getType(i + 1, j, k).r()) {
j1 = 2;
} else if (l == 5 && world.u(i - 1, j, k)) {
} else if (l == 5 && world.getType(i - 1, j, k).r()) {
j1 = 1;
} else {
j1 = this.k(world, i, j, k);
j1 = this.e(world, i, j, k);
}
return j1 + k1;
}
private int k(World world, int i, int j, int k) {
return world.u(i - 1, j, k) ? 1 : (world.u(i + 1, j, k) ? 2 : (world.u(i, j, k - 1) ? 3 : (world.u(i, j, k + 1) ? 4 : 1)));
private int e(World world, int i, int j, int k) {
return world.getType(i - 1, j, k).r() ? 1 : (world.getType(i + 1, j, k).r() ? 2 : (world.getType(i, j, k - 1).r() ? 3 : (world.getType(i, j, k + 1).r() ? 4 : 1)));
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (this.m(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
int l = world.getData(i, j, k) & 7;
boolean flag = false;
if (!world.u(i - 1, j, k) && i1 == 1) {
if (!world.getType(i - 1, j, k).r() && l == 1) {
flag = true;
}
if (!world.u(i + 1, j, k) && i1 == 2) {
if (!world.getType(i + 1, j, k).r() && l == 2) {
flag = true;
}
if (!world.u(i, j, k - 1) && i1 == 3) {
if (!world.getType(i, j, k - 1).r() && l == 3) {
flag = true;
}
if (!world.u(i, j, k + 1) && i1 == 4) {
if (!world.getType(i, j, k + 1).r() && l == 4) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
@ -97,7 +97,7 @@ public abstract class BlockButtonAbstract extends Block {
private boolean m(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@ -108,10 +108,10 @@ public abstract class BlockButtonAbstract extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
this.d(l);
this.b(l);
}
private void d(int i) {
private void b(int i) {
int j = i & 7;
boolean flag = (i & 8) > 0;
float f = 0.375F;
@ -158,22 +158,22 @@ public abstract class BlockButtonAbstract extends Block {
// CraftBukkit end
world.setData(i, j, k, j1 + k1, 3);
world.g(i, j, k, i, j, k);
world.c(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
this.d(world, i, j, k, j1);
world.a(i, j, k, this.id, this.a(world));
this.a(world, i, j, k, j1);
world.a(i, j, k, this, this.a(world));
return true;
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
if ((i1 & 8) > 0) {
int j1 = i1 & 7;
public void remove(World world, int i, int j, int k, Block block, int l) {
if ((l & 8) > 0) {
int i1 = l & 7;
this.d(world, i, j, k, j1);
this.a(world, i, j, k, i1);
}
super.remove(world, i, j, k, l, i1);
super.remove(world, i, j, k, block, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@ -218,9 +218,9 @@ public abstract class BlockButtonAbstract extends Block {
world.setData(i, j, k, l & 7, 3);
int i1 = l & 7;
this.d(world, i, j, k, i1);
this.a(world, i, j, k, i1);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
world.g(i, j, k, i, j, k);
world.c(i, j, k, i, j, k);
}
}
}
@ -249,7 +249,7 @@ public abstract class BlockButtonAbstract extends Block {
int i1 = l & 7;
boolean flag = (l & 8) != 0;
this.d(l);
this.b(l);
List list = world.a(EntityArrow.class, AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ));
boolean flag1 = !list.isEmpty();
@ -279,35 +279,35 @@ public abstract class BlockButtonAbstract extends Block {
if (flag1 && !flag) {
world.setData(i, j, k, i1 | 8, 3);
this.d(world, i, j, k, i1);
world.g(i, j, k, i, j, k);
this.a(world, i, j, k, i1);
world.c(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
}
if (!flag1 && flag) {
world.setData(i, j, k, i1, 3);
this.d(world, i, j, k, i1);
world.g(i, j, k, i, j, k);
this.a(world, i, j, k, i1);
world.c(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
}
if (flag1) {
world.a(i, j, k, this.id, this.a(world));
world.a(i, j, k, this, this.a(world));
}
}
private void d(World world, int i, int j, int k, int l) {
world.applyPhysics(i, j, k, this.id);
private void a(World world, int i, int j, int k, int l) {
world.applyPhysics(i, j, k, this);
if (l == 1) {
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i - 1, j, k, this);
} else if (l == 2) {
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i + 1, j, k, this);
} else if (l == 3) {
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j, k - 1, this);
} else if (l == 4) {
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k + 1, this);
} else {
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j - 1, k, this);
}
}
}

Datei anzeigen

@ -6,9 +6,9 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent; // CraftBukkit
public class BlockCactus extends Block {
protected BlockCactus(int i) {
super(i, Material.CACTUS);
this.b(true);
protected BlockCactus() {
super(Material.CACTUS);
this.a(true);
this.a(CreativeModeTab.c);
}
@ -16,7 +16,7 @@ public class BlockCactus extends Block {
if (world.isEmpty(i, j + 1, k)) {
int l;
for (l = 1; world.getTypeId(i, j - l, k) == this.id; ++l) {
for (l = 1; world.getType(i, j - l, k) == this; ++l) {
;
}
@ -24,9 +24,9 @@ public class BlockCactus extends Block {
int i1 = world.getData(i, j, k);
if (i1 == 15) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
world.setData(i, j, k, 0, 4);
this.doPhysics(world, i, j + 1, k, this.id);
this.doPhysics(world, i, j + 1, k, this);
} else {
world.setData(i, j, k, i1 + 1, 4);
}
@ -34,13 +34,13 @@ public class BlockCactus extends Block {
}
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
float f = 0.0625F;
return AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f));
}
public boolean b() {
public boolean d() {
return false;
}
@ -48,33 +48,33 @@ public class BlockCactus extends Block {
return false;
}
public int d() {
public int b() {
return 13;
}
public boolean canPlace(World world, int i, int j, int k) {
return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
return !super.canPlace(world, i, j, k) ? false : this.j(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.f(world, i, j, k)) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!this.j(world, i, j, k)) {
world.setAir(i, j, k, true);
}
}
public boolean f(World world, int i, int j, int k) {
if (world.getMaterial(i - 1, j, k).isBuildable()) {
public boolean j(World world, int i, int j, int k) {
if (world.getType(i - 1, j, k).getMaterial().isBuildable()) {
return false;
} else if (world.getMaterial(i + 1, j, k).isBuildable()) {
} else if (world.getType(i + 1, j, k).getMaterial().isBuildable()) {
return false;
} else if (world.getMaterial(i, j, k - 1).isBuildable()) {
} else if (world.getType(i, j, k - 1).getMaterial().isBuildable()) {
return false;
} else if (world.getMaterial(i, j, k + 1).isBuildable()) {
} else if (world.getType(i, j, k + 1).getMaterial().isBuildable()) {
return false;
} else {
int l = world.getTypeId(i, j - 1, k);
Block block = world.getType(i, j - 1, k);
return l == Block.CACTUS.id || l == Block.SAND.id;
return block == Blocks.CACTUS || block == Blocks.SAND;
}
}

Datei anzeigen

@ -4,9 +4,9 @@ import java.util.Random;
public class BlockCake extends Block {
protected BlockCake(int i) {
super(i, Material.CAKE);
this.b(true);
protected BlockCake() {
super(Material.CAKE);
this.a(true);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
@ -25,7 +25,7 @@ public class BlockCake extends Block {
this.a(f, 0.0F, f, 1.0F - f, f1, 1.0F - f);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
float f = 0.0625F;
float f1 = (float) (1 + l * 2) / 16.0F;
@ -34,7 +34,7 @@ public class BlockCake extends Block {
return AxisAlignedBB.a().a((double) ((float) i + f1), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) j + f2 - f), (double) ((float) (k + 1) - f));
}
public boolean b() {
public boolean d() {
return false;
}
@ -55,14 +55,14 @@ public class BlockCake extends Block {
if (entityhuman.g(false)) {
// CraftBukkit start
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, 2 + oldFoodLevel);
if (!event.isCancelled()) {
entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 0.1F);
}
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet8UpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
// CraftBukkit end
int l = world.getData(i, j, k) + 1;
@ -75,24 +75,24 @@ public class BlockCake extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
return !super.canPlace(world, i, j, k) ? false : this.j(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.f(world, i, j, k)) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!this.j(world, i, j, k)) {
world.setAir(i, j, k);
}
}
public boolean f(World world, int i, int j, int k) {
return world.getMaterial(i, j - 1, k).isBuildable();
public boolean j(World world, int i, int j, int k) {
return world.getType(i, j - 1, k).getMaterial().isBuildable();
}
public int a(Random random) {
return 0;
}
public int getDropType(int i, Random random, int j) {
return 0;
public Item getDropType(int i, Random random, int j) {
return null;
}
}

Datei anzeigen

@ -2,45 +2,44 @@ package net.minecraft.server;
import java.util.Random;
public class BlockCocoa extends BlockDirectional {
public class BlockCocoa extends BlockDirectional implements IBlockFragilePlantElement {
public static final String[] a = new String[] { "cocoa_0", "cocoa_1", "cocoa_2"};
public BlockCocoa(int i) {
super(i, Material.PLANT);
this.b(true);
public BlockCocoa() {
super(Material.PLANT);
this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeIdAndData(i, j, k, 0, 0, 2);
if (!this.j(world, i, j, k)) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeAndData(i, j, k, e(0), 0, 2);
} else if (world.random.nextInt(5) == 0) {
int l = world.getData(i, j, k);
int i1 = c(l);
if (i1 < 2) {
++i1;
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, i1 << 2 | j(l)); // CraftBukkit
// CraftBukkit
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, i1 << 2 | l(l));
}
}
}
public boolean f(World world, int i, int j, int k) {
int l = j(world.getData(i, j, k));
public boolean j(World world, int i, int j, int k) {
int l = l(world.getData(i, j, k));
i += Direction.a[l];
k += Direction.b[l];
int i1 = world.getTypeId(i, j, k);
Block block = world.getType(i, j, k);
return i1 == Block.LOG.id && BlockLog.f(world.getData(i, j, k)) == 3;
return block == Blocks.LOG && BlockLogAbstract.c(world.getData(i, j, k)) == 3;
}
public int d() {
public int b() {
return 28;
}
public boolean b() {
public boolean d() {
return false;
}
@ -48,14 +47,14 @@ public class BlockCocoa extends BlockDirectional {
return false;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.b(world, i, j, k);
return super.a(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
int i1 = j(l);
int i1 = l(l);
int j1 = c(l);
int k1 = 4 + j1 * 2;
int l1 = 5 + j1 * 2;
@ -93,10 +92,10 @@ public class BlockCocoa extends BlockDirectional {
return Direction.f[Direction.e[l]];
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeIdAndData(i, j, k, 0, 0, 2);
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!this.j(world, i, j, k)) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeAndData(i, j, k, e(0), 0, 2);
}
}
@ -113,11 +112,31 @@ public class BlockCocoa extends BlockDirectional {
}
for (int k1 = 0; k1 < b0; ++k1) {
this.b(world, i, j, k, new ItemStack(Item.INK_SACK, 1, 3));
this.a(world, i, j, k, new ItemStack(Items.INK_SACK, 1, 3));
}
}
public int getDropData(World world, int i, int j, int k) {
return 3;
}
public boolean a(World world, int i, int j, int k, boolean flag) {
int l = world.getData(i, j, k);
int i1 = c(l);
return i1 < 2;
}
public boolean a(World world, Random random, int i, int j, int k) {
return true;
}
public void b(World world, Random random, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = BlockDirectional.l(l);
int j1 = c(l);
++j1;
world.setData(i, j, k, j1 << 2 | i1, 2);
}
}

Datei anzeigen

@ -6,34 +6,34 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockCommand extends BlockContainer {
public BlockCommand(int i) {
super(i, Material.ORE);
public BlockCommand() {
super(Material.ORE);
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntityCommand();
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
boolean flag = world.isBlockIndirectlyPowered(i, j, k);
int i1 = world.getData(i, j, k);
boolean flag1 = (i1 & 1) != 0;
int l = world.getData(i, j, k);
boolean flag1 = (l & 1) != 0;
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
int old = flag1 ? 15 : 0;
int current = flag ? 15 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
// CraftBukkit end
if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
world.setData(i, j, k, i1 | 1, 4);
world.a(i, j, k, this.id, this.a(world));
world.setData(i, j, k, l | 1, 4);
world.a(i, j, k, this, this.a(world));
} else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
world.setData(i, j, k, i1 & -2, 4);
world.setData(i, j, k, l & -2, 4);
}
}
}
@ -42,10 +42,10 @@ public class BlockCommand extends BlockContainer {
TileEntity tileentity = world.getTileEntity(i, j, k);
if (tileentity != null && tileentity instanceof TileEntityCommand) {
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
CommandBlockListenerAbstract commandblocklistenerabstract = ((TileEntityCommand) tileentity).a();
tileentitycommand.a(tileentitycommand.a(world));
world.m(i, j, k, this.id);
commandblocklistenerabstract.a(world);
world.f(i, j, k, this);
}
}
@ -63,21 +63,21 @@ public class BlockCommand extends BlockContainer {
return true;
}
public boolean q_() {
public boolean M() {
return true;
}
public int b_(World world, int i, int j, int k, int l) {
public int g(World world, int i, int j, int k, int l) {
TileEntity tileentity = world.getTileEntity(i, j, k);
return tileentity != null && tileentity instanceof TileEntityCommand ? ((TileEntityCommand) tileentity).f() : 0;
return tileentity != null && tileentity instanceof TileEntityCommand ? ((TileEntityCommand) tileentity).a().g() : 0;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
TileEntityCommand tileentitycommand = (TileEntityCommand) world.getTileEntity(i, j, k);
if (itemstack.hasName()) {
tileentitycommand.b(itemstack.getName());
tileentitycommand.a().b(itemstack.getName());
}
}

Datei anzeigen

@ -2,22 +2,21 @@ package net.minecraft.server;
import java.util.Random;
public class BlockCrops extends BlockFlower {
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
protected BlockCrops(int i) {
super(i);
this.b(true);
protected BlockCrops() {
this.a(true);
float f = 0.5F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
this.a((CreativeModeTab) null);
this.c(0.0F);
this.a(j);
this.C();
this.a(h);
this.H();
}
protected boolean g_(int i) {
return i == Block.SOIL.id;
protected boolean a(Block block) {
return block == Blocks.SOIL;
}
public void a(World world, int i, int j, int k, Random random) {
@ -26,16 +25,17 @@ public class BlockCrops extends BlockFlower {
int l = world.getData(i, j, k);
if (l < 7) {
float f = this.k(world, i, j, k);
float f = this.n(world, i, j, k);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
++l;
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
}
}
}
}
public void e_(World world, int i, int j, int k) {
public void m(World world, int i, int j, int k) {
int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
if (l > 7) {
@ -45,33 +45,32 @@ public class BlockCrops extends BlockFlower {
world.setData(i, j, k, l, 2);
}
private float k(World world, int i, int j, int k) {
private float n(World world, int i, int j, int k) {
float f = 1.0F;
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
int j1 = world.getTypeId(i - 1, j, k);
int k1 = world.getTypeId(i + 1, j, k);
int l1 = world.getTypeId(i - 1, j, k - 1);
int i2 = world.getTypeId(i + 1, j, k - 1);
int j2 = world.getTypeId(i + 1, j, k + 1);
int k2 = world.getTypeId(i - 1, j, k + 1);
boolean flag = j1 == this.id || k1 == this.id;
boolean flag1 = l == this.id || i1 == this.id;
boolean flag2 = l1 == this.id || i2 == this.id || j2 == this.id || k2 == this.id;
Block block = world.getType(i, j, k - 1);
Block block1 = world.getType(i, j, k + 1);
Block block2 = world.getType(i - 1, j, k);
Block block3 = world.getType(i + 1, j, k);
Block block4 = world.getType(i - 1, j, k - 1);
Block block5 = world.getType(i + 1, j, k - 1);
Block block6 = world.getType(i + 1, j, k + 1);
Block block7 = world.getType(i - 1, j, k + 1);
boolean flag = block2 == this || block3 == this;
boolean flag1 = block == this || block1 == this;
boolean flag2 = block4 == this || block5 == this || block6 == this || block7 == this;
for (int l2 = i - 1; l2 <= i + 1; ++l2) {
for (int i3 = k - 1; i3 <= k + 1; ++i3) {
int j3 = world.getTypeId(l2, j - 1, i3);
for (int l = i - 1; l <= i + 1; ++l) {
for (int i1 = k - 1; i1 <= k + 1; ++i1) {
float f1 = 0.0F;
if (j3 == Block.SOIL.id) {
if (world.getType(l, j - 1, i1) == Blocks.SOIL) {
f1 = 1.0F;
if (world.getData(l2, j - 1, i3) > 0) {
if (world.getData(l, j - 1, i1) > 0) {
f1 = 3.0F;
}
}
if (l2 != i || i3 != k) {
if (l != i || i1 != k) {
f1 /= 4.0F;
}
@ -86,16 +85,16 @@ public class BlockCrops extends BlockFlower {
return f;
}
public int d() {
public int b() {
return 6;
}
protected int j() {
return Item.SEEDS.id;
protected Item i() {
return Items.SEEDS;
}
protected int k() {
return Item.WHEAT.id;
protected Item P() {
return Items.WHEAT;
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
@ -106,18 +105,30 @@ public class BlockCrops extends BlockFlower {
for (int k1 = 0; k1 < j1; ++k1) {
if (world.random.nextInt(15) <= l) {
this.b(world, i, j, k, new ItemStack(this.j(), 1, 0));
this.a(world, i, j, k, new ItemStack(this.i(), 1, 0));
}
}
}
}
}
public int getDropType(int i, Random random, int j) {
return i == 7 ? this.k() : this.j();
public Item getDropType(int i, Random random, int j) {
return i == 7 ? this.P() : this.i();
}
public int a(Random random) {
return 1;
}
public boolean a(World world, int i, int j, int k, boolean flag) {
return world.getData(i, j, k) != 7;
}
public boolean a(World world, Random random, int i, int j, int k) {
return true;
}
public void b(World world, Random random, int i, int j, int k) {
this.m(world, i, j, k);
}
}

Datei anzeigen

@ -6,8 +6,8 @@ public class BlockDaylightDetector extends BlockContainer {
private IIcon[] a = new IIcon[2];
public BlockDaylightDetector(int i) {
super(i, Material.WOOD);
public BlockDaylightDetector() {
super(Material.WOOD);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F);
this.a(CreativeModeTab.d);
}
@ -22,11 +22,11 @@ public class BlockDaylightDetector extends BlockContainer {
public void a(World world, int i, int j, int k, Random random) {}
public void doPhysics(World world, int i, int j, int k, int l) {}
public void doPhysics(World world, int i, int j, int k, Block block) {}
public void onPlace(World world, int i, int j, int k) {}
public void i_(World world, int i, int j, int k) {
public void e(World world, int i, int j, int k) {
if (!world.worldProvider.g) {
int l = world.getData(i, j, k);
int i1 = world.b(EnumSkyBlock.SKY, i, j, k) - world.j;
@ -54,7 +54,7 @@ public class BlockDaylightDetector extends BlockContainer {
}
}
public boolean b() {
public boolean d() {
return false;
}
@ -66,7 +66,7 @@ public class BlockDaylightDetector extends BlockContainer {
return true;
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntityLightDetector();
}
}

Datei anzeigen

@ -8,29 +8,29 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
protected final boolean a;
protected BlockDiodeAbstract(int i, boolean flag) {
super(i, Material.ORIENTABLE);
protected BlockDiodeAbstract(boolean flag) {
super(Material.ORIENTABLE);
this.a = flag;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
public boolean b() {
public boolean d() {
return false;
}
public boolean canPlace(World world, int i, int j, int k) {
return !world.w(i, j - 1, k) ? false : super.canPlace(world, i, j, k);
return !World.a((IBlockAccess) world, i, j - 1, k) ? false : super.canPlace(world, i, j, k);
}
public boolean f(World world, int i, int j, int k) {
return !world.w(i, j - 1, k) ? false : super.f(world, i, j, k);
public boolean j(World world, int i, int j, int k) {
return !World.a((IBlockAccess) world, i, j - 1, k) ? false : super.j(world, i, j, k);
}
public void a(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
if (!this.e((IBlockAccess) world, i, j, k, l)) {
boolean flag = this.d(world, i, j, k, l);
if (!this.g((IBlockAccess) world, i, j, k, l)) { // CraftBukkit - Cast world to IBlockAccess to call the right method.
boolean flag = this.a(world, i, j, k, l);
if (this.a && !flag) {
// CraftBukkit start
@ -39,7 +39,7 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, this.j().id, l, 2);
world.setTypeAndData(i, j, k, this.i(), l, 2);
} else if (!this.a) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
@ -47,15 +47,15 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, this.i().id, l, 2);
world.setTypeAndData(i, j, k, this.e(), l, 2);
if (!flag) {
world.a(i, j, k, this.i().id, this.h(l), -1);
world.a(i, j, k, this.e(), this.k(l), -1);
}
}
}
}
public int d() {
public int b() {
return 36;
}
@ -73,85 +73,85 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
if (!this.c(i1)) {
return 0;
} else {
int j1 = j(i1);
int j1 = l(i1);
return j1 == 0 && l == 3 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 1 && l == 4 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 2 && l == 2 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 3 && l == 5 ? this.d(iblockaccess, i, j, k, i1) : 0)));
return j1 == 0 && l == 3 ? this.f(iblockaccess, i, j, k, i1) : (j1 == 1 && l == 4 ? this.f(iblockaccess, i, j, k, i1) : (j1 == 2 && l == 2 ? this.f(iblockaccess, i, j, k, i1) : (j1 == 3 && l == 5 ? this.f(iblockaccess, i, j, k, i1) : 0)));
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!this.j(world, i, j, k)) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i + 1, j, k, this);
world.applyPhysics(i - 1, j, k, this);
world.applyPhysics(i, j, k + 1, this);
world.applyPhysics(i, j, k - 1, this);
world.applyPhysics(i, j - 1, k, this);
world.applyPhysics(i, j + 1, k, this);
} else {
this.f(world, i, j, k, l);
this.b(world, i, j, k, block);
}
}
protected void f(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
protected void b(World world, int i, int j, int k, Block block) {
int l = world.getData(i, j, k);
if (!this.e((IBlockAccess) world, i, j, k, i1)) {
boolean flag = this.d(world, i, j, k, i1);
if (!this.g((IBlockAccess) world, i, j, k, l)) {
boolean flag = this.a(world, i, j, k, l);
if ((this.a && !flag || !this.a && flag) && !world.a(i, j, k, this.id)) {
if ((this.a && !flag || !this.a && flag) && !world.a(i, j, k, (Block) this)) {
byte b0 = -1;
if (this.h(world, i, j, k, i1)) {
if (this.i(world, i, j, k, l)) {
b0 = -3;
} else if (this.a) {
b0 = -2;
}
world.a(i, j, k, this.id, this.k_(i1), b0);
world.a(i, j, k, this, this.b(l), b0);
}
}
}
public boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
public boolean g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false;
}
protected boolean d(World world, int i, int j, int k, int l) {
return this.e(world, i, j, k, l) > 0;
protected boolean a(World world, int i, int j, int k, int l) {
return this.h(world, i, j, k, l) > 0;
}
protected int e(World world, int i, int j, int k, int l) {
int i1 = j(l);
protected int h(World world, int i, int j, int k, int l) {
int i1 = l(l);
int j1 = i + Direction.a[i1];
int k1 = k + Direction.b[i1];
int l1 = world.getBlockFacePower(j1, j, k1, Direction.d[i1]);
return l1 >= 15 ? l1 : Math.max(l1, world.getTypeId(j1, j, k1) == Block.REDSTONE_WIRE.id ? world.getData(j1, j, k1) : 0);
return l1 >= 15 ? l1 : Math.max(l1, world.getType(j1, j, k1) == Blocks.REDSTONE_WIRE ? world.getData(j1, j, k1) : 0);
}
protected int f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = j(l);
protected int h(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = l(l);
switch (i1) {
case 0:
case 2:
return Math.max(this.g(iblockaccess, i - 1, j, k, 4), this.g(iblockaccess, i + 1, j, k, 5));
return Math.max(this.i(iblockaccess, i - 1, j, k, 4), this.i(iblockaccess, i + 1, j, k, 5));
case 1:
case 3:
return Math.max(this.g(iblockaccess, i, j, k + 1, 3), this.g(iblockaccess, i, j, k - 1, 2));
return Math.max(this.i(iblockaccess, i, j, k + 1, 3), this.i(iblockaccess, i, j, k - 1, 2));
default:
return 0;
}
}
protected int g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getTypeId(i, j, k);
protected int i(IBlockAccess iblockaccess, int i, int j, int k, int l) {
Block block = iblockaccess.getType(i, j, k);
return this.e(i1) ? (i1 == Block.REDSTONE_WIRE.id ? iblockaccess.getData(i, j, k) : iblockaccess.getBlockPower(i, j, k, l)) : 0;
return this.a(block) ? (block == Blocks.REDSTONE_WIRE ? iblockaccess.getData(i, j, k) : iblockaccess.getBlockPower(i, j, k, l)) : 0;
}
public boolean isPowerSource() {
@ -162,49 +162,49 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
world.setData(i, j, k, l, 3);
boolean flag = this.d(world, i, j, k, l);
boolean flag = this.a(world, i, j, k, l);
if (flag) {
world.a(i, j, k, this.id, 1);
world.a(i, j, k, this, 1);
}
}
public void onPlace(World world, int i, int j, int k) {
this.h_(world, i, j, k);
this.e(world, i, j, k);
}
protected void h_(World world, int i, int j, int k) {
int l = j(world.getData(i, j, k));
protected void e(World world, int i, int j, int k) {
int l = l(world.getData(i, j, k));
if (l == 1) {
world.g(i + 1, j, k, this.id);
world.c(i + 1, j, k, this.id, 4);
world.e(i + 1, j, k, this);
world.b(i + 1, j, k, this, 4);
}
if (l == 3) {
world.g(i - 1, j, k, this.id);
world.c(i - 1, j, k, this.id, 5);
world.e(i - 1, j, k, this);
world.b(i - 1, j, k, this, 5);
}
if (l == 2) {
world.g(i, j, k + 1, this.id);
world.c(i, j, k + 1, this.id, 2);
world.e(i, j, k + 1, this);
world.b(i, j, k + 1, this, 2);
}
if (l == 0) {
world.g(i, j, k - 1, this.id);
world.c(i, j, k - 1, this.id, 3);
world.e(i, j, k - 1, this);
world.b(i, j, k - 1, this, 3);
}
}
public void postBreak(World world, int i, int j, int k, int l) {
if (this.a) {
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i + 1, j, k, this);
world.applyPhysics(i - 1, j, k, this);
world.applyPhysics(i, j, k + 1, this);
world.applyPhysics(i, j, k - 1, this);
world.applyPhysics(i, j - 1, k, this);
world.applyPhysics(i, j + 1, k, this);
}
super.postBreak(world, i, j, k, l);
@ -214,30 +214,28 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
return false;
}
protected boolean e(int i) {
Block block = Block.byId[i];
return block != null && block.isPowerSource();
protected boolean a(Block block) {
return block.isPowerSource();
}
protected int d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
protected int f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return 15;
}
public static boolean f(int i) {
return Block.DIODE_OFF.g(i) || Block.REDSTONE_COMPARATOR_OFF.g(i);
public static boolean d(Block block) {
return Blocks.DIODE_OFF.e(block) || Blocks.REDSTONE_COMPARATOR_OFF.e(block);
}
public boolean g(int i) {
return i == this.i().id || i == this.j().id;
public boolean e(Block block) {
return block == this.e() || block == this.i();
}
public boolean h(World world, int i, int j, int k, int l) {
int i1 = j(l);
public boolean i(World world, int i, int j, int k, int l) {
int i1 = l(l);
if (f(world.getTypeId(i - Direction.a[i1], j, k - Direction.b[i1]))) {
if (d(world.getType(i - Direction.a[i1], j, k - Direction.b[i1]))) {
int j1 = world.getData(i - Direction.a[i1], j, k - Direction.b[i1]);
int k1 = j(j1);
int k1 = l(j1);
return k1 != i1;
} else {
@ -245,17 +243,17 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
}
}
protected int h(int i) {
return this.k_(i);
protected int k(int i) {
return this.b(i);
}
protected abstract int k_(int i);
protected abstract int b(int i);
protected abstract BlockDiodeAbstract e();
protected abstract BlockDiodeAbstract i();
protected abstract BlockDiodeAbstract j();
public boolean i(int i) {
return this.g(i);
public boolean c(Block block) {
return this.e(block);
}
}

Datei anzeigen

@ -8,8 +8,8 @@ public class BlockDispenser extends BlockContainer {
protected Random b = new Random();
public static boolean eventFired = false; // CraftBukkit
protected BlockDispenser(int i) {
super(i, Material.STONE);
protected BlockDispenser() {
super(Material.STONE);
this.a(CreativeModeTab.d);
}
@ -19,30 +19,30 @@ public class BlockDispenser extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
this.k(world, i, j, k);
this.m(world, i, j, k);
}
private void k(World world, int i, int j, int k) {
private void m(World world, int i, int j, int k) {
if (!world.isStatic) {
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
int j1 = world.getTypeId(i - 1, j, k);
int k1 = world.getTypeId(i + 1, j, k);
Block block = world.getType(i, j, k - 1);
Block block1 = world.getType(i, j, k + 1);
Block block2 = world.getType(i - 1, j, k);
Block block3 = world.getType(i + 1, j, k);
byte b0 = 3;
if (Block.t[l] && !Block.t[i1]) {
if (block.j() && !block1.j()) {
b0 = 3;
}
if (Block.t[i1] && !Block.t[l]) {
if (block1.j() && !block.j()) {
b0 = 2;
}
if (Block.t[j1] && !Block.t[k1]) {
if (block2.j() && !block3.j()) {
b0 = 5;
}
if (Block.t[k1] && !Block.t[j1]) {
if (block3.j() && !block2.j()) {
b0 = 4;
}
@ -64,13 +64,13 @@ public class BlockDispenser extends BlockContainer {
}
}
// CraftBukkit - private -> public
// CraftBukkit - protected -> public
public void dispense(World world, int i, int j, int k) {
SourceBlock sourceblock = new SourceBlock(world, i, j, k);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
if (tileentitydispenser != null) {
int l = tileentitydispenser.j();
int l = tileentitydispenser.i();
if (l < 0) {
world.triggerEffect(1001, i, j, k, 0);
@ -92,16 +92,16 @@ public class BlockDispenser extends BlockContainer {
return (IDispenseBehavior) a.a(itemstack.getItem());
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
int i1 = world.getData(i, j, k);
boolean flag1 = (i1 & 8) != 0;
int l = world.getData(i, j, k);
boolean flag1 = (l & 8) != 0;
if (flag && !flag1) {
world.a(i, j, k, this.id, this.a(world));
world.setData(i, j, k, i1 | 8, 4);
world.a(i, j, k, this, this.a(world));
world.setData(i, j, k, l | 8, 4);
} else if (!flag && flag1) {
world.setData(i, j, k, i1 & -9, 4);
world.setData(i, j, k, l & -9, 4);
}
}
@ -111,7 +111,7 @@ public class BlockDispenser extends BlockContainer {
}
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntityDispenser();
}
@ -124,12 +124,12 @@ public class BlockDispenser extends BlockContainer {
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
public void remove(World world, int i, int j, int k, Block block, int l) {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
if (tileentitydispenser != null) {
for (int j1 = 0; j1 < tileentitydispenser.getSize(); ++j1) {
ItemStack itemstack = tileentitydispenser.getItem(j1);
for (int i1 = 0; i1 < tileentitydispenser.getSize(); ++i1) {
ItemStack itemstack = tileentitydispenser.getItem(i1);
if (itemstack != null) {
float f = this.b.nextFloat() * 0.8F + 0.1F;
@ -137,14 +137,14 @@ public class BlockDispenser extends BlockContainer {
float f2 = this.b.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
int k1 = this.b.nextInt(21) + 10;
int j1 = this.b.nextInt(21) + 10;
if (k1 > itemstack.count) {
k1 = itemstack.count;
if (j1 > itemstack.count) {
j1 = itemstack.count;
}
itemstack.count -= k1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, k1, itemstack.getData()));
itemstack.count -= j1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
@ -160,14 +160,14 @@ public class BlockDispenser extends BlockContainer {
}
}
world.m(i, j, k, l);
world.f(i, j, k, block);
}
super.remove(world, i, j, k, l, i1);
super.remove(world, i, j, k, block, l);
}
public static IPosition a(ISourceBlock isourceblock) {
EnumFacing enumfacing = l_(isourceblock.h());
EnumFacing enumfacing = b(isourceblock.h());
double d0 = isourceblock.getX() + 0.7D * (double) enumfacing.c();
double d1 = isourceblock.getY() + 0.7D * (double) enumfacing.d();
double d2 = isourceblock.getZ() + 0.7D * (double) enumfacing.e();
@ -175,15 +175,15 @@ public class BlockDispenser extends BlockContainer {
return new Position(d0, d1, d2);
}
public static EnumFacing l_(int i) {
public static EnumFacing b(int i) {
return EnumFacing.a(i & 7);
}
public boolean q_() {
public boolean M() {
return true;
}
public int b_(World world, int i, int j, int k, int l) {
public int g(World world, int i, int j, int k, int l) {
return Container.b((IInventory) world.getTileEntity(i, j, k));
}
}

Datei anzeigen

@ -6,8 +6,8 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockDoor extends Block {
protected BlockDoor(int i, Material material) {
super(i, material);
protected BlockDoor(Material material) {
super(material);
float f = 0.5F;
float f1 = 1.0F;
@ -19,37 +19,37 @@ public class BlockDoor extends Block {
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
int l = this.c_(iblockaccess, i, j, k);
int l = this.g(iblockaccess, i, j, k);
return (l & 4) != 0;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 7;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.b(world, i, j, k);
return super.a(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.d(this.c_(iblockaccess, i, j, k));
this.b(this.g(iblockaccess, i, j, k));
}
public int d(IBlockAccess iblockaccess, int i, int j, int k) {
return this.c_(iblockaccess, i, j, k) & 3;
public int e(IBlockAccess iblockaccess, int i, int j, int k) {
return this.g(iblockaccess, i, j, k) & 3;
}
public boolean b_(IBlockAccess iblockaccess, int i, int j, int k) {
return (this.c_(iblockaccess, i, j, k) & 4) != 0;
public boolean f(IBlockAccess iblockaccess, int i, int j, int k) {
return (this.g(iblockaccess, i, j, k) & 4) != 0;
}
private void d(int i) {
private void b(int i) {
float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
@ -106,16 +106,16 @@ public class BlockDoor extends Block {
if (this.material == Material.ORE) {
return true;
} else {
int i1 = this.c_(world, i, j, k);
int i1 = this.g(world, i, j, k);
int j1 = i1 & 7;
j1 ^= 4;
if ((i1 & 8) == 0) {
world.setData(i, j, k, j1, 2);
world.g(i, j, k, i, j, k);
world.c(i, j, k, i, j, k);
} else {
world.setData(i, j - 1, k, j1, 2);
world.g(i, j - 1, k, i, j, k);
world.c(i, j - 1, k, i, j, k);
}
world.a(entityhuman, 1003, i, j, k, 0);
@ -124,7 +124,7 @@ public class BlockDoor extends Block {
}
public void setDoor(World world, int i, int j, int k, boolean flag) {
int l = this.c_(world, i, j, k);
int l = this.g(world, i, j, k);
boolean flag1 = (l & 4) != 0;
if (flag1 != flag) {
@ -133,52 +133,52 @@ public class BlockDoor extends Block {
i1 ^= 4;
if ((l & 8) == 0) {
world.setData(i, j, k, i1, 2);
world.g(i, j, k, i, j, k);
world.c(i, j, k, i, j, k);
} else {
world.setData(i, j - 1, k, i1, 2);
world.g(i, j - 1, k, i, j, k);
world.c(i, j - 1, k, i, j, k);
}
world.a((EntityHuman) null, 1003, i, j, k, 0);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
public void doPhysics(World world, int i, int j, int k, Block block) {
int l = world.getData(i, j, k);
if ((i1 & 8) == 0) {
if ((l & 8) == 0) {
boolean flag = false;
if (world.getTypeId(i, j + 1, k) != this.id) {
if (world.getType(i, j + 1, k) != this) {
world.setAir(i, j, k);
flag = true;
}
if (!world.w(i, j - 1, k)) {
if (!World.a((IBlockAccess) world, i, j - 1, k)) {
world.setAir(i, j, k);
flag = true;
if (world.getTypeId(i, j + 1, k) == this.id) {
if (world.getType(i, j + 1, k) == this) {
world.setAir(i, j + 1, k);
}
}
if (flag) {
if (!world.isStatic) {
this.c(world, i, j, k, i1, 0);
this.b(world, i, j, k, l, 0);
}
// CraftBukkit start
} else if (l > 0 && Block.byId[l].isPowerSource()) {
} else if (l > 0 && Block.e(l).isPowerSource()) {
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(i, j, k);
org.bukkit.block.Block blockTop = bworld.getBlockAt(i, j + 1, k);
int power = block.getBlockPower();
int power = bukkitBlock.getBlockPower();
int powerTop = blockTop.getBlockPower();
if (powerTop > power) power = powerTop;
int oldPower = (world.getData(i, j, k) & 4) > 0 ? 15 : 0;
if (oldPower == 0 ^ power == 0) {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
this.setDoor(world, i, j, k, eventRedstone.getNewCurrent() > 0);
@ -186,18 +186,18 @@ public class BlockDoor extends Block {
// CraftBukkit end
}
} else {
if (world.getTypeId(i, j - 1, k) != this.id) {
if (world.getType(i, j - 1, k) != this) {
world.setAir(i, j, k);
}
else if (l > 0 && l != this.id) { // CraftBukkit
this.doPhysics(world, i, j - 1, k, l);
if (block != this) {
this.doPhysics(world, i, j - 1, k, block);
}
}
}
public int getDropType(int i, Random random, int j) {
return (i & 8) != 0 ? 0 : (this.material == Material.ORE ? Item.IRON_DOOR.id : Item.WOOD_DOOR.id);
public Item getDropType(int i, Random random, int j) {
return (i & 8) != 0 ? null : (this.material == Material.ORE ? Items.IRON_DOOR : Items.WOOD_DOOR);
}
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
@ -206,14 +206,14 @@ public class BlockDoor extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return j >= 255 ? false : world.w(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
return j >= 255 ? false : World.a((IBlockAccess) world, i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
public int h() {
return 1;
}
public int c_(IBlockAccess iblockaccess, int i, int j, int k) {
public int g(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
boolean flag = (l & 8) != 0;
int i1;
@ -233,7 +233,7 @@ public class BlockDoor extends Block {
}
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild && (l & 8) != 0 && world.getTypeId(i, j - 1, k) == this.id) {
if (entityhuman.abilities.canInstantlyBuild && (l & 8) != 0 && world.getType(i, j - 1, k) == this) {
world.setAir(i, j - 1, k);
}
}

Datei anzeigen

@ -6,41 +6,41 @@ import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
public class BlockDragonEgg extends Block {
public BlockDragonEgg(int i) {
super(i, Material.DRAGON_EGG);
public BlockDragonEgg() {
super(Material.DRAGON_EGG);
this.a(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
}
public void onPlace(World world, int i, int j, int k) {
world.a(i, j, k, this.id, this.a(world));
world.a(i, j, k, this, this.a(world));
}
public void doPhysics(World world, int i, int j, int k, int l) {
world.a(i, j, k, this.id, this.a(world));
public void doPhysics(World world, int i, int j, int k, Block block) {
world.a(i, j, k, this, this.a(world));
}
public void a(World world, int i, int j, int k, Random random) {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
private void k(World world, int i, int j, int k) {
if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
private void e(World world, int i, int j, int k) {
if (BlockFalling.canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
if (!BlockSand.instaFall && world.e(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (!BlockFalling.instaFall && world.b(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
// CraftBukkit - added data
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this, world.getData(i, j, k));
world.addEntity(entityfallingblock);
} else {
world.setAir(i, j, k);
while (BlockSand.canFall(world, i, j - 1, k) && j > 0) {
while (BlockFalling.canFall(world, i, j - 1, k) && j > 0) {
--j;
}
if (j > 0) {
world.setTypeIdAndData(i, j, k, this.id, 0, 2);
world.setTypeAndData(i, j, k, this, 0, 2);
}
}
}
@ -56,13 +56,13 @@ public class BlockDragonEgg extends Block {
}
private void m(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
if (world.getType(i, j, k) == this) {
for (int l = 0; l < 1000; ++l) {
int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
int j1 = j + world.random.nextInt(8) - world.random.nextInt(8);
int k1 = k + world.random.nextInt(16) - world.random.nextInt(16);
if (world.getTypeId(i1, j1, k1) == 0) {
if (world.getType(i1, j1, k1).material == Material.AIR) {
// CraftBukkit start
org.bukkit.block.Block from = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block to = world.getWorld().getBlockAt(i1, j1, k1);
@ -79,7 +79,7 @@ public class BlockDragonEgg extends Block {
// CraftBukkit end
if (!world.isStatic) {
world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k), 2);
world.setTypeAndData(i1, j1, k1, this, world.getData(i, j, k), 2);
world.setAir(i, j, k);
} else {
short short1 = 128;
@ -111,11 +111,11 @@ public class BlockDragonEgg extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 27;
}
}

Datei anzeigen

@ -7,17 +7,15 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent;
public class BlockDropper extends BlockDispenser {
private final IDispenseBehavior cX = new DispenseBehaviorItem();
private final IDispenseBehavior P = new DispenseBehaviorItem();
protected BlockDropper(int i) {
super(i);
}
public BlockDropper() {}
protected IDispenseBehavior a(ItemStack itemstack) {
return this.cX;
return this.P;
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntityDropper();
}
@ -26,7 +24,7 @@ public class BlockDropper extends BlockDispenser {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
if (tileentitydispenser != null) {
int l = tileentitydispenser.j();
int l = tileentitydispenser.i();
if (l < 0) {
world.triggerEffect(1001, i, j, k, 0);
@ -64,7 +62,7 @@ public class BlockDropper extends BlockDispenser {
itemstack1 = itemstack.cloneItemStack();
}
} else {
itemstack1 = this.cX.a(sourceblock, itemstack);
itemstack1 = this.P.a(sourceblock, itemstack);
if (itemstack1 != null && itemstack1.count == 0) {
itemstack1 = null;
}

Datei anzeigen

@ -9,12 +9,12 @@ public class BlockEnderPortal extends BlockContainer {
public static boolean a;
protected BlockEnderPortal(int i, Material material) {
super(i, material);
protected BlockEnderPortal(Material material) {
super(material);
this.a(1.0F);
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntityEnderPortal();
}
@ -30,7 +30,7 @@ public class BlockEnderPortal extends BlockContainer {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
@ -48,7 +48,7 @@ public class BlockEnderPortal extends BlockContainer {
}
}
public int d() {
public int b() {
return -1;
}
@ -59,4 +59,8 @@ public class BlockEnderPortal extends BlockContainer {
}
}
}
public MaterialMapColor f(int i) {
return MaterialMapColor.J;
}
}

Datei anzeigen

@ -13,37 +13,43 @@ public class BlockFire extends Block {
private int[] a = new int[256];
private int[] b = new int[256];
protected BlockFire(int i) {
super(i, Material.FIRE);
this.b(true);
protected BlockFire() {
super(Material.FIRE);
this.a(true);
}
public void s_() {
this.a(Block.WOOD.id, 5, 20);
this.a(Block.WOOD_DOUBLE_STEP.id, 5, 20);
this.a(Block.WOOD_STEP.id, 5, 20);
this.a(Block.FENCE.id, 5, 20);
this.a(Block.WOOD_STAIRS.id, 5, 20);
this.a(Block.BIRCH_WOOD_STAIRS.id, 5, 20);
this.a(Block.SPRUCE_WOOD_STAIRS.id, 5, 20);
this.a(Block.JUNGLE_WOOD_STAIRS.id, 5, 20);
this.a(Block.LOG.id, 5, 5);
this.a(Block.LEAVES.id, 30, 60);
this.a(Block.BOOKSHELF.id, 30, 20);
this.a(Block.TNT.id, 15, 100);
this.a(Block.LONG_GRASS.id, 60, 100);
this.a(Block.WOOL.id, 30, 60);
this.a(Block.VINE.id, 15, 100);
this.a(Block.COAL_BLOCK.id, 5, 5);
this.a(Block.HAY_BLOCK.id, 60, 20);
public static void e() {
Blocks.FIRE.a(b(Blocks.WOOD), 5, 20);
Blocks.FIRE.a(b(Blocks.WOOD_DOUBLE_STEP), 5, 20);
Blocks.FIRE.a(b(Blocks.WOOD_STEP), 5, 20);
Blocks.FIRE.a(b(Blocks.FENCE), 5, 20);
Blocks.FIRE.a(b(Blocks.WOOD_STAIRS), 5, 20);
Blocks.FIRE.a(b(Blocks.BIRCH_WOOD_STAIRS), 5, 20);
Blocks.FIRE.a(b(Blocks.SPRUCE_WOOD_STAIRS), 5, 20);
Blocks.FIRE.a(b(Blocks.JUNGLE_WOOD_STAIRS), 5, 20);
Blocks.FIRE.a(b(Blocks.LOG), 5, 5);
Blocks.FIRE.a(b(Blocks.LOG2), 5, 5);
Blocks.FIRE.a(b(Blocks.LEAVES), 30, 60);
Blocks.FIRE.a(b(Blocks.LEAVES2), 30, 60);
Blocks.FIRE.a(b(Blocks.BOOKSHELF), 30, 20);
Blocks.FIRE.a(b(Blocks.TNT), 15, 100);
Blocks.FIRE.a(b(Blocks.LONG_GRASS), 60, 100);
Blocks.FIRE.a(b(Blocks.DOUBLE_PLANT), 60, 100);
Blocks.FIRE.a(b(Blocks.YELLOW_FLOWER), 60, 100);
Blocks.FIRE.a(b(Blocks.RED_ROSE), 60, 100);
Blocks.FIRE.a(b(Blocks.WOOL), 30, 60);
Blocks.FIRE.a(b(Blocks.VINE), 15, 100);
Blocks.FIRE.a(b(Blocks.COAL_BLOCK), 5, 5);
Blocks.FIRE.a(b(Blocks.HAY_BLOCK), 60, 20);
Blocks.FIRE.a(b(Blocks.WOOL_CARPET), 60, 20);
}
private void a(int i, int j, int k) {
public void a(int i, int j, int k) {
this.a[i] = j;
this.b[i] = k;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -51,11 +57,11 @@ public class BlockFire extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 3;
}
@ -69,9 +75,9 @@ public class BlockFire extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (world.getGameRules().getBoolean("doFireTick")) {
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
boolean flag = world.getType(i, j - 1, k) == Blocks.NETHERRACK;
if (world.worldProvider instanceof WorldProviderTheEnd && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
if (world.worldProvider instanceof WorldProviderTheEnd && world.getType(i, j - 1, k) == Blocks.BEDROCK) {
flag = true;
}
@ -79,7 +85,7 @@ public class BlockFire extends Block {
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
if (!flag && world.Q() && (world.isRainingAt(i, j, k) || world.isRainingAt(i - 1, j, k) || world.isRainingAt(i + 1, j, k) || world.isRainingAt(i, j, k - 1) || world.isRainingAt(i, j, k + 1))) {
if (!flag && world.P() && (world.isRainingAt(i, j, k) || world.isRainingAt(i - 1, j, k) || world.isRainingAt(i + 1, j, k) || world.isRainingAt(i, j, k - 1) || world.isRainingAt(i, j, k + 1))) {
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
} else {
int l = world.getData(i, j, k);
@ -88,15 +94,15 @@ public class BlockFire extends Block {
world.setData(i, j, k, l + random.nextInt(3) / 2, 4);
}
world.a(i, j, k, this.id, this.a(world) + random.nextInt(10));
if (!flag && !this.k(world, i, j, k)) {
if (!world.w(i, j - 1, k) || l > 3) {
world.a(i, j, k, this, this.a(world) + random.nextInt(10));
if (!flag && !this.e(world, i, j, k)) {
if (!World.a((IBlockAccess) world, i, j - 1, k) || l > 3) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out of inflammable block
}
} else if (!flag && !this.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
} else if (!flag && !this.e((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
} else {
boolean flag1 = world.G(i, j, k);
boolean flag1 = world.z(i, j, k);
byte b0 = 0;
if (flag1) {
@ -123,13 +129,13 @@ public class BlockFire extends Block {
int i2 = this.m(world, i1, k1, j1);
if (i2 > 0) {
int j2 = (i2 + 40 + world.difficulty * 7) / (l + 30);
int j2 = (i2 + 40 + world.difficulty.a() * 7) / (l + 30);
if (flag1) {
j2 /= 2;
}
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.Q() || !world.isRainingAt(i1, k1, j1)) && !world.isRainingAt(i1 - 1, k1, k) && !world.isRainingAt(i1 + 1, k1, j1) && !world.isRainingAt(i1, k1, j1 - 1) && !world.isRainingAt(i1, k1, j1 + 1)) {
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.P() || !world.isRainingAt(i1, k1, j1)) && !world.isRainingAt(i1 - 1, k1, k) && !world.isRainingAt(i1 + 1, k1, j1) && !world.isRainingAt(i1, k1, j1 - 1) && !world.isRainingAt(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) {
@ -137,7 +143,7 @@ public class BlockFire extends Block {
}
// CraftBukkit start - Call to stop spread of fire
if (world.getTypeId(i1, k1, j1) != Block.FIRE.id) {
if (world.getType(i1, k1, j1) != Blocks.FIRE) {
if (CraftEventFactory.callBlockIgniteEvent(world, i1, k1, j1, i, j, k).isCancelled()) {
continue;
}
@ -145,8 +151,8 @@ public class BlockFire extends Block {
org.bukkit.Server server = world.getServer();
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
blockState.setTypeId(this.id);
blockState.setData(new org.bukkit.material.MaterialData(this.id, (byte) k2));
blockState.setTypeId(Block.b(this));
blockState.setData(new org.bukkit.material.MaterialData(Block.b(this), (byte) k2));
BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
server.getPluginManager().callEvent(spreadEvent);
@ -167,15 +173,15 @@ public class BlockFire extends Block {
}
}
public boolean l() {
public boolean L() {
return false;
}
private void a(World world, int i, int j, int k, int l, Random random, int i1) {
int j1 = this.b[world.getTypeId(i, j, k)];
int j1 = this.b[Block.b(world.getType(i, j, k))];
if (random.nextInt(l) < j1) {
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
boolean flag = world.getType(i, j, k) == Blocks.TNT;
// CraftBukkit start
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);
@ -195,19 +201,19 @@ public class BlockFire extends Block {
k1 = 15;
}
world.setTypeIdAndData(i, j, k, this.id, k1, 3);
world.setTypeAndData(i, j, k, this, k1, 3);
} else {
world.setAir(i, j, k);
}
if (flag) {
Block.TNT.postBreak(world, i, j, k, 1);
Blocks.TNT.postBreak(world, i, j, k, 1);
}
}
}
private boolean k(World world, int i, int j, int k) {
return this.d((IBlockAccess) world, i + 1, j, k) ? true : (this.d((IBlockAccess) world, i - 1, j, k) ? true : (this.d((IBlockAccess) world, i, j - 1, k) ? true : (this.d((IBlockAccess) world, i, j + 1, k) ? true : (this.d((IBlockAccess) world, i, j, k - 1) ? true : this.d((IBlockAccess) world, i, j, k + 1)))));
private boolean e(World world, int i, int j, int k) {
return this.e((IBlockAccess) world, i + 1, j, k) ? true : (this.e((IBlockAccess) world, i - 1, j, k) ? true : (this.e((IBlockAccess) world, i, j - 1, k) ? true : (this.e((IBlockAccess) world, i, j + 1, k) ? true : (this.e((IBlockAccess) world, i, j, k - 1) ? true : this.e((IBlockAccess) world, i, j, k + 1)))));
}
private int m(World world, int i, int j, int k) {
@ -216,54 +222,58 @@ public class BlockFire extends Block {
if (!world.isEmpty(i, j, k)) {
return 0;
} else {
int l = this.d(world, i + 1, j, k, b0);
int l = this.a(world, i + 1, j, k, b0);
l = this.d(world, i - 1, j, k, l);
l = this.d(world, i, j - 1, k, l);
l = this.d(world, i, j + 1, k, l);
l = this.d(world, i, j, k - 1, l);
l = this.d(world, i, j, k + 1, l);
l = this.a(world, i - 1, j, k, l);
l = this.a(world, i, j - 1, k, l);
l = this.a(world, i, j + 1, k, l);
l = this.a(world, i, j, k - 1, l);
l = this.a(world, i, j, k + 1, l);
return l;
}
}
public boolean m() {
public boolean v() {
return false;
}
public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
public boolean e(IBlockAccess iblockaccess, int i, int j, int k) {
return this.a[Block.b(iblockaccess.getType(i, j, k))] > 0;
}
public int d(World world, int i, int j, int k, int l) {
int i1 = this.a[world.getTypeId(i, j, k)];
public int a(World world, int i, int j, int k, int l) {
int i1 = this.a[Block.b(world.getType(i, j, k))];
return i1 > l ? i1 : l;
}
public boolean canPlace(World world, int i, int j, int k) {
return world.w(i, j - 1, k) || this.k(world, i, j, k);
return World.a((IBlockAccess) world, i, j - 1, k) || this.e(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!World.a((IBlockAccess) world, i, j - 1, k) && !this.e(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone
}
}
public void onPlace(World world, int i, int j, int k) {
if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.o_(world, i, j, k)) {
if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
if (world.worldProvider.dimension > 0 || !Blocks.PORTAL.e(world, i, j, k)) {
if (!World.a((IBlockAccess) world, i, j - 1, k) && !this.e(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
} else {
world.a(i, j, k, this.id, this.a(world) + world.random.nextInt(10));
world.a(i, j, k, this, this.a(world) + world.random.nextInt(10));
}
}
}
public MaterialMapColor f(int i) {
return MaterialMapColor.f;
}
// CraftBukkit start
private void fireExtinguished(World world, int x, int y, int z) {
if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled()) {
if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), Blocks.AIR).isCancelled()) {
world.setAir(x, y, z);
}
}

Datei anzeigen

@ -11,20 +11,16 @@ public class BlockFlowing extends BlockFluids {
int a;
boolean[] b = new boolean[4];
int[] c = new int[4];
int[] M = new int[4];
protected BlockFlowing(int i, Material material) {
super(i, material);
protected BlockFlowing(Material material) {
super(material);
}
private void k(World world, int i, int j, int k) {
private void n(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
world.setTypeIdAndData(i, j, k, this.id + 1, l, 2);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
world.setTypeAndData(i, j, k, Block.e(Block.b((Block) this) + 1), l, 2);
}
public void a(World world, int i, int j, int k, Random random) {
@ -34,7 +30,7 @@ public class BlockFlowing extends BlockFluids {
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
// CraftBukkit end
int l = this.l_(world, i, j, k);
int l = this.e(world, i, j, k);
byte b0 = 1;
if (this.material == Material.LAVA && !world.worldProvider.f) {
@ -49,18 +45,18 @@ public class BlockFlowing extends BlockFluids {
byte b1 = -100;
this.a = 0;
int k1 = this.d(world, i - 1, j, k, b1);
int k1 = this.a(world, i - 1, j, k, b1);
k1 = this.d(world, i + 1, j, k, k1);
k1 = this.d(world, i, j, k - 1, k1);
k1 = this.d(world, i, j, k + 1, k1);
k1 = this.a(world, i + 1, j, k, k1);
k1 = this.a(world, i, j, k - 1, k1);
k1 = this.a(world, i, j, k + 1, k1);
j1 = k1 + b0;
if (j1 >= 8 || k1 < 0) {
j1 = -1;
}
if (this.l_(world, i, j + 1, k) >= 0) {
int l1 = this.l_(world, i, j + 1, k);
if (this.e(world, i, j + 1, k) >= 0) {
int l1 = this.e(world, i, j + 1, k);
if (l1 >= 8) {
j1 = l1;
@ -70,9 +66,9 @@ public class BlockFlowing extends BlockFluids {
}
if (this.a >= 2 && this.material == Material.WATER) {
if (world.getMaterial(i, j - 1, k).isBuildable()) {
if (world.getType(i, j - 1, k).getMaterial().isBuildable()) {
j1 = 0;
} else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j - 1, k) == 0) {
} else if (world.getType(i, j - 1, k).getMaterial() == this.material && world.getData(i, j - 1, k) == 0) {
j1 = 0;
}
}
@ -83,7 +79,7 @@ public class BlockFlowing extends BlockFluids {
if (j1 == l) {
if (flag) {
this.k(world, i, j, k);
this.n(world, i, j, k);
}
} else {
l = j1;
@ -91,15 +87,15 @@ public class BlockFlowing extends BlockFluids {
world.setAir(i, j, k);
} else {
world.setData(i, j, k, j1, 2);
world.a(i, j, k, this.id, i1);
world.applyPhysics(i, j, k, this.id);
world.a(i, j, k, this, i1);
world.applyPhysics(i, j, k, this);
}
}
} else {
this.k(world, i, j, k);
this.n(world, i, j, k);
}
if (this.o(world, i, j - 1, k)) {
if (this.q(world, i, j - 1, k)) {
// CraftBukkit start - Send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
if (server != null) {
@ -107,8 +103,8 @@ public class BlockFlowing extends BlockFluids {
}
if (!event.isCancelled()) {
if (this.material == Material.LAVA && world.getMaterial(i, j - 1, k) == Material.WATER) {
world.setTypeIdUpdate(i, j - 1, k, Block.STONE.id);
if (this.material == Material.LAVA && world.getType(i, j - 1, k).getMaterial() == Material.WATER) {
world.setTypeUpdate(i, j - 1, k, Blocks.STONE);
this.fizz(world, i, j - 1, k);
return;
}
@ -120,8 +116,8 @@ public class BlockFlowing extends BlockFluids {
}
}
// CraftBukkit end
} else if (l >= 0 && (l == 0 || this.n(world, i, j - 1, k))) {
boolean[] aboolean = this.m(world, i, j, k);
} else if (l >= 0 && (l == 0 || this.p(world, i, j - 1, k))) {
boolean[] aboolean = this.o(world, i, j, k);
j1 = l + b0;
if (l >= 8) {
@ -155,22 +151,20 @@ public class BlockFlowing extends BlockFluids {
}
private void flow(World world, int i, int j, int k, int l) {
if (this.o(world, i, j, k)) {
int i1 = world.getTypeId(i, j, k);
if (this.q(world, i, j, k)) {
Block block = world.getType(i, j, k);
if (i1 > 0) {
if (this.material == Material.LAVA) {
this.fizz(world, i, j, k);
} else {
Block.byId[i1].c(world, i, j, k, world.getData(i, j, k), 0);
}
if (this.material == Material.LAVA) {
this.fizz(world, i, j, k);
} else {
block.b(world, i, j, k, world.getData(i, j, k), 0);
}
world.setTypeIdAndData(i, j, k, this.id, l, 3);
world.setTypeAndData(i, j, k, this, l, 3);
}
}
private int d(World world, int i, int j, int k, int l, int i1) {
private int c(World world, int i, int j, int k, int l, int i1) {
int j1 = 1000;
for (int k1 = 0; k1 < 4; ++k1) {
@ -194,13 +188,13 @@ public class BlockFlowing extends BlockFluids {
++i2;
}
if (!this.n(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
if (!this.n(world, l1, j - 1, i2)) {
if (!this.p(world, l1, j, i2) && (world.getType(l1, j, i2).getMaterial() != this.material || world.getData(l1, j, i2) != 0)) {
if (!this.p(world, l1, j - 1, i2)) {
return l;
}
if (l < 4) {
int j2 = this.d(world, l1, j, i2, l + 1, k1);
int j2 = this.c(world, l1, j, i2, l + 1, k1);
if (j2 < j1) {
j1 = j2;
@ -213,12 +207,12 @@ public class BlockFlowing extends BlockFluids {
return j1;
}
private boolean[] m(World world, int i, int j, int k) {
private boolean[] o(World world, int i, int j, int k) {
int l;
int i1;
for (l = 0; l < 4; ++l) {
this.c[l] = 1000;
this.M[l] = 1000;
i1 = i;
int j1 = k;
@ -238,48 +232,38 @@ public class BlockFlowing extends BlockFluids {
++j1;
}
if (!this.n(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
if (this.n(world, i1, j - 1, j1)) {
this.c[l] = this.d(world, i1, j, j1, 1, l);
if (!this.p(world, i1, j, j1) && (world.getType(i1, j, j1).getMaterial() != this.material || world.getData(i1, j, j1) != 0)) {
if (this.p(world, i1, j - 1, j1)) {
this.M[l] = this.c(world, i1, j, j1, 1, l);
} else {
this.c[l] = 0;
this.M[l] = 0;
}
}
}
l = this.c[0];
l = this.M[0];
for (i1 = 1; i1 < 4; ++i1) {
if (this.c[i1] < l) {
l = this.c[i1];
if (this.M[i1] < l) {
l = this.M[i1];
}
}
for (i1 = 0; i1 < 4; ++i1) {
this.b[i1] = this.c[i1] == l;
this.b[i1] = this.M[i1] == l;
}
return this.b;
}
private boolean n(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
private boolean p(World world, int i, int j, int k) {
Block block = world.getType(i, j, k);
if (l != Block.WOODEN_DOOR.id && l != Block.IRON_DOOR_BLOCK.id && l != Block.SIGN_POST.id && l != Block.LADDER.id && l != Block.SUGAR_CANE_BLOCK.id) {
if (l == 0) {
return false;
} else {
Material material = Block.byId[l].material;
return material == Material.PORTAL ? true : material.isSolid();
}
} else {
return true;
}
return block != Blocks.WOODEN_DOOR && block != Blocks.IRON_DOOR_BLOCK && block != Blocks.SIGN_POST && block != Blocks.LADDER && block != Blocks.SUGAR_CANE_BLOCK ? (block.material == Material.PORTAL ? true : block.material.isSolid()) : true;
}
protected int d(World world, int i, int j, int k, int l) {
int i1 = this.l_(world, i, j, k);
protected int a(World world, int i, int j, int k, int l) {
int i1 = this.e(world, i, j, k);
if (i1 < 0) {
return l;
@ -296,20 +280,20 @@ public class BlockFlowing extends BlockFluids {
}
}
private boolean o(World world, int i, int j, int k) {
Material material = world.getMaterial(i, j, k);
private boolean q(World world, int i, int j, int k) {
Material material = world.getType(i, j, k).getMaterial();
return material == this.material ? false : (material == Material.LAVA ? false : !this.n(world, i, j, k));
return material == this.material ? false : (material == Material.LAVA ? false : !this.p(world, i, j, k));
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (world.getTypeId(i, j, k) == this.id) {
world.a(i, j, k, this.id, this.a(world));
if (world.getType(i, j, k) == this) {
world.a(i, j, k, this, this.a(world));
}
}
public boolean l() {
public boolean L() {
return true;
}
}

Datei anzeigen

@ -2,27 +2,32 @@ package net.minecraft.server;
import java.util.Random;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// CraftBukkit start
import org.bukkit.block.BlockState;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.BlockFadeEvent;
// CraftBukkit end
public class BlockGrass extends Block {
public class BlockGrass extends Block implements IBlockFragilePlantElement {
protected BlockGrass(int i) {
super(i, Material.GRASS);
this.b(true);
private static final Logger a = LogManager.getLogger();
protected BlockGrass() {
super(Material.GRASS);
this.a(true);
this.a(CreativeModeTab.b);
}
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
if (world.getLightLevel(i, j + 1, k) < 4 && world.getType(i, j + 1, k).k() > 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i, j, k).getState();
blockState.setTypeId(Block.DIRT.id);
blockState.setTypeId(Block.b(Blocks.DIRT));
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
@ -36,13 +41,13 @@ public class BlockGrass extends Block {
int i1 = i + random.nextInt(3) - 1;
int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1;
int l1 = world.getTypeId(i1, j1 + 1, k1);
Block block = world.getType(i1, j1 + 1, k1);
if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.lightBlock[l1] <= 2) {
if (world.getType(i1, j1, k1) == Blocks.DIRT && world.getData(i1, j1, k1) == 0 && world.getLightLevel(i1, j1 + 1, k1) >= 4 && block.k() <= 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(Block.GRASS.id);
blockState.setTypeId(Block.b(Blocks.GRASS));
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
@ -57,7 +62,58 @@ public class BlockGrass extends Block {
}
}
public int getDropType(int i, Random random, int j) {
return Block.DIRT.getDropType(0, random, j);
public Item getDropType(int i, Random random, int j) {
return Blocks.DIRT.getDropType(0, random, j);
}
public boolean a(World world, int i, int j, int k, boolean flag) {
return true;
}
public boolean a(World world, Random random, int i, int j, int k) {
return true;
}
public void b(World world, Random random, int i, int j, int k) {
int l = 0;
while (l < 128) {
int i1 = i;
int j1 = j + 1;
int k1 = k;
int l1 = 0;
while (true) {
if (l1 < l / 16) {
i1 += random.nextInt(3) - 1;
j1 += (random.nextInt(3) - 1) * random.nextInt(3) / 2;
k1 += random.nextInt(3) - 1;
if (world.getType(i1, j1 - 1, k1) == Blocks.GRASS && !world.getType(i1, j1, k1).r()) {
++l1;
continue;
}
} else if (world.getType(i1, j1, k1).material == Material.AIR) {
if (random.nextInt(8) != 0) {
if (Blocks.LONG_GRASS.j(world, i1, j1, k1)) {
world.setTypeAndData(i1, j1, k1, Blocks.LONG_GRASS, 1, 3);
}
} else {
String s = world.getBiome(i1, k1).a(random, i1, j1, k1);
a.debug("Flower in " + world.getBiome(i1, k1).af + ": " + s);
BlockFlowers blockflowers = BlockFlowers.e(s);
if (blockflowers != null && blockflowers.j(world, i1, j1, k1)) {
int i2 = BlockFlowers.f(s);
world.setTypeAndData(i1, j1, k1, blockflowers, i2, 3);
}
}
}
++l;
break;
}
}
}
}

Datei anzeigen

@ -7,8 +7,8 @@ public class BlockHopper extends BlockContainer {
private final Random a = new Random();
public BlockHopper(int i) {
super(i, Material.ORE);
public BlockHopper() {
super(Material.ORE);
this.a(CreativeModeTab.d);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@ -43,14 +43,14 @@ public class BlockHopper extends BlockContainer {
return j1;
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntityHopper();
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
super.postPlace(world, i, j, k, entityliving, itemstack);
if (itemstack.hasName()) {
TileEntityHopper tileentityhopper = d(world, i, j, k);
TileEntityHopper tileentityhopper = e((IBlockAccess) world, i, j, k);
tileentityhopper.a(itemstack.getName());
}
@ -58,14 +58,14 @@ public class BlockHopper extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
this.k(world, i, j, k);
this.e(world, i, j, k);
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
} else {
TileEntityHopper tileentityhopper = d(world, i, j, k);
TileEntityHopper tileentityhopper = e((IBlockAccess) world, i, j, k);
if (tileentityhopper != null) {
entityhuman.openHopper(tileentityhopper);
@ -75,27 +75,27 @@ public class BlockHopper extends BlockContainer {
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
this.k(world, i, j, k);
public void doPhysics(World world, int i, int j, int k, Block block) {
this.e(world, i, j, k);
}
private void k(World world, int i, int j, int k) {
private void e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = c(l);
int i1 = b(l);
boolean flag = !world.isBlockIndirectlyPowered(i, j, k);
boolean flag1 = d(l);
boolean flag1 = c(l);
if (flag != flag1) {
world.setData(i, j, k, i1 | (flag ? 0 : 8), 4);
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
public void remove(World world, int i, int j, int k, Block block, int l) {
TileEntityHopper tileentityhopper = (TileEntityHopper) world.getTileEntity(i, j, k);
if (tileentityhopper != null) {
for (int j1 = 0; j1 < tileentityhopper.getSize(); ++j1) {
ItemStack itemstack = tileentityhopper.getItem(j1);
for (int i1 = 0; i1 < tileentityhopper.getSize(); ++i1) {
ItemStack itemstack = tileentityhopper.getItem(i1);
if (itemstack != null) {
float f = this.a.nextFloat() * 0.8F + 0.1F;
@ -103,14 +103,14 @@ public class BlockHopper extends BlockContainer {
float f2 = this.a.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
int k1 = this.a.nextInt(21) + 10;
int j1 = this.a.nextInt(21) + 10;
if (k1 > itemstack.count) {
k1 = itemstack.count;
if (j1 > itemstack.count) {
j1 = itemstack.count;
}
itemstack.count -= k1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, k1, itemstack.getData()));
itemstack.count -= j1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
@ -126,17 +126,17 @@ public class BlockHopper extends BlockContainer {
}
}
world.m(i, j, k, l);
world.f(i, j, k, block);
}
super.remove(world, i, j, k, l, i1);
super.remove(world, i, j, k, block, l);
}
public int d() {
public int b() {
return 38;
}
public boolean b() {
public boolean d() {
return false;
}
@ -144,23 +144,23 @@ public class BlockHopper extends BlockContainer {
return false;
}
public static int c(int i) {
public static int b(int i) {
return Math.min(i & 7, 5); // CraftBukkit - Fix AIOOBE in callers
}
public static boolean d(int i) {
public static boolean c(int i) {
return (i & 8) != 8;
}
public boolean q_() {
public boolean M() {
return true;
}
public int b_(World world, int i, int j, int k, int l) {
return Container.b((IInventory) d(world, i, j, k));
public int g(World world, int i, int j, int k, int l) {
return Container.b((IInventory) e((IBlockAccess) world, i, j, k));
}
public static TileEntityHopper d(IBlockAccess iblockaccess, int i, int j, int k) {
public static TileEntityHopper e(IBlockAccess iblockaccess, int i, int j, int k) {
return (TileEntityHopper) iblockaccess.getTileEntity(i, j, k);
}
}

Datei anzeigen

@ -2,23 +2,23 @@ package net.minecraft.server;
import java.util.Random;
public class BlockIce extends BlockHalfTransparant {
public class BlockIce extends BlockHalfTransparent {
public BlockIce(int i) {
super(i, "ice", Material.ICE, false);
public BlockIce() {
super("ice", Material.ICE, false);
this.frictionFactor = 0.98F;
this.b(true);
this.a(true);
this.a(CreativeModeTab.b);
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
entityhuman.a(0.025F);
if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.d_(l);
if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.j(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
this.a(world, i, j, k, itemstack);
}
} else {
if (world.worldProvider.f) {
@ -28,11 +28,11 @@ public class BlockIce extends BlockHalfTransparant {
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
this.c(world, i, j, k, l, i1);
Material material = world.getMaterial(i, j - 1, k);
this.b(world, i, j, k, l, i1);
Material material = world.getType(i, j - 1, k).getMaterial();
if (material.isSolid() || material.isLiquid()) {
world.setTypeIdUpdate(i, j, k, Block.WATER.id);
world.setTypeUpdate(i, j, k, Blocks.WATER);
}
}
}
@ -42,9 +42,9 @@ public class BlockIce extends BlockHalfTransparant {
}
public void a(World world, int i, int j, int k, Random random) {
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - this.k()) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Blocks.STATIONARY_WATER).isCancelled()) {
return;
}
// CraftBukkit end
@ -54,8 +54,8 @@ public class BlockIce extends BlockHalfTransparant {
return;
}
this.c(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeIdUpdate(i, j, k, Block.STATIONARY_WATER.id);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeUpdate(i, j, k, Blocks.STATIONARY_WATER);
}
}

Datei anzeigen

@ -4,33 +4,32 @@ import java.util.Random;
import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
public class BlockLeaves extends BlockTransparant {
public abstract class BlockLeaves extends BlockTransparent {
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
public static final String[][] b = new String[][] { { "leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, { "leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}};
private IIcon[][] cX = new IIcon[2][];
int[] c;
int[] a;
protected IIcon[][] M = new IIcon[2][];
protected BlockLeaves(int i) {
super(i, Material.LEAVES, false);
this.b(true);
public BlockLeaves() {
super(Material.LEAVES, false);
this.a(true);
this.a(CreativeModeTab.c);
this.c(0.2F);
this.g(1);
this.a(h);
}
public void remove(World world, int i, int j, int k, int l, int i1) {
public void remove(World world, int i, int j, int k, Block block, int l) {
byte b0 = 1;
int j1 = b0 + 1;
int i1 = b0 + 1;
if (world.e(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
for (int k1 = -b0; k1 <= b0; ++k1) {
for (int l1 = -b0; l1 <= b0; ++l1) {
for (int i2 = -b0; i2 <= b0; ++i2) {
int j2 = world.getTypeId(i + k1, j + l1, k + i2);
if (world.b(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
for (int j1 = -b0; j1 <= b0; ++j1) {
for (int k1 = -b0; k1 <= b0; ++k1) {
for (int l1 = -b0; l1 <= b0; ++l1) {
if (world.getType(i + j1, j + k1, k + l1).getMaterial() == Material.LEAVES) {
int i2 = world.getData(i + j1, j + k1, k + l1);
if (j2 == Block.LEAVES.id) {
int k2 = world.getData(i + k1, j + l1, k + i2);
world.setData(i + k1, j + l1, k + i2, k2 | 8, 4);
world.setData(i + j1, j + k1, k + l1, i2 | 8, 4);
}
}
}
@ -49,27 +48,29 @@ public class BlockLeaves extends BlockTransparant {
int j1 = b1 * b1;
int k1 = b1 / 2;
if (this.c == null) {
this.c = new int[b1 * b1 * b1];
if (this.a == null) {
this.a = new int[b1 * b1 * b1];
}
int l1;
if (world.e(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
if (world.b(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
int i2;
int j2;
int k2;
for (l1 = -b0; l1 <= b0; ++l1) {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
k2 = world.getTypeId(i + l1, j + i2, k + j2);
if (k2 == Block.LOG.id) {
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
} else if (k2 == Block.LEAVES.id) {
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
Block block = world.getType(i + l1, j + i2, k + j2);
if (block != Blocks.LOG && block != Blocks.LOG2) {
if (block.getMaterial() == Material.LEAVES) {
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
} else {
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
}
} else {
this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
}
}
}
@ -78,30 +79,30 @@ public class BlockLeaves extends BlockTransparant {
for (l1 = 1; l1 <= 4; ++l1) {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
for (k2 = -b0; k2 <= b0; ++k2) {
if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
if (this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
for (int k2 = -b0; k2 <= b0; ++k2) {
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
if (this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
if (this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
}
if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
}
}
}
@ -110,17 +111,17 @@ public class BlockLeaves extends BlockTransparant {
}
}
l1 = this.c[k1 * j1 + k1 * b1 + k1];
l1 = this.a[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) {
world.setData(i, j, k, l & -9, 4);
} else {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
}
}
}
private void k(World world, int i, int j, int k) {
private void e(World world, int i, int j, int k) {
// CraftBukkit start
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent(event);
@ -130,7 +131,7 @@ public class BlockLeaves extends BlockTransparant {
}
// CraftBukkit end
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
@ -138,17 +139,13 @@ public class BlockLeaves extends BlockTransparant {
return random.nextInt(20) == 0 ? 1 : 0;
}
public int getDropType(int i, Random random, int j) {
return Block.SAPLING.id;
public Item getDropType(int i, Random random, int j) {
return Item.getItemOf(Blocks.SAPLING);
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) {
int j1 = 20;
if ((l & 3) == 3) {
j1 = 40;
}
int j1 = this.b(l);
if (i1 > 0) {
j1 -= 2 << i1;
@ -158,9 +155,9 @@ public class BlockLeaves extends BlockTransparant {
}
if (world.random.nextInt(j1) == 0) {
int k1 = this.getDropType(l, world.random, i1);
Item item = this.getDropType(l, world.random, i1);
this.b(world, i, j, k, new ItemStack(k1, 1, this.getDropData(l)));
this.a(world, i, j, k, new ItemStack(item, 1, this.getDropData(l)));
}
j1 = 200;
@ -171,16 +168,20 @@ public class BlockLeaves extends BlockTransparant {
}
}
if ((l & 3) == 0 && world.random.nextInt(j1) == 0) {
this.b(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
}
this.c(world, i, j, k, l, j1);
}
}
protected void c(World world, int i, int j, int k, int l, int i1) {}
protected int b(int i) {
return 20;
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.by() != null && entityhuman.by().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
if (!world.isStatic && entityhuman.bD() != null && entityhuman.bD().getItem() == Items.SHEARS) {
entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
this.a(world, i, j, k, new ItemStack(Item.getItemOf(this), 1, l & 3));
} else {
super.a(world, entityhuman, i, j, k, l);
}
@ -191,10 +192,12 @@ public class BlockLeaves extends BlockTransparant {
}
public boolean c() {
return !this.d;
return !this.P;
}
protected ItemStack d_(int i) {
return new ItemStack(this.id, 1, i & 3);
protected ItemStack j(int i) {
return new ItemStack(Item.getItemOf(this), 1, i & 3);
}
public abstract String[] e();
}

Datei anzeigen

@ -4,12 +4,12 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockLever extends Block {
protected BlockLever(int i) {
super(i, Material.ORIENTABLE);
protected BlockLever() {
super(Material.ORIENTABLE);
this.a(CreativeModeTab.d);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -17,20 +17,20 @@ public class BlockLever extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 12;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 0 && world.u(i, j + 1, k) ? true : (l == 1 && world.w(i, j - 1, k) ? true : (l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)))));
return l == 0 && world.getType(i, j + 1, k).r() ? true : (l == 1 && World.a((IBlockAccess) world, i, j - 1, k) ? true : (l == 2 && world.getType(i, j, k + 1).r() ? true : (l == 3 && world.getType(i, j, k - 1).r() ? true : (l == 4 && world.getType(i + 1, j, k).r() ? true : l == 5 && world.getType(i - 1, j, k).r()))));
}
public boolean canPlace(World world, int i, int j, int k) {
return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : (world.u(i, j, k + 1) ? true : (world.w(i, j - 1, k) ? true : world.u(i, j + 1, k)))));
return world.getType(i - 1, j, k).r() ? true : (world.getType(i + 1, j, k).r() ? true : (world.getType(i, j, k - 1).r() ? true : (world.getType(i, j, k + 1).r() ? true : (World.a((IBlockAccess) world, i, j - 1, k) ? true : world.getType(i, j + 1, k).r()))));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@ -38,27 +38,27 @@ public class BlockLever extends Block {
int k1 = i1 & 7;
byte b0 = -1;
if (l == 0 && world.u(i, j + 1, k)) {
if (l == 0 && world.getType(i, j + 1, k).r()) {
b0 = 0;
}
if (l == 1 && world.w(i, j - 1, k)) {
if (l == 1 && World.a((IBlockAccess) world, i, j - 1, k)) {
b0 = 5;
}
if (l == 2 && world.u(i, j, k + 1)) {
if (l == 2 && world.getType(i, j, k + 1).r()) {
b0 = 4;
}
if (l == 3 && world.u(i, j, k - 1)) {
if (l == 3 && world.getType(i, j, k - 1).r()) {
b0 = 3;
}
if (l == 4 && world.u(i + 1, j, k)) {
if (l == 4 && world.getType(i + 1, j, k).r()) {
b0 = 2;
}
if (l == 5 && world.u(i - 1, j, k)) {
if (l == 5 && world.getType(i - 1, j, k).r()) {
b0 = 1;
}
@ -70,13 +70,13 @@ public class BlockLever extends Block {
int i1 = l & 7;
int j1 = l & 8;
if (i1 == d(1)) {
if (i1 == b(1)) {
if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
world.setData(i, j, k, 5 | j1, 2);
} else {
world.setData(i, j, k, 6 | j1, 2);
}
} else if (i1 == d(0)) {
} else if (i1 == b(0)) {
if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
world.setData(i, j, k, 7 | j1, 2);
} else {
@ -85,7 +85,7 @@ public class BlockLever extends Block {
}
}
public static int d(int i) {
public static int b(int i) {
switch (i) {
case 0:
return 0;
@ -110,53 +110,53 @@ public class BlockLever extends Block {
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (this.k(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
public void doPhysics(World world, int i, int j, int k, Block block) {
if (this.e(world, i, j, k)) {
int l = world.getData(i, j, k) & 7;
boolean flag = false;
if (!world.u(i - 1, j, k) && i1 == 1) {
if (!world.getType(i - 1, j, k).r() && l == 1) {
flag = true;
}
if (!world.u(i + 1, j, k) && i1 == 2) {
if (!world.getType(i + 1, j, k).r() && l == 2) {
flag = true;
}
if (!world.u(i, j, k - 1) && i1 == 3) {
if (!world.getType(i, j, k - 1).r() && l == 3) {
flag = true;
}
if (!world.u(i, j, k + 1) && i1 == 4) {
if (!world.getType(i, j, k + 1).r() && l == 4) {
flag = true;
}
if (!world.w(i, j - 1, k) && i1 == 5) {
if (!World.a((IBlockAccess) world, i, j - 1, k) && l == 5) {
flag = true;
}
if (!world.w(i, j - 1, k) && i1 == 6) {
if (!World.a((IBlockAccess) world, i, j - 1, k) && l == 6) {
flag = true;
}
if (!world.u(i, j + 1, k) && i1 == 0) {
if (!world.getType(i, j + 1, k).r() && l == 0) {
flag = true;
}
if (!world.u(i, j + 1, k) && i1 == 7) {
if (!world.getType(i, j + 1, k).r() && l == 7) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
}
private boolean k(World world, int i, int j, int k) {
private boolean e(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@ -210,50 +210,50 @@ public class BlockLever extends Block {
world.setData(i, j, k, j1 + k1, 3);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j, k, this);
if (j1 == 1) {
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i - 1, j, k, this);
} else if (j1 == 2) {
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i + 1, j, k, this);
} else if (j1 == 3) {
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j, k - 1, this);
} else if (j1 == 4) {
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k + 1, this);
} else if (j1 != 5 && j1 != 6) {
if (j1 == 0 || j1 == 7) {
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j + 1, k, this);
}
} else {
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j - 1, k, this);
}
return true;
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
if ((i1 & 8) > 0) {
world.applyPhysics(i, j, k, this.id);
int j1 = i1 & 7;
public void remove(World world, int i, int j, int k, Block block, int l) {
if ((l & 8) > 0) {
world.applyPhysics(i, j, k, this);
int i1 = l & 7;
if (j1 == 1) {
world.applyPhysics(i - 1, j, k, this.id);
} else if (j1 == 2) {
world.applyPhysics(i + 1, j, k, this.id);
} else if (j1 == 3) {
world.applyPhysics(i, j, k - 1, this.id);
} else if (j1 == 4) {
world.applyPhysics(i, j, k + 1, this.id);
} else if (j1 != 5 && j1 != 6) {
if (j1 == 0 || j1 == 7) {
world.applyPhysics(i, j + 1, k, this.id);
if (i1 == 1) {
world.applyPhysics(i - 1, j, k, this);
} else if (i1 == 2) {
world.applyPhysics(i + 1, j, k, this);
} else if (i1 == 3) {
world.applyPhysics(i, j, k - 1, this);
} else if (i1 == 4) {
world.applyPhysics(i, j, k + 1, this);
} else if (i1 != 5 && i1 != 6) {
if (i1 == 0 || i1 == 7) {
world.applyPhysics(i, j + 1, k, this);
}
} else {
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j - 1, k, this);
}
}
super.remove(world, i, j, k, l, i1);
super.remove(world, i, j, k, block, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {

Datei anzeigen

@ -7,9 +7,9 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public BlockMinecartDetector(int i) {
super(i, true);
this.b(true);
public BlockMinecartDetector() {
super(true);
this.a(true);
}
public int a(World world) {
@ -25,7 +25,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
int l = world.getData(i, j, k);
if ((l & 8) == 0) {
this.d(world, i, j, k, l);
this.a(world, i, j, k, l);
}
}
}
@ -35,7 +35,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
int l = world.getData(i, j, k);
if ((l & 8) != 0) {
this.d(world, i, j, k, l);
this.a(world, i, j, k, l);
}
}
}
@ -48,7 +48,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
return (iblockaccess.getData(i, j, k) & 8) == 0 ? 0 : (l == 1 ? 15 : 0);
}
private void d(World world, int i, int j, int k, int l) {
private void a(World world, int i, int j, int k, int l) {
boolean flag = (l & 8) != 0;
boolean flag1 = false;
float f = 0.125F;
@ -71,41 +71,47 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
if (flag1 && !flag) {
world.setData(i, j, k, l | 8, 3);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.g(i, j, k, i, j, k);
world.applyPhysics(i, j, k, this);
world.applyPhysics(i, j - 1, k, this);
world.c(i, j, k, i, j, k);
}
if (!flag1 && flag) {
world.setData(i, j, k, l & 7, 3);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.g(i, j, k, i, j, k);
world.applyPhysics(i, j, k, this);
world.applyPhysics(i, j - 1, k, this);
world.c(i, j, k, i, j, k);
}
if (flag1) {
world.a(i, j, k, this.id, this.a(world));
world.a(i, j, k, this, this.a(world));
}
world.m(i, j, k, this.id);
world.f(i, j, k, this);
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
this.d(world, i, j, k, world.getData(i, j, k));
this.a(world, i, j, k, world.getData(i, j, k));
}
public boolean q_() {
public boolean M() {
return true;
}
public int b_(World world, int i, int j, int k, int l) {
public int g(World world, int i, int j, int k, int l) {
if ((world.getData(i, j, k) & 8) > 0) {
float f = 0.125F;
List list = world.a(EntityMinecartAbstract.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)), IEntitySelector.b);
List list = world.a(EntityMinecartCommandBlock.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
if (list.size() > 0) {
return Container.b((IInventory) list.get(0));
return ((EntityMinecartCommandBlock) list.get(0)).e().g();
}
List list1 = world.a(EntityMinecartAbstract.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)), IEntitySelector.b);
if (list1.size() > 0) {
return Container.b((IInventory) list1.get(0));
}
}

Datei anzeigen

@ -4,16 +4,16 @@ import java.util.Random;
public class BlockMobSpawner extends BlockContainer {
protected BlockMobSpawner(int i) {
super(i, Material.STONE);
protected BlockMobSpawner() {
super(Material.STONE);
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntityMobSpawner();
}
public int getDropType(int i, Random random, int j) {
return 0;
public Item getDropType(int i, Random random, int j) {
return null;
}
public int a(Random random) {
@ -25,7 +25,7 @@ public class BlockMobSpawner extends BlockContainer {
/* CraftBukkit start - Delegate to getExpDrop
int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15);
this.j(world, i, j, k, j1);*/
this.dropExperience(world, i, j, k, j1)*/
}
public int getExpDrop(World world, int data, int enchantmentLevel) {

Datei anzeigen

@ -12,14 +12,13 @@ import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.world.StructureGrowEvent;
// CraftBukkit end
public class BlockMushroom extends BlockFlower {
public class BlockMushroom extends BlockPlant implements IBlockFragilePlantElement {
protected BlockMushroom(int i) {
super(i);
protected BlockMushroom() {
float f = 0.2F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
this.b(true);
this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
@ -35,7 +34,7 @@ public class BlockMushroom extends BlockFlower {
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
if (world.getTypeId(i1, k1, j1) == this.id) {
if (world.getType(i1, k1, j1) == this) {
--l;
if (l <= 0) {
return;
@ -50,7 +49,7 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
@ -61,11 +60,11 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
}
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
if (world.isEmpty(i1, j1, k1) && this.j(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id); // nms: this.id, 0, 2
blockState.setTypeId(Block.b(this)); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
@ -79,18 +78,18 @@ public class BlockMushroom extends BlockFlower {
}
public boolean canPlace(World world, int i, int j, int k) {
return super.canPlace(world, i, j, k) && this.f(world, i, j, k);
return super.canPlace(world, i, j, k) && this.j(world, i, j, k);
}
protected boolean g_(int i) {
return Block.t[i];
protected boolean a(Block block) {
return block.j();
}
public boolean f(World world, int i, int j, int k) {
public boolean j(World world, int i, int j, int k) {
if (j >= 0 && j < 256) {
int l = world.getTypeId(i, j - 1, k);
Block block = world.getType(i, j - 1, k);
return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.g_(l);
return block == Blocks.MYCEL || block == Blocks.DIRT && world.getData(i, j - 1, k) == 2 || world.j(i, j, k) < 13 && this.a(block);
} else {
return false;
}
@ -107,25 +106,37 @@ public class BlockMushroom extends BlockFlower {
Location location = new Location(world.getWorld(), i, j, k);
WorldGenHugeMushroom worldgenhugemushroom = null;
if (this.id == Block.BROWN_MUSHROOM.id) {
if (this == Blocks.BROWN_MUSHROOM) {
event = new StructureGrowEvent(location, TreeType.BROWN_MUSHROOM, bonemeal, player, new ArrayList<BlockState>());
worldgenhugemushroom = new WorldGenHugeMushroom(0);
} else if (this.id == Block.RED_MUSHROOM.id) {
} else if (this == Blocks.RED_MUSHROOM) {
event = new StructureGrowEvent(location, TreeType.RED_MUSHROOM, bonemeal, player, new ArrayList<BlockState>());
worldgenhugemushroom = new WorldGenHugeMushroom(1);
}
if (worldgenhugemushroom != null && event != null) {
grown = worldgenhugemushroom.grow((org.bukkit.BlockChangeDelegate)world, random, i, j, k, event, itemstack, world.getWorld());
grown = worldgenhugemushroom.grow(new org.bukkit.craftbukkit.CraftBlockChangeDelegate((org.bukkit.BlockChangeDelegate) world), random, i, j, k, event, itemstack, world.getWorld());
if (event.isFromBonemeal() && itemstack != null) {
--itemstack.count;
}
}
if (!grown || event.isCancelled()) {
world.setTypeIdAndData(i, j, k, this.id, l, 3);
world.setTypeAndData(i, j, k, this, l, 3);
return false;
}
return true;
// CraftBukkit end
}
public boolean a(World world, int i, int j, int k, boolean flag) {
return true;
}
public boolean a(World world, Random random, int i, int j, int k) {
return (double) random.nextFloat() < 0.4D;
}
public void b(World world, Random random, int i, int j, int k) {
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - Add bonemeal, player, and itemstack
}
}

Datei anzeigen

@ -10,19 +10,19 @@ import org.bukkit.event.block.BlockSpreadEvent;
public class BlockMycel extends Block {
protected BlockMycel(int i) {
super(i, Material.GRASS);
this.b(true);
protected BlockMycel() {
super(Material.GRASS);
this.a(true);
this.a(CreativeModeTab.b);
}
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
if (world.getLightLevel(i, j + 1, k) < 4 && world.getType(i, j + 1, k).k() > 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i, j, k).getState();
blockState.setTypeId(Block.DIRT.id);
blockState.setTypeId(Block.b(Blocks.DIRT));
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
@ -36,13 +36,13 @@ public class BlockMycel extends Block {
int i1 = i + random.nextInt(3) - 1;
int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1;
int l1 = world.getTypeId(i1, j1 + 1, k1);
Block block = world.getType(i1, j1 + 1, k1);
if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.lightBlock[l1] <= 2) {
if (world.getType(i1, j1, k1) == Blocks.DIRT && world.getData(i1, j1, k1) == 0 && world.getLightLevel(i1, j1 + 1, k1) >= 4 && block.k() <= 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id);
blockState.setTypeId(Block.b(this));
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
@ -57,7 +57,7 @@ public class BlockMycel extends Block {
}
}
public int getDropType(int i, Random random, int j) {
return Block.DIRT.getDropType(0, random, j);
public Item getDropType(int i, Random random, int j) {
return Blocks.DIRT.getDropType(0, random, j);
}
}

Datei anzeigen

@ -2,36 +2,36 @@ package net.minecraft.server;
import java.util.Random;
public class BlockNetherWart extends BlockFlower {
public class BlockNetherWart extends BlockPlant {
protected BlockNetherWart(int i) {
super(i);
this.b(true);
protected BlockNetherWart() {
this.a(true);
float f = 0.5F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
this.a((CreativeModeTab) null);
}
protected boolean g_(int i) {
return i == Block.SOUL_SAND.id;
protected boolean a(Block block) {
return block == Blocks.SOUL_SAND;
}
public boolean f(World world, int i, int j, int k) {
return this.g_(world.getTypeId(i, j - 1, k));
public boolean j(World world, int i, int j, int k) {
return this.a(world.getType(i, j - 1, k));
}
public void a(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
if (l < 3 && random.nextInt(10) == 0) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
++l;
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
}
super.a(world, i, j, k, random);
}
public int d() {
public int b() {
return 6;
}
@ -47,13 +47,13 @@ public class BlockNetherWart extends BlockFlower {
}
for (int k1 = 0; k1 < j1; ++k1) {
this.b(world, i, j, k, new ItemStack(Item.NETHER_STALK));
this.a(world, i, j, k, new ItemStack(Items.NETHER_STALK));
}
}
}
public int getDropType(int i, Random random, int j) {
return 0;
public Item getDropType(int i, Random random, int j) {
return null;
}
public int a(Random random) {

Datei anzeigen

@ -4,21 +4,21 @@ import java.util.Random;
public class BlockOre extends Block {
public BlockOre(int i) {
super(i, Material.STONE);
public BlockOre() {
super(Material.STONE);
this.a(CreativeModeTab.b);
}
public int getDropType(int i, Random random, int j) {
return this.id == Block.COAL_ORE.id ? Item.COAL.id : (this.id == Block.DIAMOND_ORE.id ? Item.DIAMOND.id : (this.id == Block.LAPIS_ORE.id ? Item.INK_SACK.id : (this.id == Block.EMERALD_ORE.id ? Item.EMERALD.id : (this.id == Block.QUARTZ_ORE.id ? Item.QUARTZ.id : this.id))));
public Item getDropType(int i, Random random, int j) {
return this == Blocks.COAL_ORE ? Items.COAL : (this == Blocks.DIAMOND_ORE ? Items.DIAMOND : (this == Blocks.LAPIS_ORE ? Items.INK_SACK : (this == Blocks.EMERALD_ORE ? Items.EMERALD : (this == Blocks.QUARTZ_ORE ? Items.QUARTZ : Item.getItemOf(this)))));
}
public int a(Random random) {
return this.id == Block.LAPIS_ORE.id ? 4 + random.nextInt(5) : 1;
return this == Blocks.LAPIS_ORE ? 4 + random.nextInt(5) : 1;
}
public int getDropCount(int i, Random random) {
if (i > 0 && this.id != this.getDropType(0, random, i)) {
if (i > 0 && Item.getItemOf(this) != this.getDropType(0, random, i)) {
int j = random.nextInt(i + 2) - 1;
if (j < 0) {
@ -34,38 +34,39 @@ public class BlockOre extends Block {
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
super.dropNaturally(world, i, j, k, l, f, i1);
/* CraftBukkit start - Delegated to getExpDrop
if (this.getDropType(l, world.random, i1) != this.id) {
if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 0;
if (this.id == Block.COAL_ORE.id) {
if (this == Blocks.COAL_ORE) {
j1 = MathHelper.nextInt(world.random, 0, 2);
} else if (this.id == Block.DIAMOND_ORE.id) {
} else if (this == Blocks.DIAMOND_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.EMERALD_ORE.id) {
} else if (this == Blocks.EMERALD_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.LAPIS_ORE.id) {
} else if (this == Blocks.LAPIS_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
} else if (this.id == Block.QUARTZ_ORE.id) {
} else if (this == Blocks.QUARTZ_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
}
this.j(world, i, j, k, j1);
} */
this.dropExperience(world, i, j, k, j1);
}
// */
}
public int getExpDrop(World world, int l, int i1) {
if (this.getDropType(l, world.random, i1) != this.id) {
if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 0;
if (this.id == Block.COAL_ORE.id) {
if (this == Blocks.COAL_ORE) {
j1 = MathHelper.nextInt(world.random, 0, 2);
} else if (this.id == Block.DIAMOND_ORE.id) {
} else if (this == Blocks.DIAMOND_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.EMERALD_ORE.id) {
} else if (this == Blocks.EMERALD_ORE) {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.LAPIS_ORE.id) {
} else if (this == Blocks.LAPIS_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
} else if (this.id == Block.QUARTZ_ORE.id) {
} else if (this == Blocks.QUARTZ_ORE) {
j1 = MathHelper.nextInt(world.random, 2, 5);
}
@ -77,6 +78,6 @@ public class BlockOre extends Block {
}
public int getDropData(int i) {
return this.id == Block.LAPIS_ORE.id ? 4 : 0;
return this == Blocks.LAPIS_ORE ? 4 : 0;
}
}

Datei anzeigen

@ -12,15 +12,15 @@ public class BlockPiston extends Block {
private final boolean a;
public BlockPiston(int i, boolean flag) {
super(i, Material.PISTON);
public BlockPiston(boolean flag) {
super(Material.PISTON);
this.a = flag;
this.a(k);
this.a(i);
this.c(0.5F);
this.a(CreativeModeTab.d);
}
public int d() {
public int b() {
return 16;
}
@ -37,32 +37,32 @@ public class BlockPiston extends Block {
world.setData(i, j, k, l, 2);
if (!world.isStatic) {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
}
public void onPlace(World world, int i, int j, int k) {
if (!world.isStatic && world.getTileEntity(i, j, k) == null) {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
}
private void k(World world, int i, int j, int k) {
private void e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = d(l);
int i1 = b(l);
if (i1 != 7) {
boolean flag = this.d(world, i, j, k, i1);
boolean flag = this.a(world, i, j, k, i1);
if (flag && !e(l)) {
if (flag && !c(l)) {
// CraftBukkit start
int length = e(world, i, j, k, i1);
int length = h(world, i, j, k, i1);
if (length >= 0) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonExtendEvent event = new BlockPistonExtendEvent(block, length, CraftBlock.notchToBlockFace(i1));
@ -73,9 +73,9 @@ public class BlockPiston extends Block {
}
// CraftBukkit end
world.playNote(i, j, k, this.id, 0, i1);
world.playNote(i, j, k, this, 0, i1);
}
} else if (!flag && e(l)) {
} else if (!flag && c(l)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, CraftBlock.notchToBlockFace(i1));
@ -87,18 +87,18 @@ public class BlockPiston extends Block {
// CraftBukkit end
world.setData(i, j, k, i1, 2);
world.playNote(i, j, k, this.id, 1, i1);
world.playNote(i, j, k, this, 1, i1);
}
}
}
private boolean d(World world, int i, int j, int k, int l) {
private boolean a(World world, int i, int j, int k, int l) {
return l != 0 && world.isBlockFacePowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFacePowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFacePowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFacePowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFacePowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFacePowered(i - 1, j, k, 4) ? true : (world.isBlockFacePowered(i, j, k, 0) ? true : (world.isBlockFacePowered(i, j + 2, k, 1) ? true : (world.isBlockFacePowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFacePowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFacePowered(i - 1, j + 1, k, 4) ? true : world.isBlockFacePowered(i + 1, j + 1, k, 5)))))))))));
}
public boolean b(World world, int i, int j, int k, int l, int i1) {
public boolean a(World world, int i, int j, int k, int l, int i1) {
if (!world.isStatic) {
boolean flag = this.d(world, i, j, k, i1);
boolean flag = this.a(world, i, j, k, i1);
if (flag && l == 1) {
world.setData(i, j, k, i1 | 8, 2);
@ -111,7 +111,7 @@ public class BlockPiston extends Block {
}
if (l == 0) {
if (!this.f(world, i, j, k, i1)) {
if (!this.i(world, i, j, k, i1)) {
return false;
}
@ -124,17 +124,17 @@ public class BlockPiston extends Block {
((TileEntityPiston) tileentity).f();
}
world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(this.id, i1, i1, false, true));
world.setTypeAndData(i, j, k, Blocks.PISTON_MOVING, i1, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(this, i1, i1, false, true));
if (this.a) {
int j1 = i + Facing.b[i1] * 2;
int k1 = j + Facing.c[i1] * 2;
int l1 = k + Facing.d[i1] * 2;
int i2 = world.getTypeId(j1, k1, l1);
int j2 = world.getData(j1, k1, l1);
Block block = world.getType(j1, k1, l1);
int i2 = world.getData(j1, k1, l1);
boolean flag1 = false;
if (i2 == Block.PISTON_MOVING.id) {
if (block == Blocks.PISTON_MOVING) {
TileEntity tileentity1 = world.getTileEntity(j1, k1, l1);
if (tileentity1 instanceof TileEntityPiston) {
@ -142,19 +142,19 @@ public class BlockPiston extends Block {
if (tileentitypiston.c() == i1 && tileentitypiston.b()) {
tileentitypiston.f();
i2 = tileentitypiston.a();
j2 = tileentitypiston.p();
block = tileentitypiston.a();
i2 = tileentitypiston.p();
flag1 = true;
}
}
}
if (!flag1 && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].h() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
if (!flag1 && block.getMaterial() != Material.AIR && a(block, world, j1, k1, l1, false) && (block.h() == 0 || block == Blocks.PISTON || block == Blocks.PISTON_STICKY)) {
i += Facing.b[i1];
j += Facing.c[i1];
k += Facing.d[i1];
world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
world.setTypeAndData(i, j, k, Blocks.PISTON_MOVING, i2, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(block, i2, i1, false, false));
world.setAir(j1, k1, l1);
} else if (!flag1) {
world.setAir(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
@ -172,10 +172,10 @@ public class BlockPiston extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
if (e(l)) {
if (c(l)) {
float f = 0.25F;
switch (d(l)) {
switch (b(l)) {
case 0:
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
@ -213,21 +213,21 @@ public class BlockPiston extends Block {
super.a(world, i, j, k, axisalignedbb, list, entity);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.b(world, i, j, k);
return super.a(world, i, j, k);
}
public boolean b() {
public boolean d() {
return false;
}
public static int d(int i) {
public static int b(int i) {
if ((i & 7) >= Facing.OPPOSITE_FACING.length) return 7; // CraftBukkit - check for AIOOB on piston data
return i & 7;
}
public static boolean e(int i) {
public static boolean c(int i) {
return (i & 8) != 0;
}
@ -249,36 +249,36 @@ public class BlockPiston extends Block {
return l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
}
private static boolean a(int i, World world, int j, int k, int l, boolean flag) {
if (i == Block.OBSIDIAN.id) {
private static boolean a(Block block, World world, int i, int j, int k, boolean flag) {
if (block == Blocks.OBSIDIAN) {
return false;
} else {
if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) {
if (Block.byId[i].l(world, j, k, l) == -1.0F) {
if (block != Blocks.PISTON && block != Blocks.PISTON_STICKY) {
if (block.f(world, i, j, k) == -1.0F) {
return false;
}
if (Block.byId[i].h() == 2) {
if (block.h() == 2) {
return false;
}
if (Block.byId[i].h() == 1) {
if (block.h() == 1) {
if (!flag) {
return false;
}
return true;
}
} else if (e(world.getData(j, k, l))) {
} else if (c(world.getData(i, j, k))) {
return false;
}
return !(Block.byId[i] instanceof IContainer);
return !(block instanceof IContainer);
}
}
// CraftBukkit - boolean -> int return
private static int e(World world, int i, int j, int k, int l) {
private static int h(World world, int i, int j, int k, int l) {
int i1 = i + Facing.b[l];
int j1 = j + Facing.c[l];
int k1 = k + Facing.d[l];
@ -290,14 +290,14 @@ public class BlockPiston extends Block {
return -1; // CraftBukkit
}
int i2 = world.getTypeId(i1, j1, k1);
Block block = world.getType(i1, j1, k1);
if (i2 != 0) {
if (!a(i2, world, i1, j1, k1, true)) {
if (block.getMaterial() != Material.AIR) {
if (!a(block, world, i1, j1, k1, true)) {
return -1; // CraftBukkit
}
if (Block.byId[i2].h() != 1) {
if (block.h() != 1) {
if (l1 == 12) {
return -1; // CraftBukkit
}
@ -315,27 +315,26 @@ public class BlockPiston extends Block {
}
}
private boolean f(World world, int i, int j, int k, int l) {
private boolean i(World world, int i, int j, int k, int l) {
int i1 = i + Facing.b[l];
int j1 = j + Facing.c[l];
int k1 = k + Facing.d[l];
int l1 = 0;
while (true) {
int i2;
if (l1 < 13) {
if (j1 <= 0 || j1 >= 255) {
return false;
}
i2 = world.getTypeId(i1, j1, k1);
if (i2 != 0) {
if (!a(i2, world, i1, j1, k1, true)) {
Block block = world.getType(i1, j1, k1);
if (block.getMaterial() != Material.AIR) {
if (!a(block, world, i1, j1, k1, true)) {
return false;
}
if (Block.byId[i2].h() != 1) {
if (block.h() != 1) {
if (l1 == 12) {
return false;
}
@ -347,37 +346,37 @@ public class BlockPiston extends Block {
continue;
}
Block.byId[i2].c(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
block.b(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
world.setAir(i1, j1, k1);
}
}
l1 = i1;
i2 = j1;
int i2 = j1;
int j2 = k1;
int k2 = 0;
int[] aint;
Block[] ablock;
int l2;
int i3;
int j3;
for (aint = new int[13]; i1 != i || j1 != j || k1 != k; k1 = j3) {
for (ablock = new Block[13]; i1 != i || j1 != j || k1 != k; k1 = j3) {
l2 = i1 - Facing.b[l];
i3 = j1 - Facing.c[l];
j3 = k1 - Facing.d[l];
int k3 = world.getTypeId(l2, i3, j3);
int l3 = world.getData(l2, i3, j3);
Block block1 = world.getType(l2, i3, j3);
int k3 = world.getData(l2, i3, j3);
if (k3 == this.id && l2 == i && i3 == j && j3 == k) {
world.setTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0), 4);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(Block.PISTON_EXTENSION.id, l | (this.a ? 8 : 0), l, true, false));
if (block1 == this && l2 == i && i3 == j && j3 == k) {
world.setTypeAndData(i1, j1, k1, Blocks.PISTON_MOVING, l | (this.a ? 8 : 0), 4);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(Blocks.PISTON_EXTENSION, l | (this.a ? 8 : 0), l, true, false));
} else {
world.setTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l3, 4);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k3, l3, l, true, false));
world.setTypeAndData(i1, j1, k1, Blocks.PISTON_MOVING, k3, 4);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(block1, k3, l, true, false));
}
aint[k2++] = k3;
ablock[k2++] = block1;
i1 = l2;
j1 = i3;
}
@ -390,7 +389,7 @@ public class BlockPiston extends Block {
l2 = i1 - Facing.b[l];
i3 = j1 - Facing.c[l];
j3 = k1 - Facing.d[l];
world.applyPhysics(l2, i3, j3, aint[k2++]);
world.applyPhysics(l2, i3, j3, ablock[k2++]);
i1 = l2;
j1 = i3;
}

Datei anzeigen

@ -5,18 +5,18 @@ import java.util.Random;
public class BlockPistonExtension extends Block {
public BlockPistonExtension(int i) {
super(i, Material.PISTON);
this.a(k);
public BlockPistonExtension() {
super(Material.PISTON);
this.a(i);
this.c(0.5F);
}
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild) {
int i1 = d(l);
int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
int i1 = b(l);
Block block = world.getType(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) {
if (block == Blocks.PISTON || block == Blocks.PISTON_STICKY) {
world.setAir(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
}
}
@ -24,26 +24,26 @@ public class BlockPistonExtension extends Block {
super.a(world, i, j, k, l, entityhuman);
}
public void remove(World world, int i, int j, int k, int l, int i1) {
super.remove(world, i, j, k, l, i1);
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
int j1 = Facing.OPPOSITE_FACING[d(i1)];
public void remove(World world, int i, int j, int k, Block block, int l) {
super.remove(world, i, j, k, block, l);
if ((l & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
int i1 = Facing.OPPOSITE_FACING[b(l)];
i += Facing.b[j1];
j += Facing.c[j1];
k += Facing.d[j1];
int k1 = world.getTypeId(i, j, k);
i += Facing.b[i1];
j += Facing.c[i1];
k += Facing.d[i1];
Block block1 = world.getType(i, j, k);
if (k1 == Block.PISTON.id || k1 == Block.PISTON_STICKY.id) {
i1 = world.getData(i, j, k);
if (BlockPiston.e(i1)) {
Block.byId[k1].c(world, i, j, k, i1, 0);
if (block1 == Blocks.PISTON || block1 == Blocks.PISTON_STICKY) {
l = world.getData(i, j, k);
if (BlockPiston.c(l)) {
block1.b(world, i, j, k, l, 0);
world.setAir(i, j, k);
}
}
}
public int d() {
public int b() {
return 17;
}
@ -51,7 +51,7 @@ public class BlockPistonExtension extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
@ -75,7 +75,7 @@ public class BlockPistonExtension extends Block {
float f3 = 0.25F;
float f4 = 0.75F;
switch (d(l)) {
switch (b(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
super.a(world, i, j, k, axisalignedbb, list, entity);
@ -125,7 +125,7 @@ public class BlockPistonExtension extends Block {
int l = iblockaccess.getData(i, j, k);
float f = 0.25F;
switch (d(l)) {
switch (b(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
break;
@ -151,19 +151,19 @@ public class BlockPistonExtension extends Block {
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = d(world.getData(i, j, k));
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
public void doPhysics(World world, int i, int j, int k, Block block) {
int l = b(world.getData(i, j, k));
if ((l & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
Block block1 = world.getType(i - Facing.b[l], j - Facing.c[l], k - Facing.d[l]);
if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
if (block1 != Blocks.PISTON && block1 != Blocks.PISTON_STICKY) {
world.setAir(i, j, k);
} else {
Block.byId[j1].doPhysics(world, i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1], l);
block1.doPhysics(world, i - Facing.b[l], j - Facing.c[l], k - Facing.d[l], block);
}
}
public static int d(int i) {
public static int b(int i) {
return i & 7;
}
}

Datei anzeigen

@ -2,175 +2,101 @@ package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.event.entity.EntityPortalEnterEvent;
import org.bukkit.event.world.PortalCreateEvent;
// CraftBukkit end
import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
public class BlockPortal extends BlockHalfTransparant {
public class BlockPortal extends BlockHalfTransparent {
public BlockPortal(int i) {
super(i, "portal", Material.PORTAL, false);
this.b(true);
public static final int[][] a = new int[][] { new int[0], { 3, 1}, { 2, 0}};
public BlockPortal() {
super("portal", Material.PORTAL, false);
this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
super.a(world, i, j, k, random);
if (world.worldProvider.d() && random.nextInt(2000) < world.difficulty) {
if (world.worldProvider.d() && world.getGameRules().getBoolean("doMobSpawning") && random.nextInt(2000) < world.difficulty.a()) {
int l;
for (l = j; !world.w(i, l, k) && l > 0; --l) {
for (l = j; !World.a((IBlockAccess) world, i, l, k) && l > 0; --l) {
;
}
if (l > 0 && !world.u(i, l + 1, k)) {
if (l > 0 && !world.getType(i, l + 1, k).r()) {
Entity entity = ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
if (entity != null) {
entity.portalCooldown = entity.ac();
entity.portalCooldown = entity.ai();
}
}
}
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
float f;
float f1;
int l = b(iblockaccess.getData(i, j, k));
if (iblockaccess.getTypeId(i - 1, j, k) != this.id && iblockaccess.getTypeId(i + 1, j, k) != this.id) {
f = 0.125F;
f1 = 0.5F;
this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
} else {
f = 0.5F;
f1 = 0.125F;
this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
}
}
public boolean c() {
return false;
}
public boolean b() {
return false;
}
public boolean o_(World world, int i, int j, int k) {
byte b0 = 0;
byte b1 = 0;
if (world.getTypeId(i - 1, j, k) == Block.OBSIDIAN.id || world.getTypeId(i + 1, j, k) == Block.OBSIDIAN.id) {
b0 = 1;
}
if (world.getTypeId(i, j, k - 1) == Block.OBSIDIAN.id || world.getTypeId(i, j, k + 1) == Block.OBSIDIAN.id) {
b1 = 1;
}
if (b0 == b1) {
return false;
} else {
// CraftBukkit start
java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>();
org.bukkit.World bworld = world.getWorld();
// CraftBukkit end
if (world.getTypeId(i - b0, j, k - b1) == 0) {
i -= b0;
k -= b1;
}
int l;
int i1;
for (l = -1; l <= 2; ++l) {
for (i1 = -1; i1 <= 3; ++i1) {
boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;
if (l != -1 && l != 2 || i1 != -1 && i1 != 3) {
int j1 = world.getTypeId(i + b0 * l, j + i1, k + b1 * l);
if (flag) {
if (j1 != Block.OBSIDIAN.id) {
return false;
} else { // CraftBukkit
blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); // CraftBukkit
}
} else if (j1 != 0 && j1 != Block.FIRE.id) {
return false;
}
}
}
}
// CraftBukkit start
for (l = 0; l < 2; ++l) {
for (i1 = 0; i1 < 3; ++i1) {
blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l));
}
}
PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return false;
}
// CraftBukkit end
for (l = 0; l < 2; ++l) {
for (i1 = 0; i1 < 3; ++i1) {
world.setTypeIdAndData(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id, 0, 2);
}
}
return true;
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
byte b0 = 0;
byte b1 = 1;
if (world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id) {
b0 = 1;
b1 = 0;
}
int i1;
for (i1 = j; world.getTypeId(i, i1 - 1, k) == this.id; --i1) {
;
}
if (world.getTypeId(i, i1 - 1, k) != Block.OBSIDIAN.id) {
world.setAir(i, j, k);
} else {
int j1;
for (j1 = 1; j1 < 4 && world.getTypeId(i, i1 + j1, k) == this.id; ++j1) {
;
}
if (j1 == 3 && world.getTypeId(i, i1 + j1, k) == Block.OBSIDIAN.id) {
boolean flag = world.getTypeId(i - 1, j, k) == this.id || world.getTypeId(i + 1, j, k) == this.id;
boolean flag1 = world.getTypeId(i, j, k - 1) == this.id || world.getTypeId(i, j, k + 1) == this.id;
if (flag && flag1) {
world.setAir(i, j, k);
} else {
if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id || world.getTypeId(i - b0, j, k - b1) != this.id) && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id || world.getTypeId(i + b0, j, k + b1) != this.id)) {
world.setAir(i, j, k);
}
}
if (l == 0) {
if (iblockaccess.getType(i - 1, j, k) != this && iblockaccess.getType(i + 1, j, k) != this) {
l = 2;
} else {
world.setAir(i, j, k);
l = 1;
}
if (iblockaccess instanceof World && !((World) iblockaccess).isStatic) {
((World) iblockaccess).setData(i, j, k, l, 2);
}
}
float f = 0.125F;
float f1 = 0.125F;
if (l == 1) {
f = 0.5F;
}
if (l == 2) {
f1 = 0.5F;
}
this.a(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
}
public boolean d() {
return false;
}
public boolean e(World world, int i, int j, int k) {
PortalCreator portalcreator = new PortalCreator(world, i, j, k, 1);
PortalCreator portalcreator1 = new PortalCreator(world, i, j, k, 2);
if (portalcreator.b() && PortalCreator.a(portalcreator) == 0) {
// CraftBukkit start - return portalcreator
return portalcreator.c();
// return true;
} else if (portalcreator1.b() && PortalCreator.a(portalcreator1) == 0) {
return portalcreator1.c();
// return true;
// CraftBukkit end
} else {
return false;
}
}
public void doPhysics(World world, int i, int j, int k, Block block) {
int l = b(world.getData(i, j, k));
PortalCreator portalcreator = new PortalCreator(world, i, j, k, 1);
PortalCreator portalcreator1 = new PortalCreator(world, i, j, k, 2);
if (l == 1 && (!portalcreator.b() || PortalCreator.a(portalcreator) < PortalCreator.b(portalcreator) * PortalCreator.c(portalcreator))) {
world.setTypeUpdate(i, j, k, Blocks.AIR);
} else if (l == 2 && (!portalcreator1.b() || PortalCreator.a(portalcreator1) < PortalCreator.b(portalcreator1) * PortalCreator.c(portalcreator1))) {
world.setTypeUpdate(i, j, k, Blocks.AIR);
} else if (l == 0 && !portalcreator.b() && !portalcreator1.b()) {
world.setTypeUpdate(i, j, k, Blocks.AIR);
}
}
@ -185,7 +111,11 @@ public class BlockPortal extends BlockHalfTransparant {
world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
entity.ab();
entity.ah();
}
}
public static int b(int i) {
return i & 3;
}
}

Datei anzeigen

@ -8,19 +8,19 @@ public abstract class BlockPressurePlateAbstract extends Block {
private String a;
protected BlockPressurePlateAbstract(int i, String s, Material material) {
super(i, material);
protected BlockPressurePlateAbstract(String s, Material material) {
super(material);
this.a = s;
this.a(CreativeModeTab.d);
this.b(true);
this.c_(this.d(15));
this.a(true);
this.b(this.d(15));
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.c_(iblockaccess.getData(i, j, k));
this.b(iblockaccess.getData(i, j, k));
}
protected void c_(int i) {
protected void b(int i) {
boolean flag = this.c(i) > 0;
float f = 0.0625F;
@ -35,7 +35,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
return 20;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -43,7 +43,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
@ -52,18 +52,18 @@ public abstract class BlockPressurePlateAbstract extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return world.w(i, j - 1, k) || BlockFence.n_(world.getTypeId(i, j - 1, k));
return World.a((IBlockAccess) world, i, j - 1, k) || BlockFence.a(world.getType(i, j - 1, k));
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
boolean flag = false;
if (!world.w(i, j - 1, k) && !BlockFence.n_(world.getTypeId(i, j - 1, k))) {
if (!World.a((IBlockAccess) world, i, j - 1, k) && !BlockFence.a(world.getType(i, j - 1, k))) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
@ -73,7 +73,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
int l = this.c(world.getData(i, j, k));
if (l > 0) {
this.b(world, i, j, k, l);
this.a(world, i, j, k, l);
}
}
}
@ -83,12 +83,12 @@ public abstract class BlockPressurePlateAbstract extends Block {
int l = this.c(world.getData(i, j, k));
if (l == 0) {
this.b(world, i, j, k, l);
this.a(world, i, j, k, l);
}
}
}
protected void b(World world, int i, int j, int k, int l) {
protected void a(World world, int i, int j, int k, int l) {
int i1 = this.e(world, i, j, k);
boolean flag = l > 0;
boolean flag1 = i1 > 0;
@ -108,8 +108,8 @@ public abstract class BlockPressurePlateAbstract extends Block {
if (l != i1) {
world.setData(i, j, k, this.d(i1), 2);
this.b_(world, i, j, k);
world.g(i, j, k, i, j, k);
this.a_(world, i, j, k);
world.c(i, j, k, i, j, k);
}
if (!flag1 && flag) {
@ -119,7 +119,7 @@ public abstract class BlockPressurePlateAbstract extends Block {
}
if (flag1) {
world.a(i, j, k, this.id, this.a(world));
world.a(i, j, k, this, this.a(world));
}
}
@ -129,17 +129,17 @@ public abstract class BlockPressurePlateAbstract extends Block {
return AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f));
}
public void remove(World world, int i, int j, int k, int l, int i1) {
if (this.c(i1) > 0) {
this.b_(world, i, j, k);
public void remove(World world, int i, int j, int k, Block block, int l) {
if (this.c(l) > 0) {
this.a_(world, i, j, k);
}
super.remove(world, i, j, k, l, i1);
super.remove(world, i, j, k, block, l);
}
protected void b_(World world, int i, int j, int k) {
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
protected void a_(World world, int i, int j, int k) {
world.applyPhysics(i, j, k, this);
world.applyPhysics(i, j - 1, k, this);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {

Datei anzeigen

@ -9,8 +9,8 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
private EnumMobType a;
protected BlockPressurePlateBinary(int i, String s, Material material, EnumMobType enummobtype) {
super(i, s, material);
protected BlockPressurePlateBinary(String s, Material material, EnumMobType enummobtype) {
super(s, material);
this.a = enummobtype;
}
@ -63,7 +63,7 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
}
// CraftBukkit end
if (!entity.au()) {
if (!entity.az()) {
return 15;
}
}

Datei anzeigen

@ -10,16 +10,16 @@ public class BlockPumpkin extends BlockDirectional {
private boolean a;
protected BlockPumpkin(int i, boolean flag) {
super(i, Material.PUMPKIN);
this.b(true);
protected BlockPumpkin(boolean flag) {
super(Material.PUMPKIN);
this.a(true);
this.a = flag;
this.a(CreativeModeTab.b);
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
if (world.getType(i, j - 1, k) == Blocks.SNOW_BLOCK && world.getType(i, j - 2, k) == Blocks.SNOW_BLOCK) {
if (!world.isStatic) {
// CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
@ -27,22 +27,20 @@ public class BlockPumpkin extends BlockDirectional {
blockList.setTypeId(i, j, k, 0);
blockList.setTypeId(i, j - 1, k, 0);
blockList.setTypeId(i, j - 2, k, 0);
EntitySnowman entitysnowman = new EntitySnowman(world);
entitysnowman.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
if (world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
blockList.updateList();
}
// CraftBukkit end
}
for (int l = 0; l < 120; ++l) {
world.addParticle("snowshovel", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 2.5D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
}
} else if (world.getTypeId(i, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.IRON_BLOCK.id) {
boolean flag = world.getTypeId(i - 1, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i + 1, j - 1, k) == Block.IRON_BLOCK.id;
boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id;
} else if (world.getType(i, j - 1, k) == Blocks.IRON_BLOCK && world.getType(i, j - 2, k) == Blocks.IRON_BLOCK) {
boolean flag = world.getType(i - 1, j - 1, k) == Blocks.IRON_BLOCK && world.getType(i + 1, j - 1, k) == Blocks.IRON_BLOCK;
boolean flag1 = world.getType(i, j - 1, k - 1) == Blocks.IRON_BLOCK && world.getType(i, j - 1, k + 1) == Blocks.IRON_BLOCK;
if (flag || flag1) {
// CraftBukkit start - Use BlockStateListPopulator
@ -51,7 +49,6 @@ public class BlockPumpkin extends BlockDirectional {
blockList.setTypeId(i, j, k, 0);
blockList.setTypeId(i, j - 1, k, 0);
blockList.setTypeId(i, j - 2, k, 0);
if (flag) {
blockList.setTypeId(i - 1, j - 1, k, 0);
blockList.setTypeId(i + 1, j - 1, k, 0);
@ -77,9 +74,7 @@ public class BlockPumpkin extends BlockDirectional {
}
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
return (l == 0 || Block.byId[l].material.isReplaceable()) && world.w(i, j - 1, k);
return world.getType(i, j, k).material.isReplaceable() && World.a((IBlockAccess) world, i, j - 1, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
@ -89,12 +84,12 @@ public class BlockPumpkin extends BlockDirectional {
}
// CraftBukkit start
public void doPhysics(World world, int i, int j, int k, int l) {
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
int power = block.getBlockPower();
public void doPhysics(World world, int i, int j, int k, Block block) {
if (block != null && block.isPowerSource()) {
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
int power = bukkitBlock.getBlockPower();
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
}
}

Datei anzeigen

@ -8,8 +8,8 @@ public class BlockRedstoneLamp extends Block {
private final boolean a;
public BlockRedstoneLamp(int i, boolean flag) {
super(i, Material.BUILDABLE_GLASS);
public BlockRedstoneLamp(boolean flag) {
super(Material.BUILDABLE_GLASS);
this.a = flag;
if (flag) {
this.a(1.0F);
@ -19,7 +19,7 @@ public class BlockRedstoneLamp extends Block {
public void onPlace(World world, int i, int j, int k) {
if (!world.isStatic) {
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
world.a(i, j, k, this.id, 4);
world.a(i, j, k, this, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
@ -27,15 +27,15 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
world.setTypeAndData(i, j, k, Blocks.REDSTONE_LAMP_ON, 0, 2);
}
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
world.a(i, j, k, this.id, 4);
world.a(i, j, k, this, 4);
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
@ -43,7 +43,7 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
world.setTypeAndData(i, j, k, Blocks.REDSTONE_LAMP_ON, 0, 2);
}
}
}
@ -56,11 +56,15 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_OFF.id, 0, 2);
world.setTypeAndData(i, j, k, Blocks.REDSTONE_LAMP_OFF, 0, 2);
}
}
public int getDropType(int i, Random random, int j) {
return Block.REDSTONE_LAMP_OFF.id;
public Item getDropType(int i, Random random, int j) {
return Item.getItemOf(Blocks.REDSTONE_LAMP_OFF);
}
protected ItemStack j(int i) {
return new ItemStack(Blocks.REDSTONE_LAMP_OFF);
}
}

Datei anzeigen

@ -8,10 +8,10 @@ public class BlockRedstoneOre extends Block {
private boolean a;
public BlockRedstoneOre(int i, boolean flag) {
super(i, Material.STONE);
public BlockRedstoneOre(boolean flag) {
super(Material.STONE);
if (flag) {
this.b(true);
this.a(true);
}
this.a = flag;
@ -22,7 +22,7 @@ public class BlockRedstoneOre extends Block {
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.k(world, i, j, k);
this.e(world, i, j, k);
super.attack(world, i, j, k, entityhuman);
}
@ -31,14 +31,14 @@ public class BlockRedstoneOre extends Block {
if (entity instanceof EntityHuman) {
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
if (!event.isCancelled()) {
this.k(world, i, j, k);
this.e(world, i, j, k);
super.b(world, i, j, k, entity);
}
} else {
EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.k(world, i, j, k);
this.e(world, i, j, k);
super.b(world, i, j, k, entity);
}
}
@ -46,25 +46,25 @@ public class BlockRedstoneOre extends Block {
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
this.k(world, i, j, k);
this.e(world, i, j, k);
return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
private void k(World world, int i, int j, int k) {
private void e(World world, int i, int j, int k) {
this.m(world, i, j, k);
if (this.id == Block.REDSTONE_ORE.id) {
world.setTypeIdUpdate(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
if (this == Blocks.REDSTONE_ORE) {
world.setTypeUpdate(i, j, k, Blocks.GLOWING_REDSTONE_ORE);
}
}
public void a(World world, int i, int j, int k, Random random) {
if (this.id == Block.GLOWING_REDSTONE_ORE.id) {
world.setTypeIdUpdate(i, j, k, Block.REDSTONE_ORE.id);
if (this == Blocks.GLOWING_REDSTONE_ORE) {
world.setTypeUpdate(i, j, k, Blocks.REDSTONE_ORE);
}
}
public int getDropType(int i, Random random, int j) {
return Item.REDSTONE.id;
public Item getDropType(int i, Random random, int j) {
return Items.REDSTONE;
}
public int getDropCount(int i, Random random) {
@ -78,15 +78,16 @@ public class BlockRedstoneOre extends Block {
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
super.dropNaturally(world, i, j, k, l, f, i1);
/* CraftBukkit start - Delegated to getExpDrop
if (this.getDropType(l, world.random, i1) != this.id) {
if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 1 + world.random.nextInt(5);
this.j(world, i, j, k, j1);
} */
this.dropExperience(world, i, j, k, j1);
}
// */
}
public int getExpDrop(World world, int l, int i1) {
if (this.getDropType(l, world.random, i1) != this.id) {
if (this.getDropType(l, world.random, i1) != Item.getItemOf(this)) {
int j1 = 1 + world.random.nextInt(5);
return j1;
@ -105,27 +106,27 @@ public class BlockRedstoneOre extends Block {
double d2 = (double) ((float) j + random.nextFloat());
double d3 = (double) ((float) k + random.nextFloat());
if (l == 0 && !world.t(i, j + 1, k)) {
if (l == 0 && !world.getType(i, j + 1, k).c()) {
d2 = (double) (j + 1) + d0;
}
if (l == 1 && !world.t(i, j - 1, k)) {
if (l == 1 && !world.getType(i, j - 1, k).c()) {
d2 = (double) (j + 0) - d0;
}
if (l == 2 && !world.t(i, j, k + 1)) {
if (l == 2 && !world.getType(i, j, k + 1).c()) {
d3 = (double) (k + 1) + d0;
}
if (l == 3 && !world.t(i, j, k - 1)) {
if (l == 3 && !world.getType(i, j, k - 1).c()) {
d3 = (double) (k + 0) - d0;
}
if (l == 4 && !world.t(i + 1, j, k)) {
if (l == 4 && !world.getType(i + 1, j, k).c()) {
d1 = (double) (i + 1) + d0;
}
if (l == 5 && !world.t(i - 1, j, k)) {
if (l == 5 && !world.getType(i - 1, j, k).c()) {
d1 = (double) (i + 0) - d0;
}
@ -135,7 +136,7 @@ public class BlockRedstoneOre extends Block {
}
}
protected ItemStack d_(int i) {
return new ItemStack(Block.REDSTONE_ORE);
protected ItemStack j(int i) {
return new ItemStack(Blocks.REDSTONE_ORE);
}
}

Datei anzeigen

@ -40,10 +40,9 @@ public class BlockRedstoneTorch extends BlockTorch {
return false;
}
protected BlockRedstoneTorch(int i, boolean flag) {
super(i);
protected BlockRedstoneTorch(boolean flag) {
this.isOn = flag;
this.b(true);
this.a(true);
this.a((CreativeModeTab) null);
}
@ -57,23 +56,23 @@ public class BlockRedstoneTorch extends BlockTorch {
}
if (this.isOn) {
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j - 1, k, this);
world.applyPhysics(i, j + 1, k, this);
world.applyPhysics(i - 1, j, k, this);
world.applyPhysics(i + 1, j, k, this);
world.applyPhysics(i, j, k - 1, this);
world.applyPhysics(i, j, k + 1, this);
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
public void remove(World world, int i, int j, int k, Block block, int l) {
if (this.isOn) {
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j - 1, k, this);
world.applyPhysics(i, j + 1, k, this);
world.applyPhysics(i - 1, j, k, this);
world.applyPhysics(i + 1, j, k, this);
world.applyPhysics(i, j, k - 1, this);
world.applyPhysics(i, j, k + 1, this);
}
}
@ -121,7 +120,7 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k), 3);
world.setTypeAndData(i, j, k, Blocks.REDSTONE_TORCH_OFF, world.getData(i, j, k), 3);
if (this.a(world, i, j, k, true)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
@ -145,16 +144,16 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k), 3);
world.setTypeAndData(i, j, k, Blocks.REDSTONE_TORCH_ON, world.getData(i, j, k), 3);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!this.d(world, i, j, k, l)) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!this.b(world, i, j, k, block)) {
boolean flag = this.m(world, i, j, k);
if (this.isOn && flag || !this.isOn && !flag) {
world.a(i, j, k, this.id, this.a(world));
world.a(i, j, k, this, this.a(world));
}
}
}
@ -163,15 +162,15 @@ public class BlockRedstoneTorch extends BlockTorch {
return l == 0 ? this.b(iblockaccess, i, j, k, l) : 0;
}
public int getDropType(int i, Random random, int j) {
return Block.REDSTONE_TORCH_ON.id;
public Item getDropType(int i, Random random, int j) {
return Item.getItemOf(Blocks.REDSTONE_TORCH_ON);
}
public boolean isPowerSource() {
return true;
}
public boolean i(int i) {
return i == Block.REDSTONE_TORCH_OFF.id || i == Block.REDSTONE_TORCH_ON.id;
public boolean c(Block block) {
return block == Blocks.REDSTONE_TORCH_OFF || block == Blocks.REDSTONE_TORCH_ON;
}
}

Datei anzeigen

@ -12,12 +12,12 @@ public class BlockRedstoneWire extends Block {
private boolean a = true;
private Set b = new HashSet();
public BlockRedstoneWire(int i) {
super(i, Material.ORIENTABLE);
public BlockRedstoneWire() {
super(Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -25,19 +25,19 @@ public class BlockRedstoneWire extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 5;
}
public boolean canPlace(World world, int i, int j, int k) {
return world.w(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
return World.a((IBlockAccess) world, i, j - 1, k) || world.getType(i, j - 1, k) == Blocks.GLOWSTONE;
}
private void k(World world, int i, int j, int k) {
private void e(World world, int i, int j, int k) {
this.a(world, i, j, k, i, j, k);
ArrayList arraylist = new ArrayList(this.b);
@ -46,7 +46,7 @@ public class BlockRedstoneWire extends Block {
for (int l = 0; l < arraylist.size(); ++l) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this.id);
world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this);
}
}
@ -89,11 +89,11 @@ public class BlockRedstoneWire extends Block {
j2 = this.getPower(world, l2, j, i3, j2);
}
if (world.u(l2, j, i3) && !world.u(i, j + 1, k)) {
if (world.getType(l2, j, i3).r() && !world.getType(i, j + 1, k).r()) {
if ((l2 != l || i3 != j1) && j >= i1) {
j2 = this.getPower(world, l2, j + 1, i3, j2);
}
} else if (!world.u(l2, j, i3) && (l2 != l || i3 != j1) && j <= i1) {
} else if (!world.getType(l2, j, i3).r() && (l2 != l || i3 != j1) && j <= i1) {
j2 = this.getPower(world, l2, j - 1, i3, j2);
}
}
@ -118,7 +118,6 @@ public class BlockRedstoneWire extends Block {
l1 = event.getNewCurrent();
}
// CraftBukkit end
if (k1 != l1) {
world.setData(i, j, k, l1, 2);
this.b.add(new ChunkPosition(i, j, k));
@ -132,46 +131,46 @@ public class BlockRedstoneWire extends Block {
}
private void m(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i, j + 1, k, this.id);
if (world.getType(i, j, k) == this) {
world.applyPhysics(i, j, k, this);
world.applyPhysics(i - 1, j, k, this);
world.applyPhysics(i + 1, j, k, this);
world.applyPhysics(i, j, k - 1, this);
world.applyPhysics(i, j, k + 1, this);
world.applyPhysics(i, j - 1, k, this);
world.applyPhysics(i, j + 1, k, this);
}
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (!world.isStatic) {
this.k(world, i, j, k);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
this.e(world, i, j, k);
world.applyPhysics(i, j + 1, k, this);
world.applyPhysics(i, j - 1, k, this);
this.m(world, i - 1, j, k);
this.m(world, i + 1, j, k);
this.m(world, i, j, k - 1);
this.m(world, i, j, k + 1);
if (world.u(i - 1, j, k)) {
if (world.getType(i - 1, j, k).r()) {
this.m(world, i - 1, j + 1, k);
} else {
this.m(world, i - 1, j - 1, k);
}
if (world.u(i + 1, j, k)) {
if (world.getType(i + 1, j, k).r()) {
this.m(world, i + 1, j + 1, k);
} else {
this.m(world, i + 1, j - 1, k);
}
if (world.u(i, j, k - 1)) {
if (world.getType(i, j, k - 1).r()) {
this.m(world, i, j + 1, k - 1);
} else {
this.m(world, i, j - 1, k - 1);
}
if (world.u(i, j, k + 1)) {
if (world.getType(i, j, k + 1).r()) {
this.m(world, i, j + 1, k + 1);
} else {
this.m(world, i, j - 1, k + 1);
@ -179,39 +178,39 @@ public class BlockRedstoneWire extends Block {
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
super.remove(world, i, j, k, l, i1);
public void remove(World world, int i, int j, int k, Block block, int l) {
super.remove(world, i, j, k, block, l);
if (!world.isStatic) {
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k - 1, this.id);
this.k(world, i, j, k);
world.applyPhysics(i, j + 1, k, this);
world.applyPhysics(i, j - 1, k, this);
world.applyPhysics(i + 1, j, k, this);
world.applyPhysics(i - 1, j, k, this);
world.applyPhysics(i, j, k + 1, this);
world.applyPhysics(i, j, k - 1, this);
this.e(world, i, j, k);
this.m(world, i - 1, j, k);
this.m(world, i + 1, j, k);
this.m(world, i, j, k - 1);
this.m(world, i, j, k + 1);
if (world.u(i - 1, j, k)) {
if (world.getType(i - 1, j, k).r()) {
this.m(world, i - 1, j + 1, k);
} else {
this.m(world, i - 1, j - 1, k);
}
if (world.u(i + 1, j, k)) {
if (world.getType(i + 1, j, k).r()) {
this.m(world, i + 1, j + 1, k);
} else {
this.m(world, i + 1, j - 1, k);
}
if (world.u(i, j, k - 1)) {
if (world.getType(i, j, k - 1).r()) {
this.m(world, i, j + 1, k - 1);
} else {
this.m(world, i, j - 1, k - 1);
}
if (world.u(i, j, k + 1)) {
if (world.getType(i, j, k + 1).r()) {
this.m(world, i, j + 1, k + 1);
} else {
this.m(world, i, j - 1, k + 1);
@ -221,7 +220,7 @@ public class BlockRedstoneWire extends Block {
// CraftBukkit - private -> public
public int getPower(World world, int i, int j, int k, int l) {
if (world.getTypeId(i, j, k) != this.id) {
if (world.getType(i, j, k) != this) {
return l;
} else {
int i1 = world.getData(i, j, k);
@ -230,23 +229,23 @@ public class BlockRedstoneWire extends Block {
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
boolean flag = this.canPlace(world, i, j, k);
if (flag) {
this.k(world, i, j, k);
this.e(world, i, j, k);
} else {
this.c(world, i, j, k, 0, 0);
this.b(world, i, j, k, 0, 0);
world.setAir(i, j, k);
}
super.doPhysics(world, i, j, k, l);
super.doPhysics(world, i, j, k, block);
}
}
public int getDropType(int i, Random random, int j) {
return Item.REDSTONE.id;
public Item getDropType(int i, Random random, int j) {
return Items.REDSTONE;
}
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@ -264,25 +263,25 @@ public class BlockRedstoneWire extends Block {
} else if (l == 1) {
return i1;
} else {
boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.u(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.u(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.u(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.u(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.getType(i - 1, j, k).r() && g(iblockaccess, i - 1, j - 1, k, -1);
boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.getType(i + 1, j, k).r() && g(iblockaccess, i + 1, j - 1, k, -1);
boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.getType(i, j, k - 1).r() && g(iblockaccess, i, j - 1, k - 1, -1);
boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.getType(i, j, k + 1).r() && g(iblockaccess, i, j - 1, k + 1, -1);
if (!iblockaccess.u(i, j + 1, k)) {
if (iblockaccess.u(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
if (!iblockaccess.getType(i, j + 1, k).r()) {
if (iblockaccess.getType(i - 1, j, k).r() && g(iblockaccess, i - 1, j + 1, k, -1)) {
flag = true;
}
if (iblockaccess.u(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
if (iblockaccess.getType(i + 1, j, k).r() && g(iblockaccess, i + 1, j + 1, k, -1)) {
flag1 = true;
}
if (iblockaccess.u(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
if (iblockaccess.getType(i, j, k - 1).r() && g(iblockaccess, i, j + 1, k - 1, -1)) {
flag2 = true;
}
if (iblockaccess.u(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
if (iblockaccess.getType(i, j, k + 1).r() && g(iblockaccess, i, j + 1, k + 1, -1)) {
flag3 = true;
}
}
@ -297,34 +296,28 @@ public class BlockRedstoneWire extends Block {
}
public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getTypeId(i, j, k);
Block block = iblockaccess.getType(i, j, k);
if (i1 == Block.REDSTONE_WIRE.id) {
if (block == Blocks.REDSTONE_WIRE) {
return true;
} else if (i1 == 0) {
return false;
} else if (!Block.DIODE_OFF.g(i1)) {
return Block.byId[i1].isPowerSource() && l != -1;
} else if (!Blocks.DIODE_OFF.e(block)) {
return block.isPowerSource() && l != -1;
} else {
int j1 = iblockaccess.getData(i, j, k);
int i1 = iblockaccess.getData(i, j, k);
return l == (j1 & 3) || l == Direction.f[j1 & 3];
return l == (i1 & 3) || l == Direction.f[i1 & 3];
}
}
public static boolean g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (f(iblockaccess, i, j, k, l)) {
return true;
} else if (iblockaccess.getType(i, j, k) == Blocks.DIODE_ON) {
int i1 = iblockaccess.getData(i, j, k);
return l == (i1 & 3);
} else {
int i1 = iblockaccess.getTypeId(i, j, k);
if (i1 == Block.DIODE_ON.id) {
int j1 = iblockaccess.getData(i, j, k);
return l == (j1 & 3);
} else {
return false;
}
return false;
}
}
}

Datei anzeigen

@ -4,73 +4,78 @@ import java.util.Random;
public class BlockReed extends Block {
protected BlockReed(int i) {
super(i, Material.PLANT);
protected BlockReed() {
super(Material.PLANT);
float f = 0.375F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
this.b(true);
this.a(true);
}
public void a(World world, int i, int j, int k, Random random) {
if (world.isEmpty(i, j + 1, k)) {
int l;
if (world.getType(i, j - 1, k) == Blocks.SUGAR_CANE_BLOCK || this.e(world, i, j, k)) {
if (world.isEmpty(i, j + 1, k)) {
int l;
for (l = 1; world.getTypeId(i, j - l, k) == this.id; ++l) {
;
}
for (l = 1; world.getType(i, j - l, k) == this; ++l) {
;
}
if (l < 3) {
int i1 = world.getData(i, j, k);
if (l < 3) {
int i1 = world.getData(i, j, k);
if (i1 == 15) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
world.setData(i, j, k, 0, 4);
} else {
world.setData(i, j, k, i1 + 1, 4);
if (i1 == 15) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this, 0); // CraftBukkit
world.setData(i, j, k, 0, 4);
} else {
world.setData(i, j, k, i1 + 1, 4);
}
}
}
}
}
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j - 1, k);
Block block = world.getType(i, j - 1, k);
return l == this.id ? true : (l != Block.GRASS.id && l != Block.DIRT.id && l != Block.SAND.id ? false : (world.getMaterial(i - 1, j - 1, k) == Material.WATER ? true : (world.getMaterial(i + 1, j - 1, k) == Material.WATER ? true : (world.getMaterial(i, j - 1, k - 1) == Material.WATER ? true : world.getMaterial(i, j - 1, k + 1) == Material.WATER))));
return block == this ? true : (block != Blocks.GRASS && block != Blocks.DIRT && block != Blocks.SAND ? false : (world.getType(i - 1, j - 1, k).getMaterial() == Material.WATER ? true : (world.getType(i + 1, j - 1, k).getMaterial() == Material.WATER ? true : (world.getType(i, j - 1, k - 1).getMaterial() == Material.WATER ? true : world.getType(i, j - 1, k + 1).getMaterial() == Material.WATER))));
}
public void doPhysics(World world, int i, int j, int k, int l) {
this.p_(world, i, j, k);
public void doPhysics(World world, int i, int j, int k, Block block) {
this.e(world, i, j, k);
}
protected final void p_(World world, int i, int j, int k) {
if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
protected final boolean e(World world, int i, int j, int k) {
if (!this.j(world, i, j, k)) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
return true;
}
}
public boolean f(World world, int i, int j, int k) {
public boolean j(World world, int i, int j, int k) {
return this.canPlace(world, i, j, k);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
public int getDropType(int i, Random random, int j) {
return Item.SUGAR_CANE.id;
public Item getDropType(int i, Random random, int j) {
return Items.SUGAR_CANE;
}
public boolean c() {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 1;
}
}

Datei anzeigen

@ -5,17 +5,18 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.TreeType;
import org.bukkit.craftbukkit.CraftBlockChangeDelegate;
import org.bukkit.craftbukkit.util.StructureGrowDelegate;
import org.bukkit.entity.Player;
import org.bukkit.event.world.StructureGrowEvent;
// CraftBukkit end
public class BlockSapling extends BlockFlower {
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle", "acacia", "roofed_oak"};
private static final IIcon[] b = new IIcon[a.length];
protected BlockSapling(int i) {
super(i);
protected BlockSapling() {
float f = 0.4F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
@ -44,64 +45,113 @@ public class BlockSapling extends BlockFlower {
// CraftBukkit - Added bonemeal, player and itemstack
public void d(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
int l = world.getData(i, j, k) & 3;
Object object = null;
int i1 = 0;
int j1 = 0;
boolean flag = false;
int l = world.getData(i, j, k) & 7;
// CraftBukkit start - Records tree generation and calls StructureGrowEvent
StructureGrowDelegate delegate = new StructureGrowDelegate(world);
TreeType treeType = null;
TreeGenerator gen = null;
boolean grownTree = false;
if (l == 1) {
treeType = TreeType.REDWOOD;
gen = new WorldGenTaiga2(false);
} else if (l == 2) {
treeType = TreeType.BIRCH;
gen = new WorldGenForest(false);
} else if (l == 3) {
for (i1 = 0; i1 >= -1; --i1) {
for (j1 = 0; j1 >= -1; --j1) {
if (this.d(world, i + i1, j, k + j1, 3) && this.d(world, i + i1 + 1, j, k + j1, 3) && this.d(world, i + i1, j, k + j1 + 1, 3) && this.d(world, i + i1 + 1, j, k + j1 + 1, 3)) {
treeType = TreeType.JUNGLE;
gen = new WorldGenMegaTree(false, 10 + random.nextInt(20), 3, 3);
flag = true;
break;
}
}
if (gen != null) {
break;
}
}
if (gen == null) {
j1 = 0;
i1 = 0;
treeType = TreeType.SMALL_JUNGLE;
gen = new WorldGenTrees(false, 4 + random.nextInt(7), 3, 3, false);
}
// Turn ternary operator into if statement to set treeType
//Object object = random.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
TreeGenerator object; // Changed to TreeGenerator
if (random.nextInt(10) == 0) {
treeType = TreeType.BIG_TREE;
object = new WorldGenBigTree(true);
} else {
treeType = TreeType.TREE;
gen = new WorldGenTrees(false);
if (random.nextInt(10) == 0) {
treeType = TreeType.BIG_TREE;
gen = new WorldGenBigTree(false);
object = new WorldGenTrees(true);
}
// CraftBukkit end
int i1 = 0;
int j1 = 0;
boolean flag = false;
switch (l) {
case 0:
default:
break;
case 1:
treeType = TreeType.REDWOOD; // CraftBukkit
label78:
for (i1 = 0; i1 >= -1; --i1) {
for (j1 = 0; j1 >= -1; --j1) {
if (this.a(world, i + i1, j, k + j1, 1) && this.a(world, i + i1 + 1, j, k + j1, 1) && this.a(world, i + i1, j, k + j1 + 1, 1) && this.a(world, i + i1 + 1, j, k + j1 + 1, 1)) {
object = new WorldGenMegaTree(false, random.nextBoolean());
flag = true;
break label78;
}
}
}
if (!flag) {
j1 = 0;
i1 = 0;
object = new WorldGenTaiga2(true);
}
break;
case 2:
treeType = TreeType.BIRCH; // CraftBukkit
object = new WorldGenForest(true, false);
break;
case 3:
label93:
for (i1 = 0; i1 >= -1; --i1) {
for (j1 = 0; j1 >= -1; --j1) {
if (this.a(world, i + i1, j, k + j1, 3) && this.a(world, i + i1 + 1, j, k + j1, 3) && this.a(world, i + i1, j, k + j1 + 1, 3) && this.a(world, i + i1 + 1, j, k + j1 + 1, 3)) {
treeType = TreeType.JUNGLE; // CraftBukkit
object = new WorldGenJungleTree(true, 10, 20, 3, 3);
flag = true;
break label93;
}
}
}
if (!flag) {
j1 = 0;
i1 = 0;
treeType = TreeType.SMALL_JUNGLE; // CraftBukkit
object = new WorldGenTrees(true, 4 + random.nextInt(7), 3, 3, false);
}
break;
case 4:
treeType = TreeType.ACACIA; // CraftBukkit
object = new WorldGenAcaciaTree(true);
break;
case 5:
label108:
for (i1 = 0; i1 >= -1; --i1) {
for (j1 = 0; j1 >= -1; --j1) {
if (this.a(world, i + i1, j, k + j1, 5) && this.a(world, i + i1 + 1, j, k + j1, 5) && this.a(world, i + i1, j, k + j1 + 1, 5) && this.a(world, i + i1 + 1, j, k + j1 + 1, 5)) {
object = new WorldGenForestTree(true);
treeType = TreeType.DARK_OAK; // CraftBukkit
flag = true;
break label108;
}
}
}
if (!flag) {
return;
}
}
Block block = Blocks.AIR;
if (flag) {
world.setTypeIdAndData(i + i1, j, k + j1, 0, 0, 4);
world.setTypeIdAndData(i + i1 + 1, j, k + j1, 0, 0, 4);
world.setTypeIdAndData(i + i1, j, k + j1 + 1, 0, 0, 4);
world.setTypeIdAndData(i + i1 + 1, j, k + j1 + 1, 0, 0, 4);
world.setTypeAndData(i + i1, j, k + j1, block, 0, 4);
world.setTypeAndData(i + i1 + 1, j, k + j1, block, 0, 4);
world.setTypeAndData(i + i1, j, k + j1 + 1, block, 0, 4);
world.setTypeAndData(i + i1 + 1, j, k + j1 + 1, block, 0, 4);
} else {
world.setTypeIdAndData(i, j, k, 0, 0, 4);
world.setTypeAndData(i, j, k, block, 0, 4);
}
grownTree = gen.generate(delegate, random, i + i1, j, k + j1);
// CraftBukkit start
grownTree = object.generate(new CraftBlockChangeDelegate(delegate), random, i + i1, j, k + j1);
if (grownTree) {
Location location = new Location(world.getWorld(), i, j, k);
StructureGrowEvent event = new StructureGrowEvent(location, treeType, bonemeal, player, delegate.getBlocks());
@ -120,26 +170,38 @@ public class BlockSapling extends BlockFlower {
// We always consume bonemeal when trying to grow
--itemstack.count;
}
// No need to generate the tree again.
if (!grownTree) {
// CraftBukkit end
if (flag) {
world.setTypeIdAndData(i + i1, j, k + j1, this.id, l, 4);
world.setTypeIdAndData(i + i1 + 1, j, k + j1, this.id, l, 4);
world.setTypeIdAndData(i + i1, j, k + j1 + 1, this.id, l, 4);
world.setTypeIdAndData(i + i1 + 1, j, k + j1 + 1, this.id, l, 4);
world.setTypeAndData(i + i1, j, k + j1, this, l, 4);
world.setTypeAndData(i + i1 + 1, j, k + j1, this, l, 4);
world.setTypeAndData(i + i1, j, k + j1 + 1, this, l, 4);
world.setTypeAndData(i + i1 + 1, j, k + j1 + 1, this, l, 4);
} else {
world.setTypeIdAndData(i, j, k, this.id, l, 4);
world.setTypeAndData(i, j, k, this, l, 4);
}
}
// CraftBukkit end
}
public boolean d(World world, int i, int j, int k, int l) {
return world.getTypeId(i, j, k) == this.id && (world.getData(i, j, k) & 3) == l;
public boolean a(World world, int i, int j, int k, int l) {
return world.getType(i, j, k) == this && (world.getData(i, j, k) & 7) == l;
}
public int getDropData(int i) {
return i & 3;
return MathHelper.a(i & 7, 0, 5);
}
public boolean a(World world, int i, int j, int k, boolean flag) {
return true;
}
public boolean a(World world, Random random, int i, int j, int k) {
return (double) world.random.nextFloat() < 0.45D;
}
public void b(World world, Random random, int i, int j, int k) {
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
}
// CraftBukkit start
@ -147,7 +209,7 @@ public class BlockSapling extends BlockFlower {
public boolean a(World world, Random random, int i, int j, int k);
public boolean generate(org.bukkit.BlockChangeDelegate world, Random random, int i, int j, int k);
public boolean generate(org.bukkit.craftbukkit.CraftBlockChangeDelegate world, Random random, int i, int j, int k);
}
// CraftBukkit end
}

Datei anzeigen

@ -9,8 +9,8 @@ public class BlockSign extends BlockContainer {
private Class a;
private boolean b;
protected BlockSign(int i, Class oclass, boolean flag) {
super(i, Material.WOOD);
protected BlockSign(Class oclass, boolean flag) {
super(Material.WOOD);
this.b = flag;
this.a = oclass;
float f = 0.25F;
@ -19,7 +19,7 @@ public class BlockSign extends BlockContainer {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -51,11 +51,11 @@ public class BlockSign extends BlockContainer {
}
}
public int d() {
public int b() {
return -1;
}
public boolean b() {
public boolean d() {
return false;
}
@ -67,7 +67,7 @@ public class BlockSign extends BlockContainer {
return false;
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
try {
return (TileEntity) this.a.newInstance();
} catch (Exception exception) {
@ -75,51 +75,51 @@ public class BlockSign extends BlockContainer {
}
}
public int getDropType(int i, Random random, int j) {
return Item.SIGN.id;
public Item getDropType(int i, Random random, int j) {
return Items.SIGN;
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
boolean flag = false;
if (this.b) {
if (!world.getMaterial(i, j - 1, k).isBuildable()) {
if (!world.getType(i, j - 1, k).getMaterial().isBuildable()) {
flag = true;
}
} else {
int i1 = world.getData(i, j, k);
int l = world.getData(i, j, k);
flag = true;
if (i1 == 2 && world.getMaterial(i, j, k + 1).isBuildable()) {
if (l == 2 && world.getType(i, j, k + 1).getMaterial().isBuildable()) {
flag = false;
}
if (i1 == 3 && world.getMaterial(i, j, k - 1).isBuildable()) {
if (l == 3 && world.getType(i, j, k - 1).getMaterial().isBuildable()) {
flag = false;
}
if (i1 == 4 && world.getMaterial(i + 1, j, k).isBuildable()) {
if (l == 4 && world.getType(i + 1, j, k).getMaterial().isBuildable()) {
flag = false;
}
if (i1 == 5 && world.getMaterial(i - 1, j, k).isBuildable()) {
if (l == 5 && world.getType(i - 1, j, k).getMaterial().isBuildable()) {
flag = false;
}
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
super.doPhysics(world, i, j, k, l);
super.doPhysics(world, i, j, k, block);
// CraftBukkit start
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
int power = block.getBlockPower();
if (block != null && block.isPowerSource()) {
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
int power = bukkitBlock.getBlockPower();
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
}
// CraftBukkit end

Datei anzeigen

@ -1,5 +1,6 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.Random;
// CraftBukkit start
@ -9,12 +10,12 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
public class BlockSkull extends BlockContainer {
protected BlockSkull(int i) {
super(i, Material.ORIENTABLE);
protected BlockSkull() {
super(Material.ORIENTABLE);
this.a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
}
public int d() {
public int b() {
return -1;
}
@ -22,7 +23,7 @@ public class BlockSkull extends BlockContainer {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
@ -52,9 +53,9 @@ public class BlockSkull extends BlockContainer {
}
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.b(world, i, j, k);
return super.a(world, i, j, k);
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
@ -63,7 +64,7 @@ public class BlockSkull extends BlockContainer {
world.setData(i, j, k, l, 2);
}
public TileEntity b(World world) {
public TileEntity a(World world, int i) {
return new TileEntitySkull();
}
@ -80,7 +81,7 @@ public class BlockSkull extends BlockContainer {
// CraftBukkit start - Special case dropping so we can get info from the tile entity
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (world.random.nextFloat() < f) {
ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k));
ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, i, j, k));
TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k);
if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) {
@ -88,7 +89,7 @@ public class BlockSkull extends BlockContainer {
itemstack.getTag().setString("SkullOwner", tileentityskull.getExtraType());
}
this.b(world, i, j, k, itemstack);
this.a(world, i, j, k, itemstack);
}
}
// CraftBukkit end
@ -102,11 +103,13 @@ public class BlockSkull extends BlockContainer {
super.a(world, i, j, k, l, entityhuman);
}
public void remove(World world, int i, int j, int k, int l, int i1) {
public void remove(World world, int i, int j, int k, Block block, int l) {
if (!world.isStatic) {
/* CraftBukkit start - Drop item in code above, not here
if ((i1 & 8) == 0) {
ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k));
// CraftBukkit start - Drop item in code above, not here
// if ((l & 8) == 0) {
if (false) {
// CraftBukkit end
ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, i, j, k));
TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k);
if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0) {
@ -114,92 +117,106 @@ public class BlockSkull extends BlockContainer {
itemstack.getTag().setString("SkullOwner", tileentityskull.getExtraType());
}
this.b(world, i, j, k, itemstack);
this.a(world, i, j, k, itemstack);
}
// CraftBukkit end */
super.remove(world, i, j, k, l, i1);
super.remove(world, i, j, k, block, l);
}
}
public int getDropType(int i, Random random, int j) {
return Item.SKULL.id;
public Item getDropType(int i, Random random, int j) {
return Items.SKULL;
}
public void a(World world, int i, int j, int k, TileEntitySkull tileentityskull) {
if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty > 0 && !world.isStatic) {
int l = Block.SOUL_SAND.id;
int i1;
if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty != EnumDifficulty.PEACEFUL && !world.isStatic) {
int l;
EntityWither entitywither;
int j1;
Iterator iterator;
EntityHuman entityhuman;
int i1;
for (i1 = -2; i1 <= 0; ++i1) {
if (world.getTypeId(i, j - 1, k + i1) == l && world.getTypeId(i, j - 1, k + i1 + 1) == l && world.getTypeId(i, j - 2, k + i1 + 1) == l && world.getTypeId(i, j - 1, k + i1 + 2) == l && this.d(world, i, j, k + i1, 1) && this.d(world, i, j, k + i1 + 1, 1) && this.d(world, i, j, k + i1 + 2, 1)) {
for (l = -2; l <= 0; ++l) {
if (world.getType(i, j - 1, k + l) == Blocks.SOUL_SAND && world.getType(i, j - 1, k + l + 1) == Blocks.SOUL_SAND && world.getType(i, j - 2, k + l + 1) == Blocks.SOUL_SAND && world.getType(i, j - 1, k + l + 2) == Blocks.SOUL_SAND && this.a(world, i, j, k + l, 1) && this.a(world, i, j, k + l + 1, 1) && this.a(world, i, j, k + l + 2, 1)) {
// CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
world.setData(i, j, k + i1, 8, 2);
world.setData(i, j, k + i1 + 1, 8, 2);
world.setData(i, j, k + i1 + 2, 8, 2);
world.setData(i, j, k + l, 8, 2);
world.setData(i, j, k + l + 1, 8, 2);
world.setData(i, j, k + l + 2, 8, 2);
blockList.setTypeId(i, j, k + i1, 0);
blockList.setTypeId(i, j, k + i1 + 1, 0);
blockList.setTypeId(i, j, k + i1 + 2, 0);
blockList.setTypeId(i, j - 1, k + i1, 0);
blockList.setTypeId(i, j - 1, k + i1 + 1, 0);
blockList.setTypeId(i, j - 1, k + i1 + 2, 0);
blockList.setTypeId(i, j - 2, k + i1 + 1, 0);
blockList.setTypeAndData(i, j, k + l, e(0), 0, 2);
blockList.setTypeAndData(i, j, k + l + 1, e(0), 0, 2);
blockList.setTypeAndData(i, j, k + l + 2, e(0), 0, 2);
blockList.setTypeAndData(i, j - 1, k + l, e(0), 0, 2);
blockList.setTypeAndData(i, j - 1, k + l + 1, e(0), 0, 2);
blockList.setTypeAndData(i, j - 1, k + l + 2, e(0), 0, 2);
blockList.setTypeAndData(i, j - 2, k + l + 1, e(0), 0, 2);
if (!world.isStatic) {
entitywither = new EntityWither(world);
entitywither.setPositionRotation((double) i + 0.5D, (double) j - 1.45D, (double) (k + i1) + 1.5D, 90.0F, 0.0F);
entitywither.setPositionRotation((double) i + 0.5D, (double) j - 1.45D, (double) (k + l) + 1.5D, 90.0F, 0.0F);
entitywither.aN = 90.0F;
entitywither.bT();
entitywither.bX();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
if (!world.isStatic) {
iterator = world.a(EntityHuman.class, entitywither.boundingBox.grow(50.0D, 50.0D, 50.0D)).iterator();
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
entityhuman.a((Statistic) AchievementList.I);
}
}
blockList.updateList();
}
}
for (j1 = 0; j1 < 120; ++j1) {
world.addParticle("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) (k + i1 + 1) + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
for (i1 = 0; i1 < 120; ++i1) {
world.addParticle("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) (k + l + 1) + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
}
// CraftBukkit end
return;
}
}
for (i1 = -2; i1 <= 0; ++i1) {
if (world.getTypeId(i + i1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 2, k) == l && world.getTypeId(i + i1 + 2, j - 1, k) == l && this.d(world, i + i1, j, k, 1) && this.d(world, i + i1 + 1, j, k, 1) && this.d(world, i + i1 + 2, j, k, 1)) {
for (l = -2; l <= 0; ++l) {
if (world.getType(i + l, j - 1, k) == Blocks.SOUL_SAND && world.getType(i + l + 1, j - 1, k) == Blocks.SOUL_SAND && world.getType(i + l + 1, j - 2, k) == Blocks.SOUL_SAND && world.getType(i + l + 2, j - 1, k) == Blocks.SOUL_SAND && this.a(world, i + l, j, k, 1) && this.a(world, i + l + 1, j, k, 1) && this.a(world, i + l + 2, j, k, 1)) {
// CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
world.setData(i + i1, j, k, 8, 2);
world.setData(i + i1 + 1, j, k, 8, 2);
world.setData(i + i1 + 2, j, k, 8, 2);
blockList.setTypeId(i + i1, j, k, 0);
blockList.setTypeId(i + i1 + 1, j, k, 0);
blockList.setTypeId(i + i1 + 2, j, k, 0);
blockList.setTypeId(i + i1, j - 1, k, 0);
blockList.setTypeId(i + i1 + 1, j - 1, k, 0);
blockList.setTypeId(i + i1 + 2, j - 1, k, 0);
blockList.setTypeId(i + i1 + 1, j - 2, k, 0);
world.setData(i + l, j, k, 8, 2);
world.setData(i + l + 1, j, k, 8, 2);
world.setData(i + l + 2, j, k, 8, 2);
blockList.setTypeAndData(i + l, j, k, e(0), 0, 2);
blockList.setTypeAndData(i + l + 1, j, k, e(0), 0, 2);
blockList.setTypeAndData(i + l + 2, j, k, e(0), 0, 2);
blockList.setTypeAndData(i + l, j - 1, k, e(0), 0, 2);
blockList.setTypeAndData(i + l + 1, j - 1, k, e(0), 0, 2);
blockList.setTypeAndData(i + l + 2, j - 1, k, e(0), 0, 2);
blockList.setTypeAndData(i + l + 1, j - 2, k, e(0), 0, 2);
if (!world.isStatic) {
entitywither = new EntityWither(world);
entitywither.setPositionRotation((double) (i + i1) + 1.5D, (double) j - 1.45D, (double) k + 0.5D, 0.0F, 0.0F);
entitywither.bT();
entitywither.setPositionRotation((double) (i + l) + 1.5D, (double) j - 1.45D, (double) k + 0.5D, 0.0F, 0.0F);
entitywither.bX();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
if (!world.isStatic) {
iterator = world.a(EntityHuman.class, entitywither.boundingBox.grow(50.0D, 50.0D, 50.0D)).iterator();
while (iterator.hasNext()) {
entityhuman = (EntityHuman) iterator.next();
entityhuman.a((Statistic) AchievementList.I);
}
}
blockList.updateList();
}
}
for (j1 = 0; j1 < 120; ++j1) {
world.addParticle("snowballpoof", (double) (i + i1 + 1) + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
for (i1 = 0; i1 < 120; ++i1) {
world.addParticle("snowballpoof", (double) (i + l + 1) + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
}
// CraftBukkit end
@ -209,8 +226,8 @@ public class BlockSkull extends BlockContainer {
}
}
private boolean d(World world, int i, int j, int k, int l) {
if (world.getTypeId(i, j, k) != this.id) {
private boolean a(World world, int i, int j, int k, int l) {
if (world.getType(i, j, k) != this) {
return false;
} else {
TileEntity tileentity = world.getTileEntity(i, j, k);

Datei anzeigen

@ -4,15 +4,15 @@ import java.util.Random;
public class BlockSnow extends Block {
protected BlockSnow(int i) {
super(i, Material.SNOW_LAYER);
protected BlockSnow() {
super(Material.PACKED_ICE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
this.b(true);
this.a(true);
this.a(CreativeModeTab.c);
this.d(0);
this.b(0);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
int l = world.getData(i, j, k) & 7;
float f = 0.125F;
@ -23,19 +23,19 @@ public class BlockSnow extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public void g() {
this.d(0);
this.b(0);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.d(iblockaccess.getData(i, j, k));
this.b(iblockaccess.getData(i, j, k));
}
protected void d(int i) {
protected void b(int i) {
int j = i & 7;
float f = (float) (2 * (1 + j)) / 16.0F;
@ -43,18 +43,18 @@ public class BlockSnow extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j - 1, k);
Block block = world.getType(i, j - 1, k);
return l == 0 ? false : (l == this.id && (world.getData(i, j - 1, k) & 7) == 7 ? true : (l != Block.LEAVES.id && !Block.byId[l].c() ? false : world.getMaterial(i, j - 1, k).isSolid()));
return block != Blocks.ICE && block != Blocks.PACKED_ICE ? (block.getMaterial() == Material.LEAVES ? true : (block == this && (world.getData(i, j - 1, k) & 7) == 7 ? true : block.c() && block.material.isSolid())) : false;
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
this.m(world, i, j, k);
}
private boolean m(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@ -63,16 +63,15 @@ public class BlockSnow extends Block {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
int i1 = Item.SNOW_BALL.id;
int j1 = l & 7;
int i1 = l & 7;
this.b(world, i, j, k, new ItemStack(i1, j1 + 1, 0));
this.a(world, i, j, k, new ItemStack(Items.SNOW_BALL, i1 + 1, 0));
world.setAir(i, j, k);
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
}
public int getDropType(int i, Random random, int j) {
return Item.SNOW_BALL.id;
public Item getDropType(int i, Random random, int j) {
return Items.SNOW_BALL;
}
public int a(Random random) {
@ -82,12 +81,12 @@ public class BlockSnow extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), 0).isCancelled()) {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Blocks.AIR).isCancelled()) {
return;
}
// CraftBukkit end
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}

Datei anzeigen

@ -9,14 +9,14 @@ import org.bukkit.craftbukkit.event.CraftEventFactory;
public class BlockSoil extends Block {
protected BlockSoil(int i) {
super(i, Material.EARTH);
this.b(true);
protected BlockSoil() {
super(Material.EARTH);
this.a(true);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
this.k(255);
this.g(255);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return AxisAlignedBB.a().a((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
}
@ -24,7 +24,7 @@ public class BlockSoil extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
@ -34,15 +34,15 @@ public class BlockSoil extends Block {
if (l > 0) {
world.setData(i, j, k, l - 1, 2);
} else if (!this.k(world, i, j, k)) {
} else if (!this.e(world, i, j, k)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
if (CraftEventFactory.callBlockFadeEvent(block, Block.DIRT.id).isCancelled()) {
if (CraftEventFactory.callBlockFadeEvent(block, Blocks.DIRT).isCancelled()) {
return;
}
// CraftBukkit end
world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
world.setTypeUpdate(i, j, k, Blocks.DIRT);
}
} else {
world.setData(i, j, k, 7, 2);
@ -69,18 +69,18 @@ public class BlockSoil extends Block {
}
// CraftBukkit end
world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
world.setTypeUpdate(i, j, k, Blocks.DIRT);
}
}
private boolean k(World world, int i, int j, int k) {
private boolean e(World world, int i, int j, int k) {
byte b0 = 0;
for (int l = i - b0; l <= i + b0; ++l) {
for (int i1 = k - b0; i1 <= k + b0; ++i1) {
int j1 = world.getTypeId(l, j + 1, i1);
Block block = world.getType(l, j + 1, i1);
if (j1 == Block.CROPS.id || j1 == Block.MELON_STEM.id || j1 == Block.PUMPKIN_STEM.id || j1 == Block.POTATOES.id || j1 == Block.CARROTS.id) {
if (block == Blocks.CROPS || block == Blocks.MELON_STEM || block == Blocks.PUMPKIN_STEM || block == Blocks.POTATOES || block == Blocks.CARROTS) {
return true;
}
}
@ -93,7 +93,7 @@ public class BlockSoil extends Block {
for (int l = i - 4; l <= i + 4; ++l) {
for (int i1 = j; i1 <= j + 1; ++i1) {
for (int j1 = k - 4; j1 <= k + 4; ++j1) {
if (world.getMaterial(l, i1, j1) == Material.WATER) {
if (world.getType(l, i1, j1).getMaterial() == Material.WATER) {
return true;
}
}
@ -103,16 +103,16 @@ public class BlockSoil extends Block {
return false;
}
public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l);
Material material = world.getMaterial(i, j + 1, k);
public void doPhysics(World world, int i, int j, int k, Block block) {
super.doPhysics(world, i, j, k, block);
Material material = world.getType(i, j + 1, k).getMaterial();
if (material.isBuildable()) {
world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
world.setTypeUpdate(i, j, k, Blocks.DIRT);
}
}
public int getDropType(int i, Random random, int j) {
return Block.DIRT.getDropType(0, random, j);
public Item getDropType(int i, Random random, int j) {
return Blocks.DIRT.getDropType(0, random, j);
}
}

Datei anzeigen

@ -6,30 +6,26 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockStationary extends BlockFluids {
protected BlockStationary(int i, Material material) {
super(i, material);
this.b(false);
protected BlockStationary(Material material) {
super(material);
this.a(false);
if (material == Material.LAVA) {
this.b(true);
this.a(true);
}
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l);
if (world.getTypeId(i, j, k) == this.id) {
this.k(world, i, j, k);
public void doPhysics(World world, int i, int j, int k, Block block) {
super.doPhysics(world, i, j, k, block);
if (world.getType(i, j, k) == this) {
this.n(world, i, j, k);
}
}
private void k(World world, int i, int j, int k) {
private void n(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
world.setTypeIdAndData(i, j, k, this.id - 1, l, 2);
world.a(i, j, k, this.id - 1, this.a(world));
world.setTypeAndData(i, j, k, Block.e(Block.b((Block) this) - 1), l, 2);
world.a(i, j, k, Block.e(Block.b((Block) this) - 1), this.a(world));
}
public void a(World world, int i, int j, int k, Random random) {
@ -37,7 +33,6 @@ public class BlockStationary extends BlockFluids {
int l = random.nextInt(3);
int i1;
int j1;
// CraftBukkit start - Prevent lava putting something on fire, remember igniter block coords
int x = i;
@ -49,49 +44,50 @@ public class BlockStationary extends BlockFluids {
i += random.nextInt(3) - 1;
++j;
k += random.nextInt(3) - 1;
j1 = world.getTypeId(i, j, k);
if (j1 == 0) {
if (this.m(world, i - 1, j, k) || this.m(world, i + 1, j, k) || this.m(world, i, j, k - 1) || this.m(world, i, j, k + 1) || this.m(world, i, j - 1, k) || this.m(world, i, j + 1, k)) {
Block block = world.getType(i, j, k);
if (block.material == Material.AIR) {
if (this.o(world, i - 1, j, k) || this.o(world, i + 1, j, k) || this.o(world, i, j, k - 1) || this.o(world, i, j, k + 1) || this.o(world, i, j - 1, k) || this.o(world, i, j + 1, k)) {
// CraftBukkit start - Prevent lava putting something on fire
if (world.getTypeId(i, j, k) != Block.FIRE.id) {
if (world.getType(i, j, k) != Blocks.FIRE) {
if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, x, y, z).isCancelled()) {
continue;
}
}
// CraftBukkit end
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
world.setTypeUpdate(i, j, k, Blocks.FIRE);
return;
}
} else if (Block.byId[j1].material.isSolid()) {
} else if (block.material.isSolid()) {
return;
}
}
if (l == 0) {
i1 = i;
j1 = k;
int j1 = k;
for (int k1 = 0; k1 < 3; ++k1) {
i = i1 + random.nextInt(3) - 1;
k = j1 + random.nextInt(3) - 1;
if (world.isEmpty(i, j + 1, k) && this.m(world, i, j, k)) {
if (world.isEmpty(i, j + 1, k) && this.o(world, i, j, k)) {
// CraftBukkit start - Prevent lava putting something on fire
if (world.getTypeId(i, j + 1, k) != Block.FIRE.id) {
if (world.getType(i, j + 1, k) != Blocks.FIRE) {
if (CraftEventFactory.callBlockIgniteEvent(world, i, j + 1, k, x, y, z).isCancelled()) {
continue;
}
}
// CraftBukkit end
world.setTypeIdUpdate(i, j + 1, k, Block.FIRE.id);
world.setTypeUpdate(i, j + 1, k, Blocks.FIRE);
}
}
}
}
}
private boolean m(World world, int i, int j, int k) {
return world.getMaterial(i, j, k).isBurnable();
private boolean o(World world, int i, int j, int k) {
return world.getType(i, j, k).getMaterial().isBurnable();
}
}

Datei anzeigen

@ -4,48 +4,48 @@ import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockStem extends BlockFlower {
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
private final Block blockFruit;
protected BlockStem(int i, Block block) {
super(i);
protected BlockStem(Block block) {
this.blockFruit = block;
this.b(true);
this.a(true);
float f = 0.125F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
this.a((CreativeModeTab) null);
}
protected boolean g_(int i) {
return i == Block.SOIL.id;
protected boolean a(Block block) {
return block == Blocks.SOIL;
}
public void a(World world, int i, int j, int k, Random random) {
super.a(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9) {
float f = this.m(world, i, j, k);
float f = this.n(world, i, j, k);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
int l = world.getData(i, j, k);
if (l < 7) {
CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
++l;
CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this, l); // CraftBukkit
} else {
if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
if (world.getType(i - 1, j, k) == this.blockFruit) {
return;
}
if (world.getTypeId(i + 1, j, k) == this.blockFruit.id) {
if (world.getType(i + 1, j, k) == this.blockFruit) {
return;
}
if (world.getTypeId(i, j, k - 1) == this.blockFruit.id) {
if (world.getType(i, j, k - 1) == this.blockFruit) {
return;
}
if (world.getTypeId(i, j, k + 1) == this.blockFruit.id) {
if (world.getType(i, j, k + 1) == this.blockFruit) {
return;
}
@ -69,17 +69,17 @@ public class BlockStem extends BlockFlower {
++k1;
}
int l1 = world.getTypeId(j1, j - 1, k1);
Block block = world.getType(j1, j - 1, k1);
if (world.getTypeId(j1, j, k1) == 0 && (l1 == Block.SOIL.id || l1 == Block.DIRT.id || l1 == Block.GRASS.id)) {
CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit.id, 0); // CraftBukkit
if (world.getType(j1, j, k1).material == Material.AIR && (block == Blocks.SOIL || block == Blocks.DIRT || block == Blocks.GRASS)) {
CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit, 0); // CraftBukkit
}
}
}
}
}
public void k(World world, int i, int j, int k) {
public void m(World world, int i, int j, int k) {
int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
if (l > 7) {
@ -89,33 +89,33 @@ public class BlockStem extends BlockFlower {
world.setData(i, j, k, l, 2);
}
private float m(World world, int i, int j, int k) {
private float n(World world, int i, int j, int k) {
float f = 1.0F;
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
int j1 = world.getTypeId(i - 1, j, k);
int k1 = world.getTypeId(i + 1, j, k);
int l1 = world.getTypeId(i - 1, j, k - 1);
int i2 = world.getTypeId(i + 1, j, k - 1);
int j2 = world.getTypeId(i + 1, j, k + 1);
int k2 = world.getTypeId(i - 1, j, k + 1);
boolean flag = j1 == this.id || k1 == this.id;
boolean flag1 = l == this.id || i1 == this.id;
boolean flag2 = l1 == this.id || i2 == this.id || j2 == this.id || k2 == this.id;
Block block = world.getType(i, j, k - 1);
Block block1 = world.getType(i, j, k + 1);
Block block2 = world.getType(i - 1, j, k);
Block block3 = world.getType(i + 1, j, k);
Block block4 = world.getType(i - 1, j, k - 1);
Block block5 = world.getType(i + 1, j, k - 1);
Block block6 = world.getType(i + 1, j, k + 1);
Block block7 = world.getType(i - 1, j, k + 1);
boolean flag = block2 == this || block3 == this;
boolean flag1 = block == this || block1 == this;
boolean flag2 = block4 == this || block5 == this || block6 == this || block7 == this;
for (int l2 = i - 1; l2 <= i + 1; ++l2) {
for (int i3 = k - 1; i3 <= k + 1; ++i3) {
int j3 = world.getTypeId(l2, j - 1, i3);
for (int l = i - 1; l <= i + 1; ++l) {
for (int i1 = k - 1; i1 <= k + 1; ++i1) {
Block block8 = world.getType(l, j - 1, i1);
float f1 = 0.0F;
if (j3 == Block.SOIL.id) {
if (block8 == Blocks.SOIL) {
f1 = 1.0F;
if (world.getData(l2, j - 1, i3) > 0) {
if (world.getData(l, j - 1, i1) > 0) {
f1 = 3.0F;
}
}
if (l2 != i || i3 != k) {
if (l != i || i1 != k) {
f1 /= 4.0F;
}
@ -143,7 +143,7 @@ public class BlockStem extends BlockFlower {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, (float) this.maxY, 0.5F + f);
}
public int d() {
public int b() {
return 19;
}
@ -152,27 +152,39 @@ public class BlockStem extends BlockFlower {
if (!world.isStatic) {
Item item = null;
if (this.blockFruit == Block.PUMPKIN) {
item = Item.PUMPKIN_SEEDS;
if (this.blockFruit == Blocks.PUMPKIN) {
item = Items.PUMPKIN_SEEDS;
}
if (this.blockFruit == Block.MELON) {
item = Item.MELON_SEEDS;
if (this.blockFruit == Blocks.MELON) {
item = Items.MELON_SEEDS;
}
for (int j1 = 0; j1 < 3; ++j1) {
if (world.random.nextInt(15) <= l) {
this.b(world, i, j, k, new ItemStack(item));
this.a(world, i, j, k, new ItemStack(item));
}
}
}
}
public int getDropType(int i, Random random, int j) {
return -1;
public Item getDropType(int i, Random random, int j) {
return null;
}
public int a(Random random) {
return 1;
}
public boolean a(World world, int i, int j, int k, boolean flag) {
return world.getData(i, j, k) != 7;
}
public boolean a(World world, Random random, int i, int j, int k) {
return true;
}
public void b(World world, Random random, int i, int j, int k) {
this.m(world, i, j, k);
}
}

Datei anzeigen

@ -4,8 +4,8 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTrapdoor extends Block {
protected BlockTrapdoor(int i, Material material) {
super(i, material);
protected BlockTrapdoor(Material material) {
super(material);
float f = 0.5F;
float f1 = 1.0F;
@ -17,25 +17,25 @@ public class BlockTrapdoor extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return !f(iblockaccess.getData(i, j, k));
return !d(iblockaccess.getData(i, j, k));
}
public int d() {
public int b() {
return 0;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
return super.b(world, i, j, k);
return super.a(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.d(iblockaccess.getData(i, j, k));
this.b(iblockaccess.getData(i, j, k));
}
public void g() {
@ -44,7 +44,7 @@ public class BlockTrapdoor extends Block {
this.a(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F);
}
public void d(int i) {
public void b(int i) {
float f = 0.1875F;
if ((i & 8) != 0) {
@ -53,7 +53,7 @@ public class BlockTrapdoor extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
}
if (f(i)) {
if (d(i)) {
if ((i & 3) == 0) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
@ -96,48 +96,51 @@ public class BlockTrapdoor extends Block {
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic) {
int i1 = world.getData(i, j, k);
int j1 = i;
int k1 = k;
int l = world.getData(i, j, k);
int i1 = i;
int j1 = k;
if ((i1 & 3) == 0) {
k1 = k + 1;
if ((l & 3) == 0) {
j1 = k + 1;
}
if ((i1 & 3) == 1) {
--k1;
}
if ((i1 & 3) == 2) {
j1 = i + 1;
}
if ((i1 & 3) == 3) {
if ((l & 3) == 1) {
--j1;
}
if (!g(world.getTypeId(j1, j, k1))) {
world.setAir(i, j, k);
this.c(world, i, j, k, i1, 0);
if ((l & 3) == 2) {
i1 = i + 1;
}
// CraftBukkit start
if (l == 0 || l > 0 && Block.byId[l] != null && Block.byId[l].isPowerSource()) {
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
if ((l & 3) == 3) {
--i1;
}
int power = block.getBlockPower();
if (!a(world.getType(i1, j, j1))) {
world.setAir(i, j, k);
this.b(world, i, j, k, l, 0);
}
boolean flag = world.isBlockIndirectlyPowered(i, j, k);
if (flag || block.isPowerSource()) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.Block bblock = bworld.getBlockAt(i, j, k);
int power = bblock.getBlockPower();
int oldPower = (world.getData(i, j, k) & 4) > 0 ? 15 : 0;
if (oldPower == 0 ^ power == 0 || (Block.byId[l] != null && Block.byId[l].isPowerSource())) {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power);
if (oldPower == 0 ^ power == 0 || block.isPowerSource()) {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
this.setOpen(world, i, j, k, eventRedstone.getNewCurrent() > 0);
flag = eventRedstone.getNewCurrent() > 0;
}
// CraftBukkit end
this.setOpen(world, i, j, k, flag);
}
}
}
@ -195,21 +198,15 @@ public class BlockTrapdoor extends Block {
--i;
}
return g(world.getTypeId(i, j, k));
return a(world.getType(i, j, k));
}
}
public static boolean f(int i) {
public static boolean d(int i) {
return (i & 4) != 0;
}
private static boolean g(int i) {
if (i <= 0) {
return false;
} else {
Block block = Block.byId[i];
return block != null && block.material.k() && block.b() || block == Block.GLOWSTONE || block instanceof BlockStepAbstract || block instanceof BlockStairs;
}
private static boolean a(Block block) {
return block.material.k() && block.d() || block == Blocks.GLOWSTONE || block instanceof BlockStepAbstract || block instanceof BlockStairs;
}
}

Datei anzeigen

@ -8,17 +8,17 @@ import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
public class BlockTripwire extends Block {
public BlockTripwire(int i) {
super(i, Material.ORIENTABLE);
public BlockTripwire() {
super(Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
this.b(true);
this.a(true);
}
public int a(World world) {
return 10;
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -26,25 +26,25 @@ public class BlockTripwire extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 30;
}
public int getDropType(int i, Random random, int j) {
return Item.STRING.id;
public Item getDropType(int i, Random random, int j) {
return Items.STRING;
}
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
boolean flag = (i1 & 2) == 2;
boolean flag1 = !world.w(i, j - 1, k);
public void doPhysics(World world, int i, int j, int k, Block block) {
int l = world.getData(i, j, k);
boolean flag = (l & 2) == 2;
boolean flag1 = !World.a((IBlockAccess) world, i, j - 1, k);
if (flag != flag1) {
this.c(world, i, j, k, i1, 0);
this.b(world, i, j, k, l, 0);
world.setAir(i, j, k);
}
}
@ -64,25 +64,25 @@ public class BlockTripwire extends Block {
}
public void onPlace(World world, int i, int j, int k) {
int l = world.w(i, j - 1, k) ? 0 : 2;
int l = World.a((IBlockAccess) world, i, j - 1, k) ? 0 : 2;
world.setData(i, j, k, l, 3);
this.d(world, i, j, k, l);
this.a(world, i, j, k, l);
}
public void remove(World world, int i, int j, int k, int l, int i1) {
this.d(world, i, j, k, i1 | 1);
public void remove(World world, int i, int j, int k, Block block, int l) {
this.a(world, i, j, k, l | 1);
}
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (!world.isStatic) {
if (entityhuman.by() != null && entityhuman.by().id == Item.SHEARS.id) {
if (entityhuman.bD() != null && entityhuman.bD().getItem() == Items.SHEARS) {
world.setData(i, j, k, l | 8, 4);
}
}
}
private void d(World world, int i, int j, int k, int l) {
private void a(World world, int i, int j, int k, int l) {
int i1 = 0;
while (i1 < 2) {
@ -92,15 +92,15 @@ public class BlockTripwire extends Block {
if (j1 < 42) {
int k1 = i + Direction.a[i1] * j1;
int l1 = k + Direction.b[i1] * j1;
int i2 = world.getTypeId(k1, j, l1);
Block block = world.getType(k1, j, l1);
if (i2 == Block.TRIPWIRE_SOURCE.id) {
int j2 = world.getData(k1, j, l1) & 3;
if (block == Blocks.TRIPWIRE_SOURCE) {
int i2 = world.getData(k1, j, l1) & 3;
if (j2 == Direction.f[i1]) {
Block.TRIPWIRE_SOURCE.a(world, k1, j, l1, i2, world.getData(k1, j, l1), true, j1, l);
if (i2 == Direction.f[i1]) {
Blocks.TRIPWIRE_SOURCE.a(world, k1, j, l1, false, world.getData(k1, j, l1), true, j1, l);
}
} else if (i2 == Block.TRIPWIRE.id) {
} else if (block == Blocks.TRIPWIRE) {
++j1;
continue;
}
@ -115,7 +115,7 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, Entity entity) {
if (!world.isStatic) {
if ((world.getData(i, j, k) & 1) != 1) {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
}
}
@ -123,12 +123,12 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if ((world.getData(i, j, k) & 1) == 1) {
this.k(world, i, j, k);
this.e(world, i, j, k);
}
}
}
private void k(World world, int i, int j, int k) {
private void e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
boolean flag = (l & 1) == 1;
boolean flag1 = false;
@ -140,7 +140,7 @@ public class BlockTripwire extends Block {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
if (!entity.au()) {
if (!entity.az()) {
flag1 = true;
break;
}
@ -191,11 +191,11 @@ public class BlockTripwire extends Block {
if (flag1 != flag) {
world.setData(i, j, k, l, 3);
this.d(world, i, j, k, l);
this.a(world, i, j, k, l);
}
if (flag1) {
world.a(i, j, k, this.id, this.a(world));
world.a(i, j, k, this, this.a(world));
}
}
}

Datei anzeigen

@ -6,13 +6,13 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTripwireHook extends Block {
public BlockTripwireHook(int i) {
super(i, Material.ORIENTABLE);
public BlockTripwireHook() {
super(Material.ORIENTABLE);
this.a(CreativeModeTab.d);
this.b(true);
this.a(true);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
@ -20,11 +20,11 @@ public class BlockTripwireHook extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
public int d() {
public int b() {
return 29;
}
@ -33,11 +33,11 @@ public class BlockTripwireHook extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)));
return l == 2 && world.getType(i, j, k + 1).r() ? true : (l == 3 && world.getType(i, j, k - 1).r() ? true : (l == 4 && world.getType(i + 1, j, k).r() ? true : l == 5 && world.getType(i - 1, j, k).r()));
}
public boolean canPlace(World world, int i, int j, int k) {
return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : world.u(i, j, k + 1)));
return world.getType(i - 1, j, k).r() ? true : (world.getType(i + 1, j, k).r() ? true : (world.getType(i, j, k - 1).r() ? true : world.getType(i, j, k + 1).r()));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@ -63,100 +63,102 @@ public class BlockTripwireHook extends Block {
}
public void postPlace(World world, int i, int j, int k, int l) {
this.a(world, i, j, k, this.id, l, false, -1, 0);
this.a(world, i, j, k, false, l, false, -1, 0);
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (l != this.id) {
if (this.k(world, i, j, k)) {
int i1 = world.getData(i, j, k);
int j1 = i1 & 3;
public void doPhysics(World world, int i, int j, int k, Block block) {
if (block != this) {
if (this.e(world, i, j, k)) {
int l = world.getData(i, j, k);
int i1 = l & 3;
boolean flag = false;
if (!world.u(i - 1, j, k) && j1 == 3) {
if (!world.getType(i - 1, j, k).r() && i1 == 3) {
flag = true;
}
if (!world.u(i + 1, j, k) && j1 == 1) {
if (!world.getType(i + 1, j, k).r() && i1 == 1) {
flag = true;
}
if (!world.u(i, j, k - 1) && j1 == 0) {
if (!world.getType(i, j, k - 1).r() && i1 == 0) {
flag = true;
}
if (!world.u(i, j, k + 1) && j1 == 2) {
if (!world.getType(i, j, k + 1).r() && i1 == 2) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, i1, 0);
this.b(world, i, j, k, l, 0);
world.setAir(i, j, k);
}
}
}
}
public void a(World world, int i, int j, int k, int l, int i1, boolean flag, int j1, int k1) {
int l1 = i1 & 3;
boolean flag1 = (i1 & 4) == 4;
boolean flag2 = (i1 & 8) == 8;
boolean flag3 = l == Block.TRIPWIRE_SOURCE.id;
boolean flag4 = false;
boolean flag5 = !world.w(i, j - 1, k);
int i2 = Direction.a[l1];
int j2 = Direction.b[l1];
int k2 = 0;
public void a(World world, int i, int j, int k, boolean flag, int l, boolean flag1, int i1, int j1) {
int k1 = l & 3;
boolean flag2 = (l & 4) == 4;
boolean flag3 = (l & 8) == 8;
boolean flag4 = !flag;
boolean flag5 = false;
boolean flag6 = !World.a((IBlockAccess) world, i, j - 1, k);
int l1 = Direction.a[k1];
int i2 = Direction.b[k1];
int j2 = 0;
int[] aint = new int[42];
int k2;
int l2;
int i3;
int j3;
int k3;
int l3;
for (i3 = 1; i3 < 42; ++i3) {
l2 = i + i2 * i3;
k3 = k + j2 * i3;
j3 = world.getTypeId(l2, j, k3);
if (j3 == Block.TRIPWIRE_SOURCE.id) {
l3 = world.getData(l2, j, k3);
if ((l3 & 3) == Direction.f[l1]) {
k2 = i3;
for (l2 = 1; l2 < 42; ++l2) {
k2 = i + l1 * l2;
i3 = k + i2 * l2;
Block block = world.getType(k2, j, i3);
if (block == Blocks.TRIPWIRE_SOURCE) {
j3 = world.getData(k2, j, i3);
if ((j3 & 3) == Direction.f[k1]) {
j2 = l2;
}
break;
}
if (j3 != Block.TRIPWIRE.id && i3 != j1) {
aint[i3] = -1;
flag3 = false;
if (block != Blocks.TRIPWIRE && l2 != i1) {
aint[l2] = -1;
flag4 = false;
} else {
l3 = i3 == j1 ? k1 : world.getData(l2, j, k3);
boolean flag6 = (l3 & 8) != 8;
boolean flag7 = (l3 & 1) == 1;
boolean flag8 = (l3 & 2) == 2;
j3 = l2 == i1 ? j1 : world.getData(k2, j, i3);
boolean flag7 = (j3 & 8) != 8;
boolean flag8 = (j3 & 1) == 1;
boolean flag9 = (j3 & 2) == 2;
flag3 &= flag8 == flag5;
flag4 |= flag6 && flag7;
aint[i3] = l3;
if (i3 == j1) {
world.a(i, j, k, l, this.a(world));
flag3 &= flag6;
flag4 &= flag9 == flag6;
flag5 |= flag7 && flag8;
aint[l2] = j3;
if (l2 == i1) {
world.a(i, j, k, this, this.a(world));
flag4 &= flag7;
}
}
}
flag3 &= k2 > 1;
flag4 &= flag3;
i3 = (flag3 ? 4 : 0) | (flag4 ? 8 : 0);
i1 = l1 | i3;
if (k2 > 0) {
l2 = i + i2 * k2;
k3 = k + j2 * k2;
j3 = Direction.f[l1];
world.setData(l2, j, k3, j3 | i3, 3);
this.d(world, l2, j, k3, j3);
this.a(world, l2, j, k3, flag3, flag4, flag1, flag2);
flag4 &= j2 > 1;
flag5 &= flag4;
l2 = (flag4 ? 4 : 0) | (flag5 ? 8 : 0);
l = k1 | l2;
int k3;
if (j2 > 0) {
k2 = i + l1 * j2;
i3 = k + i2 * j2;
k3 = Direction.f[k1];
world.setData(k2, j, i3, k3 | l2, 3);
this.a(world, k2, j, i3, k3);
this.a(world, k2, j, i3, flag4, flag5, flag2, flag3);
}
// CraftBukkit start
@ -170,34 +172,34 @@ public class BlockTripwireHook extends Block {
}
// CraftBukkit end
this.a(world, i, j, k, flag3, flag4, flag1, flag2);
if (l > 0) {
world.setData(i, j, k, i1, 3);
if (flag) {
this.d(world, i, j, k, l1);
this.a(world, i, j, k, flag4, flag5, flag2, flag3);
if (!flag) {
world.setData(i, j, k, l, 3);
if (flag1) {
this.a(world, i, j, k, k1);
}
}
if (flag1 != flag3) {
for (l2 = 1; l2 < k2; ++l2) {
k3 = i + i2 * l2;
j3 = k + j2 * l2;
l3 = aint[l2];
if (l3 >= 0) {
if (flag3) {
l3 |= 4;
if (flag2 != flag4) {
for (k2 = 1; k2 < j2; ++k2) {
i3 = i + l1 * k2;
k3 = k + i2 * k2;
j3 = aint[k2];
if (j3 >= 0) {
if (flag4) {
j3 |= 4;
} else {
l3 &= -5;
j3 &= -5;
}
world.setData(k3, j, j3, l3, 3);
world.setData(i3, j, k3, j3, 3);
}
}
}
}
public void a(World world, int i, int j, int k, Random random) {
this.a(world, i, j, k, this.id, world.getData(i, j, k), true, -1, 0);
this.a(world, i, j, k, false, world.getData(i, j, k), true, -1, 0);
}
private void a(World world, int i, int j, int k, boolean flag, boolean flag1, boolean flag2, boolean flag3) {
@ -212,22 +214,22 @@ public class BlockTripwireHook extends Block {
}
}
private void d(World world, int i, int j, int k, int l) {
world.applyPhysics(i, j, k, this.id);
private void a(World world, int i, int j, int k, int l) {
world.applyPhysics(i, j, k, this);
if (l == 3) {
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i - 1, j, k, this);
} else if (l == 1) {
world.applyPhysics(i + 1, j, k, this.id);
world.applyPhysics(i + 1, j, k, this);
} else if (l == 0) {
world.applyPhysics(i, j, k - 1, this.id);
world.applyPhysics(i, j, k - 1, this);
} else if (l == 2) {
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k + 1, this);
}
}
private boolean k(World world, int i, int j, int k) {
private boolean e(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
@ -250,30 +252,30 @@ public class BlockTripwireHook extends Block {
}
}
public void remove(World world, int i, int j, int k, int l, int i1) {
boolean flag = (i1 & 4) == 4;
boolean flag1 = (i1 & 8) == 8;
public void remove(World world, int i, int j, int k, Block block, int l) {
boolean flag = (l & 4) == 4;
boolean flag1 = (l & 8) == 8;
if (flag || flag1) {
this.a(world, i, j, k, 0, i1, false, -1, 0);
this.a(world, i, j, k, true, l, false, -1, 0);
}
if (flag1) {
world.applyPhysics(i, j, k, this.id);
int j1 = i1 & 3;
world.applyPhysics(i, j, k, this);
int i1 = l & 3;
if (j1 == 3) {
world.applyPhysics(i - 1, j, k, this.id);
} else if (j1 == 1) {
world.applyPhysics(i + 1, j, k, this.id);
} else if (j1 == 0) {
world.applyPhysics(i, j, k - 1, this.id);
} else if (j1 == 2) {
world.applyPhysics(i, j, k + 1, this.id);
if (i1 == 3) {
world.applyPhysics(i - 1, j, k, this);
} else if (i1 == 1) {
world.applyPhysics(i + 1, j, k, this);
} else if (i1 == 0) {
world.applyPhysics(i, j, k - 1, this);
} else if (i1 == 2) {
world.applyPhysics(i, j, k + 1, this);
}
}
super.remove(world, i, j, k, l, i1);
super.remove(world, i, j, k, block, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {

Datei anzeigen

@ -6,9 +6,9 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockVine extends Block {
public BlockVine(int i) {
super(i, Material.REPLACEABLE_PLANT);
this.b(true);
public BlockVine() {
super(Material.REPLACEABLE_PLANT);
this.a(true);
this.a(CreativeModeTab.c);
}
@ -16,7 +16,7 @@ public class BlockVine extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public int d() {
public int b() {
return 20;
}
@ -24,7 +24,7 @@ public class BlockVine extends Block {
return false;
}
public boolean b() {
public boolean d() {
return false;
}
@ -79,7 +79,7 @@ public class BlockVine extends Block {
flag = true;
}
if (!flag && this.d(iblockaccess.getTypeId(i, j + 1, k))) {
if (!flag && this.a(iblockaccess.getType(i, j + 1, k))) {
f2 = Math.min(f2, 0.9375F);
f5 = 1.0F;
f1 = 0.0F;
@ -91,43 +91,37 @@ public class BlockVine extends Block {
this.a(f1, f2, f3, f4, f5, f6);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
switch (l) {
case 1:
return this.d(world.getTypeId(i, j + 1, k));
return this.a(world.getType(i, j + 1, k));
case 2:
return this.d(world.getTypeId(i, j, k + 1));
return this.a(world.getType(i, j, k + 1));
case 3:
return this.d(world.getTypeId(i, j, k - 1));
return this.a(world.getType(i, j, k - 1));
case 4:
return this.d(world.getTypeId(i + 1, j, k));
return this.a(world.getType(i + 1, j, k));
case 5:
return this.d(world.getTypeId(i - 1, j, k));
return this.a(world.getType(i - 1, j, k));
default:
return false;
}
}
private boolean d(int i) {
if (i == 0) {
return false;
} else {
Block block = Block.byId[i];
return block.b() && block.material.isSolid();
}
private boolean a(Block block) {
return block.d() && block.material.isSolid();
}
private boolean k(World world, int i, int j, int k) {
private boolean e(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = l;
@ -135,13 +129,13 @@ public class BlockVine extends Block {
for (int j1 = 0; j1 <= 3; ++j1) {
int k1 = 1 << j1;
if ((l & k1) != 0 && !this.d(world.getTypeId(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getTypeId(i, j + 1, k) != this.id || (world.getData(i, j + 1, k) & k1) == 0)) {
if ((l & k1) != 0 && !this.a(world.getType(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getType(i, j + 1, k) != this || (world.getData(i, j + 1, k) & k1) == 0)) {
i1 &= ~k1;
}
}
}
if (i1 == 0 && !this.d(world.getTypeId(i, j + 1, k))) {
if (i1 == 0 && !this.a(world.getType(i, j + 1, k))) {
return false;
} else {
if (i1 != l) {
@ -152,9 +146,9 @@ public class BlockVine extends Block {
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic && !this.k(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
public void doPhysics(World world, int i, int j, int k, Block block) {
if (!world.isStatic && !this.e(world, i, j, k)) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
@ -169,15 +163,15 @@ public class BlockVine extends Block {
int j1;
int k1;
label138:
label134:
for (i1 = i - b0; i1 <= i + b0; ++i1) {
for (j1 = k - b0; j1 <= k + b0; ++j1) {
for (k1 = j - 1; k1 <= j + 1; ++k1) {
if (world.getTypeId(i1, k1, j1) == this.id) {
if (world.getType(i1, k1, j1) == this) {
--l;
if (l <= 0) {
flag = true;
break label138;
break label134;
}
}
}
@ -188,30 +182,31 @@ public class BlockVine extends Block {
j1 = world.random.nextInt(6);
k1 = Direction.e[j1];
int l1;
int i2;
if (j1 == 1 && j < 255 && world.isEmpty(i, j + 1, k)) {
if (flag) {
return;
}
l1 = world.random.nextInt(16) & i1;
if (l1 > 0) {
for (i2 = 0; i2 <= 3; ++i2) {
if (!this.d(world.getTypeId(i + Direction.a[i2], j + 1, k + Direction.b[i2]))) {
l1 &= ~(1 << i2);
int i2 = world.random.nextInt(16) & i1;
if (i2 > 0) {
for (l1 = 0; l1 <= 3; ++l1) {
if (!this.a(world.getType(i + Direction.a[l1], j + 1, k + Direction.b[l1]))) {
i2 &= ~(1 << l1);
}
}
if (l1 > 0) {
if (i2 > 0) {
// CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j + 1, k);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1);
CraftEventFactory.handleBlockSpreadEvent(block, source, this, l1);
// CraftBukkit end
}
}
} else {
Block block;
int j2;
if (j1 >= 2 && j1 <= 5 && (i1 & 1 << k1) == 0) {
@ -219,49 +214,47 @@ public class BlockVine extends Block {
return;
}
l1 = world.getTypeId(i + Direction.a[k1], j, k + Direction.b[k1]);
if (l1 != 0 && Block.byId[l1] != null) {
if (Block.byId[l1].material.k() && Block.byId[l1].b()) {
world.setData(i, j, k, i1 | 1 << k1, 2);
}
} else {
i2 = k1 + 1 & 3;
block = world.getType(i + Direction.a[k1], j, k + Direction.b[k1]);
if (block.material == Material.AIR) {
l1 = k1 + 1 & 3;
j2 = k1 + 3 & 3;
// CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]);
if ((i1 & 1 << i2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) {
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << i2);
} else if ((i1 & 1 << j2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) {
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << j2);
} else if ((i1 & 1 << i2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]) && this.d(world.getTypeId(i + Direction.a[i2], j, k + Direction.b[i2]))) {
block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3));
} else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.d(world.getTypeId(i + Direction.a[j2], j, k + Direction.b[j2]))) {
block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3));
} else if (this.d(world.getTypeId(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 0);
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]);
if ((i1 & 1 << l1) != 0 && this.a(world.getType(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]))) {
CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << l1);
} else if ((i1 & 1 << j2) != 0 && this.a(world.getType(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) {
CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << j2);
} else if ((i1 & 1 << l1) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]) && this.a(world.getType(i + Direction.a[l1], j, k + Direction.b[l1]))) {
bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[l1], j, k + Direction.b[k1] + Direction.b[l1]);
CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
} else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.a(world.getType(i + Direction.a[j2], j, k + Direction.b[j2]))) {
bukkitBlock = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]);
CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
} else if (this.a(world.getType(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 0);
}
// CraftBukkit end
} else if (block.material.k() && block.d()) {
world.setData(i, j, k, i1 | 1 << k1, 2);
}
} else if (j > 1) {
l1 = world.getTypeId(i, j - 1, k);
if (l1 == 0) {
i2 = world.random.nextInt(16) & i1;
if (i2 > 0) {
block = world.getType(i, j - 1, k);
if (block.material == Material.AIR) {
l1 = world.random.nextInt(16) & i1;
if (l1 > 0) {
// CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j - 1, k);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2);
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j - 1, k);
CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, l1);
// CraftBukkit end
}
} else if (l1 == this.id) {
i2 = world.random.nextInt(16) & i1;
} else if (block == this) {
l1 = world.random.nextInt(16) & i1;
j2 = world.getData(i, j - 1, k);
if (j2 != (j2 | i2)) {
world.setData(i, j - 1, k, j2 | i2, 2);
if (j2 != (j2 | l1)) {
world.setData(i, j - 1, k, j2 | l1, 2);
}
}
}
@ -292,8 +285,8 @@ public class BlockVine extends Block {
return b0 != 0 ? b0 : i1;
}
public int getDropType(int i, Random random, int j) {
return 0;
public Item getDropType(int i, Random random, int j) {
return null;
}
public int a(Random random) {
@ -301,9 +294,9 @@ public class BlockVine extends Block {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.by() != null && entityhuman.by().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.VINE, 1, 0));
if (!world.isStatic && entityhuman.bD() != null && entityhuman.bD().getItem() == Items.SHEARS) {
entityhuman.a(StatisticList.C[Block.b((Block) this)], 1);
this.a(world, i, j, k, new ItemStack(Blocks.VINE, 1, 0));
} else {
super.a(world, entityhuman, i, j, k, l);
}

Datei anzeigen

@ -7,44 +7,51 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit; // CraftBukkit
public class Chunk {
private static final Logger t = LogManager.getLogger();
public static boolean a;
private ChunkSection[] sections;
private byte[] s;
private byte[] v;
public int[] b;
public boolean[] c;
public boolean d;
public World world;
public int[] heightMap;
public final int x;
public final int z;
private boolean t;
public final int locX;
public final int locZ;
private boolean w;
public Map tileEntities;
public List[] entitySlices;
public boolean done;
public boolean l;
public boolean lit;
public boolean m;
public long n;
public boolean seenByPlayer;
public int p;
public long q;
private int u;
public boolean n;
public boolean o;
public long p;
public boolean q;
public int r;
public long s;
private int x;
public Chunk(World world, int i, int j) {
this.sections = new ChunkSection[16];
this.s = new byte[256];
this.v = new byte[256];
this.b = new int[256];
this.c = new boolean[256];
this.tileEntities = new HashMap();
this.u = 4096;
this.x = 4096;
this.entitySlices = new List[16];
this.world = world;
this.x = i;
this.z = j;
this.locX = i;
this.locZ = j;
this.heightMap = new int[256];
for (int k = 0; k < this.entitySlices.length; ++k) {
@ -52,7 +59,7 @@ public class Chunk {
}
Arrays.fill(this.b, -999);
Arrays.fill(this.s, (byte) -1);
Arrays.fill(this.v, (byte) -1);
// CraftBukkit start
if (!(this instanceof EmptyChunk)) {
@ -64,23 +71,50 @@ public class Chunk {
public boolean mustSave;
// CraftBukkit end
public Chunk(World world, byte[] abyte, int i, int j) {
public Chunk(World world, Block[] ablock, int i, int j) {
this(world, i, j);
int k = abyte.length / 256;
int k = ablock.length / 256;
boolean flag = !world.worldProvider.g;
for (int l = 0; l < 16; ++l) {
for (int i1 = 0; i1 < 16; ++i1) {
for (int j1 = 0; j1 < k; ++j1) {
byte b0 = abyte[l << 11 | i1 << 7 | j1];
Block block = ablock[l << 11 | i1 << 7 | j1];
if (b0 != 0) {
if (block != null && block.getMaterial() != Material.AIR) {
int k1 = j1 >> 4;
if (this.sections[k1] == null) {
this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.g);
this.sections[k1] = new ChunkSection(k1 << 4, flag);
}
this.sections[k1].setTypeId(l, j1 & 15, i1, b0);
this.sections[k1].setTypeId(l, j1 & 15, i1, block);
}
}
}
}
}
public Chunk(World world, Block[] ablock, byte[] abyte, int i, int j) {
this(world, i, j);
int k = ablock.length / 256;
boolean flag = !world.worldProvider.g;
for (int l = 0; l < 16; ++l) {
for (int i1 = 0; i1 < 16; ++i1) {
for (int j1 = 0; j1 < k; ++j1) {
int k1 = l * k * 16 | i1 * k | j1;
Block block = ablock[k1];
if (block != null && block != Blocks.AIR) {
int l1 = j1 >> 4;
if (this.sections[l1] == null) {
this.sections[l1] = new ChunkSection(l1 << 4, flag);
}
this.sections[l1].setTypeId(l, j1 & 15, i1, block);
this.sections[l1].setData(l, j1 & 15, i1, abyte[k1]);
}
}
}
@ -88,7 +122,7 @@ public class Chunk {
}
public boolean a(int i, int j) {
return i == this.x && j == this.z;
return i == this.locX && j == this.locZ;
}
public int b(int i, int j) {
@ -112,13 +146,10 @@ public class Chunk {
public void initLighting() {
int i = this.h();
this.p = Integer.MAX_VALUE;
this.r = Integer.MAX_VALUE;
int j;
int k;
for (j = 0; j < 16; ++j) {
k = 0;
for (int j = 0; j < 16; ++j) {
int k = 0;
while (k < 16) {
this.b[j + (k << 4)] = -999;
@ -132,8 +163,8 @@ public class Chunk {
}
this.heightMap[k << 4 | j] = l;
if (l < this.p) {
this.p = l;
if (l < this.r) {
this.r = l;
}
}
@ -142,13 +173,19 @@ public class Chunk {
int i1 = i + 16 - 1;
do {
l -= this.b(j, i1, k);
int j1 = this.b(j, i1, k);
if (j1 == 0 && l != 15) {
j1 = 1;
}
l -= j1;
if (l > 0) {
ChunkSection chunksection = this.sections[i1 >> 4];
if (chunksection != null) {
chunksection.setSkyLight(j, i1 & 15, k, l);
this.world.p((this.x << 4) + j, i1, (this.z << 4) + k);
this.world.m((this.locX << 4) + j, i1, (this.locZ << 4) + k);
}
}
@ -162,30 +199,24 @@ public class Chunk {
}
}
this.l = true;
for (j = 0; j < 16; ++j) {
for (k = 0; k < 16; ++k) {
this.e(j, k);
}
}
this.n = true;
}
private void e(int i, int j) {
this.c[i + j * 16] = true;
this.t = true;
this.w = true;
}
private void q() {
private void c(boolean flag) {
this.world.methodProfiler.a("recheckGaps");
if (this.world.areChunksLoaded(this.x * 16 + 8, 0, this.z * 16 + 8, 16)) {
if (this.world.areChunksLoaded(this.locX * 16 + 8, 0, this.locZ * 16 + 8, 16)) {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
if (this.c[i + j * 16]) {
this.c[i + j * 16] = false;
int k = this.b(i, j);
int l = this.x * 16 + i;
int i1 = this.z * 16 + j;
int l = this.locX * 16 + i;
int i1 = this.locZ * 16 + j;
int j1 = this.world.g(l - 1, i1);
int k1 = this.world.g(l + 1, i1);
int l1 = this.world.g(l, i1 - 1);
@ -208,11 +239,15 @@ public class Chunk {
this.g(l + 1, i1, k);
this.g(l, i1 - 1, k);
this.g(l, i1 + 1, k);
if (flag) {
this.world.methodProfiler.b();
return;
}
}
}
}
this.t = false;
this.w = false;
}
this.world.methodProfiler.b();
@ -222,19 +257,19 @@ public class Chunk {
int l = this.world.getHighestBlockYAt(i, j);
if (l > k) {
this.d(i, j, k, l + 1);
this.c(i, j, k, l + 1);
} else if (l < k) {
this.d(i, j, l, k + 1);
this.c(i, j, l, k + 1);
}
}
private void d(int i, int j, int k, int l) {
private void c(int i, int j, int k, int l) {
if (l > k && this.world.areChunksLoaded(i, 0, j, 16)) {
for (int i1 = k; i1 < l; ++i1) {
this.world.c(EnumSkyBlock.SKY, i, i1, j);
}
this.l = true;
this.n = true;
}
}
@ -251,10 +286,10 @@ public class Chunk {
}
if (i1 != l) {
this.world.e(i + this.x * 16, k + this.z * 16, i1, l);
this.world.b(i + this.locX * 16, k + this.locZ * 16, i1, l);
this.heightMap[k << 4 | i] = i1;
int j1 = this.x * 16 + i;
int k1 = this.z * 16 + k;
int j1 = this.locX * 16 + i;
int k1 = this.locZ * 16 + k;
int l1;
int i2;
@ -266,7 +301,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.setSkyLight(i, l1 & 15, k, 15);
this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
this.world.m((this.locX << 4) + i, l1, (this.locZ << 4) + k);
}
}
} else {
@ -274,7 +309,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.setSkyLight(i, l1 & 15, k, 0);
this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
this.world.m((this.locX << 4) + i, l1, (this.locZ << 4) + k);
}
}
}
@ -310,34 +345,46 @@ public class Chunk {
j2 = l;
}
if (l1 < this.p) {
this.p = l1;
if (l1 < this.r) {
this.r = l1;
}
if (!this.world.worldProvider.g) {
this.d(j1 - 1, k1, i2, j2);
this.d(j1 + 1, k1, i2, j2);
this.d(j1, k1 - 1, i2, j2);
this.d(j1, k1 + 1, i2, j2);
this.d(j1, k1, i2, j2);
this.c(j1 - 1, k1, i2, j2);
this.c(j1 + 1, k1, i2, j2);
this.c(j1, k1 - 1, i2, j2);
this.c(j1, k1 + 1, i2, j2);
this.c(j1, k1, i2, j2);
}
this.l = true;
this.n = true;
}
}
public int b(int i, int j, int k) {
return Block.lightBlock[this.getTypeId(i, j, k)];
return this.getType(i, j, k).k();
}
public int getTypeId(int i, int j, int k) {
if (j >> 4 >= this.sections.length) {
return 0;
} else {
public Block getType(int i, int j, int k) {
Block block = Blocks.AIR;
if (j >> 4 < this.sections.length) {
ChunkSection chunksection = this.sections[j >> 4];
return chunksection != null ? chunksection.getTypeId(i, j & 15, k) : 0;
if (chunksection != null) {
try {
block = chunksection.getTypeId(i, j & 15, k);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Getting block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being got");
crashreportsystemdetails.a("Location", (Callable) (new CrashReportLocation(this, i, j, k)));
throw new ReportedException(crashreport);
}
}
}
return block;
}
public int getData(int i, int j, int k) {
@ -350,105 +397,108 @@ public class Chunk {
}
}
public boolean a(int i, int j, int k, int l, int i1) {
int j1 = k << 4 | i;
public boolean a(int i, int j, int k, Block block, int l) {
int i1 = k << 4 | i;
if (j >= this.b[j1] - 1) {
this.b[j1] = -999;
if (j >= this.b[i1] - 1) {
this.b[i1] = -999;
}
int k1 = this.heightMap[j1];
int l1 = this.getTypeId(i, j, k);
int i2 = this.getData(i, j, k);
int j1 = this.heightMap[i1];
Block block1 = this.getType(i, j, k);
int k1 = this.getData(i, j, k);
if (l1 == l && i2 == i1) {
if (block1 == block && k1 == l) {
return false;
} else {
ChunkSection chunksection = this.sections[j >> 4];
boolean flag = false;
if (chunksection == null) {
if (l == 0) {
if (block == Blocks.AIR) {
return false;
}
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.g);
flag = j >= k1;
flag = j >= j1;
}
int j2 = this.x * 16 + i;
int k2 = this.z * 16 + k;
int l1 = this.locX * 16 + i;
int i2 = this.locZ * 16 + k;
if (l1 != 0 && !this.world.isStatic) {
Block.byId[l1].l(this.world, j2, j, k2, i2);
if (!this.world.isStatic) {
block1.f(this.world, l1, j, i2, k1);
}
chunksection.setTypeId(i, j & 15, k, l);
if (l1 != 0) {
if (!this.world.isStatic) {
Block.byId[l1].remove(this.world, j2, j, k2, l1, i2);
} else if (Block.byId[l1] instanceof IContainer && l1 != l) {
this.world.s(j2, j, k2);
}
chunksection.setTypeId(i, j & 15, k, block);
if (!this.world.isStatic) {
block1.remove(this.world, l1, j, i2, block1, k1);
} else if (block1 instanceof IContainer && block1 != block) {
this.world.p(l1, j, i2);
}
if (chunksection.getTypeId(i, j & 15, k) != l) {
if (chunksection.getTypeId(i, j & 15, k) != block) {
return false;
} else {
chunksection.setData(i, j & 15, k, i1);
chunksection.setData(i, j & 15, k, l);
if (flag) {
this.initLighting();
} else {
if (Block.lightBlock[l & 4095] > 0) {
if (j >= k1) {
int j2 = block.k();
int k2 = block1.k();
if (j2 > 0) {
if (j >= j1) {
this.h(i, j + 1, k);
}
} else if (j == k1 - 1) {
} else if (j == j1 - 1) {
this.h(i, j, k);
}
this.e(i, k);
if (j2 != k2 && (j2 < k2 || this.getBrightness(EnumSkyBlock.SKY, i, j, k) > 0 || this.getBrightness(EnumSkyBlock.BLOCK, i, j, k) > 0)) {
this.e(i, k);
}
}
TileEntity tileentity;
if (l != 0) {
// CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer
if (!this.world.isStatic && (!this.world.callingPlaceEvent || (Block.byId[l] instanceof BlockContainer))) {
Block.byId[l].onPlace(this.world, j2, j, k2);
}
if (Block.byId[l] instanceof IContainer) {
// CraftBukkit start - Don't create tile entity if placement failed
if (this.getTypeId(i, j, k) != l) {
return false;
}
// CraftBukkit end
tileentity = this.e(i, j, k);
if (tileentity == null) {
tileentity = ((IContainer) Block.byId[l]).b(this.world);
this.world.setTileEntity(j2, j, k2, tileentity);
}
if (tileentity != null) {
tileentity.i();
}
}
} else if (l1 > 0 && Block.byId[l1] instanceof IContainer) {
if (block1 instanceof IContainer) {
tileentity = this.e(i, j, k);
if (tileentity != null) {
tileentity.i();
tileentity.u();
}
}
this.l = true;
// CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer
if (!this.world.isStatic && (!this.world.callingPlaceEvent || (block instanceof BlockContainer))) {
block.onPlace(this.world, l1, j, i2);
}
if (block instanceof IContainer) {
// CraftBukkit start - Don't create tile entity if placement failed
if (this.getType(i, j, k) != block) {
return false;
}
// CraftBukkit end
tileentity = this.e(i, j, k);
if (tileentity == null) {
tileentity = ((IContainer) block).a(this.world, l);
this.world.setTileEntity(l1, j, i2, tileentity);
}
if (tileentity != null) {
tileentity.u();
}
}
this.n = true;
return true;
}
}
}
public boolean b(int i, int j, int k, int l) {
public boolean a(int i, int j, int k, int l) {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
@ -459,16 +509,14 @@ public class Chunk {
if (i1 == l) {
return false;
} else {
this.l = true;
this.n = true;
chunksection.setData(i, j & 15, k, l);
int j1 = chunksection.getTypeId(i, j & 15, k);
if (j1 > 0 && Block.byId[j1] instanceof IContainer) {
if (chunksection.getTypeId(i, j & 15, k) instanceof IContainer) {
TileEntity tileentity = this.e(i, j, k);
if (tileentity != null) {
tileentity.i();
tileentity.p = l;
tileentity.u();
tileentity.g = l;
}
}
@ -491,7 +539,7 @@ public class Chunk {
this.initLighting();
}
this.l = true;
this.n = true;
if (enumskyblock == EnumSkyBlock.SKY) {
if (!this.world.worldProvider.g) {
chunksection.setSkyLight(i, j & 15, k, l);
@ -501,7 +549,7 @@ public class Chunk {
}
}
public int c(int i, int j, int k, int l) {
public int b(int i, int j, int k, int l) {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
@ -525,15 +573,16 @@ public class Chunk {
}
public void a(Entity entity) {
this.m = true;
this.o = true;
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
if (i != this.x || j != this.z) {
if (i != this.locX || j != this.locZ) {
// CraftBukkit start
Bukkit.getLogger().warning("Wrong location for " + entity + " in world '" + world.getWorld().getName() + "'!");
// t.error("Wrong location! " + entity);
// Thread.dumpStack();
Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.x + "," + this.z);
Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.locX + "," + this.locZ);
// CraftBukkit end
}
@ -547,15 +596,15 @@ public class Chunk {
k = this.entitySlices.length - 1;
}
entity.ai = true;
entity.aj = this.x;
entity.ak = k;
entity.al = this.z;
entity.ah = true;
entity.ai = this.locX;
entity.aj = k;
entity.ak = this.locZ;
this.entitySlices[k].add(entity);
}
public void b(Entity entity) {
this.a(entity, entity.ak);
this.a(entity, entity.aj);
}
public void a(Entity entity, int i) {
@ -579,18 +628,14 @@ public class Chunk {
TileEntity tileentity = (TileEntity) this.tileEntities.get(chunkposition);
if (tileentity == null) {
int l = this.getTypeId(i, j, k);
Block block = this.getType(i, j, k);
if (l <= 0 || !Block.byId[l].t()) {
if (!block.isTileEntity()) {
return null;
}
if (tileentity == null) {
tileentity = ((IContainer) Block.byId[l]).b(this.world);
this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity);
}
tileentity = (TileEntity) this.tileEntities.get(chunkposition);
tileentity = ((IContainer) block).a(this.world, this.getData(i, j, k));
this.world.setTileEntity(this.locX * 16 + i, j, this.locZ * 16 + k, tileentity);
}
if (tileentity != null && tileentity.r()) {
@ -602,9 +647,9 @@ public class Chunk {
}
public void a(TileEntity tileentity) {
int i = tileentity.x - this.x * 16;
int i = tileentity.x - this.locX * 16;
int j = tileentity.y;
int k = tileentity.z - this.z * 16;
int k = tileentity.z - this.locZ * 16;
this.a(i, j, k, tileentity);
if (this.d) {
@ -615,22 +660,22 @@ public class Chunk {
public void a(int i, int j, int k, TileEntity tileentity) {
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
tileentity.b(this.world);
tileentity.x = this.x * 16 + i;
tileentity.a(this.world);
tileentity.x = this.locX * 16 + i;
tileentity.y = j;
tileentity.z = this.z * 16 + k;
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof IContainer) {
tileentity.z = this.locZ * 16 + k;
if (this.getType(i, j, k) instanceof IContainer) {
if (this.tileEntities.containsKey(chunkposition)) {
((TileEntity) this.tileEntities.get(chunkposition)).w_();
((TileEntity) this.tileEntities.get(chunkposition)).s();
}
tileentity.s();
tileentity.t();
this.tileEntities.put(chunkposition, tileentity);
// CraftBukkit start
} else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z
+ " (" + org.bukkit.Material.getMaterial(getTypeId(i, j, k)) + ") where there was no entity tile!");
System.out.println("Chunk coordinates: " + (this.x * 16) + "," + (this.z * 16));
+ " (" + org.bukkit.Material.getMaterial(Block.b(getType(i, j, k))) + ") where there was no entity tile!");
System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
new Exception().printStackTrace();
// CraftBukkit end
}
@ -643,7 +688,7 @@ public class Chunk {
TileEntity tileentity = (TileEntity) this.tileEntities.remove(chunkposition);
if (tileentity != null) {
tileentity.w_();
tileentity.s();
}
}
}
@ -658,7 +703,7 @@ public class Chunk {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
entity.R();
entity.X();
}
this.world.a(this.entitySlices[i]);
@ -694,22 +739,15 @@ public class Chunk {
}
public void e() {
this.l = true;
this.n = true;
}
public void a(Entity entity, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) {
int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
if (i < 0) {
i = 0;
j = Math.max(i, j);
}
if (j >= this.entitySlices.length) {
j = this.entitySlices.length - 1;
i = Math.min(i, j);
}
i = MathHelper.a(i, 0, this.entitySlices.length - 1);
j = MathHelper.a(j, 0, this.entitySlices.length - 1);
for (int k = i; k <= j; ++k) {
List list1 = this.entitySlices[k];
@ -719,7 +757,7 @@ public class Chunk {
if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
Entity[] aentity = entity1.ao();
Entity[] aentity = entity1.at();
if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) {
@ -738,17 +776,8 @@ public class Chunk {
int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
if (i < 0) {
i = 0;
} else if (i >= this.entitySlices.length) {
i = this.entitySlices.length - 1;
}
if (j >= this.entitySlices.length) {
j = this.entitySlices.length - 1;
} else if (j < 0) {
j = 0;
}
i = MathHelper.a(i, 0, this.entitySlices.length - 1);
j = MathHelper.a(j, 0, this.entitySlices.length - 1);
for (int k = i; k <= j; ++k) {
List list1 = this.entitySlices[k];
@ -765,18 +794,18 @@ public class Chunk {
public boolean a(boolean flag) {
if (flag) {
if (this.m && this.world.getTime() != this.n || this.l) {
if (this.o && this.world.getTime() != this.p || this.n) {
return true;
}
} else if (this.m && this.world.getTime() >= this.n + 600L) {
} else if (this.o && this.world.getTime() >= this.p + 600L) {
return true;
}
return this.l;
return this.n;
}
public Random a(long i) {
return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i);
return new Random(this.world.getSeed() + (long) (this.locX * this.locX * 4987142) + (long) (this.locX * 5947611) + (long) (this.locZ * this.locZ) * 4392871L + (long) (this.locZ * 389711) ^ i);
}
public boolean isEmpty() {
@ -811,8 +840,8 @@ public class Chunk {
l = -1;
while (i1 > 0 && l == -1) {
int j1 = this.getTypeId(i, i1, j);
Material material = j1 == 0 ? Material.AIR : Block.byId[j1].material;
Block block = this.getType(i, i1, j);
Material material = block.getMaterial();
if (!material.isSolid() && !material.isLiquid()) {
--i1;
@ -827,14 +856,23 @@ public class Chunk {
return l;
}
public void k() {
if (this.t && !this.world.worldProvider.g) {
this.q();
public void b(boolean flag) {
if (this.w && !this.world.worldProvider.g && !flag) {
this.c(this.world.isStatic);
}
this.m = true;
if (!this.lit && this.done) {
this.p();
}
}
public boolean k() {
return this.m && this.done && this.lit;
}
public ChunkCoordIntPair l() {
return new ChunkCoordIntPair(this.x, this.z);
return new ChunkCoordIntPair(this.locX, this.locZ);
}
public boolean c(int i, int j) {
@ -862,75 +900,160 @@ public class Chunk {
}
public BiomeBase a(int i, int j, WorldChunkManager worldchunkmanager) {
int k = this.s[j << 4 | i] & 255;
int k = this.v[j << 4 | i] & 255;
if (k == 255) {
BiomeBase biomebase = worldchunkmanager.getBiome((this.x << 4) + i, (this.z << 4) + j);
BiomeBase biomebase = worldchunkmanager.getBiome((this.locX << 4) + i, (this.locZ << 4) + j);
k = biomebase.id;
this.s[j << 4 | i] = (byte) (k & 255);
this.v[j << 4 | i] = (byte) (k & 255);
}
return BiomeBase.biomes[k] == null ? BiomeBase.PLAINS : BiomeBase.biomes[k];
return BiomeBase.getBiome(k) == null ? BiomeBase.PLAINS : BiomeBase.getBiome(k);
}
public byte[] m() {
return this.s;
return this.v;
}
public void a(byte[] abyte) {
this.s = abyte;
this.v = abyte;
}
public void n() {
this.u = 0;
this.x = 0;
}
public void o() {
for (int i = 0; i < 8; ++i) {
if (this.u >= 4096) {
if (this.x >= 4096) {
return;
}
int j = this.u % 16;
int k = this.u / 16 % 16;
int l = this.u / 256;
int j = this.x % 16;
int k = this.x / 16 % 16;
int l = this.x / 256;
++this.u;
int i1 = (this.x << 4) + k;
int j1 = (this.z << 4) + l;
++this.x;
int i1 = (this.locX << 4) + k;
int j1 = (this.locZ << 4) + l;
for (int k1 = 0; k1 < 16; ++k1) {
int l1 = (j << 4) + k1;
if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l) == 0) {
if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) {
this.world.A(i1, l1 - 1, j1);
if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l).getMaterial() == Material.AIR) {
if (this.world.getType(i1, l1 - 1, j1).m() > 0) {
this.world.t(i1, l1 - 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) {
this.world.A(i1, l1 + 1, j1);
if (this.world.getType(i1, l1 + 1, j1).m() > 0) {
this.world.t(i1, l1 + 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) {
this.world.A(i1 - 1, l1, j1);
if (this.world.getType(i1 - 1, l1, j1).m() > 0) {
this.world.t(i1 - 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) {
this.world.A(i1 + 1, l1, j1);
if (this.world.getType(i1 + 1, l1, j1).m() > 0) {
this.world.t(i1 + 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) {
this.world.A(i1, l1, j1 - 1);
if (this.world.getType(i1, l1, j1 - 1).m() > 0) {
this.world.t(i1, l1, j1 - 1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) {
this.world.A(i1, l1, j1 + 1);
if (this.world.getType(i1, l1, j1 + 1).m() > 0) {
this.world.t(i1, l1, j1 + 1);
}
this.world.A(i1, l1, j1);
this.world.t(i1, l1, j1);
}
}
}
}
public void p() {
this.done = true;
this.lit = true;
if (!this.world.worldProvider.g) {
if (this.world.b(this.locX * 16 - 1, 0, this.locZ * 16 - 1, this.locX * 16 + 1, 63, this.locZ * 16 + 1)) {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
if (!this.f(i, j)) {
this.lit = false;
break;
}
}
}
if (this.lit) {
Chunk chunk = this.world.getChunkAtWorldCoords(this.locX * 16 - 1, this.locZ * 16);
chunk.a(3);
chunk = this.world.getChunkAtWorldCoords(this.locX * 16 + 16, this.locZ * 16);
chunk.a(1);
chunk = this.world.getChunkAtWorldCoords(this.locX * 16, this.locZ * 16 - 1);
chunk.a(0);
chunk = this.world.getChunkAtWorldCoords(this.locX * 16, this.locZ * 16 + 16);
chunk.a(2);
}
} else {
this.lit = false;
}
}
}
private void a(int i) {
if (this.done) {
int j;
if (i == 3) {
for (j = 0; j < 16; ++j) {
this.f(15, j);
}
} else if (i == 1) {
for (j = 0; j < 16; ++j) {
this.f(0, j);
}
} else if (i == 0) {
for (j = 0; j < 16; ++j) {
this.f(j, 15);
}
} else if (i == 2) {
for (j = 0; j < 16; ++j) {
this.f(j, 0);
}
}
}
}
private boolean f(int i, int j) {
int k = this.h();
boolean flag = false;
boolean flag1 = false;
int l;
for (l = k + 16 - 1; l > 63 || l > 0 && !flag1; --l) {
int i1 = this.b(i, l, j);
if (i1 == 255 && l < 63) {
flag1 = true;
}
if (!flag && i1 > 0) {
flag = true;
} else if (flag && i1 == 0 && !this.world.t(this.locX * 16 + i, l, this.locZ * 16 + j)) {
return false;
}
}
for (; l > 0; --l) {
if (this.getType(i, l, j).m() > 0) {
this.world.t(this.locX * 16 + i, l, this.locZ * 16 + j);
}
}
return true;
}
}

Datei anzeigen

@ -7,6 +7,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// CraftBukkit start
import java.util.Random;
@ -19,20 +22,22 @@ import org.bukkit.event.world.ChunkUnloadEvent;
public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit start
public LongHashSet unloadQueue = new LongHashSet();
private static final Logger b = LogManager.getLogger();
// CraftBukkit start - private -> public
public LongHashSet unloadQueue = new LongHashSet(); // LongHashSet
public Chunk emptyChunk;
public IChunkProvider chunkProvider; // CraftBukkit
private IChunkLoader e;
public IChunkProvider chunkProvider;
private IChunkLoader f;
public boolean forceChunkLoad = false; // true -> false
public LongObjectHashMap<Chunk> chunks = new LongObjectHashMap<Chunk>();
private List chunkList = new ArrayList();
public WorldServer world;
// CraftBukkit end
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
this.emptyChunk = new EmptyChunk(worldserver, 0, 0);
this.world = worldserver;
this.e = ichunkloader;
this.f = ichunkloader;
this.chunkProvider = ichunkprovider;
}
@ -75,7 +80,7 @@ public class ChunkProviderServer implements IChunkProvider {
while (iterator.hasNext()) {
Chunk chunk = (Chunk) iterator.next();
this.queueUnload(chunk.x, chunk.z);
this.queueUnload(chunk.locX, chunk.locZ);
}
}
@ -90,8 +95,8 @@ public class ChunkProviderServer implements IChunkProvider {
boolean newChunk = false;
ChunkRegionLoader loader = null;
if (this.e instanceof ChunkRegionLoader) {
loader = (ChunkRegionLoader) this.e;
if (this.f instanceof ChunkRegionLoader) {
loader = (ChunkRegionLoader) this.f;
}
// If the chunk exists but isn't loaded do it async
@ -123,9 +128,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit
if (chunk != null) {
chunk.addEntities();
}
this.chunkList.add(chunk);
chunk.addEntities();
// CraftBukkit start
Server server = this.world.getServer();
@ -138,7 +142,6 @@ public class ChunkProviderServer implements IChunkProvider {
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk));
}
// CraftBukkit end
chunk.a(this, this, i, j);
}
@ -157,9 +160,9 @@ public class ChunkProviderServer implements IChunkProvider {
chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
if (chunk == this.emptyChunk) return chunk;
if (i != chunk.x || j != chunk.z) {
this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
this.world.getLogger().severe(chunk.getClass().getName());
if (i != chunk.locX || j != chunk.locZ) {
b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
b.error(chunk.getClass().getName());
Throwable ex = new Throwable();
ex.fillInStackTrace();
ex.printStackTrace();
@ -169,14 +172,14 @@ public class ChunkProviderServer implements IChunkProvider {
}
public Chunk loadChunk(int i, int j) { // CraftBukkit - private -> public
if (this.e == null) {
if (this.f == null) {
return null;
} else {
try {
Chunk chunk = this.e.a(this.world, i, j);
Chunk chunk = this.f.a(this.world, i, j);
if (chunk != null) {
chunk.n = this.world.getTime();
chunk.p = this.world.getTime();
if (this.chunkProvider != null) {
this.chunkProvider.recreateStructures(i, j);
}
@ -184,35 +187,35 @@ public class ChunkProviderServer implements IChunkProvider {
return chunk;
} catch (Exception exception) {
exception.printStackTrace();
b.error("Couldn\'t load chunk", exception);
return null;
}
}
}
public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private -> public
if (this.e != null) {
if (this.f != null) {
try {
this.e.b(this.world, chunk);
this.f.b(this.world, chunk);
} catch (Exception exception) {
exception.printStackTrace();
b.error("Couldn\'t save entities", exception);
}
}
}
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
if (this.e != null) {
if (this.f != null) {
try {
chunk.n = this.world.getTime();
this.e.a(this.world, chunk);
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
ioexception.printStackTrace();
// CraftBukkit start - Remove extra exception
chunk.p = this.world.getTime();
this.f.a(this.world, chunk);
// CraftBukkit start - IOException to Exception
} catch (Exception ioexception) {
b.error("Couldn\'t save chunk", ioexception);
/* Remove extra exception
} catch (ExceptionWorldConflict exceptionworldconflict) {
b.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
// CraftBukkit end */
}
// } catch (ExceptionWorldConflict exceptionworldconflict) {
// exceptionworldconflict.printStackTrace();
// }
// CraftBukkit end
}
}
@ -220,7 +223,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = this.getOrCreateChunk(i, j);
if (!chunk.done) {
chunk.done = true;
chunk.p();
if (this.chunkProvider != null) {
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
@ -262,7 +265,7 @@ public class ChunkProviderServer implements IChunkProvider {
if (chunk.a(flag)) {
this.saveChunk(chunk);
chunk.l = false;
chunk.n = false;
++i;
if (i == 24 && !flag) {
return false;
@ -274,8 +277,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
public void b() {
if (this.e != null) {
this.e.b();
if (this.f != null) {
this.f.b();
}
}
@ -294,14 +297,16 @@ public class ChunkProviderServer implements IChunkProvider {
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
// this.unloadQueue.remove(integer);
// this.unloadQueue.remove(olong);
// this.chunks.remove(olong.longValue());
this.chunks.remove(chunkcoordinates); // CraftBukkit
this.chunkList.remove(chunk);
}
}
// CraftBukkit end
if (this.e != null) {
this.e.a();
if (this.f != null) {
this.f.a();
}
}
@ -313,7 +318,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
public String getName() {
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit
// CraftBukkit - this.chunks.count() -> .values().size()
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size();
}
public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) {
@ -325,7 +331,8 @@ public class ChunkProviderServer implements IChunkProvider {
}
public int getLoadedChunks() {
return this.chunks.values().size(); // CraftBukkit
// CraftBukkit - this.chunks.count() -> .values().size()
return this.chunks.values().size();
}
public void recreateStructures(int i, int j) {}

Datei anzeigen

@ -11,32 +11,36 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
private List a = new ArrayList();
private Set b = new HashSet();
private Object c = new Object();
private final File d;
public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
private static final Logger a = LogManager.getLogger();
private List b = new ArrayList();
private Set c = new HashSet();
private Object d = new Object();
private final File e;
public ChunkRegionLoader(File file1) {
this.d = file1;
this.e = file1;
}
// CraftBukkit start
public boolean chunkExists(World world, int i, int j) {
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
synchronized (this.c) {
if (this.b.contains(chunkcoordintpair)) {
for (int k = 0; k < this.a.size(); ++k) {
if (((PendingChunkToSave) this.a.get(k)).a.equals(chunkcoordintpair)) {
synchronized (this.d) {
if (this.c.contains(chunkcoordintpair)) {
for (int k = 0; k < this.b.size(); ++k) {
if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
return true;
}
}
}
}
return RegionFileCache.a(this.d, i, j).chunkExists(i & 31, j & 31);
return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31);
}
// CraftBukkit end
@ -57,13 +61,13 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
// CraftBukkit end
NBTTagCompound nbttagcompound = null;
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
Object object = this.c;
Object object = this.d;
synchronized (this.c) {
if (this.b.contains(chunkcoordintpair)) {
for (int k = 0; k < this.a.size(); ++k) {
if (((PendingChunkToSave) this.a.get(k)).a.equals(chunkcoordintpair)) {
nbttagcompound = ((PendingChunkToSave) this.a.get(k)).b;
synchronized (this.d) {
if (this.c.contains(chunkcoordintpair)) {
for (int k = 0; k < this.b.size(); ++k) {
if (((PendingChunkToSave) this.b.get(k)).a.equals(chunkcoordintpair)) {
nbttagcompound = ((PendingChunkToSave) this.b.get(k)).b;
break;
}
}
@ -71,7 +75,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
if (nbttagcompound == null) {
DataInputStream datainputstream = RegionFileCache.c(this.d, i, j);
DataInputStream datainputstream = RegionFileCache.c(this.e, i, j);
if (datainputstream == null) {
return null;
@ -84,33 +88,32 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[]
if (!nbttagcompound.hasKey("Level")) {
world.getLogger().severe("Chunk file at " + i + "," + j + " is missing level data, skipping");
if (!nbttagcompound.hasKeyOfType("Level", 10)) {
a.error("Chunk file at " + i + "," + j + " is missing level data, skipping");
return null;
} else if (!nbttagcompound.getCompound("Level").hasKey("Sections")) {
world.getLogger().severe("Chunk file at " + i + "," + j + " is missing block data, skipping");
} else if (!nbttagcompound.getCompound("Level").hasKeyOfType("Sections", 9)) {
a.error("Chunk file at " + i + "," + j + " is missing block data, skipping");
return null;
} else {
Chunk chunk = this.a(world, nbttagcompound.getCompound("Level"));
if (!chunk.a(i, j)) {
world.getLogger().severe("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")");
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
// CraftBukkit start - Have to move tile entities since we don't load them at this stage
NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities");
NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10);
if (tileEntities != null) {
for (int te = 0; te < tileEntities.size(); te++) {
NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te);
int x = tileEntity.getInt("x") - chunk.x * 16;
int z = tileEntity.getInt("z") - chunk.z * 16;
int x = tileEntity.getInt("x") - chunk.locX * 16;
int z = tileEntity.getInt("z") - chunk.locZ * 16;
tileEntity.setInt("x", i * 16 + x);
tileEntity.setInt("z", j * 16 + z);
}
}
// CraftBukkit end
chunk = this.a(world, nbttagcompound.getCompound("Level"));
}
@ -126,7 +129,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void a(World world, Chunk chunk) {
// CraftBukkit start - "handle" exception
try {
world.G();
world.F();
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
}
@ -145,35 +148,35 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
protected void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) {
Object object = this.c;
Object object = this.d;
synchronized (this.c) {
if (this.b.contains(chunkcoordintpair)) {
for (int i = 0; i < this.a.size(); ++i) {
if (((PendingChunkToSave) this.a.get(i)).a.equals(chunkcoordintpair)) {
this.a.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
synchronized (this.d) {
if (this.c.contains(chunkcoordintpair)) {
for (int i = 0; i < this.b.size(); ++i) {
if (((PendingChunkToSave) this.b.get(i)).a.equals(chunkcoordintpair)) {
this.b.set(i, new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
return;
}
}
}
this.a.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
this.b.add(chunkcoordintpair);
this.b.add(new PendingChunkToSave(chunkcoordintpair, nbttagcompound));
this.c.add(chunkcoordintpair);
FileIOThread.a.a(this);
}
}
public boolean c() {
PendingChunkToSave pendingchunktosave = null;
Object object = this.c;
Object object = this.d;
synchronized (this.c) {
if (this.a.isEmpty()) {
synchronized (this.d) {
if (this.b.isEmpty()) {
return false;
}
pendingchunktosave = (PendingChunkToSave) this.a.remove(0);
this.b.remove(pendingchunktosave.a);
pendingchunktosave = (PendingChunkToSave) this.b.remove(0);
this.c.remove(pendingchunktosave.a);
}
if (pendingchunktosave != null) {
@ -188,7 +191,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - public -> private, added throws
DataOutputStream dataoutputstream = RegionFileCache.d(this.d, pendingchunktosave.a.x, pendingchunktosave.a.z);
DataOutputStream dataoutputstream = RegionFileCache.d(this.e, pendingchunktosave.a.x, pendingchunktosave.a.z);
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);
dataoutputstream.close();
@ -205,14 +208,16 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
private void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) {
nbttagcompound.setInt("xPos", chunk.x);
nbttagcompound.setInt("zPos", chunk.z);
nbttagcompound.setByte("V", (byte) 1);
nbttagcompound.setInt("xPos", chunk.locX);
nbttagcompound.setInt("zPos", chunk.locZ);
nbttagcompound.setLong("LastUpdate", world.getTime());
nbttagcompound.setIntArray("HeightMap", chunk.heightMap);
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
nbttagcompound.setLong("InhabitedTime", chunk.q);
nbttagcompound.setBoolean("LightPopulated", chunk.lit);
nbttagcompound.setLong("InhabitedTime", chunk.s);
ChunkSection[] achunksection = chunk.i();
NBTTagList nbttaglist = new NBTTagList("Sections");
NBTTagList nbttaglist = new NBTTagList();
boolean flag = !world.worldProvider.g;
ChunkSection[] achunksection1 = achunksection;
int i = achunksection.length;
@ -244,7 +249,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound.set("Sections", nbttaglist);
nbttagcompound.setByteArray("Biomes", chunk.m());
chunk.m = false;
chunk.o = false;
NBTTagList nbttaglist1 = new NBTTagList();
Iterator iterator;
@ -257,7 +262,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound1 = new NBTTagCompound();
if (entity.d(nbttagcompound1)) {
chunk.m = true;
chunk.o = true;
nbttaglist1.add(nbttagcompound1);
}
}
@ -288,12 +293,12 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
NextTickListEntry nextticklistentry = (NextTickListEntry) iterator1.next();
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.setInt("i", nextticklistentry.d);
nbttagcompound2.setInt("i", Block.b(nextticklistentry.a()));
nbttagcompound2.setInt("x", nextticklistentry.a);
nbttagcompound2.setInt("y", nextticklistentry.b);
nbttagcompound2.setInt("z", nextticklistentry.c);
nbttagcompound2.setInt("t", (int) (nextticklistentry.e - k));
nbttagcompound2.setInt("p", nextticklistentry.f);
nbttagcompound2.setInt("t", (int) (nextticklistentry.d - k));
nbttagcompound2.setInt("p", nextticklistentry.e);
nbttaglist3.add(nbttagcompound2);
}
@ -308,19 +313,20 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
chunk.heightMap = nbttagcompound.getIntArray("HeightMap");
chunk.done = nbttagcompound.getBoolean("TerrainPopulated");
chunk.q = nbttagcompound.getLong("InhabitedTime");
NBTTagList nbttaglist = nbttagcompound.getList("Sections");
chunk.lit = nbttagcompound.getBoolean("LightPopulated");
chunk.s = nbttagcompound.getLong("InhabitedTime");
NBTTagList nbttaglist = nbttagcompound.getList("Sections", 10);
byte b0 = 16;
ChunkSection[] achunksection = new ChunkSection[b0];
boolean flag = !world.worldProvider.g;
for (int k = 0; k < nbttaglist.size(); ++k) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(k);
NBTTagCompound nbttagcompound1 = nbttaglist.get(k);
byte b1 = nbttagcompound1.getByte("Y");
ChunkSection chunksection = new ChunkSection(b1 << 4, flag);
chunksection.setIdArray(nbttagcompound1.getByteArray("Blocks"));
if (nbttagcompound1.hasKey("Add")) {
if (nbttagcompound1.hasKeyOfType("Add", 7)) {
chunksection.setExtendedIdArray(new NibbleArray(nbttagcompound1.getByteArray("Add"), 4));
}
@ -335,7 +341,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
chunk.a(achunksection);
if (nbttagcompound.hasKey("Biomes")) {
if (nbttagcompound.hasKeyOfType("Biomes", 7)) {
chunk.a(nbttagcompound.getByteArray("Biomes"));
}
@ -345,20 +351,19 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) {
// CraftBukkit end
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities");
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10);
if (nbttaglist1 != null) {
for (int l = 0; l < nbttaglist1.size(); ++l) {
NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.get(l);
NBTTagCompound nbttagcompound2 = nbttaglist1.get(l);
Entity entity = EntityTypes.a(nbttagcompound2, world);
chunk.m = true;
chunk.o = true;
if (entity != null) {
chunk.a(entity);
Entity entity1 = entity;
for (NBTTagCompound nbttagcompound3 = nbttagcompound2; nbttagcompound3.hasKey("Riding"); nbttagcompound3 = nbttagcompound3.getCompound("Riding")) {
for (NBTTagCompound nbttagcompound3 = nbttagcompound2; nbttagcompound3.hasKeyOfType("Riding", 10); nbttagcompound3 = nbttagcompound3.getCompound("Riding")) {
Entity entity2 = EntityTypes.a(nbttagcompound3.getCompound("Riding"), world);
if (entity2 != null) {
@ -372,11 +377,11 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
}
NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities");
NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities", 10);
if (nbttaglist2 != null) {
for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) {
NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist2.get(i1);
NBTTagCompound nbttagcompound4 = nbttaglist2.get(i1);
TileEntity tileentity = TileEntity.c(nbttagcompound4);
if (tileentity != null) {
@ -385,14 +390,14 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
}
if (nbttagcompound.hasKey("TileTicks")) {
NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks");
if (nbttagcompound.hasKeyOfType("TileTicks", 9)) {
NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks", 10);
if (nbttaglist3 != null) {
for (int j1 = 0; j1 < nbttaglist3.size(); ++j1) {
NBTTagCompound nbttagcompound5 = (NBTTagCompound) nbttaglist3.get(j1);
NBTTagCompound nbttagcompound5 = nbttaglist3.get(j1);
world.b(nbttagcompound5.getInt("x"), nbttagcompound5.getInt("y"), nbttagcompound5.getInt("z"), nbttagcompound5.getInt("i"), nbttagcompound5.getInt("t"), nbttagcompound5.getInt("p"));
world.b(nbttagcompound5.getInt("x"), nbttagcompound5.getInt("y"), nbttagcompound5.getInt("z"), Block.e(nbttagcompound5.getInt("i")), nbttagcompound5.getInt("t"), nbttagcompound5.getInt("p"));
}
}
}

Datei anzeigen

@ -37,42 +37,48 @@ public class ChunkSection {
}
// CraftBukkit end
public int getTypeId(int i, int j, int k) {
public Block getTypeId(int i, int j, int k) {
int l = this.blockIds[j << 8 | k << 4 | i] & 255;
return this.extBlockIds != null ? this.extBlockIds.a(i, j, k) << 8 | l : l;
if (this.extBlockIds != null) {
l |= this.extBlockIds.a(i, j, k) << 8;
}
return Block.e(l);
}
public void setTypeId(int i, int j, int k, int l) {
int i1 = this.blockIds[j << 8 | k << 4 | i] & 255;
public void setTypeId(int i, int j, int k, Block block) {
int l = this.blockIds[j << 8 | k << 4 | i] & 255;
if (this.extBlockIds != null) {
i1 |= this.extBlockIds.a(i, j, k) << 8;
l |= this.extBlockIds.a(i, j, k) << 8;
}
if (i1 == 0 && l != 0) {
++this.nonEmptyBlockCount;
if (Block.byId[l] != null && Block.byId[l].isTicking()) {
++this.tickingBlockCount;
}
} else if (i1 != 0 && l == 0) {
Block block1 = Block.e(l);
if (block1 != Blocks.AIR) {
--this.nonEmptyBlockCount;
if (Block.byId[i1] != null && Block.byId[i1].isTicking()) {
if (block1.isTicking()) {
--this.tickingBlockCount;
}
} else if (Block.byId[i1] != null && Block.byId[i1].isTicking() && (Block.byId[l] == null || !Block.byId[l].isTicking())) {
--this.tickingBlockCount;
} else if ((Block.byId[i1] == null || !Block.byId[i1].isTicking()) && Block.byId[l] != null && Block.byId[l].isTicking()) {
++this.tickingBlockCount;
}
this.blockIds[j << 8 | k << 4 | i] = (byte) (l & 255);
if (l > 255) {
if (block != Blocks.AIR) {
++this.nonEmptyBlockCount;
if (block.isTicking()) {
++this.tickingBlockCount;
}
}
int i1 = Block.b(block);
this.blockIds[j << 8 | k << 4 | i] = (byte) (i1 & 255);
if (i1 > 255) {
if (this.extBlockIds == null) {
this.extBlockIds = new NibbleArray(this.blockIds.length, 4);
}
this.extBlockIds.a(i, j, k, (l & 3840) >> 8);
this.extBlockIds.a(i, j, k, (i1 & 3840) >> 8);
} else if (this.extBlockIds != null) {
this.extBlockIds.a(i, j, k, 0);
}
@ -123,11 +129,11 @@ public class ChunkSection {
for (int off = 0; off < blkIds.length; off++) {
int l = blkIds[off] & 0xFF;
if (l > 0) {
if (Block.byId[l] == null) {
if (Block.e(l) == null) {
blkIds[off] = 0;
} else {
++cntNonEmpty;
if (Block.byId[l].isTicking()) {
if (Block.e(l).isTicking()) {
++cntTicking;
}
}
@ -139,12 +145,12 @@ public class ChunkSection {
byte extid = ext[off2];
int l = (blkIds[off] & 0xFF) | ((extid & 0xF) << 8); // Even data
if (l > 0) {
if (Block.byId[l] == null) {
if (Block.e(l) == null) {
blkIds[off] = 0;
ext[off2] &= 0xF0;
} else {
++cntNonEmpty;
if (Block.byId[l].isTicking()) {
if (Block.e(l).isTicking()) {
++cntTicking;
}
}
@ -152,12 +158,12 @@ public class ChunkSection {
off++;
l = (blkIds[off] & 0xFF) | ((extid & 0xF0) << 4); // Odd data
if (l > 0) {
if (Block.byId[l] == null) {
if (Block.e(l) == null) {
blkIds[off] = 0;
ext[off2] &= 0x0F;
} else {
++cntNonEmpty;
if (Block.byId[l].isTicking()) {
if (Block.e(l).isTicking()) {
++cntTicking;
}
}
@ -178,19 +184,12 @@ public class ChunkSection {
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
for (int k = 0; k < 16; ++k) {
int l = this.getTypeId(i, j, k);
Block block = this.getTypeId(i, j, k);
if (l > 0) {
if (Block.byId[l] == null) {
this.blockIds[j << 8 | k << 4 | i] = 0;
if (this.extBlockIds != null) {
this.extBlockIds.a(i, j, k, 0);
}
} else {
++this.nonEmptyBlockCount;
if (Block.byId[l].isTicking()) {
++this.tickingBlockCount;
}
if (block != Blocks.AIR) {
++this.nonEmptyBlockCount;
if (block.isTicking()) {
++this.tickingBlockCount;
}
}
}

Datei anzeigen

@ -0,0 +1,27 @@
package net.minecraft.server;
// CraftBukkit - import package private class
class ClientCommandOrdinalWrapper {
static final int[] a = new int[EnumClientCommand.values().length];
static {
try {
a[EnumClientCommand.PERFORM_RESPAWN.ordinal()] = 1;
} catch (NoSuchFieldError nosuchfielderror) {
;
}
try {
a[EnumClientCommand.REQUEST_STATS.ordinal()] = 2;
} catch (NoSuchFieldError nosuchfielderror1) {
;
}
try {
a[EnumClientCommand.OPEN_INVENTORY_ACHIEVEMENT.ordinal()] = 3;
} catch (NoSuchFieldError nosuchfielderror2) {
;
}
}
}

Datei anzeigen

@ -0,0 +1,220 @@
package net.minecraft.server;
import java.text.SimpleDateFormat;
import java.util.Date;
// CraftBukkit start
import java.util.ArrayList;
import org.apache.logging.log4j.Level;
import com.google.common.base.Joiner;
// CraftBukkit end
public abstract class CommandBlockListenerAbstract implements ICommandListener {
private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss");
private int b;
private boolean c = true;
private IChatBaseComponent d = null;
public String e = ""; // CraftBukkit - private -> public
private String f = "@";
protected org.bukkit.command.CommandSender sender; // CraftBukkit - add sender;
public CommandBlockListenerAbstract() {}
public int g() {
return this.b;
}
public IChatBaseComponent h() {
return this.d;
}
public void a(NBTTagCompound nbttagcompound) {
nbttagcompound.setString("Command", this.e);
nbttagcompound.setInt("SuccessCount", this.b);
nbttagcompound.setString("CustomName", this.f);
if (this.d != null) {
nbttagcompound.setString("LastOutput", ChatSerializer.a(this.d));
}
nbttagcompound.setBoolean("TrackOutput", this.c);
}
public void b(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.getString("Command");
this.b = nbttagcompound.getInt("SuccessCount");
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
this.f = nbttagcompound.getString("CustomName");
}
if (nbttagcompound.hasKeyOfType("LastOutput", 8)) {
this.d = ChatSerializer.a(nbttagcompound.getString("LastOutput"));
}
if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) {
this.c = nbttagcompound.getBoolean("TrackOutput");
}
}
public boolean a(int i, String s) {
return i <= 2;
}
public void a(String s) {
this.e = s;
}
public String i() {
return this.e;
}
public void a(World world) {
if (world.isStatic) {
this.b = 0;
}
MinecraftServer minecraftserver = MinecraftServer.getServer();
if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) {
// CraftBukkit start - Handle command block commands using Bukkit dispatcher
org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
Joiner joiner = Joiner.on(" ");
String command = this.e;
if (this.e.startsWith("/")) {
command = this.e.substring(1);
}
String[] args = command.split(" ");
ArrayList<String[]> commands = new ArrayList<String[]>();
// Block disallowed commands
if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") ||
args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") ||
args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) {
this.b = 0;
return;
}
// Make sure this is a valid command
if (commandMap.getCommand(args[0]) == null) {
this.b = 0;
return;
}
// If the world has no players don't run
if (this.getWorld().players.isEmpty()) {
this.b = 0;
return;
}
// testfor command requires special handling
if (args[0].equalsIgnoreCase("testfor")) {
if (args.length < 2) {
this.b = 0;
return;
}
EntityPlayer[] players = PlayerSelector.getPlayers(this, args[1]);
if (players != null && players.length > 0) {
this.b = players.length;
return;
} else {
EntityPlayer player = MinecraftServer.getServer().getPlayerList().getPlayer(args[1]);
if (player == null) {
this.b = 0;
return;
} else {
this.b = 1;
return;
}
}
}
commands.add(args);
// Find positions of command block syntax, if any
ArrayList<String[]> newCommands = new ArrayList<String[]>();
for (int i = 0; i < args.length; i++) {
if (PlayerSelector.isPattern(args[i])) {
for (int j = 0; j < commands.size(); j++) {
newCommands.addAll(this.buildCommands(commands.get(j), i));
}
ArrayList<String[]> temp = commands;
commands = newCommands;
newCommands = temp;
newCommands.clear();
}
}
int completed = 0;
// Now dispatch all of the commands we ended up with
for (int i = 0; i < commands.size(); i++) {
try {
if (commandMap.dispatch(sender, joiner.join(java.util.Arrays.asList(commands.get(i))))) {
completed++;
}
} catch (Throwable exception) {
if(this instanceof TileEntityCommandListener) {
TileEntityCommandListener listener = (TileEntityCommandListener) this;
MinecraftServer.av().log(Level.WARN, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().x, listener.getChunkCoordinates().y, listener.getChunkCoordinates().z), exception);
} else if (this instanceof EntityMinecartCommandBlockListener) {
EntityMinecartCommandBlockListener listener = (EntityMinecartCommandBlockListener) this;
MinecraftServer.av().log(Level.WARN, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().x, listener.getChunkCoordinates().y, listener.getChunkCoordinates().z), exception);
} else {
MinecraftServer.av().log(Level.WARN, String.format("Unknown CommandBlock failed to handle command"), exception);
}
}
}
this.b = completed;
// CraftBukkit end
} else {
this.b = 0;
}
}
// CraftBukkit start
private ArrayList<String[]> buildCommands(String[] args, int pos) {
ArrayList<String[]> commands = new ArrayList<String[]>();
EntityPlayer[] players = PlayerSelector.getPlayers(this, args[pos]);
if (players != null) {
for (EntityPlayer player : players) {
if (player.world != this.getWorld()) {
continue;
}
String[] command = args.clone();
command[pos] = player.getName();
commands.add(command);
}
}
return commands;
}
// CraftBukkit end
public String getName() {
return this.f;
}
public IChatBaseComponent getScoreboardDisplayName() {
return new ChatComponentText(this.getName());
}
public void b(String s) {
this.f = s;
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
if (this.c && this.getWorld() != null && !this.getWorld().isStatic) {
this.d = (new ChatComponentText("[" + a.format(new Date()) + "] ")).a(ichatbasecomponent);
this.e();
}
}
public abstract void e();
public void b(IChatBaseComponent ichatbasecomponent) {
this.d = ichatbasecomponent;
}
}

Datei anzeigen

@ -1,60 +0,0 @@
package net.minecraft.server;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.regex.Pattern; // CraftBukkit
class ConsoleLogFormatter extends Formatter {
private SimpleDateFormat b;
final ConsoleLogManager a;
// CraftBukkit start - Add color stripping
private Pattern pattern = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]");
private boolean strip = false;
// CraftBukkit end
private ConsoleLogFormatter(ConsoleLogManager consolelogmanager) {
this.a = consolelogmanager;
this.b = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
this.strip = MinecraftServer.getServer().options.has("log-strip-color"); // CraftBukkit
}
public String format(LogRecord logrecord) {
StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append(this.b.format(Long.valueOf(logrecord.getMillis())));
if (ConsoleLogManager.a(this.a) != null) {
stringbuilder.append(ConsoleLogManager.a(this.a));
}
stringbuilder.append(" [").append(logrecord.getLevel().getName()).append("] ");
stringbuilder.append(this.formatMessage(logrecord));
stringbuilder.append('\n');
Throwable throwable = logrecord.getThrown();
if (throwable != null) {
StringWriter stringwriter = new StringWriter();
throwable.printStackTrace(new PrintWriter(stringwriter));
stringbuilder.append(stringwriter.toString());
}
// CraftBukkit start - handle stripping color
if (this.strip) {
return this.pattern.matcher(stringbuilder.toString()).replaceAll("");
} else {
return stringbuilder.toString();
}
// CraftBukkit end
}
ConsoleLogFormatter(ConsoleLogManager consolelogmanager, EmptyClass3 emptyclass3) {
this(consolelogmanager);
}
}

Datei anzeigen

@ -1,158 +0,0 @@
package net.minecraft.server;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.File; // CraftBukkit
public class ConsoleLogManager implements IConsoleLogManager {
private final Logger a;
private final String b;
private final String c;
private final String d;
public static Logger global = Logger.getLogger(""); // CraftBukkit
public ConsoleLogManager(String s, String s1, String s2) {
this.a = Logger.getLogger(s);
this.c = s;
this.d = s1;
this.b = s2;
this.b();
}
private void b() {
this.a.setUseParentHandlers(false);
Handler[] ahandler = this.a.getHandlers();
int i = ahandler.length;
for (int j = 0; j < i; ++j) {
Handler handler = ahandler[j];
this.a.removeHandler(handler);
}
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(this, (EmptyClass3) null);
// CraftBukkit start
MinecraftServer server = MinecraftServer.getServer();
ConsoleHandler consolehandler = new org.bukkit.craftbukkit.util.TerminalConsoleHandler(server.reader);
// CraftBukkit end
consolehandler.setFormatter(consolelogformatter);
this.a.addHandler(consolehandler);
// CraftBukkit start
for (java.util.logging.Handler handler : global.getHandlers()) {
global.removeHandler(handler);
}
consolehandler.setFormatter(new org.bukkit.craftbukkit.util.ShortConsoleLogFormatter(server));
global.addHandler(consolehandler);
// CraftBukkit end
try {
// CraftBukkit start
String pattern = (String) server.options.valueOf("log-pattern");
// We have to parse the pattern ourself so we can create directories as needed (java #6244047)
String tmpDir = System.getProperty("java.io.tmpdir");
String homeDir = System.getProperty("user.home");
if (tmpDir == null) {
tmpDir = homeDir;
}
// We only care about parsing for directories, FileHandler can do file names by itself
File parent = new File(pattern).getParentFile();
StringBuilder fixedPattern = new StringBuilder();
String parentPath = "";
if (parent != null) {
parentPath = parent.getPath();
}
int j = 0;
while (j < parentPath.length()) {
char ch = parentPath.charAt(j);
char ch2 = 0;
if (j + 1 < parentPath.length()) {
ch2 = Character.toLowerCase(pattern.charAt(j + 1));
}
if (ch == '%') {
if (ch2 == 'h') {
j += 2;
fixedPattern.append(homeDir);
continue;
} else if (ch2 == 't') {
j += 2;
fixedPattern.append(tmpDir);
continue;
} else if (ch2 == '%') {
// Even though we don't care about this we have to skip it to avoid matching %%t
j += 2;
fixedPattern.append("%%");
continue;
} else if (ch2 != 0) {
throw new java.io.IOException("log-pattern can only use %t and %h for directories, got %" + ch2);
}
}
fixedPattern.append(ch);
j++;
}
// Try to create needed parent directories
parent = new File(fixedPattern.toString());
if (parent != null) {
parent.mkdirs();
}
int limit = (Integer) server.options.valueOf("log-limit");
int count = (Integer) server.options.valueOf("log-count");
boolean append = (Boolean) server.options.valueOf("log-append");
FileHandler filehandler = new FileHandler(pattern, limit, count, append);
// CraftBukkit end
filehandler.setFormatter(consolelogformatter);
this.a.addHandler(filehandler);
global.addHandler(filehandler); // CraftBukkit
} catch (Exception exception) {
this.a.log(Level.WARNING, "Failed to log " + this.c + " to " + this.b, exception);
}
}
public Logger getLogger() {
return this.a;
}
public void info(String s) {
this.a.log(Level.INFO, s);
}
public void warning(String s) {
this.a.log(Level.WARNING, s);
}
public void warning(String s, Object... aobject) {
this.a.log(Level.WARNING, s, aobject);
}
public void warning(String s, Throwable throwable) {
this.a.log(Level.WARNING, s, throwable);
}
public void severe(String s) {
this.a.log(Level.SEVERE, s);
}
public void severe(String s, Throwable throwable) {
this.a.log(Level.SEVERE, s, throwable);
}
static String a(ConsoleLogManager consolelogmanager) {
return consolelogmanager.d;
}
}

Datei anzeigen

@ -42,7 +42,7 @@ public abstract class Container {
public Container() {}
protected Slot a(Slot slot) {
slot.g = this.c.size();
slot.rawSlotIndex = this.c.size();
this.c.add(slot);
this.b.add(null);
return slot;
@ -162,7 +162,7 @@ public abstract class Container {
}
l -= itemstack2.count - j1;
draggedSlots.put(slot1.g, itemstack2); // CraftBukkit - Put in map instead of setting, Should be Slot.rawSlotIndex
draggedSlots.put(slot1.rawSlotIndex, itemstack2); // CraftBukkit - Put in map instead of setting
}
}
@ -221,7 +221,7 @@ public abstract class Container {
if (i == -999) {
if (playerinventory.getCarried() != null && i == -999) {
if (j == 0) {
entityhuman.drop(playerinventory.getCarried());
entityhuman.drop(playerinventory.getCarried(), true);
playerinventory.setCarried((ItemStack) null);
}
@ -229,7 +229,7 @@ public abstract class Container {
// CraftBukkit start - Store a reference
ItemStack itemstack4 = playerinventory.getCarried();
if (itemstack4.count > 0) {
entityhuman.drop(itemstack4.a(1));
entityhuman.drop(itemstack4.a(1), true);
}
if (itemstack4.count == 0) {
@ -247,9 +247,10 @@ public abstract class Container {
if (slot2 != null && slot2.a(entityhuman)) {
itemstack1 = this.b(entityhuman, i);
if (itemstack1 != null) {
l = itemstack1.id;
Item item = itemstack1.getItem();
itemstack = itemstack1.cloneItemStack();
if (slot2 != null && slot2.getItem() != null && slot2.getItem().id == l) {
if (slot2.getItem() != null && slot2.getItem().getItem() == item) {
this.a(i, j, true, entityhuman);
}
}
@ -294,7 +295,7 @@ public abstract class Container {
slot2.a(entityhuman, playerinventory.getCarried());
} else if (slot2.isAllowed(itemstack4)) {
if (itemstack1.id == itemstack4.id && itemstack1.getData() == itemstack4.getData() && ItemStack.equals(itemstack1, itemstack4)) {
if (itemstack1.getItem() == itemstack4.getItem() && itemstack1.getData() == itemstack4.getData() && ItemStack.equals(itemstack1, itemstack4)) {
k1 = j == 0 ? itemstack4.count : 1;
if (k1 > slot2.a() - itemstack1.count) {
k1 = slot2.a() - itemstack1.count;
@ -314,7 +315,7 @@ public abstract class Container {
slot2.set(itemstack4);
playerinventory.setCarried(itemstack1);
}
} else if (itemstack1.id == itemstack4.id && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) {
} else if (itemstack1.getItem() == itemstack4.getItem() && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) {
k1 = itemstack1.count;
if (k1 > 0 && k1 + itemstack4.count <= itemstack4.getMaxStackSize()) {
itemstack4.count += k1;
@ -375,7 +376,7 @@ public abstract class Container {
if (slot2 != null && slot2.e() && slot2.a(entityhuman)) {
itemstack1 = slot2.a(j == 0 ? 1 : slot2.getItem().count);
slot2.a(entityhuman, itemstack1);
entityhuman.drop(itemstack1);
entityhuman.drop(itemstack1, true);
}
} else if (k == 6 && i >= 0) {
slot2 = (Slot) this.c.get(i);
@ -422,7 +423,7 @@ public abstract class Container {
PlayerInventory playerinventory = entityhuman.inventory;
if (playerinventory.getCarried() != null) {
entityhuman.drop(playerinventory.getCarried());
entityhuman.drop(playerinventory.getCarried(), false);
playerinventory.setCarried((ItemStack) null);
}
}
@ -464,7 +465,7 @@ public abstract class Container {
while (itemstack.count > 0 && (!flag && k < j || flag && k >= i)) {
slot = (Slot) this.c.get(k);
itemstack1 = slot.getItem();
if (itemstack1 != null && itemstack1.id == itemstack.id && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
if (itemstack1 != null && itemstack1.getItem() == itemstack.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
int l = itemstack1.count + itemstack.count;
if (l <= itemstack.getMaxStackSize()) {

Datei anzeigen

@ -3,22 +3,25 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
public class ContainerAnvil extends Container {
private IInventory f = new InventoryCraftResult();
private IInventory g = new ContainerAnvilInventory(this, "Repair", true, 2);
private World h;
private int i;
private static final Logger f = LogManager.getLogger();
private IInventory g = new InventoryCraftResult();
private IInventory h = new ContainerAnvilInventory(this, "Repair", true, 2);
private World i;
private int j;
private int k;
public int a;
private int l;
private String m;
private final EntityHuman n;
public int a;
private int m;
private String n;
private final EntityHuman o;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@ -26,14 +29,14 @@ public class ContainerAnvil extends Container {
public ContainerAnvil(PlayerInventory playerinventory, World world, int i, int j, int k, EntityHuman entityhuman) {
this.player = playerinventory; // CraftBukkit
this.h = world;
this.i = i;
this.j = j;
this.k = k;
this.n = entityhuman;
this.a(new Slot(this.g, 0, 27, 47));
this.a(new Slot(this.g, 1, 76, 47));
this.a((Slot) (new SlotAnvilResult(this, this.f, 2, 134, 47, world, i, j, k)));
this.i = world;
this.j = i;
this.k = j;
this.l = k;
this.o = entityhuman;
this.a(new Slot(this.h, 0, 27, 47));
this.a(new Slot(this.h, 1, 76, 47));
this.a((Slot) (new SlotAnvilResult(this, this.g, 2, 134, 47, world, i, j, k)));
int l;
@ -50,13 +53,13 @@ public class ContainerAnvil extends Container {
public void a(IInventory iinventory) {
super.a(iinventory);
if (iinventory == this.g) {
if (iinventory == this.h) {
this.e();
}
}
public void e() {
ItemStack itemstack = this.g.getItem(0);
ItemStack itemstack = this.h.getItem(0);
this.a = 0;
int i = 0;
@ -64,16 +67,16 @@ public class ContainerAnvil extends Container {
int j = 0;
if (itemstack == null) {
this.f.setItem(0, (ItemStack) null);
this.g.setItem(0, (ItemStack) null);
this.a = 0;
} else {
ItemStack itemstack1 = itemstack.cloneItemStack();
ItemStack itemstack2 = this.g.getItem(1);
ItemStack itemstack2 = this.h.getItem(1);
Map map = EnchantmentManager.a(itemstack1);
boolean flag = false;
int k = b0 + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost());
this.l = 0;
this.m = 0;
int l;
int i1;
int j1;
@ -83,11 +86,11 @@ public class ContainerAnvil extends Container {
Enchantment enchantment;
if (itemstack2 != null) {
flag = itemstack2.id == Item.ENCHANTED_BOOK.id && Item.ENCHANTED_BOOK.g(itemstack2).size() > 0;
if (itemstack1.g() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
flag = itemstack2.getItem() == Items.ENCHANTED_BOOK && Items.ENCHANTED_BOOK.g(itemstack2).size() > 0;
if (itemstack1.g() && itemstack1.getItem().a(itemstack, itemstack2)) {
l = Math.min(itemstack1.j(), itemstack1.l() / 4);
if (l <= 0) {
this.f.setItem(0, (ItemStack) null);
this.g.setItem(0, (ItemStack) null);
this.a = 0;
return;
}
@ -99,10 +102,10 @@ public class ContainerAnvil extends Container {
l = Math.min(itemstack1.j(), itemstack1.l() / 4);
}
this.l = i1;
this.m = i1;
} else {
if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.g())) {
this.f.setItem(0, (ItemStack) null);
if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.g())) {
this.g.setItem(0, (ItemStack) null);
this.a = 0;
return;
}
@ -146,7 +149,7 @@ public class ContainerAnvil extends Container {
int k2 = l1 - k1;
boolean flag1 = enchantment.canEnchant(itemstack);
if (this.n.abilities.canInstantlyBuild || itemstack.id == ItemEnchantedBook.ENCHANTED_BOOK.id) {
if (this.o.abilities.canInstantlyBuild || itemstack.getItem() == Items.ENCHANTED_BOOK) {
flag1 = true;
}
@ -204,20 +207,20 @@ public class ContainerAnvil extends Container {
}
}
if (StringUtils.isBlank(this.m)) {
if (StringUtils.isBlank(this.n)) {
if (itemstack.hasName()) {
j = itemstack.g() ? 7 : itemstack.count * 5;
i += j;
itemstack1.t();
}
} else if (!this.m.equals(itemstack.getName())) {
} else if (!this.n.equals(itemstack.getName())) {
j = itemstack.g() ? 7 : itemstack.count * 5;
i += j;
if (itemstack.hasName()) {
k += j / 2;
}
itemstack1.c(this.m);
itemstack1.c(this.n);
}
l = 0;
@ -271,7 +274,7 @@ public class ContainerAnvil extends Container {
this.a = 39;
}
if (this.a >= 40 && !this.n.abilities.canInstantlyBuild) {
if (this.a >= 40 && !this.o.abilities.canInstantlyBuild) {
itemstack1 = null;
}
@ -294,7 +297,7 @@ public class ContainerAnvil extends Container {
EnchantmentManager.a(map, itemstack1);
}
this.f.setItem(0, itemstack1);
this.g.setItem(0, itemstack1);
this.b();
}
}
@ -306,12 +309,12 @@ public class ContainerAnvil extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
if (!this.h.isStatic) {
for (int i = 0; i < this.g.getSize(); ++i) {
ItemStack itemstack = this.g.splitWithoutUpdate(i);
if (!this.i.isStatic) {
for (int i = 0; i < this.h.getSize(); ++i) {
ItemStack itemstack = this.h.splitWithoutUpdate(i);
if (itemstack != null) {
entityhuman.drop(itemstack);
entityhuman.drop(itemstack, false);
}
}
}
@ -319,7 +322,7 @@ public class ContainerAnvil extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.h.getTypeId(this.i, this.j, this.k) != Block.ANVIL.id ? false : entityhuman.e((double) this.i + 0.5D, (double) this.j + 0.5D, (double) this.k + 0.5D) <= 64.0D;
return this.i.getType(this.j, this.k, this.l) != Blocks.ANVIL ? false : entityhuman.e((double) this.j + 0.5D, (double) this.k + 0.5D, (double) this.l + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
@ -361,14 +364,14 @@ public class ContainerAnvil extends Container {
}
public void a(String s) {
this.m = s;
this.n = s;
if (this.getSlot(2).e()) {
ItemStack itemstack = this.getSlot(2).getItem();
if (StringUtils.isBlank(s)) {
itemstack.t();
} else {
itemstack.c(this.m);
itemstack.c(this.n);
}
}
@ -376,11 +379,11 @@ public class ContainerAnvil extends Container {
}
static IInventory a(ContainerAnvil containeranvil) {
return containeranvil.g;
return containeranvil.h;
}
static int b(ContainerAnvil containeranvil) {
return containeranvil.l;
return containeranvil.m;
}
// CraftBukkit start
@ -389,7 +392,7 @@ public class ContainerAnvil extends Container {
return bukkitEntity;
}
org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.g, this.f);
org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.h, this.g);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}

Datei anzeigen

@ -50,8 +50,4 @@ public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBuk
super.update();
this.a.a((IInventory) this);
}
public boolean b(int i, ItemStack itemstack) {
return true;
}
}

Datei anzeigen

@ -38,7 +38,7 @@ public class ContainerBrewingStand extends Container {
public void addSlotListener(ICrafting icrafting) {
super.addSlotListener(icrafting);
icrafting.setContainerData(this, 0, this.brewingStand.x_());
icrafting.setContainerData(this, 0, this.brewingStand.i());
}
public void b() {
@ -47,12 +47,12 @@ public class ContainerBrewingStand extends Container {
for (int i = 0; i < this.listeners.size(); ++i) {
ICrafting icrafting = (ICrafting) this.listeners.get(i);
if (this.g != this.brewingStand.x_()) {
icrafting.setContainerData(this, 0, this.brewingStand.x_());
if (this.g != this.brewingStand.i()) {
icrafting.setContainerData(this, 0, this.brewingStand.i());
}
}
this.g = this.brewingStand.x_();
this.g = this.brewingStand.i();
}
public boolean a(EntityHuman entityhuman) {

Datei anzeigen

@ -39,7 +39,7 @@ public class ContainerChest extends Container {
int i = (this.f - 4) * 18;
// CraftBukkit start - Save player
// TODO: Should we check to make sure it really is an InventoryPlayer?
this.player = (PlayerInventory)iinventory;
this.player = (PlayerInventory) iinventory;
// CraftBukkit end
int j;
@ -95,7 +95,7 @@ public class ContainerChest extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
this.container.g();
this.container.l_();
}
public IInventory e() {

Datei anzeigen

@ -89,28 +89,28 @@ public class ContainerEnchantTable extends Container {
for (j = -1; j <= 1; ++j) {
for (int k = -1; k <= 1; ++k) {
if ((j != 0 || k != 0) && this.world.isEmpty(this.x + k, this.y, this.z + j) && this.world.isEmpty(this.x + k, this.y + 1, this.z + j)) {
if (this.world.getTypeId(this.x + k * 2, this.y, this.z + j * 2) == Block.BOOKSHELF.id) {
if (this.world.getType(this.x + k * 2, this.y, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
if (this.world.getTypeId(this.x + k * 2, this.y + 1, this.z + j * 2) == Block.BOOKSHELF.id) {
if (this.world.getType(this.x + k * 2, this.y + 1, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
if (k != 0 && j != 0) {
if (this.world.getTypeId(this.x + k * 2, this.y, this.z + j) == Block.BOOKSHELF.id) {
if (this.world.getType(this.x + k * 2, this.y, this.z + j) == Blocks.BOOKSHELF) {
++i;
}
if (this.world.getTypeId(this.x + k * 2, this.y + 1, this.z + j) == Block.BOOKSHELF.id) {
if (this.world.getType(this.x + k * 2, this.y + 1, this.z + j) == Blocks.BOOKSHELF) {
++i;
}
if (this.world.getTypeId(this.x + k, this.y, this.z + j * 2) == Block.BOOKSHELF.id) {
if (this.world.getType(this.x + k, this.y, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
if (this.world.getTypeId(this.x + k, this.y + 1, this.z + j * 2) == Block.BOOKSHELF.id) {
if (this.world.getType(this.x + k, this.y + 1, this.z + j * 2) == Blocks.BOOKSHELF) {
++i;
}
}
@ -152,7 +152,7 @@ public class ContainerEnchantTable extends Container {
if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) {
if (!this.world.isStatic) {
List list = EnchantmentManager.b(this.l, itemstack, this.costs[i]);
boolean flag = itemstack.id == Item.BOOK.id;
boolean flag = itemstack.getItem() == Items.BOOK;
if (list != null) {
// CraftBukkit start
@ -181,9 +181,9 @@ public class ContainerEnchantTable extends Container {
}
EnchantmentInstance enchantment = new EnchantmentInstance(enchantId, entry.getValue());
Item.ENCHANTED_BOOK.a(itemstack, enchantment);
Items.ENCHANTED_BOOK.a(itemstack, enchantment);
applied = true;
itemstack.id = Item.ENCHANTED_BOOK.id;
itemstack.setItem((Item) Items.ENCHANTED_BOOK);
break;
} else {
item.addEnchantment(entry.getKey(), entry.getValue());
@ -215,14 +215,14 @@ public class ContainerEnchantTable extends Container {
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(0);
if (itemstack != null) {
entityhuman.drop(itemstack);
entityhuman.drop(itemstack, false);
}
}
}
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.world.getTypeId(this.x, this.y, this.z) != Block.ENCHANTMENT_TABLE.id ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
return this.world.getType(this.x, this.y, this.z) != Blocks.ENCHANTMENT_TABLE ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {
@ -246,7 +246,7 @@ public class ContainerEnchantTable extends Container {
((Slot) this.c.get(0)).set(itemstack1.cloneItemStack());
itemstack1.count = 0;
} else if (itemstack1.count >= 1) {
((Slot) this.c.get(0)).set(new ItemStack(itemstack1.id, 1, itemstack1.getData()));
((Slot) this.c.get(0)).set(new ItemStack(itemstack1.getItem(), 1, itemstack1.getData()));
--itemstack1.count;
}
}

Datei anzeigen

@ -8,7 +8,7 @@ import org.bukkit.entity.HumanEntity;
public class ContainerEnchantTableInventory extends InventorySubcontainer { // CraftBukkit -> public
private final ContainerEnchantTable enchantTable;
final ContainerEnchantTable enchantTable;
// CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@ -54,8 +54,4 @@ public class ContainerEnchantTableInventory extends InventorySubcontainer { // C
super.update();
this.enchantTable.a((IInventory) this);
}
public boolean b(int i, ItemStack itemstack) {
return true;
}
}

Datei anzeigen

@ -98,7 +98,7 @@ public class ContainerFurnace extends Container {
slot.a(itemstack1, itemstack);
} else if (i != 1 && i != 0) {
if (RecipesFurnace.getInstance().getResult(itemstack1.getItem().id) != null) {
if (RecipesFurnace.getInstance().getResult(itemstack1) != null) {
if (!this.a(itemstack1, 0, 1, false)) {
return null;
}

Datei anzeigen

@ -80,6 +80,6 @@ public class ContainerHopper extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
this.hopper.g();
this.hopper.l_();
}
}

Datei anzeigen

@ -99,6 +99,6 @@ public class ContainerHorse extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
this.a.g();
this.a.l_();
}
}

Datei anzeigen

@ -21,6 +21,7 @@ public class ContainerMerchant extends Container {
}
// CraftBukkit end
public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
this.merchant = imerchant;
this.g = world;
@ -65,7 +66,7 @@ public class ContainerMerchant extends Container {
}
public boolean a(EntityHuman entityhuman) {
return this.merchant.m_() == entityhuman;
return this.merchant.b() == entityhuman;
}
public ItemStack b(EntityHuman entityhuman, int i) {
@ -118,12 +119,12 @@ public class ContainerMerchant extends Container {
ItemStack itemstack = this.f.splitWithoutUpdate(0);
if (itemstack != null) {
entityhuman.drop(itemstack);
entityhuman.drop(itemstack, false);
}
itemstack = this.f.splitWithoutUpdate(1);
if (itemstack != null) {
entityhuman.drop(itemstack);
entityhuman.drop(itemstack, false);
}
}
}

Datei anzeigen

@ -61,7 +61,7 @@ public class ContainerPlayer extends Container {
}
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
player.playerConnection.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
// CraftBukkit end
}
@ -72,7 +72,7 @@ public class ContainerPlayer extends Container {
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
if (itemstack != null) {
entityhuman.drop(itemstack);
entityhuman.drop(itemstack, false);
}
}

Datei anzeigen

@ -63,7 +63,7 @@ public class ContainerWorkbench extends Container {
}
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
player.playerConnection.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
player.playerConnection.sendPacket(new PacketPlayOutSetSlot(player.activeContainer.windowId, 0, craftResult));
// CraftBukkit end
}
@ -74,7 +74,7 @@ public class ContainerWorkbench extends Container {
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
if (itemstack != null) {
entityhuman.drop(itemstack);
entityhuman.drop(itemstack, false);
}
}
}
@ -82,7 +82,7 @@ public class ContainerWorkbench extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
return this.g.getTypeId(this.h, this.i, this.j) != Block.WORKBENCH.id ? false : entityhuman.e((double) this.h + 0.5D, (double) this.i + 0.5D, (double) this.j + 0.5D) <= 64.0D;
return this.g.getType(this.h, this.i, this.j) != Blocks.WORKBENCH ? false : entityhuman.e((double) this.h + 0.5D, (double) this.i + 0.5D, (double) this.j + 0.5D) <= 64.0D;
}
public ItemStack b(EntityHuman entityhuman, int i) {

Datei anzeigen

@ -30,117 +30,124 @@ public class CraftingManager {
(new RecipesArmor()).a(this);
(new RecipesDyes()).a(this);
this.recipes.add(new RecipeArmorDye());
this.recipes.add(new RecipeBookClone());
this.recipes.add(new RecipeMapClone());
this.recipes.add(new RecipeMapExtend());
this.recipes.add(new RecipeFireworks());
this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
this.registerShapelessRecipe(new ItemStack(Item.BOOK, 1), new Object[] { Item.PAPER, Item.PAPER, Item.PAPER, Item.LEATHER});
this.registerShapelessRecipe(new ItemStack(Item.BOOK_AND_QUILL, 1), new Object[] { Item.BOOK, new ItemStack(Item.INK_SACK, 1, 0), Item.FEATHER});
this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.COBBLE_WALL, 6, 0), new Object[] { "###", "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.COBBLE_WALL, 6, 1), new Object[] { "###", "###", Character.valueOf('#'), Block.MOSSY_COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Item.STICK, Character.valueOf('W'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
this.registerShapedRecipe(new ItemStack(Item.LEASH, 2), new Object[] { "~~ ", "~O ", " ~", Character.valueOf('~'), Item.STRING, Character.valueOf('O'), Item.SLIME_BALL});
this.registerShapedRecipe(new ItemStack(Block.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Block.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.BOOK});
this.registerShapedRecipe(new ItemStack(Block.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.SNOW_BALL});
this.registerShapedRecipe(new ItemStack(Block.SNOW, 6), new Object[] { "###", Character.valueOf('#'), Block.SNOW_BLOCK});
this.registerShapedRecipe(new ItemStack(Block.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BALL});
this.registerShapedRecipe(new ItemStack(Block.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BRICK});
this.registerShapedRecipe(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.GLOWSTONE_DUST});
this.registerShapedRecipe(new ItemStack(Block.QUARTZ_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.QUARTZ});
this.registerShapedRecipe(new ItemStack(Block.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.STRING});
this.registerShapedRecipe(new ItemStack(Block.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Item.SULPHUR, Character.valueOf('#'), Block.SAND});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 6), new Object[] { "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 7), new Object[] { "###", Character.valueOf('#'), Block.QUARTZ_BLOCK});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
this.registerShapedRecipe(new ItemStack(Block.LADDER, 3), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Item.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Item.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Item.SIGN, 3), new Object[] { "###", "###", " X ", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Item.CAKE, 1), new Object[] { "AAA", "BEB", "CCC", Character.valueOf('A'), Item.MILK_BUCKET, Character.valueOf('B'), Item.SUGAR, Character.valueOf('C'), Item.WHEAT, Character.valueOf('E'), Item.EGG});
this.registerShapedRecipe(new ItemStack(Item.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Item.SUGAR_CANE});
this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 0), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 0)});
this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 1), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 1)});
this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 2), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 2)});
this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 3), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 3)});
this.registerShapedRecipe(new ItemStack(Item.STICK, 4), new Object[] { "#", "#", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), Item.COAL, Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), new ItemStack(Item.COAL, 1, 1), Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Item.BOWL, 4), new Object[] { "# #", " # ", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Item.GLASS_BOTTLE, 3), new Object[] { "# #", " # ", Character.valueOf('#'), Block.GLASS});
this.registerShapedRecipe(new ItemStack(Block.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.GOLD_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.ACTIVATOR_RAIL, 6), new Object[] { "XSX", "X#X", "XSX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('S'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Block.STONE_PLATE});
this.registerShapedRecipe(new ItemStack(Item.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Item.CAULDRON, 1), new Object[] { "# #", "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Item.BREWING_STAND, 1), new Object[] { " B ", "###", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('B'), Item.BLAZE_ROD});
this.registerShapedRecipe(new ItemStack(Block.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.PUMPKIN, Character.valueOf('B'), Block.TORCH});
this.registerShapedRecipe(new ItemStack(Item.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.CHEST, Character.valueOf('B'), Item.MINECART});
this.registerShapedRecipe(new ItemStack(Item.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
this.registerShapedRecipe(new ItemStack(Item.MINECART_TNT, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.TNT, Character.valueOf('B'), Item.MINECART});
this.registerShapedRecipe(new ItemStack(Item.MINECART_HOPPER, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.HOPPER, Character.valueOf('B'), Item.MINECART});
this.registerShapedRecipe(new ItemStack(Item.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Item.FLOWER_POT, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.CLAY_BRICK});
this.registerShapedRecipe(new ItemStack(Item.FLINT_AND_STEEL, 1), new Object[] { "A ", " B", Character.valueOf('A'), Item.IRON_INGOT, Character.valueOf('B'), Item.FLINT});
this.registerShapedRecipe(new ItemStack(Item.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Item.WHEAT});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
this.registerShapedRecipe(new ItemStack(Block.BIRCH_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
this.registerShapedRecipe(new ItemStack(Block.SPRUCE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
this.registerShapedRecipe(new ItemStack(Block.JUNGLE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
this.registerShapedRecipe(new ItemStack(Item.CARROT_STICK, 1), new Object[] { "# ", " X", Character.valueOf('#'), Item.FISHING_ROD, Character.valueOf('X'), Item.CARROT}).c();
this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.SANDSTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Block.QUARTZ_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.QUARTZ_BLOCK});
this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
this.registerShapedRecipe(new ItemStack(Item.ITEM_FRAME, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.LEATHER});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Item.CARROT_GOLDEN, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.CARROT});
this.registerShapedRecipe(new ItemStack(Item.SPECKLED_MELON, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.MELON});
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.TRIPWIRE_SOURCE, 2), new Object[] { "I", "S", "#", Character.valueOf('#'), Block.WOOD, Character.valueOf('S'), Item.STICK, Character.valueOf('I'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Block.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.REDSTONE, Character.valueOf('I'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Item.REDSTONE_COMPARATOR, 1), new Object[] { " # ", "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.QUARTZ, Character.valueOf('I'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Item.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.IRON_INGOT, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.MAP_EMPTY, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.PAPER, Character.valueOf('X'), Item.COMPASS});
this.registerShapedRecipe(new ItemStack(Block.STONE_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Block.WOOD_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Block.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.IRON_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Block.GOLD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Item.GOLD_INGOT});
this.registerShapedRecipe(new ItemStack(Block.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.BOW, Character.valueOf('R'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Block.DROPPER, 1), new Object[] { "###", "# #", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('R'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Block.PISTON, 1), new Object[] { "TTT", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('T'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.PISTON_STICKY, 1), new Object[] { "S", "P", Character.valueOf('S'), Item.SLIME_BALL, Character.valueOf('P'), Block.PISTON});
this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Block.OBSIDIAN, Character.valueOf('B'), Item.BOOK, Character.valueOf('D'), Item.DIAMOND});
this.registerShapedRecipe(new ItemStack(Block.ANVIL, 1), new Object[] { "III", " i ", "iii", Character.valueOf('I'), Block.IRON_BLOCK, Character.valueOf('i'), Item.IRON_INGOT});
this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, Item.COAL});
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, new ItemStack(Item.COAL, 1, 1)});
this.registerShapedRecipe(new ItemStack(Block.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Block.GLASS, Character.valueOf('Q'), Item.QUARTZ, Character.valueOf('W'), Block.WOOD_STEP});
this.registerShapedRecipe(new ItemStack(Block.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Item.IRON_INGOT, Character.valueOf('C'), Block.CHEST});
this.registerShapedRecipe(new ItemStack(Items.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Items.SUGAR_CANE});
this.registerShapelessRecipe(new ItemStack(Items.BOOK, 1), new Object[] { Items.PAPER, Items.PAPER, Items.PAPER, Items.LEATHER});
this.registerShapelessRecipe(new ItemStack(Items.BOOK_AND_QUILL, 1), new Object[] { Items.BOOK, new ItemStack(Items.INK_SACK, 1, 0), Items.FEATHER});
this.registerShapedRecipe(new ItemStack(Blocks.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Blocks.COBBLE_WALL, 6, 0), new Object[] { "###", "###", Character.valueOf('#'), Blocks.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Blocks.COBBLE_WALL, 6, 1), new Object[] { "###", "###", Character.valueOf('#'), Blocks.MOSSY_COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Blocks.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Blocks.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Items.STICK, Character.valueOf('W'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Blocks.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.DIAMOND});
this.registerShapedRecipe(new ItemStack(Items.LEASH, 2), new Object[] { "~~ ", "~O ", " ~", Character.valueOf('~'), Items.STRING, Character.valueOf('O'), Items.SLIME_BALL});
this.registerShapedRecipe(new ItemStack(Blocks.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.REDSTONE});
this.registerShapedRecipe(new ItemStack(Blocks.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.BOOK});
this.registerShapedRecipe(new ItemStack(Blocks.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.SNOW_BALL});
this.registerShapedRecipe(new ItemStack(Blocks.SNOW, 6), new Object[] { "###", Character.valueOf('#'), Blocks.SNOW_BLOCK});
this.registerShapedRecipe(new ItemStack(Blocks.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.CLAY_BALL});
this.registerShapedRecipe(new ItemStack(Blocks.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.CLAY_BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.GLOWSTONE_DUST});
this.registerShapedRecipe(new ItemStack(Blocks.QUARTZ_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.QUARTZ});
this.registerShapedRecipe(new ItemStack(Blocks.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Items.STRING});
this.registerShapedRecipe(new ItemStack(Blocks.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Items.SULPHUR, Character.valueOf('#'), Blocks.SAND});
this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), Blocks.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), Blocks.STONE});
this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), Blocks.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Blocks.BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Blocks.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 6), new Object[] { "###", Character.valueOf('#'), Blocks.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.STEP, 6, 7), new Object[] { "###", Character.valueOf('#'), Blocks.QUARTZ_BLOCK});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 0)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 2)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 1)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 3)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 4)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 5)});
this.registerShapedRecipe(new ItemStack(Blocks.LADDER, 3), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Items.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Blocks.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Items.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Items.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Items.SIGN, 3), new Object[] { "###", "###", " X ", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('X'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Items.CAKE, 1), new Object[] { "AAA", "BEB", "CCC", Character.valueOf('A'), Items.MILK_BUCKET, Character.valueOf('B'), Items.SUGAR, Character.valueOf('C'), Items.WHEAT, Character.valueOf('E'), Items.EGG});
this.registerShapedRecipe(new ItemStack(Items.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Items.SUGAR_CANE});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 0), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 0)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 1), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 1)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 2), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 2)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 3), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG, 1, 3)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 4), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG2, 1, 0)});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD, 4, 5), new Object[] { "#", Character.valueOf('#'), new ItemStack(Blocks.LOG2, 1, 1)});
this.registerShapedRecipe(new ItemStack(Items.STICK, 4), new Object[] { "#", "#", Character.valueOf('#'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Blocks.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), Items.COAL, Character.valueOf('#'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Blocks.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), new ItemStack(Items.COAL, 1, 1), Character.valueOf('#'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Items.BOWL, 4), new Object[] { "# #", " # ", Character.valueOf('#'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Items.GLASS_BOTTLE, 3), new Object[] { "# #", " # ", Character.valueOf('#'), Blocks.GLASS});
this.registerShapedRecipe(new ItemStack(Blocks.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('#'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Blocks.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Items.GOLD_INGOT, Character.valueOf('R'), Items.REDSTONE, Character.valueOf('#'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Blocks.ACTIVATOR_RAIL, 6), new Object[] { "XSX", "X#X", "XSX", Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('#'), Blocks.REDSTONE_TORCH_ON, Character.valueOf('S'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Blocks.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('R'), Items.REDSTONE, Character.valueOf('#'), Blocks.STONE_PLATE});
this.registerShapedRecipe(new ItemStack(Items.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Items.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Items.CAULDRON, 1), new Object[] { "# #", "# #", "###", Character.valueOf('#'), Items.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Items.BREWING_STAND, 1), new Object[] { " B ", "###", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('B'), Items.BLAZE_ROD});
this.registerShapedRecipe(new ItemStack(Blocks.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.PUMPKIN, Character.valueOf('B'), Blocks.TORCH});
this.registerShapedRecipe(new ItemStack(Items.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.CHEST, Character.valueOf('B'), Items.MINECART});
this.registerShapedRecipe(new ItemStack(Items.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.FURNACE, Character.valueOf('B'), Items.MINECART});
this.registerShapedRecipe(new ItemStack(Items.MINECART_TNT, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.TNT, Character.valueOf('B'), Items.MINECART});
this.registerShapedRecipe(new ItemStack(Items.MINECART_HOPPER, 1), new Object[] { "A", "B", Character.valueOf('A'), Blocks.HOPPER, Character.valueOf('B'), Items.MINECART});
this.registerShapedRecipe(new ItemStack(Items.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Items.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Items.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Items.FLOWER_POT, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Items.CLAY_BRICK});
this.registerShapelessRecipe(new ItemStack(Items.FLINT_AND_STEEL, 1), new Object[] { new ItemStack(Items.IRON_INGOT, 1), new ItemStack(Items.FLINT, 1)});
this.registerShapedRecipe(new ItemStack(Items.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Items.WHEAT});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 0)});
this.registerShapedRecipe(new ItemStack(Blocks.BIRCH_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 2)});
this.registerShapedRecipe(new ItemStack(Blocks.SPRUCE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 1)});
this.registerShapedRecipe(new ItemStack(Blocks.JUNGLE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 3)});
this.registerShapedRecipe(new ItemStack(Blocks.ACACIA_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 4)});
this.registerShapedRecipe(new ItemStack(Blocks.DARK_OAK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Blocks.WOOD, 1, 5)});
this.registerShapedRecipe(new ItemStack(Items.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Items.STRING});
this.registerShapedRecipe(new ItemStack(Items.CARROT_STICK, 1), new Object[] { "# ", " X", Character.valueOf('#'), Items.FISHING_ROD, Character.valueOf('X'), Items.CARROT}).c();
this.registerShapedRecipe(new ItemStack(Blocks.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Blocks.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Blocks.SANDSTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Blocks.QUARTZ_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Blocks.QUARTZ_BLOCK});
this.registerShapedRecipe(new ItemStack(Items.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Blocks.WOOL});
this.registerShapedRecipe(new ItemStack(Items.ITEM_FRAME, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Items.LEATHER});
this.registerShapedRecipe(new ItemStack(Items.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.GOLD_INGOT, Character.valueOf('X'), Items.APPLE});
this.registerShapedRecipe(new ItemStack(Items.GOLDEN_APPLE, 1, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Blocks.GOLD_BLOCK, Character.valueOf('X'), Items.APPLE});
this.registerShapedRecipe(new ItemStack(Items.CARROT_GOLDEN, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.GOLD_NUGGET, Character.valueOf('X'), Items.CARROT});
this.registerShapedRecipe(new ItemStack(Items.SPECKLED_MELON, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.GOLD_NUGGET, Character.valueOf('X'), Items.MELON});
this.registerShapedRecipe(new ItemStack(Blocks.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('X'), Items.STICK});
this.registerShapedRecipe(new ItemStack(Blocks.TRIPWIRE_SOURCE, 2), new Object[] { "I", "S", "#", Character.valueOf('#'), Blocks.WOOD, Character.valueOf('S'), Items.STICK, Character.valueOf('I'), Items.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Blocks.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Items.STICK, Character.valueOf('X'), Items.REDSTONE});
this.registerShapedRecipe(new ItemStack(Items.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Blocks.REDSTONE_TORCH_ON, Character.valueOf('X'), Items.REDSTONE, Character.valueOf('I'), Blocks.STONE});
this.registerShapedRecipe(new ItemStack(Items.REDSTONE_COMPARATOR, 1), new Object[] { " # ", "#X#", "III", Character.valueOf('#'), Blocks.REDSTONE_TORCH_ON, Character.valueOf('X'), Items.QUARTZ, Character.valueOf('I'), Blocks.STONE});
this.registerShapedRecipe(new ItemStack(Items.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Items.GOLD_INGOT, Character.valueOf('X'), Items.REDSTONE});
this.registerShapedRecipe(new ItemStack(Items.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Items.IRON_INGOT, Character.valueOf('X'), Items.REDSTONE});
this.registerShapedRecipe(new ItemStack(Items.MAP_EMPTY, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Items.PAPER, Character.valueOf('X'), Items.COMPASS});
this.registerShapedRecipe(new ItemStack(Blocks.STONE_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Blocks.STONE});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Blocks.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Blocks.STONE});
this.registerShapedRecipe(new ItemStack(Blocks.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Blocks.IRON_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Items.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Blocks.GOLD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Items.GOLD_INGOT});
this.registerShapedRecipe(new ItemStack(Blocks.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('X'), Items.BOW, Character.valueOf('R'), Items.REDSTONE});
this.registerShapedRecipe(new ItemStack(Blocks.DROPPER, 1), new Object[] { "###", "# #", "#R#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('R'), Items.REDSTONE});
this.registerShapedRecipe(new ItemStack(Blocks.PISTON, 1), new Object[] { "TTT", "#X#", "#R#", Character.valueOf('#'), Blocks.COBBLESTONE, Character.valueOf('X'), Items.IRON_INGOT, Character.valueOf('R'), Items.REDSTONE, Character.valueOf('T'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Blocks.PISTON_STICKY, 1), new Object[] { "S", "P", Character.valueOf('S'), Items.SLIME_BALL, Character.valueOf('P'), Blocks.PISTON});
this.registerShapedRecipe(new ItemStack(Items.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Blocks.WOOL, Character.valueOf('X'), Blocks.WOOD});
this.registerShapedRecipe(new ItemStack(Blocks.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Blocks.OBSIDIAN, Character.valueOf('B'), Items.BOOK, Character.valueOf('D'), Items.DIAMOND});
this.registerShapedRecipe(new ItemStack(Blocks.ANVIL, 1), new Object[] { "III", " i ", "iii", Character.valueOf('I'), Blocks.IRON_BLOCK, Character.valueOf('i'), Items.IRON_INGOT});
this.registerShapelessRecipe(new ItemStack(Items.EYE_OF_ENDER, 1), new Object[] { Items.ENDER_PEARL, Items.BLAZE_POWDER});
this.registerShapelessRecipe(new ItemStack(Items.FIREBALL, 3), new Object[] { Items.SULPHUR, Items.BLAZE_POWDER, Items.COAL});
this.registerShapelessRecipe(new ItemStack(Items.FIREBALL, 3), new Object[] { Items.SULPHUR, Items.BLAZE_POWDER, new ItemStack(Items.COAL, 1, 1)});
this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOOD_STEP});
this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST});
// Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
this.sort(); // CraftBukkit - call new sort method
}
@ -261,8 +268,8 @@ public class CraftingManager {
}
}
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].usesDurability()) {
Item item = Item.byId[itemstack.id];
if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.count == 1 && itemstack1.count == 1 && itemstack.getItem().usesDurability()) {
Item item = itemstack.getItem();
int k = item.getMaxDurability() - itemstack.j();
int l = item.getMaxDurability() - itemstack1.j();
int i1 = k + l + item.getMaxDurability() * 5 / 100;
@ -273,7 +280,7 @@ public class CraftingManager {
}
// CraftBukkit start - Construct a dummy repair recipe
ItemStack result = new ItemStack(itemstack.id, 1, j1);
ItemStack result = new ItemStack(itemstack.getItem(), 1, j1);
List<ItemStack> ingredients = new ArrayList<ItemStack>();
ingredients.add(itemstack.cloneItemStack());
ingredients.add(itemstack1.cloneItemStack());

Datei anzeigen

@ -2,7 +2,6 @@ package net.minecraft.server;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
@ -12,48 +11,57 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import net.minecraft.util.org.apache.commons.io.IOUtils;
import net.minecraft.util.org.apache.commons.lang3.ArrayUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class CrashReport {
private final String a;
private final Throwable b;
private final CrashReportSystemDetails c = new CrashReportSystemDetails(this, "System Details");
private final List d = new ArrayList();
private File e;
private boolean f = true;
private StackTraceElement[] g = new StackTraceElement[0];
private static final Logger a = LogManager.getLogger();
private final String b;
private final Throwable c;
private final CrashReportSystemDetails d = new CrashReportSystemDetails(this, "System Details");
private final List e = new ArrayList();
private File f;
private boolean g = true;
private StackTraceElement[] h = new StackTraceElement[0];
public CrashReport(String s, Throwable throwable) {
this.a = s;
this.b = throwable;
this.b = s;
this.c = throwable;
this.h();
}
private void h() {
this.c.a("Minecraft Version", (Callable) (new CrashReportVersion(this)));
this.c.a("Operating System", (Callable) (new CrashReportOperatingSystem(this)));
this.c.a("Java Version", (Callable) (new CrashReportJavaVersion(this)));
this.c.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
this.c.a("Memory", (Callable) (new CrashReportMemory(this)));
this.c.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
this.c.a("AABB Pool Size", (Callable) (new CrashReportAABBPoolSize(this)));
this.c.a("Suspicious classes", (Callable) (new CrashReportSuspiciousClasses(this)));
this.c.a("IntCache", (Callable) (new CrashReportIntCacheSize(this)));
this.c.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
this.d.a("Minecraft Version", (Callable) (new CrashReportVersion(this)));
this.d.a("Operating System", (Callable) (new CrashReportOperatingSystem(this)));
this.d.a("Java Version", (Callable) (new CrashReportJavaVersion(this)));
this.d.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
this.d.a("Memory", (Callable) (new CrashReportMemory(this)));
this.d.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
this.d.a("AABB Pool Size", (Callable) (new CrashReportAABBPoolSize(this)));
this.d.a("IntCache", (Callable) (new CrashReportIntCacheSize(this)));
this.d.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
}
public String a() {
return this.a;
}
public Throwable b() {
return this.b;
}
public Throwable b() {
return this.c;
}
public void a(StringBuilder stringbuilder) {
if (this.g != null && this.g.length > 0) {
if ((this.h == null || this.h.length <= 0) && this.e.size() > 0) {
this.h = (StackTraceElement[]) ArrayUtils.subarray(((CrashReportSystemDetails) this.e.get(0)).a(), 0, 1);
}
if (this.h != null && this.h.length > 0) {
stringbuilder.append("-- Head --\n");
stringbuilder.append("Stacktrace:\n");
StackTraceElement[] astacktraceelement = this.g;
StackTraceElement[] astacktraceelement = this.h;
int i = astacktraceelement.length;
for (int j = 0; j < i; ++j) {
@ -66,7 +74,7 @@ public class CrashReport {
stringbuilder.append("\n");
}
Iterator iterator = this.d.iterator();
Iterator iterator = this.e.iterator();
while (iterator.hasNext()) {
CrashReportSystemDetails crashreportsystemdetails = (CrashReportSystemDetails) iterator.next();
@ -75,31 +83,36 @@ public class CrashReport {
stringbuilder.append("\n\n");
}
this.c.a(stringbuilder);
this.d.a(stringbuilder);
}
public String d() {
StringWriter stringwriter = null;
PrintWriter printwriter = null;
String s = this.b.toString();
Object object = this.c;
if (((Throwable) object).getMessage() == null) {
if (object instanceof NullPointerException) {
object = new NullPointerException(this.b);
} else if (object instanceof StackOverflowError) {
object = new StackOverflowError(this.b);
} else if (object instanceof OutOfMemoryError) {
object = new OutOfMemoryError(this.b);
}
((Throwable) object).setStackTrace(this.c.getStackTrace());
}
String s = ((Throwable) object).toString();
try {
stringwriter = new StringWriter();
printwriter = new PrintWriter(stringwriter);
this.b.printStackTrace(printwriter);
((Throwable) object).printStackTrace(printwriter);
s = stringwriter.toString();
} finally {
try {
if (stringwriter != null) {
stringwriter.close();
}
if (printwriter != null) {
printwriter.close();
}
} catch (IOException ioexception) {
;
}
IOUtils.closeQuietly(stringwriter);
IOUtils.closeQuietly(printwriter);
}
return s;
@ -116,7 +129,7 @@ public class CrashReport {
stringbuilder.append((new SimpleDateFormat()).format(new Date()));
stringbuilder.append("\n");
stringbuilder.append("Description: ");
stringbuilder.append(this.a);
stringbuilder.append(this.b);
stringbuilder.append("\n\n");
stringbuilder.append(this.d());
stringbuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
@ -130,8 +143,8 @@ public class CrashReport {
return stringbuilder.toString();
}
public boolean a(File file1, IConsoleLogManager iconsolelogmanager) {
if (this.e != null) {
public boolean a(File file1) {
if (this.f != null) {
return false;
} else {
if (file1.getParentFile() != null) {
@ -143,17 +156,17 @@ public class CrashReport {
filewriter.write(this.e());
filewriter.close();
this.e = file1;
this.f = file1;
return true;
} catch (Throwable throwable) {
iconsolelogmanager.severe("Could not save crash report to " + file1, throwable);
a.error("Could not save crash report to " + file1, throwable);
return false;
}
}
}
public CrashReportSystemDetails g() {
return this.c;
return this.d;
}
public CrashReportSystemDetails a(String s) {
@ -163,9 +176,9 @@ public class CrashReport {
public CrashReportSystemDetails a(String s, int i) {
CrashReportSystemDetails crashreportsystemdetails = new CrashReportSystemDetails(this, s);
if (this.f) {
if (this.g) {
int j = crashreportsystemdetails.a(i);
StackTraceElement[] astacktraceelement = this.b.getStackTrace();
StackTraceElement[] astacktraceelement = this.c.getStackTrace();
StackTraceElement stacktraceelement = null;
StackTraceElement stacktraceelement1 = null;
@ -176,20 +189,20 @@ public class CrashReport {
}
}
this.f = crashreportsystemdetails.a(stacktraceelement, stacktraceelement1);
if (j > 0 && !this.d.isEmpty()) {
CrashReportSystemDetails crashreportsystemdetails1 = (CrashReportSystemDetails) this.d.get(this.d.size() - 1);
this.g = crashreportsystemdetails.a(stacktraceelement, stacktraceelement1);
if (j > 0 && !this.e.isEmpty()) {
CrashReportSystemDetails crashreportsystemdetails1 = (CrashReportSystemDetails) this.e.get(this.e.size() - 1);
crashreportsystemdetails1.b(j);
} else if (astacktraceelement != null && astacktraceelement.length >= j) {
this.g = new StackTraceElement[astacktraceelement.length - j];
System.arraycopy(astacktraceelement, 0, this.g, 0, this.g.length);
this.h = new StackTraceElement[astacktraceelement.length - j];
System.arraycopy(astacktraceelement, 0, this.h, 0, this.h.length);
} else {
this.f = false;
this.g = false;
}
}
this.d.add(crashreportsystemdetails);
this.e.add(crashreportsystemdetails);
return crashreportsystemdetails;
}

Datei anzeigen

@ -3,15 +3,19 @@ package net.minecraft.server;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// CraftBukkit start
import java.io.PrintStream;
import java.util.logging.Level;
import org.apache.logging.log4j.Level;
import org.bukkit.craftbukkit.LoggerOutputStream;
import org.bukkit.event.server.ServerCommandEvent;
@ -19,43 +23,51 @@ import org.bukkit.event.server.ServerCommandEvent;
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private final List l = Collections.synchronizedList(new ArrayList());
private final IConsoleLogManager m;
private RemoteStatusListener n;
private RemoteControlListener o;
private static final Logger h = LogManager.getLogger();
private final List i = Collections.synchronizedList(new ArrayList());
private RemoteStatusListener j;
private RemoteControlListener k;
public PropertyManager propertyManager; // CraftBukkit - private -> public
private boolean generateStructures;
private EnumGamemode r;
private ServerConnection s;
private boolean t;
private EnumGamemode n;
private boolean o;
// CraftBukkit start - Signature changed
public DedicatedServer(joptsimple.OptionSet options) {
super(options);
super(options, Proxy.NO_PROXY);
// super(file1, Proxy.NO_PROXY);
// CraftBukkit end
this.m = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument
new ThreadSleepForever(this);
new ThreadSleepForever(this, "Server Infinisleeper");
}
protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this, "Server console handler");
threadcommandreader.setDaemon(true);
threadcommandreader.start();
// CraftBukkit start
System.setOut(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.SEVERE), true));
// CraftBukkit end
this.getLogger().info("Starting minecraft server version 1.6.4");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
this.getLogger().warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
// CraftBukkit start - TODO: See if this needs fixing
final org.apache.logging.log4j.core.Logger realLogger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger());
for (org.apache.logging.log4j.core.Appender appender : realLogger.getAppenders().values()) {
if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) {
realLogger.removeAppender(appender);
}
}
this.getLogger().info("Loading properties");
this.propertyManager = new PropertyManager(this.options, this.getLogger()); // CraftBukkit - CLI argument support
if (this.K()) {
new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start();
System.setOut(new PrintStream(new LoggerOutputStream(realLogger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(realLogger, Level.WARN), true));
// CraftBukkit end
h.info("Starting minecraft server version 1.7.2");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
h.info("Loading properties");
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
if (this.L()) {
this.c("127.0.0.1");
} else {
this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
@ -66,10 +78,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true));
this.setPvP(this.propertyManager.getBoolean("pvp", true));
this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
this.setTexturePack(this.propertyManager.getString("texture-pack", ""));
this.setTexturePack(this.propertyManager.getString("resource-pack", ""));
this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
this.setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false));
this.e(this.propertyManager.getInt("player-idle-timeout", 0));
this.d(this.propertyManager.getInt("player-idle-timeout", 0));
if (this.propertyManager.getInt("difficulty", 1) < 0) {
this.propertyManager.a("difficulty", Integer.valueOf(0));
} else if (this.propertyManager.getInt("difficulty", 1) > 3) {
@ -79,45 +91,45 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
this.r = WorldSettings.a(i);
this.getLogger().info("Default game type: " + this.r);
this.n = WorldSettings.a(i);
h.info("Default game type: " + this.n);
InetAddress inetaddress = null;
if (this.getServerIp().length() > 0) {
inetaddress = InetAddress.getByName(this.getServerIp());
}
if (this.I() < 0) {
if (this.J() < 0) {
this.setPort(this.propertyManager.getInt("server-port", 25565));
}
this.getLogger().info("Generating keypair");
h.info("Generating keypair");
this.a(MinecraftEncryption.b());
this.getLogger().info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.I());
h.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.J());
try {
this.s = new DedicatedServerConnection(this, inetaddress, this.I());
this.ag().a(inetaddress, this.J());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
this.getLogger().warning("**** FAILED TO BIND TO PORT!");
this.getLogger().warning("The exception was: {0}", new Object[] { ioexception.toString()});
this.getLogger().warning("Perhaps a server is already running on that port?");
h.warn("**** FAILED TO BIND TO PORT!");
h.warn("The exception was: {}", new Object[] { ioexception.toString()});
h.warn("Perhaps a server is already running on that port?");
return false;
}
this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
if (!this.getOnlineMode()) {
this.getLogger().warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
this.getLogger().warning("The server will make no attempt to authenticate usernames. Beware.");
this.getLogger().warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
this.getLogger().warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
h.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
h.warn("The server will make no attempt to authenticate usernames. Beware.");
h.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
h.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
long j = System.nanoTime();
if (this.L() == null) {
if (this.M() == null) {
this.k(this.propertyManager.getString("level-name", "world"));
}
@ -144,32 +156,36 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
worldtype = WorldType.NORMAL;
}
this.d(this.propertyManager.getInt("max-build-height", 256));
this.d((this.getMaxBuildHeight() + 8) / 16 * 16);
this.d(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
this.ar();
this.getEnableCommandBlock();
this.l();
this.getSnooperEnabled();
this.c(this.propertyManager.getInt("max-build-height", 256));
this.c((this.getMaxBuildHeight() + 8) / 16 * 16);
this.c(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
this.getLogger().info("Preparing level \"" + this.L() + "\"");
this.a(this.L(), this.L(), k, worldtype, s2);
h.info("Preparing level \"" + this.M() + "\"");
this.a(this.M(), this.M(), k, worldtype, s2);
long i1 = System.nanoTime() - j;
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
this.getLogger().info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
h.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
if (this.propertyManager.getBoolean("enable-query", false)) {
this.getLogger().info("Starting GS4 status listener");
this.n = new RemoteStatusListener(this);
this.n.a();
h.info("Starting GS4 status listener");
this.j = new RemoteStatusListener(this);
this.j.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false)) {
this.getLogger().info("Starting remote control listener");
this.o = new RemoteControlListener(this);
this.o.a();
h.info("Starting remote control listener");
this.k = new RemoteControlListener(this);
this.k.a();
this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
}
// CraftBukkit start
if (this.server.getBukkitSpawnRadius() > -1) {
this.getLogger().info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
h.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
this.propertyManager.properties.remove("spawn-protection");
this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
this.server.removeBukkitSpawnRadius();
@ -189,11 +205,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public EnumGamemode getGamemode() {
return this.r;
return this.n;
}
public int getDifficulty() {
return Math.max(0, Math.min(3, this.propertyManager.getInt("difficulty", 1))); // CraftBukkit - clamp values
public EnumDifficulty getDifficulty() {
return EnumDifficulty.a(this.propertyManager.getInt("difficulty", 1));
}
public boolean isHardcore() {
@ -202,12 +218,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
protected void a(CrashReport crashreport) {
while (this.isRunning()) {
this.as();
this.aw();
try {
Thread.sleep(10L);
} catch (InterruptedException interruptedexception) {
interruptedexception.printStackTrace();
;
}
}
}
@ -219,13 +235,13 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return crashreport;
}
protected void r() {
protected void s() {
System.exit(0);
}
public void t() { // CraftBukkit - protected -> public
super.t();
this.as();
public void u() { // CraftBukkit - protected -> public
super.u();
this.aw();
}
public boolean getAllowNether() {
@ -237,8 +253,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.at().getHasWhitelist()));
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.at().getWhitelisted().size()));
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.ax().getHasWhitelist()));
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.ax().getWhitelisted().size()));
super.a(mojangstatisticsgenerator);
}
@ -247,12 +263,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void issueCommand(String s, ICommandListener icommandlistener) {
this.l.add(new ServerCommand(s, icommandlistener));
this.i.add(new ServerCommand(s, icommandlistener));
}
public void as() {
while (!this.l.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
public void aw() {
while (!this.i.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.i.remove(0);
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
@ -269,14 +285,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return true;
}
public DedicatedPlayerList at() {
public DedicatedPlayerList ax() {
return (DedicatedPlayerList) super.getPlayerList();
}
public ServerConnection ag() {
return this.s;
}
public int a(String s, int i) {
return this.propertyManager.getInt(s, i);
}
@ -297,19 +309,19 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.propertyManager.savePropertiesFile();
}
public String b_() {
public String b() {
File file1 = this.propertyManager.c();
return file1 != null ? file1.getAbsolutePath() : "No settings file";
}
public void au() {
public void ay() {
ServerGUI.a(this);
this.t = true;
this.o = true;
}
public boolean ai() {
return this.t;
return this.o;
}
public String a(EnumGamemode enumgamemode, boolean flag) {
@ -327,9 +339,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.worldProvider.dimension != 0) {
return false;
} else if (this.at().getOPs().isEmpty()) {
} else if (this.ax().getOPs().isEmpty()) {
return false;
} else if (this.at().isOp(entityhuman.getName())) {
} else if (this.ax().isOp(entityhuman.getName())) {
return false;
} else if (this.getSpawnProtection() <= 0) {
return false;
@ -343,21 +355,25 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
}
public IConsoleLogManager getLogger() {
return this.m;
}
public int k() {
public int l() {
return this.propertyManager.getInt("op-permission-level", 4);
}
public void e(int i) {
super.e(i);
public void d(int i) {
super.d(i);
this.propertyManager.a("player-idle-timeout", Integer.valueOf(i));
this.a();
}
public boolean ar() {
return this.propertyManager.getBoolean("announce-player-achievements", true);
}
public PlayerList getPlayerList() {
return this.at();
return this.ax();
}
static Logger az() {
return h;
}
}

Datei anzeigen

@ -1,123 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
public class DedicatedServerConnectionThread extends Thread {
private final List a = Collections.synchronizedList(new ArrayList());
private final HashMap b = new HashMap();
private int c;
private final ServerSocket d;
private ServerConnection e;
private final InetAddress f;
private final int g;
long connectionThrottle; // CraftBukkit
public DedicatedServerConnectionThread(ServerConnection serverconnection, InetAddress inetaddress, int i) throws IOException { // CraftBukkit - added throws
super("Listen thread");
this.e = serverconnection;
this.g = i;
this.d = new ServerSocket(i, 0, inetaddress);
this.f = inetaddress == null ? this.d.getInetAddress() : inetaddress;
this.d.setPerformancePreferences(0, 2, 1);
}
public void a() {
List list = this.a;
synchronized (this.a) {
for (int i = 0; i < this.a.size(); ++i) {
PendingConnection pendingconnection = (PendingConnection) this.a.get(i);
try {
pendingconnection.d();
} catch (Exception exception) {
pendingconnection.disconnect("Internal server error");
this.e.d().getLogger().warning("Failed to handle packet for " + pendingconnection.getName() + ": " + exception, (Throwable) exception);
}
if (pendingconnection.b) {
this.a.remove(i--);
}
pendingconnection.networkManager.a();
}
}
}
public void run() {
while (this.e.a) {
try {
Socket socket = this.d.accept();
// CraftBukkit start - Connection throttle
InetAddress address = socket.getInetAddress();
long currentTime = System.currentTimeMillis();
if (((MinecraftServer) this.e.d()).server == null) {
socket.close();
continue;
}
connectionThrottle = ((MinecraftServer) this.e.d()).server.getConnectionThrottle();
synchronized (this.b) {
if (this.b.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ((Long) this.b.get(address)).longValue() < connectionThrottle) {
this.b.put(address, Long.valueOf(currentTime));
socket.close();
continue;
}
this.b.put(address, Long.valueOf(currentTime));
}
// CraftBukkit end
PendingConnection pendingconnection = new PendingConnection(this.e.d(), socket, "Connection #" + this.c++);
this.a(pendingconnection);
} catch (IOException ioexception) {
this.e.d().getLogger().warning("DSCT: " + ioexception.getMessage()); // CraftBukkit
}
}
this.e.d().getLogger().info("Closing listening thread");
}
private void a(PendingConnection pendingconnection) {
if (pendingconnection == null) {
throw new IllegalArgumentException("Got null pendingconnection!");
} else {
List list = this.a;
synchronized (this.a) {
this.a.add(pendingconnection);
}
}
}
public void a(InetAddress inetaddress) {
if (inetaddress != null) {
HashMap hashmap = this.b;
synchronized (this.b) {
this.b.remove(inetaddress);
}
}
}
public void b() {
try {
this.d.close();
} catch (Throwable throwable) {
;
}
}
}

Datei anzeigen

@ -12,7 +12,7 @@ final class DispenseBehaviorArmor extends DispenseBehaviorItem {
DispenseBehaviorArmor() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();

Datei anzeigen

@ -12,7 +12,7 @@ final class DispenseBehaviorBoat extends DispenseBehaviorItem {
DispenseBehaviorBoat() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
@ -20,13 +20,13 @@ final class DispenseBehaviorBoat extends DispenseBehaviorItem {
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
Material material = world.getMaterial(i, j, k);
Material material = world.getType(i, j, k).getMaterial();
double d3;
if (Material.WATER.equals(material)) {
d3 = 1.0D;
} else {
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getMaterial(i, j - 1, k))) {
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getType(i, j - 1, k).getMaterial())) {
return this.b.a(isourceblock, itemstack);
}

Datei anzeigen

@ -13,7 +13,7 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
if (itemstack.getData() == 15) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();

Datei anzeigen

@ -12,23 +12,23 @@ final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
DispenseBehaviorEmptyBucket() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
Material material = world.getMaterial(i, j, k);
Material material = world.getType(i, j, k).getMaterial();
int l = world.getData(i, j, k);
Item item;
if (Material.WATER.equals(material) && l == 0) {
item = Item.WATER_BUCKET;
item = Items.WATER_BUCKET;
} else {
if (!Material.LAVA.equals(material) || l != 0) {
return super.b(isourceblock, itemstack);
}
item = Item.LAVA_BUCKET;
item = Items.LAVA_BUCKET;
}
// CraftBukkit start
@ -57,7 +57,7 @@ final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
world.setAir(i, j, k);
if (--itemstack.count == 0) {
itemstack.id = item.id;
itemstack.setItem(item);
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
this.b.a(isourceblock, new ItemStack(item));

Datei anzeigen

@ -16,14 +16,14 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
int i = isourceblock.getBlockX();
int j = isourceblock.getBlockY();
int k = isourceblock.getBlockZ();
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
// CraftBukkit start
World world = isourceblock.k();
int x = i + enumfacing.c();
int y = j + enumfacing.d();
int z = k + enumfacing.e();
if (world.isEmpty(x, y, z) || !world.getMaterial(x, y, z).isBuildable()) {
if (world.isEmpty(x, y, z) || !world.getType(x, y, z).getMaterial().isBuildable()) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
@ -52,9 +52,9 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
if (itembucket.a(isourceblock.k(), i + enumfacing.c(), j + enumfacing.d(), k + enumfacing.e())) {
// CraftBukkit start - Handle stacked buckets
Item item = Item.BUCKET;
Item item = Items.BUCKET;
if (--itemstack.count == 0) {
itemstack.id = item.id;
itemstack.setItem(Items.BUCKET);
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
this.b.a(isourceblock, new ItemStack(item));

Datei anzeigen

@ -12,7 +12,7 @@ final class DispenseBehaviorFireball extends DispenseBehaviorItem {
DispenseBehaviorFireball() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
double d0 = iposition.getX() + (double) ((float) enumfacing.c() * 0.3F);
double d1 = iposition.getY() + (double) ((float) enumfacing.c() * 0.3F);

Datei anzeigen

@ -10,7 +10,7 @@ final class DispenseBehaviorFireworks extends DispenseBehaviorItem {
DispenseBehaviorFireworks() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();

Datei anzeigen

@ -12,7 +12,7 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
DispenseBehaviorFlintAndSteel() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
@ -45,14 +45,14 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
if (world.isEmpty(i, j, k)) {
// CraftBukkit start - Ignition by dispensing flint and steel
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()).isCancelled()) {
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
world.setTypeUpdate(i, j, k, Blocks.FIRE);
if (itemstack.isDamaged(1, world.random)) {
itemstack.count = 0;
}
}
// CraftBukkit end
} else if (world.getTypeId(i, j, k) == Block.TNT.id) {
Block.TNT.postBreak(world, i, j, k, 1);
} else if (world.getType(i, j, k) == Blocks.TNT) {
Blocks.TNT.postBreak(world, i, j, k, 1);
world.setAir(i, j, k);
} else {
this.b = false;

Datei anzeigen

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

Datei anzeigen

@ -12,7 +12,7 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
DispenseBehaviorMinecart() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
@ -20,13 +20,13 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
int l = world.getTypeId(i, j, k);
Block block = world.getType(i, j, k);
double d3;
if (BlockMinecartTrackAbstract.e_(l)) {
if (BlockMinecartTrackAbstract.a(block)) {
d3 = 0.0D;
} else {
if (l != 0 || !BlockMinecartTrackAbstract.e_(world.getTypeId(i, j - 1, k))) {
if (block.getMaterial() != Material.AIR || !BlockMinecartTrackAbstract.a(world.getType(i, j - 1, k))) {
return this.b.a(isourceblock, itemstack);
}
@ -35,10 +35,10 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
// CraftBukkit start
ItemStack itemstack1 = itemstack.a(1);
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
if (!BlockDispenser.eventFired) {
world.getServer().getPluginManager().callEvent(event);
}

Datei anzeigen

@ -10,7 +10,7 @@ final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
DispenseBehaviorMonsterEgg() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();

Datei anzeigen

@ -12,7 +12,7 @@ public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.k();
IPosition iposition = BlockDispenser.a(isourceblock);
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
IProjectile iprojectile = this.a(world, iposition);
// CraftBukkit start

Datei anzeigen

@ -10,7 +10,7 @@ final class DispenseBehaviorTNT extends DispenseBehaviorItem {
DispenseBehaviorTNT() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
EnumFacing enumfacing = BlockDispenser.b(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();

Datei anzeigen

@ -29,6 +29,8 @@ public abstract class Enchantment {
public static final Enchantment ARROW_KNOCKBACK = new EnchantmentArrowKnockback(49, 2);
public static final Enchantment ARROW_FIRE = new EnchantmentFlameArrows(50, 2);
public static final Enchantment ARROW_INFINITE = new EnchantmentInfiniteArrows(51, 1);
public static final Enchantment LUCK = new EnchantmentLootBonus(61, 2, EnchantmentSlotType.FISHING_ROD);
public static final Enchantment LURE = new EnchantmentLure(62, 2, EnchantmentSlotType.FISHING_ROD);
public final int id;
private final int weight;
public EnchantmentSlotType slot;
@ -98,6 +100,10 @@ public abstract class Enchantment {
return this.slot.canEnchant(itemstack.getItem());
}
public void a(EntityLiving entityliving, Entity entity, int i) {}
public void b(EntityLiving entityliving, Entity entity, int i) {}
static {
ArrayList arraylist = new ArrayList();
Enchantment[] aenchantment = byId;

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -15,7 +15,7 @@ public abstract class EntityAgeable extends EntityCreature {
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id) {
if (itemstack != null && itemstack.getItem() == Items.MONSTER_EGG) {
if (!this.world.isStatic) {
Class oclass = EntityTypes.a(itemstack.getData());
@ -46,8 +46,8 @@ public abstract class EntityAgeable extends EntityCreature {
}
}
protected void a() {
super.a();
protected void c() {
super.c();
this.datawatcher.a(12, new Integer(0));
}
@ -83,8 +83,8 @@ public abstract class EntityAgeable extends EntityCreature {
this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
}
public void c() {
super.c();
public void e() {
super.e();
if (this.world.isStatic || this.ageLocked) { // CraftBukkit
this.a(this.isBaby());
} else {

Datei anzeigen

@ -12,7 +12,7 @@ public class EntityArrow extends Entity implements IProjectile {
private int d = -1;
private int e = -1;
private int f = -1;
private int g;
private Block g;
private int h;
private boolean inGround;
public int fromPlayer;
@ -25,13 +25,13 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world) {
super(world);
this.l = 10.0D;
this.k = 10.0D;
this.a(0.5F, 0.5F);
}
public EntityArrow(World world, double d0, double d1, double d2) {
super(world);
this.l = 10.0D;
this.k = 10.0D;
this.a(0.5F, 0.5F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
@ -39,7 +39,7 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world, EntityLiving entityliving, EntityLiving entityliving1, float f, float f1) {
super(world);
this.l = 10.0D;
this.k = 10.0D;
this.shooter = entityliving;
if (entityliving instanceof EntityHuman) {
this.fromPlayer = 1;
@ -67,7 +67,7 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world, EntityLiving entityliving, float f) {
super(world);
this.l = 10.0D;
this.k = 10.0D;
this.shooter = entityliving;
if (entityliving instanceof EntityHuman) {
this.fromPlayer = 1;
@ -86,7 +86,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.shoot(this.motX, this.motY, this.motZ, f * 1.5F, 1.0F);
}
protected void a() {
protected void c() {
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
@ -112,8 +112,8 @@ public class EntityArrow extends Entity implements IProjectile {
this.j = 0;
}
public void l_() {
super.l_();
public void h() {
super.h();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@ -121,11 +121,11 @@ public class EntityArrow extends Entity implements IProjectile {
this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
}
int i = this.world.getTypeId(this.d, this.e, this.f);
Block block = this.world.getType(this.d, this.e, this.f);
if (i > 0) {
Block.byId[i].updateShape(this.world, this.d, this.e, this.f);
AxisAlignedBB axisalignedbb = Block.byId[i].b(this.world, this.d, this.e, this.f);
if (block.getMaterial() != Material.AIR) {
block.updateShape(this.world, this.d, this.e, this.f);
AxisAlignedBB axisalignedbb = block.a(this.world, this.d, this.e, this.f);
if (axisalignedbb != null && axisalignedbb.a(this.world.getVec3DPool().create(this.locX, this.locY, this.locZ))) {
this.inGround = true;
@ -137,10 +137,9 @@ public class EntityArrow extends Entity implements IProjectile {
}
if (this.inGround) {
int j = this.world.getTypeId(this.d, this.e, this.f);
int k = this.world.getData(this.d, this.e, this.f);
int i = this.world.getData(this.d, this.e, this.f);
if (j == this.g && k == this.h) {
if (block == this.g && i == this.h) {
++this.j;
if (this.j == 1200) {
this.die();
@ -157,7 +156,7 @@ public class EntityArrow extends Entity implements IProjectile {
++this.au;
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true, false);
vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
@ -169,13 +168,13 @@ public class EntityArrow extends Entity implements IProjectile {
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int l;
int j;
float f1;
for (l = 0; l < list.size(); ++l) {
Entity entity1 = (Entity) list.get(l);
for (j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.L() && (entity1 != this.shooter || this.au >= 5)) {
if (entity1.R() && (entity1 != this.shooter || this.au >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
@ -211,10 +210,10 @@ public class EntityArrow extends Entity implements IProjectile {
if (movingobjectposition.entity != null) {
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int i1 = MathHelper.f((double) f2 * this.damage);
int k = MathHelper.f((double) f2 * this.damage);
if (this.d()) {
i1 += this.random.nextInt(i1 / 2 + 2);
if (this.f()) {
k += this.random.nextInt(k / 2 + 2);
}
DamageSource damagesource = null;
@ -226,7 +225,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
// CraftBukkit start - Moved damage call
if (movingobjectposition.entity.damageEntity(damagesource, i1)) {
if (movingobjectposition.entity.damageEntity(damagesource, k)) {
if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
@ -237,12 +236,12 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit end
}
// if (movingobjectposition.entity.damageEntity(damagesource, (float) i1)) { // CraftBukkit - moved up
// if (movingobjectposition.entity.damageEntity(damagesource, (float) k)) { // CraftBukkit - moved up
if (movingobjectposition.entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
if (!this.world.isStatic) {
entityliving.m(entityliving.aU() + 1);
entityliving.p(entityliving.aZ() + 1);
}
if (this.aw > 0) {
@ -252,12 +251,13 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
if (this.shooter != null) {
EnchantmentThorns.a(this.shooter, entityliving, this.random);
if (this.shooter != null && this.shooter instanceof EntityLiving) {
EnchantmentManager.a(entityliving, this.shooter);
EnchantmentManager.b((EntityLiving) this.shooter, entityliving);
}
if (this.shooter != null && movingobjectposition.entity != this.shooter && movingobjectposition.entity instanceof EntityHuman && this.shooter instanceof EntityPlayer) {
((EntityPlayer) this.shooter).playerConnection.sendPacket(new Packet70Bed(6, 0));
((EntityPlayer) this.shooter).playerConnection.sendPacket(new PacketPlayOutGameStateChange(6, 0.0F));
}
}
@ -277,7 +277,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.d = movingobjectposition.b;
this.e = movingobjectposition.c;
this.f = movingobjectposition.d;
this.g = this.world.getTypeId(this.d, this.e, this.f);
this.g = block;
this.h = this.world.getData(this.d, this.e, this.f);
this.motX = (double) ((float) (movingobjectposition.pos.c - this.locX));
this.motY = (double) ((float) (movingobjectposition.pos.d - this.locY));
@ -290,15 +290,15 @@ public class EntityArrow extends Entity implements IProjectile {
this.inGround = true;
this.shake = 7;
this.a(false);
if (this.g != 0) {
Block.byId[this.g].a(this.world, this.d, this.e, this.f, (Entity) this);
if (this.g.getMaterial() != Material.AIR) {
this.g.a(this.world, this.d, this.e, this.f, (Entity) this);
}
}
}
if (this.d()) {
for (l = 0; l < 4; ++l) {
this.world.addParticle("crit", this.locX + this.motX * (double) l / 4.0D, this.locY + this.motY * (double) l / 4.0D, this.locZ + this.motZ * (double) l / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
if (this.f()) {
for (j = 0; j < 4; ++j) {
this.world.addParticle("crit", this.locX + this.motX * (double) j / 4.0D, this.locY + this.motY * (double) j / 4.0D, this.locZ + this.motZ * (double) j / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
}
}
@ -329,8 +329,8 @@ public class EntityArrow extends Entity implements IProjectile {
float f4 = 0.99F;
f1 = 0.05F;
if (this.H()) {
for (int j1 = 0; j1 < 4; ++j1) {
if (this.M()) {
for (int l = 0; l < 4; ++l) {
f3 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
}
@ -338,12 +338,16 @@ public class EntityArrow extends Entity implements IProjectile {
f4 = 0.8F;
}
if (this.L()) {
this.extinguish();
}
this.motX *= (double) f4;
this.motY *= (double) f4;
this.motZ *= (double) f4;
this.motY -= (double) f1;
this.setPosition(this.locX, this.locY, this.locZ);
this.D();
this.I();
}
}
@ -351,7 +355,8 @@ public class EntityArrow extends Entity implements IProjectile {
nbttagcompound.setShort("xTile", (short) this.d);
nbttagcompound.setShort("yTile", (short) this.e);
nbttagcompound.setShort("zTile", (short) this.f);
nbttagcompound.setByte("inTile", (byte) this.g);
nbttagcompound.setShort("life", (short) this.j);
nbttagcompound.setByte("inTile", (byte) Block.b(this.g));
nbttagcompound.setByte("inData", (byte) this.h);
nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
@ -363,17 +368,18 @@ public class EntityArrow extends Entity implements IProjectile {
this.d = nbttagcompound.getShort("xTile");
this.e = nbttagcompound.getShort("yTile");
this.f = nbttagcompound.getShort("zTile");
this.g = nbttagcompound.getByte("inTile") & 255;
this.j = nbttagcompound.getShort("life");
this.g = Block.e(nbttagcompound.getByte("inTile") & 255);
this.h = nbttagcompound.getByte("inData") & 255;
this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.getByte("inGround") == 1;
if (nbttagcompound.hasKey("damage")) {
if (nbttagcompound.hasKeyOfType("damage", 99)) {
this.damage = nbttagcompound.getDouble("damage");
}
if (nbttagcompound.hasKey("pickup")) {
if (nbttagcompound.hasKeyOfType("pickup", 99)) {
this.fromPlayer = nbttagcompound.getByte("pickup");
} else if (nbttagcompound.hasKey("player")) {
} else if (nbttagcompound.hasKeyOfType("player", 99)) {
this.fromPlayer = nbttagcompound.getBoolean("player") ? 1 : 0;
}
}
@ -381,7 +387,7 @@ public class EntityArrow extends Entity implements IProjectile {
public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic && this.inGround && this.shake <= 0) {
// CraftBukkit start
ItemStack itemstack = new ItemStack(Item.ARROW);
ItemStack itemstack = new ItemStack(Items.ARROW);
if (this.fromPlayer == 1 && entityhuman.inventory.canHold(itemstack) > 0) {
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
@ -397,7 +403,7 @@ public class EntityArrow extends Entity implements IProjectile {
boolean flag = this.fromPlayer == 1 || this.fromPlayer == 2 && entityhuman.abilities.canInstantlyBuild;
if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Items.ARROW, 1))) {
flag = false;
}
@ -409,7 +415,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
protected boolean e_() {
protected boolean g_() {
return false;
}
@ -417,7 +423,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.damage = d0;
}
public double c() {
public double e() {
return this.damage;
}
@ -425,7 +431,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.aw = i;
}
public boolean aq() {
public boolean av() {
return false;
}
@ -439,7 +445,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
public boolean d() {
public boolean f() {
byte b0 = this.datawatcher.getByte(16);
return (b0 & 1) != 0;

Datei anzeigen

@ -12,25 +12,25 @@ public class EntityBlaze extends EntityMonster {
this.b = 10;
}
protected void az() {
super.az();
protected void aD() {
super.aD();
this.getAttributeInstance(GenericAttributes.e).setValue(6.0D);
}
protected void a() {
super.a();
protected void c() {
super.c();
this.datawatcher.a(16, new Byte((byte) 0));
}
protected String r() {
protected String t() {
return "mob.blaze.breathe";
}
protected String aO() {
protected String aT() {
return "mob.blaze.hit";
}
protected String aP() {
protected String aU() {
return "mob.blaze.death";
}
@ -38,9 +38,9 @@ public class EntityBlaze extends EntityMonster {
return 1.0F;
}
public void c() {
public void e() {
if (!this.world.isStatic) {
if (this.G()) {
if (this.L()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
@ -50,7 +50,7 @@ public class EntityBlaze extends EntityMonster {
this.bp = 0.5F + (float) this.random.nextGaussian() * 3.0F;
}
if (this.bN() != null && this.bN().locY + (double) this.bN().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) {
if (this.bR() != null && this.bR().locY + (double) this.bR().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
}
}
@ -67,7 +67,7 @@ public class EntityBlaze extends EntityMonster {
this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
}
super.c();
super.e();
}
protected void a(Entity entity, float f) {
@ -113,12 +113,12 @@ public class EntityBlaze extends EntityMonster {
protected void b(float f) {}
protected int getLootId() {
return Item.BLAZE_ROD.id;
protected Item getLoot() {
return Items.BLAZE_ROD;
}
public boolean isBurning() {
return this.bT();
return this.bX();
}
protected void dropDeathLoot(boolean flag, int i) {
@ -128,7 +128,7 @@ public class EntityBlaze extends EntityMonster {
int j = this.random.nextInt(2 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.BLAZE_ROD.id, j));
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(Items.BLAZE_ROD), j));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
@ -136,7 +136,7 @@ public class EntityBlaze extends EntityMonster {
}
}
public boolean bT() {
public boolean bX() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@ -152,7 +152,7 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
protected boolean i_() {
protected boolean j_() {
return true;
}
}

Datei anzeigen

@ -48,16 +48,16 @@ public class EntityBoat extends Entity {
super(world);
this.a = true;
this.b = 0.07D;
this.m = true;
this.l = true;
this.a(1.5F, 0.6F);
this.height = this.length / 2.0F;
}
protected boolean e_() {
protected boolean g_() {
return false;
}
protected void a() {
protected void c() {
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(1));
this.datawatcher.a(19, new Float(0.0F));
@ -67,11 +67,11 @@ public class EntityBoat extends Entity {
return entity.boundingBox;
}
public AxisAlignedBB E() {
public AxisAlignedBB J() {
return this.boundingBox;
}
public boolean M() {
public boolean S() {
return true;
}
@ -88,7 +88,7 @@ public class EntityBoat extends Entity {
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
public double Y() {
public double ae() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@ -106,13 +106,13 @@ public class EntityBoat extends Entity {
if (event.isCancelled()) {
return true;
}
// i = event.getDamage(); // TODO Why don't we do this?
// f = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
this.c(-this.h());
this.c(-this.i());
this.a(10);
this.setDamage(this.getDamage() + f * 10.0F);
this.K();
this.Q();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
if (flag || this.getDamage() > 40.0F) {
@ -131,7 +131,7 @@ public class EntityBoat extends Entity {
}
if (!flag) {
this.a(Item.BOAT.id, 1, 0.0F);
this.a(Items.BOAT, 1, 0.0F);
}
this.die();
@ -143,11 +143,11 @@ public class EntityBoat extends Entity {
}
}
public boolean L() {
public boolean R() {
return !this.dead;
}
public void l_() {
public void h() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@ -156,9 +156,9 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
super.l_();
if (this.e() > 0) {
this.a(this.e() - 1);
super.h();
if (this.f() > 0) {
this.a(this.f() - 1);
}
if (this.getDamage() > 0.0F) {
@ -184,12 +184,13 @@ public class EntityBoat extends Entity {
double d3 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
double d4;
double d5;
int j;
if (d3 > 0.26249999999999996D) {
d4 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D);
d5 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D);
for (int j = 0; (double) j < 1.0D + d3 * 60.0D; ++j) {
for (j = 0; (double) j < 1.0D + d3 * 60.0D; ++j) {
double d6 = (double) (this.random.nextFloat() * 2.0F - 1.0F);
double d7 = (double) (this.random.nextInt(2) * 2 - 1) * 0.7D;
double d8;
@ -249,13 +250,11 @@ public class EntityBoat extends Entity {
}
if (this.passenger != null && this.passenger instanceof EntityLiving) {
d4 = (double) ((EntityLiving) this.passenger).bf;
if (d4 > 0.0D) {
d5 = -Math.sin((double) (this.passenger.yaw * 3.1415927F / 180.0F));
d10 = Math.cos((double) (this.passenger.yaw * 3.1415927F / 180.0F));
this.motX += d5 * this.b * 0.05000000074505806D;
this.motZ += d10 * this.b * 0.05000000074505806D;
}
EntityLiving entityliving = (EntityLiving) this.passenger;
float f = this.passenger.yaw + -entityliving.be * 90.0F;
this.motX += -Math.sin((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.bf * 0.05000000074505806D;
this.motZ += Math.cos((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.bf * 0.05000000074505806D;
}
// CraftBukkit start - Support unoccupied deceleration
else if (unoccupiedDeceleration >= 0) {
@ -291,6 +290,37 @@ public class EntityBoat extends Entity {
}
}
int k;
for (k = 0; k < 4; ++k) {
int l = MathHelper.floor(this.locX + ((double) (k % 2) - 0.5D) * 0.8D);
j = MathHelper.floor(this.locZ + ((double) (k / 2) - 0.5D) * 0.8D);
for (int i1 = 0; i1 < 2; ++i1) {
int j1 = MathHelper.floor(this.locY) + i1;
Block block = this.world.getType(l, j1, j);
if (block == Blocks.SNOW) {
// CraftBukkit start
if (CraftEventFactory.callEntityChangeBlockEvent(this, l, j1, j, Blocks.AIR, 0).isCancelled()) {
continue;
}
// CraftBukkit end
this.world.setAir(l, j1, j);
this.positionChanged = false;
} else if (block == Blocks.WATER_LILY) {
// CraftBukkit start
if (CraftEventFactory.callEntityChangeBlockEvent(this, l, j1, j, Blocks.AIR, 0).isCancelled()) {
continue;
}
// CraftBukkit end
this.world.setAir(l, j1, j, true);
this.positionChanged = false;
}
}
}
if (this.onGround && !this.landBoats) { // CraftBukkit
this.motX *= 0.5D;
this.motY *= 0.5D;
@ -307,14 +337,12 @@ public class EntityBoat extends Entity {
if (!destroyEvent.isCancelled()) {
this.die();
int k;
for (k = 0; k < 3; ++k) {
this.a(Block.WOOD.id, 1, 0.0F);
this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
}
for (k = 0; k < 2; ++k) {
this.a(Item.STICK.id, 1, 0.0F);
this.a(Items.STICK, 1, 0.0F);
}
}
// CraftBukkit end
@ -364,46 +392,17 @@ public class EntityBoat extends Entity {
if (!this.world.isStatic) {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
int l;
if (list != null && !list.isEmpty()) {
for (l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l);
for (int k1 = 0; k1 < list.size(); ++k1) {
Entity entity = (Entity) list.get(k1);
if (entity != this.passenger && entity.M() && entity instanceof EntityBoat) {
if (entity != this.passenger && entity.S() && entity instanceof EntityBoat) {
entity.collide(this);
}
}
}
for (l = 0; l < 4; ++l) {
int i1 = MathHelper.floor(this.locX + ((double) (l % 2) - 0.5D) * 0.8D);
int j1 = MathHelper.floor(this.locZ + ((double) (l / 2) - 0.5D) * 0.8D);
for (int k1 = 0; k1 < 2; ++k1) {
int l1 = MathHelper.floor(this.locY) + k1;
int i2 = this.world.getTypeId(i1, l1, j1);
if (i2 == Block.SNOW.id) {
// CraftBukkit start
if (CraftEventFactory.callEntityChangeBlockEvent(this, i1, l1, j1, 0, 0).isCancelled()) {
continue;
}
// CraftBukkit end
this.world.setAir(i1, l1, j1);
} else if (i2 == Block.WATER_LILY.id) {
// CraftBukkit start
if (CraftEventFactory.callEntityChangeBlockEvent(this, i1, l1, j1, 0, 0).isCancelled()) {
continue;
}
// CraftBukkit end
this.world.setAir(i1, l1, j1, true);
}
}
}
if (this.passenger != null && this.passenger.dead) {
this.passenger.vehicle = null; // CraftBukkit
this.passenger = null;
@ -412,12 +411,12 @@ public class EntityBoat extends Entity {
}
}
public void W() {
public void ac() {
if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
this.passenger.setPosition(this.locX + d0, this.locY + this.Y() + this.passenger.X(), this.locZ + d1);
this.passenger.setPosition(this.locX + d0, this.locY + this.ae() + this.passenger.ad(), this.locZ + d1);
}
}
@ -437,6 +436,35 @@ public class EntityBoat extends Entity {
}
}
protected void a(double d0, boolean flag) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
if (flag) {
if (this.fallDistance > 3.0F) {
this.b(this.fallDistance);
if (!this.world.isStatic && !this.dead) {
this.die();
int l;
for (l = 0; l < 3; ++l) {
this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
}
for (l = 0; l < 2; ++l) {
this.a(Items.STICK, 1, 0.0F);
}
}
this.fallDistance = 0.0F;
}
} else if (this.world.getType(i, j - 1, k).getMaterial() != Material.WATER && d0 < 0.0D) {
this.fallDistance = (float) ((double) this.fallDistance - d0);
}
}
public void setDamage(float f) {
this.datawatcher.watch(19, Float.valueOf(f));
}
@ -449,7 +477,7 @@ public class EntityBoat extends Entity {
this.datawatcher.watch(17, Integer.valueOf(i));
}
public int e() {
public int f() {
return this.datawatcher.getInt(17);
}
@ -457,7 +485,7 @@ public class EntityBoat extends Entity {
this.datawatcher.watch(18, Integer.valueOf(i));
}
public int h() {
public int i() {
return this.datawatcher.getInt(18);
}
}

Datei anzeigen

@ -1,5 +1,7 @@
package net.minecraft.server;
import org.bukkit.craftbukkit.util.CraftMagicNumbers; // CraftBukkit
public class EntityChicken extends EntityAnimal {
public float bp;
@ -16,25 +18,25 @@ public class EntityChicken extends EntityAnimal {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, Item.SEEDS.id, false));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, Items.SEEDS, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.1D));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
public boolean bf() {
public boolean bk() {
return true;
}
protected void az() {
super.az();
protected void aD() {
super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(4.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
public void c() {
super.c();
public void e() {
super.e();
this.bs = this.bp;
this.br = this.bq;
this.bq = (float) ((double) this.bq + (double) (this.onGround ? -1 : 4) * 0.3D);
@ -58,31 +60,31 @@ public class EntityChicken extends EntityAnimal {
this.bp += this.bt * 2.0F;
if (!this.isBaby() && !this.world.isStatic && --this.bu <= 0) {
this.makeSound("mob.chicken.plop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.b(Item.EGG.id, 1);
this.a(Items.EGG, 1);
this.bu = this.random.nextInt(6000) + 6000;
}
}
protected void b(float f) {}
protected String r() {
protected String t() {
return "mob.chicken.say";
}
protected String aO() {
protected String aT() {
return "mob.chicken.hurt";
}
protected String aP() {
protected String aU() {
return "mob.chicken.hurt";
}
protected void a(int i, int j, int k, int l) {
protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.chicken.step", 0.15F, 1.0F);
}
protected int getLootId() {
return Item.FEATHER.id;
protected Item getLoot() {
return Items.FEATHER;
}
protected void dropDeathLoot(boolean flag, int i) {
@ -91,13 +93,13 @@ public class EntityChicken extends EntityAnimal {
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, j));
loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.FEATHER), j));
}
if (this.isBurning()) {
loot.add(new org.bukkit.inventory.ItemStack(Item.COOKED_CHICKEN.id, 1));
loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.COOKED_CHICKEN), 1));
} else {
loot.add(new org.bukkit.inventory.ItemStack(Item.RAW_CHICKEN.id, 1));
loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.RAW_CHICKEN), 1));
}
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);

Datei anzeigen

@ -3,6 +3,7 @@ package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
// CraftBukkit end
public class EntityCow extends EntityAnimal {
@ -14,45 +15,45 @@ public class EntityCow extends EntityAnimal {
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 2.0D));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.25D, Item.WHEAT.id, false));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.25D, Items.WHEAT, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
public boolean bf() {
public boolean bk() {
return true;
}
protected void az() {
super.az();
protected void aD() {
super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.20000000298023224D);
}
protected String r() {
protected String t() {
return "mob.cow.say";
}
protected String aO() {
protected String aT() {
return "mob.cow.hurt";
}
protected String aP() {
protected String aU() {
return "mob.cow.hurt";
}
protected void a(int i, int j, int k, int l) {
protected void a(int i, int j, int k, Block block) {
this.makeSound("mob.cow.step", 0.15F, 1.0F);
}
protected float ba() {
protected float bf() {
return 0.4F;
}
protected int getLootId() {
return Item.LEATHER.id;
protected Item getLoot() {
return Items.LEATHER;
}
protected void dropDeathLoot(boolean flag, int i) {
@ -63,13 +64,13 @@ public class EntityCow extends EntityAnimal {
int k;
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, j));
loot.add(new org.bukkit.inventory.ItemStack(CraftMagicNumbers.getMaterial(Items.LEATHER), j));
}
j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(this.isBurning() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
loot.add(new org.bukkit.inventory.ItemStack(this.isBurning() ? CraftMagicNumbers.getMaterial(Items.COOKED_BEEF) : CraftMagicNumbers.getMaterial(Items.RAW_BEEF), j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);
@ -79,10 +80,10 @@ public class EntityCow extends EntityAnimal {
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id && !entityhuman.abilities.canInstantlyBuild) {
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild) {
// CraftBukkit start - Got milk?
org.bukkit.Location loc = this.getBukkitEntity().getLocation();
org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Items.MILK_BUCKET);
if (event.isCancelled()) {
return false;
@ -90,8 +91,8 @@ public class EntityCow extends EntityAnimal {
if (--itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, CraftItemStack.asNMSCopy(event.getItemStack()));
} else if (!entityhuman.inventory.pickup(new ItemStack(Item.MILK_BUCKET))) {
entityhuman.drop(CraftItemStack.asNMSCopy(event.getItemStack()));
} else if (!entityhuman.inventory.pickup(new ItemStack(Items.MILK_BUCKET))) {
entityhuman.drop(CraftItemStack.asNMSCopy(event.getItemStack()), false);
}
// CraftBukkit end

Datei anzeigen

@ -25,11 +25,11 @@ public abstract class EntityCreature extends EntityInsentient {
super(world);
}
protected boolean bJ() {
protected boolean bN() {
return false;
}
protected void bl() {
protected void bq() {
this.world.methodProfiler.a("ai");
if (this.bo > 0 && --this.bo == 0) {
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d);
@ -37,7 +37,7 @@ public abstract class EntityCreature extends EntityInsentient {
attributeinstance.b(i);
}
this.bn = this.bJ();
this.bn = this.bN();
float f11 = 16.0F;
if (this.target == null) {
@ -81,16 +81,20 @@ public abstract class EntityCreature extends EntityInsentient {
// CraftBukkit end
}
if (this.target instanceof EntityPlayer && ((EntityPlayer) this.target).playerInteractManager.isCreative()) {
this.target = null;
}
this.world.methodProfiler.b();
if (!this.bn && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true);
} else if (!this.bn && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.bo > 0) && this.aV < 100) {
this.bK();
this.bO();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
boolean flag = this.H();
boolean flag1 = this.J();
boolean flag = this.M();
boolean flag1 = this.P();
this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
@ -147,7 +151,7 @@ public abstract class EntityCreature extends EntityInsentient {
this.a(this.target, 30.0F, 30.0F);
}
if (this.positionChanged && !this.bM()) {
if (this.positionChanged && !this.bQ()) {
this.bd = true;
}
@ -157,12 +161,12 @@ public abstract class EntityCreature extends EntityInsentient {
this.world.methodProfiler.b();
} else {
super.bl();
super.bq();
this.pathEntity = null;
}
}
protected void bK() {
protected void bO() {
this.world.methodProfiler.a("stroll");
boolean flag = false;
int i = -1;
@ -210,7 +214,7 @@ public abstract class EntityCreature extends EntityInsentient {
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
}
public boolean bM() {
public boolean bQ() {
return this.pathEntity != null;
}
@ -218,7 +222,7 @@ public abstract class EntityCreature extends EntityInsentient {
this.pathEntity = pathentity;
}
public Entity bN() {
public Entity bR() {
return this.target;
}
@ -226,7 +230,7 @@ public abstract class EntityCreature extends EntityInsentient {
this.target = entity;
}
public boolean bO() {
public boolean bS() {
return this.b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
@ -234,33 +238,33 @@ public abstract class EntityCreature extends EntityInsentient {
return this.br == -1.0F ? true : this.bq.e(i, j, k) < this.br * this.br;
}
public void b(int i, int j, int k, int l) {
public void a(int i, int j, int k, int l) {
this.bq.b(i, j, k);
this.br = (float) l;
}
public ChunkCoordinates bP() {
public ChunkCoordinates bT() {
return this.bq;
}
public float bQ() {
public float bU() {
return this.br;
}
public void bR() {
public void bV() {
this.br = -1.0F;
}
public boolean bS() {
public boolean bW() {
return this.br != -1.0F;
}
protected void bF() {
super.bF();
if (this.bH() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
protected void bJ() {
super.bJ();
if (this.bL() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
this.b((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
this.a((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
float f = this.d(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
@ -297,11 +301,11 @@ public abstract class EntityCreature extends EntityInsentient {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
} else if (!this.bH() && this.bt) {
} else if (!this.bL() && this.bt) {
this.bt = false;
this.goalSelector.a(this.bs);
this.getNavigation().a(true);
this.bR();
this.bV();
}
}

Datei anzeigen

@ -26,16 +26,16 @@ public class EntityCreeper extends EntityMonster {
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
protected void az() {
super.az();
protected void aD() {
super.aD();
this.getAttributeInstance(GenericAttributes.d).setValue(0.25D);
}
public boolean bf() {
public boolean bk() {
return true;
}
public int as() {
public int ax() {
return this.getGoalTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
}
@ -47,10 +47,11 @@ public class EntityCreeper extends EntityMonster {
}
}
protected void a() {
super.a();
protected void c() {
super.c();
this.datawatcher.a(16, Byte.valueOf((byte) -1));
this.datawatcher.a(17, Byte.valueOf((byte) 0));
this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
public void b(NBTTagCompound nbttagcompound) {
@ -61,27 +62,36 @@ public class EntityCreeper extends EntityMonster {
nbttagcompound.setShort("Fuse", (short) this.maxFuseTicks);
nbttagcompound.setByte("ExplosionRadius", (byte) this.explosionRadius);
nbttagcompound.setBoolean("ignited", this.ca());
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0)));
if (nbttagcompound.hasKey("Fuse")) {
if (nbttagcompound.hasKeyOfType("Fuse", 99)) {
this.maxFuseTicks = nbttagcompound.getShort("Fuse");
}
if (nbttagcompound.hasKey("ExplosionRadius")) {
if (nbttagcompound.hasKeyOfType("ExplosionRadius", 99)) {
this.explosionRadius = nbttagcompound.getByte("ExplosionRadius");
}
if (nbttagcompound.getBoolean("ignited")) {
this.cb();
}
}
public void l_() {
public void h() {
if (this.isAlive()) {
this.bp = this.fuseTicks;
int i = this.bV();
if (this.ca()) {
this.a(1);
}
int i = this.bZ();
if (i > 0 && this.fuseTicks == 0) {
this.makeSound("random.fuse", 1.0F, 0.5F);
this.makeSound("creeper.primed", 1.0F, 0.5F);
}
this.fuseTicks += i;
@ -91,42 +101,30 @@ public class EntityCreeper extends EntityMonster {
if (this.fuseTicks >= this.maxFuseTicks) {
this.fuseTicks = this.maxFuseTicks;
if (!this.world.isStatic) {
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
// CraftBukkit start
float radius = this.isPowered() ? 6.0F : 3.0F;
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
this.die();
} else {
this.fuseTicks = 0;
}
// CraftBukkit end
}
this.cc();
}
}
super.l_();
super.h();
}
protected String aO() {
protected String aT() {
return "mob.creeper.say";
}
protected String aP() {
protected String aU() {
return "mob.creeper.death";
}
public void die(DamageSource damagesource) {
// CraftBukkit start - Rearranged the method (super call to end, drop to dropDeathLoot)
if (damagesource.getEntity() instanceof EntitySkeleton) {
int i = Item.RECORD_1.id + this.random.nextInt(Item.RECORD_12.id - Item.RECORD_1.id + 1);
int i = Item.b(Items.RECORD_1);
int j = Item.b(Items.RECORD_12);
int k = i + this.random.nextInt(j - i + 1);
// this.b(i, 1); // CraftBukkit
this.record = i;
// this.a(Item.d(k), 1); // CraftBukkit
this.record = k;
}
super.die(damagesource);
@ -135,11 +133,11 @@ public class EntityCreeper extends EntityMonster {
// CraftBukkit start - Whole method
protected void dropDeathLoot(boolean flag, int i) {
int j = this.getLootId();
Item j = this.getLoot();
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
if (j > 0) {
if (j != null) {
int k = this.random.nextInt(3);
if (i > 0) {
@ -147,13 +145,13 @@ public class EntityCreeper extends EntityMonster {
}
if (k > 0) {
loot.add(new org.bukkit.inventory.ItemStack(j, k));
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(j), k));
}
}
// Drop a music disc?
if (this.record != -1) {
loot.add(new org.bukkit.inventory.ItemStack(this.record, 1));
loot.add(new org.bukkit.inventory.ItemStack(this.record, 1)); // TODO: Material
this.record = -1;
}
@ -169,11 +167,11 @@ public class EntityCreeper extends EntityMonster {
return this.datawatcher.getByte(17) == 1;
}
protected int getLootId() {
return Item.SULPHUR.id;
protected Item getLoot() {
return Items.SULPHUR;
}
public int bV() {
public int bZ() {
return this.datawatcher.getByte(16);
}
@ -199,4 +197,47 @@ public class EntityCreeper extends EntityMonster {
}
// CraftBukkit end
}
protected boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.getItem() == Items.FLINT_AND_STEEL) {
this.world.makeSound(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.ignite", 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
entityhuman.ba();
if (!this.world.isStatic) {
this.cb();
itemstack.damage(1, entityhuman);
return true;
}
}
return super.a(entityhuman);
}
private void cc() {
if (!this.world.isStatic) {
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
// CraftBukkit start
float radius = this.isPowered() ? 6.0F : 3.0F;
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
this.die();
} else {
this.fuseTicks = 0;
}
// CraftBukkit end
}
}
public boolean ca() {
return this.datawatcher.getByte(18) != 0;
}
public void cb() {
this.datawatcher.watch(18, Byte.valueOf((byte) 1));
}
}

Datei anzeigen

@ -9,7 +9,7 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
this.owner = entity1;
}
public Entity h() {
public Entity i() {
return this.p;
}
@ -17,13 +17,13 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
return this.owner;
}
public ChatMessage getLocalizedDeathMessage(EntityLiving entityliving) {
String s = this.owner == null ? this.p.getScoreboardDisplayName() : this.owner.getScoreboardDisplayName();
ItemStack itemstack = this.owner instanceof EntityLiving ? ((EntityLiving) this.owner).aZ() : null;
String s1 = "death.attack." + this.translationIndex;
String s2 = s1 + ".item";
public IChatBaseComponent getLocalizedDeathMessage(EntityLiving entityliving) {
IChatBaseComponent ichatbasecomponent = this.owner == null ? this.p.getScoreboardDisplayName() : this.owner.getScoreboardDisplayName();
ItemStack itemstack = this.owner instanceof EntityLiving ? ((EntityLiving) this.owner).be() : null;
String s = "death.attack." + this.translationIndex;
String s1 = s + ".item";
return itemstack != null && itemstack.hasName() && LocaleI18n.b(s2) ? ChatMessage.b(s2, new Object[] { entityliving.getScoreboardDisplayName(), s, itemstack.getName()}) : ChatMessage.b(s1, new Object[] { entityliving.getScoreboardDisplayName(), s});
return itemstack != null && itemstack.hasName() && LocaleI18n.c(s1) ? new ChatMessage(s1, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.E()}) : new ChatMessage(s, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent});
}
// CraftBukkit start

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen