Archiviert
13
0

Update for 1.0.0

Dieser Commit ist enthalten in:
Erik Broes 2011-11-20 00:01:14 -08:00 committet von Erik Broes
Ursprung 589f66bd1b
Commit 345ea36c7b
153 geänderte Dateien mit 6128 neuen und 4617 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.8.1-R5-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<name>CraftBukkit</name> <name>CraftBukkit</name>
<url>http://www.bukkit.org</url> <url>http://www.bukkit.org</url>
<properties> <properties>
@ -44,14 +44,14 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.8.1-R5-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId> <artifactId>minecraft-server</artifactId>
<version>1.8.1_01</version> <version>1.9.RC1</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

Datei anzeigen

@ -22,41 +22,42 @@ public class Block {
public static final boolean[] r = new boolean[256]; public static final boolean[] r = new boolean[256];
public static final int[] s = new int[256]; public static final int[] s = new int[256];
public static final boolean[] t = new boolean[256]; public static final boolean[] t = new boolean[256];
public static boolean[] u = new boolean[256];
public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).a("stone"); public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).a("stone");
public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).a("grass"); public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).a("grass");
public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).a("dirt"); public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).a("dirt");
public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stonebrick"); public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stonebrick");
public static final Block WOOD = (new Block(5, 4, Material.WOOD)).c(2.0F).b(5.0F).a(e).a("wood").g(); public static final Block WOOD = (new Block(5, 4, Material.WOOD)).c(2.0F).b(5.0F).a(e).a("wood").i();
public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).a("sapling").g(); public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).a("sapling").i();
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).i().b(6000000.0F).a(h).a("bedrock").n(); public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).k().b(6000000.0F).a(h).a("bedrock").p();
public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).f(3).a("water").n().g(); public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).g(3).a("water").p().i();
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).f(3).a("water").n().g(); public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).g(3).a("water").p().i();
public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).f(255).a("lava").n().g(); public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).g(255).a("lava").p().i();
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).f(255).a("lava").n().g(); public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).g(255).a("lava").p().i();
public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).a("sand"); public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).a("sand");
public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).a("gravel"); public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).a("gravel");
public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).a("oreGold"); public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).a("oreGold");
public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).a("oreIron"); public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).a("oreIron");
public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).a("oreCoal"); public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).a("oreCoal");
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).a("log").g(); public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).a("log").i();
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).f(1).a(g).a("leaves").g(); public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).g(1).a(g).a("leaves").i();
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).a("sponge"); public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).a("sponge");
public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).a("glass"); public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).a("glass");
public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).a("oreLapis"); public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).a("oreLapis");
public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).a("blockLapis"); public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).a("blockLapis");
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).a("dispenser").g(); public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).a("dispenser").i();
public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).a("sandStone"); public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).a("sandStone");
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).a("musicBlock").g(); public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).a("musicBlock").i();
public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed").n().g(); public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed").p().i();
public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).a("goldenRail").g(); public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).a("goldenRail").i();
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).a("detectorRail").g(); public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).a("detectorRail").i();
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).a("pistonStickyBase").g(); public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).a("pistonStickyBase").i();
public static final Block WEB = (new BlockWeb(30, 11)).f(1).c(4.0F).a("web"); public static final Block WEB = (new BlockWeb(30, 11)).g(1).c(4.0F).a("web");
public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).a("tallgrass"); public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).a("tallgrass");
public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).a("deadbush"); public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).a("deadbush");
public static final Block PISTON = (new BlockPiston(33, 107, false)).a("pistonBase").g(); public static final Block PISTON = (new BlockPiston(33, 107, false)).a("pistonBase").i();
public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).g(); public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).i();
public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).a("cloth").g(); public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).a("cloth").i();
public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36); public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).a("flower"); public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).a("flower");
public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).a("rose"); public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).a("rose");
@ -70,73 +71,86 @@ public class Block {
public static final Block TNT = (new BlockTNT(46, 8)).c(0.0F).a(g).a("tnt"); public static final Block TNT = (new BlockTNT(46, 8)).c(0.0F).a(g).a("tnt");
public static final Block BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).a("bookshelf"); public static final Block BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).a("bookshelf");
public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stoneMoss"); public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stoneMoss");
public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(10.0F).b(2000.0F).a(h).a("obsidian"); public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(50.0F).b(2000.0F).a(h).a("obsidian");
public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).a("torch").g(); public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).a("torch").i();
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").n(); public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").p();
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").n(); public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").p();
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").g(); public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").i();
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").g(); public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").i();
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust").n().g(); public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust").p().i();
public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).a("oreDiamond"); public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).a("oreDiamond");
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond"); public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond");
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench"); public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench");
public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").n().g(); public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").p().i();
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland").g(); public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland").i();
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").g(); public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").i();
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).a("furnace").g(); public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).a("furnace").i();
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").n().g(); public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").p().i();
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).a("doorWood").n().g(); public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).a("doorWood").p().i();
public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).a("ladder").g(); public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).a("ladder").i();
public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).a("rail").g(); public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).a("rail").i();
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE)).a("stairsStone").g(); public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE)).a("stairsStone").i();
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).a("sign").n().g(); public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).a("sign").p().i();
public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).a("lever").g(); public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).a("lever").i();
public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).a("pressurePlate").g(); public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).a("pressurePlate").i();
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).a("doorIron").n().g(); public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).a("doorIron").p().i();
public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).a("pressurePlate").g(); public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).a("pressurePlate").i();
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).a("oreRedstone").g(); public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).a("oreRedstone").i();
public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).a("oreRedstone").g(); public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).a("oreRedstone").i();
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).a("notGate").g(); public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).a("notGate").i();
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).a("notGate").g(); public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).a("notGate").i();
public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).a("button").g(); public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).a("button").i();
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).a("snow"); public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).a("snow").g(0);
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).f(3).a(j).a("ice"); public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).g(3).a(j).a("ice");
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(k).a("snow"); public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(k).a("snow");
public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).a("cactus"); public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).a("cactus");
public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).a("clay"); public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).a("clay");
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").n(); public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").p();
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").g(); public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").i();
public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).a("fence"); public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).a("fence");
public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).a("pumpkin").g(); public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).a("pumpkin").i();
public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).a("hellrock"); public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).a("hellrock");
public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).a("hellsand"); public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).a("hellsand");
public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.STONE)).c(0.3F).a(j).a(1.0F).a("lightgem"); public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).a("lightgem");
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).a("portal"); public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).a("portal");
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).a("litpumpkin").g(); public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).a("litpumpkin").i();
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake").n().g(); public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake").p().i();
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).a("diode").n().g(); public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).a("diode").p().i();
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").n().g(); public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").p().i();
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).a("lockedchest").a(true).g(); public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).a("lockedchest").a(true).i();
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").n().g(); public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").p().i();
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F); public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F);
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).a("stonebricksmooth"); public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).a("stonebricksmooth");
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).a("mushroom").g(); public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).a("mushroom").i();
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).a("mushroom").g(); public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).a("mushroom").i();
public static final Block IRON_FENCE = (new BlockThin(101, 85, 85, Material.ORE)).c(5.0F).b(10.0F).a(i).a("fenceIron"); public static final Block IRON_FENCE = (new BlockThin(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).a("fenceIron");
public static final Block THIN_GLASS = (new BlockThin(102, 49, 148, Material.SHATTERABLE)).c(0.3F).a(j).a("thinGlass"); public static final Block THIN_GLASS = (new BlockThin(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).a("thinGlass");
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).a("melon"); public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).a("melon");
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).a("pumpkinStem").g(); public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).a("pumpkinStem").i();
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).a("pumpkinStem").g(); public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).a("pumpkinStem").i();
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).a("vine").g(); public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).a("vine").i();
public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).a("fenceGate").g(); public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).a("fenceGate").i();
public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK)).a("stairsBrick").g(); public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK)).a("stairsBrick").i();
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK)).a("stairsStoneBrickSmooth").g(); public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK)).a("stairsStoneBrickSmooth").i();
public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(g).a("mycel");
public static final Block WATER_LILY = (new BlockWaterLily(111, 76)).c(0.0F).a(g).a("waterlily");
public static final Block NETHER_BRICK = (new Block(112, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).a("netherBrick");
public static final Block NETHER_FENCE = (new BlockFence(113, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).a("netherFence");
public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK)).a("stairsNetherBrick").i();
public static final Block NETHER_WART = (new BlockNetherWart(115)).a("netherStalk").i();
public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).a("enchantmentTable");
public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).a("brewingStand").i();
public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).a("cauldron").i();
public static final Block ENDER_PORTAL = (new BlockEnderPortal(119, Material.PORTAL)).c(-1.0F).b(6000000.0F);
public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).a("endPortalFrame").i().b(6000000.0F);
public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).a("whiteStone");
public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).a("dragonEgg");
public int textureId; public int textureId;
public final int id; public final int id;
protected float strength; protected float strength;
protected float durability; protected float durability;
protected boolean bD; protected boolean bR;
protected boolean bE; protected boolean bS;
public double minX; public double minX;
public double minY; public double minY;
public double minZ; public double minZ;
@ -144,16 +158,16 @@ public class Block {
public double maxY; public double maxY;
public double maxZ; public double maxZ;
public StepSound stepSound; public StepSound stepSound;
public float bM; public float ca;
public final Material material; public final Material material;
public float frictionFactor; public float frictionFactor;
private String name; private String name;
protected Block(int i, Material material) { protected Block(int i, Material material) {
this.bD = true; this.bR = true;
this.bE = true; this.bS = true;
this.stepSound = d; this.stepSound = d;
this.bM = 1.0F; this.ca = 1.0F;
this.frictionFactor = 0.6F; this.frictionFactor = 0.6F;
if (byId[i] != null) { if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this); throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
@ -169,12 +183,12 @@ public class Block {
} }
} }
protected Block g() { protected Block i() {
t[this.id] = true; t[this.id] = true;
return this; return this;
} }
protected void h() {} protected void j() {}
protected Block(int i, int j, Material material) { protected Block(int i, int j, Material material) {
this(i, material); this(i, material);
@ -186,7 +200,7 @@ public class Block {
return this; return this;
} }
protected Block f(int i) { protected Block g(int i) {
q[this.id] = i; q[this.id] = i;
return this; return this;
} }
@ -205,6 +219,10 @@ public class Block {
return true; return true;
} }
public int c() {
return 0;
}
protected Block c(float f) { protected Block c(float f) {
this.strength = f; this.strength = f;
if (this.durability < f * 5.0F) { if (this.durability < f * 5.0F) {
@ -214,12 +232,12 @@ public class Block {
return this; return this;
} }
protected Block i() { protected Block k() {
this.c(-1.0F); this.c(-1.0F);
return this; return this;
} }
public float j() { public float l() {
return this.strength; return this.strength;
} }
@ -266,10 +284,10 @@ public class Block {
} }
public boolean a(int i, boolean flag) { public boolean a(int i, boolean flag) {
return this.q_(); return this.v_();
} }
public boolean q_() { public boolean v_() {
return true; return true;
} }
@ -279,7 +297,7 @@ public class 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, int l) {}
public int c() { public int d() {
return 10; return 10;
} }
@ -291,7 +309,7 @@ public class Block {
return 1; return 1;
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return this.id; return this.id;
} }
@ -299,21 +317,21 @@ public class Block {
return this.strength < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / this.strength / 100.0F : entityhuman.a(this) / this.strength / 30.0F); return this.strength < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / this.strength / 100.0F : entityhuman.a(this) / this.strength / 30.0F);
} }
public final void g(World world, int i, int j, int k, int l) { 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); this.dropNaturally(world, i, j, k, l, 1.0F, i1);
} }
public void dropNaturally(World world, int i, int j, int k, int l, float f) { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) { if (!world.isStatic) {
int i1 = this.a(world.random); int j1 = this.a(i1, world.random);
for (int j1 = 0; j1 < i1; ++j1) { for (int k1 = 0; k1 < j1; ++k1) {
// CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions // CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
if (world.random.nextFloat() < f) { if (world.random.nextFloat() < f) {
int k1 = this.a(l, world.random); int l1 = this.a(l, world.random, i1);
if (k1 > 0) { if (l1 > 0) {
this.a(world, i, j, k, new ItemStack(k1, 1, this.a_(l))); this.a(world, i, j, k, new ItemStack(l1, 1, this.c(l)));
} }
} }
} }
@ -333,7 +351,7 @@ public class Block {
} }
} }
protected int a_(int i) { protected int c(int i) {
return 0; return 0;
} }
@ -487,10 +505,36 @@ public class Block {
return false; return false;
} }
public void f() {}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { 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[this.id], 1);
entityhuman.b(0.025F); entityhuman.c(0.025F);
this.g(world, i, j, k, l); if (this.b() && !isTileEntity[this.id] && EnchantmentManager.d(entityhuman.inventory)) {
ItemStack itemstack = this.a_(l);
if (itemstack != null) {
this.a(world, i, j, k, itemstack);
}
} else {
int i1 = EnchantmentManager.e(entityhuman.inventory);
this.b(world, i, j, k, l, i1);
}
}
protected ItemStack a_(int i) {
int j = 0;
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].e()) {
j = i;
}
return new ItemStack(this.id, 1, j);
}
public int a(int i, Random random) {
return this.a(random);
} }
public boolean f(World world, int i, int j, int k) { public boolean f(World world, int i, int j, int k) {
@ -504,26 +548,26 @@ public class Block {
return this; return this;
} }
public String k() { public String m() {
return StatisticCollector.a(this.l() + ".name"); return StatisticCollector.a(this.n() + ".name");
} }
public String l() { public String n() {
return this.name; return this.name;
} }
public void a(World world, int i, int j, int k, int l, int i1) {} public void a(World world, int i, int j, int k, int l, int i1) {}
public boolean m() { public boolean o() {
return this.bE; return this.bS;
} }
protected Block n() { protected Block p() {
this.bE = false; this.bS = false;
return this; return this;
} }
public int e() { public int g() {
return this.material.l(); return this.material.l();
} }
@ -535,7 +579,8 @@ public class Block {
Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling"); Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling");
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves"); Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves");
Item.byId[VINE.id] = new ItemColoredBlock(VINE.id - 256, false); Item.byId[VINE.id] = new ItemColoredBlock(VINE.id - 256, false);
Item.byId[LONG_GRASS.id] = new ItemColoredBlock(LONG_GRASS.id - 256, true); Item.byId[LONG_GRASS.id] = (new ItemColoredBlock(LONG_GRASS.id - 256, true)).a(new String[] { "shrub", "grass", "fern"});
Item.byId[WATER_LILY.id] = new ItemWaterLily(WATER_LILY.id - 256);
Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256); Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256);
Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256); Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256);
Item.byId[BIG_MUSHROOM_1.id] = new ItemLog(BIG_MUSHROOM_1.id - 256, BIG_MUSHROOM_1); // CraftBukkit Item.byId[BIG_MUSHROOM_1.id] = new ItemLog(BIG_MUSHROOM_1.id - 256, BIG_MUSHROOM_1); // CraftBukkit
@ -543,9 +588,27 @@ public class Block {
Item.byId[MOB_SPAWNER.id] = new ItemMobSpawner(MOB_SPAWNER.id - 256); // CraftBukkit Item.byId[MOB_SPAWNER.id] = new ItemMobSpawner(MOB_SPAWNER.id - 256); // CraftBukkit
for (int i = 0; i < 256; ++i) { for (int i = 0; i < 256; ++i) {
if (byId[i] != null && Item.byId[i] == null) { if (byId[i] != null) {
if (Item.byId[i] == null) {
Item.byId[i] = new ItemBlock(i - 256); Item.byId[i] = new ItemBlock(i - 256);
byId[i].h(); byId[i].j();
}
boolean flag = false;
if (i > 0 && byId[i].c() == 10) {
flag = true;
}
if (i > 0 && byId[i] instanceof BlockStep) {
flag = true;
}
if (i == SOIL.id) {
flag = true;
}
u[i] = flag;
} }
} }

Datei anzeigen

@ -15,7 +15,7 @@ public class BlockButton extends Block {
return null; return null;
} }
public int c() { public int d() {
return 20; return 20;
} }
@ -81,7 +81,7 @@ public class BlockButton extends Block {
} }
if (flag) { if (flag) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
} }
@ -89,7 +89,7 @@ public class BlockButton extends Block {
private boolean h(World world, int i, int j, int k) { private boolean h(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) { if (!this.canPlace(world, i, j, k)) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
return false; return false;
} else { } else {
@ -162,7 +162,7 @@ public class BlockButton extends Block {
world.applyPhysics(i, j - 1, k, this.id); world.applyPhysics(i, j - 1, k, this.id);
} }
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
return true; return true;
} }
} }
@ -245,4 +245,12 @@ public class BlockButton extends Block {
} }
} }
} }
public void f() {
float f = 0.1875F;
float f1 = 0.125F;
float f2 = 0.125F;
this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
}
} }

Datei anzeigen

@ -53,13 +53,17 @@ public class BlockCactus extends Block {
return false; return false;
} }
public int c() {
return 13;
}
public boolean canPlace(World world, int i, int j, int k) { 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.f(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, int l) {
if (!this.f(world, i, j, k)) { if (!this.f(world, i, j, k)) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
} }

Datei anzeigen

@ -17,11 +17,11 @@ public class BlockDispenser extends BlockContainer {
this.textureId = 45; this.textureId = 45;
} }
public int c() { public int d() {
return 4; return 4;
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Block.DISPENSER.id; return Block.DISPENSER.id;
} }
@ -111,7 +111,7 @@ public class BlockDispenser extends BlockContainer {
double d2 = (double) k + (double) b1 * 0.6D + 0.5D; double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
if (itemstack == null) { if (itemstack == null) {
world.e(1001, i, j, k, 0); world.f(1001, i, j, k, 0);
} else { } else {
// CraftBukkit start // CraftBukkit start
double d3 = random.nextDouble() * 0.1D + 0.2D; double d3 = random.nextDouble() * 0.1D + 0.2D;
@ -148,19 +148,25 @@ public class BlockDispenser extends BlockContainer {
entityarrow.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F); entityarrow.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
entityarrow.fromPlayer = true; entityarrow.fromPlayer = true;
world.addEntity(entityarrow); world.addEntity(entityarrow);
world.e(1002, i, j, k, 0); world.f(1002, i, j, k, 0);
} else if (itemstack.id == Item.EGG.id) { } else if (itemstack.id == Item.EGG.id) {
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2); EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F); entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entityegg); world.addEntity(entityegg);
world.e(1002, i, j, k, 0); world.f(1002, i, j, k, 0);
} else if (itemstack.id == Item.SNOW_BALL.id) { } else if (itemstack.id == Item.SNOW_BALL.id) {
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2); EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F); entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entitysnowball); world.addEntity(entitysnowball);
world.e(1002, i, j, k, 0); world.f(1002, i, j, k, 0);
} else if (itemstack.id == Item.POTION.id && ItemPotion.c(itemstack.getData())) {
EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData());
entitypotion.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
world.addEntity(entitypotion);
world.f(1002, i, j, k, 0);
} else { } else {
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack); EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
// CraftBukkit start // CraftBukkit start
@ -170,10 +176,10 @@ public class BlockDispenser extends BlockContainer {
entityitem.motZ = motZ; entityitem.motZ = motZ;
// CraftBukkit end // CraftBukkit end
world.addEntity(entityitem); world.addEntity(entityitem);
world.e(1000, i, j, k, 0); world.f(1000, i, j, k, 0);
} }
world.e(2000, i, j, k, b0 + 1 + (b1 + 1) * 3); world.f(2000, i, j, k, b0 + 1 + (b1 + 1) * 3);
} }
} }
} }
@ -183,13 +189,13 @@ public class BlockDispenser extends BlockContainer {
boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k); boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
if (flag) { if (flag) {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
} }
} }
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
if (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k)) { if (!world.isStatic && (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k))) {
this.dispense(world, i, j, k, random); this.dispense(world, i, j, k, random);
} }
} }

Datei anzeigen

@ -21,7 +21,7 @@ public class BlockDoor extends Block {
public int a(int i, int j) { public int a(int i, int j) {
if (i != 0 && i != 1) { if (i != 0 && i != 1) {
int k = this.d(j); int k = this.e(j);
if ((k == 0 || k == 2) ^ i <= 3) { if ((k == 0 || k == 2) ^ i <= 3) {
return this.textureId; return this.textureId;
@ -50,16 +50,20 @@ public class BlockDoor extends Block {
return false; return false;
} }
public int c() {
return 7;
}
public AxisAlignedBB e(World world, int i, int j, int k) { public AxisAlignedBB e(World world, int i, int j, int k) {
this.a((IBlockAccess)world, i, j, k); // CraftBukkit - Make sure this points to the below method! this.a((IBlockAccess)world, i, j, k); // CraftBukkit - Make sure this points to the below method!
return super.e(world, i, j, k); return super.e(world, i, j, k);
} }
public void a(IBlockAccess iblockaccess, int i, int j, int k) { public void a(IBlockAccess iblockaccess, int i, int j, int k) {
this.c(this.d(iblockaccess.getData(i, j, k))); this.d(this.e(iblockaccess.getData(i, j, k)));
} }
public void c(int i) { public void d(int i) {
float f = 0.1875F; float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
@ -160,7 +164,7 @@ public class BlockDoor extends Block {
if (flag) { if (flag) {
if (!world.isStatic) { if (!world.isStatic) {
this.g(world, i, j, k, i1); this.b(world, i, j, k, i1, 0);
} }
} else if (l > 0 && Block.byId[l].isPowerSource()) { } else if (l > 0 && Block.byId[l].isPowerSource()) {
// CraftBukkit start // CraftBukkit start
@ -184,7 +188,7 @@ public class BlockDoor extends Block {
} }
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return (i & 8) != 0 ? 0 : (this.material == Material.ORE ? Item.IRON_DOOR.id : Item.WOOD_DOOR.id); return (i & 8) != 0 ? 0 : (this.material == Material.ORE ? Item.IRON_DOOR.id : Item.WOOD_DOOR.id);
} }
@ -193,20 +197,19 @@ public class BlockDoor extends Block {
return super.a(world, i, j, k, vec3d, vec3d1); return super.a(world, i, j, k, vec3d, vec3d1);
} }
public int d(int i) { public int e(int i) {
return (i & 4) == 0 ? i - 1 & 3 : i & 3; return (i & 4) == 0 ? i - 1 & 3 : i & 3;
} }
public boolean canPlace(World world, int i, int j, int k) { public boolean canPlace(World world, int i, int j, int k) {
world.getClass(); return j >= world.height - 1 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
return j >= 128 - 1 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
} }
public static boolean e(int i) { public static boolean f(int i) {
return (i & 4) != 0; return (i & 4) != 0;
} }
public int e() { public int g() {
return 1; return 1;
} }
} }

Datei anzeigen

@ -20,7 +20,7 @@ public class BlockFire extends Block {
this.a(true); this.a(true);
} }
public void h() { public void j() {
this.a(Block.WOOD.id, 5, 20); this.a(Block.WOOD.id, 5, 20);
this.a(Block.FENCE.id, 5, 20); this.a(Block.FENCE.id, 5, 20);
this.a(Block.WOOD_STAIRS.id, 5, 20); this.a(Block.WOOD_STAIRS.id, 5, 20);
@ -50,22 +50,30 @@ public class BlockFire extends Block {
return false; return false;
} }
public int c() {
return 3;
}
public int a(Random random) { public int a(Random random) {
return 0; return 0;
} }
public int c() { public int d() {
return 40; return 40;
} }
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id; boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
if (world.worldProvider instanceof WorldProviderSky && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
flag = true;
}
if (!this.canPlace(world, i, j, k)) { if (!this.canPlace(world, i, j, k)) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
if (!flag && world.u() && (world.s(i, j, k) || world.s(i - 1, j, k) || world.s(i + 1, j, k) || world.s(i, j, k - 1) || world.s(i, j, k + 1))) { if (!flag && world.w() && (world.v(i, j, k) || world.v(i - 1, j, k) || world.v(i + 1, j, k) || world.v(i, j, k - 1) || world.v(i, j, k + 1))) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } else {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
@ -74,7 +82,7 @@ public class BlockFire extends Block {
world.setRawData(i, j, k, l + random.nextInt(3) / 2); world.setRawData(i, j, k, l + random.nextInt(3) / 2);
} }
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
if (!flag && !this.g(world, i, j, k)) { if (!flag && !this.g(world, i, j, k)) {
if (!world.e(i, j - 1, k) || l > 3) { if (!world.e(i, j - 1, k) || l > 3) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
@ -112,7 +120,7 @@ public class BlockFire extends Block {
if (i2 > 0) { if (i2 > 0) {
int j2 = (i2 + 40) / (l + 30); int j2 = (i2 + 40) / (l + 30);
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.u() || !world.s(i1, k1, j1)) && !world.s(i1 - 1, k1, k) && !world.s(i1 + 1, k1, j1) && !world.s(i1, k1, j1 - 1) && !world.s(i1, k1, j1 + 1)) { if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.w() || !world.v(i1, k1, j1)) && !world.v(i1 - 1, k1, k) && !world.v(i1 + 1, k1, j1) && !world.v(i1, k1, j1 - 1) && !world.v(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4; int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) { if (k2 > 15) {
@ -167,7 +175,7 @@ public class BlockFire extends Block {
} }
// CraftBukkit end // CraftBukkit end
if (random.nextInt(i1 + 10) < 5 && !world.s(i, j, k)) { if (random.nextInt(i1 + 10) < 5 && !world.v(i, j, k)) {
int k1 = i1 + random.nextInt(5) / 4; int k1 = i1 + random.nextInt(5) / 4;
if (k1 > 15) { if (k1 > 15) {
@ -206,7 +214,7 @@ public class BlockFire extends Block {
} }
} }
public boolean q_() { public boolean v_() {
return false; return false;
} }
@ -231,11 +239,11 @@ public class BlockFire extends Block {
} }
public void a(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) { if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) {
if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) { if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } else {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
} }
} }

Datei anzeigen

@ -85,7 +85,7 @@ public class BlockFlowing extends BlockFluids {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } else {
world.setData(i, j, k, i1); world.setData(i, j, k, i1);
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
world.applyPhysics(i, j, k, this.id); world.applyPhysics(i, j, k, this.id);
} }
} else if (flag) { } else if (flag) {
@ -103,6 +103,12 @@ public class BlockFlowing extends BlockFluids {
} }
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (this.material == Material.LAVA && world.getMaterial(i, j - 1, k) == Material.WATER) {
world.setTypeId(i, j - 1, k, Block.STONE.id);
this.h(world, i, j - 1, k);
return;
}
if (l >= 8) { if (l >= 8) {
world.setTypeIdAndData(i, j - 1, k, this.id, l); world.setTypeIdAndData(i, j - 1, k, this.id, l);
} else { } else {
@ -152,7 +158,7 @@ public class BlockFlowing extends BlockFluids {
if (this.material == Material.LAVA) { if (this.material == Material.LAVA) {
this.h(world, i, j, k); this.h(world, i, j, k);
} else { } else {
Block.byId[i1].g(world, i, j, k, world.getData(i, j, k)); Block.byId[i1].b(world, i, j, k, world.getData(i, j, k), 0);
} }
} }
@ -160,7 +166,7 @@ public class BlockFlowing extends BlockFluids {
} }
} }
private int b(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; int j1 = 1000;
for (int k1 = 0; k1 < 4; ++k1) { for (int k1 = 0; k1 < 4; ++k1) {
@ -190,7 +196,7 @@ public class BlockFlowing extends BlockFluids {
} }
if (l < 4) { if (l < 4) {
int j2 = this.b(world, l1, j, i2, l + 1, k1); int j2 = this.c(world, l1, j, i2, l + 1, k1);
if (j2 < j1) { if (j2 < j1) {
j1 = j2; j1 = j2;
@ -232,7 +238,7 @@ public class BlockFlowing extends BlockFluids {
if (!this.k(world, i1, j - 1, j1)) { if (!this.k(world, i1, j - 1, j1)) {
this.c[l] = 0; this.c[l] = 0;
} else { } else {
this.c[l] = this.b(world, i1, j, j1, 1, l); this.c[l] = this.c(world, i1, j, j1, 1, l);
} }
} }
} }
@ -261,7 +267,7 @@ public class BlockFlowing extends BlockFluids {
} else { } else {
Material material = Block.byId[l].material; Material material = Block.byId[l].material;
return material.isSolid(); return material == Material.PORTAL ? true : material.isSolid();
} }
} else { } else {
return true; return true;
@ -295,7 +301,7 @@ public class BlockFlowing extends BlockFluids {
public void a(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
super.a(world, i, j, k); super.a(world, i, j, k);
if (world.getTypeId(i, j, k) == this.id) { if (world.getTypeId(i, j, k) == this.id) {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
} }
} }

Datei anzeigen

@ -22,9 +22,6 @@ public class BlockGrass extends Block {
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) { if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) { if (world.getLightLevel(i, j + 1, k) < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) {
if (random.nextInt(4) != 0) {
return;
}
// CraftBukkit start // CraftBukkit start
org.bukkit.World bworld = world.getWorld(); org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState(); org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState();
@ -38,15 +35,16 @@ public class BlockGrass extends Block {
} }
// CraftBukkit end // CraftBukkit end
} else if (world.getLightLevel(i, j + 1, k) >= 9) { } else if (world.getLightLevel(i, j + 1, k) >= 9) {
int l = i + random.nextInt(3) - 1; for (int l = 0; l < 4; ++l) {
int i1 = j + random.nextInt(5) - 3; int i1 = i + random.nextInt(3) - 1;
int j1 = k + random.nextInt(3) - 1; int j1 = j + random.nextInt(5) - 3;
int k1 = world.getTypeId(l, i1 + 1, j1); int k1 = k + random.nextInt(3) - 1;
int l1 = world.getTypeId(i1, j1 + 1, k1);
if (world.getTypeId(l, i1, j1) == Block.DIRT.id && world.getLightLevel(l, i1 + 1, j1) >= 4 && Block.q[k1] <= 2) { if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.q[l1] <= 2) {
// CraftBukkit start // CraftBukkit start
org.bukkit.World bworld = world.getWorld(); org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(l, i1, j1).getState(); org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id); blockState.setTypeId(this.id);
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState); BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
@ -60,8 +58,9 @@ public class BlockGrass extends Block {
} }
} }
} }
}
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Block.DIRT.a(0, random); return Block.DIRT.a(0, random, j);
} }
} }

Datei anzeigen

@ -32,12 +32,16 @@ public class BlockIce extends BlockBreakable {
} }
// CraftBukkit end // CraftBukkit end
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, Block.STATIONARY_WATER.id); world.setTypeId(i, j, k, Block.STATIONARY_WATER.id);
} }
} }
public int e() { public int g() {
return 0; return 0;
} }
protected ItemStack a_(int i) {
return null;
}
} }

Datei anzeigen

@ -126,7 +126,7 @@ public class BlockLeaves extends BlockLeavesBase {
if (event.isCancelled()) return; if (event.isCancelled()) return;
// CraftBukkit end // CraftBukkit end
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
@ -134,12 +134,12 @@ public class BlockLeaves extends BlockLeavesBase {
return random.nextInt(20) == 0 ? 1 : 0; return random.nextInt(20) == 0 ? 1 : 0;
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Block.SAPLING.id; return Block.SAPLING.id;
} }
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.K() != null && entityhuman.K().id == Item.SHEARS.id) { if (!world.isStatic && entityhuman.P() != null && entityhuman.P().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1); entityhuman.a(StatisticList.C[this.id], 1);
this.a(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3)); this.a(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
} else { } else {
@ -147,7 +147,7 @@ public class BlockLeaves extends BlockLeavesBase {
} }
} }
protected int a_(int i) { protected int c(int i) {
return i & 3; return i & 3;
} }

Datei anzeigen

@ -20,6 +20,10 @@ public class BlockLever extends Block {
return false; return false;
} }
public int c() {
return 12;
}
public boolean canPlace(World world, int i, int j, int k, int l) { public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 1 && world.e(i, j - 1, k) ? true : (l == 2 && world.e(i, j, k + 1) ? true : (l == 3 && world.e(i, j, k - 1) ? true : (l == 4 && world.e(i + 1, j, k) ? true : l == 5 && world.e(i - 1, j, k)))); return l == 1 && world.e(i, j - 1, k) ? true : (l == 2 && world.e(i, j, k + 1) ? true : (l == 3 && world.e(i, j, k - 1) ? true : (l == 4 && world.e(i + 1, j, k) ? true : l == 5 && world.e(i - 1, j, k))));
} }
@ -55,7 +59,7 @@ public class BlockLever extends Block {
} }
if (i1 == -1) { if (i1 == -1) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } else {
world.setData(i, j, k, i1 + j1); world.setData(i, j, k, i1 + j1);
@ -92,7 +96,7 @@ public class BlockLever extends Block {
} }
if (flag) { if (flag) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
} }
@ -100,7 +104,7 @@ public class BlockLever extends Block {
private boolean g(World world, int i, int j, int k) { private boolean g(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) { if (!this.canPlace(world, i, j, k)) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
return false; return false;
} else { } else {

Datei anzeigen

@ -12,7 +12,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
this.a(true); this.a(true);
} }
public int c() { public int d() {
return 20; return 20;
} }
@ -84,7 +84,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
} }
if (flag1) { if (flag1) {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
} }
} }

Datei anzeigen

@ -12,28 +12,30 @@ public class BlockMobSpawner extends BlockContainer {
return new TileEntityMobSpawner(); return new TileEntityMobSpawner();
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Block.MOB_SPAWNER.id; // CraftBukkit return Block.MOB_SPAWNER.id; // CraftBukkit
} }
public int a(Random random) { public int a(Random random) {
return 0; // CraftBukkit return 0;
} }
// CraftBukkit start // CraftBukkit start
public void dropNaturally(World world, int i, int j, int k, int l, float f) { @Override
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
TileEntity entity = world.getTileEntity(i, j, k); TileEntity entity = world.getTileEntity(i, j, k);
if (entity instanceof TileEntityMobSpawner) { if (entity instanceof TileEntityMobSpawner) {
super.dropNaturally(world, i, j, k, ((TileEntityMobSpawner) entity).getId(), f); super.dropNaturally(world, i, j, k, ((TileEntityMobSpawner) entity).getId(), f, i1);
} }
} }
@Override
public void remove(World world, int i, int j, int k) { public void remove(World world, int i, int j, int k) {
dropNaturally(world, i, j, k, 0, 1.0f); dropNaturally(world, i, j, k, 0, 1.0f, 0);
super.remove(world, i, j, k); super.remove(world, i, j, k);
} }
protected int a_(int i) { protected int c(int i) {
return i; return i;
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -14,7 +14,7 @@ public class BlockMushroom extends BlockFlower {
} }
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
if (random.nextInt(100) == 0) { if (random.nextInt(25) == 0) {
byte b0 = 4; byte b0 = 4;
int l = 5; int l = 5;
@ -68,28 +68,22 @@ public class BlockMushroom extends BlockFlower {
} }
} }
protected boolean c(int i) { protected boolean d(int i) {
return Block.o[i]; return Block.o[i];
} }
public boolean f(World world, int i, int j, int k) { public boolean f(World world, int i, int j, int k) {
if (j >= 0) { if (j >= 0 && j < world.height) {
world.getClass(); int l = world.getTypeId(i, j - 1, k);
if (j < 128) {
return world.k(i, j, k) < 13 && this.c(world.getTypeId(i, j - 1, k));
}
}
return l == Block.MYCEL.id || world.k(i, j, k) < 13 && this.d(l);
} else {
return false; return false;
} }
}
public boolean b(World world, int i, int j, int k, Random random) { public boolean b(World world, int i, int j, int k, Random random) {
int l = world.getTypeId(i, j - 1, k); int l = world.getData(i, j, k);
if (l != Block.DIRT.id && l != Block.GRASS.id) {
return false;
} else {
int i1 = world.getData(i, j, k);
world.setRawTypeId(i, j, k, 0); world.setRawTypeId(i, j, k, 0);
WorldGenHugeMushroom worldgenhugemushroom = null; WorldGenHugeMushroom worldgenhugemushroom = null;
@ -103,9 +97,8 @@ public class BlockMushroom extends BlockFlower {
if (worldgenhugemushroom != null && worldgenhugemushroom.a(world, random, i, j, k)) { if (worldgenhugemushroom != null && worldgenhugemushroom.a(world, random, i, j, k)) {
return true; return true;
} else { } else {
world.setRawTypeIdAndData(i, j, k, this.id, i1); world.setRawTypeIdAndData(i, j, k, this.id, l);
return false; return false;
} }
} }
} }
}

Datei anzeigen

@ -3,7 +3,6 @@ package net.minecraft.server;
import java.util.ArrayList; import java.util.ArrayList;
// CraftBukkit start // CraftBukkit start
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonExtendEvent;
@ -12,7 +11,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
public class BlockPiston extends Block { public class BlockPiston extends Block {
private boolean a; private boolean a;
private boolean b; private static boolean b;
public BlockPiston(int i, int j, boolean flag) { public BlockPiston(int i, int j, boolean flag) {
super(i, j, Material.PISTON); super(i, j, Material.PISTON);
@ -22,9 +21,13 @@ public class BlockPiston extends Block {
} }
public int a(int i, int j) { public int a(int i, int j) {
int k = c(j); int k = d(j);
return k > 5 ? this.textureId : (i == k ? (!d(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == PistonBlockTextures.a[k] ? 109 : 108)); return k > 5 ? this.textureId : (i == k ? (!e(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == PistonBlockTextures.a[k] ? 109 : 108));
}
public int c() {
return 16;
} }
public boolean a() { public boolean a() {
@ -39,32 +42,32 @@ public class BlockPiston extends Block {
int l = c(world, i, j, k, (EntityHuman) entityliving); int l = c(world, i, j, k, (EntityHuman) entityliving);
world.setData(i, j, k, l); world.setData(i, j, k, l);
if (!world.isStatic) { if (!world.isStatic && !b) {
this.g(world, i, j, k); this.g(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, int l) {
if (!world.isStatic && !this.b) { if (!world.isStatic && !b) {
this.g(world, i, j, k); this.g(world, i, j, k);
} }
} }
public void a(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
if (!world.isStatic && world.getTileEntity(i, j, k) == null) { if (!world.isStatic && world.getTileEntity(i, j, k) == null && !b) {
this.g(world, i, j, k); this.g(world, i, j, k);
} }
} }
private void g(World world, int i, int j, int k) { private void g(World world, int i, int j, int k) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
int i1 = c(l); int i1 = d(l);
boolean flag = this.f(world, i, j, k, i1); boolean flag = this.f(world, i, j, k, i1);
if (l != 7) { if (l != 7) {
if (flag && !d(l)) { if (flag && !e(l)) {
// CraftBukkit start // CraftBukkit start
int length = h(world, i, j, k, i1); int length = g(world, i, j, k, i1);
if (length >= 0) { if (length >= 0) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
@ -79,7 +82,7 @@ public class BlockPiston extends Block {
world.setRawData(i, j, k, i1 | 8); world.setRawData(i, j, k, i1 | 8);
world.playNote(i, j, k, 0, i1); world.playNote(i, j, k, 0, i1);
} }
} else if (!flag && d(l)) { } else if (!flag && e(l)) {
// CraftBukkit start // CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
@ -102,17 +105,19 @@ public class BlockPiston extends Block {
} }
public void a(World world, int i, int j, int k, int l, int i1) { public void a(World world, int i, int j, int k, int l, int i1) {
this.b = true; b = true;
if (l == 0) { if (l == 0) {
if (this.i(world, i, j, k, i1)) { if (this.h(world, i, j, k, i1)) {
world.setData(i, j, k, i1 | 8); world.setData(i, j, k, i1 | 8);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F); world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
} else {
world.setRawData(i, j, k, i1);
} }
} else if (l == 1) { } else if (l == 1) {
TileEntity tileentity = world.getTileEntity(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1]); TileEntity tileentity = world.getTileEntity(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1]);
if (tileentity != null && tileentity instanceof TileEntityPiston) { if (tileentity != null && tileentity instanceof TileEntityPiston) {
((TileEntityPiston) tileentity).e(); ((TileEntityPiston) tileentity).g();
} }
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1); world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
@ -131,46 +136,46 @@ public class BlockPiston extends Block {
if (tileentity1 != null && tileentity1 instanceof TileEntityPiston) { if (tileentity1 != null && tileentity1 instanceof TileEntityPiston) {
TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1; TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1;
if (tileentitypiston.d() == i1 && tileentitypiston.c()) { if (tileentitypiston.f() == i1 && tileentitypiston.e()) {
tileentitypiston.e(); tileentitypiston.g();
i2 = tileentitypiston.a(); i2 = tileentitypiston.c();
j2 = tileentitypiston.j(); j2 = tileentitypiston.j();
flag = true; flag = true;
} }
} }
} }
if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].e() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) { if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].g() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
this.b = false;
world.setTypeId(j1, k1, l1, 0);
this.b = true;
i += PistonBlockTextures.b[i1]; i += PistonBlockTextures.b[i1];
j += PistonBlockTextures.c[i1]; j += PistonBlockTextures.c[i1];
k += PistonBlockTextures.d[i1]; k += PistonBlockTextures.d[i1];
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2); world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2);
world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false)); world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
b = false;
world.setTypeId(j1, k1, l1, 0);
b = true;
} else if (!flag) { } else if (!flag) {
this.b = false; b = false;
world.setTypeId(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1], 0); world.setTypeId(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1], 0);
this.b = true; b = true;
} }
} else { } else {
this.b = false; b = false;
world.setTypeId(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1], 0); world.setTypeId(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1], 0);
this.b = true; b = true;
} }
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.in", 0.5F, world.random.nextFloat() * 0.15F + 0.6F); world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.in", 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
} }
this.b = false; b = false;
} }
public void a(IBlockAccess iblockaccess, int i, int j, int k) { public void a(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k); int l = iblockaccess.getData(i, j, k);
if (d(l)) { if (e(l)) {
switch (c(l)) { switch (d(l)) {
case 0: case 0:
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F); this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
break; break;
@ -199,6 +204,10 @@ public class BlockPiston extends Block {
} }
} }
public void f() {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) { public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
super.a(world, i, j, k, axisalignedbb, arraylist); super.a(world, i, j, k, axisalignedbb, arraylist);
@ -208,11 +217,11 @@ public class BlockPiston extends Block {
return false; return false;
} }
public static int c(int i) { public static int d(int i) {
return i & 7; return i & 7;
} }
public static boolean d(int i) { public static boolean e(int i) {
return (i & 8) != 0; return (i & 8) != 0;
} }
@ -239,29 +248,27 @@ public class BlockPiston extends Block {
return false; return false;
} else { } else {
if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) { if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) {
if (Block.byId[i].j() == -1.0F) { if (Block.byId[i].l() == -1.0F) {
return false; return false;
} }
if (Block.byId[i].e() == 2) { if (Block.byId[i].g() == 2) {
return false; return false;
} }
if (!flag && Block.byId[i].e() == 1) { if (!flag && Block.byId[i].g() == 1) {
return false; return false;
} }
} else if (d(world.getData(j, k, l))) { } else if (e(world.getData(j, k, l))) {
return false; return false;
} }
TileEntity tileentity = world.getTileEntity(j, k, l); return !(Block.byId[i] instanceof BlockContainer);
return tileentity == null;
} }
} }
// CraftBukkkit boolean -> int // CraftBukkkit boolean -> int
private static int h(World world, int i, int j, int k, int l) { private static int g(World world, int i, int j, int k, int l) {
int i1 = i + PistonBlockTextures.b[l]; int i1 = i + PistonBlockTextures.b[l];
int j1 = j + PistonBlockTextures.c[l]; int j1 = j + PistonBlockTextures.c[l];
int k1 = k + PistonBlockTextures.d[l]; int k1 = k + PistonBlockTextures.d[l];
@ -269,9 +276,10 @@ public class BlockPiston extends Block {
while (true) { while (true) {
if (l1 < 13) { if (l1 < 13) {
if (j1 > 0) { if (j1 <= 0 || j1 >= world.height - 1) {
world.getClass(); return -1; // CraftBukkit
if (j1 < 128 - 1) { }
int i2 = world.getTypeId(i1, j1, k1); int i2 = world.getTypeId(i1, j1, k1);
if (i2 != 0) { if (i2 != 0) {
@ -279,7 +287,7 @@ public class BlockPiston extends Block {
return -1; // CraftBukkit return -1; // CraftBukkit
} }
if (Block.byId[i2].e() != 1) { if (Block.byId[i2].g() != 1) {
if (l1 == 12) { if (l1 == 12) {
return -1; // CraftBukkit return -1; // CraftBukkit
} }
@ -291,19 +299,13 @@ public class BlockPiston extends Block {
continue; continue;
} }
} }
return l1; // CraftBukkit
}
}
return -1; // CraftBukkit
} }
return l1; // CraftBukkit return l1; // CraftBukkit
} }
} }
private boolean i(World world, int i, int j, int k, int l) { private boolean h(World world, int i, int j, int k, int l) {
int i1 = i + PistonBlockTextures.b[l]; int i1 = i + PistonBlockTextures.b[l];
int j1 = j + PistonBlockTextures.c[l]; int j1 = j + PistonBlockTextures.c[l];
int k1 = k + PistonBlockTextures.d[l]; int k1 = k + PistonBlockTextures.d[l];
@ -313,17 +315,17 @@ public class BlockPiston extends Block {
int i2; int i2;
if (l1 < 13) { if (l1 < 13) {
label63: { if (j1 <= 0 || j1 >= world.height - 1) {
if (j1 > 0) { return false;
world.getClass(); }
if (j1 < 128 - 1) {
i2 = world.getTypeId(i1, j1, k1); i2 = world.getTypeId(i1, j1, k1);
if (i2 != 0) { if (i2 != 0) {
if (!a(i2, world, i1, j1, k1, true)) { if (!a(i2, world, i1, j1, k1, true)) {
return false; return false;
} }
if (Block.byId[i2].e() != 1) { if (Block.byId[i2].g() != 1) {
if (l1 == 12) { if (l1 == 12) {
return false; return false;
} }
@ -335,15 +337,9 @@ public class BlockPiston extends Block {
continue; continue;
} }
Block.byId[i2].g(world, i1, j1, k1, world.getData(i1, j1, k1)); Block.byId[i2].b(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
world.setTypeId(i1, j1, k1, 0); world.setTypeId(i1, j1, k1, 0);
} }
break label63;
}
}
return false;
}
} }
while (i1 != i || j1 != j || k1 != k) { while (i1 != i || j1 != j || k1 != k) {

Datei anzeigen

@ -26,8 +26,8 @@ public class BlockPistonExtension extends Block {
if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) { if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) {
l = world.getData(i, j, k); l = world.getData(i, j, k);
if (BlockPiston.d(l)) { if (BlockPiston.e(l)) {
Block.byId[j1].g(world, i, j, k, l); Block.byId[j1].b(world, i, j, k, l, 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
} }
@ -39,6 +39,10 @@ public class BlockPistonExtension extends Block {
return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == PistonBlockTextures.a[k] ? 107 : 108); return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == PistonBlockTextures.a[k] ? 107 : 108);
} }
public int c() {
return 17;
}
public boolean a() { public boolean a() {
return false; return false;
} }

Datei anzeigen

@ -166,7 +166,7 @@ public class BlockPortal extends BlockBreakable {
world.getServer().getPluginManager().callEvent(event); world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end // CraftBukkit end
entity.T(); entity.Y();
} }
} }
} }

Datei anzeigen

@ -22,7 +22,7 @@ public class BlockPressurePlate extends Block {
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f); this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
} }
public int c() { public int d() {
return 20; return 20;
} }
@ -52,7 +52,7 @@ public class BlockPressurePlate extends Block {
} }
if (flag) { if (flag) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
} }
@ -144,7 +144,7 @@ public class BlockPressurePlate extends Block {
} }
if (flag1) { if (flag1) {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
} }
@ -182,7 +182,15 @@ public class BlockPressurePlate extends Block {
return true; return true;
} }
public int e() { public void f() {
float f = 0.5F;
float f1 = 0.125F;
float f2 = 0.5F;
this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
}
public int g() {
return 1; return 1;
} }
} }

Datei anzeigen

@ -35,6 +35,21 @@ public class BlockPumpkin extends Block {
public void a(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
super.a(world, i, j, k); super.a(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.isStatic) {
world.setTypeId(i, j, k, 0);
world.setTypeId(i, j - 1, k, 0);
world.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);
world.addEntity(entitysnowman);
}
for (int l = 0; l < 120; ++l) {
world.a("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);
}
}
} }
public boolean canPlace(World world, int i, int j, int k) { public boolean canPlace(World world, int i, int j, int k) {

Datei anzeigen

@ -42,7 +42,7 @@ public class BlockRedstoneTorch extends BlockTorch {
this.a(true); this.a(true);
} }
public int c() { public int d() {
return 2; return 2;
} }
@ -145,14 +145,14 @@ public class BlockRedstoneTorch extends BlockTorch {
public void doPhysics(World world, int i, int j, int k, int l) { public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l); super.doPhysics(world, i, j, k, l);
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
public boolean d(World world, int i, int j, int k, int l) { public boolean d(World world, int i, int j, int k, int l) {
return l == 0 ? this.a(world, i, j, k, l) : false; return l == 0 ? this.a(world, i, j, k, l) : false;
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Block.REDSTONE_TORCH_ON.id; return Block.REDSTONE_TORCH_ON.id;
} }

Datei anzeigen

@ -33,6 +33,10 @@ public class BlockRedstoneWire extends Block {
return false; return false;
} }
public int c() {
return 5;
}
public boolean canPlace(World world, int i, int j, int k) { public boolean canPlace(World world, int i, int j, int k) {
return world.e(i, j - 1, k); return world.e(i, j - 1, k);
} }
@ -280,7 +284,7 @@ public class BlockRedstoneWire extends Block {
boolean flag = this.canPlace(world, i, j, k); boolean flag = this.canPlace(world, i, j, k);
if (!flag) { if (!flag) {
this.g(world, i, j, k, i1); this.b(world, i, j, k, i1, 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } else {
this.g(world, i, j, k); this.g(world, i, j, k);
@ -290,7 +294,7 @@ public class BlockRedstoneWire extends Block {
} }
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Item.REDSTONE.id; return Item.REDSTONE.id;
} }
@ -306,25 +310,25 @@ public class BlockRedstoneWire extends Block {
} else if (l == 1) { } else if (l == 1) {
return true; return true;
} else { } else {
boolean flag = c(iblockaccess, i - 1, j, k, 1) || !iblockaccess.e(i - 1, j, k) && c(iblockaccess, i - 1, j - 1, k, -1); boolean flag = d(iblockaccess, i - 1, j, k, 1) || !iblockaccess.e(i - 1, j, k) && d(iblockaccess, i - 1, j - 1, k, -1);
boolean flag1 = c(iblockaccess, i + 1, j, k, 3) || !iblockaccess.e(i + 1, j, k) && c(iblockaccess, i + 1, j - 1, k, -1); boolean flag1 = d(iblockaccess, i + 1, j, k, 3) || !iblockaccess.e(i + 1, j, k) && d(iblockaccess, i + 1, j - 1, k, -1);
boolean flag2 = c(iblockaccess, i, j, k - 1, 2) || !iblockaccess.e(i, j, k - 1) && c(iblockaccess, i, j - 1, k - 1, -1); boolean flag2 = d(iblockaccess, i, j, k - 1, 2) || !iblockaccess.e(i, j, k - 1) && d(iblockaccess, i, j - 1, k - 1, -1);
boolean flag3 = c(iblockaccess, i, j, k + 1, 0) || !iblockaccess.e(i, j, k + 1) && c(iblockaccess, i, j - 1, k + 1, -1); boolean flag3 = d(iblockaccess, i, j, k + 1, 0) || !iblockaccess.e(i, j, k + 1) && d(iblockaccess, i, j - 1, k + 1, -1);
if (!iblockaccess.e(i, j + 1, k)) { if (!iblockaccess.e(i, j + 1, k)) {
if (iblockaccess.e(i - 1, j, k) && c(iblockaccess, i - 1, j + 1, k, -1)) { if (iblockaccess.e(i - 1, j, k) && d(iblockaccess, i - 1, j + 1, k, -1)) {
flag = true; flag = true;
} }
if (iblockaccess.e(i + 1, j, k) && c(iblockaccess, i + 1, j + 1, k, -1)) { if (iblockaccess.e(i + 1, j, k) && d(iblockaccess, i + 1, j + 1, k, -1)) {
flag1 = true; flag1 = true;
} }
if (iblockaccess.e(i, j, k - 1) && c(iblockaccess, i, j + 1, k - 1, -1)) { if (iblockaccess.e(i, j, k - 1) && d(iblockaccess, i, j + 1, k - 1, -1)) {
flag2 = true; flag2 = true;
} }
if (iblockaccess.e(i, j, k + 1) && c(iblockaccess, i, j + 1, k + 1, -1)) { if (iblockaccess.e(i, j, k + 1) && d(iblockaccess, i, j + 1, k + 1, -1)) {
flag3 = true; flag3 = true;
} }
} }
@ -344,14 +348,30 @@ public class BlockRedstoneWire extends Block {
return true; return true;
} else if (i1 == 0) { } else if (i1 == 0) {
return false; return false;
} else if (Block.byId[i1].isPowerSource()) { } else if (Block.byId[i1].isPowerSource() && l != -1) {
return true; return true;
} else if (i1 != Block.DIODE_OFF.id && i1 != Block.DIODE_ON.id) { } else if (i1 != Block.DIODE_OFF.id && i1 != Block.DIODE_ON.id) {
return false; return false;
} else { } else {
int j1 = iblockaccess.getData(i, j, k); int j1 = iblockaccess.getData(i, j, k);
return l == Direction.e[j1 & 3]; return l == (j1 & 3) || l == Direction.e[j1 & 3];
}
}
public static boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (c(iblockaccess, i, j, k, l)) {
return true;
} 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;
}
} }
} }
} }

Datei anzeigen

@ -11,30 +11,32 @@ public class BlockSand extends Block {
} }
public void a(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
public void doPhysics(World world, int i, int j, int k, int l) { public void doPhysics(World world, int i, int j, int k, int l) {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.d());
} }
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
this.g(world, i, j, k); this.h(world, i, j, k);
} }
private void g(World world, int i, int j, int k) { private void h(World world, int i, int j, int k) {
if (d_(world, i, j - 1, k) && j >= 0) { if (g(world, i, j - 1, k) && j >= 0) {
byte b0 = 32; byte b0 = 32;
if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) { if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (!world.isStatic) {
// CraftBukkit Change call to add data // CraftBukkit Change call to add data
EntityFallingSand entityfallingsand = new EntityFallingSand(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k)); EntityFallingSand entityfallingsand = new EntityFallingSand(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
world.addEntity(entityfallingsand); world.addEntity(entityfallingsand);
}
} else { } else {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
while (d_(world, i, j - 1, k) && j > 0) { while (g(world, i, j - 1, k) && j > 0) {
--j; --j;
} }
@ -45,11 +47,11 @@ public class BlockSand extends Block {
} }
} }
public int c() { public int d() {
return 3; return 3;
} }
public static boolean d_(World world, int i, int j, int k) { public static boolean g(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k); int l = world.getTypeId(i, j, k);
if (l == 0) { if (l == 0) {

Datei anzeigen

@ -16,7 +16,7 @@ public class BlockSapling extends BlockFlower {
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) { if (!world.isStatic) {
super.a(world, i, j, k, random); super.a(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(30) == 0) { if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if ((l & 8) == 0) { if ((l & 8) == 0) {
@ -42,15 +42,16 @@ public class BlockSapling extends BlockFlower {
boolean grownTree; boolean grownTree;
BlockChangeWithNotify delegate = new BlockChangeWithNotify(world); BlockChangeWithNotify delegate = new BlockChangeWithNotify(world);
// All of these are 'false' because we need the 'raw' calls so the block-delegate works
if (l == 1) { if (l == 1) {
grownTree = new WorldGenTaiga2().generate(delegate, random, i, j, k); grownTree = new WorldGenTaiga2(false).generate(delegate, random, i, j, k);
} else if (l == 2) { } else if (l == 2) {
grownTree = new WorldGenForest().generate(delegate, random, i, j, k); grownTree = new WorldGenForest(false).generate(delegate, random, i, j, k);
} else { } else {
if (random.nextInt(10) == 0) { if (random.nextInt(10) == 0) {
grownTree = new WorldGenBigTree().generate(delegate, random, i, j, k); grownTree = new WorldGenBigTree(false).generate(delegate, random, i, j, k);
} else { } else {
grownTree = new WorldGenTrees().generate(delegate, random, i, j, k); grownTree = new WorldGenTrees(false).generate(delegate, random, i, j, k);
} }
} }
@ -60,7 +61,7 @@ public class BlockSapling extends BlockFlower {
// CraftBukkit end // CraftBukkit end
} }
protected int a_(int i) { protected int c(int i) {
return i & 3; return i & 3;
} }

Datei anzeigen

@ -52,6 +52,10 @@ public class BlockSign extends BlockContainer {
} }
} }
public int c() {
return -1;
}
public boolean b() { public boolean b() {
return false; return false;
} }
@ -68,7 +72,7 @@ public class BlockSign extends BlockContainer {
} }
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Item.SIGN.id; return Item.SIGN.id;
} }
@ -101,7 +105,7 @@ public class BlockSign extends BlockContainer {
} }
if (flag) { if (flag) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }

Datei anzeigen

@ -44,7 +44,7 @@ public class BlockSnow extends Block {
private boolean g(World world, int i, int j, int k) { private boolean g(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) { if (!this.canPlace(world, i, j, k)) {
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
return false; return false;
} else { } else {
@ -66,7 +66,7 @@ public class BlockSnow extends Block {
entityhuman.a(StatisticList.C[this.id], 1); entityhuman.a(StatisticList.C[this.id], 1);
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Item.SNOW_BALL.id; return Item.SNOW_BALL.id;
} }
@ -82,7 +82,7 @@ public class BlockSnow extends Block {
} }
// CraftBukkit end // CraftBukkit end
this.g(world, i, j, k, world.getData(i, j, k)); this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
} }

Datei anzeigen

@ -14,7 +14,7 @@ public class BlockSoil extends Block {
this.textureId = 87; this.textureId = 87;
this.a(true); this.a(true);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F); this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
this.f(255); this.g(255);
} }
public AxisAlignedBB e(World world, int i, int j, int k) { public AxisAlignedBB e(World world, int i, int j, int k) {
@ -34,8 +34,7 @@ public class BlockSoil extends Block {
} }
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
if (random.nextInt(5) == 0) { if (!this.h(world, i, j, k) && !world.v(i, j + 1, k)) {
if (!this.h(world, i, j, k) && !world.s(i, j + 1, k)) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if (l > 0) { if (l > 0) {
@ -47,7 +46,6 @@ public class BlockSoil extends Block {
world.setData(i, j, k, 7); world.setData(i, j, k, 7);
} }
} }
}
public void b(World world, int i, int j, int k, Entity entity) { public void b(World world, int i, int j, int k, Entity entity) {
if (world.random.nextInt(4) == 0) { if (world.random.nextInt(4) == 0) {
@ -108,7 +106,7 @@ public class BlockSoil extends Block {
} }
} }
public int a(int i, Random random) { public int a(int i, Random random, int j) {
return Block.DIRT.a(0, random); return Block.DIRT.a(0, random, j);
} }
} }

Datei anzeigen

@ -13,7 +13,7 @@ public class BlockStairs extends Block {
this.c(block.strength); this.c(block.strength);
this.b(block.durability / 3.0F); this.b(block.durability / 3.0F);
this.a(block.stepSound); this.a(block.stepSound);
this.f(255); this.g(255);
} }
public void a(IBlockAccess iblockaccess, int i, int j, int k) { public void a(IBlockAccess iblockaccess, int i, int j, int k) {
@ -32,6 +32,10 @@ public class BlockStairs extends Block {
return false; return false;
} }
public int c() {
return 10;
}
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) { public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
@ -72,14 +76,6 @@ public class BlockStairs extends Block {
return this.a.a(entity); return this.a.a(entity);
} }
public int a(int i, Random random) {
return this.a.a(i, random);
}
public int a(Random random) {
return this.a.a(random);
}
public int a(int i, int j) { public int a(int i, int j) {
return this.a.a(i, 0); return this.a.a(i, 0);
} }
@ -88,16 +84,16 @@ public class BlockStairs extends Block {
return this.a.a(i, 0); return this.a.a(i, 0);
} }
public int c() { public int d() {
return this.a.c(); return this.a.d();
} }
public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) { public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) {
this.a.a(world, i, j, k, entity, vec3d); this.a.a(world, i, j, k, entity, vec3d);
} }
public boolean q_() { public boolean v_() {
return this.a.q_(); return this.a.v_();
} }
public boolean a(int i, boolean flag) { public boolean a(int i, boolean flag) {
@ -117,8 +113,8 @@ public class BlockStairs extends Block {
this.a.remove(world, i, j, k); this.a.remove(world, i, j, k);
} }
public void dropNaturally(World world, int i, int j, int k, int l, float f) { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
this.a.dropNaturally(world, i, j, k, 0, f); // CraftBukkit - don't propagate stair direction this.a.dropNaturally(world, i, j, k, 0, f, i1); // CraftBukkit - don't propagate stair direction
} }
public void b(World world, int i, int j, int k, Entity entity) { public void b(World world, int i, int j, int k, Entity entity) {

Datei anzeigen

@ -27,7 +27,7 @@ public class BlockStationary extends BlockFluids {
world.suppressPhysics = true; world.suppressPhysics = true;
world.setRawTypeIdAndData(i, j, k, this.id - 1, l); world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
world.b(i, j, k, i, j, k); world.b(i, j, k, i, j, k);
world.c(i, j, k, this.id - 1, this.c()); world.c(i, j, k, this.id - 1, this.d());
world.suppressPhysics = false; world.suppressPhysics = false;
} }

Datei anzeigen

@ -25,20 +25,30 @@ public class BlockTrapdoor extends Block {
return false; return false;
} }
public int c() {
return 0;
}
public AxisAlignedBB e(World world, int i, int j, int k) { public AxisAlignedBB e(World world, int i, int j, int k) {
this.a((IBlockAccess)world, i, j, k); // CraftBukkit - Make sure this points to the below method! this.a(world, i, j, k);
return super.e(world, i, j, k); return super.e(world, i, j, k);
} }
public void a(IBlockAccess iblockaccess, int i, int j, int k) { public void a(IBlockAccess iblockaccess, int i, int j, int k) {
this.c(iblockaccess.getData(i, j, k)); this.d(iblockaccess.getData(i, j, k));
} }
public void c(int i) { public void f() {
float f = 0.1875F;
this.a(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F);
}
public void d(int i) {
float f = 0.1875F; float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
if (d(i)) { if (e(i)) {
if ((i & 3) == 0) { if ((i & 3) == 0) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
} }
@ -105,9 +115,9 @@ public class BlockTrapdoor extends Block {
--j1; --j1;
} }
if (!world.e(j1, j, k1)) { if (!f(world.getTypeId(j1, j, k1))) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
this.g(world, i, j, k, i1); this.b(world, i, j, k, i1, 0);
} }
// CraftBukkit start // CraftBukkit start
@ -179,11 +189,21 @@ public class BlockTrapdoor extends Block {
--i; --i;
} }
return world.e(i, j, k); return f(world.getTypeId(i, j, k));
} }
} }
public static boolean d(int i) { public static boolean e(int i) {
return (i & 4) != 0; return (i & 4) != 0;
} }
private static boolean f(int i) {
if (i <= 0) {
return false;
} else {
Block block = Block.byId[i];
return block != null && block.material.j() && block.b() || block == Block.GLOWSTONE;
}
}
} }

Datei anzeigen

@ -7,7 +7,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import org.bukkit.Bukkit; import org.bukkit.Bukkit; // CraftBukkit
public class Chunk { public class Chunk {
@ -24,6 +24,7 @@ public class Chunk {
public int k; public int k;
public final int x; public final int x;
public final int z; public final int z;
private boolean v;
public Map tileEntities; public Map tileEntities;
public List[] entitySlices; public List[] entitySlices;
public boolean done; public boolean done;
@ -36,14 +37,14 @@ public class Chunk {
public Chunk(World world, int i, int j) { public Chunk(World world, int i, int j) {
this.c = new int[256]; this.c = new int[256];
this.d = new boolean[256]; this.d = new boolean[256];
this.v = false;
this.tileEntities = new HashMap(); this.tileEntities = new HashMap();
this.done = false; this.done = false;
this.q = false; this.q = false;
this.s = false; this.s = false;
this.t = 0L; this.t = 0L;
this.u = false; this.u = false;
world.getClass(); this.entitySlices = new List[world.height / 16];
this.entitySlices = new List[128 / 16];
this.world = world; this.world = world;
this.x = i; this.x = i;
this.z = j; this.z = j;
@ -71,14 +72,9 @@ public class Chunk {
public Chunk(World world, byte[] abyte, int i, int j) { public Chunk(World world, byte[] abyte, int i, int j) {
this(world, i, j); this(world, i, j);
this.b = abyte; this.b = abyte;
this.g = new NibbleArray(abyte.length, world.heightBits);
int k = abyte.length; this.h = new NibbleArray(abyte.length, world.heightBits);
this.i = new NibbleArray(abyte.length, world.heightBits);
// Craftbukkit start - FIX THE DECOMPILER!
this.g = new NibbleArray(k, 7);
this.h = new NibbleArray(k, 7);
this.i = new NibbleArray(k, 7);
// Craftbukkit end
} }
public boolean a(int i, int j) { public boolean a(int i, int j) {
@ -92,22 +88,18 @@ public class Chunk {
public void a() {} public void a() {}
public void initLighting() { public void initLighting() {
int i = this.world.height - 1;
int i = 128 - 1;
int j; int j;
int k; int k;
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
for (k = 0; k < 16; ++k) { for (k = 0; k < 16; ++k) {
int l = this.world.height - 1;
int l = 128 - 1; int i1;
int i1 = j << 11; for (i1 = j << this.world.heightBitsPlusFour | k << this.world.heightBits; l > 0 && Block.q[this.b[i1 + l - 1] & 255] == 0; --l) {
int j1;
for (j1 = i1 | k << 7; l > 0 && Block.q[this.b[j1 + l - 1] & 255] == 0; --l) {
; ;
} }
@ -117,18 +109,17 @@ public class Chunk {
} }
if (!this.world.worldProvider.e) { if (!this.world.worldProvider.e) {
int k1 = 15; int j1 = 15;
int k1 = this.world.height - 1;
int l1 = 128 - 1;
do { do {
k1 -= Block.q[this.b[j1 + l1] & 255]; j1 -= Block.q[this.b[i1 + k1] & 255];
if (k1 > 0) { if (j1 > 0) {
this.h.a(j, l1, k, k1); this.h.a(j, k1, k, j1);
} }
--l1; --k1;
} while (l1 > 0 && k1 > 0); } while (k1 > 0 && j1 > 0);
} }
} }
} }
@ -148,44 +139,41 @@ public class Chunk {
private void d(int i, int j) { private void d(int i, int j) {
this.d[i + j * 16] = true; this.d[i + j * 16] = true;
this.v = true;
} }
private void i() { private void k() {
World j0000 = this.world; if (this.world.areChunksLoaded(this.x * 16 + 8, this.world.height / 2, this.z * 16 + 8, 16)) {
int j0001 = this.x * 16 + 8; for (int i = 0; i < 16; ++i) {
if (j0000.areChunksLoaded(j0001, 128 / 2, this.z * 16 + 8, 16)) {
for (int j = 0; j < 16; ++j) { for (int j = 0; j < 16; ++j) {
for (int k = 0; k < 16; ++k) { if (this.d[i + j * 16]) {
if (this.d[j + k * 16]) { this.d[i + j * 16] = false;
this.d[j + k * 16] = false; int k = this.b(i, j);
int l = this.b(j, k); int l = this.x * 16 + i;
int i1 = this.x * 16 + j; int i1 = this.z * 16 + j;
int j1 = this.z * 16 + k; int j1 = this.world.getHighestBlockYAt(l - 1, i1);
int k1 = this.world.getHighestBlockYAt(i1 - 1, j1); int k1 = this.world.getHighestBlockYAt(l + 1, i1);
int l1 = this.world.getHighestBlockYAt(i1 + 1, j1); int l1 = this.world.getHighestBlockYAt(l, i1 - 1);
int i2 = this.world.getHighestBlockYAt(i1, j1 - 1); int i2 = this.world.getHighestBlockYAt(l, i1 + 1);
int j2 = this.world.getHighestBlockYAt(i1, j1 + 1);
if (l1 < k1) { if (k1 < j1) {
k1 = l1; j1 = k1;
} }
if (i2 < k1) { if (l1 < j1) {
k1 = i2; j1 = l1;
} }
if (j2 < k1) { if (i2 < j1) {
k1 = j2; j1 = i2;
} }
this.u = true; this.f(l, i1, j1);
this.f(i1, j1, k1); this.f(l - 1, i1, k);
this.u = true; this.f(l + 1, i1, k);
this.f(i1 - 1, j1, l); this.f(l, i1 - 1, k);
this.f(i1 + 1, j1, l); this.f(l, i1 + 1, k);
this.f(i1, j1 - 1, l); this.v = false;
this.f(i1, j1 + 1, l);
} }
} }
} }
@ -203,10 +191,7 @@ public class Chunk {
} }
private void d(int i, int j, int k, int l) { private void d(int i, int j, int k, int l) {
if (l > k) { if (l > k && this.world.areChunksLoaded(i, this.world.height / 2, j, 16)) {
World world = this.world;
if (world.areChunksLoaded(i, 128 / 2, j, 16)) {
for (int i1 = k; i1 < l; ++i1) { for (int i1 = k; i1 < l; ++i1) {
this.world.b(EnumSkyBlock.SKY, i, i1, j); this.world.b(EnumSkyBlock.SKY, i, i1, j);
} }
@ -214,7 +199,6 @@ public class Chunk {
this.q = true; this.q = true;
} }
} }
}
private void g(int i, int j, int k) { private void g(int i, int j, int k) {
int l = this.heightMap[k << 4 | i] & 255; int l = this.heightMap[k << 4 | i] & 255;
@ -223,88 +207,87 @@ public class Chunk {
if (j > l) { if (j > l) {
i1 = j; i1 = j;
} }
//
this.world.getClass();
int j1 = i << 11;
for (int k1 = j1 | k << 7; i1 > 0 && Block.q[this.b[k1 + i1 - 1] & 255] == 0; --i1) { for (int j1 = i << this.world.heightBitsPlusFour | k << this.world.heightBits; i1 > 0 && Block.q[this.b[j1 + i1 - 1] & 255] == 0; --i1) {
; ;
} }
if (i1 != l) { if (i1 != l) {
this.world.g(i, k, i1, l); this.world.g(i, k, i1, l);
this.heightMap[k << 4 | i] = (byte) i1; this.heightMap[k << 4 | i] = (byte) i1;
int k1;
int l1; int l1;
int i2; int i2;
int j2;
if (i1 < this.k) { if (i1 < this.k) {
this.k = i1; this.k = i1;
} else { } else {
k1 = this.world.height - 1;
l1 = 128 - 1; for (l1 = 0; l1 < 16; ++l1) {
for (i2 = 0; i2 < 16; ++i2) { for (i2 = 0; i2 < 16; ++i2) {
for (j2 = 0; j2 < 16; ++j2) { if ((this.heightMap[i2 << 4 | l1] & 255) < k1) {
if ((this.heightMap[j2 << 4 | i2] & 255) < l1) { k1 = this.heightMap[i2 << 4 | l1] & 255;
l1 = this.heightMap[j2 << 4 | i2] & 255;
} }
} }
} }
this.k = l1; this.k = k1;
} }
l1 = this.x * 16 + i; k1 = this.x * 16 + i;
i2 = this.z * 16 + k; l1 = this.z * 16 + k;
int j2;
if (!this.world.worldProvider.e) {
if (i1 < l) { if (i1 < l) {
for (j2 = i1; j2 < l; ++j2) { for (i2 = i1; i2 < l; ++i2) {
this.h.a(i, j2, k, 15); this.h.a(i, i2, k, 15);
} }
} else { } else {
for (j2 = l; j2 < i1; ++j2) { for (i2 = l; i2 < i1; ++i2) {
this.h.a(i, j2, k, 0); this.h.a(i, i2, k, 0);
} }
} }
for (j2 = 15; i1 > 0 && j2 > 0; this.h.a(i, i1, k, j2)) { for (i2 = 15; i1 > 0 && i2 > 0; this.h.a(i, i1, k, i2)) {
--i1; --i1;
int k2 = Block.q[this.getTypeId(i, i1, k)]; j2 = Block.q[this.getTypeId(i, i1, k)];
if (j2 == 0) {
if (k2 == 0) { j2 = 1;
k2 = 1;
} }
j2 -= k2; i2 -= j2;
if (j2 < 0) { if (i2 < 0) {
j2 = 0; i2 = 0;
}
} }
} }
byte b0 = this.heightMap[k << 4 | i]; byte b0 = this.heightMap[k << 4 | i];
int l2 = l;
int i3 = b0; j2 = l;
int k2 = b0;
if (b0 < l) { if (b0 < l) {
l2 = b0; j2 = b0;
i3 = l; k2 = l;
}
if (!this.world.worldProvider.e) {
this.d(k1 - 1, l1, j2, k2);
this.d(k1 + 1, l1, j2, k2);
this.d(k1, l1 - 1, j2, k2);
this.d(k1, l1 + 1, j2, k2);
this.d(k1, l1, j2, k2);
} }
this.d(l1 - 1, i2, l2, i3);
this.d(l1 + 1, i2, l2, i3);
this.d(l1, i2 - 1, l2, i3);
this.d(l1, i2 + 1, l2, i3);
this.d(l1, i2, l2, i3);
this.q = true; this.q = true;
} }
} }
public int getTypeId(int i, int j, int k) { public int getTypeId(int i, int j, int k) {
byte[] abyte = this.b; return this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
int l = i << 11;
return abyte[l | k << 7 | j] & 255;
} }
public boolean a(int i, int j, int k, int l, int i1) { public boolean a(int i, int j, int k, int l, int i1) {
@ -316,25 +299,21 @@ public class Chunk {
} }
int k1 = this.heightMap[k << 4 | i] & 255; int k1 = this.heightMap[k << 4 | i] & 255;
byte[] j2000 = this.b; int l1 = this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
int j2001 = i << 11; if (l1 == l && this.g.a(i, j, k) == i1) {
int i2 = j2000[j2001 | k << 7 | j] & 255;
if (i2 == l && this.g.a(i, j, k) == i1) {
return false; return false;
} else { } else {
int j2 = this.x * 16 + i; int i2 = this.x * 16 + i;
int k2 = this.z * 16 + k; int j2 = this.z * 16 + k;
j2000 = this.b; this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255);
if (l1 != 0) {
j2001 = i << 11; if (!this.world.isStatic) {
Block.byId[l1].remove(this.world, i2, j, j2);
j2000[j2001 | k << 7 | j] = (byte) (b0 & 255); } else if (Block.byId[l1] instanceof BlockContainer) {
if (i2 != 0 && !this.world.isStatic) { this.world.n(i2, j, j2);
Block.byId[i2].remove(this.world, j2, j, k2); }
} }
this.g.a(i, j, k, i1); this.g.a(i, j, k, i1);
@ -347,17 +326,17 @@ public class Chunk {
this.g(i, j, k); this.g(i, j, k);
} }
this.world.a(EnumSkyBlock.SKY, j2, j, k2, j2, j, k2); this.world.a(EnumSkyBlock.SKY, i2, j, j2, i2, j, j2);
} }
this.world.a(EnumSkyBlock.BLOCK, j2, j, k2, j2, j, k2); this.world.a(EnumSkyBlock.BLOCK, i2, j, j2, i2, j, j2);
this.d(i, k); this.d(i, k);
this.g.a(i, j, k, i1); this.g.a(i, j, k, i1);
TileEntity tileentity; TileEntity tileentity;
if (l != 0) { if (l != 0) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
Block.byId[l].a(this.world, j2, j, k2); Block.byId[l].a(this.world, i2, j, j2);
} }
if (Block.byId[l] instanceof BlockContainer) { if (Block.byId[l] instanceof BlockContainer) {
@ -368,13 +347,13 @@ public class Chunk {
} }
if (tileentity != null) { if (tileentity != null) {
tileentity.g(); tileentity.d();
} }
} }
} else if (i2 > 0 && Block.byId[i2] instanceof BlockContainer) { } else if (l1 > 0 && Block.byId[l1] instanceof BlockContainer) {
tileentity = this.d(i, j, k); tileentity = this.d(i, j, k);
if (tileentity != null) { if (tileentity != null) {
tileentity.g(); tileentity.d();
} }
} }
@ -392,25 +371,17 @@ public class Chunk {
} }
int j1 = this.heightMap[i1] & 255; int j1 = this.heightMap[i1] & 255;
byte[] j2000 = this.b; int k1 = this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
int j2001 = i << 11; if (k1 == l) {
int l1 = j2000[j2001 | k << 7 | j] & 255;
if (l1 == l) {
return false; return false;
} else { } else {
int i2 = this.x * 16 + i; int l1 = this.x * 16 + i;
int j2 = this.z * 16 + k; int i2 = this.z * 16 + k;
j2000 = this.b; this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255);
if (k1 != 0) {
j2001 = i << 11; Block.byId[k1].remove(this.world, l1, j, i2);
j2000[j2001 | k << 7 | j] = (byte) (b0 & 255);
if (l1 != 0) {
Block.byId[l1].remove(this.world, i2, j, j2);
} }
this.g.a(i, j, k, 0); this.g.a(i, j, k, 0);
@ -422,14 +393,14 @@ public class Chunk {
this.g(i, j, k); this.g(i, j, k);
} }
this.world.a(EnumSkyBlock.SKY, i2, j, j2, i2, j, j2); this.world.a(EnumSkyBlock.SKY, l1, j, i2, l1, j, i2);
this.world.a(EnumSkyBlock.BLOCK, i2, j, j2, i2, j, j2); this.world.a(EnumSkyBlock.BLOCK, l1, j, i2, l1, j, i2);
this.d(i, k); this.d(i, k);
TileEntity tileentity; TileEntity tileentity;
if (l != 0) { if (l != 0) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
Block.byId[l].a(this.world, i2, j, j2); Block.byId[l].a(this.world, l1, j, i2);
} }
if (l > 0 && Block.byId[l] instanceof BlockContainer) { if (l > 0 && Block.byId[l] instanceof BlockContainer) {
@ -440,13 +411,13 @@ public class Chunk {
} }
if (tileentity != null) { if (tileentity != null) {
tileentity.g(); tileentity.d();
} }
} }
} else if (l1 > 0 && Block.byId[l1] instanceof BlockContainer) { } else if (k1 > 0 && Block.byId[k1] instanceof BlockContainer) {
tileentity = this.d(i, j, k); tileentity = this.d(i, j, k);
if (tileentity != null) { if (tileentity != null) {
tileentity.g(); tileentity.d();
} }
} }
@ -459,19 +430,27 @@ public class Chunk {
return this.g.a(i, j, k); return this.g.a(i, j, k);
} }
public void b(int i, int j, int k, int l) { public boolean b(int i, int j, int k, int l) {
this.q = true; this.q = true;
this.g.a(i, j, k, l); int i1 = this.g.a(i, j, k);
int i1 = this.getTypeId(i, j, k);
if (i1 > 0 && Block.byId[i1] instanceof BlockContainer) { if (i1 == l) {
return false;
} else {
this.g.a(i, j, k, l);
int j1 = this.getTypeId(i, j, k);
if (j1 > 0 && Block.byId[j1] instanceof BlockContainer) {
TileEntity tileentity = this.d(i, j, k); TileEntity tileentity = this.d(i, j, k);
if (tileentity != null) { if (tileentity != null) {
tileentity.g(); tileentity.d();
tileentity.n = l; tileentity.p = l;
} }
} }
return true;
}
} }
public int a(EnumSkyBlock enumskyblock, int i, int j, int k) { public int a(EnumSkyBlock enumskyblock, int i, int j, int k) {
@ -481,7 +460,9 @@ public class Chunk {
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) { public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
this.q = true; this.q = true;
if (enumskyblock == EnumSkyBlock.SKY) { if (enumskyblock == EnumSkyBlock.SKY) {
if (!this.world.worldProvider.e) {
this.h.a(i, j, k, l); this.h.a(i, j, k, l);
}
} else { } else {
if (enumskyblock != EnumSkyBlock.BLOCK) { if (enumskyblock != EnumSkyBlock.BLOCK) {
return; return;
@ -492,7 +473,7 @@ public class Chunk {
} }
public int c(int i, int j, int k, int l) { public int c(int i, int j, int k, int l) {
int i1 = this.h.a(i, j, k); int i1 = this.world.worldProvider.e ? 0 : this.h.a(i, j, k);
if (i1 > 0) { if (i1 > 0) {
a = true; a = true;
@ -531,15 +512,15 @@ public class Chunk {
k = this.entitySlices.length - 1; k = this.entitySlices.length - 1;
} }
entity.bV = true; entity.bW = true;
entity.bW = this.x; entity.bX = this.x;
entity.bX = k; entity.bY = k;
entity.bY = this.z; entity.bZ = this.z;
this.entitySlices[k].add(entity); this.entitySlices[k].add(entity);
} }
public void b(Entity entity) { public void b(Entity entity) {
this.a(entity, entity.bX); this.a(entity, entity.bY);
} }
public void a(Entity entity, int i) { public void a(Entity entity, int i) {
@ -577,7 +558,7 @@ public class Chunk {
tileentity = (TileEntity) this.tileEntities.get(chunkposition); tileentity = (TileEntity) this.tileEntities.get(chunkposition);
} }
if (tileentity != null && tileentity.m()) { if (tileentity != null && tileentity.l()) {
this.tileEntities.remove(chunkposition); this.tileEntities.remove(chunkposition);
return null; return null;
} else { } else {
@ -604,10 +585,10 @@ public class Chunk {
tileentity.y = j; tileentity.y = j;
tileentity.z = this.z * 16 + k; tileentity.z = this.z * 16 + k;
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) { if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
tileentity.n(); tileentity.m();
this.tileEntities.put(chunkposition, tileentity); this.tileEntities.put(chunkposition, tileentity);
} else {
// CraftBukkit start // CraftBukkit start
} else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z 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!"); + " (" + org.bukkit.Material.getMaterial(getTypeId(i, j, k)) + ") where there was no entity tile!");
// CraftBukkit end // CraftBukkit end
@ -689,6 +670,16 @@ public class Chunk {
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) { if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
list.add(entity1); list.add(entity1);
Entity[] aentity = entity1.aG();
if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) {
entity1 = aentity[i1];
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
list.add(entity1);
}
}
}
} }
} }
} }
@ -700,10 +691,14 @@ public class Chunk {
if (i < 0) { if (i < 0) {
i = 0; i = 0;
} else if (i >= this.entitySlices.length) {
i = this.entitySlices.length - 1;
} }
if (j >= this.entitySlices.length) { if (j >= this.entitySlices.length) {
j = this.entitySlices.length - 1; j = this.entitySlices.length - 1;
} else if (j < 0) {
j = 0;
} }
for (int k = i; k <= j; ++k) { for (int k = i; k <= j; ++k) {
@ -755,53 +750,40 @@ public class Chunk {
int l2; int l2;
int i3; int i3;
int j3; int j3;
int k3;
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (i3 = k; i3 < j1; ++i3) { for (l2 = k; l2 < j1; ++l2) {
i3 = k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j;
l2 = k2 << 11; j3 = i1 - j;
System.arraycopy(this.b, i3, abyte, k1, j3);
j3 = l2 | i3 << 7 | j; k1 += j3;
k3 = i1 - j;
System.arraycopy(this.b, j3, abyte, k1, k3);
k1 += k3;
} }
} }
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (i3 = k; i3 < j1; ++i3) { for (l2 = k; l2 < j1; ++l2) {
i3 = (k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j) >> 1;
l2 = k2 << 11; j3 = (i1 - j) / 2;
System.arraycopy(this.g.a, i3, abyte, k1, j3);
j3 = (l2 | i3 << 7 | j) >> 1; k1 += j3;
k3 = (i1 - j) / 2;
System.arraycopy(this.g.a, j3, abyte, k1, k3);
k1 += k3;
} }
} }
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (i3 = k; i3 < j1; ++i3) { for (l2 = k; l2 < j1; ++l2) {
i3 = (k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j) >> 1;
l2 = k2 << 11; j3 = (i1 - j) / 2;
System.arraycopy(this.i.a, i3, abyte, k1, j3);
j3 = (l2 | i3 << 7 | j) >> 1; k1 += j3;
k3 = (i1 - j) / 2;
System.arraycopy(this.i.a, j3, abyte, k1, k3);
k1 += k3;
} }
} }
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (i3 = k; i3 < j1; ++i3) { for (l2 = k; l2 < j1; ++l2) {
i3 = (k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j) >> 1;
l2 = k2 << 11; j3 = (i1 - j) / 2;
System.arraycopy(this.h.a, i3, abyte, k1, j3);
j3 = (l2 | i3 << 7 | j) >> 1; k1 += j3;
k3 = (i1 - j) / 2;
System.arraycopy(this.h.a, j3, abyte, k1, k3);
k1 += k3;
} }
} }
@ -813,7 +795,11 @@ public class Chunk {
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.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i);
} }
public void g() { public boolean isEmpty() {
return false;
}
public void h() {
BlockRegister.a(this.b); BlockRegister.a(this.b);
} }
@ -840,8 +826,7 @@ public class Chunk {
int l = this.c[k]; int l = this.c[k];
if (l == -999) { if (l == -999) {
int i1 = this.world.height - 1;
int i1 = 128 - 1;
l = -1; l = -1;
@ -862,7 +847,13 @@ public class Chunk {
return l; return l;
} }
public void h() { public void i() {
this.i(); if (this.v && !this.world.worldProvider.e) {
this.k();
}
}
public ChunkCoordIntPair j() {
return new ChunkCoordIntPair(this.x, this.z);
} }
} }

Datei anzeigen

@ -31,11 +31,7 @@ public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit end // CraftBukkit end
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
this.emptyChunk = new EmptyChunk(worldserver, new byte[256 * worldserver.height], 0, 0);
worldserver.getClass();
EmptyChunk emptychunk = new EmptyChunk(worldserver, new byte[256 * 128], 0, 0);
this.emptyChunk = emptychunk;
this.world = worldserver; this.world = worldserver;
this.e = ichunkloader; this.e = ichunkloader;
this.chunkProvider = ichunkprovider; this.chunkProvider = ichunkprovider;
@ -46,6 +42,7 @@ public class ChunkProviderServer implements IChunkProvider {
} }
public void queueUnload(int i, int j) { public void queueUnload(int i, int j) {
if (this.world.worldProvider.c()) {
ChunkCoordinates chunkcoordinates = this.world.getSpawn(); ChunkCoordinates chunkcoordinates = this.world.getSpawn();
int k = i * 16 + 8 - chunkcoordinates.x; int k = i * 16 + 8 - chunkcoordinates.x;
int l = j * 16 + 8 - chunkcoordinates.z; int l = j * 16 + 8 - chunkcoordinates.z;
@ -54,6 +51,9 @@ public class ChunkProviderServer implements IChunkProvider {
if (k < -short1 || k > short1 || l < -short1 || l > short1 || !(this.world.keepSpawnInMemory)) { // CraftBukkit - added 'this.world.keepSpawnInMemory' if (k < -short1 || k > short1 || l < -short1 || l > short1 || !(this.world.keepSpawnInMemory)) { // CraftBukkit - added 'this.world.keepSpawnInMemory'
this.unloadQueue.add(i, j); // CraftBukkit this.unloadQueue.add(i, j); // CraftBukkit
} }
} else {
this.unloadQueue.add(i, j); // CraftBukkit
}
} }
public Chunk getChunkAt(int i, int j) { public Chunk getChunkAt(int i, int j) {
@ -253,4 +253,12 @@ public class ChunkProviderServer implements IChunkProvider {
public boolean canSave() { public boolean canSave() {
return !this.world.savingDisabled; return !this.world.savingDisabled;
} }
public List a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
return this.chunkProvider.a(enumcreaturetype, i, j, k);
}
public ChunkPosition a(World world, String s, int i, int j, int k) {
return this.chunkProvider.a(world, s, i, j, k);
}
} }

Datei anzeigen

@ -77,7 +77,7 @@ public class ContainerPlayer extends Container {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.e.get(i); Slot slot = (Slot) this.e.get(i);
if (slot != null && slot.b()) { if (slot != null && slot.c()) {
ItemStack itemstack1 = slot.getItem(); ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack(); itemstack = itemstack1.cloneItemStack();
@ -100,14 +100,14 @@ public class ContainerPlayer extends Container {
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.c((ItemStack) null);
} else { } else {
slot.c(); slot.d();
} }
if (itemstack1.count == itemstack.count) { if (itemstack1.count == itemstack.count) {
return null; return null;
} }
slot.a(itemstack1); slot.b(itemstack1);
} }
return itemstack; return itemstack;

Datei anzeigen

@ -72,7 +72,7 @@ public class ContainerWorkbench extends Container {
ItemStack itemstack = null; ItemStack itemstack = null;
Slot slot = (Slot) this.e.get(i); Slot slot = (Slot) this.e.get(i);
if (slot != null && slot.b()) { if (slot != null && slot.c()) {
ItemStack itemstack1 = slot.getItem(); ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack(); itemstack = itemstack1.cloneItemStack();
@ -95,14 +95,14 @@ public class ContainerWorkbench extends Container {
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.c((ItemStack) null);
} else { } else {
slot.c(); slot.d();
} }
if (itemstack1.count == itemstack.count) { if (itemstack1.count == itemstack.count) {
return null; return null;
} }
slot.a(itemstack1); slot.b(itemstack1);
} }
return itemstack; return itemstack;

Datei anzeigen

@ -25,6 +25,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE}); this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
this.registerShapedRecipe(new ItemStack(Item.BOOK, 1), new Object[] { "#", "#", "#", Character.valueOf('#'), Item.PAPER}); this.registerShapedRecipe(new ItemStack(Item.BOOK, 1), new Object[] { "#", "#", "#", Character.valueOf('#'), Item.PAPER});
this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK}); this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Item.STICK, Character.valueOf('W'), Block.WOOD}); 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(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
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.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE});
@ -53,10 +54,13 @@ public class CraftingManager {
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'), 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(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.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.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.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.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(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.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(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.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.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
@ -69,6 +73,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE}); 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.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.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(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL}); this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE}); this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK}); this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
@ -84,6 +89,8 @@ public class CraftingManager {
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, 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(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(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.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
Collections.sort(this.b, new RecipeSorter(this)); Collections.sort(this.b, new RecipeSorter(this));
System.out.println(this.b.size() + " recipes"); System.out.println(this.b.size() + " recipes");
} }
@ -171,8 +178,43 @@ public class CraftingManager {
} }
public ItemStack craft(InventoryCrafting inventorycrafting) { public ItemStack craft(InventoryCrafting inventorycrafting) {
for (int i = 0; i < this.b.size(); ++i) { int i = 0;
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(i); ItemStack itemstack = null;
ItemStack itemstack1 = null;
int j;
for (j = 0; j < inventorycrafting.getSize(); ++j) {
ItemStack itemstack2 = inventorycrafting.getItem(j);
if (itemstack2 != null) {
if (i == 0) {
itemstack = itemstack2;
}
if (i == 1) {
itemstack1 = itemstack2;
}
++i;
}
}
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].g()) {
Item item = Item.byId[itemstack.id];
int k = item.getMaxDurability() - itemstack.g();
int l = item.getMaxDurability() - itemstack1.g();
int i1 = k + l + item.getMaxDurability() * 10 / 100;
int j1 = item.getMaxDurability() - i1;
if (j1 < 0) {
j1 = 0;
}
return new ItemStack(itemstack.id, 1, j1);
} else {
for (j = 0; j < this.b.size(); ++j) {
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(j);
if (craftingrecipe.a(inventorycrafting)) { if (craftingrecipe.a(inventorycrafting)) {
return craftingrecipe.b(inventorycrafting); return craftingrecipe.b(inventorycrafting);
@ -181,6 +223,7 @@ public class CraftingManager {
return null; return null;
} }
}
public List b() { public List b() {
return this.b; return this.b;

Datei anzeigen

@ -22,8 +22,8 @@ public abstract class Entity {
private static int entityCount = 0; private static int entityCount = 0;
public int id; public int id;
public double aX; public double bb;
public boolean aY; public boolean bc;
public Entity passenger; public Entity passenger;
public Entity vehicle; public Entity vehicle;
public World world; public World world;
@ -43,83 +43,82 @@ public abstract class Entity {
public final AxisAlignedBB boundingBox; public final AxisAlignedBB boundingBox;
public boolean onGround; public boolean onGround;
public boolean positionChanged; public boolean positionChanged;
public boolean bs;
public boolean bt;
public boolean velocityChanged;
protected boolean bv;
public boolean bw; public boolean bw;
public boolean bx;
public boolean velocityChanged;
protected boolean bz;
public boolean bA;
public boolean dead; public boolean dead;
public float height; public float height;
public float length; public float length;
public float width; public float width;
public float bB; public float bF;
public float bC; public float bG;
public float fallDistance; // CraftBukkit - private -> public public float fallDistance; // CraftBukkit - private -> public
private int b; private int b;
public double bE; public double bI;
public double bF; public double bJ;
public double bG; public double bK;
public float bH; public float bL;
public float bI; public float bM;
public boolean bJ; public boolean bN;
public float bK; public float bO;
protected Random random; protected Random random;
public int ticksLived; public int ticksLived;
public int maxFireTicks; public int maxFireTicks;
public int fireTicks; public int fireTicks; // CraftBukkit - private -> public
public int maxAirTicks; // CraftBukkit - protected -> public public int maxAirTicks; // CraftBukkit - protected -> public
protected boolean bQ; protected boolean bS;
public int noDamageTicks; public int noDamageTicks;
public int airTicks; public int airTicks;
private boolean justCreated; private boolean justCreated;
protected boolean fireProof; protected boolean fireProof;
protected DataWatcher datawatcher; protected DataWatcher datawatcher;
private double d;
private double e; private double e;
public boolean bV; private double f;
public int bW; public boolean bW;
public int bX; public int bX;
public int bY; public int bY;
public boolean bZ; public int bZ;
public boolean ca; public boolean ca;
public boolean cb;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public Entity(World world) { public Entity(World world) {
this.id = entityCount++; this.id = entityCount++;
this.aX = 1.0D; this.bb = 1.0D;
this.aY = false; this.bc = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false; this.onGround = false;
this.bt = false; this.bx = false;
this.velocityChanged = false; this.velocityChanged = false;
this.bw = true; this.bA = true;
this.dead = false; this.dead = false;
this.height = 0.0F; this.height = 0.0F;
this.length = 0.6F; this.length = 0.6F;
this.width = 1.8F; this.width = 1.8F;
this.bB = 0.0F; this.bF = 0.0F;
this.bC = 0.0F; this.bG = 0.0F;
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
this.b = 1; this.b = 1;
this.bH = 0.0F; this.bL = 0.0F;
this.bI = 0.0F; this.bM = 0.0F;
this.bJ = false; this.bN = false;
this.bK = 0.0F; this.bO = 0.0F;
this.random = new Random(); this.random = new Random();
this.ticksLived = 0; this.ticksLived = 0;
this.maxFireTicks = 1; this.maxFireTicks = 1;
this.fireTicks = 0; this.fireTicks = 0;
this.maxAirTicks = 300; this.bS = false;
this.bQ = false;
this.noDamageTicks = 0; this.noDamageTicks = 0;
this.airTicks = 300;
this.justCreated = true; this.justCreated = true;
this.fireProof = false; this.fireProof = false;
this.datawatcher = new DataWatcher(); this.datawatcher = new DataWatcher();
this.bV = false; this.bW = false;
this.world = world; this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D); this.setPosition(0.0D, 0.0D, 0.0D);
this.datawatcher.a(0, Byte.valueOf((byte) 0)); this.datawatcher.a(0, Byte.valueOf((byte) 0));
this.datawatcher.a(1, Short.valueOf((short) 300));
this.b(); this.b();
} }
@ -185,20 +184,21 @@ public abstract class Entity {
float f = this.length / 2.0F; float f = this.length / 2.0F;
float f1 = this.width; float f1 = this.width;
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bH, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bH + (double) f1, d2 + (double) f); this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bL, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bL + (double) f1, d2 + (double) f);
} }
public void s_() { public void w_() {
this.aa(); this.af();
} }
public void aa() { public void af() {
MethodProfiler.a("entityBaseTick");
if (this.vehicle != null && this.vehicle.dead) { if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} }
++this.ticksLived; ++this.ticksLived;
this.bB = this.bC; this.bF = this.bG;
this.lastX = this.locX; this.lastX = this.locX;
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;
@ -218,8 +218,8 @@ public abstract class Entity {
} }
} }
if (this.f_()) { if (this.i_()) {
if (!this.bQ && !this.justCreated) { if (!this.bS && !this.justCreated) {
float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F; float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F) { if (f > 1.0F) {
@ -246,10 +246,10 @@ public abstract class Entity {
} }
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
this.bQ = true; this.bS = true;
this.fireTicks = 0; this.fireTicks = 0;
} else { } else {
this.bQ = false; this.bS = false;
} }
if (this.world.isStatic) { if (this.world.isStatic) {
@ -280,12 +280,13 @@ public abstract class Entity {
} }
} }
if (this.ap()) { if (this.aA()) {
this.am(); this.av();
this.fallDistance *= 0.5F;
} }
if (this.locY < -64.0D) { if (this.locY < -64.0D) {
this.ah(); this.ao();
} }
if (!this.world.isStatic) { if (!this.world.isStatic) {
@ -294,9 +295,10 @@ public abstract class Entity {
} }
this.justCreated = false; this.justCreated = false;
MethodProfiler.a();
} }
protected void am() { protected void av() {
if (!this.fireProof) { if (!this.fireProof) {
// CraftBukkit start - TODO: this event spams! // CraftBukkit start - TODO: this event spams!
if (this instanceof EntityLiving) { if (this instanceof EntityLiving) {
@ -319,22 +321,33 @@ public abstract class Entity {
server.getPluginManager().callEvent(combustEvent); server.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) { if (!combustEvent.isCancelled()) {
this.fireTicks = 600; this.j(15);
} }
} else { } else {
// reset fire level back to max this.j(15);
this.fireTicks = 600;
} }
return; return;
} }
// CraftBukkit end // CraftBukkit end
this.damageEntity(DamageSource.LAVA, 4); this.damageEntity(DamageSource.LAVA, 4);
this.fireTicks = 600; this.j(15);
} }
} }
protected void ah() { public void j(int i) {
int j = i * 20;
if (this.fireTicks < j) {
this.fireTicks = j;
}
}
public void aw() {
this.fireTicks = 0;
}
protected void ao() {
this.die(); this.die();
} }
@ -346,18 +359,19 @@ public abstract class Entity {
} }
public void move(double d0, double d1, double d2) { public void move(double d0, double d1, double d2) {
if (this.bJ) { if (this.bN) {
this.boundingBox.d(d0, d1, d2); this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bH; this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else { } else {
this.bH *= 0.4F; MethodProfiler.a("move");
this.bL *= 0.4F;
double d3 = this.locX; double d3 = this.locX;
double d4 = this.locZ; double d4 = this.locZ;
if (this.bv) { if (this.bz) {
this.bv = false; this.bz = false;
d0 *= 0.25D; d0 *= 0.25D;
d1 *= 0.05000000074505806D; d1 *= 0.05000000074505806D;
d2 *= 0.25D; d2 *= 0.25D;
@ -403,7 +417,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, d1, 0.0D); this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bw && d6 != d1) { if (!this.bA && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -418,7 +432,7 @@ public abstract class Entity {
} }
this.boundingBox.d(d0, 0.0D, 0.0D); this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bw && d5 != d0) { if (!this.bA && d5 != d0) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -429,7 +443,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, 0.0D, d2); this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bw && d7 != d2) { if (!this.bA && d7 != d2) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -439,13 +453,13 @@ public abstract class Entity {
double d10; double d10;
int k; int k;
if (this.bI > 0.0F && flag1 && (flag || this.bH < 0.05F) && (d5 != d0 || d7 != d2)) { if (this.bM > 0.0F && flag1 && (flag || this.bL < 0.05F) && (d5 != d0 || d7 != d2)) {
d9 = d0; d9 = d0;
d10 = d1; d10 = d1;
double d11 = d2; double d11 = d2;
d0 = d5; d0 = d5;
d1 = (double) this.bI; d1 = (double) this.bM;
d2 = d7; d2 = d7;
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone(); AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
@ -457,7 +471,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, d1, 0.0D); this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bw && d6 != d1) { if (!this.bA && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -468,7 +482,7 @@ public abstract class Entity {
} }
this.boundingBox.d(d0, 0.0D, 0.0D); this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bw && d5 != d0) { if (!this.bA && d5 != d0) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -479,18 +493,18 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, 0.0D, d2); this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bw && d7 != d2) { if (!this.bA && d7 != d2) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
} }
if (!this.bw && d6 != d1) { if (!this.bA && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
} else { } else {
d1 = (double) (-this.bI); d1 = (double) (-this.bM);
for (k = 0; k < list.size(); ++k) { for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1); d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@ -508,18 +522,20 @@ public abstract class Entity {
double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b); double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
if (d12 > 0.0D) { if (d12 > 0.0D) {
this.bH = (float) ((double) this.bH + d12 + 0.01D); this.bL = (float) ((double) this.bL + d12 + 0.01D);
} }
} }
} }
MethodProfiler.a();
MethodProfiler.a("rest");
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.bH; this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.positionChanged = d5 != d0 || d7 != d2; this.positionChanged = d5 != d0 || d7 != d2;
this.bs = d6 != d1; this.bw = d6 != d1;
this.onGround = d6 != d1 && d6 < 0.0D; this.onGround = d6 != d1 && d6 < 0.0D;
this.bt = this.positionChanged || this.bs; this.bx = this.positionChanged || this.bw;
this.a(d1, this.onGround); this.a(d1, this.onGround);
if (d5 != d0) { if (d5 != d0) {
this.motX = 0.0D; this.motX = 0.0D;
@ -559,27 +575,19 @@ public abstract class Entity {
} }
// CraftBukkit end // CraftBukkit end
if (this.e_() && !flag && this.vehicle == null) { if (this.g_() && !flag && this.vehicle == null) {
this.bC = (float) ((double) this.bC + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); this.bG = (float) ((double) this.bG + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
l = MathHelper.floor(this.locX); l = MathHelper.floor(this.locX);
i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
j1 = MathHelper.floor(this.locZ); j1 = MathHelper.floor(this.locZ);
k = this.world.getTypeId(l, i1, j1); k = this.world.getTypeId(l, i1, j1);
if (this.world.getTypeId(l, i1 - 1, j1) == Block.FENCE.id) { if (k == 0 && this.world.getTypeId(l, i1 - 1, j1) == Block.FENCE.id) {
k = this.world.getTypeId(l, i1 - 1, j1); k = this.world.getTypeId(l, i1 - 1, j1);
} }
if (this.bC > (float) this.b && k > 0) { if (this.bG > (float) this.b && k > 0) {
this.b = (int) this.bC + 1; this.b = (int) this.bG + 1;
StepSound stepsound = Block.byId[k].stepSound; this.a(l, i1, j1, k);
if (this.world.getTypeId(l, i1 + 1, j1) == Block.SNOW.id) {
stepsound = Block.SNOW.stepSound;
this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
} else if (!Block.byId[k].material.isLiquid()) {
this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
}
Block.byId[k].b(this.world, l, i1, j1, this); Block.byId[k].b(this.world, l, i1, j1, this);
} }
} }
@ -605,7 +613,7 @@ public abstract class Entity {
} }
} }
boolean flag2 = this.an(); boolean flag2 = this.ay();
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) { if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
this.burn(1); this.burn(1);
@ -617,11 +625,11 @@ public abstract class Entity {
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.fireTicks = 300; this.j(8);
} }
} else { } else {
// CraftBukkit end - reset fire level back to max // CraftBukkit end
this.fireTicks = 300; this.j(8);
} }
} }
} else if (this.fireTicks <= 0) { } else if (this.fireTicks <= 0) {
@ -632,17 +640,30 @@ public abstract class Entity {
this.world.makeSound(this, "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); this.world.makeSound(this, "random.fizz", 0.7F, 1.6F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
this.fireTicks = -this.maxFireTicks; this.fireTicks = -this.maxFireTicks;
} }
MethodProfiler.a();
} }
} }
protected boolean e_() { protected void a(int i, int j, int k, int l) {
StepSound stepsound = Block.byId[l].stepSound;
if (this.world.getTypeId(i, j + 1, k) == Block.SNOW.id) {
stepsound = Block.SNOW.stepSound;
this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
} else if (!Block.byId[l].material.isLiquid()) {
this.world.makeSound(this, stepsound.getName(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2());
}
}
protected boolean g_() {
return true; return true;
} }
protected void a(double d0, boolean flag) { protected void a(double d0, boolean flag) {
if (flag) { if (flag) {
if (this.fallDistance > 0.0F) { if (this.fallDistance > 0.0F) {
this.a(this.fallDistance); this.b(this.fallDistance);
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
} }
} else if (d0 < 0.0D) { } else if (d0 < 0.0D) {
@ -650,7 +671,7 @@ public abstract class Entity {
} }
} }
public AxisAlignedBB f() { public AxisAlignedBB h_() {
return null; return null;
} }
@ -672,33 +693,37 @@ public abstract class Entity {
} }
} }
protected void a(float f) { public final boolean ax() {
return this.fireProof;
}
protected void b(float f) {
if (this.passenger != null) { if (this.passenger != null) {
this.passenger.a(f); this.passenger.b(f);
} }
} }
public boolean an() { public boolean ay() {
return this.bQ || this.world.s(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); return this.bS || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
} }
public boolean ao() { public boolean az() {
return this.bQ; return this.bS;
} }
public boolean f_() { public boolean i_() {
return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D).shrink(0.0010D, 0.0010D, 0.0010D), Material.WATER, this); return this.world.a(this.boundingBox.b(0.0D, -0.4000000059604645D, 0.0D).shrink(0.0010D, 0.0010D, 0.0010D), Material.WATER, this);
} }
public boolean a(Material material) { public boolean a(Material material) {
double d0 = this.locY + (double) this.t(); double d0 = this.locY + (double) this.x();
int i = MathHelper.floor(this.locX); int i = MathHelper.floor(this.locX);
int j = MathHelper.d((float) MathHelper.floor(d0)); int j = MathHelper.d((float) MathHelper.floor(d0));
int k = MathHelper.floor(this.locZ); int k = MathHelper.floor(this.locZ);
int l = this.world.getTypeId(i, j, k); int l = this.world.getTypeId(i, j, k);
if (l != 0 && Block.byId[l].material == material) { if (l != 0 && Block.byId[l].material == material) {
float f = BlockFluids.c(this.world.getData(i, j, k)) - 0.11111111F; float f = BlockFluids.d(this.world.getData(i, j, k)) - 0.11111111F;
float f1 = (float) (j + 1) - f; float f1 = (float) (j + 1) - f;
return d0 < (double) f1; return d0 < (double) f1;
@ -707,11 +732,11 @@ public abstract class Entity {
} }
} }
public float t() { public float x() {
return 0.0F; return 0.0F;
} }
public boolean ap() { public boolean aA() {
return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
} }
@ -734,12 +759,11 @@ public abstract class Entity {
} }
} }
public float a_(float f) { public float a(float f) {
int i = MathHelper.floor(this.locX); int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ); int j = MathHelper.floor(this.locZ);
World world = this.world;
if (world.isLoaded(i, 128 / 2, j)) { if (this.world.isLoaded(i, this.world.height / 2, j)) {
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D; double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
int k = MathHelper.floor(this.locY - (double) this.height + d0); int k = MathHelper.floor(this.locY - (double) this.height + d0);
@ -766,7 +790,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2; this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f; this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1; this.lastPitch = this.pitch = f1;
this.bH = 0.0F; this.bL = 0.0F;
double d3 = (double) (this.lastYaw - f); double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) { if (d3 < -180.0D) {
@ -782,15 +806,15 @@ public abstract class Entity {
} }
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) { public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
this.bE = this.lastX = this.locX = d0; this.bI = this.lastX = this.locX = d0;
this.bF = this.lastY = this.locY = d1 + (double) this.height; this.bJ = this.lastY = this.locY = d1 + (double) this.height;
this.bG = this.lastZ = this.locZ = d2; this.bK = this.lastZ = this.locZ = d2;
this.yaw = f; this.yaw = f;
this.pitch = f1; this.pitch = f1;
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
} }
public float g(Entity entity) { public float h(Entity entity) {
float f = (float) (this.locX - entity.locX); float f = (float) (this.locX - entity.locX);
float f1 = (float) (this.locY - entity.locY); float f1 = (float) (this.locY - entity.locY);
float f2 = (float) (this.locZ - entity.locZ); float f2 = (float) (this.locZ - entity.locZ);
@ -814,7 +838,7 @@ public abstract class Entity {
return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5); return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
} }
public double h(Entity entity) { public double i(Entity entity) {
double d0 = this.locX - entity.locX; double d0 = this.locX - entity.locX;
double d1 = this.locY - entity.locY; double d1 = this.locY - entity.locY;
double d2 = this.locZ - entity.locZ; double d2 = this.locZ - entity.locZ;
@ -844,42 +868,42 @@ public abstract class Entity {
d1 *= d3; d1 *= d3;
d0 *= 0.05000000074505806D; d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D; d1 *= 0.05000000074505806D;
d0 *= (double) (1.0F - this.bK); d0 *= (double) (1.0F - this.bO);
d1 *= (double) (1.0F - this.bK); d1 *= (double) (1.0F - this.bO);
this.b(-d0, 0.0D, -d1); this.b_(-d0, 0.0D, -d1);
entity.b(d0, 0.0D, d1); entity.b_(d0, 0.0D, d1);
} }
} }
} }
public void b(double d0, double d1, double d2) { public void b_(double d0, double d1, double d2) {
this.motX += d0; this.motX += d0;
this.motY += d1; this.motY += d1;
this.motZ += d2; this.motZ += d2;
this.ca = true; this.cb = true;
} }
protected void aq() { protected void aB() {
this.velocityChanged = true; this.velocityChanged = true;
} }
public boolean damageEntity(DamageSource damagesource, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
this.aq(); this.aB();
return false; return false;
} }
public boolean r_() { public boolean e_() {
return false; return false;
} }
public boolean g() { public boolean f_() {
return false; return false;
} }
public void b(Entity entity, int i) {} public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) { public boolean c(NBTTagCompound nbttagcompound) {
String s = this.ar(); String s = this.aC();
if (!this.dead && s != null) { if (!this.dead && s != null) {
nbttagcompound.setString("id", s); nbttagcompound.setString("id", s);
@ -891,7 +915,7 @@ public abstract class Entity {
} }
public void d(NBTTagCompound nbttagcompound) { public void d(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Pos", (NBTBase) this.a(new double[] { this.locX, this.locY + (double) this.bH, this.locZ})); nbttagcompound.a("Pos", (NBTBase) this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ}));
nbttagcompound.a("Motion", (NBTBase) this.a(new double[] { this.motX, this.motY, this.motZ})); nbttagcompound.a("Motion", (NBTBase) this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero // CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
@ -908,7 +932,7 @@ public abstract class Entity {
nbttagcompound.a("Rotation", (NBTBase) this.a(new float[] { this.yaw, this.pitch})); nbttagcompound.a("Rotation", (NBTBase) this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.a("FallDistance", this.fallDistance); nbttagcompound.a("FallDistance", this.fallDistance);
nbttagcompound.a("Fire", (short) this.fireTicks); nbttagcompound.a("Fire", (short) this.fireTicks);
nbttagcompound.a("Air", (short) this.airTicks); nbttagcompound.a("Air", (short) this.getAirTicks());
nbttagcompound.a("OnGround", this.onGround); nbttagcompound.a("OnGround", this.onGround);
// CraftBukkit start // CraftBukkit start
nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits());
@ -920,9 +944,9 @@ public abstract class Entity {
} }
public void e(NBTTagCompound nbttagcompound) { public void e(NBTTagCompound nbttagcompound) {
NBTTagList nbttaglist = nbttagcompound.l("Pos"); NBTTagList nbttaglist = nbttagcompound.m("Pos");
NBTTagList nbttaglist1 = nbttagcompound.l("Motion"); NBTTagList nbttaglist1 = nbttagcompound.m("Motion");
NBTTagList nbttaglist2 = nbttagcompound.l("Rotation"); NBTTagList nbttaglist2 = nbttagcompound.m("Rotation");
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a; this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a; this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
@ -941,15 +965,15 @@ public abstract class Entity {
} }
// CraftBukkit end */ // CraftBukkit end */
this.lastX = this.bE = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
this.lastY = this.bF = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
this.lastZ = this.bG = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a; this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a; this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a;
this.fallDistance = nbttagcompound.g("FallDistance"); this.fallDistance = nbttagcompound.h("FallDistance");
this.fireTicks = nbttagcompound.d("Fire"); this.fireTicks = nbttagcompound.e("Fire");
this.airTicks = nbttagcompound.d("Air"); this.setAirTicks(nbttagcompound.e("Air"));
this.onGround = nbttagcompound.m("OnGround"); this.onGround = nbttagcompound.n("OnGround");
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
// CraftBukkit start // CraftBukkit start
@ -1004,7 +1028,7 @@ public abstract class Entity {
// CraftBukkit end // CraftBukkit end
} }
protected final String ar() { protected final String aC() {
return EntityTypes.b(this); return EntityTypes.b(this);
} }
@ -1020,7 +1044,7 @@ public abstract class Entity {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
double d0 = adouble1[j]; double d0 = adouble1[j];
nbttaglist.a((NBTBase) (new NBTTagDouble(d0))); nbttaglist.a((NBTBase) (new NBTTagDouble((String) null, d0)));
} }
return nbttaglist; return nbttaglist;
@ -1034,7 +1058,7 @@ public abstract class Entity {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
float f = afloat1[j]; float f = afloat1[j];
nbttaglist.a((NBTBase) (new NBTTagFloat(f))); nbttaglist.a((NBTBase) (new NBTTagFloat((String) null, f)));
} }
return nbttaglist; return nbttaglist;
@ -1056,17 +1080,17 @@ public abstract class Entity {
return entityitem; return entityitem;
} }
public boolean ac() { public boolean aj() {
return !this.dead; return !this.dead;
} }
public boolean O() { public boolean T() {
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
float f = ((float) ((i >> 0) % 2) - 0.5F) * this.length * 0.9F; float f = ((float) ((i >> 0) % 2) - 0.5F) * this.length * 0.8F;
float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F; float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F;
float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.length * 0.9F; float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.length * 0.8F;
int j = MathHelper.floor(this.locX + (double) f); int j = MathHelper.floor(this.locX + (double) f);
int k = MathHelper.floor(this.locY + (double) this.t() + (double) f1); int k = MathHelper.floor(this.locY + (double) this.x() + (double) f1);
int l = MathHelper.floor(this.locZ + (double) f2); int l = MathHelper.floor(this.locZ + (double) f2);
if (this.world.e(j, k, l)) { if (this.world.e(j, k, l)) {
@ -1081,40 +1105,40 @@ public abstract class Entity {
return false; return false;
} }
public AxisAlignedBB b(Entity entity) { public AxisAlignedBB a_(Entity entity) {
return null; return null;
} }
public void I() { public void M() {
if (this.vehicle.dead) { if (this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} else { } else {
this.motX = 0.0D; this.motX = 0.0D;
this.motY = 0.0D; this.motY = 0.0D;
this.motZ = 0.0D; this.motZ = 0.0D;
this.s_(); this.w_();
if (this.vehicle != null) { if (this.vehicle != null) {
this.vehicle.g_(); this.vehicle.i();
this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw); this.f += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) { for (this.e += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.f >= 180.0D; this.f -= 360.0D) {
; ;
} }
while (this.f < -180.0D) {
this.f += 360.0D;
}
while (this.e >= 180.0D) {
this.e -= 360.0D;
}
while (this.e < -180.0D) { while (this.e < -180.0D) {
this.e += 360.0D; this.e += 360.0D;
} }
while (this.d >= 180.0D) { double d0 = this.f * 0.5D;
this.d -= 360.0D; double d1 = this.e * 0.5D;
}
while (this.d < -180.0D) {
this.d += 360.0D;
}
double d0 = this.e * 0.5D;
double d1 = this.d * 0.5D;
float f = 10.0F; float f = 10.0F;
if (d0 > (double) f) { if (d0 > (double) f) {
@ -1133,23 +1157,23 @@ public abstract class Entity {
d1 = (double) (-f); d1 = (double) (-f);
} }
this.e -= d0; this.f -= d0;
this.d -= d1; this.e -= d1;
this.yaw = (float) ((double) this.yaw + d0); this.yaw = (float) ((double) this.yaw + d0);
this.pitch = (float) ((double) this.pitch + d1); this.pitch = (float) ((double) this.pitch + d1);
} }
} }
} }
public void g_() { public void i() {
this.passenger.setPosition(this.locX, this.locY + this.n() + this.passenger.M(), this.locZ); this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.R(), this.locZ);
} }
public double M() { public double R() {
return (double) this.height; return (double) this.height;
} }
public double n() { public double q() {
return (double) this.width * 0.75D; return (double) this.width * 0.75D;
} }
@ -1172,8 +1196,8 @@ public abstract class Entity {
// so this method is needed // so this method is needed
// CraftBukkit end // CraftBukkit end
this.d = 0.0D;
this.e = 0.0D; this.e = 0.0D;
this.f = 0.0D;
if (entity == null) { if (entity == null) {
if (this.vehicle != null) { if (this.vehicle != null) {
// CraftBukkit start // CraftBukkit start
@ -1213,18 +1237,26 @@ public abstract class Entity {
} }
} }
public Vec3D ai() { public float j_() {
return 0.1F;
}
public Vec3D ap() {
return null; return null;
} }
public void T() {} public void Y() {}
public ItemStack[] getEquipment() { public ItemStack[] getEquipment() {
return null; return null;
} }
public boolean z() {
return this.fireTicks > 0 || this.k(0);
}
public boolean isSneaking() { public boolean isSneaking() {
return this.e(1); return this.k(1);
} }
public void setSneak(boolean flag) { public void setSneak(boolean flag) {
@ -1232,18 +1264,18 @@ public abstract class Entity {
} }
public boolean isSprinting() { public boolean isSprinting() {
return this.e(3); return this.k(3);
} }
public void setSprinting(boolean flag) { public void setSprinting(boolean flag) {
this.a(3, flag); this.a(3, flag);
} }
public void h(boolean flag) { public void g(boolean flag) {
this.a(4, flag); this.a(4, flag);
} }
protected boolean e(int i) { protected boolean k(int i) {
return (this.datawatcher.getByte(0) & 1 << i) != 0; return (this.datawatcher.getByte(0) & 1 << i) != 0;
} }
@ -1257,6 +1289,14 @@ public abstract class Entity {
} }
} }
public int getAirTicks() {
return this.datawatcher.b(1);
}
public void setAirTicks(int i) {
this.datawatcher.watch(1, Short.valueOf((short) i));
}
public void a(EntityWeatherStorm entityweatherstorm) { public void a(EntityWeatherStorm entityweatherstorm) {
// CraftBukkit start // CraftBukkit start
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.LIGHTNING, 5); EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.LIGHTNING, 5);
@ -1271,7 +1311,7 @@ public abstract class Entity {
++this.fireTicks; ++this.fireTicks;
if (this.fireTicks == 0) { if (this.fireTicks == 0) {
this.fireTicks = 300; this.j(8);
} }
} }
@ -1350,16 +1390,18 @@ public abstract class Entity {
if (b0 == 5) { if (b0 == 5) {
this.motZ = (double) f; this.motZ = (double) f;
} }
}
return true;
} else {
return false; return false;
} }
public void q() {
this.bv = true;
} }
public String Y() { public void s() {
this.bz = true;
}
public String ad() {
String s = EntityTypes.b(this); String s = EntityTypes.b(this);
if (s == null) { if (s == null) {
@ -1368,4 +1410,12 @@ public abstract class Entity {
return StatisticCollector.a("entity." + s + ".name"); return StatisticCollector.a("entity." + s + ".name");
} }
public Entity[] aG() {
return null;
}
public boolean a(Entity entity) {
return this == entity;
}
} }

Datei anzeigen

@ -43,7 +43,7 @@ public class EntityArrow extends Entity {
this.shooter = entityliving; this.shooter = entityliving;
this.fromPlayer = entityliving instanceof EntityHuman; this.fromPlayer = entityliving instanceof EntityHuman;
this.b(0.5F, 0.5F); this.b(0.5F, 0.5F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.t(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.x(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D; this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -79,8 +79,8 @@ public class EntityArrow extends Entity {
this.k = 0; this.k = 0;
} }
public void s_() { public void w_() {
super.s_(); super.w_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) { if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
@ -142,7 +142,7 @@ public class EntityArrow extends Entity {
for (k = 0; k < list.size(); ++k) { for (k = 0; k < list.size(); ++k) {
Entity entity1 = (Entity) list.get(k); Entity entity1 = (Entity) list.get(k);
if (entity1.r_() && (entity1 != this.shooter || this.l >= 5)) { if (entity1.e_() && (entity1 != this.shooter || this.l >= 5)) {
f1 = 0.3F; f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.b((double) f1, (double) f1, (double) f1); AxisAlignedBB axisalignedbb1 = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
@ -174,7 +174,15 @@ public class EntityArrow extends Entity {
int l = (int) Math.ceil((double) f2 * 2.0D); int l = (int) Math.ceil((double) f2 * 2.0D);
if (this.d) { if (this.d) {
l = l * 3 / 2 + 1; l += this.random.nextInt(l / 2 + 2);
}
DamageSource damagesource = null;
if (this.shooter == null) {
damagesource = DamageSource.arrow(this, this);
} else {
damagesource = DamageSource.arrow(this, this.shooter);
} }
// CraftBukkit start // CraftBukkit start
@ -196,18 +204,18 @@ public class EntityArrow extends Entity {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the arrow should stick in or not, i.e. !bounce // this function returns if the arrow should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(DamageSource.arrow(this, this.shooter), event.getDamage()); stick = movingobjectposition.entity.damageEntity(damagesource, event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(DamageSource.arrow(this, this.shooter), l); stick = movingobjectposition.entity.damageEntity(damagesource, l);
} }
if (stick) { if (stick) {
// CraftBukkit end // CraftBukkit end
if (movingobjectposition.entity instanceof EntityLiving) { if (movingobjectposition.entity instanceof EntityLiving) {
++((EntityLiving) movingobjectposition.entity).aD; ++((EntityLiving) movingobjectposition.entity).aH;
} }
this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); this.world.makeSound(this, "random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.die(); this.die();
} else { } else {
this.motX *= -0.10000000149011612D; this.motX *= -0.10000000149011612D;
@ -230,7 +238,7 @@ public class EntityArrow extends Entity {
this.locX -= this.motX / (double) f2 * 0.05000000074505806D; this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
this.locY -= this.motY / (double) f2 * 0.05000000074505806D; this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D; this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D;
this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); this.world.makeSound(this, "random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.inGround = true; this.inGround = true;
this.shake = 7; this.shake = 7;
this.d = false; this.d = false;
@ -270,7 +278,7 @@ public class EntityArrow extends Entity {
float f3 = 0.99F; float f3 = 0.99F;
f1 = 0.05F; f1 = 0.05F;
if (this.ao()) { if (this.az()) {
for (int i1 = 0; i1 < 4; ++i1) { for (int i1 = 0; i1 < 4; ++i1) {
float f4 = 0.25F; float f4 = 0.25F;
@ -300,14 +308,14 @@ public class EntityArrow extends Entity {
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.d("xTile"); this.e = nbttagcompound.e("xTile");
this.f = nbttagcompound.d("yTile"); this.f = nbttagcompound.e("yTile");
this.g = nbttagcompound.d("zTile"); this.g = nbttagcompound.e("zTile");
this.h = nbttagcompound.c("inTile") & 255; this.h = nbttagcompound.d("inTile") & 255;
this.i = nbttagcompound.c("inData") & 255; this.i = nbttagcompound.d("inData") & 255;
this.shake = nbttagcompound.c("shake") & 255; this.shake = nbttagcompound.d("shake") & 255;
this.inGround = nbttagcompound.c("inGround") == 1; this.inGround = nbttagcompound.d("inGround") == 1;
this.fromPlayer = nbttagcompound.m("player"); this.fromPlayer = nbttagcompound.n("player");
} }
public void a_(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {

Datei anzeigen

@ -16,15 +16,12 @@ import org.bukkit.event.vehicle.VehicleUpdateEvent;
public class EntityBoat extends Entity { public class EntityBoat extends Entity {
public int damage; private int a;
public int b; private double b;
public int c; private double c;
private int d; private double d;
private double e; private double e;
private double f; private double f;
private double g;
private double h;
private double i;
// CraftBukkit start // CraftBukkit start
public double maxSpeed = 0.4D; public double maxSpeed = 0.4D;
@ -49,29 +46,30 @@ public class EntityBoat extends Entity {
public EntityBoat(World world) { public EntityBoat(World world) {
super(world); super(world);
this.damage = 0; this.bc = true;
this.b = 0;
this.c = 1;
this.aY = true;
this.b(1.5F, 0.6F); this.b(1.5F, 0.6F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
} }
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
protected void b() {} protected void b() {
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(1));
this.datawatcher.a(19, new Integer(0));
}
public AxisAlignedBB b(Entity entity) { public AxisAlignedBB a_(Entity entity) {
return entity.boundingBox; return entity.boundingBox;
} }
public AxisAlignedBB f() { public AxisAlignedBB h_() {
return this.boundingBox; return this.boundingBox;
} }
public boolean g() { public boolean f_() {
return true; return true;
} }
@ -88,7 +86,7 @@ public class EntityBoat extends Entity {
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
} }
public double n() { public double q() {
return (double) this.width * 0.0D - 0.30000001192092896D; return (double) this.width * 0.0D - 0.30000001192092896D;
} }
@ -107,18 +105,17 @@ public class EntityBoat extends Entity {
// i = event.getDamage(); // TODO Why don't we do this? // i = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end // CraftBukkit end
this.c = -this.c; this.d(-this.l());
this.b = 10; this.c(10);
this.damage += i * 10; this.setDamage(this.getDamage() + i * 10);
this.aq(); this.aB();
if (this.damage > 40) { if (this.getDamage() > 40) {
// CraftBukkit start // CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker); VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.world.getServer().getPluginManager().callEvent(destroyEvent); this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) { if (destroyEvent.isCancelled()) {
this.damage = 40; // Maximize damage so this doesn't get triggered again right away this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
return true; return true;
} }
// CraftBukkit end // CraftBukkit end
@ -146,11 +143,11 @@ public class EntityBoat extends Entity {
} }
} }
public boolean r_() { public boolean e_() {
return !this.dead; return !this.dead;
} }
public void s_() { public void w_() {
// CraftBukkit start // CraftBukkit start
double prevX = this.locX; double prevX = this.locX;
double prevY = this.locY; double prevY = this.locY;
@ -159,13 +156,13 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch; float prevPitch = this.pitch;
// CraftBukkit end // CraftBukkit end
super.s_(); super.w_();
if (this.b > 0) { if (this.k() > 0) {
--this.b; this.c(this.k() - 1);
} }
if (this.damage > 0) { if (this.getDamage() > 0) {
--this.damage; this.setDamage(this.getDamage() - 1);
} }
this.lastX = this.locX; this.lastX = this.locX;
@ -184,35 +181,59 @@ public class EntityBoat extends Entity {
} }
} }
double d3; double d3 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
double d4; double d4;
double d5; double d5;
double d6;
if (d3 > 0.15D) {
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) {
double d6 = (double) (this.random.nextFloat() * 2.0F - 1.0F);
double d7 = (double) (this.random.nextInt(2) * 2 - 1) * 0.7D;
double d8;
double d9;
if (this.random.nextBoolean()) {
d8 = this.locX - d4 * d6 * 0.8D + d5 * d7;
d9 = this.locZ - d5 * d6 * 0.8D - d4 * d7;
this.world.a("splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
} else {
d8 = this.locX + d4 + d5 * d6 * 0.7D;
d9 = this.locZ + d5 - d4 * d6 * 0.7D;
this.world.a("splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
}
}
}
double d10;
double d11;
if (this.world.isStatic) { if (this.world.isStatic) {
if (this.d > 0) { if (this.a > 0) {
d3 = this.locX + (this.e - this.locX) / (double) this.d; d4 = this.locX + (this.b - this.locX) / (double) this.a;
d4 = this.locY + (this.f - this.locY) / (double) this.d; d5 = this.locY + (this.c - this.locY) / (double) this.a;
d5 = this.locZ + (this.g - this.locZ) / (double) this.d; d10 = this.locZ + (this.d - this.locZ) / (double) this.a;
for (d6 = this.h - (double) this.yaw; d6 < -180.0D; d6 += 360.0D) { for (d11 = this.e - (double) this.yaw; d11 < -180.0D; d11 += 360.0D) {
; ;
} }
while (d6 >= 180.0D) { while (d11 >= 180.0D) {
d6 -= 360.0D; d11 -= 360.0D;
} }
this.yaw = (float) ((double) this.yaw + d6 / (double) this.d); this.yaw = (float) ((double) this.yaw + d11 / (double) this.a);
this.pitch = (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d); this.pitch = (float) ((double) this.pitch + (this.f - (double) this.pitch) / (double) this.a);
--this.d; --this.a;
this.setPosition(d3, d4, d5); this.setPosition(d4, d5, d10);
this.c(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} else { } else {
d3 = this.locX + this.motX; d4 = this.locX + this.motX;
d4 = this.locY + this.motY; d5 = this.locY + this.motY;
d5 = this.locZ + this.motZ; d10 = this.locZ + this.motZ;
this.setPosition(d3, d4, d5); this.setPosition(d4, d5, d10);
if (this.onGround) { if (this.onGround) {
this.motX *= 0.5D; this.motX *= 0.5D;
this.motY *= 0.5D; this.motY *= 0.5D;
@ -225,8 +246,8 @@ public class EntityBoat extends Entity {
} }
} else { } else {
if (d0 < 1.0D) { if (d0 < 1.0D) {
d3 = d0 * 2.0D - 1.0D; d4 = d0 * 2.0D - 1.0D;
this.motY += 0.03999999910593033D * d3; this.motY += 0.03999999910593033D * d4;
} else { } else {
if (this.motY < 0.0D) { if (this.motY < 0.0D) {
this.motY /= 2.0D; this.motY /= 2.0D;
@ -254,21 +275,21 @@ public class EntityBoat extends Entity {
// CraftBukkit end // CraftBukkit end
// CraftBukkit // CraftBukkit
d3 = this.maxSpeed; d4 = this.maxSpeed;
if (this.motX < -d3) { if (this.motX < -d4) {
this.motX = -d3; this.motX = -d4;
} }
if (this.motX > d3) { if (this.motX > d4) {
this.motX = d3; this.motX = d4;
} }
if (this.motZ < -d3) { if (this.motZ < -d4) {
this.motZ = -d3; this.motZ = -d4;
} }
if (this.motZ > d3) { if (this.motZ > d4) {
this.motZ = d3; this.motZ = d4;
} }
if (this.onGround && !landBoats) { // CraftBukkit if (this.onGround && !landBoats) { // CraftBukkit
@ -278,30 +299,7 @@ public class EntityBoat extends Entity {
} }
this.move(this.motX, this.motY, this.motZ); this.move(this.motX, this.motY, this.motZ);
d4 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); if (this.positionChanged && d3 > 0.2D) {
if (d4 > 0.15D) {
d5 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D);
d6 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D);
for (int j = 0; (double) j < 1.0D + d4 * 60.0D; ++j) {
double d7 = (double) (this.random.nextFloat() * 2.0F - 1.0F);
double d8 = (double) (this.random.nextInt(2) * 2 - 1) * 0.7D;
double d9;
double d10;
if (this.random.nextBoolean()) {
d9 = this.locX - d5 * d7 * 0.8D + d6 * d8;
d10 = this.locZ - d6 * d7 * 0.8D - d5 * d8;
this.world.a("splash", d9, this.locY - 0.125D, d10, this.motX, this.motY, this.motZ);
} else {
d9 = this.locX + d5 + d6 * d7 * 0.7D;
d10 = this.locZ + d6 - d5 * d7 * 0.7D;
this.world.a("splash", d9, this.locY - 0.125D, d10, this.motX, this.motY, this.motZ);
}
}
}
if (this.positionChanged && d4 > 0.15D) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
// CraftBukkit start // CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity(); Vehicle vehicle = (Vehicle) this.getBukkitEntity();
@ -331,11 +329,10 @@ public class EntityBoat extends Entity {
this.pitch = 0.0F; this.pitch = 0.0F;
d5 = (double) this.yaw; d5 = (double) this.yaw;
d6 = this.lastX - this.locX; d10 = this.lastX - this.locX;
double d11 = this.lastZ - this.locZ; d11 = this.lastZ - this.locZ;
if (d10 * d10 + d11 * d11 > 0.0010D) {
if (d6 * d6 + d11 * d11 > 0.0010D) { d5 = (double) ((float) (Math.atan2(d11, d10) * 180.0D / 3.141592653589793D));
d5 = (double) ((float) (Math.atan2(d11, d6) * 180.0D / 3.141592653589793D));
} }
double d12; double d12;
@ -382,7 +379,7 @@ public class EntityBoat extends Entity {
for (l = 0; l < list.size(); ++l) { for (l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l); Entity entity = (Entity) list.get(l);
if (entity != this.passenger && entity.g() && entity instanceof EntityBoat) { if (entity != this.passenger && entity.f_() && entity instanceof EntityBoat) {
entity.collide(this); entity.collide(this);
} }
} }
@ -405,12 +402,12 @@ public class EntityBoat extends Entity {
} }
} }
public void g_() { public void i() {
if (this.passenger != null) { if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; 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; double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
this.passenger.setPosition(this.locX + d0, this.locY + this.n() + this.passenger.M(), this.locZ + d1); this.passenger.setPosition(this.locX + d0, this.locY + this.q() + this.passenger.R(), this.locZ + d1);
} }
} }
@ -438,4 +435,28 @@ public class EntityBoat extends Entity {
return true; return true;
} }
} }
public void setDamage(int i) {
this.datawatcher.watch(19, Integer.valueOf(i));
}
public int getDamage() {
return this.datawatcher.getInt(19);
}
public void c(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
public int k() {
return this.datawatcher.getInt(17);
}
public void d(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
public int l() {
return this.datawatcher.getInt(18);
}
} }

Datei anzeigen

@ -19,12 +19,15 @@ public class EntityChicken extends EntityAnimal {
super(world); super(world);
this.texture = "/mob/chicken.png"; this.texture = "/mob/chicken.png";
this.b(0.3F, 0.7F); this.b(0.3F, 0.7F);
this.health = 4;
this.j = this.random.nextInt(6000) + 6000; this.j = this.random.nextInt(6000) + 6000;
} }
public void s() { public int getMaxHealth() {
super.s(); return 4;
}
public void d() {
super.d();
this.h = this.b; this.h = this.b;
this.g = this.c; this.g = this.c;
this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D); this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D);
@ -46,14 +49,14 @@ public class EntityChicken extends EntityAnimal {
} }
this.b += this.i * 2.0F; this.b += this.i * 2.0F;
if (!this.world.isStatic && --this.j <= 0) { if (!this.l() && !this.world.isStatic && --this.j <= 0) {
this.world.makeSound(this, "mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.makeSound(this, "mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.b(Item.EGG.id, 1); this.b(Item.EGG.id, 1);
this.j = this.random.nextInt(6000) + 6000; this.j = this.random.nextInt(6000) + 6000;
} }
} }
protected void a(float f) {} protected void b(float f) {}
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
@ -63,33 +66,42 @@ public class EntityChicken extends EntityAnimal {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected String h() { protected String c_() {
return "mob.chicken"; return "mob.chicken";
} }
protected String i() { protected String m() {
return "mob.chickenhurt"; return "mob.chickenhurt";
} }
protected String j() { protected String n() {
return "mob.chickenhurt"; return "mob.chickenhurt";
} }
protected int k() { protected int e() {
return Item.FEATHER.id; return Item.FEATHER.id;
} }
protected void a(boolean flag) { protected void a(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(3); int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
if (count > 0) { if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, count)); loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, j));
loot.add(new org.bukkit.inventory.ItemStack(this.fireTicks > 0 ? Item.COOKED_CHICKEN.id : Item.RAW_CHICKEN.id, 1)); }
if (this.z()) {
this.b(Item.COOKED_CHICKEN.id, 1);
} else {
this.b(Item.RAW_CHICKEN.id, 1);
} }
CraftEventFactory.callEntityDeathEvent(this, loot); CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end // CraftBukkit end
} }
protected EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityChicken(this.world);
}
} }

Datei anzeigen

@ -4,10 +4,8 @@ package net.minecraft.server;
import java.util.List; import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.player.PlayerBucketFillEvent; import org.bukkit.event.player.PlayerBucketFillEvent;
// CraftBukkit end // CraftBukkit end
@ -19,6 +17,10 @@ public class EntityCow extends EntityAnimal {
this.b(0.9F, 1.3F); this.b(0.9F, 1.3F);
} }
public int getMaxHealth() {
return 10;
}
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
} }
@ -27,39 +29,39 @@ public class EntityCow extends EntityAnimal {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected String h() { protected String c_() {
return "mob.cow"; return "mob.cow";
} }
protected String i() { protected String m() {
return "mob.cowhurt"; return "mob.cowhurt";
} }
protected String j() { protected String n() {
return "mob.cowhurt"; return "mob.cowhurt";
} }
protected float l() { protected float o() {
return 0.4F; return 0.4F;
} }
protected int k() { protected int e() {
return Item.LEATHER.id; return Item.LEATHER.id;
} }
protected void a(boolean flag) { protected void a(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(3); int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
if (count > 0) { if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, count)); loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, j));
} }
count = this.random.nextInt(3) + 1; j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (count > 0) { if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(this.fireTicks > 0 ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, count)); loot.add(new org.bukkit.inventory.ItemStack(this.z() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
} }
CraftEventFactory.callEntityDeathEvent(this, loot); CraftEventFactory.callEntityDeathEvent(this, loot);
@ -87,7 +89,11 @@ public class EntityCow extends EntityAnimal {
return true; return true;
} else { } else {
return false; return super.b(entityhuman);
} }
} }
protected EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityCow(this.world);
}
} }

Datei anzeigen

@ -17,16 +17,17 @@ public abstract class EntityCreature extends EntityLiving {
super(world); super(world);
} }
protected boolean v() { protected boolean w() {
return false; return false;
} }
protected void c_() { protected void m_() {
MethodProfiler.a("ai");
if (this.f > 0) { if (this.f > 0) {
--this.f; --this.f;
} }
this.e = this.v(); this.e = this.w();
float f = 16.0F; float f = 16.0F;
if (this.target == null) { if (this.target == null) {
@ -49,7 +50,7 @@ public abstract class EntityCreature extends EntityLiving {
if (this.target != null) { if (this.target != null) {
this.pathEntity = this.world.findPath(this, this.target, f); this.pathEntity = this.world.findPath(this, this.target, f);
} }
} else if (!this.target.ac()) { } else if (!this.target.aj()) {
// CraftBukkit start // CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -63,27 +64,29 @@ public abstract class EntityCreature extends EntityLiving {
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
float f1 = this.target.g(this); float f1 = this.target.h(this);
if (this.f(this.target)) { if (this.g(this.target)) {
this.a(this.target, f1); this.a(this.target, f1);
} else { } else {
this.b(this.target, f1); this.b(this.target, f1);
} }
} }
MethodProfiler.a();
if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) { if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f); this.pathEntity = this.world.findPath(this, this.target, f);
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(80) == 0 || this.f > 0 || this.random.nextInt(80) == 0)) { } else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aS < 100) {
this.A(); this.C();
} }
int i = MathHelper.floor(this.boundingBox.b + 0.5D); int i = MathHelper.floor(this.boundingBox.b + 0.5D);
boolean flag = this.ao(); boolean flag = this.az();
boolean flag1 = this.ap(); boolean flag1 = this.aA();
this.pitch = 0.0F; this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) { if (this.pathEntity != null && this.random.nextInt(100) != 0) {
MethodProfiler.a("followpath");
Vec3D vec3d = this.pathEntity.a(this); Vec3D vec3d = this.pathEntity.a(this);
double d0 = (double) (this.length * 2.0F); double d0 = (double) (this.length * 2.0F);
@ -97,7 +100,7 @@ public abstract class EntityCreature extends EntityLiving {
} }
} }
this.aS = false; this.aW = false;
if (vec3d != null) { if (vec3d != null) {
double d1 = vec3d.a - this.locX; double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ; double d2 = vec3d.c - this.locZ;
@ -106,7 +109,7 @@ public abstract class EntityCreature extends EntityLiving {
float f2 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; float f2 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = f2 - this.yaw; float f3 = f2 - this.yaw;
for (this.aQ = this.aU; f3 < -180.0F; f3 += 360.0F) { for (this.aU = this.aY; f3 < -180.0F; f3 += 360.0F) {
; ;
} }
@ -130,12 +133,12 @@ public abstract class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F; this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F; f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
this.aP = -MathHelper.sin(f3) * this.aQ * 1.0F; this.aT = -MathHelper.sin(f3) * this.aU * 1.0F;
this.aQ = MathHelper.cos(f3) * this.aQ * 1.0F; this.aU = MathHelper.cos(f3) * this.aU * 1.0F;
} }
if (d3 > 0.0D) { if (d3 > 0.0D) {
this.aS = true; this.aW = true;
} }
} }
@ -143,20 +146,23 @@ public abstract class EntityCreature extends EntityLiving {
this.a(this.target, 30.0F, 30.0F); this.a(this.target, 30.0F, 30.0F);
} }
if (this.positionChanged && !this.B()) { if (this.positionChanged && !this.D()) {
this.aS = true; this.aW = true;
} }
if (this.random.nextFloat() < 0.8F && (flag || flag1)) { if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
this.aS = true; this.aW = true;
} }
MethodProfiler.a();
} else { } else {
super.c_(); super.m_();
this.pathEntity = null; this.pathEntity = null;
} }
} }
protected void A() { protected void C() {
MethodProfiler.a("stroll");
boolean flag = false; boolean flag = false;
int i = -1; int i = -1;
int j = -1; int j = -1;
@ -181,6 +187,8 @@ public abstract class EntityCreature extends EntityLiving {
if (flag) { if (flag) {
this.pathEntity = this.world.a(this, i, j, k, 10.0F); this.pathEntity = this.world.a(this, i, j, k, 10.0F);
} }
MethodProfiler.a();
} }
protected void a(Entity entity, float f) {} protected void a(Entity entity, float f) {}
@ -195,15 +203,15 @@ public abstract class EntityCreature extends EntityLiving {
return null; return null;
} }
public boolean d() { public boolean g() {
int i = MathHelper.floor(this.locX); int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b); int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ); int k = MathHelper.floor(this.locZ);
return super.d() && this.a(i, j, k) >= 0.0F; return super.g() && this.a(i, j, k) >= 0.0F;
} }
public boolean B() { public boolean D() {
return this.pathEntity != null; return this.pathEntity != null;
} }
@ -211,7 +219,7 @@ public abstract class EntityCreature extends EntityLiving {
this.pathEntity = pathentity; this.pathEntity = pathentity;
} }
public Entity C() { public Entity E() {
return this.target; return this.target;
} }
@ -219,8 +227,8 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity; this.target = entity;
} }
protected float D() { protected float F() {
float f = super.D(); float f = super.F();
if (this.f > 0) { if (this.f > 0) {
f *= 2.0F; f *= 2.0F;

Datei anzeigen

@ -16,6 +16,10 @@ public class EntityCreeper extends EntityMonster {
this.texture = "/mob/creeper.png"; this.texture = "/mob/creeper.png";
} }
public int getMaxHealth() {
return 20;
}
protected void b() { protected void b() {
super.b(); super.b();
this.datawatcher.a(16, Byte.valueOf((byte) -1)); this.datawatcher.a(16, Byte.valueOf((byte) -1));
@ -31,7 +35,7 @@ public class EntityCreeper extends EntityMonster {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.m("powered") ? 1 : 0))); this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.n("powered") ? 1 : 0)));
} }
protected void b(Entity entity, float f) { protected void b(Entity entity, float f) {
@ -46,10 +50,10 @@ public class EntityCreeper extends EntityMonster {
} }
} }
public void s_() { public void w_() {
this.b = this.fuseTicks; this.b = this.fuseTicks;
if (this.world.isStatic) { if (this.world.isStatic) {
int i = this.w(); int i = this.A();
if (i > 0 && this.fuseTicks == 0) { if (i > 0 && this.fuseTicks == 0) {
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F); this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
@ -65,7 +69,7 @@ public class EntityCreeper extends EntityMonster {
} }
} }
super.s_(); super.w_();
if (this.target == null && this.fuseTicks > 0) { if (this.target == null && this.fuseTicks > 0) {
this.b(-1); this.b(-1);
--this.fuseTicks; --this.fuseTicks;
@ -75,24 +79,24 @@ public class EntityCreeper extends EntityMonster {
} }
} }
protected String i() { protected String m() {
return "mob.creeper"; return "mob.creeper";
} }
protected String j() { protected String n() {
return "mob.creeperdeath"; return "mob.creeperdeath";
} }
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
super.die(damagesource); super.die(damagesource);
if (damagesource.getEntity() instanceof EntitySkeleton) { if (damagesource.getEntity() instanceof EntitySkeleton) {
this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1); this.b(Item.RECORD_1.id + this.random.nextInt(2), 1);
} }
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
int i = this.w(); int i = this.A();
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) { if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
this.b(-1); this.b(-1);
@ -132,11 +136,11 @@ public class EntityCreeper extends EntityMonster {
return this.datawatcher.getByte(17) == 1; return this.datawatcher.getByte(17) == 1;
} }
protected int k() { protected int e() {
return Item.SULPHUR.id; return Item.SULPHUR.id;
} }
private int w() { private int A() {
return this.datawatcher.getByte(16); return this.datawatcher.getByte(16);
} }

Datei anzeigen

@ -15,7 +15,7 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
public String a(EntityHuman entityhuman) { public String a(EntityHuman entityhuman) {
// CraftBukkit start // CraftBukkit start
String source = (this.n == null) ? "Herobrine" : this.n.Y(); String source = (this.n == null) ? "Herobrine" : this.n.ad();
return StatisticCollector.a("death." + this.m, new Object[] { entityhuman.name, source}); return StatisticCollector.a("death." + this.m, new Object[] { entityhuman.name, source});
// CraftBukkit end // CraftBukkit end
} }

Datei anzeigen

@ -1,8 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List; import org.bukkit.Location;
// CraftBukkit start
import org.bukkit.entity.CreatureType; import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@ -10,146 +8,22 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerEggThrowEvent; import org.bukkit.event.player.PlayerEggThrowEvent;
// CraftBukkit end
public class EntityEgg extends Entity { public class EntityEgg extends EntityProjectile {
private int b = -1;
private int c = -1;
private int d = -1;
private int e = 0;
private boolean f = false;
public int a = 0;
public EntityLiving thrower; // CraftBukkit - private -> public
private int h;
private int i = 0;
public EntityEgg(World world) { public EntityEgg(World world) {
super(world); super(world);
this.b(0.25F, 0.25F);
} }
protected void b() {}
public EntityEgg(World world, EntityLiving entityliving) { public EntityEgg(World world, EntityLiving entityliving) {
super(world); super(world, entityliving);
this.thrower = entityliving;
this.b(0.25F, 0.25F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.t(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.setPosition(this.locX, this.locY, this.locZ);
this.height = 0.0F;
float f = 0.4F;
this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f);
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
} }
public EntityEgg(World world, double d0, double d1, double d2) { public EntityEgg(World world, double d0, double d1, double d2) {
super(world); super(world, d0, d1, d2);
this.h = 0;
this.b(0.25F, 0.25F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
} }
public void a(double d0, double d1, double d2, float f, float f1) { protected void a(MovingObjectPosition movingobjectposition) {
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= (double) f2;
d1 /= (double) f2;
d2 /= (double) f2;
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d0 *= (double) f;
d1 *= (double) f;
d2 *= (double) f;
this.motX = d0;
this.motY = d1;
this.motZ = d2;
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.h = 0;
}
public void s_() {
this.bE = this.locX;
this.bF = this.locY;
this.bG = this.locZ;
super.s_();
if (this.a > 0) {
--this.a;
}
if (this.f) {
int i = this.world.getTypeId(this.b, this.c, this.d);
if (i == this.e) {
++this.h;
if (this.h == 1200) {
this.die();
}
return;
}
this.f = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.h = 0;
this.i = 0;
} else {
++this.i;
}
Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
if (!this.world.isStatic) {
Entity entity = null;
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.r_() && (entity1 != this.thrower || this.i >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) {
double d1 = vec3d.b(movingobjectposition1.f);
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null) {
movingobjectposition = new MovingObjectPosition(entity);
}
}
if (movingobjectposition != null) {
// CraftBukkit start // CraftBukkit start
ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity()); ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(phe); this.world.getServer().getPluginManager().callEvent(phe);
@ -168,10 +42,10 @@ public class EntityEgg extends Entity {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the egg should stick in or not, i.e. !bounce // this function returns if the egg should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.thrower), event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.thrower), 0); stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
} }
if (stick) { if (stick) {
@ -187,8 +61,8 @@ public class EntityEgg extends Entity {
CreatureType hatchingType = CreatureType.CHICKEN; CreatureType hatchingType = CreatureType.CHICKEN;
if (this.thrower instanceof EntityPlayer) { if (this.shooter instanceof EntityPlayer) {
org.bukkit.entity.Player player = (this.thrower == null) ? null : (org.bukkit.entity.Player) this.thrower.getBukkitEntity(); org.bukkit.entity.Player player = (this.shooter == null) ? null : (org.bukkit.entity.Player) this.shooter.getBukkitEntity();
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType); PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -200,135 +74,16 @@ public class EntityEgg extends Entity {
if (hatching) { if (hatching) {
for (int k = 0; k < numHatching; k++) { for (int k = 0; k < numHatching; k++) {
Entity entity = null; world.getWorld().spawn(new Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG);
switch (hatchingType) { }
case CHICKEN:
entity = new EntityChicken(this.world);
break;
case COW:
entity = new EntityCow(this.world);
break;
case CREEPER:
entity = new EntityCreeper(this.world);
break;
case GHAST:
entity = new EntityGhast(this.world);
break;
case GIANT:
entity = new EntityGiantZombie(this.world);
break;
case PIG:
entity = new EntityPig(this.world);
break;
case PIG_ZOMBIE:
entity = new EntityPigZombie(this.world);
break;
case SHEEP:
entity = new EntitySheep(this.world);
break;
case SKELETON:
entity = new EntitySkeleton(this.world);
break;
case SPIDER:
entity = new EntitySpider(this.world);
break;
case ZOMBIE:
entity = new EntityZombie(this.world);
break;
case SQUID:
entity = new EntitySquid(this.world);
break;
case SLIME:
entity = new EntitySlime(this.world);
break;
case WOLF:
entity = new EntityWolf(this.world);
break;
default:
entity = new EntityChicken(this.world);
break;
} }
entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
this.world.addEntity(entity, SpawnReason.EGG);
// CraftBukkit end // CraftBukkit end
}
}
for (int l = 0; l < 8; ++l) { for (int j = 0; j < 8; ++j) {
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D); this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
} }
this.die(); if (!this.world.isStatic) {
}
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
;
}
while (this.pitch - this.lastPitch >= 180.0F) {
this.lastPitch += 360.0F;
}
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
while (this.yaw - this.lastYaw >= 180.0F) {
this.lastYaw += 360.0F;
}
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.99F;
float f3 = 0.03F;
if (this.ao()) {
for (int i1 = 0; i1 < 4; ++i1) {
float f4 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
}
f2 = 0.8F;
}
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.motY -= (double) f3;
this.setPosition(this.locX, this.locY, this.locZ);
}
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.b);
nbttagcompound.a("yTile", (short) this.c);
nbttagcompound.a("zTile", (short) this.d);
nbttagcompound.a("inTile", (byte) this.e);
nbttagcompound.a("shake", (byte) this.a);
nbttagcompound.a("inGround", (byte) (this.f ? 1 : 0));
}
public void a(NBTTagCompound nbttagcompound) {
this.b = nbttagcompound.d("xTile");
this.c = nbttagcompound.d("yTile");
this.d = nbttagcompound.d("zTile");
this.e = nbttagcompound.c("inTile") & 255;
this.a = nbttagcompound.c("shake") & 255;
this.f = nbttagcompound.c("inGround") == 1;
}
public void a_(EntityHuman entityhuman) {
if (this.f && this.thrower == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, 1);
this.die(); this.die();
} }
} }

Datei anzeigen

@ -19,10 +19,14 @@ public class EntityEnderman extends EntityMonster {
public EntityEnderman(World world) { public EntityEnderman(World world) {
super(world); super(world);
this.texture = "/mob/enderman.png"; this.texture = "/mob/enderman.png";
this.aU = 0.2F; this.aY = 0.2F;
this.damage = 5; this.damage = 7;
this.b(0.6F, 2.9F); this.b(0.6F, 2.9F);
this.bI = 1.0F; this.bM = 1.0F;
}
public int getMaxHealth() {
return 40;
} }
protected void b() { protected void b() {
@ -34,17 +38,17 @@ public class EntityEnderman extends EntityMonster {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("carried", (short) this.getCarriedId()); nbttagcompound.a("carried", (short) this.getCarriedId());
nbttagcompound.a("carryingData", (short) this.getCarriedData()); // Craftbukkit - fixed from carriedData nbttagcompound.a("carriedData", (short) this.getCarriedData());
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setCarriedId(nbttagcompound.d("carried")); this.setCarriedId(nbttagcompound.e("carried"));
this.setCarriedData(nbttagcompound.d("carryingData")); this.setCarriedData(nbttagcompound.e("carriedData"));
} }
protected Entity findTarget() { protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 64.0D); EntityHuman entityhuman = this.world.b(this, 64.0D);
if (entityhuman != null) { if (entityhuman != null) {
if (this.c(entityhuman)) { if (this.c(entityhuman)) {
@ -60,8 +64,8 @@ public class EntityEnderman extends EntityMonster {
return null; return null;
} }
public float a_(float f) { public float a(float f) {
return super.a_(f); return super.a(f);
} }
private boolean c(EntityHuman entityhuman) { private boolean c(EntityHuman entityhuman) {
@ -70,24 +74,24 @@ public class EntityEnderman extends EntityMonster {
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) { if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
return false; return false;
} else { } else {
Vec3D vec3d = entityhuman.c(1.0F).b(); Vec3D vec3d = entityhuman.d(1.0F).b();
Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.width / 2.0F) - entityhuman.locY + (double) entityhuman.t(), this.locZ - entityhuman.locZ); Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.width / 2.0F) - (entityhuman.locY + (double) entityhuman.x()), this.locZ - entityhuman.locZ);
double d0 = vec3d1.c(); double d0 = vec3d1.c();
vec3d1 = vec3d1.b(); vec3d1 = vec3d1.b();
double d1 = vec3d.a(vec3d1); double d1 = vec3d.a(vec3d1);
return d1 > 1.0D - 0.025D / d0 ? entityhuman.f(this) : false; return d1 > 1.0D - 0.025D / d0 ? entityhuman.g(this) : false;
} }
} }
public void s() { public void d() {
if (this.an()) { if (this.ay()) {
this.damageEntity(DamageSource.DROWN, 1); this.damageEntity(DamageSource.DROWN, 1);
} }
this.a = this.target != null; this.a = this.target != null;
this.aU = this.target != null ? 4.5F : 0.3F; this.aY = this.target != null ? 6.5F : 0.3F;
int i; int i;
if (!this.world.isStatic) { if (!this.world.isStatic) {
@ -137,30 +141,36 @@ public class EntityEnderman extends EntityMonster {
this.world.a("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.length, this.locY + this.random.nextDouble() * (double) this.width - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.length, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); this.world.a("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.length, this.locY + this.random.nextDouble() * (double) this.width - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.length, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D);
} }
if (this.world.d() && !this.world.isStatic) { if (this.world.e() && !this.world.isStatic) {
float f = this.a_(1.0F); float f = this.a(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
this.fireTicks = 300; this.target = null;
this.u_();
} }
} }
this.aS = false; if (this.ay()) {
this.target = null;
this.u_();
}
this.aW = false;
if (this.target != null) { if (this.target != null) {
this.a(this.target, 100.0F, 100.0F); this.a(this.target, 100.0F, 100.0F);
} }
if (!this.world.isStatic) { if (!this.world.isStatic && this.aj()) {
if (this.target != null) { if (this.target != null) {
if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) { if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) {
this.aP = this.aQ = 0.0F; this.aT = this.aU = 0.0F;
this.aU = 0.0F; this.aY = 0.0F;
if (this.target.h(this) < 16.0D) { if (this.target.i(this) < 16.0D) {
this.w(); this.u_();
} }
this.g = 0; this.g = 0;
} else if (this.target.h(this) > 256.0D && this.g++ >= 30 && this.e(this.target)) { } else if (this.target.i(this) > 256.0D && this.g++ >= 30 && this.f(this.target)) {
this.g = 0; this.g = 0;
} }
} else { } else {
@ -168,19 +178,19 @@ public class EntityEnderman extends EntityMonster {
} }
} }
super.s(); super.d();
} }
protected boolean w() { protected boolean u_() {
double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D; double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D;
double d1 = this.locY + (double) (this.random.nextInt(64) - 32); double d1 = this.locY + (double) (this.random.nextInt(64) - 32);
double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D; double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D;
return this.a(d0, d1, d2); return this.b(d0, d1, d2);
} }
protected boolean e(Entity entity) { protected boolean f(Entity entity) {
Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.width / 2.0F) - entity.locY + (double) entity.t(), this.locZ - entity.locZ); Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.width / 2.0F) - entity.locY + (double) entity.x(), this.locZ - entity.locZ);
vec3d = vec3d.b(); vec3d = vec3d.b();
double d0 = 16.0D; double d0 = 16.0D;
@ -188,10 +198,10 @@ public class EntityEnderman extends EntityMonster {
double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.b * d0; double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.b * d0;
double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0; double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0;
return this.a(d1, d2, d3); return this.b(d1, d2, d3);
} }
protected boolean a(double d0, double d1, double d2) { protected boolean b(double d0, double d1, double d2) {
double d3 = this.locX; double d3 = this.locX;
double d4 = this.locY; double d4 = this.locY;
double d5 = this.locZ; double d5 = this.locZ;
@ -244,40 +254,44 @@ public class EntityEnderman extends EntityMonster {
this.world.a("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); this.world.a("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
} }
this.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
this.world.makeSound(this, "mob.endermen.portal", 1.0F, 1.0F);
return true; return true;
} }
} }
protected String h() { protected String c_() {
return "mob.zombie"; return "mob.endermen.idle";
} }
protected String i() { protected String m() {
return "mob.zombiehurt"; return "mob.endermen.hit";
} }
protected String j() { protected String n() {
return "mob.zombiedeath"; return "mob.endermen.death";
} }
protected int k() { protected int e() {
return Item.ENDER_PEARL.id; return Item.ENDER_PEARL.id;
} }
protected void a(boolean flag) { protected void a(boolean flag, int i) {
int i = this.k(); int j = this.e();
if (j > 0) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(2); int count = this.random.nextInt(2 + i);
if ((i > 0) && (count > 0)) { if ((j > 0) && (count > 0)) {
loot.add(new org.bukkit.inventory.ItemStack(i, count)); loot.add(new org.bukkit.inventory.ItemStack(j, count));
} }
CraftEventFactory.callEntityDeathEvent(this, loot); CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end // CraftBukkit end
} }
}
public void setCarriedId(int i) { public void setCarriedId(int i) {
this.datawatcher.watch(16, Byte.valueOf((byte) (i & 255))); this.datawatcher.watch(16, Byte.valueOf((byte) (i & 255)));
@ -295,51 +309,34 @@ public class EntityEnderman extends EntityMonster {
return this.datawatcher.getByte(17); return this.datawatcher.getByte(17);
} }
public boolean damageEntity(DamageSource damagesource, int i) {
if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
if (this.u_()) {
return true;
}
}
return false;
} else {
return super.damageEntity(damagesource, i);
}
}
static { static {
b[Block.STONE.id] = true;
b[Block.GRASS.id] = true; b[Block.GRASS.id] = true;
b[Block.DIRT.id] = true; b[Block.DIRT.id] = true;
b[Block.COBBLESTONE.id] = true;
b[Block.WOOD.id] = true;
b[Block.SAND.id] = true; b[Block.SAND.id] = true;
b[Block.GRAVEL.id] = true; b[Block.GRAVEL.id] = true;
b[Block.GOLD_ORE.id] = true;
b[Block.IRON_ORE.id] = true;
b[Block.COAL_ORE.id] = true;
b[Block.LOG.id] = true;
b[Block.LEAVES.id] = true;
b[Block.SPONGE.id] = true;
b[Block.GLASS.id] = true;
b[Block.LAPIS_ORE.id] = true;
b[Block.LAPIS_BLOCK.id] = true;
b[Block.SANDSTONE.id] = true;
b[Block.WOOL.id] = true;
b[Block.YELLOW_FLOWER.id] = true; b[Block.YELLOW_FLOWER.id] = true;
b[Block.RED_ROSE.id] = true; b[Block.RED_ROSE.id] = true;
b[Block.BROWN_MUSHROOM.id] = true; b[Block.BROWN_MUSHROOM.id] = true;
b[Block.RED_MUSHROOM.id] = true; b[Block.RED_MUSHROOM.id] = true;
b[Block.GOLD_BLOCK.id] = true;
b[Block.IRON_BLOCK.id] = true;
b[Block.BRICK.id] = true;
b[Block.TNT.id] = true; b[Block.TNT.id] = true;
b[Block.BOOKSHELF.id] = true;
b[Block.MOSSY_COBBLESTONE.id] = true;
b[Block.DIAMOND_ORE.id] = true;
b[Block.DIAMOND_BLOCK.id] = true;
b[Block.WORKBENCH.id] = true;
b[Block.REDSTONE_ORE.id] = true;
b[Block.GLOWING_REDSTONE_ORE.id] = true;
b[Block.ICE.id] = true;
b[Block.CACTUS.id] = true; b[Block.CACTUS.id] = true;
b[Block.CLAY.id] = true; b[Block.CLAY.id] = true;
b[Block.PUMPKIN.id] = true; b[Block.PUMPKIN.id] = true;
b[Block.NETHERRACK.id] = true;
b[Block.SOUL_SAND.id] = true;
b[Block.GLOWSTONE.id] = true;
b[Block.JACK_O_LANTERN.id] = true;
b[Block.SMOOTH_BRICK.id] = true;
b[Block.BIG_MUSHROOM_1.id] = true;
b[Block.BIG_MUSHROOM_2.id] = true;
b[Block.MELON.id] = true; b[Block.MELON.id] = true;
b[Block.MYCEL.id] = true;
} }
} }

Datei anzeigen

@ -5,9 +5,8 @@ public class EntityExperienceOrb extends Entity {
public int a; public int a;
public int b = 0; public int b = 0;
public int c; public int c;
private int e = 5; private int d = 5;
public int value; // CraftBukkit - priv to pub public int value; // CraftBukkit - priv to pub
public float d = (float) (Math.random() * 3.141592653589793D * 2.0D);
public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) { public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) {
super(world); super(world);
@ -21,7 +20,7 @@ public class EntityExperienceOrb extends Entity {
this.value = i; this.value = i;
} }
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
@ -33,8 +32,8 @@ public class EntityExperienceOrb extends Entity {
protected void b() {} protected void b() {}
public void s_() { public void w_() {
super.s_(); super.w_();
if (this.c > 0) { if (this.c > 0) {
--this.c; --this.c;
} }
@ -56,7 +55,7 @@ public class EntityExperienceOrb extends Entity {
if (entityhuman != null) { if (entityhuman != null) {
double d1 = (entityhuman.locX - this.locX) / d0; double d1 = (entityhuman.locX - this.locX) / d0;
double d2 = (entityhuman.locY + (double) entityhuman.t() - this.locY) / d0; double d2 = (entityhuman.locY + (double) entityhuman.x() - this.locY) / d0;
double d3 = (entityhuman.locZ - this.locZ) / d0; double d3 = (entityhuman.locZ - this.locZ) / d0;
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
double d5 = 1.0D - d4; double d5 = 1.0D - d4;
@ -95,7 +94,7 @@ public class EntityExperienceOrb extends Entity {
} }
} }
public boolean f_() { public boolean i_() {
return this.world.a(this.boundingBox, Material.WATER, this); return this.world.a(this.boundingBox, Material.WATER, this);
} }
@ -104,9 +103,9 @@ public class EntityExperienceOrb extends Entity {
} }
public boolean damageEntity(DamageSource damagesource, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
this.aq(); this.aB();
this.e -= i; this.d -= i;
if (this.e <= 0) { if (this.d <= 0) {
this.die(); this.die();
} }
@ -114,30 +113,30 @@ public class EntityExperienceOrb extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Health", (short) ((byte) this.e)); nbttagcompound.a("Health", (short) ((byte) this.d));
nbttagcompound.a("Age", (short) this.b); nbttagcompound.a("Age", (short) this.b);
nbttagcompound.a("Value", (short) this.value); nbttagcompound.a("Value", (short) this.value);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.d("Health") & 255; this.d = nbttagcompound.e("Health") & 255;
this.b = nbttagcompound.d("Age"); this.b = nbttagcompound.e("Age");
this.value = nbttagcompound.d("Value"); this.value = nbttagcompound.e("Value");
} }
public void a_(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
if (this.c == 0 && entityhuman.w == 0) { if (this.c == 0 && entityhuman.x == 0) {
entityhuman.w = 2; entityhuman.x = 2;
this.world.makeSound(this, "random.pop", 0.2F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F)); this.world.makeSound(this, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
entityhuman.receive(this, 1); entityhuman.receive(this, 1);
entityhuman.d(this.value); entityhuman.h(this.value);
this.die(); this.die();
} }
} }
} }
public int j_() { public int g() {
return this.value; return this.value;
} }

Datei anzeigen

@ -14,8 +14,8 @@ public class EntityFallingSand extends Entity {
public EntityFallingSand(World world, double d0, double d1, double d2, int i, int data) { public EntityFallingSand(World world, double d0, double d1, double d2, int i, int data) {
super(world); super(world);
this.a = i; this.a = i;
this.bc = true;
this.data = data; // CraftBukkit this.data = data; // CraftBukkit
this.aY = true;
this.b(0.98F, 0.98F); this.b(0.98F, 0.98F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
@ -27,17 +27,17 @@ public class EntityFallingSand extends Entity {
this.lastZ = d2; this.lastZ = d2;
} }
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
protected void b() {} protected void b() {}
public boolean r_() { public boolean e_() {
return !this.dead; return !this.dead;
} }
public void s_() { public void w_() {
if (this.a == 0) { if (this.a == 0) {
this.die(); this.die();
} else { } else {
@ -54,19 +54,23 @@ public class EntityFallingSand extends Entity {
int j = MathHelper.floor(this.locY); int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ); int k = MathHelper.floor(this.locZ);
if (this.world.getTypeId(i, j, k) == this.a) { if (this.b == 1 && this.world.getTypeId(i, j, k) == this.a) {
this.world.setTypeId(i, j, k, 0); this.world.setTypeId(i, j, k, 0);
} else if (!this.world.isStatic && this.b == 1) {
this.die();
} }
if (this.onGround) { if (this.onGround) {
this.motX *= 0.699999988079071D; this.motX *= 0.699999988079071D;
this.motZ *= 0.699999988079071D; this.motZ *= 0.699999988079071D;
this.motY *= -0.5D; this.motY *= -0.5D;
if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
this.die(); this.die();
// CraftBukkit -- setTypeId => setTypeIdAndData // CraftBukkit -- setTypeId => setTypeIdAndData
if ((!this.world.a(this.a, i, j, k, true, 1) || BlockSand.d_(this.world, i, j - 1, k) || !this.world.setTypeIdAndData(i, j, k, this.a, this.data)) && !this.world.isStatic) { if ((!this.world.a(this.a, i, j, k, true, 1) || BlockSand.g(this.world, i, j - 1, k) || !this.world.setTypeIdAndData(i, j, k, this.a, this.data)) && !this.world.isStatic) {
this.b(this.a, 1); this.b(this.a, 1);
} }
}
} else if (this.b > 100 && !this.world.isStatic) { } else if (this.b > 100 && !this.world.isStatic) {
this.b(this.a, 1); this.b(this.a, 1);
this.die(); this.die();
@ -80,7 +84,7 @@ public class EntityFallingSand extends Entity {
} }
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.c("Tile") & 255; this.a = nbttagcompound.d("Tile") & 255;
this.data = nbttagcompound.c("Data") & 15; // CraftBukkit this.data = nbttagcompound.d("Data") & 15; // CraftBukkit
} }
} }

Datei anzeigen

@ -15,15 +15,14 @@ import org.bukkit.event.entity.ProjectileHitEvent;
public class EntityFireball extends Entity { public class EntityFireball extends Entity {
private int e = -1;
private int f = -1; private int f = -1;
private int g = -1; private int g = -1;
private int h = -1; private int h = 0;
private int i = 0; private boolean i = false;
private boolean j = false;
public int a = 0;
public EntityLiving shooter; public EntityLiving shooter;
private int k; private int j;
private int l = 0; private int k = 0;
public double dirX; public double dirX;
public double dirY; public double dirY;
public double dirZ; public double dirZ;
@ -61,33 +60,33 @@ public class EntityFireball extends Entity {
this.dirZ = d2 / d3 * 0.1D; this.dirZ = d2 / d3 * 0.1D;
} }
public void s_() { public void w_() {
super.s_(); super.w_();
this.fireTicks = 10; this.j(1);
if (this.a > 0) { if (!this.world.isStatic && (this.shooter == null || this.shooter.dead)) {
--this.a; this.die();
} }
if (this.j) { if (this.i) {
int i = this.world.getTypeId(this.f, this.g, this.h); int i = this.world.getTypeId(this.e, this.f, this.g);
if (i == this.i) { if (i == this.h) {
++this.k; ++this.j;
if (this.k == 1200) { if (this.j == 1200) {
this.die(); this.die();
} }
return; return;
} }
this.j = false; this.i = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
this.k = 0; this.k = 0;
this.l = 0;
} else { } else {
++this.l; ++this.k;
} }
Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ); Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
@ -107,7 +106,7 @@ public class EntityFireball extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.r_() && (entity1 != this.shooter || this.l >= 25)) { if (entity1.e_() && (!entity1.a((Entity) this.shooter) || this.k >= 25)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -128,6 +127,57 @@ public class EntityFireball extends Entity {
} }
if (movingobjectposition != null) { if (movingobjectposition != null) {
}
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
;
}
while (this.pitch - this.lastPitch >= 180.0F) {
this.lastPitch += 360.0F;
}
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
while (this.yaw - this.lastYaw >= 180.0F) {
this.lastYaw += 360.0F;
}
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F;
if (this.az()) {
for (int k = 0; k < 4; ++k) {
float f3 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
}
f2 = 0.8F;
}
this.motX += this.dirX;
this.motY += this.dirY;
this.motZ += this.dirZ;
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
this.setPosition(this.locX, this.locY, this.locZ);
}
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
// CraftBukkit start // CraftBukkit start
ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity()); ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(phe); this.world.getServer().getPluginManager().callEvent(phe);
@ -170,82 +220,39 @@ public class EntityFireball extends Entity {
// CraftBukkit end // CraftBukkit end
} }
// this.world.createExplosion((Entity) null, this.locX, this.locY, this.locZ, 1.0F, true); // CraftBukkit
this.die(); this.die();
} }
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
;
}
while (this.pitch - this.lastPitch >= 180.0F) {
this.lastPitch += 360.0F;
}
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
while (this.yaw - this.lastYaw >= 180.0F) {
this.lastYaw += 360.0F;
}
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F;
if (this.ao()) {
for (int k = 0; k < 4; ++k) {
float f3 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
}
f2 = 0.8F;
}
this.motX += this.dirX;
this.motY += this.dirY;
this.motZ += this.dirZ;
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
this.setPosition(this.locX, this.locY, this.locZ);
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.f); nbttagcompound.a("xTile", (short) this.e);
nbttagcompound.a("yTile", (short) this.g); nbttagcompound.a("yTile", (short) this.f);
nbttagcompound.a("zTile", (short) this.h); nbttagcompound.a("zTile", (short) this.g);
nbttagcompound.a("inTile", (byte) this.i); nbttagcompound.a("inTile", (byte) this.h);
nbttagcompound.a("shake", (byte) this.a); nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0));
nbttagcompound.a("inGround", (byte) (this.j ? 1 : 0));
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.f = nbttagcompound.d("xTile"); this.e = nbttagcompound.e("xTile");
this.g = nbttagcompound.d("yTile"); this.f = nbttagcompound.e("yTile");
this.h = nbttagcompound.d("zTile"); this.g = nbttagcompound.e("zTile");
this.i = nbttagcompound.c("inTile") & 255; this.h = nbttagcompound.d("inTile") & 255;
this.a = nbttagcompound.c("shake") & 255; this.i = nbttagcompound.d("inGround") == 1;
this.j = nbttagcompound.c("inGround") == 1;
} }
public boolean r_() { public boolean e_() {
return true; return true;
} }
public float j_() {
return 1.0F;
}
public boolean damageEntity(DamageSource damagesource, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
this.aq(); this.aB();
if (damagesource.getEntity() != null) { if (damagesource.getEntity() != null) {
Vec3D vec3d = damagesource.getEntity().ai(); Vec3D vec3d = damagesource.getEntity().ap();
if (vec3d != null) { if (vec3d != null) {
this.motX = vec3d.a; this.motX = vec3d.a;
@ -256,9 +263,17 @@ public class EntityFireball extends Entity {
this.dirZ = this.motZ * 0.1D; this.dirZ = this.motZ * 0.1D;
} }
if (damagesource.getEntity() instanceof EntityLiving) {
this.shooter = (EntityLiving) damagesource.getEntity();
}
return true; return true;
} else { } else {
return false; return false;
} }
} }
public float a(float f) {
return 1.0F;
}
} }

Datei anzeigen

@ -32,12 +32,12 @@ public class EntityFishingHook extends Entity {
public EntityFishingHook(World world) { public EntityFishingHook(World world) {
super(world); super(world);
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
this.bZ = true; this.ca = true;
} }
public EntityFishingHook(World world, EntityHuman entityhuman) { public EntityFishingHook(World world, EntityHuman entityhuman) {
super(world); super(world);
this.bZ = true; this.ca = true;
this.owner = entityhuman; this.owner = entityhuman;
this.owner.hookedFish = this; this.owner.hookedFish = this;
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
@ -79,8 +79,8 @@ public class EntityFishingHook extends Entity {
this.i = 0; this.i = 0;
} }
public void s_() { public void w_() {
super.s_(); super.w_();
if (this.l > 0) { if (this.l > 0) {
double d0 = this.locX + (this.m - this.locX) / (double) this.l; double d0 = this.locX + (this.m - this.locX) / (double) this.l;
double d1 = this.locY + (this.n - this.locY) / (double) this.l; double d1 = this.locY + (this.n - this.locY) / (double) this.l;
@ -103,9 +103,9 @@ public class EntityFishingHook extends Entity {
this.c(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} else { } else {
if (!this.world.isStatic) { if (!this.world.isStatic) {
ItemStack itemstack = this.owner.K(); ItemStack itemstack = this.owner.P();
if (this.owner.dead || !this.owner.ac() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.h(this.owner) > 1024.0D) { if (this.owner.dead || !this.owner.aj() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.i(this.owner) > 1024.0D) {
this.die(); this.die();
this.owner.hookedFish = null; this.owner.hookedFish = null;
return; return;
@ -168,7 +168,7 @@ public class EntityFishingHook extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.r_() && (entity1 != this.owner || this.j >= 5)) { if (entity1.e_() && (entity1 != this.owner || this.j >= 5)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -207,7 +207,7 @@ public class EntityFishingHook extends Entity {
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), 0); stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0);
} }
if (!stick) { if (!stick) {
// CraftBukkit end // CraftBukkit end
@ -267,7 +267,7 @@ public class EntityFishingHook extends Entity {
} else { } else {
short short1 = 500; short short1 = 500;
if (this.world.s(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) { if (this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
short1 = 300; short1 = 300;
} }
@ -325,15 +325,15 @@ public class EntityFishingHook extends Entity {
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.d("xTile"); this.d = nbttagcompound.e("xTile");
this.e = nbttagcompound.d("yTile"); this.e = nbttagcompound.e("yTile");
this.f = nbttagcompound.d("zTile"); this.f = nbttagcompound.e("zTile");
this.g = nbttagcompound.c("inTile") & 255; this.g = nbttagcompound.d("inTile") & 255;
this.a = nbttagcompound.c("shake") & 255; this.a = nbttagcompound.d("shake") & 255;
this.h = nbttagcompound.c("inGround") == 1; this.h = nbttagcompound.d("inGround") == 1;
} }
public int i() { public int j() {
byte b0 = 0; byte b0 = 0;
if (this.c != null) { if (this.c != null) {
@ -347,6 +347,7 @@ public class EntityFishingHook extends Entity {
return 0; return 0;
} }
// CraftBukkit end // CraftBukkit end
double d0 = this.owner.locX - this.locX; double d0 = this.owner.locX - this.locX;
double d1 = this.owner.locY - this.locY; double d1 = this.owner.locY - this.locY;
double d2 = this.owner.locZ - this.locZ; double d2 = this.owner.locZ - this.locZ;
@ -369,6 +370,7 @@ public class EntityFishingHook extends Entity {
return 0; return 0;
} }
// CraftBukkit end // CraftBukkit end
double d5 = this.owner.locX - this.locX; double d5 = this.owner.locX - this.locX;
double d6 = this.owner.locY - this.locY; double d6 = this.owner.locY - this.locY;
double d7 = this.owner.locZ - this.locZ; double d7 = this.owner.locZ - this.locZ;

Datei anzeigen

@ -21,7 +21,17 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.texture = "/mob/ghast.png"; this.texture = "/mob/ghast.png";
this.b(4.0F, 4.0F); this.b(4.0F, 4.0F);
this.fireProof = true; this.fireProof = true;
this.ax = 5; this.az = 5;
}
public boolean damageEntity(DamageSource damagesource, int i) {
if ("fireball".equals(damagesource.l()) && damagesource.getEntity() instanceof EntityHuman) {
super.damageEntity(damagesource, 1000);
((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.y);
return true;
} else {
return super.damageEntity(damagesource, i);
}
} }
protected void b() { protected void b() {
@ -29,19 +39,23 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.datawatcher.a(16, Byte.valueOf((byte) 0)); this.datawatcher.a(16, Byte.valueOf((byte) 0));
} }
public void s_() { public int getMaxHealth() {
super.s_(); return 10;
}
public void w_() {
super.w_();
byte b0 = this.datawatcher.getByte(16); byte b0 = this.datawatcher.getByte(16);
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png"; this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
} }
protected void c_() { protected void m_() {
if (!this.world.isStatic && this.world.difficulty == 0) { if (!this.world.isStatic && this.world.difficulty == 0) {
this.die(); this.die();
} }
this.ad(); this.ak();
this.e = this.f; this.e = this.f;
double d0 = this.b - this.locX; double d0 = this.b - this.locX;
double d1 = this.c - this.locY; double d1 = this.c - this.locY;
@ -84,7 +98,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
if (this.target == null || this.h-- <= 0) { if (this.target == null || this.h-- <= 0) {
// CraftBukkit start // CraftBukkit start
Entity target = this.world.findNearbyPlayer(this, 100.0D); Entity target = this.world.b(this, 100.0D);
if (target != null) { if (target != null) {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -105,23 +119,23 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d4 = 64.0D; double d4 = 64.0D;
if (this.target != null && this.target.h(this) < d4 * d4) { if (this.target != null && this.target.i(this) < d4 * d4) {
double d5 = this.target.locX - this.locX; double d5 = this.target.locX - this.locX;
double d6 = this.target.boundingBox.b + (double) (this.target.width / 2.0F) - (this.locY + (double) (this.width / 2.0F)); double d6 = this.target.boundingBox.b + (double) (this.target.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
double d7 = this.target.locZ - this.locZ; double d7 = this.target.locZ - this.locZ;
this.U = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; this.V = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
if (this.f(this.target)) { if (this.g(this.target)) {
if (this.f == 10) { if (this.f == 10) {
this.world.makeSound(this, "mob.ghast.charge", this.l(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
} }
++this.f; ++this.f;
if (this.f == 20) { if (this.f == 20) {
this.world.makeSound(this, "mob.ghast.fireball", this.l(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7); EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7);
double d8 = 4.0D; double d8 = 4.0D;
Vec3D vec3d = this.c(1.0F); Vec3D vec3d = this.d(1.0F);
entityfireball.locX = this.locX + vec3d.a * d8; entityfireball.locX = this.locX + vec3d.a * d8;
entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D; entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D;
@ -133,7 +147,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
--this.f; --this.f;
} }
} else { } else {
this.U = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F; this.V = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
if (this.f > 0) { if (this.f > 0) {
--this.f; --this.f;
} }
@ -165,31 +179,47 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true; return true;
} }
protected String h() { protected String c_() {
return "mob.ghast.moan"; return "mob.ghast.moan";
} }
protected String i() { protected String m() {
return "mob.ghast.scream"; return "mob.ghast.scream";
} }
protected String j() { protected String n() {
return "mob.ghast.death"; return "mob.ghast.death";
} }
protected int k() { protected int e() {
return Item.SULPHUR.id; return Item.SULPHUR.id;
} }
protected float l() { protected void a(boolean flag, int i) {
int j = this.random.nextInt(2) + this.random.nextInt(1 + i);
int k;
for (k = 0; k < j; ++k) {
this.b(Item.GHAST_TEAR.id, 1);
}
j = this.random.nextInt(3) + this.random.nextInt(1 + i);
for (k = 0; k < j; ++k) {
this.b(Item.SULPHUR.id, 1);
}
}
protected float o() {
return 10.0F; return 10.0F;
} }
public boolean d() { public boolean g() {
return this.random.nextInt(20) == 0 && super.d() && this.world.difficulty > 0; return this.random.nextInt(20) == 0 && super.g() && this.world.difficulty > 0;
} }
public int m() { public int p() {
return 1; return 1;
} }
} }

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

Datei anzeigen

@ -29,7 +29,7 @@ public class EntityItem extends Entity {
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
} }
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
@ -41,8 +41,8 @@ public class EntityItem extends Entity {
protected void b() {} protected void b() {}
public void s_() { public void w_() {
super.s_(); super.w_();
// CraftBukkit start // CraftBukkit start
int currentTick = (int) (System.currentTimeMillis() / 50); int currentTick = (int) (System.currentTimeMillis() / 50);
this.pickupDelay -= (currentTick - this.lastTick); this.pickupDelay -= (currentTick - this.lastTick);
@ -87,7 +87,7 @@ public class EntityItem extends Entity {
} }
} }
public boolean f_() { public boolean i_() {
return this.world.a(this.boundingBox, Material.WATER, this); return this.world.a(this.boundingBox, Material.WATER, this);
} }
@ -96,7 +96,7 @@ public class EntityItem extends Entity {
} }
public boolean damageEntity(DamageSource damagesource, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
this.aq(); this.aB();
this.f -= i; this.f -= i;
if (this.f <= 0) { if (this.f <= 0) {
this.die(); this.die();
@ -112,9 +112,9 @@ public class EntityItem extends Entity {
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.f = nbttagcompound.d("Health") & 255; this.f = nbttagcompound.e("Health") & 255;
this.b = nbttagcompound.d("Age"); this.b = nbttagcompound.e("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item"); NBTTagCompound nbttagcompound1 = nbttagcompound.l("Item");
this.itemStack = ItemStack.a(nbttagcompound1); this.itemStack = ItemStack.a(nbttagcompound1);
if (this.itemStack == null) { if (this.itemStack == null) {
@ -153,6 +153,14 @@ public class EntityItem extends Entity {
entityhuman.a((Statistic) AchievementList.t); entityhuman.a((Statistic) AchievementList.t);
} }
if (this.itemStack.id == Item.DIAMOND.id) {
entityhuman.a((Statistic) AchievementList.w);
}
if (this.itemStack.id == Item.BLAZE_ROD.id) {
entityhuman.a((Statistic) AchievementList.z);
}
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, i); entityhuman.receive(this, i);
if (this.itemStack.count <= 0) { if (this.itemStack.count <= 0) {
@ -162,7 +170,7 @@ public class EntityItem extends Entity {
} }
} }
public String Y() { public String ad() {
return StatisticCollector.a("item." + this.itemStack.k()); return StatisticCollector.a("item." + this.itemStack.k());
} }
} }

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

Datei anzeigen

@ -17,21 +17,18 @@ import org.bukkit.event.vehicle.VehicleUpdateEvent;
public class EntityMinecart extends Entity implements IInventory { public class EntityMinecart extends Entity implements IInventory {
private ItemStack[] items; private ItemStack[] items;
public int damage; private int e;
public int b; private boolean f;
public int c;
private boolean i;
public int type; public int type;
public int e; public double b;
public double f; public double c;
public double g;
private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}}; private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
private int k; private int h;
private double i;
private double j;
private double k;
private double l; private double l;
private double m; private double m;
private double n;
private double o;
private double p;
// CraftBukkit start // CraftBukkit start
public boolean slowWhenEmpty = true; public boolean slowWhenEmpty = true;
@ -51,30 +48,33 @@ public class EntityMinecart extends Entity implements IInventory {
public EntityMinecart(World world) { public EntityMinecart(World world) {
super(world); super(world);
this.items = new ItemStack[27]; // CraftBukkit this.items = new ItemStack[27]; // CraftBukkit
this.damage = 0; this.e = 0;
this.b = 0; this.f = false;
this.c = 1; this.bc = true;
this.i = false;
this.aY = true;
this.b(0.98F, 0.7F); this.b(0.98F, 0.7F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
} }
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
protected void b() {} protected void b() {
this.datawatcher.a(16, new Byte((byte) 0));
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(1));
this.datawatcher.a(19, new Integer(0));
}
public AxisAlignedBB b(Entity entity) { public AxisAlignedBB a_(Entity entity) {
return entity.boundingBox; return entity.boundingBox;
} }
public AxisAlignedBB f() { public AxisAlignedBB h_() {
return null; return null;
} }
public boolean g() { public boolean f_() {
return true; return true;
} }
@ -92,7 +92,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
} }
public double n() { public double q() {
return (double) this.width * 0.0D - 0.30000001192092896D; return (double) this.width * 0.0D - 0.30000001192092896D;
} }
@ -112,11 +112,11 @@ public class EntityMinecart extends Entity implements IInventory {
i = event.getDamage(); i = event.getDamage();
// CraftBukkit end // CraftBukkit end
this.c = -this.c; this.d(-this.m());
this.b = 10; this.c(10);
this.aq(); this.aB();
this.damage += i * 10; this.setDamage(this.getDamage() + i * 10);
if (this.damage > 40) { if (this.getDamage() > 40) {
if (this.passenger != null) { if (this.passenger != null) {
this.passenger.mount(this); this.passenger.mount(this);
} }
@ -126,7 +126,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.world.getServer().getPluginManager().callEvent(destroyEvent); this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) { if (destroyEvent.isCancelled()) {
this.damage = 40; // Maximize damage so this doesn't get triggered again right away this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
return true; return true;
} }
// CraftBukkit end // CraftBukkit end
@ -175,7 +175,7 @@ public class EntityMinecart extends Entity implements IInventory {
} }
} }
public boolean r_() { public boolean e_() {
return !this.dead; return !this.dead;
} }
@ -210,7 +210,7 @@ public class EntityMinecart extends Entity implements IInventory {
super.die(); super.die();
} }
public void s_() { public void w_() {
// CraftBukkit start // CraftBukkit start
double prevX = this.locX; double prevX = this.locX;
double prevY = this.locY; double prevY = this.locY;
@ -219,34 +219,38 @@ public class EntityMinecart extends Entity implements IInventory {
float prevPitch = this.pitch; float prevPitch = this.pitch;
// CraftBukkit end // CraftBukkit end
if (this.b > 0) { if (this.l() > 0) {
--this.b; this.c(this.l() - 1);
} }
if (this.damage > 0) { if (this.getDamage() > 0) {
--this.damage; this.setDamage(this.getDamage() - 1);
} }
double d0; if (this.j() && this.random.nextInt(4) == 0) {
this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
}
if (this.world.isStatic && this.k > 0) { if (this.world.isStatic) {
if (this.k > 0) { if (this.h > 0) {
double d1 = this.locX + (this.l - this.locX) / (double) this.k; double d0 = this.locX + (this.i - this.locX) / (double) this.h;
double d2 = this.locY + (this.m - this.locY) / (double) this.k; double d1 = this.locY + (this.j - this.locY) / (double) this.h;
double d3 = this.locZ + (this.n - this.locZ) / (double) this.k; double d2 = this.locZ + (this.k - this.locZ) / (double) this.h;
for (d0 = this.o - (double) this.yaw; d0 < -180.0D; d0 += 360.0D) { double d3;
for (d3 = this.l - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
; ;
} }
while (d0 >= 180.0D) { while (d3 >= 180.0D) {
d0 -= 360.0D; d3 -= 360.0D;
} }
this.yaw = (float) ((double) this.yaw + d0 / (double) this.k); this.yaw = (float) ((double) this.yaw + d3 / (double) this.h);
this.pitch = (float) ((double) this.pitch + (this.p - (double) this.pitch) / (double) this.k); this.pitch = (float) ((double) this.pitch + (this.m - (double) this.pitch) / (double) this.h);
--this.k; --this.h;
this.setPosition(d1, d2, d3); this.setPosition(d0, d1, d2);
this.c(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} else { } else {
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
@ -267,25 +271,23 @@ public class EntityMinecart extends Entity implements IInventory {
// CraftBukkit // CraftBukkit
double d4 = this.maxSpeed; double d4 = this.maxSpeed;
boolean flag = false; double d5 = 0.0078125D;
d0 = 0.0078125D;
int l = this.world.getTypeId(i, j, k); int l = this.world.getTypeId(i, j, k);
if (BlockMinecartTrack.c(l)) { if (BlockMinecartTrack.d(l)) {
Vec3D vec3d = this.h(this.locX, this.locY, this.locZ); Vec3D vec3d = this.h(this.locX, this.locY, this.locZ);
int i1 = this.world.getData(i, j, k); int i1 = this.world.getData(i, j, k);
this.locY = (double) j; this.locY = (double) j;
boolean flag = false;
boolean flag1 = false; boolean flag1 = false;
boolean flag2 = false;
if (l == Block.GOLDEN_RAIL.id) { if (l == Block.GOLDEN_RAIL.id) {
flag1 = (i1 & 8) != 0; flag = (i1 & 8) != 0;
flag2 = !flag1; flag1 = !flag;
} }
if (((BlockMinecartTrack) Block.byId[l]).f()) { if (((BlockMinecartTrack) Block.byId[l]).h()) {
i1 &= 7; i1 &= 7;
} }
@ -294,41 +296,41 @@ public class EntityMinecart extends Entity implements IInventory {
} }
if (i1 == 2) { if (i1 == 2) {
this.motX -= d0; this.motX -= d5;
} }
if (i1 == 3) { if (i1 == 3) {
this.motX += d0; this.motX += d5;
} }
if (i1 == 4) { if (i1 == 4) {
this.motZ += d0; this.motZ += d5;
} }
if (i1 == 5) { if (i1 == 5) {
this.motZ -= d0; this.motZ -= d5;
} }
int[][] aint = matrix[i1]; int[][] aint = matrix[i1];
double d5 = (double) (aint[1][0] - aint[0][0]); double d6 = (double) (aint[1][0] - aint[0][0]);
double d6 = (double) (aint[1][2] - aint[0][2]); double d7 = (double) (aint[1][2] - aint[0][2]);
double d7 = Math.sqrt(d5 * d5 + d6 * d6); double d8 = Math.sqrt(d6 * d6 + d7 * d7);
double d8 = this.motX * d5 + this.motZ * d6; double d9 = this.motX * d6 + this.motZ * d7;
if (d8 < 0.0D) { if (d9 < 0.0D) {
d5 = -d5;
d6 = -d6; d6 = -d6;
d7 = -d7;
} }
double d9 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.motX = d9 * d5 / d7; this.motX = d10 * d6 / d8;
this.motZ = d9 * d6 / d7; this.motZ = d10 * d7 / d8;
double d10; double d11;
if (flag2) { if (flag1) {
d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); d11 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (d10 < 0.03D) { if (d11 < 0.03D) {
this.motX *= 0.0D; this.motX *= 0.0D;
this.motY *= 0.0D; this.motY *= 0.0D;
this.motZ *= 0.0D; this.motZ *= 0.0D;
@ -339,39 +341,39 @@ public class EntityMinecart extends Entity implements IInventory {
} }
} }
d10 = 0.0D; d11 = 0.0D;
double d11 = (double) i + 0.5D + (double) aint[0][0] * 0.5D; double d12 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
double d12 = (double) k + 0.5D + (double) aint[0][2] * 0.5D; double d13 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
double d13 = (double) i + 0.5D + (double) aint[1][0] * 0.5D; double d14 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
double d14 = (double) k + 0.5D + (double) aint[1][2] * 0.5D; double d15 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
d5 = d13 - d11;
d6 = d14 - d12; d6 = d14 - d12;
double d15; d7 = d15 - d13;
double d16; double d16;
double d17; double d17;
double d18;
if (d5 == 0.0D) { if (d6 == 0.0D) {
this.locX = (double) i + 0.5D; this.locX = (double) i + 0.5D;
d10 = this.locZ - (double) k; d11 = this.locZ - (double) k;
} else if (d6 == 0.0D) { } else if (d7 == 0.0D) {
this.locZ = (double) k + 0.5D; this.locZ = (double) k + 0.5D;
d10 = this.locX - (double) i; d11 = this.locX - (double) i;
} else { } else {
d16 = this.locX - d11; d16 = this.locX - d12;
d15 = this.locZ - d12; d18 = this.locZ - d13;
d17 = (d16 * d5 + d15 * d6) * 2.0D; d17 = (d16 * d6 + d18 * d7) * 2.0D;
d10 = d17; d11 = d17;
} }
this.locX = d11 + d5 * d10; this.locX = d12 + d6 * d11;
this.locZ = d12 + d6 * d10; this.locZ = d13 + d7 * d11;
this.setPosition(this.locX, this.locY + (double) this.height, this.locZ); this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
d16 = this.motX; d16 = this.motX;
d15 = this.motZ; d18 = this.motZ;
if (this.passenger != null) { if (this.passenger != null) {
d16 *= 0.75D; d16 *= 0.75D;
d15 *= 0.75D; d18 *= 0.75D;
} }
if (d16 < -d4) { if (d16 < -d4) {
@ -382,15 +384,15 @@ public class EntityMinecart extends Entity implements IInventory {
d16 = d4; d16 = d4;
} }
if (d15 < -d4) { if (d18 < -d4) {
d15 = -d4; d18 = -d4;
} }
if (d15 > d4) { if (d18 > d4) {
d15 = d4; d18 = d4;
} }
this.move(d16, 0.0D, d15); this.move(d16, 0.0D, d18);
if (aint[0][1] != 0 && MathHelper.floor(this.locX) - i == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) { if (aint[0][1] != 0 && MathHelper.floor(this.locX) - i == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) {
this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ); this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ);
} else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - i == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) { } else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - i == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) {
@ -404,18 +406,17 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ *= 0.996999979019165D; this.motZ *= 0.996999979019165D;
} else { } else {
if (this.type == 2) { if (this.type == 2) {
d17 = (double) MathHelper.a(this.f * this.f + this.g * this.g); d17 = (double) MathHelper.a(this.b * this.b + this.c * this.c);
if (d17 > 0.01D) { if (d17 > 0.01D) {
flag = true; this.b /= d17;
this.f /= d17; this.c /= d17;
this.g /= d17; double d19 = 0.04D;
double d18 = 0.04D;
this.motX *= 0.800000011920929D; this.motX *= 0.800000011920929D;
this.motY *= 0.0D; this.motY *= 0.0D;
this.motZ *= 0.800000011920929D; this.motZ *= 0.800000011920929D;
this.motX += this.f * d18; this.motX += this.b * d19;
this.motZ += this.g * d18; this.motZ += this.c * d19;
} else { } else {
this.motX *= 0.8999999761581421D; this.motX *= 0.8999999761581421D;
this.motY *= 0.0D; this.motY *= 0.0D;
@ -431,12 +432,12 @@ public class EntityMinecart extends Entity implements IInventory {
Vec3D vec3d1 = this.h(this.locX, this.locY, this.locZ); Vec3D vec3d1 = this.h(this.locX, this.locY, this.locZ);
if (vec3d1 != null && vec3d != null) { if (vec3d1 != null && vec3d != null) {
double d19 = (vec3d.b - vec3d1.b) * 0.05D; double d20 = (vec3d.b - vec3d1.b) * 0.05D;
d9 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (d9 > 0.0D) { if (d10 > 0.0D) {
this.motX = this.motX / d9 * (d9 + d19); this.motX = this.motX / d10 * (d10 + d20);
this.motZ = this.motZ / d9 * (d9 + d19); this.motZ = this.motZ / d10 * (d10 + d20);
} }
this.setPosition(this.locX, vec3d1.b, this.locZ); this.setPosition(this.locX, vec3d1.b, this.locZ);
@ -446,35 +447,35 @@ public class EntityMinecart extends Entity implements IInventory {
int k1 = MathHelper.floor(this.locZ); int k1 = MathHelper.floor(this.locZ);
if (j1 != i || k1 != k) { if (j1 != i || k1 != k) {
d9 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.motX = d9 * (double) (j1 - i); this.motX = d10 * (double) (j1 - i);
this.motZ = d9 * (double) (k1 - k); this.motZ = d10 * (double) (k1 - k);
} }
double d20; double d21;
if (this.type == 2) { if (this.type == 2) {
d20 = (double) MathHelper.a(this.f * this.f + this.g * this.g); d21 = (double) MathHelper.a(this.b * this.b + this.c * this.c);
if (d20 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) { if (d21 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
this.f /= d20; this.b /= d21;
this.g /= d20; this.c /= d21;
if (this.f * this.motX + this.g * this.motZ < 0.0D) { if (this.b * this.motX + this.c * this.motZ < 0.0D) {
this.f = 0.0D; this.b = 0.0D;
this.g = 0.0D; this.c = 0.0D;
} else { } else {
this.f = this.motX; this.b = this.motX;
this.g = this.motZ; this.c = this.motZ;
} }
} }
} }
if (flag1) { if (flag) {
d20 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); d21 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (d20 > 0.01D) { if (d21 > 0.01D) {
double d21 = 0.06D; double d22 = 0.06D;
this.motX += this.motX / d20 * d21; this.motX += this.motX / d21 * d22;
this.motZ += this.motZ / d20 * d21; this.motZ += this.motZ / d21 * d22;
} else if (i1 == 1) { } else if (i1 == 1) {
if (this.world.e(i - 1, j, k)) { if (this.world.e(i - 1, j, k)) {
this.motX = 0.02D; this.motX = 0.02D;
@ -525,29 +526,29 @@ public class EntityMinecart extends Entity implements IInventory {
} }
this.pitch = 0.0F; this.pitch = 0.0F;
double d22 = this.lastX - this.locX; double d23 = this.lastX - this.locX;
double d23 = this.lastZ - this.locZ; double d24 = this.lastZ - this.locZ;
if (d22 * d22 + d23 * d23 > 0.0010D) { if (d23 * d23 + d24 * d24 > 0.0010D) {
this.yaw = (float) (Math.atan2(d23, d22) * 180.0D / 3.141592653589793D); this.yaw = (float) (Math.atan2(d24, d23) * 180.0D / 3.141592653589793D);
if (this.i) { if (this.f) {
this.yaw += 180.0F; this.yaw += 180.0F;
} }
} }
double d24; double d25;
for (d24 = (double) (this.yaw - this.lastYaw); d24 >= 180.0D; d24 -= 360.0D) { for (d25 = (double) (this.yaw - this.lastYaw); d25 >= 180.0D; d25 -= 360.0D) {
; ;
} }
while (d24 < -180.0D) { while (d25 < -180.0D) {
d24 += 360.0D; d25 += 360.0D;
} }
if (d24 < -170.0D || d24 >= 170.0D) { if (d25 < -170.0D || d25 >= 170.0D) {
this.yaw += 180.0F; this.yaw += 180.0F;
this.i = !this.i; this.f = !this.f;
} }
this.c(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
@ -571,25 +572,29 @@ public class EntityMinecart extends Entity implements IInventory {
for (int l1 = 0; l1 < list.size(); ++l1) { for (int l1 = 0; l1 < list.size(); ++l1) {
Entity entity = (Entity) list.get(l1); Entity entity = (Entity) list.get(l1);
if (entity != this.passenger && entity.g() && entity instanceof EntityMinecart) { if (entity != this.passenger && entity.f_() && entity instanceof EntityMinecart) {
entity.collide(this); entity.collide(this);
} }
} }
} }
if (this.passenger != null && this.passenger.dead) { if (this.passenger != null && this.passenger.dead) {
this.passenger.vehicle = null; // CraftBukkit if (this.passenger.vehicle == this) {
this.passenger.vehicle = null;
}
this.passenger = null; this.passenger = null;
} }
if (flag && this.random.nextInt(4) == 0) { if (this.e > 0) {
--this.e; --this.e;
if (this.e < 0) {
this.f = this.g = 0.0D;
} }
this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D); if (this.e <= 0) {
this.b = this.c = 0.0D;
} }
this.a(this.e > 0);
} }
} }
@ -604,11 +609,11 @@ public class EntityMinecart extends Entity implements IInventory {
int l = this.world.getTypeId(i, j, k); int l = this.world.getTypeId(i, j, k);
if (BlockMinecartTrack.c(l)) { if (BlockMinecartTrack.d(l)) {
int i1 = this.world.getData(i, j, k); int i1 = this.world.getData(i, j, k);
d1 = (double) j; d1 = (double) j;
if (((BlockMinecartTrack) Block.byId[l]).f()) { if (((BlockMinecartTrack) Block.byId[l]).h()) {
i1 &= 7; i1 &= 7;
} }
@ -662,8 +667,8 @@ public class EntityMinecart extends Entity implements IInventory {
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Type", this.type); nbttagcompound.a("Type", this.type);
if (this.type == 2) { if (this.type == 2) {
nbttagcompound.a("PushX", this.f); nbttagcompound.a("PushX", this.b);
nbttagcompound.a("PushZ", this.g); nbttagcompound.a("PushZ", this.c);
nbttagcompound.a("Fuel", (short) this.e); nbttagcompound.a("Fuel", (short) this.e);
} else if (this.type == 1) { } else if (this.type == 1) {
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
@ -683,19 +688,19 @@ public class EntityMinecart extends Entity implements IInventory {
} }
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {
this.type = nbttagcompound.e("Type"); this.type = nbttagcompound.f("Type");
if (this.type == 2) { if (this.type == 2) {
this.f = nbttagcompound.h("PushX"); this.b = nbttagcompound.i("PushX");
this.g = nbttagcompound.h("PushZ"); this.c = nbttagcompound.i("PushZ");
this.e = nbttagcompound.d("Fuel"); this.e = nbttagcompound.e("Fuel");
} else if (this.type == 1) { } else if (this.type == 1) {
NBTTagList nbttaglist = nbttagcompound.l("Items"); NBTTagList nbttaglist = nbttagcompound.m("Items");
this.items = new ItemStack[this.getSize()]; this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.c(); ++i) { for (int i = 0; i < nbttaglist.d(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound1.c("Slot") & 255; int j = nbttagcompound1.d("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = ItemStack.a(nbttagcompound1); this.items[j] = ItemStack.a(nbttagcompound1);
@ -749,17 +754,18 @@ public class EntityMinecart extends Entity implements IInventory {
d1 *= d3; d1 *= d3;
d0 *= 0.10000000149011612D; d0 *= 0.10000000149011612D;
d1 *= 0.10000000149011612D; d1 *= 0.10000000149011612D;
d0 *= (double) (1.0F - this.bK); d0 *= (double) (1.0F - this.bO);
d1 *= (double) (1.0F - this.bK); d1 *= (double) (1.0F - this.bO);
d0 *= 0.5D; d0 *= 0.5D;
d1 *= 0.5D; d1 *= 0.5D;
if (entity instanceof EntityMinecart) { if (entity instanceof EntityMinecart) {
double d4 = entity.locX - this.locX; double d4 = entity.locX - this.locX;
double d5 = entity.locZ - this.locZ; double d5 = entity.locZ - this.locZ;
double d6 = d4 * entity.motZ + d5 * entity.lastX; Vec3D vec3d = Vec3D.create(d4, 0.0D, d5).b();
Vec3D vec3d1 = Vec3D.create((double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F), 0.0D, (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F)).b();
double d6 = Math.abs(vec3d.a(vec3d1));
d6 *= d6; if (d6 < 0.800000011920929D) {
if (d6 > 5.0D) {
return; return;
} }
@ -769,28 +775,28 @@ public class EntityMinecart extends Entity implements IInventory {
if (((EntityMinecart) entity).type == 2 && this.type != 2) { if (((EntityMinecart) entity).type == 2 && this.type != 2) {
this.motX *= 0.20000000298023224D; this.motX *= 0.20000000298023224D;
this.motZ *= 0.20000000298023224D; this.motZ *= 0.20000000298023224D;
this.b(entity.motX - d0, 0.0D, entity.motZ - d1); this.b_(entity.motX - d0, 0.0D, entity.motZ - d1);
entity.motX *= 0.699999988079071D; entity.motX *= 0.949999988079071D;
entity.motZ *= 0.699999988079071D; entity.motZ *= 0.949999988079071D;
} else if (((EntityMinecart) entity).type != 2 && this.type == 2) { } else if (((EntityMinecart) entity).type != 2 && this.type == 2) {
entity.motX *= 0.20000000298023224D; entity.motX *= 0.20000000298023224D;
entity.motZ *= 0.20000000298023224D; entity.motZ *= 0.20000000298023224D;
entity.b(this.motX + d0, 0.0D, this.motZ + d1); entity.b_(this.motX + d0, 0.0D, this.motZ + d1);
this.motX *= 0.699999988079071D; this.motX *= 0.949999988079071D;
this.motZ *= 0.699999988079071D; this.motZ *= 0.949999988079071D;
} else { } else {
d7 /= 2.0D; d7 /= 2.0D;
d8 /= 2.0D; d8 /= 2.0D;
this.motX *= 0.20000000298023224D; this.motX *= 0.20000000298023224D;
this.motZ *= 0.20000000298023224D; this.motZ *= 0.20000000298023224D;
this.b(d7 - d0, 0.0D, d8 - d1); this.b_(d7 - d0, 0.0D, d8 - d1);
entity.motX *= 0.20000000298023224D; entity.motX *= 0.20000000298023224D;
entity.motZ *= 0.20000000298023224D; entity.motZ *= 0.20000000298023224D;
entity.b(d7 + d0, 0.0D, d8 + d1); entity.b_(d7 + d0, 0.0D, d8 + d1);
} }
} else { } else {
this.b(-d0, 0.0D, -d1); this.b_(-d0, 0.0D, -d1);
entity.b(d0 / 4.0D, 0.0D, d1 / 4.0D); entity.b_(d0 / 4.0D, 0.0D, d1 / 4.0D);
} }
} }
} }
@ -875,21 +881,57 @@ public class EntityMinecart extends Entity implements IInventory {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
} }
this.e += 1200; this.e += 3600;
} }
this.f = this.locX - entityhuman.locX; this.b = this.locX - entityhuman.locX;
this.g = this.locZ - entityhuman.locZ; this.c = this.locZ - entityhuman.locZ;
} }
return true; return true;
} }
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.dead ? false : entityhuman.h(this) <= 64.0D; return this.dead ? false : entityhuman.i(this) <= 64.0D;
} }
public void e() {} protected boolean j() {
return (this.datawatcher.getByte(16) & 1) != 0;
public void t_() {} }
protected void a(boolean flag) {
if (flag) {
this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) | 1)));
} else {
this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) & -2)));
}
}
public void f() {}
public void g() {}
public void setDamage(int i) {
this.datawatcher.watch(19, Integer.valueOf(i));
}
public int getDamage() {
return this.datawatcher.getInt(19);
}
public void c(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
public int l() {
return this.datawatcher.getInt(17);
}
public void d(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
public int m() {
return this.datawatcher.getInt(18);
}
} }

Datei anzeigen

@ -13,31 +13,30 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
public EntityMonster(World world) { public EntityMonster(World world) {
super(world); super(world);
this.health = 20; this.az = 5;
this.ax = 5;
} }
public void s() { public void d() {
float f = this.a_(1.0F); float f = this.a(1.0F);
if (f > 0.5F) { if (f > 0.5F) {
this.aO += 2; this.aS += 2;
} }
super.s(); super.d();
} }
public void s_() { public void w_() {
super.s_(); super.w_();
if (!this.world.isStatic && this.world.difficulty == 0) { if (!this.world.isStatic && this.world.difficulty == 0) {
this.die(); this.die();
} }
} }
protected Entity findTarget() { protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D); EntityHuman entityhuman = this.world.b(this, 16.0D);
return entityhuman != null && this.f(entityhuman) ? entityhuman : null; return entityhuman != null && this.g(entityhuman) ? entityhuman : null;
} }
public boolean damageEntity(DamageSource damagesource, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
@ -71,7 +70,17 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} }
} }
protected boolean c(Entity entity) { protected boolean d(Entity entity) {
int i = this.damage;
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
}
if (this.hasEffect(MobEffectList.WEAKNESS)) {
i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
}
// CraftBukkit start - this is still duplicated here and EntityHuman because it's possible for lastDamage EntityMonster // CraftBukkit start - this is still duplicated here and EntityHuman because it's possible for lastDamage EntityMonster
// to damage another EntityMonster, and we want to catch those events. // to damage another EntityMonster, and we want to catch those events.
// This does not fire events for slime attacks, av they're not lastDamage EntityMonster. // This does not fire events for slime attacks, av they're not lastDamage EntityMonster.
@ -80,22 +89,23 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage); EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
i = event.getDamage();
if (!event.isCancelled()) { if (!event.isCancelled()) {
return entity.damageEntity(DamageSource.mobAttack(this), event.getDamage()); return entity.damageEntity(DamageSource.mobAttack(this), i);
} }
return false; return false;
} }
// CraftBukkit end // CraftBukkit end
return entity.damageEntity(DamageSource.mobAttack((EntityLiving) this), this.damage); return entity.damageEntity(DamageSource.mobAttack(this), i);
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) { if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20; this.attackTicks = 20;
this.c(entity); this.d(entity);
} }
} }
@ -111,7 +121,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
public boolean d() { protected boolean y() {
int i = MathHelper.floor(this.locX); int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b); int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ); int k = MathHelper.floor(this.locZ);
@ -121,7 +131,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} else { } else {
int l = this.world.getLightLevel(i, j, k); int l = this.world.getLightLevel(i, j, k);
if (this.world.t()) { if (this.world.v()) {
int i1 = this.world.k; int i1 = this.world.k;
this.world.k = 10; this.world.k = 10;
@ -129,7 +139,11 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
this.world.k = i1; this.world.k = i1;
} }
return l <= this.random.nextInt(8) && super.d(); return l <= this.random.nextInt(8);
} }
} }
public boolean g() {
return this.y() && super.g();
}
} }

Datei anzeigen

@ -43,7 +43,7 @@ public class EntityPainting extends Entity {
this.e = enumart; this.e = enumart;
this.b(l); this.b(l);
if (this.i()) { if (this.j()) {
arraylist.add(enumart); arraylist.add(enumart);
} }
} }
@ -121,10 +121,10 @@ public class EntityPainting extends Entity {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F); return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
} }
public void s_() { public void w_() {
if (this.f++ == 100 && !this.world.isStatic) { if (this.f++ == 100 && !this.world.isStatic) {
this.f = 0; this.f = 0;
if (!this.i()) { if (!this.j()) {
// CraftBukkit start // CraftBukkit start
Material material = this.world.getMaterial((int)this.locX, (int)this.locY, (int)this.locZ); Material material = this.world.getMaterial((int)this.locX, (int)this.locY, (int)this.locZ);
RemoveCause cause; RemoveCause cause;
@ -152,7 +152,7 @@ public class EntityPainting extends Entity {
} }
} }
public boolean i() { public boolean j() {
if (this.world.getEntities(this, this.boundingBox).size() > 0) { if (this.world.getEntities(this, this.boundingBox).size() > 0) {
return false; return false;
} else { } else {
@ -210,7 +210,7 @@ public class EntityPainting extends Entity {
} }
} }
public boolean r_() { public boolean e_() {
return true; return true;
} }
@ -234,12 +234,12 @@ public class EntityPainting extends Entity {
} }
} }
if(!dead) { if (dead) return true;
this.die();
this.aq();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
}
// CraftBukkit end // CraftBukkit end
this.die();
this.aB();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
} }
return true; return true;
@ -259,7 +259,7 @@ public class EntityPainting extends Entity {
++this.fireTicks; ++this.fireTicks;
if (this.fireTicks == 0) { if (this.fireTicks == 0) {
this.fireTicks = 300; this.j(8);
} }
} }
// CraftBukkit end // CraftBukkit end
@ -273,10 +273,10 @@ public class EntityPainting extends Entity {
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.c("Dir"); this.a = nbttagcompound.d("Dir");
this.b = nbttagcompound.e("TileX"); this.b = nbttagcompound.f("TileX");
this.c = nbttagcompound.e("TileY"); this.c = nbttagcompound.f("TileY");
this.d = nbttagcompound.e("TileZ"); this.d = nbttagcompound.f("TileZ");
String s = nbttagcompound.getString("Motive"); String s = nbttagcompound.getString("Motive");
EnumArt[] aenumart = EnumArt.values(); EnumArt[] aenumart = EnumArt.values();
int i = aenumart.length; int i = aenumart.length;
@ -298,25 +298,19 @@ public class EntityPainting extends Entity {
public void move(double d0, double d1, double d2) { public void move(double d0, double d1, double d2) {
if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
if (dead) return; // CraftBukkit
// CraftBukkit start
if(!dead) {
this.die(); this.die();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING))); this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
} }
// CraftBukkit end
}
} }
public void b(double d0, double d1, double d2) { public void b_(double d0, double d1, double d2) {
if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
if (dead) return; // CraftBukkit
// CraftBukkit start
if(!dead) {
this.die(); this.die();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING))); this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
} }
// CraftBukkit end
}
} }
} }

Datei anzeigen

@ -13,7 +13,12 @@ public class EntityPig extends EntityAnimal {
this.b(0.9F, 0.9F); this.b(0.9F, 0.9F);
} }
public int getMaxHealth() {
return 10;
}
protected void b() { protected void b() {
super.b();
this.datawatcher.a(16, Byte.valueOf((byte) 0)); this.datawatcher.a(16, Byte.valueOf((byte) 0));
} }
@ -24,23 +29,25 @@ public class EntityPig extends EntityAnimal {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setSaddle(nbttagcompound.m("Saddle")); this.setSaddle(nbttagcompound.n("Saddle"));
} }
protected String h() { protected String c_() {
return "mob.pig"; return "mob.pig";
} }
protected String i() { protected String m() {
return "mob.pig"; return "mob.pig";
} }
protected String j() { protected String n() {
return "mob.pigdeath"; return "mob.pigdeath";
} }
public boolean b(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) { if (super.b(entityhuman)) {
return true;
} else if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
entityhuman.mount(this); entityhuman.mount(this);
return true; return true;
} else { } else {
@ -48,8 +55,8 @@ public class EntityPig extends EntityAnimal {
} }
} }
protected int k() { protected int e() {
return this.fireTicks > 0 ? Item.GRILLED_PORK.id : Item.PORK.id; return this.z() ? Item.GRILLED_PORK.id : Item.PORK.id;
} }
public boolean hasSaddle() { public boolean hasSaddle() {
@ -84,10 +91,14 @@ public class EntityPig extends EntityAnimal {
} }
} }
protected void a(float f) { protected void b(float f) {
super.a(f); super.b(f);
if (f > 5.0F && this.passenger instanceof EntityHuman) { if (f > 5.0F && this.passenger instanceof EntityHuman) {
((EntityHuman) this.passenger).a((Statistic) AchievementList.u); ((EntityHuman) this.passenger).a((Statistic) AchievementList.u);
} }
} }
protected EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityPig(this.world);
}
} }

Datei anzeigen

@ -16,21 +16,21 @@ public class EntityPigZombie extends EntityZombie {
public EntityPigZombie(World world) { public EntityPigZombie(World world) {
super(world); super(world);
this.texture = "/mob/pigzombie.png"; this.texture = "/mob/pigzombie.png";
this.aU = 0.5F; this.aY = 0.5F;
this.damage = 5; this.damage = 5;
this.fireProof = true; this.fireProof = true;
} }
public void s_() { public void w_() {
this.aU = this.target != null ? 0.95F : 0.5F; this.aY = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) { if (this.soundDelay > 0 && --this.soundDelay == 0) {
this.world.makeSound(this, "mob.zombiepig.zpigangry", this.l() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F); this.world.makeSound(this, "mob.zombiepig.zpigangry", this.o() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
} }
super.s_(); super.w_();
} }
public boolean d() { public boolean g() {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getEntities(this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
} }
@ -41,15 +41,15 @@ public class EntityPigZombie extends EntityZombie {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.angerLevel = nbttagcompound.d("Anger"); this.angerLevel = nbttagcompound.e("Anger");
} }
protected Entity findTarget() { protected Entity findTarget() {
return this.angerLevel == 0 ? null : super.findTarget(); return this.angerLevel == 0 ? null : super.findTarget();
} }
public void s() { public void d() {
super.s(); super.d();
} }
public boolean damageEntity(DamageSource damagesource, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
@ -64,17 +64,17 @@ public class EntityPigZombie extends EntityZombie {
if (entity1 instanceof EntityPigZombie) { if (entity1 instanceof EntityPigZombie) {
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1; EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
entitypigzombie.e(entity); entitypigzombie.f(entity);
} }
} }
this.e(entity); this.f(entity);
} }
return super.damageEntity(damagesource, i); return super.damageEntity(damagesource, i);
} }
private void e(Entity entity) { private void f(Entity entity) {
// CraftBukkit start // CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
@ -97,19 +97,35 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40); this.soundDelay = this.random.nextInt(40);
} }
protected String h() { protected String c_() {
return "mob.zombiepig.zpig"; return "mob.zombiepig.zpig";
} }
protected String i() { protected String m() {
return "mob.zombiepig.zpighurt"; return "mob.zombiepig.zpighurt";
} }
protected String j() { protected String n() {
return "mob.zombiepig.zpigdeath"; return "mob.zombiepig.zpigdeath";
} }
protected int k() { protected void a(boolean flag, int i) {
return Item.GRILLED_PORK.id; int j = this.random.nextInt(2 + i);
int k;
for (k = 0; k < j; ++k) {
this.b(Item.ROTTEN_FLESH.id, 1);
}
j = this.random.nextInt(2 + i);
for (k = 0; k < j; ++k) {
this.b(Item.GOLD_NUGGET.id, 1);
}
}
protected int e() {
return Item.ROTTEN_FLESH.id;
} }
} }

Datei anzeigen

@ -24,15 +24,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double e; public double e;
public List chunkCoordIntPairQueue = new LinkedList(); public List chunkCoordIntPairQueue = new LinkedList();
public Set playerChunkCoordIntPairs = new HashSet(); public Set playerChunkCoordIntPairs = new HashSet();
private int cb = -99999999;
private int cc = -99999999; private int cc = -99999999;
private boolean cd = true; private int cd = -99999999;
private int ce = -99999999; private boolean ce = true;
private int cf = 60; private int cf = -99999999;
private ItemStack[] cg = new ItemStack[] { null, null, null, null, null}; private int cg = 60;
private int ch = 0; private ItemStack[] ch = new ItemStack[] { null, null, null, null, null};
private int ci = 0;
public boolean h; public boolean h;
public int i; public int i;
public boolean j = false;
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world); super(world);
@ -51,7 +52,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F); this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.b = minecraftserver; this.b = minecraftserver;
this.bI = 0.0F; this.bM = 0.0F;
this.name = s; this.name = s;
this.height = 0.0F; this.height = 0.0F;
@ -69,7 +70,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
if (nbttagcompound.hasKey("playerGameType")) { if (nbttagcompound.hasKey("playerGameType")) {
this.itemInWorldManager.a(nbttagcompound.e("playerGameType")); this.itemInWorldManager.a(nbttagcompound.f("playerGameType"));
} }
} }
@ -106,38 +107,43 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end // CraftBukkit end
} }
public void b(int i) {
super.b(i);
this.cf = -1;
}
public void syncInventory() { public void syncInventory() {
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public ItemStack[] getEquipment() { public ItemStack[] getEquipment() {
return this.cg; return this.ch;
} }
protected void m_() { protected void w() {
this.height = 0.0F; this.height = 0.0F;
} }
public float t() { public float x() {
return 1.62F; return 1.62F;
} }
public void s_() { public void w_() {
this.itemInWorldManager.c(); this.itemInWorldManager.c();
--this.cf; --this.cg;
this.activeContainer.a(); this.activeContainer.a();
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
ItemStack itemstack = this.b(i); ItemStack itemstack = this.c(i);
if (itemstack != this.cg[i]) { if (itemstack != this.ch[i]) {
this.b.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack)); this.b.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
this.cg[i] = itemstack; this.ch[i] = itemstack;
} }
} }
} }
public ItemStack b(int i) { public ItemStack c(int i) {
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1]; return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
} }
@ -179,7 +185,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public boolean damageEntity(DamageSource damagesource, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
if (this.cf > 0) { if (this.cg > 0) {
return false; return false;
} else { } else {
// CraftBukkit - this.b.pvpMode -> this.world.pvpMode // CraftBukkit - this.b.pvpMode -> this.world.pvpMode
@ -203,21 +209,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
protected boolean n_() { protected boolean y() {
return this.b.pvpMode; return this.b.pvpMode;
} }
public void c(int i) { public void d(int i) {
super.c(i, RegainReason.EATING); super.d(i);
} }
public void b(boolean flag) { public void a(boolean flag) {
super.s_(); super.w_();
for (int i = 0; i < this.inventory.getSize(); ++i) { for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i); ItemStack itemstack = this.inventory.getItem(i);
if (itemstack != null && Item.byId[itemstack.id].i_() && this.netServerHandler.b() <= 2) { if (itemstack != null && Item.byId[itemstack.id].n_() && this.netServerHandler.b() <= 2) {
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this); Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
if (packet != null) { if (packet != null) {
@ -240,31 +246,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
WorldServer worldserver = this.b.getWorldServer(this.dimension); WorldServer worldserver = this.b.getWorldServer(this.dimension);
this.chunkCoordIntPairQueue.remove(chunkcoordintpair); this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
NetServerHandler netserverhandler = this.netServerHandler; this.netServerHandler.sendPacket(new Packet51MapChunk(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, 16, worldserver.height, 16, worldserver));
List list = worldserver.getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, worldserver.height, chunkcoordintpair.z * 16 + 16);
int j = chunkcoordintpair.x * 16; for (int j = 0; j < list.size(); ++j) {
int k = chunkcoordintpair.z * 16; this.a((TileEntity) list.get(j));
worldserver.getClass();
Packet51MapChunk packet51mapchunk = new Packet51MapChunk(j, 0, k, 16, 128, 16, worldserver);
netserverhandler.sendPacket(packet51mapchunk);
int l = chunkcoordintpair.x * 16;
j = chunkcoordintpair.z * 16;
int i1 = chunkcoordintpair.x * 16 + 16;
worldserver.getClass();
List list = worldserver.getTileEntities(l, 0, j, i1, 128, chunkcoordintpair.z * 16 + 16);
for (int j1 = 0; j1 < list.size(); ++j1) {
this.a((TileEntity) list.get(j1));
} }
} }
} }
} }
if (this.I) { if (this.J) {
//if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit //if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
if (this.activeContainer != this.defaultContainer) { if (this.activeContainer != this.defaultContainer) {
this.closeInventory(); this.closeInventory();
@ -273,49 +265,80 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.vehicle != null) { if (this.vehicle != null) {
this.mount(this.vehicle); this.mount(this.vehicle);
} else { } else {
this.J += 0.0125F; this.K += 0.0125F;
if (this.J >= 1.0F) { if (this.K >= 1.0F) {
this.J = 1.0F; this.K = 1.0F;
this.H = 10; this.I = 10;
this.b.serverConfigurationManager.f(this); boolean flag2 = false;
this.ce = -1; byte b0;
this.cb = -1;
if (this.dimension == -1) {
b0 = 0;
} else {
b0 = -1;
}
this.b.serverConfigurationManager.a(this, b0);
this.cf = -1;
this.cc = -1; this.cc = -1;
this.cd = -1;
this.a((Statistic) AchievementList.x);
} }
} }
this.I = false; this.J = false;
//} // CraftBukkit //} // CraftBukkit
} else { } else {
if (this.J > 0.0F) { if (this.K > 0.0F) {
this.J -= 0.05F; this.K -= 0.05F;
} }
if (this.J < 0.0F) { if (this.K < 0.0F) {
this.J = 0.0F; this.K = 0.0F;
} }
} }
if (this.H > 0) { if (this.I > 0) {
--this.H; --this.I;
} }
if (this.health != this.cb || this.cc != this.foodData.a() || this.foodData.c() == 0.0F != this.cd) { if (this.getHealth() != this.cc || this.cd != this.foodData.a() || this.foodData.c() == 0.0F != this.ce) {
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health, this.foodData.a(), this.foodData.c())); this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.c()));
this.cb = this.health; this.cc = this.getHealth();
this.cc = this.foodData.a(); this.cd = this.foodData.a();
this.cd = this.foodData.c() == 0.0F; this.ce = this.foodData.c() == 0.0F;
} }
if (this.expTotal != this.ce) { if (this.exp != this.cf) {
this.ce = this.expTotal; this.cf = this.exp;
this.netServerHandler.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel)); this.netServerHandler.sendPacket(new Packet43SetExperience(this.expLevel, this.exp, this.expTotal));
}
}
public void e(int i) {
if (this.dimension == 1 && i == 1) {
this.a((Statistic) AchievementList.C);
this.world.kill(this);
this.j = true;
this.netServerHandler.sendPacket(new Packet70Bed(4, 0));
} else {
this.a((Statistic) AchievementList.B);
ChunkCoordinates chunkcoordinates = this.b.getWorldServer(i).d();
if (chunkcoordinates != null) {
this.netServerHandler.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
}
this.b.serverConfigurationManager.a(this, 1);
this.cf = -1;
this.cc = -1;
this.cd = -1;
} }
} }
private void a(TileEntity tileentity) { private void a(TileEntity tileentity) {
if (tileentity != null) { if (tileentity != null) {
Packet packet = tileentity.l(); Packet packet = tileentity.k();
if (packet != null) { if (packet != null) {
this.netServerHandler.sendPacket(packet); this.netServerHandler.sendPacket(packet);
@ -344,17 +367,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.a(); this.activeContainer.a();
} }
public void v() { public void r_() {
if (!this.s) { if (!this.t) {
this.t = -1; this.u = -1;
this.s = true; this.t = true;
EntityTracker entitytracker = this.b.getTracker(this.dimension); EntityTracker entitytracker = this.b.getTracker(this.dimension);
entitytracker.a(this, new Packet18ArmAnimation(this, 1)); entitytracker.a(this, new Packet18ArmAnimation(this, 1));
} }
} }
public void w() {} public void A() {}
public EnumBedError a(int i, int j, int k) { public EnumBedError a(int i, int j, int k) {
EnumBedError enumbederror = super.a(i, j, k); EnumBedError enumbederror = super.a(i, j, k);
@ -406,39 +429,55 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.a(d0, flag); super.a(d0, flag);
} }
private void au() { private void aH() {
this.ch = this.ch % 100 + 1; this.ci = this.ci % 100 + 1;
} }
public void b(int i, int j, int k) { public void b(int i, int j, int k) {
this.au(); this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 1, "Crafting", 9)); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 1, "Crafting", 9));
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k); this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
this.activeContainer.windowId = this.ch; this.activeContainer.windowId = this.ci;
this.activeContainer.a((ICrafting) this);
}
public void c(int i, int j, int k) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 4, "Enchanting", 9));
this.activeContainer = new ContainerEnchantTable(this.inventory, this.world, i, j, k);
this.activeContainer.windowId = this.ci;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(IInventory iinventory) { public void a(IInventory iinventory) {
this.au(); this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 0, iinventory.getName(), iinventory.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 0, iinventory.getName(), iinventory.getSize()));
this.activeContainer = new ContainerChest(this.inventory, iinventory); this.activeContainer = new ContainerChest(this.inventory, iinventory);
this.activeContainer.windowId = this.ch; this.activeContainer.windowId = this.ci;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(TileEntityFurnace tileentityfurnace) { public void a(TileEntityFurnace tileentityfurnace) {
this.au(); this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 2, tileentityfurnace.getName(), tileentityfurnace.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace); this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
this.activeContainer.windowId = this.ch; this.activeContainer.windowId = this.ci;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(TileEntityDispenser tileentitydispenser) { public void a(TileEntityDispenser tileentitydispenser) {
this.au(); this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 3, tileentitydispenser.getName(), tileentitydispenser.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser); this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
this.activeContainer.windowId = this.ch; this.activeContainer.windowId = this.ci;
this.activeContainer.a((ICrafting) this);
}
public void a(TileEntityBrewingStand tileentitybrewingstand) {
this.aH();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
this.activeContainer = new ContainerBrewingStand(this.inventory, tileentitybrewingstand);
this.activeContainer.windowId = this.ci;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
@ -467,24 +506,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void closeInventory() { public void closeInventory() {
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId)); this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
this.z(); this.D();
} }
public void y() { public void C() {
if (!this.h) { if (!this.h) {
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l())); this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l()));
} }
} }
public void z() { public void D() {
this.activeContainer.a((EntityHuman) this); this.activeContainer.a((EntityHuman) this);
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
} }
public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) { public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) {
this.aP = f; this.aT = f;
this.aQ = f1; this.aU = f1;
this.aS = flag; this.aW = flag;
this.setSneak(flag1); this.setSneak(flag1);
this.pitch = f2; this.pitch = f2;
this.yaw = f3; this.yaw = f3;
@ -503,7 +542,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void A() { public void E() {
if (this.vehicle != null) { if (this.vehicle != null) {
this.mount(this.vehicle); this.mount(this.vehicle);
} }
@ -517,8 +556,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void B() { public void s_() {
this.cb = -99999999; this.cc = -99999999;
} }
public void a(String s) { public void a(String s) {
@ -528,25 +567,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.netServerHandler.sendPacket(new Packet3Chat(s1)); this.netServerHandler.sendPacket(new Packet3Chat(s1));
} }
protected void C() { protected void G() {
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9)); this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
super.C(); super.G();
} }
public void a(ItemStack itemstack, int i) { public void a(ItemStack itemstack, int i) {
super.a(itemstack, i); super.a(itemstack, i);
if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().b(itemstack) == EnumAnimation.b) { if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().d(itemstack) == EnumAnimation.b) {
EntityTracker entitytracker = this.b.getTracker(this.dimension); EntityTracker entitytracker = this.b.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 5)); entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
} }
} }
protected void a(MobEffect mobeffect) {
super.a(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
}
protected void b(MobEffect mobeffect) { protected void b(MobEffect mobeffect) {
super.b(mobeffect); super.b(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect)); this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
@ -554,9 +588,30 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
protected void c(MobEffect mobeffect) { protected void c(MobEffect mobeffect) {
super.c(mobeffect); super.c(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
}
protected void d(MobEffect mobeffect) {
super.d(mobeffect);
this.netServerHandler.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect)); this.netServerHandler.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
} }
public void a_(double d0, double d1, double d2) {
this.netServerHandler.a(d0, d1, d2, this.yaw, this.pitch);
}
public void c(Entity entity) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
}
public void d(Entity entity) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
}
// CraftBukkit start // CraftBukkit start
public long timeOffset = 0; public long timeOffset = 0;
public boolean relativeTime = true; public boolean relativeTime = true;

Datei anzeigen

@ -0,0 +1,224 @@
package net.minecraft.server;
import java.util.List;
public abstract class EntityProjectile extends Entity {
private int blockX = -1;
private int blockY = -1;
private int blockZ = -1;
private int inBlockId = 0;
protected boolean inGround = false;
public int shake = 0;
public EntityLiving shooter; // CraftBukkit - prot to public
private int h;
private int i = 0;
public EntityProjectile(World world) {
super(world);
this.b(0.25F, 0.25F);
}
protected void b() {}
public EntityProjectile(World world, EntityLiving entityliving) {
super(world);
this.shooter = entityliving;
this.b(0.25F, 0.25F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.x(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.setPosition(this.locX, this.locY, this.locZ);
this.height = 0.0F;
float f = 0.4F;
this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motY = (double) (-MathHelper.sin((this.pitch + this.d()) / 180.0F * 3.1415927F) * f);
this.a(this.motX, this.motY, this.motZ, this.c(), 1.0F);
}
public EntityProjectile(World world, double d0, double d1, double d2) {
super(world);
this.h = 0;
this.b(0.25F, 0.25F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
}
protected float c() {
return 1.5F;
}
protected float d() {
return 0.0F;
}
public void a(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= (double) f2;
d1 /= (double) f2;
d2 /= (double) f2;
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d0 *= (double) f;
d1 *= (double) f;
d2 *= (double) f;
this.motX = d0;
this.motY = d1;
this.motZ = d2;
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.h = 0;
}
public void w_() {
this.bI = this.locX;
this.bJ = this.locY;
this.bK = this.locZ;
super.w_();
if (this.shake > 0) {
--this.shake;
}
if (this.inGround) {
int i = this.world.getTypeId(this.blockX, this.blockY, this.blockZ);
if (i == this.inBlockId) {
++this.h;
if (this.h == 1200) {
this.die();
}
return;
}
this.inGround = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.h = 0;
this.i = 0;
} else {
++this.i;
}
Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
if (!this.world.isStatic) {
Entity entity = null;
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.e_() && (entity1 != this.shooter || this.i >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) {
double d1 = vec3d.b(movingobjectposition1.f);
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null) {
movingobjectposition = new MovingObjectPosition(entity);
}
}
if (movingobjectposition != null) {
this.a(movingobjectposition);
}
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
;
}
while (this.pitch - this.lastPitch >= 180.0F) {
this.lastPitch += 360.0F;
}
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
while (this.yaw - this.lastYaw >= 180.0F) {
this.lastYaw += 360.0F;
}
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.99F;
float f3 = this.e();
if (this.az()) {
for (int k = 0; k < 4; ++k) {
float f4 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
}
f2 = 0.8F;
}
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.motY -= (double) f3;
this.setPosition(this.locX, this.locY, this.locZ);
}
protected float e() {
return 0.03F;
}
protected abstract void a(MovingObjectPosition movingobjectposition);
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.blockX);
nbttagcompound.a("yTile", (short) this.blockY);
nbttagcompound.a("zTile", (short) this.blockZ);
nbttagcompound.a("inTile", (byte) this.inBlockId);
nbttagcompound.a("shake", (byte) this.shake);
nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0));
}
public void a(NBTTagCompound nbttagcompound) {
this.blockX = nbttagcompound.e("xTile");
this.blockY = nbttagcompound.e("yTile");
this.blockZ = nbttagcompound.e("zTile");
this.inBlockId = nbttagcompound.d("inTile") & 255;
this.shake = nbttagcompound.d("shake") & 255;
this.inGround = nbttagcompound.d("inGround") == 1;
}
public void a_(EntityHuman entityhuman) {}
}

Datei anzeigen

@ -13,12 +13,16 @@ public class EntitySheep extends EntityAnimal {
this.b(0.9F, 1.3F); this.b(0.9F, 1.3F);
} }
public int getMaxHealth() {
return 8;
}
protected void b() { protected void b() {
super.b(); super.b();
this.datawatcher.a(16, new Byte((byte) 0)); this.datawatcher.a(16, new Byte((byte) 0));
} }
protected void a(boolean flag) { protected void a(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
@ -30,7 +34,7 @@ public class EntitySheep extends EntityAnimal {
// CraftBukkit end // CraftBukkit end
} }
protected int k() { protected int e() {
return Block.WOOL.id; return Block.WOOL.id;
} }
@ -54,7 +58,7 @@ public class EntitySheep extends EntityAnimal {
itemstack.damage(1, entityhuman); itemstack.damage(1, entityhuman);
} }
return false; return super.b(entityhuman);
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
@ -65,19 +69,19 @@ public class EntitySheep extends EntityAnimal {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setSheared(nbttagcompound.m("Sheared")); this.setSheared(nbttagcompound.n("Sheared"));
this.setColor(nbttagcompound.c("Color")); this.setColor(nbttagcompound.d("Color"));
} }
protected String h() { protected String c_() {
return "mob.sheep"; return "mob.sheep";
} }
protected String i() { protected String m() {
return "mob.sheep"; return "mob.sheep";
} }
protected String j() { protected String n() {
return "mob.sheep"; return "mob.sheep";
} }
@ -110,4 +114,17 @@ public class EntitySheep extends EntityAnimal {
return i < 5 ? 15 : (i < 10 ? 7 : (i < 15 ? 8 : (i < 18 ? 12 : (random.nextInt(500) == 0 ? 6 : 0)))); return i < 5 ? 15 : (i < 10 ? 7 : (i < 15 ? 8 : (i < 18 ? 12 : (random.nextInt(500) == 0 ? 6 : 0))));
} }
protected EntityAnimal createChild(EntityAnimal entityanimal) {
EntitySheep entitysheep = (EntitySheep) entityanimal;
EntitySheep entitysheep1 = new EntitySheep(this.world);
if (this.random.nextBoolean()) {
entitysheep1.setColor(this.getColor());
} else {
entitysheep1.setColor(entitysheep.getColor());
}
return entitysheep1;
}
} }

Datei anzeigen

@ -1,128 +0,0 @@
package net.minecraft.server;
public class EntitySilverfish extends EntityMonster {
private int a;
public EntitySilverfish(World world) {
super(world);
this.texture = "/mob/silverfish.png";
this.b(0.3F, 0.7F);
this.aU = 0.6F;
this.damage = 1; // CraftBukkit - 0 -> 1, temporary fix for Silverfish base damage.
}
protected boolean e_() {
return false;
}
protected Entity findTarget() {
double d0 = 8.0D;
return this.world.findNearbyPlayer(this, d0);
}
protected String h() {
return "mob.spider";
}
protected String i() {
return "mob.spider";
}
protected String j() {
return "mob.spiderdeath";
}
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.a <= 0 && damagesource instanceof EntityDamageSource) {
this.a = 20;
}
return super.damageEntity(damagesource, i);
}
protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 1.2F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
entity.damageEntity(DamageSource.mobAttack(this), this.damage);
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
}
protected int k() {
return 0;
}
public void s_() {
this.U = this.yaw;
super.s_();
}
protected void c_() {
super.c_();
if (!this.world.isStatic) {
int i;
int j;
int k;
int l;
if (this.a > 0) {
--this.a;
if (this.a == 0) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
boolean flag = false;
for (l = 0; !flag && l <= 5 && l >= -5; l = l <= 0 ? 1 - l : 0 - l) {
for (int i1 = 0; !flag && i1 <= 10 && i1 >= -10; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) {
for (int j1 = 0; !flag && j1 <= 10 && j1 >= -10; j1 = j1 <= 0 ? 1 - j1 : 0 - j1) {
int k1 = this.world.getTypeId(i + i1, j + l, k + j1);
if (k1 == Block.MONSTER_EGGS.id) {
this.world.e(2001, i + i1, j + l, k + j1, Block.MONSTER_EGGS.id + this.world.getData(i + i1, j + l, k + j1) * 256);
this.world.setTypeId(i + i1, j + l, k + j1, 0);
Block.MONSTER_EGGS.postBreak(this.world, i + i1, j + l, k + j1, 0);
if (this.random.nextBoolean()) {
flag = true;
break;
}
}
}
}
}
}
}
if (this.target == null && !this.B()) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY + 0.5D);
k = MathHelper.floor(this.locZ);
int l1 = this.random.nextInt(6);
l = this.world.getTypeId(i + PistonBlockTextures.b[l1], j + PistonBlockTextures.c[l1], k + PistonBlockTextures.d[l1]);
if (BlockMonsterEggs.c(l)) {
this.world.setTypeIdAndData(i + PistonBlockTextures.b[l1], j + PistonBlockTextures.c[l1], k + PistonBlockTextures.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.d(l));
this.ab();
this.die();
} else {
this.A();
}
} else if (this.target != null && !this.B()) {
this.target = null;
}
}
}
protected float a(int i, int j, int k) {
return this.world.getTypeId(i, j - 1, k) == Block.STONE.id ? 10.0F : super.a(i, j, k);
}
}

Datei anzeigen

@ -14,15 +14,19 @@ public class EntitySkeleton extends EntityMonster {
this.texture = "/mob/skeleton.png"; this.texture = "/mob/skeleton.png";
} }
protected String h() { public int getMaxHealth() {
return 20;
}
protected String c_() {
return "mob.skeleton"; return "mob.skeleton";
} }
protected String i() { protected String m() {
return "mob.skeletonhurt"; return "mob.skeletonhurt";
} }
protected String j() { protected String n() {
return "mob.skeletonhurt"; return "mob.skeletonhurt";
} }
@ -32,7 +36,7 @@ public class EntitySkeleton extends EntityMonster {
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
super.die(damagesource); super.die(damagesource);
if (damagesource.e() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) { if (damagesource.g() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity(); EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX; double d0 = entityhuman.locX - this.locX;
double d1 = entityhuman.locZ - this.locZ; double d1 = entityhuman.locZ - this.locZ;
@ -43,9 +47,9 @@ public class EntitySkeleton extends EntityMonster {
} }
} }
public void s() { public void d() {
if (this.world.d() && !this.world.isStatic) { if (this.world.e() && !this.world.isStatic) {
float f = this.a_(1.0F); float f = this.a(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start // CraftBukkit start
@ -53,13 +57,13 @@ public class EntitySkeleton extends EntityMonster {
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.fireTicks = 300; this.j(8);
} }
// CraftBukkit end // CraftBukkit end
} }
} }
super.s(); super.d();
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
@ -69,7 +73,7 @@ public class EntitySkeleton extends EntityMonster {
if (this.attackTicks == 0) { if (this.attackTicks == 0) {
EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F); EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F);
double d2 = entity.locY + (double) entity.t() - 0.699999988079071D - entityarrow.locY; double d2 = entity.locY + (double) entity.x() - 0.699999988079071D - entityarrow.locY;
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F; float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F)); this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
@ -91,20 +95,20 @@ public class EntitySkeleton extends EntityMonster {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected int k() { protected int e() {
return Item.ARROW.id; return Item.ARROW.id;
} }
protected void a(boolean flag) { protected void a(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(3); int count = this.random.nextInt(3 + i);
if (count > 0) { if (count > 0) {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.ARROW, count)); loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.ARROW, count));
} }
count = this.random.nextInt(3); count = this.random.nextInt(3 + i);
if (count > 0) { if (count > 0) {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.BONE, count)); loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.BONE, count));
} }
@ -112,4 +116,8 @@ public class EntitySkeleton extends EntityMonster {
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot); org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end // CraftBukkit end
} }
public EnchantmentDamage t() {
return EnchantmentDamage.b;
}
} }

Datei anzeigen

@ -4,6 +4,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
public float a; public float a;
public float b; public float b;
public float c;
private int size = 0; private int size = 0;
public EntitySlime(World world) { public EntitySlime(World world) {
@ -14,7 +15,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.height = 0.0F; this.height = 0.0F;
this.size = this.random.nextInt(20) + 10; this.size = this.random.nextInt(20) + 10;
this.setSize(i); this.setSize(i);
this.ax = i; this.az = i;
} }
protected void b() { protected void b() {
@ -25,8 +26,14 @@ public class EntitySlime extends EntityLiving implements IMonster {
public void setSize(int i) { public void setSize(int i) {
this.datawatcher.watch(16, new Byte((byte) i)); this.datawatcher.watch(16, new Byte((byte) i));
this.b(0.6F * (float) i, 0.6F * (float) i); this.b(0.6F * (float) i, 0.6F * (float) i);
this.health = i * i;
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
this.setHealth(this.getMaxHealth());
}
public int getMaxHealth() {
int i = this.getSize();
return i * i;
} }
public int getSize() { public int getSize() {
@ -40,14 +47,27 @@ public class EntitySlime extends EntityLiving implements IMonster {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setSize(nbttagcompound.e("Size") + 1); this.setSize(nbttagcompound.f("Size") + 1);
} }
public void s_() { protected String w() {
this.b = this.a; return "slime";
}
protected String E() {
return "mob.slime";
}
public void w_() {
if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
this.dead = true;
}
this.b += (this.a - this.b) * 0.5F;
this.c = this.b;
boolean flag = this.onGround; boolean flag = this.onGround;
super.s_(); super.w_();
if (this.onGround && !flag) { if (this.onGround && !flag) {
int i = this.getSize(); int i = this.getSize();
@ -57,101 +77,142 @@ public class EntitySlime extends EntityLiving implements IMonster {
float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1; float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1; float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
this.world.a("slime", this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D); this.world.a(this.w(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
} }
if (i > 2) { if (this.G()) {
this.world.makeSound(this, "mob.slime", this.l(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); this.world.makeSound(this, this.E(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
} }
this.a = -0.5F; this.a = -0.5F;
} }
this.a *= 0.6F; this.B();
} }
protected void c_() { protected void m_() {
this.ad(); this.ak();
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D); EntityHuman entityhuman = this.world.b(this, 16.0D);
if (entityhuman != null) { if (entityhuman != null) {
this.a(entityhuman, 10.0F, 20.0F); this.a(entityhuman, 10.0F, 20.0F);
} }
if (this.onGround && this.size-- <= 0) { if (this.onGround && this.size-- <= 0) {
this.size = this.random.nextInt(20) + 10; this.size = this.A();
if (entityhuman != null) { if (entityhuman != null) {
this.size /= 3; this.size /= 3;
} }
this.aS = true; this.aW = true;
if (this.getSize() > 1) { if (this.I()) {
this.world.makeSound(this, "mob.slime", this.l(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F); this.world.makeSound(this, this.E(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
} }
this.a = 1.0F; this.a = 1.0F;
this.aP = 1.0F - this.random.nextFloat() * 2.0F; this.aT = 1.0F - this.random.nextFloat() * 2.0F;
this.aQ = (float) (1 * this.getSize()); this.aU = (float) (1 * this.getSize());
} else { } else {
this.aS = false; this.aW = false;
if (this.onGround) { if (this.onGround) {
this.aP = this.aQ = 0.0F; this.aT = this.aU = 0.0F;
} }
} }
} }
protected void B() {
this.a *= 0.6F;
}
protected int A() {
return this.random.nextInt(20) + 10;
}
protected EntitySlime y() {
return new EntitySlime(this.world);
}
public void die() { public void die() {
int i = this.getSize(); int i = this.getSize();
if (!this.world.isStatic && i > 1 && this.health == 0) { if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
int j = 2 + this.random.nextInt(3);
// CraftBukkit start // CraftBukkit start
org.bukkit.event.entity.SlimeSplitEvent event = new org.bukkit.event.entity.SlimeSplitEvent(this.getBukkitEntity(), 4); org.bukkit.event.entity.SlimeSplitEvent event = new org.bukkit.event.entity.SlimeSplitEvent(this.getBukkitEntity(), j);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getCount() > 0) { if (!event.isCancelled() && event.getCount() > 0) {
for (int j = 0; j < event.getCount(); ++j) { j = event.getCount();
float f = ((float) (j % 2) - 0.5F) * (float) i / 4.0F; } else {
float f1 = ((float) (j / 2) - 0.5F) * (float) i / 4.0F; super.die();
EntitySlime entityslime = new EntitySlime(this.world); return;
}
// CraftBukkit end
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
EntitySlime entityslime = this.y();
entityslime.setSize(i / 2); entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F); entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
this.world.addEntity(entityslime); this.world.addEntity(entityslime);
} }
} }
// CraftBukkit end
}
super.die(); super.die();
} }
public void a_(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {
if (this.C()) {
int i = this.getSize(); int i = this.getSize();
if (i > 1 && this.f(entityhuman) && (double) this.g(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), i)) { if (this.g(entityhuman) && (double) this.h(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.D())) {
this.world.makeSound(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.makeSound(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
} }
}
protected String i() { protected boolean C() {
return this.getSize() > 1;
}
protected int D() {
return this.getSize();
}
protected String m() {
return "mob.slime"; return "mob.slime";
} }
protected String j() { protected String n() {
return "mob.slime"; return "mob.slime";
} }
protected int k() { protected int e() {
return this.getSize() == 1 ? Item.SLIME_BALL.id : 0; return this.getSize() == 1 ? Item.SLIME_BALL.id : 0;
} }
public boolean d() { public boolean g() {
Chunk chunk = this.world.getChunkAtWorldCoords(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); Chunk chunk = this.world.getChunkAtWorldCoords(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
return (this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 16.0D; return (this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.g() : false;
} }
protected float l() { protected float o() {
return 0.6F; return 0.4F * (float) this.getSize();
}
protected int q_() {
return 0;
}
protected boolean I() {
return this.getSize() > 1;
}
protected boolean G() {
return this.getSize() > 2;
} }
} }

Datei anzeigen

@ -1,7 +1,5 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
@ -10,248 +8,65 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
// CraftBukkit end // CraftBukkit end
public class EntitySnowball extends Entity { public class EntitySnowball extends EntityProjectile {
private int b = -1;
private int c = -1;
private int d = -1;
private int e = 0;
private boolean f = false;
public int a = 0;
public EntityLiving shooter; // CraftBukkit - private -> public
private int h;
private int i = 0;
public EntitySnowball(World world) { public EntitySnowball(World world) {
super(world); super(world);
this.b(0.25F, 0.25F);
} }
protected void b() {}
public EntitySnowball(World world, EntityLiving entityliving) { public EntitySnowball(World world, EntityLiving entityliving) {
super(world); super(world, entityliving);
this.shooter = entityliving;
this.b(0.25F, 0.25F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.t(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.setPosition(this.locX, this.locY, this.locZ);
this.height = 0.0F;
float f = 0.4F;
this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F) * f);
this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F) * f);
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
} }
public EntitySnowball(World world, double d0, double d1, double d2) { public EntitySnowball(World world, double d0, double d1, double d2) {
super(world); super(world, d0, d1, d2);
this.h = 0;
this.b(0.25F, 0.25F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
} }
public void a(double d0, double d1, double d2, float f, float f1) { protected void a(MovingObjectPosition movingobjectposition) {
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2); if (movingobjectposition.entity != null) {
byte b0 = 0;
d0 /= (double) f2; if (movingobjectposition.entity instanceof EntityBlaze) {
d1 /= (double) f2; b0 = 3;
d2 /= (double) f2;
d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
d0 *= (double) f;
d1 *= (double) f;
d2 *= (double) f;
this.motX = d0;
this.motY = d1;
this.motZ = d2;
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.h = 0;
} }
public void s_() {
this.bE = this.locX;
this.bF = this.locY;
this.bG = this.locZ;
super.s_();
if (this.a > 0) {
--this.a;
}
if (this.f) {
int i = this.world.getTypeId(this.b, this.c, this.d);
if (i == this.e) {
++this.h;
if (this.h == 1200) {
this.die();
}
return;
}
this.f = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.h = 0;
this.i = 0;
} else {
++this.i;
}
Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c);
}
if (!this.world.isStatic) {
Entity entity = null;
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.r_() && (entity1 != this.shooter || this.i >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) {
double d1 = vec3d.b(movingobjectposition1.f);
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null) {
movingobjectposition = new MovingObjectPosition(entity);
}
}
if (movingobjectposition != null) {
// CraftBukkit start // CraftBukkit start
ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity()); ProjectileHitEvent hitEvent = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(phe); this.world.getServer().getPluginManager().callEvent(hitEvent);
boolean stick = false;
if (movingobjectposition.entity != null) { if (movingobjectposition.entity != null) {
boolean stick;
if (movingobjectposition.entity instanceof EntityLiving) { if (movingobjectposition.entity instanceof EntityLiving) {
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
Projectile projectile = (Projectile) this.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity();
// TODO @see EntityArrow#162 // TODO @see EntityArrow#162
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0); EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, b0);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle(); this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
b0 = (byte) event.getDamage();
if (event.isCancelled()) { if (event.isCancelled()) {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the snowball should stick in or not, i.e. !bounce // this function returns if the snowball should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), b0);
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0); stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), b0);
} }
}
if (stick) { if (stick) {
// CraftBukkit end
; ;
} }
} }
// CraftBukkit end
for (int k = 0; k < 8; ++k) { for (int i = 0; i < 8; ++i) {
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D); this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
} }
this.die(); if (!this.world.isStatic) {
}
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
;
}
while (this.pitch - this.lastPitch >= 180.0F) {
this.lastPitch += 360.0F;
}
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
while (this.yaw - this.lastYaw >= 180.0F) {
this.lastYaw += 360.0F;
}
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.99F;
float f3 = 0.03F;
if (this.ao()) {
for (int l = 0; l < 4; ++l) {
float f4 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
}
f2 = 0.8F;
}
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.motY -= (double) f3;
this.setPosition(this.locX, this.locY, this.locZ);
}
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.b);
nbttagcompound.a("yTile", (short) this.c);
nbttagcompound.a("zTile", (short) this.d);
nbttagcompound.a("inTile", (byte) this.e);
nbttagcompound.a("shake", (byte) this.a);
nbttagcompound.a("inGround", (byte) (this.f ? 1 : 0));
}
public void a(NBTTagCompound nbttagcompound) {
this.b = nbttagcompound.d("xTile");
this.c = nbttagcompound.d("yTile");
this.d = nbttagcompound.d("zTile");
this.e = nbttagcompound.c("inTile") & 255;
this.a = nbttagcompound.c("shake") & 255;
this.f = nbttagcompound.c("inGround") == 1;
}
public void a_(EntityHuman entityhuman) {
if (this.f && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, 1);
this.die(); this.die();
} }
} }

Datei anzeigen

@ -11,43 +11,63 @@ public class EntitySpider extends EntityMonster {
super(world); super(world);
this.texture = "/mob/spider.png"; this.texture = "/mob/spider.png";
this.b(1.4F, 0.9F); this.b(1.4F, 0.9F);
this.aU = 0.8F; this.aY = 0.8F;
} }
public double n() { protected void b() {
super.b();
this.datawatcher.a(16, new Byte((byte) 0));
}
public void d() {
super.d();
}
public void w_() {
super.w_();
if (!this.world.isStatic) {
this.a(this.positionChanged);
}
}
public int getMaxHealth() {
return 16;
}
public double q() {
return (double) this.width * 0.75D - 0.5D; return (double) this.width * 0.75D - 0.5D;
} }
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
protected Entity findTarget() { protected Entity findTarget() {
float f = this.a_(1.0F); float f = this.a(1.0F);
if (f < 0.5F) { if (f < 0.5F) {
double d0 = 16.0D; double d0 = 16.0D;
return this.world.findNearbyPlayer(this, d0); return this.world.b(this, d0);
} else { } else {
return null; return null;
} }
} }
protected String h() { protected String c_() {
return "mob.spider"; return "mob.spider";
} }
protected String i() { protected String m() {
return "mob.spider"; return "mob.spider";
} }
protected String j() { protected String n() {
return "mob.spiderdeath"; return "mob.spiderdeath";
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
float f1 = this.a_(1.0F); float f1 = this.a(1.0F);
if (f1 > 0.5F && this.random.nextInt(100) == 0) { if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start // CraftBukkit start
@ -88,13 +108,44 @@ public class EntitySpider extends EntityMonster {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected int k() { protected int e() {
return Item.STRING.id; return Item.STRING.id;
} }
public boolean p() { protected void a(boolean flag, int i) {
return this.positionChanged; super.a(flag, i);
if (flag && (this.random.nextInt(3) == 0 || this.random.nextInt(1 + i) > 0)) {
this.b(Item.SPIDER_EYE.id, 1);
}
} }
public void q() {} public boolean r() {
return this.o_();
}
public void s() {}
public EnchantmentDamage t() {
return EnchantmentDamage.c;
}
public boolean a(MobEffect mobeffect) {
return mobeffect.getEffectId() == MobEffectList.POISON.id ? false : super.a(mobeffect);
}
public boolean o_() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
public void a(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
b0 = (byte) (b0 | 1);
} else {
b0 &= -2;
}
this.datawatcher.watch(16, Byte.valueOf(b0));
}
} }

Datei anzeigen

@ -26,6 +26,10 @@ public class EntitySquid extends EntityWaterAnimal {
this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
} }
public int getMaxHealth() {
return 10;
}
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
} }
@ -34,31 +38,31 @@ public class EntitySquid extends EntityWaterAnimal {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected String h() { protected String c_() {
return null; return null;
} }
protected String i() { protected String m() {
return null; return null;
} }
protected String j() { protected String n() {
return null; return null;
} }
protected float l() { protected float o() {
return 0.4F; return 0.4F;
} }
protected int k() { protected int e() {
return 0; return 0;
} }
protected void a(boolean flag) { protected void a(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(3) + 1; int count = this.random.nextInt(3 + i) + 1;
if (count > 0) { if (count > 0) {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.INK_SACK, count)); loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.INK_SACK, count));
} }
@ -68,15 +72,15 @@ public class EntitySquid extends EntityWaterAnimal {
} }
public boolean b(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
return false; return super.b(entityhuman);
} }
public boolean ao() { public boolean az() {
return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this); return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
} }
public void s() { public void d() {
super.s(); super.d();
this.b = this.a; this.b = this.a;
this.g = this.c; this.g = this.c;
this.i = this.h; this.i = this.h;
@ -89,7 +93,7 @@ public class EntitySquid extends EntityWaterAnimal {
} }
} }
if (this.ao()) { if (this.az()) {
float f; float f;
if (this.h < 3.1415927F) { if (this.h < 3.1415927F) {
@ -107,20 +111,20 @@ public class EntitySquid extends EntityWaterAnimal {
this.n *= 0.99F; this.n *= 0.99F;
} }
if (!this.ai) { if (!this.aj) {
this.motX = (double) (this.o * this.l); this.motX = (double) (this.o * this.l);
this.motY = (double) (this.p * this.l); this.motY = (double) (this.p * this.l);
this.motZ = (double) (this.q * this.l); this.motZ = (double) (this.q * this.l);
} }
f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
this.U += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.U) * 0.1F; this.V += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.V) * 0.1F;
this.yaw = this.U; this.yaw = this.V;
this.c += 3.1415927F * this.n * 1.5F; this.c += 3.1415927F * this.n * 1.5F;
this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F; this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
} else { } else {
this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F; this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
if (!this.ai) { if (!this.aj) {
this.motX = 0.0D; this.motX = 0.0D;
this.motY -= 0.08D; this.motY -= 0.08D;
this.motY *= 0.9800000190734863D; this.motY *= 0.9800000190734863D;
@ -135,8 +139,11 @@ public class EntitySquid extends EntityWaterAnimal {
this.move(this.motX, this.motY, this.motZ); this.move(this.motX, this.motY, this.motZ);
} }
protected void c_() { protected void m_() {
if (this.random.nextInt(50) == 0 || !this.bQ || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) { ++this.aS;
if (this.aS > 100) {
this.o = this.p = this.q = 0.0F;
} else if (this.random.nextInt(50) == 0 || !this.bS || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F; float f = this.random.nextFloat() * 3.1415927F * 2.0F;
this.o = MathHelper.cos(f) * 0.2F; this.o = MathHelper.cos(f) * 0.2F;
@ -144,6 +151,10 @@ public class EntitySquid extends EntityWaterAnimal {
this.q = MathHelper.sin(f) * 0.2F; this.q = MathHelper.sin(f) * 0.2F;
} }
this.ad(); this.ak();
}
public boolean g() {
return this.locY > 45.0D && this.locY < (double) this.world.seaLevel && super.g();
} }
} }

Datei anzeigen

@ -16,7 +16,7 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world) { public EntityTNTPrimed(World world) {
super(world); super(world);
this.fuseTicks = 0; this.fuseTicks = 0;
this.aY = true; this.bc = true;
this.b(0.98F, 0.98F); this.b(0.98F, 0.98F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
} }
@ -37,15 +37,15 @@ public class EntityTNTPrimed extends Entity {
protected void b() {} protected void b() {}
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
public boolean r_() { public boolean e_() {
return !this.dead; return !this.dead;
} }
public void s_() { public void w_() {
this.lastX = this.locX; this.lastX = this.locX;
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;
@ -95,6 +95,6 @@ public class EntityTNTPrimed extends Entity {
} }
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {
this.fuseTicks = nbttagcompound.c("Fuse"); this.fuseTicks = nbttagcompound.d("Fuse");
} }
} }

Datei anzeigen

@ -37,21 +37,31 @@ public class EntityTracker {
this.addEntity(entity, 64, 5, true); this.addEntity(entity, 64, 5, true);
} else if (entity instanceof EntityArrow) { } else if (entity instanceof EntityArrow) {
this.addEntity(entity, 64, 20, false); this.addEntity(entity, 64, 20, false);
} else if (entity instanceof EntitySmallFireball) {
this.addEntity(entity, 64, 10, false);
} else if (entity instanceof EntityFireball) { } else if (entity instanceof EntityFireball) {
this.addEntity(entity, 64, 10, false); this.addEntity(entity, 64, 10, false);
} else if (entity instanceof EntitySnowball) { } else if (entity instanceof EntitySnowball) {
this.addEntity(entity, 64, 10, true); this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityEnderPearl) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityEnderSignal) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityEgg) { } else if (entity instanceof EntityEgg) {
this.addEntity(entity, 64, 10, true); this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityPotion) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityItem) { } else if (entity instanceof EntityItem) {
this.addEntity(entity, 64, 20, true); this.addEntity(entity, 64, 20, true);
} else if (entity instanceof EntityMinecart) { } else if (entity instanceof EntityMinecart) {
this.addEntity(entity, 160, 5, true); this.addEntity(entity, 80, 3, true);
} else if (entity instanceof EntityBoat) { } else if (entity instanceof EntityBoat) {
this.addEntity(entity, 160, 5, true); this.addEntity(entity, 80, 3, true);
} else if (entity instanceof EntitySquid) { } else if (entity instanceof EntitySquid) {
this.addEntity(entity, 160, 3, true); this.addEntity(entity, 64, 3, true);
} else if (entity instanceof IAnimal) { } else if (entity instanceof IAnimal) {
this.addEntity(entity, 80, 3, true);
} else if (entity instanceof EntityEnderDragon) {
this.addEntity(entity, 160, 3, true); this.addEntity(entity, 160, 3, true);
} else if (entity instanceof EntityTNTPrimed) { } else if (entity instanceof EntityTNTPrimed) {
this.addEntity(entity, 160, 10, true); this.addEntity(entity, 160, 10, true);
@ -61,6 +71,8 @@ public class EntityTracker {
this.addEntity(entity, 160, Integer.MAX_VALUE, false); this.addEntity(entity, 160, Integer.MAX_VALUE, false);
} else if (entity instanceof EntityExperienceOrb) { } else if (entity instanceof EntityExperienceOrb) {
this.addEntity(entity, 160, 20, true); this.addEntity(entity, 160, 20, true);
} else if (entity instanceof EntityEnderCrystal) {
this.addEntity(entity, 256, Integer.MAX_VALUE, false);
} }
} }

Datei anzeigen

@ -60,7 +60,7 @@ public class EntityTrackerEntry {
} }
++this.t; ++this.t;
if (++this.l % this.c == 0 || this.tracker.ca) { if (++this.l % this.c == 0 || this.tracker.cb) {
int i = MathHelper.floor(this.tracker.locX * 32.0D); int i = MathHelper.floor(this.tracker.locX * 32.0D);
int j = MathHelper.floor(this.tracker.locY * 32.0D); int j = MathHelper.floor(this.tracker.locY * 32.0D);
int k = MathHelper.floor(this.tracker.locZ * 32.0D); int k = MathHelper.floor(this.tracker.locZ * 32.0D);
@ -70,8 +70,8 @@ public class EntityTrackerEntry {
int k1 = j - this.e; int k1 = j - this.e;
int l1 = k - this.f; int l1 = k - this.f;
Object object = null; Object object = null;
boolean flag = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8; boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4;
boolean flag1 = Math.abs(l - this.g) >= 8 || Math.abs(i1 - this.h) >= 8; boolean flag1 = Math.abs(l - this.g) >= 4 || Math.abs(i1 - this.h) >= 4;
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.t <= 400) { if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.t <= 400) {
if (flag && flag1) { if (flag && flag1) {
@ -126,7 +126,7 @@ public class EntityTrackerEntry {
} }
} }
this.tracker.ca = false; this.tracker.cb = false;
if (this.tracker.velocityChanged) { if (this.tracker.velocityChanged) {
// CraftBukkit start - create PlayerVelocity event // CraftBukkit start - create PlayerVelocity event
boolean cancelled = false; boolean cancelled = false;
@ -140,8 +140,7 @@ public class EntityTrackerEntry {
if (event.isCancelled()) { if (event.isCancelled()) {
cancelled = true; cancelled = true;
} } else if (!velocity.equals(event.getVelocity())) {
else if(!velocity.equals(event.getVelocity())) {
player.setVelocity(velocity); player.setVelocity(velocity);
} }
} }
@ -235,6 +234,10 @@ public class EntityTrackerEntry {
} }
private Packet b() { private Packet b() {
if (this.tracker.dead) {
System.out.println("Fetching addPacket for removed entity");
}
if (this.tracker instanceof EntityItem) { if (this.tracker instanceof EntityItem) {
EntityItem entityitem = (EntityItem) this.tracker; EntityItem entityitem = (EntityItem) this.tracker;
Packet21PickupSpawn packet21pickupspawn = new Packet21PickupSpawn(entityitem); Packet21PickupSpawn packet21pickupspawn = new Packet21PickupSpawn(entityitem);
@ -271,6 +274,8 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.tracker, 1); return new Packet23VehicleSpawn(this.tracker, 1);
} else if (this.tracker instanceof IAnimal) { } else if (this.tracker instanceof IAnimal) {
return new Packet24MobSpawn((EntityLiving) this.tracker); return new Packet24MobSpawn((EntityLiving) this.tracker);
} else if (this.tracker instanceof EntityEnderDragon) {
return new Packet24MobSpawn((EntityLiving) this.tracker);
} else if (this.tracker instanceof EntityFishingHook) { } else if (this.tracker instanceof EntityFishingHook) {
return new Packet23VehicleSpawn(this.tracker, 90); return new Packet23VehicleSpawn(this.tracker, 90);
} else if (this.tracker instanceof EntityArrow) { } else if (this.tracker instanceof EntityArrow) {
@ -279,12 +284,38 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id); return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
} else if (this.tracker instanceof EntitySnowball) { } else if (this.tracker instanceof EntitySnowball) {
return new Packet23VehicleSpawn(this.tracker, 61); return new Packet23VehicleSpawn(this.tracker, 61);
} else if (this.tracker instanceof EntityPotion) {
return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).f());
} else if (this.tracker instanceof EntityEnderPearl) {
return new Packet23VehicleSpawn(this.tracker, 65);
} else if (this.tracker instanceof EntityEnderSignal) {
return new Packet23VehicleSpawn(this.tracker, 72);
} else {
Packet23VehicleSpawn packet23vehiclespawn;
if (this.tracker instanceof EntitySmallFireball) {
EntitySmallFireball entitysmallfireball = (EntitySmallFireball) this.tracker;
packet23vehiclespawn = null;
if (entitysmallfireball.shooter != null) {
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, entitysmallfireball.shooter.id);
} else {
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, 0);
}
packet23vehiclespawn.e = (int) (entitysmallfireball.dirX * 8000.0D);
packet23vehiclespawn.f = (int) (entitysmallfireball.dirY * 8000.0D);
packet23vehiclespawn.g = (int) (entitysmallfireball.dirZ * 8000.0D);
return packet23vehiclespawn;
} else if (this.tracker instanceof EntityFireball) { } else if (this.tracker instanceof EntityFireball) {
EntityFireball entityfireball = (EntityFireball) this.tracker; EntityFireball entityfireball = (EntityFireball) this.tracker;
// CraftBukkit start - added check for null shooter
int shooter = ((EntityFireball) this.tracker).shooter != null ? ((EntityFireball) this.tracker).shooter.id : 1; packet23vehiclespawn = null;
Packet23VehicleSpawn packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, shooter); if (entityfireball.shooter != null) {
// CraftBukkit end packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
} else {
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, 0);
}
packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D); packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D); packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
@ -294,6 +325,8 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.tracker, 62); return new Packet23VehicleSpawn(this.tracker, 62);
} else if (this.tracker instanceof EntityTNTPrimed) { } else if (this.tracker instanceof EntityTNTPrimed) {
return new Packet23VehicleSpawn(this.tracker, 50); return new Packet23VehicleSpawn(this.tracker, 50);
} else if (this.tracker instanceof EntityEnderCrystal) {
return new Packet23VehicleSpawn(this.tracker, 51);
} else { } else {
if (this.tracker instanceof EntityFallingSand) { if (this.tracker instanceof EntityFallingSand) {
EntityFallingSand entityfallingsand = (EntityFallingSand) this.tracker; EntityFallingSand entityfallingsand = (EntityFallingSand) this.tracker;
@ -305,6 +338,10 @@ public class EntityTrackerEntry {
if (entityfallingsand.a == Block.GRAVEL.id) { if (entityfallingsand.a == Block.GRAVEL.id) {
return new Packet23VehicleSpawn(this.tracker, 71); return new Packet23VehicleSpawn(this.tracker, 71);
} }
if (entityfallingsand.a == Block.DRAGON_EGG.id) {
return new Packet23VehicleSpawn(this.tracker, 74);
}
} }
if (this.tracker instanceof EntityPainting) { if (this.tracker instanceof EntityPainting) {
@ -317,6 +354,7 @@ public class EntityTrackerEntry {
} }
} }
} }
}
public void c(EntityPlayer entityplayer) { public void c(EntityPlayer entityplayer) {
if (this.trackedPlayers.contains(entityplayer)) { if (this.trackedPlayers.contains(entityplayer)) {

Datei anzeigen

@ -86,9 +86,17 @@ public class EntityTypes {
static { static {
a(EntityItem.class, "Item", 1); a(EntityItem.class, "Item", 1);
a(EntityExperienceOrb.class, "XPOrb", 2); a(EntityExperienceOrb.class, "XPOrb", 2);
a(EntityPainting.class, "Painting", 9);
a(EntityArrow.class, "Arrow", 10); a(EntityArrow.class, "Arrow", 10);
a(EntitySnowball.class, "Snowball", 11); a(EntitySnowball.class, "Snowball", 11);
a(EntityPainting.class, "Painting", 9); a(EntityFireball.class, "Fireball", 12);
a(EntitySmallFireball.class, "SmallFireball", 13);
a(EntityEnderPearl.class, "ThrownEnderpearl", 14);
a(EntityEnderSignal.class, "EyeOfEnderSignal", 15);
a(EntityTNTPrimed.class, "PrimedTnt", 20);
a(EntityFallingSand.class, "FallingSand", 21);
a(EntityMinecart.class, "Minecart", 40);
a(EntityBoat.class, "Boat", 41);
a(EntityLiving.class, "Mob", 48); a(EntityLiving.class, "Mob", 48);
a(EntityMonster.class, "Monster", 49); a(EntityMonster.class, "Monster", 49);
a(EntityCreeper.class, "Creeper", 50); a(EntityCreeper.class, "Creeper", 50);
@ -102,15 +110,18 @@ public class EntityTypes {
a(EntityEnderman.class, "Enderman", 58); a(EntityEnderman.class, "Enderman", 58);
a(EntityCaveSpider.class, "CaveSpider", 59); a(EntityCaveSpider.class, "CaveSpider", 59);
a(EntitySilverfish.class, "Silverfish", 60); a(EntitySilverfish.class, "Silverfish", 60);
a(EntityBlaze.class, "Blaze", 61);
a(EntityLavaSlime.class, "LavaSlime", 62);
a(EntityEnderDragon.class, "EnderDragon", 63);
a(EntityPig.class, "Pig", 90); a(EntityPig.class, "Pig", 90);
a(EntitySheep.class, "Sheep", 91); a(EntitySheep.class, "Sheep", 91);
a(EntityCow.class, "Cow", 92); a(EntityCow.class, "Cow", 92);
a(EntityChicken.class, "Chicken", 93); a(EntityChicken.class, "Chicken", 93);
a(EntitySquid.class, "Squid", 94); a(EntitySquid.class, "Squid", 94);
a(EntityWolf.class, "Wolf", 95); a(EntityWolf.class, "Wolf", 95);
a(EntityTNTPrimed.class, "PrimedTnt", 20); a(EntityMushroomCow.class, "MushroomCow", 96);
a(EntityFallingSand.class, "FallingSand", 21); a(EntitySnowman.class, "SnowMan", 97);
a(EntityMinecart.class, "Minecart", 40); a(EntityVillager.class, "Villager", 120);
a(EntityBoat.class, "Boat", 41); a(EntityEnderCrystal.class, "EnderCrystal", 200);
} }
} }

Datei anzeigen

@ -36,6 +36,7 @@ public class EntityWeatherStorm extends EntityWeather {
this.lifeTicks = 2; this.lifeTicks = 2;
this.a = this.random.nextLong(); this.a = this.random.nextLong();
this.c = this.random.nextInt(3) + 1; this.c = this.random.nextInt(3) + 1;
// CraftBukkit // CraftBukkit
if (!isEffect && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) { if (!isEffect && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
int i = MathHelper.floor(d0); int i = MathHelper.floor(d0);
@ -72,8 +73,8 @@ public class EntityWeatherStorm extends EntityWeather {
} }
} }
public void s_() { public void w_() {
super.s_(); super.w_();
if (this.lifeTicks == 2) { if (this.lifeTicks == 2) {
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F); this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);

Datei anzeigen

@ -26,18 +26,21 @@ public class EntityWolf extends EntityAnimal {
super(world); super(world);
this.texture = "/mob/wolf.png"; this.texture = "/mob/wolf.png";
this.b(0.8F, 0.8F); this.b(0.8F, 0.8F);
this.aU = 1.1F; this.aY = 1.1F;
this.health = 8; }
public int getMaxHealth() {
return this.isTamed() ? 20 : 8;
} }
protected void b() { protected void b() {
super.b(); super.b();
this.datawatcher.a(16, Byte.valueOf((byte) 0)); this.datawatcher.a(16, Byte.valueOf((byte) 0));
this.datawatcher.a(17, ""); this.datawatcher.a(17, "");
this.datawatcher.a(18, new Integer(this.health)); this.datawatcher.a(18, new Integer(this.getHealth()));
} }
protected boolean e_() { protected boolean g_() {
return false; return false;
} }
@ -54,8 +57,8 @@ public class EntityWolf extends EntityAnimal {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setAngry(nbttagcompound.m("Angry")); this.setAngry(nbttagcompound.n("Angry"));
this.setSitting(nbttagcompound.m("Sitting")); this.setSitting(nbttagcompound.n("Sitting"));
String s = nbttagcompound.getString("Owner"); String s = nbttagcompound.getString("Owner");
if (s.length() > 0) { if (s.length() > 0) {
@ -65,44 +68,44 @@ public class EntityWolf extends EntityAnimal {
} }
protected boolean d_() { protected boolean d_() {
return !this.isTamed(); return this.isAngry();
} }
protected String h() { protected String c_() {
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getInt(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getInt(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
} }
protected String i() { protected String m() {
return "mob.wolf.hurt"; return "mob.wolf.hurt";
} }
protected String j() { protected String n() {
return "mob.wolf.death"; return "mob.wolf.death";
} }
protected float l() { protected float o() {
return 0.4F; return 0.4F;
} }
protected int k() { protected int e() {
return -1; return -1;
} }
protected void c_() { protected void m_() {
super.c_(); super.m_();
if (!this.e && !this.B() && this.isTamed() && this.vehicle == null) { if (!this.e && !this.D() && this.isTamed() && this.vehicle == null) {
EntityHuman entityhuman = this.world.a(this.getOwnerName()); EntityHuman entityhuman = this.world.a(this.getOwnerName());
if (entityhuman != null) { if (entityhuman != null) {
float f = entityhuman.g(this); float f = entityhuman.h(this);
if (f > 5.0F) { if (f > 5.0F) {
this.c(entityhuman, f); this.c(entityhuman, f);
} }
} else if (!this.ao()) { } else if (!this.az()) {
this.setSitting(true); this.setSitting(true);
} }
} else if (this.target == null && !this.B() && !this.isTamed() && this.world.random.nextInt(100) == 0) { } else if (this.target == null && !this.D() && !this.isTamed() && this.world.random.nextInt(100) == 0) {
List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D)); List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D));
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -120,20 +123,20 @@ public class EntityWolf extends EntityAnimal {
} }
} }
if (this.ao()) { if (this.az()) {
this.setSitting(false); this.setSitting(false);
} }
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.datawatcher.watch(18, Integer.valueOf(this.health)); this.datawatcher.watch(18, Integer.valueOf(this.getHealth()));
} }
} }
public void s() { public void d() {
super.s(); super.d();
this.a = false; this.a = false;
if (this.ae() && !this.B() && !this.isAngry()) { if (this.al() && !this.D() && !this.isAngry()) {
Entity entity = this.af(); Entity entity = this.am();
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity; EntityHuman entityhuman = (EntityHuman) entity;
@ -143,13 +146,13 @@ public class EntityWolf extends EntityAnimal {
if (!this.isTamed() && itemstack.id == Item.BONE.id) { if (!this.isTamed() && itemstack.id == Item.BONE.id) {
this.a = true; this.a = true;
} else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) { } else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) {
this.a = ((ItemFood) Item.byId[itemstack.id]).m(); this.a = ((ItemFood) Item.byId[itemstack.id]).p();
} }
} }
} }
} }
if (!this.ai && this.g && !this.h && !this.B() && this.onGround) { if (!this.aj && this.g && !this.h && !this.D() && this.onGround) {
this.h = true; this.h = true;
this.i = 0.0F; this.i = 0.0F;
this.j = 0.0F; this.j = 0.0F;
@ -157,8 +160,8 @@ public class EntityWolf extends EntityAnimal {
} }
} }
public void s_() { public void w_() {
super.s_(); super.w_();
this.c = this.b; this.c = this.b;
if (this.a) { if (this.a) {
this.b += (1.0F - this.b) * 0.4F; this.b += (1.0F - this.b) * 0.4F;
@ -167,17 +170,17 @@ public class EntityWolf extends EntityAnimal {
} }
if (this.a) { if (this.a) {
this.aV = 10; this.aZ = 10;
} }
if (this.an()) { if (this.ay()) {
this.g = true; this.g = true;
this.h = false; this.h = false;
this.i = 0.0F; this.i = 0.0F;
this.j = 0.0F; this.j = 0.0F;
} else if ((this.g || this.h) && this.h) { } else if ((this.g || this.h) && this.h) {
if (this.i == 0.0F) { if (this.i == 0.0F) {
this.world.makeSound(this, "mob.wolf.shake", this.l(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.makeSound(this, "mob.wolf.shake", this.o(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
this.j = this.i; this.j = this.i;
@ -203,12 +206,12 @@ public class EntityWolf extends EntityAnimal {
} }
} }
public float t() { public float x() {
return this.width * 0.8F; return this.width * 0.8F;
} }
protected int u() { protected int q_() {
return this.isSitting() ? 20 : super.u(); return this.isSitting() ? 20 : super.q_();
} }
private void c(Entity entity, float f) { private void c(Entity entity, float f) {
@ -232,7 +235,7 @@ public class EntityWolf extends EntityAnimal {
} }
} }
protected boolean v() { protected boolean w() {
return this.isSitting() || this.h; return this.isSitting() || this.h;
} }
@ -366,12 +369,12 @@ public class EntityWolf extends EntityAnimal {
this.setTamed(true); this.setTamed(true);
this.setPathEntity((PathEntity) null); this.setPathEntity((PathEntity) null);
this.setSitting(true); this.setSitting(true);
this.health = 20; this.setHealth(20);
this.setOwnerName(entityhuman.name); this.setOwnerName(entityhuman.name);
this.b(true); this.a(true);
this.world.a(this, (byte) 7); this.world.a(this, (byte) 7);
} else { } else {
this.b(false); this.a(false);
this.world.a(this, (byte) 6); this.world.a(this, (byte) 6);
} }
} }
@ -382,9 +385,9 @@ public class EntityWolf extends EntityAnimal {
if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) { if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) {
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id]; ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
if (itemfood.m() && this.datawatcher.getInt(18) < 20) { if (itemfood.p() && this.datawatcher.getInt(18) < 20) {
--itemstack.count; --itemstack.count;
this.c(itemfood.k(), RegainReason.EATING); // Craftbukkit this.d(itemfood.n(), RegainReason.EATING); // Craftbukkit
if (itemstack.count <= 0) { if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
} }
@ -396,7 +399,7 @@ public class EntityWolf extends EntityAnimal {
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) { if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.setSitting(!this.isSitting()); this.setSitting(!this.isSitting());
this.aS = false; this.aW = false;
this.setPathEntity((PathEntity) null); this.setPathEntity((PathEntity) null);
} }
@ -404,10 +407,10 @@ public class EntityWolf extends EntityAnimal {
} }
} }
return false; return super.b(entityhuman);
} }
void b(boolean flag) { void a(boolean flag) {
String s = "heart"; String s = "heart";
if (!flag) { if (!flag) {
@ -423,7 +426,7 @@ public class EntityWolf extends EntityAnimal {
} }
} }
public int m() { public int p() {
return 8; return 8;
} }
@ -476,4 +479,8 @@ public class EntityWolf extends EntityAnimal {
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -5))); this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -5)));
} }
} }
protected EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityWolf(this.world);
}
} }

Datei anzeigen

@ -7,13 +7,21 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) { public EntityZombie(World world) {
super(world); super(world);
this.texture = "/mob/zombie.png"; this.texture = "/mob/zombie.png";
this.aU = 0.5F; this.aY = 0.5F;
this.damage = 5; this.damage = 4;
} }
public void s() { public int getMaxHealth() {
if (this.world.d() && !this.world.isStatic) { return 20;
float f = this.a_(1.0F); }
protected int O() {
return 2;
}
public void d() {
if (this.world.e() && !this.world.isStatic) {
float f = this.a(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start // CraftBukkit start
@ -21,28 +29,32 @@ public class EntityZombie extends EntityMonster {
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.fireTicks = 300; this.j(8);
} }
// CraftBukkit end // CraftBukkit end
} }
} }
super.s(); super.d();
} }
protected String h() { protected String c_() {
return "mob.zombie"; return "mob.zombie";
} }
protected String i() { protected String m() {
return "mob.zombiehurt"; return "mob.zombiehurt";
} }
protected String j() { protected String n() {
return "mob.zombiedeath"; return "mob.zombiedeath";
} }
protected int k() { protected int e() {
return Item.ROTTEN_FLESH.id; return Item.ROTTEN_FLESH.id;
} }
public EnchantmentDamage t() {
return EnchantmentDamage.b;
}
} }

Datei anzeigen

@ -154,20 +154,6 @@ public class Explosion {
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
arraylist.addAll(this.blocks); arraylist.addAll(this.blocks);
if (this.a) {
for (int l2 = arraylist.size() - 1; l2 >= 0; --l2) {
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l2);
int i3 = chunkposition.x;
int j3 = chunkposition.y;
int k3 = chunkposition.z;
int l3 = this.world.getTypeId(i3, j3, k3);
int i4 = this.world.getTypeId(i3, j3 - 1, k3);
if (l3 == 0 && Block.o[i4] && this.h.nextInt(3) == 0) {
this.world.setTypeId(i3, j3, k3, Block.FIRE.id);
}
}
}
} }
public void a(boolean flag) { public void a(boolean flag) {
@ -209,13 +195,19 @@ public class Explosion {
} }
// CraftBukkit end // CraftBukkit end
for (int i = arraylist.size() - 1; i >= 0; --i) { int i;
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(i); ChunkPosition chunkposition;
int j = chunkposition.x; int j;
int k = chunkposition.y; int k;
int l = chunkposition.z; int l;
int i1 = this.world.getTypeId(j, k, l); int i1;
for (i = arraylist.size() - 1; i >= 0; --i) {
chunkposition = (ChunkPosition) arraylist.get(i);
j = chunkposition.x;
k = chunkposition.y;
l = chunkposition.z;
i1 = this.world.getTypeId(j, k, l);
if (flag) { if (flag) {
double d0 = (double) ((float) j + this.world.random.nextFloat()); double d0 = (double) ((float) j + this.world.random.nextFloat());
double d1 = (double) ((float) k + this.world.random.nextFloat()); double d1 = (double) ((float) k + this.world.random.nextFloat());
@ -241,10 +233,25 @@ public class Explosion {
// CraftBukkit - stop explosions from putting out fire // CraftBukkit - stop explosions from putting out fire
if (i1 > 0 && i1 != Block.FIRE.id) { if (i1 > 0 && i1 != Block.FIRE.id) {
// CraftBukkit // CraftBukkit
Block.byId[i1].dropNaturally(this.world, j, k, l, this.world.getData(j, k, l), event.getYield()); Block.byId[i1].dropNaturally(this.world, j, k, l, this.world.getData(j, k, l), event.getYield(), 0);
this.world.setTypeId(j, k, l, 0); this.world.setTypeId(j, k, l, 0);
Block.byId[i1].a_(this.world, j, k, l); Block.byId[i1].a_(this.world, j, k, l);
} }
} }
if (this.a) {
for (i = arraylist.size() - 1; i >= 0; --i) {
chunkposition = (ChunkPosition) arraylist.get(i);
j = chunkposition.x;
k = chunkposition.y;
l = chunkposition.z;
i1 = this.world.getTypeId(j, k, l);
int j1 = this.world.getTypeId(j, k - 1, l);
if (i1 == 0 && Block.o[j1] && this.h.nextInt(3) == 0) {
this.world.setTypeId(j, k, l, Block.FIRE.id);
}
}
}
} }
} }

Datei anzeigen

@ -23,7 +23,7 @@ public class FoodMetaData {
} }
public void a(ItemFood itemfood) { public void a(ItemFood itemfood) {
this.a(itemfood.k(), itemfood.l()); this.a(itemfood.n(), itemfood.o());
} }
public void a(EntityHuman entityhuman) { public void a(EntityHuman entityhuman) {
@ -46,17 +46,17 @@ public class FoodMetaData {
} }
} }
if (this.foodLevel >= 18 && entityhuman.W()) { if (this.foodLevel >= 18 && entityhuman.ab()) {
++this.foodTickTimer; ++this.foodTickTimer;
if (this.foodTickTimer >= 80) { if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason. // CraftBukkit - added RegainReason.
entityhuman.c(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); entityhuman.d(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
this.foodTickTimer = 0; this.foodTickTimer = 0;
} }
} else if (this.foodLevel <= 0) { } else if (this.foodLevel <= 0) {
++this.foodTickTimer; ++this.foodTickTimer;
if (this.foodTickTimer >= 80) { if (this.foodTickTimer >= 80) {
if (entityhuman.health > 10 || i >= 3 || entityhuman.health > 1 && i >= 2) { if (entityhuman.getHealth() > 10 || i >= 3 || entityhuman.getHealth() > 1 && i >= 2) {
// CraftBukkit start // CraftBukkit start
EntityDamageEvent event = new EntityDamageEvent(entityhuman.getBukkitEntity(), EntityDamageEvent.DamageCause.STARVATION, 1); EntityDamageEvent event = new EntityDamageEvent(entityhuman.getBukkitEntity(), EntityDamageEvent.DamageCause.STARVATION, 1);
entityhuman.world.getServer().getPluginManager().callEvent(event); entityhuman.world.getServer().getPluginManager().callEvent(event);
@ -76,10 +76,10 @@ public class FoodMetaData {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
if (nbttagcompound.hasKey("foodLevel")) { if (nbttagcompound.hasKey("foodLevel")) {
this.foodLevel = nbttagcompound.e("foodLevel"); this.foodLevel = nbttagcompound.f("foodLevel");
this.foodTickTimer = nbttagcompound.e("foodTickTimer"); this.foodTickTimer = nbttagcompound.f("foodTickTimer");
this.saturationLevel = nbttagcompound.g("foodSaturationLevel"); this.saturationLevel = nbttagcompound.h("foodSaturationLevel");
this.exhaustionLevel = nbttagcompound.g("foodExhaustionLevel"); this.exhaustionLevel = nbttagcompound.h("foodExhaustionLevel");
} }
} }

Datei anzeigen

@ -18,9 +18,9 @@ public interface IInventory {
boolean a(EntityHuman entityhuman); boolean a(EntityHuman entityhuman);
void e(); void f();
void t_(); void g();
public abstract ItemStack[] getContents(); // CraftBukkit public abstract ItemStack[] getContents(); // CraftBukkit
} }

Datei anzeigen

@ -49,7 +49,7 @@ public class InventoryCraftResult implements IInventory {
return true; return true;
} }
public void e() {} public void f() {}
public void t_() {} public void g() {}
} }

Datei anzeigen

@ -80,7 +80,7 @@ public class InventoryCrafting implements IInventory {
return true; return true;
} }
public void e() {} public void f() {}
public void t_() {} public void g() {}
} }

Datei anzeigen

@ -67,13 +67,13 @@ public class InventoryLargeChest implements IInventory {
return this.b.a(entityhuman) && this.c.a(entityhuman); return this.b.a(entityhuman) && this.c.a(entityhuman);
} }
public void e() { public void f() {
this.b.e(); this.b.f();
this.c.e(); this.c.f();
} }
public void t_() { public void g() {
this.b.t_(); this.b.g();
this.c.t_(); this.c.g();
} }
} }

Datei anzeigen

@ -27,7 +27,7 @@ public class InventoryPlayer implements IInventory {
return this.itemInHandIndex < 9 && this.itemInHandIndex >= 0 ? this.items[this.itemInHandIndex] : null; return this.itemInHandIndex < 9 && this.itemInHandIndex >= 0 ? this.items[this.itemInHandIndex] : null;
} }
public static int g() { public static int h() {
return 9; return 9;
} }
@ -80,8 +80,21 @@ public class InventoryPlayer implements IInventory {
private int e(ItemStack itemstack) { private int e(ItemStack itemstack) {
int i = itemstack.id; int i = itemstack.id;
int j = itemstack.count; int j = itemstack.count;
int k = this.firstPartial(itemstack); int k;
if (itemstack.getMaxStackSize() == 1) {
k = this.m();
if (k < 0) {
return j;
} else {
if (this.items[k] == null) {
this.items[k] = ItemStack.b(itemstack);
}
return 0;
}
} else {
k = this.firstPartial(itemstack);
if (k < 0) { if (k < 0) {
k = this.m(); k = this.m();
} }
@ -113,8 +126,9 @@ public class InventoryPlayer implements IInventory {
} }
} }
} }
}
public void h() { public void i() {
for (int i = 0; i < this.items.length; ++i) { for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] != null) { if (this.items[i] != null) {
this.items[i].a(this.d.world, this.d, i, this.itemInHandIndex == i); this.items[i].a(this.d.world, this.d, i, this.itemInHandIndex == i);
@ -152,6 +166,9 @@ public class InventoryPlayer implements IInventory {
this.items[i].b = 5; this.items[i].b = 5;
itemstack.count = 0; itemstack.count = 0;
return true; return true;
} else if (this.d.abilities.canInstantlyBuild) {
itemstack.count = 0;
return true;
} else { } else {
return false; return false;
} }
@ -161,9 +178,14 @@ public class InventoryPlayer implements IInventory {
itemstack.count = this.e(itemstack); itemstack.count = this.e(itemstack);
} while (itemstack.count > 0 && itemstack.count < i); } while (itemstack.count > 0 && itemstack.count < i);
if (itemstack.count == i && this.d.abilities.canInstantlyBuild) {
itemstack.count = 0;
return true;
} else {
return itemstack.count < i; return itemstack.count < i;
} }
} }
}
public ItemStack splitStack(int i, int j) { public ItemStack splitStack(int i, int j) {
ItemStack[] aitemstack = this.items; ItemStack[] aitemstack = this.items;
@ -243,9 +265,9 @@ public class InventoryPlayer implements IInventory {
this.items = new ItemStack[36]; this.items = new ItemStack[36];
this.armor = new ItemStack[4]; this.armor = new ItemStack[4];
for (int i = 0; i < nbttaglist.c(); ++i) { for (int i = 0; i < nbttaglist.d(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound.c("Slot") & 255; int j = nbttagcompound.d("Slot") & 255;
ItemStack itemstack = ItemStack.a(nbttagcompound); ItemStack itemstack = ItemStack.a(nbttagcompound);
if (itemstack != null) { if (itemstack != null) {
@ -299,33 +321,26 @@ public class InventoryPlayer implements IInventory {
} }
} }
public int i() { public int j() {
int i = 0; int i = 0;
int j = 0;
int k = 0;
for (int l = 0; l < this.armor.length; ++l) { for (int j = 0; j < this.armor.length; ++j) {
if (this.armor[l] != null && this.armor[l].getItem() instanceof ItemArmor) { if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
int i1 = this.armor[l].i(); int k = ((ItemArmor) this.armor[j].getItem()).b;
int j1 = this.armor[l].g();
int k1 = i1 - j1;
j += k1; i += k;
k += i1;
int l1 = ((ItemArmor) this.armor[l].getItem()).bu;
i += l1;
} }
} }
if (k == 0) { return i;
return 0;
} else {
return (i - 1) * j / k + 1;
}
} }
public void d(int i) { public void d(int i) {
i /= 4;
if (i < 1) {
i = 1;
}
for (int j = 0; j < this.armor.length; ++j) { for (int j = 0; j < this.armor.length; ++j) {
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) { if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
this.armor[j].damage(i, this.d); this.armor[j].damage(i, this.d);
@ -337,7 +352,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public void j() { public void k() {
int i; int i;
for (i = 0; i < this.items.length; ++i) { for (i = 0; i < this.items.length; ++i) {
@ -369,7 +384,7 @@ public class InventoryPlayer implements IInventory {
} }
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.d.dead ? false : entityhuman.h(this.d) <= 64.0D; return this.d.dead ? false : entityhuman.i(this.d) <= 64.0D;
} }
public boolean c(ItemStack itemstack) { public boolean c(ItemStack itemstack) {
@ -390,7 +405,19 @@ public class InventoryPlayer implements IInventory {
return false; return false;
} }
public void e() {} public void f() {}
public void t_() {} public void g() {}
public void a(InventoryPlayer inventoryplayer) {
int i;
for (i = 0; i < this.items.length; ++i) {
this.items[i] = ItemStack.b(inventoryplayer.items[i]);
}
for (i = 0; i < this.armor.length; ++i) {
this.armor[i] = ItemStack.b(inventoryplayer.armor[i]);
}
}
} }

Datei anzeigen

@ -40,7 +40,7 @@ public class ItemBed extends Item {
b0 = 1; b0 = 1;
} }
if (entityhuman.c(i, j, k) && entityhuman.c(i + b0, j, k + b1)) { if (entityhuman.d(i, j, k) && entityhuman.d(i + b0, j, k + b1)) {
if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.e(i, j - 1, k) && world.e(i + b0, j - 1, k + b1)) { if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.e(i, j - 1, k) && world.e(i + b0, j - 1, k + b1)) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
@ -55,7 +55,10 @@ public class ItemBed extends Item {
} }
// CraftBukkit end // CraftBukkit end
if (world.getTypeId(i, j, k) == blockbed.id) {
world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8); world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8);
}
--itemstack.count; --itemstack.count;
return true; return true;
} else { } else {

Datei anzeigen

@ -13,7 +13,7 @@ public class ItemBlock extends Item {
public ItemBlock(int i) { public ItemBlock(int i) {
super(i); super(i);
this.id = i + 256; this.id = i + 256;
this.b(Block.byId[i + 256].a(2)); this.d(Block.byId[i + 256].a(2));
} }
public int a() { public int a() {
@ -54,11 +54,9 @@ public class ItemBlock extends Item {
if (itemstack.count == 0) { if (itemstack.count == 0) {
return false; return false;
} else if (!entityhuman.c(i, j, k)) { } else if (!entityhuman.d(i, j, k)) {
return false; return false;
} else { } else if (j == world.height - 1 && Block.byId[this.id].material.isBuildable()) {
world.getClass();
if (j == 128 - 1 && Block.byId[this.id].material.isBuildable()) {
return false; return false;
} else if (world.a(this.id, i, j, k, false, l)) { } else if (world.a(this.id, i, j, k, false, l)) {
Block block = Block.byId[this.id]; Block block = Block.byId[this.id];
@ -128,13 +126,12 @@ public class ItemBlock extends Item {
return false; return false;
} }
} }
}
public String a(ItemStack itemstack) { public String a(ItemStack itemstack) {
return Block.byId[this.id].l(); return Block.byId[this.id].n();
} }
public String b() { public String b() {
return Block.byId[this.id].l(); return Block.byId[this.id].n();
} }
} }

Datei anzeigen

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
@ -33,32 +35,56 @@ public class ItemBoat extends Item {
if (movingobjectposition == null) { if (movingobjectposition == null) {
return itemstack; return itemstack;
} else {
Vec3D vec3d2 = entityhuman.d(f);
boolean flag = false;
float f9 = 1.0F;
List list = world.b((Entity) entityhuman, entityhuman.boundingBox.a(vec3d2.a * d3, vec3d2.b * d3, vec3d2.c * d3).b((double) f9, (double) f9, (double) f9));
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
if (entity.e_()) {
float f10 = entity.j_();
AxisAlignedBB axisalignedbb = entity.boundingBox.b((double) f10, (double) f10, (double) f10);
if (axisalignedbb.a(vec3d)) {
flag = true;
}
}
}
if (flag) {
return itemstack;
} else { } else {
if (movingobjectposition.type == EnumMovingObjectType.TILE) { if (movingobjectposition.type == EnumMovingObjectType.TILE) {
int i = movingobjectposition.b; int j = movingobjectposition.b;
int j = movingobjectposition.c; int k = movingobjectposition.c;
int k = movingobjectposition.d; int l = movingobjectposition.d;
if (!world.isStatic) { if (!world.isStatic) {
// CraftBukkit start - Boat placement // CraftBukkit start - Boat placement
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, movingobjectposition.face, itemstack); PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, j, k, l, movingobjectposition.face, itemstack);
if (event.isCancelled()) { if (event.isCancelled()) {
return itemstack; return itemstack;
} }
// CraftBukkit end // CraftBukkit end
if (world.getTypeId(i, j, k) == Block.SNOW.id) { if (world.getTypeId(j, k, l) == Block.SNOW.id) {
--j; --k;
} }
world.addEntity(new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.0F), (double) ((float) k + 0.5F))); world.addEntity(new EntityBoat(world, (double) ((float) j + 0.5F), (double) ((float) k + 1.0F), (double) ((float) l + 0.5F)));
} }
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count; --itemstack.count;
} }
}
return itemstack; return itemstack;
} }
} }
} }
}

Datei anzeigen

@ -20,21 +20,11 @@ public class ItemBucket extends Item {
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) { public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
float f = 1.0F; float f = 1.0F;
float f1 = entityhuman.lastPitch + (entityhuman.pitch - entityhuman.lastPitch) * f;
float f2 = entityhuman.lastYaw + (entityhuman.yaw - entityhuman.lastYaw) * f;
double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f; double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height; double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f; double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
Vec3D vec3d = Vec3D.create(d0, d1, d2); boolean flag = this.a == 0;
float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F); MovingObjectPosition movingobjectposition = this.a(world, entityhuman, flag);
float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
float f6 = MathHelper.sin(-f1 * 0.017453292F);
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 5.0D;
Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
MovingObjectPosition movingobjectposition = world.rayTrace(vec3d, vec3d1, this.a == 0);
if (movingobjectposition == null) { if (movingobjectposition == null) {
return itemstack; return itemstack;
@ -49,7 +39,7 @@ public class ItemBucket extends Item {
} }
if (this.a == 0) { if (this.a == 0) {
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return itemstack; return itemstack;
} }
@ -61,6 +51,10 @@ public class ItemBucket extends Item {
return itemstack; return itemstack;
} }
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack(); CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData(); byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
// CraftBukkit end // CraftBukkit end
@ -77,6 +71,10 @@ public class ItemBucket extends Item {
return itemstack; return itemstack;
} }
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack(); CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData(); byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
// CraftBukkit end // CraftBukkit end
@ -125,7 +123,7 @@ public class ItemBucket extends Item {
++i; ++i;
} }
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return itemstack; return itemstack;
} }

Datei anzeigen

@ -29,7 +29,7 @@ public class ItemDoor extends Item {
block = Block.IRON_DOOR_BLOCK; block = Block.IRON_DOOR_BLOCK;
} }
if (entityhuman.c(i, j, k) && entityhuman.c(i, j + 1, k)) { if (entityhuman.d(i, j, k) && entityhuman.d(i, j + 1, k)) {
if (!block.canPlace(world, i, j, k)) { if (!block.canPlace(world, i, j, k)) {
return false; return false;
} else { } else {
@ -39,9 +39,8 @@ public class ItemDoor extends Item {
if (a(world, i, j, k, i1, block, entityhuman)) { if (a(world, i, j, k, i1, block, entityhuman)) {
--itemstack.count; --itemstack.count;
return true; return true;
} else {
return false;
} }
return false;
// CraftBukkit end // CraftBukkit end
} }
} else { } else {

Datei anzeigen

@ -6,16 +6,16 @@ public class ItemFishingRod extends Item {
public ItemFishingRod(int i) { public ItemFishingRod(int i) {
super(i); super(i);
this.d(64); this.f(64);
this.c(1); this.e(1);
} }
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) { public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.hookedFish != null) { if (entityhuman.hookedFish != null) {
int i = entityhuman.hookedFish.i(); int i = entityhuman.hookedFish.j();
itemstack.damage(i, entityhuman); itemstack.damage(i, entityhuman);
entityhuman.v(); entityhuman.r_();
} else { } else {
// CraftBukkit start // CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null,PlayerFishEvent.State.FISHING); PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null,PlayerFishEvent.State.FISHING);
@ -25,12 +25,13 @@ public class ItemFishingRod extends Item {
return itemstack; return itemstack;
} }
// CraftBukkit end // CraftBukkit end
world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (b.nextFloat() * 0.4F + 0.8F));
world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (c.nextFloat() * 0.4F + 0.8F));
if (!world.isStatic) { if (!world.isStatic) {
world.addEntity(new EntityFishingHook(world, entityhuman)); world.addEntity(new EntityFishingHook(world, entityhuman));
} }
entityhuman.v(); entityhuman.r_();
} }
return itemstack; return itemstack;

Datei anzeigen

@ -13,7 +13,7 @@ public class ItemFlintAndSteel extends Item {
public ItemFlintAndSteel(int i) { public ItemFlintAndSteel(int i) {
super(i); super(i);
this.maxStackSize = 1; this.maxStackSize = 1;
this.d(64); this.f(64);
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
@ -43,7 +43,7 @@ public class ItemFlintAndSteel extends Item {
++i; ++i;
} }
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else { } else {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
@ -64,7 +64,7 @@ public class ItemFlintAndSteel extends Item {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
// CraftBukkit end // CraftBukkit end
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F); world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, c.nextFloat() * 0.4F + 0.8F);
world.setTypeId(i, j, k, Block.FIRE.id); world.setTypeId(i, j, k, Block.FIRE.id);
// CraftBukkit start // CraftBukkit start

Datei anzeigen

@ -5,21 +5,21 @@ import org.bukkit.event.entity.FoodLevelChangeEvent; // CraftBukkit
public class ItemFood extends Item { public class ItemFood extends Item {
public final int a; public final int a;
private final int bt; private final int b;
private final float bu; private final float bR;
private final boolean bv; private final boolean bS;
private boolean bw; private boolean bT;
private int bx; private int bU;
private int by; private int bV;
private int bz; private int bW;
private float bA; private float bX;
public ItemFood(int i, int j, float f, boolean flag) { public ItemFood(int i, int j, float f, boolean flag) {
super(i); super(i);
this.a = 32; this.a = 32;
this.bt = j; this.b = j;
this.bv = flag; this.bS = flag;
this.bu = f; this.bR = f;
} }
public ItemFood(int i, int j, boolean flag) { public ItemFood(int i, int j, boolean flag) {
@ -31,16 +31,16 @@ public class ItemFood extends Item {
// CraftBukkit start // CraftBukkit start
int oldFoodLevel = entityhuman.getFoodData().foodLevel; int oldFoodLevel = entityhuman.getFoodData().foodLevel;
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.k() + entityhuman.getFoodData().foodLevel, 20)); FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.n() + entityhuman.getFoodData().foodLevel, 20));
entityhuman.world.getServer().getPluginManager().callEvent(event); entityhuman.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.l()); entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.o());
} }
// CraftBukkit end // CraftBukkit end
if (!world.isStatic && this.bx > 0 && world.random.nextFloat() < this.bA) { if (!world.isStatic && this.bU > 0 && world.random.nextFloat() < this.bX) {
entityhuman.addEffect(new MobEffect(this.bx, this.by * 20, this.bz)); entityhuman.addEffect(new MobEffect(this.bU, this.bV * 20, this.bW));
} }
return itemstack; return itemstack;
@ -50,40 +50,40 @@ public class ItemFood extends Item {
return 32; return 32;
} }
public EnumAnimation b(ItemStack itemstack) { public EnumAnimation d(ItemStack itemstack) {
return EnumAnimation.b; return EnumAnimation.b;
} }
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) { public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.c(this.bw)) { if (entityhuman.b(this.bT)) {
entityhuman.a(itemstack, this.c(itemstack)); entityhuman.a(itemstack, this.c(itemstack));
} }
return itemstack; return itemstack;
} }
public int k() { public int n() {
return this.bt; return this.b;
} }
public float l() { public float o() {
return this.bu; return this.bR;
} }
public boolean m() { public boolean p() {
return this.bv; return this.bS;
} }
public ItemFood a(int i, int j, int k, float f) { public ItemFood a(int i, int j, int k, float f) {
this.bx = i; this.bU = i;
this.by = j; this.bV = j;
this.bz = k; this.bW = k;
this.bA = f; this.bX = f;
return this; return this;
} }
public ItemFood n() { public ItemFood q() {
this.bw = true; this.bT = true;
return this; return this;
} }

Datei anzeigen

@ -11,11 +11,11 @@ public class ItemHoe extends Item {
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) { public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
super(i); super(i);
this.maxStackSize = 1; this.maxStackSize = 1;
this.d(enumtoolmaterial.a()); this.f(enumtoolmaterial.a());
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else { } else {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);

Datei anzeigen

@ -215,17 +215,18 @@ public class ItemInWorldManager {
if (this.b()) { if (this.b()) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world)); ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else { } else {
ItemStack itemstack = this.player.K(); ItemStack itemstack = this.player.P();
boolean flag1 = this.player.b(Block.byId[l]);
if (itemstack != null) { if (itemstack != null) {
itemstack.a(l, i, j, k, this.player); itemstack.a(l, i, j, k, this.player);
if (itemstack.count == 0) { if (itemstack.count == 0) {
itemstack.a(this.player); itemstack.a(this.player);
this.player.L(); this.player.Q();
} }
} }
if (flag && this.player.b(Block.byId[l])) { if (flag && flag1) {
Block.byId[l].a(this.world, this.player, i, j, k, i1); Block.byId[l].a(this.world, this.player, i, j, k, i1);
} }
} }

Datei anzeigen

@ -19,7 +19,7 @@ public class ItemMinecart extends Item {
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
if (BlockMinecartTrack.c(i1)) { if (BlockMinecartTrack.d(i1)) {
if (!world.isStatic) { if (!world.isStatic) {
// CraftBukkit start - Minecarts // CraftBukkit start - Minecarts
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack); PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);

Datei anzeigen

@ -32,12 +32,12 @@ public class ItemPainting extends Item {
b0 = 3; b0 = 3;
} }
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else { } else {
EntityPainting entitypainting = new EntityPainting(world, i, j, k, b0); EntityPainting entitypainting = new EntityPainting(world, i, j, k, b0);
if (entitypainting.i()) { if (entitypainting.j()) {
if (!world.isStatic) { if (!world.isStatic) {
// CraftBukkit start // CraftBukkit start
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity(); Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();

Datei anzeigen

@ -45,7 +45,7 @@ public class ItemRedstone extends Item {
} }
} }
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else { } else {
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) { if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {

Datei anzeigen

@ -47,7 +47,7 @@ public class ItemReed extends Item {
} }
} }
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else if (itemstack.count == 0) { } else if (itemstack.count == 0) {
return false; return false;

Datei anzeigen

@ -9,19 +9,21 @@ import org.bukkit.event.block.BlockPlaceEvent;
public class ItemSeeds extends Item { public class ItemSeeds extends Item {
private int id; private int id;
private int b;
public ItemSeeds(int i, int j) { public ItemSeeds(int i, int j, int k) {
super(i); super(i);
this.id = j; this.id = j;
this.b = k;
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l != 1) { if (l != 1) {
return false; return false;
} else if (entityhuman.c(i, j, k) && entityhuman.c(i, j + 1, k)) { } else if (entityhuman.d(i, j, k) && entityhuman.d(i, j + 1, k)) {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
if (i1 == Block.SOIL.id && world.isEmpty(i, j + 1, k)) { if (i1 == this.b && world.isEmpty(i, j + 1, k)) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j + 1, k); // CraftBukkit CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j + 1, k); // CraftBukkit
world.setTypeId(i, j + 1, k, this.id); world.setTypeId(i, j + 1, k, this.id);

Datei anzeigen

@ -41,7 +41,7 @@ public class ItemSign extends Item {
++i; ++i;
} }
if (!entityhuman.c(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else if (!Block.SIGN_POST.canPlace(world, i, j, k)) { } else if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
return false; return false;

Datei anzeigen

@ -5,6 +5,7 @@ public final class ItemStack {
public int count; public int count;
public int b; public int b;
public int id; public int id;
public NBTTagCompound tag;
private int damage; private int damage;
public ItemStack(Block block) { public ItemStack(Block block) {
@ -50,8 +51,14 @@ public final class ItemStack {
} }
public ItemStack a(int i) { public ItemStack a(int i) {
ItemStack itemstack = new ItemStack(this.id, i, this.damage);
if (this.tag != null) {
itemstack.tag = (NBTTagCompound) this.tag.b();
}
this.count -= i; this.count -= i;
return new ItemStack(this.id, i, this.damage); return itemstack;
} }
public Item getItem() { public Item getItem() {
@ -84,13 +91,20 @@ public final class ItemStack {
nbttagcompound.a("id", (short) this.id); nbttagcompound.a("id", (short) this.id);
nbttagcompound.a("Count", (byte) this.count); nbttagcompound.a("Count", (byte) this.count);
nbttagcompound.a("Damage", (short) this.damage); nbttagcompound.a("Damage", (short) this.damage);
if (this.tag != null) {
nbttagcompound.a("tag", (NBTBase) this.tag);
}
return nbttagcompound; return nbttagcompound;
} }
public void c(NBTTagCompound nbttagcompound) { public void c(NBTTagCompound nbttagcompound) {
this.id = nbttagcompound.d("id"); this.id = nbttagcompound.e("id");
this.count = nbttagcompound.c("Count"); this.count = nbttagcompound.d("Count");
this.damage = nbttagcompound.d("Damage"); this.damage = nbttagcompound.e("Damage");
if (nbttagcompound.hasKey("tag")) {
this.tag = nbttagcompound.l("tag");
}
} }
public int getMaxStackSize() { public int getMaxStackSize() {
@ -106,7 +120,7 @@ public final class ItemStack {
} }
public boolean usesData() { public boolean usesData() {
return Item.byId[this.id].d(); return Item.byId[this.id].e();
} }
public boolean f() { public boolean f() {
@ -129,12 +143,21 @@ public final class ItemStack {
return Item.byId[this.id].getMaxDurability(); return Item.byId[this.id].getMaxDurability();
} }
public void damage(int i, Entity entity) { public void damage(int i, EntityLiving entityliving) {
if (this.d()) { if (this.d()) {
if (i > 0 && entityliving instanceof EntityHuman) {
int j = EnchantmentManager.c(((EntityHuman) entityliving).inventory);
if (j > 0 && entityliving.world.random.nextInt(j + 1) > 0) {
return;
}
}
this.damage += i; this.damage += i;
if (this.damage > this.i()) { if (this.damage > this.i()) {
if (entity instanceof EntityHuman) { entityliving.c(this);
((EntityHuman) entity).a(StatisticList.F[this.id], 1); if (entityliving instanceof EntityHuman) {
((EntityHuman) entityliving).a(StatisticList.F[this.id], 1);
} }
--this.count; --this.count;
@ -178,7 +201,16 @@ public final class ItemStack {
} }
public ItemStack cloneItemStack() { public ItemStack cloneItemStack() {
return new ItemStack(this.id, this.count, this.damage); ItemStack itemstack = new ItemStack(this.id, this.count, this.damage);
if (this.tag != null) {
itemstack.tag = (NBTTagCompound) this.tag.b();
if (!itemstack.tag.equals(this.tag)) {
return itemstack;
}
}
return itemstack;
} }
public static boolean equals(ItemStack itemstack, ItemStack itemstack1) { public static boolean equals(ItemStack itemstack, ItemStack itemstack1) {
@ -186,7 +218,7 @@ public final class ItemStack {
} }
private boolean d(ItemStack itemstack) { private boolean d(ItemStack itemstack) {
return this.count != itemstack.count ? false : (this.id != itemstack.id ? false : this.damage == itemstack.damage); return this.count != itemstack.count ? false : (this.id != itemstack.id ? false : (this.damage != itemstack.damage ? false : (this.tag == null && itemstack.tag != null ? false : this.tag == null || this.tag.equals(itemstack.tag))));
} }
public boolean doMaterialsMatch(ItemStack itemstack) { public boolean doMaterialsMatch(ItemStack itemstack) {
@ -227,10 +259,55 @@ public final class ItemStack {
} }
public EnumAnimation m() { public EnumAnimation m() {
return this.getItem().b(this); return this.getItem().d(this);
} }
public void a(World world, EntityHuman entityhuman, int i) { public void a(World world, EntityHuman entityhuman, int i) {
this.getItem().a(this, world, entityhuman, i); this.getItem().a(this, world, entityhuman, i);
} }
public boolean n() {
return this.tag != null;
}
public NBTTagCompound o() {
return this.tag;
}
public NBTTagList p() {
return this.tag == null ? null : (NBTTagList) this.tag.b("ench");
}
public void d(NBTTagCompound nbttagcompound) {
if (Item.byId[this.id].getMaxStackSize() != 1) {
throw new IllegalArgumentException("Cannot add tag data to a stackable item");
} else {
this.tag = nbttagcompound;
}
}
public boolean q() {
return !this.getItem().e(this) ? false : !this.r();
}
public void a(Enchantment enchantment, int i) {
if (this.tag == null) {
this.d(new NBTTagCompound());
}
if (!this.tag.hasKey("ench")) {
this.tag.a("ench", (NBTBase) (new NBTTagList("ench")));
}
NBTTagList nbttaglist = (NBTTagList) this.tag.b("ench");
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.a("id", (short) enchantment.id);
nbttagcompound.a("lvl", (short) ((byte) i));
nbttaglist.a((NBTBase) nbttagcompound);
}
public boolean r() {
return this.tag != null && this.tag.hasKey("ench");
}
} }

Datei anzeigen

@ -9,7 +9,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
protected ItemWorldMap(int i) { protected ItemWorldMap(int i) {
super(i); super(i);
this.c(1); this.e(1);
} }
public WorldMap a(ItemStack itemstack, World world) { public WorldMap a(ItemStack itemstack, World world) {
@ -21,8 +21,8 @@ public class ItemWorldMap extends ItemWorldMapBase {
String s = "map_" + itemstack.getData(); String s = "map_" + itemstack.getData();
worldmap = new WorldMap(s); worldmap = new WorldMap(s);
worldmap.b = world.p().c(); worldmap.b = world.r().c();
worldmap.c = world.p().e(); worldmap.c = world.r().e();
worldmap.e = 3; worldmap.e = 3;
worldmap.map = (byte) world.worldProvider.dimension; worldmap.map = (byte) world.worldProvider.dimension;
worldmap.a(); worldmap.a();
@ -105,18 +105,17 @@ public class ItemWorldMap extends ItemWorldMapBase {
j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3); j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
if (j5 == 0) { if (j5 == 0) {
flag1 = false; flag1 = false;
} else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.D == MaterialMapColor.b) { } else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.E == MaterialMapColor.b) {
flag1 = false; flag1 = false;
} }
if (!flag1) { if (!flag1) {
--k4; --k4;
if (k4 <= 0) break; // CraftBukkit
j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3); j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
} }
} while (!flag1); } while (k4 > 0 && !flag1);
if (j5 != 0 && Block.byId[j5].material.isLiquid()) { if (k4 > 0 && j5 != 0 && Block.byId[j5].material.isLiquid()) {
i5 = k4 - 1; i5 = k4 - 1;
boolean flag2 = false; boolean flag2 = false;
@ -163,7 +162,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
i5 = 0; i5 = 0;
if (j4 > 0) { if (j4 > 0) {
MaterialMapColor materialmapcolor = Block.byId[j4].material.D; MaterialMapColor materialmapcolor = Block.byId[j4].material.E;
if (materialmapcolor == MaterialMapColor.n) { if (materialmapcolor == MaterialMapColor.n) {
d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D; d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;

Datei anzeigen

@ -32,28 +32,34 @@ import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.PluginLoadOrder; import org.bukkit.plugin.PluginLoadOrder;
// CraftBukkit end // CraftBukkit end
public class MinecraftServer implements Runnable, ICommandListener { public class MinecraftServer implements Runnable, ICommandListener, IMinecraftServer {
public static Logger log = Logger.getLogger("Minecraft"); public static Logger log = Logger.getLogger("Minecraft");
public static HashMap trackerList = new HashMap(); public static HashMap trackerList = new HashMap();
private String s;
private int t;
public NetworkListenThread networkListenThread; public NetworkListenThread networkListenThread;
public PropertyManager propertyManager; public PropertyManager propertyManager;
// public WorldServer[] worldServer; // CraftBukkit - removed! // public WorldServer[] worldServer; // CraftBukkit - removed!
public long[] f = new long[100];
public long[][] g;
public ServerConfigurationManager serverConfigurationManager; public ServerConfigurationManager serverConfigurationManager;
public ConsoleCommandHandler consoleCommandHandler; // CraftBukkit - made public public ConsoleCommandHandler consoleCommandHandler; // CraftBukkit - made public
private boolean isRunning = true; private boolean isRunning = true;
public boolean isStopped = false; public boolean isStopped = false;
int ticks = 0; int ticks = 0;
public String i; public String k;
public int j; public int l;
private List s = new ArrayList(); private List w = new ArrayList();
private List t = Collections.synchronizedList(new ArrayList()); private List x = Collections.synchronizedList(new ArrayList());
// public EntityTracker[] tracker = new EntityTracker[2]; // CraftBukkit - removed! // public EntityTracker[] tracker = new EntityTracker[3]; // CraftBukkit - removed!
public boolean onlineMode; public boolean onlineMode;
public boolean spawnAnimals; public boolean spawnAnimals;
public boolean pvpMode; public boolean pvpMode;
public boolean allowFlight; public boolean allowFlight;
public String p; public String r;
private RemoteStatusListener y;
private RemoteControlListener z;
// CraftBukkit start // CraftBukkit start
public List<WorldServer> worlds = new ArrayList<WorldServer>(); public List<WorldServer> worlds = new ArrayList<WorldServer>();
@ -91,7 +97,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true)); System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end // CraftBukkit end
log.info("Starting minecraft server version Beta 1.8.1"); log.info("Starting minecraft server version 1.0.0");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("**** NOT ENOUGH RAM!"); log.warning("**** NOT ENOUGH RAM!");
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@ -99,26 +105,24 @@ public class MinecraftServer implements Runnable, ICommandListener {
log.info("Loading properties"); log.info("Loading properties");
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
String s = this.propertyManager.getString("server-ip", ""); this.s = this.propertyManager.getString("server-ip", "");
this.onlineMode = this.propertyManager.getBoolean("online-mode", true); this.onlineMode = this.propertyManager.getBoolean("online-mode", true);
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true); this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
this.pvpMode = this.propertyManager.getBoolean("pvp", true); this.pvpMode = this.propertyManager.getBoolean("pvp", true);
this.allowFlight = this.propertyManager.getBoolean("allow-flight", false); this.allowFlight = this.propertyManager.getBoolean("allow-flight", false);
this.p = this.propertyManager.getString("motd", "A Minecraft Server"); this.r = this.propertyManager.getString("motd", "A Minecraft Server");
this.p.replace('\u00a7', '$'); this.r.replace('\u00a7', '$');
InetAddress inetaddress = null; InetAddress inetaddress = null;
if (s.length() > 0) { if (this.s.length() > 0) {
inetaddress = InetAddress.getByName(s); inetaddress = InetAddress.getByName(this.s);
} }
int i = this.propertyManager.getInt("server-port", 25565); this.t = this.propertyManager.getInt("server-port", 25565);
log.info("Starting Minecraft server on " + (this.s.length() == 0 ? "*" : this.s) + ":" + this.t);
log.info("Starting Minecraft server on " + (s.length() == 0 ? "*" : s) + ":" + i);
try { try {
this.networkListenThread = new NetworkListenThread(this, inetaddress, i); this.networkListenThread = new NetworkListenThread(this, inetaddress, this.t);
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
log.warning("**** FAILED TO BIND TO PORT!"); log.warning("**** FAILED TO BIND TO PORT!");
log.log(Level.WARNING, "The exception was: " + ioexception.toString()); log.log(Level.WARNING, "The exception was: " + ioexception.toString());
@ -135,33 +139,53 @@ public class MinecraftServer implements Runnable, ICommandListener {
this.serverConfigurationManager = new ServerConfigurationManager(this); this.serverConfigurationManager = new ServerConfigurationManager(this);
// CraftBukkit - removed trackers // CraftBukkit - removed trackers
long j = System.nanoTime(); long i = System.nanoTime();
String s1 = this.propertyManager.getString("level-name", "world"); String s = this.propertyManager.getString("level-name", "world");
String s2 = this.propertyManager.getString("level-seed", ""); String s1 = this.propertyManager.getString("level-seed", "");
long k = (new Random()).nextLong(); long j = (new Random()).nextLong();
if (s2.length() > 0) { if (s1.length() > 0) {
try { try {
k = Long.parseLong(s2); long k = Long.parseLong(s1);
if (k != 0L) {
j = k;
}
} catch (NumberFormatException numberformatexception) { } catch (NumberFormatException numberformatexception) {
k = (long) s2.hashCode(); j = (long) s1.hashCode();
} }
} }
log.info("Preparing level \"" + s1 + "\""); log.info("Preparing level \"" + s + "\"");
this.a(new WorldLoaderServer(new File(".")), s1, k); this.a(new WorldLoaderServer(new File(".")), s, j);
// CraftBukkit start // CraftBukkit start
long elapsed = System.nanoTime() - j; long elapsed = System.nanoTime() - i;
String time = String.format("%.3fs", elapsed / 10000000000.0D); String time = String.format("%.3fs", elapsed / 10000000000.0D);
log.info("Done (" + time + ")! For help, type \"help\" or \"?\""); log.info("Done (" + time + ")! For help, type \"help\" or \"?\"");
// CratBukkit end
if (this.propertyManager.getBoolean("enable-query", false)) {
log.info("Starting GS4 status listener");
this.y = new RemoteStatusListener(this);
this.y.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false)) {
log.info("Starting remote control listener");
this.z = new RemoteControlListener(this);
this.z.a();
}
// CraftBukkit start
if (this.propertyManager.properties.containsKey("spawn-protection")) { if (this.propertyManager.properties.containsKey("spawn-protection")) {
log.info("'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you."); log.info("'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you.");
this.server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16)); this.server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16));
this.propertyManager.properties.remove("spawn-protection"); this.propertyManager.properties.remove("spawn-protection");
this.propertyManager.savePropertiesFile(); this.propertyManager.savePropertiesFile();
} }
// CratBukkit end
return true; return true;
} }
@ -171,21 +195,36 @@ public class MinecraftServer implements Runnable, ICommandListener {
convertable.convert(s, new ConvertProgressUpdater(this)); convertable.convert(s, new ConvertProgressUpdater(this));
} }
// CraftBukkit - removed world array // CraftBukkit - removed world and ticktime arrays
int j = this.propertyManager.getInt("gamemode", 0); int j = this.propertyManager.getInt("gamemode", 0);
j = WorldSettings.a(j); j = WorldSettings.a(j);
log.info("Default game type: " + j); log.info("Default game type: " + j);
// CraftBukkit start (+ removed worldsettings and servernbtmanager) // CraftBukkit start (+ removed worldsettings and servernbtmanager)
for (int k = 0; k < (this.propertyManager.getBoolean("allow-nether", true) ? 2 : 1); ++k) { int worldCount = 2;
if (this.propertyManager.getBoolean("allow-nether", true)) {
worldCount++;
}
for (int k = 0; k < worldCount; ++k) {
WorldServer world; WorldServer world;
int dimension = k == 0 ? 0 : -1; int dimension = 0;
if (k == 1) {
dimension = -1;
}
if (k == 2) {
dimension = 1;
}
String worldType = Environment.getEnvironment(dimension).toString().toLowerCase(); String worldType = Environment.getEnvironment(dimension).toString().toLowerCase();
String name = (dimension == 0) ? s : s + "_" + worldType; String name = (dimension == 0) ? s : s + "_" + worldType;
ChunkGenerator gen = this.server.getGenerator(name); ChunkGenerator gen = this.server.getGenerator(name);
WorldSettings settings = new WorldSettings(i, j, true); WorldSettings settings = new WorldSettings(i, j, true, false);
if (k == 0) { if (k == 0) {
world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
@ -231,7 +270,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
world.addIWorldAccess(new WorldManager(this, world)); world.addIWorldAccess(new WorldManager(this, world));
world.difficulty = this.propertyManager.getInt("difficulty", 1); world.difficulty = this.propertyManager.getInt("difficulty", 1);
world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals); world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
world.p().setGameType(j); world.r().setGameType(j);
this.worlds.add(world); this.worlds.add(world);
this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0])); this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0]));
} }
@ -261,13 +300,13 @@ public class MinecraftServer implements Runnable, ICommandListener {
int i2 = (short1 * 2 + 1) * (short1 * 2 + 1); int i2 = (short1 * 2 + 1) * (short1 * 2 + 1);
int j2 = (j1 + short1) * (short1 * 2 + 1) + k1 + 1; int j2 = (j1 + short1) * (short1 * 2 + 1) + k1 + 1;
this.a("Preparing spawn area", j2 * 100 / i2); this.b("Preparing spawn area", j2 * 100 / i2);
l = l1; l = l1;
} }
worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4); worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4);
while (worldserver.v() && this.isRunning) { while (worldserver.x() && this.isRunning) {
; ;
} }
} }
@ -281,18 +320,18 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
// CraftBukkit end // CraftBukkit end
this.e(); this.t();
} }
private void a(String s, int i) { private void b(String s, int i) {
this.i = s; this.k = s;
this.j = i; this.l = i;
log.info(s + ": " + i + "%"); log.info(s + ": " + i + "%");
} }
private void e() { private void t() {
this.i = null; this.k = null;
this.j = 0; this.l = 0;
this.server.enablePlugins(PluginLoadOrder.POSTWORLD); // CraftBukkit this.server.enablePlugins(PluginLoadOrder.POSTWORLD); // CraftBukkit
} }
@ -365,13 +404,13 @@ public class MinecraftServer implements Runnable, ICommandListener {
j += l; j += l;
i = k; i = k;
if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
this.h(); this.w();
j = 0L; j = 0L;
} else { } else {
while (j > 50L) { while (j > 50L) {
MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
j -= 50L; j -= 50L;
this.h(); this.w();
} }
} }
} }
@ -411,25 +450,26 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
} }
private void h() { private void w() {
long i = System.nanoTime();
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
Iterator iterator = trackerList.keySet().iterator(); Iterator iterator = trackerList.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String s = (String) iterator.next(); String s = (String) iterator.next();
int i = ((Integer) trackerList.get(s)).intValue(); int j = ((Integer) trackerList.get(s)).intValue();
if (i > 0) { if (j > 0) {
trackerList.put(s, Integer.valueOf(i - 1)); trackerList.put(s, Integer.valueOf(j - 1));
} else { } else {
arraylist.add(s); arraylist.add(s);
} }
} }
int j; int k;
for (j = 0; j < arraylist.size(); ++j) { for (k = 0; k < arraylist.size(); ++k) {
trackerList.remove(arraylist.get(j)); trackerList.remove(arraylist.get(k));
} }
AxisAlignedBB.a(); AxisAlignedBB.a();
@ -442,15 +482,16 @@ public class MinecraftServer implements Runnable, ICommandListener {
// Send timeupdates to everyone, it will get the right time from the world the player is in. // Send timeupdates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) { if (this.ticks % 20 == 0) {
for (int i = 0; i < this.serverConfigurationManager.players.size(); ++i) { for ( k = 0; k < this.serverConfigurationManager.players.size(); ++k) {
EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(i); EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(k);
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time
} }
} }
for (j = 0; j < this.worlds.size(); ++j) { for (k = 0; k < this.worlds.size(); ++k) {
// if (j == 0 || this.propertyManager.getBoolean("allow-nether", true)) { long l = System.nanoTime();
WorldServer worldserver = this.worlds.get(j); // if (k == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
WorldServer worldserver = this.worlds.get(k);
/* Drop global timeupdates /* Drop global timeupdates
if (this.ticks % 20 == 0) { if (this.ticks % 20 == 0) {
@ -460,25 +501,28 @@ public class MinecraftServer implements Runnable, ICommandListener {
worldserver.doTick(); worldserver.doTick();
while (worldserver.v()) { while (true) {
; if (!worldserver.x()) {
worldserver.tickEntities();
break;
}
}
} }
worldserver.tickEntities(); // this.g[k][this.ticks % 100] = System.nanoTime() - l; // CraftBukkit
}
// } // CraftBukkit // } // CraftBukkit
this.networkListenThread.a(); this.networkListenThread.a();
this.serverConfigurationManager.b(); this.serverConfigurationManager.b();
// CraftBukkit start // CraftBukkit start
for (j = 0; j < this.worlds.size(); ++j) { for (k = 0; k < this.worlds.size(); ++k) {
this.worlds.get(j).tracker.updatePlayers(); this.worlds.get(k).tracker.updatePlayers();
} }
// CraftBukkit end // CraftBukkit end
for (j = 0; j < this.s.size(); ++j) { for (k = 0; k < this.w.size(); ++k) {
((IUpdatePlayerListBox) this.s.get(j)).a(); ((IUpdatePlayerListBox) this.w.get(k)).a();
} }
try { try {
@ -486,15 +530,17 @@ public class MinecraftServer implements Runnable, ICommandListener {
} catch (Exception exception) { } catch (Exception exception) {
log.log(Level.WARNING, "Unexpected exception while parsing console command", exception); log.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
} }
this.f[this.ticks % 100] = System.nanoTime() - i;
} }
public void issueCommand(String s, ICommandListener icommandlistener) { public void issueCommand(String s, ICommandListener icommandlistener) {
this.t.add(new ServerCommand(s, icommandlistener)); this.x.add(new ServerCommand(s, icommandlistener));
} }
public void b() { public void b() {
while (this.t.size() > 0) { while (this.x.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.t.remove(0); ServerCommand servercommand = (ServerCommand) this.x.remove(0);
// CraftBukkit start - ServerCommand for preprocessing // CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command); ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
@ -508,7 +554,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
public void a(IUpdatePlayerListBox iupdateplayerlistbox) { public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
this.s.add(iupdateplayerlistbox); this.w.add(iupdateplayerlistbox);
} }
public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[]) public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[])
@ -533,7 +579,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
log.info(s); log.info(s);
} }
public void c(String s) { public void warning(String s) {
log.warning(s); log.warning(s);
} }
@ -557,6 +603,94 @@ public class MinecraftServer implements Runnable, ICommandListener {
return this.getWorldServer(i).tracker; // CraftBukkit return this.getWorldServer(i).tracker; // CraftBukkit
} }
public int getProperty(String s, int i) {
return this.propertyManager.getInt(s, i);
}
public String a(String s, String s1) {
return this.propertyManager.getString(s, s1);
}
public void a(String s, Object object) {
this.propertyManager.a(s, object);
}
public void c() {
this.propertyManager.savePropertiesFile();
}
public String getPropertiesFile() {
File file1 = this.propertyManager.c();
return file1 != null ? file1.getAbsolutePath() : "No settings file";
}
public String getMotd() {
return this.s;
}
public int getPort() {
return this.t;
}
public String getServerAddress() {
return this.r;
}
public String getVersion() {
return "1.0.0";
}
public int getPlayerCount() {
return this.serverConfigurationManager.j();
}
public int getMaxPlayers() {
return this.serverConfigurationManager.k();
}
public String[] getPlayers() {
return this.serverConfigurationManager.d();
}
public String getWorldName() {
return this.propertyManager.getString("level-name", "world");
}
public String getPlugins() {
return "";
}
public void o() {}
public String d(String s) {
RemoteControlCommandListener.a.a();
this.consoleCommandHandler.handle(new ServerCommand(s, RemoteControlCommandListener.a));
return RemoteControlCommandListener.a.b();
}
public boolean isDebugging() {
return false;
}
public void severe(String s) {
log.log(Level.SEVERE, s);
}
public void debug(String s) {
if (this.isDebugging()) {
log.log(Level.INFO, s);
}
}
public String[] q() {
return (String[]) this.serverConfigurationManager.f().toArray(new String[0]);
}
public String[] r() {
return (String[]) this.serverConfigurationManager.e().toArray(new String[0]);
}
public static boolean isRunning(MinecraftServer minecraftserver) { public static boolean isRunning(MinecraftServer minecraftserver) {
return minecraftserver.isRunning; return minecraftserver.isRunning;
} }

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