mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 20:50:41 +01:00
Update for 1.0.0
This commit is contained in:
parent
589f66bd1b
commit
345ea36c7b
153 changed files with 6128 additions and 4617 deletions
18
pom.xml
18
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.8.1-R5-SNAPSHOT</version>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>CraftBukkit</name>
|
||||
<url>http://www.bukkit.org</url>
|
||||
<properties>
|
||||
|
@ -18,14 +18,14 @@
|
|||
</scm>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>repobo-rel</id>
|
||||
<name>repo.bukkit.org Releases</name>
|
||||
<url>http://repo.bukkit.org/content/repositories/libs-release-local</url>
|
||||
<id>repobo-rel</id>
|
||||
<name>repo.bukkit.org Releases</name>
|
||||
<url>http://repo.bukkit.org/content/repositories/libs-release-local</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>repobo-snap</id>
|
||||
<name>repo.bukkit.org Snapshots</name>
|
||||
<url>http://repo.bukkit.org/content/repositories/libs-snapshot-local</url>
|
||||
<id>repobo-snap</id>
|
||||
<name>repo.bukkit.org Snapshots</name>
|
||||
<url>http://repo.bukkit.org/content/repositories/libs-snapshot-local</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<repositories>
|
||||
|
@ -44,14 +44,14 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.1-R5-SNAPSHOT</version>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.8.1_01</version>
|
||||
<version>1.9.RC1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -22,41 +22,42 @@ public class Block {
|
|||
public static final boolean[] r = new boolean[256];
|
||||
public static final int[] s = new int[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 BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).a("grass");
|
||||
public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).a("dirt");
|
||||
public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stonebrick");
|
||||
public static final Block WOOD = (new Block(5, 4, Material.WOOD)).c(2.0F).b(5.0F).a(e).a("wood").g();
|
||||
public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).a("sapling").g();
|
||||
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).i().b(6000000.0F).a(h).a("bedrock").n();
|
||||
public static final Block WATER = (new BlockFlowing(8, 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).f(3).a("water").n().g();
|
||||
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 STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).f(255).a("lava").n().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").i();
|
||||
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).g(3).a("water").p().i();
|
||||
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).g(255).a("lava").p().i();
|
||||
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 GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).a("gravel");
|
||||
public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).a("oreGold");
|
||||
public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).a("oreIron");
|
||||
public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).a("oreCoal");
|
||||
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).a("log").g();
|
||||
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).f(1).a(g).a("leaves").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).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 GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).a("glass");
|
||||
public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).a("oreLapis");
|
||||
public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).a("blockLapis");
|
||||
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).a("dispenser").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 NOTE_BLOCK = (new BlockNote(25)).c(0.8F).a("musicBlock").g();
|
||||
public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed").n().g();
|
||||
public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).a("goldenRail").g();
|
||||
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).a("detectorRail").g();
|
||||
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).a("pistonStickyBase").g();
|
||||
public static final Block WEB = (new BlockWeb(30, 11)).f(1).c(4.0F).a("web");
|
||||
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").p().i();
|
||||
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").i();
|
||||
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).a("pistonStickyBase").i();
|
||||
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 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 BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).g();
|
||||
public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).a("cloth").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)).i();
|
||||
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 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");
|
||||
|
@ -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 BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).a("bookshelf");
|
||||
public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stoneMoss");
|
||||
public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(10.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 BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").n();
|
||||
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").n();
|
||||
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").g();
|
||||
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").g();
|
||||
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust").n().g();
|
||||
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").i();
|
||||
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").p();
|
||||
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").i();
|
||||
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_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond");
|
||||
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench");
|
||||
public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").n().g();
|
||||
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland").g();
|
||||
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").g();
|
||||
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 SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").n().g();
|
||||
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).a("doorWood").n().g();
|
||||
public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).a("ladder").g();
|
||||
public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).a("rail").g();
|
||||
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE)).a("stairsStone").g();
|
||||
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 LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).a("lever").g();
|
||||
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 IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).a("doorIron").n().g();
|
||||
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 REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).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").g();
|
||||
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_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).a("notGate").g();
|
||||
public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).a("button").g();
|
||||
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).a("snow");
|
||||
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).f(3).a(j).a("ice");
|
||||
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").i();
|
||||
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").i();
|
||||
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").p().i();
|
||||
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").i();
|
||||
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").p().i();
|
||||
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").i();
|
||||
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").i();
|
||||
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").i();
|
||||
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").i();
|
||||
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").g(0);
|
||||
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 CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).a("cactus");
|
||||
public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).a("clay");
|
||||
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").n();
|
||||
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").g();
|
||||
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").i();
|
||||
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 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 Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).a("litpumpkin").g();
|
||||
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake").n().g();
|
||||
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).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").n().g();
|
||||
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 TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").n().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").p().i();
|
||||
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").p().i();
|
||||
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").p().i();
|
||||
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F);
|
||||
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).a("stonebricksmooth");
|
||||
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).a("mushroom").g();
|
||||
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 IRON_FENCE = (new BlockThin(101, 85, 85, Material.ORE)).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 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").i();
|
||||
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, false)).c(0.3F).a(j).a("thinGlass");
|
||||
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).a("melon");
|
||||
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).a("pumpkinStem").g();
|
||||
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).a("pumpkinStem").g();
|
||||
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).a("vine").g();
|
||||
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 BRICK_STAIRS = (new BlockStairs(108, BRICK)).a("stairsBrick").g();
|
||||
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK)).a("stairsStoneBrickSmooth").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").i();
|
||||
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").i();
|
||||
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").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 final int id;
|
||||
protected float strength;
|
||||
protected float durability;
|
||||
protected boolean bD;
|
||||
protected boolean bE;
|
||||
protected boolean bR;
|
||||
protected boolean bS;
|
||||
public double minX;
|
||||
public double minY;
|
||||
public double minZ;
|
||||
|
@ -144,16 +158,16 @@ public class Block {
|
|||
public double maxY;
|
||||
public double maxZ;
|
||||
public StepSound stepSound;
|
||||
public float bM;
|
||||
public float ca;
|
||||
public final Material material;
|
||||
public float frictionFactor;
|
||||
private String name;
|
||||
|
||||
protected Block(int i, Material material) {
|
||||
this.bD = true;
|
||||
this.bE = true;
|
||||
this.bR = true;
|
||||
this.bS = true;
|
||||
this.stepSound = d;
|
||||
this.bM = 1.0F;
|
||||
this.ca = 1.0F;
|
||||
this.frictionFactor = 0.6F;
|
||||
if (byId[i] != null) {
|
||||
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;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void h() {}
|
||||
protected void j() {}
|
||||
|
||||
protected Block(int i, int j, Material material) {
|
||||
this(i, material);
|
||||
|
@ -186,7 +200,7 @@ public class Block {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected Block f(int i) {
|
||||
protected Block g(int i) {
|
||||
q[this.id] = i;
|
||||
return this;
|
||||
}
|
||||
|
@ -205,6 +219,10 @@ public class Block {
|
|||
return true;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected Block c(float f) {
|
||||
this.strength = f;
|
||||
if (this.durability < f * 5.0F) {
|
||||
|
@ -214,12 +232,12 @@ public class Block {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected Block i() {
|
||||
protected Block k() {
|
||||
this.c(-1.0F);
|
||||
return this;
|
||||
}
|
||||
|
||||
public float j() {
|
||||
public float l() {
|
||||
return this.strength;
|
||||
}
|
||||
|
||||
|
@ -266,10 +284,10 @@ public class Block {
|
|||
}
|
||||
|
||||
public boolean a(int i, boolean flag) {
|
||||
return this.q_();
|
||||
return this.v_();
|
||||
}
|
||||
|
||||
public boolean q_() {
|
||||
public boolean v_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -279,7 +297,7 @@ public class Block {
|
|||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
@ -291,7 +309,7 @@ public class Block {
|
|||
return 1;
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
public int a(int i, Random random, int j) {
|
||||
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);
|
||||
}
|
||||
|
||||
public final void g(World world, int i, int j, int k, int l) {
|
||||
this.dropNaturally(world, i, j, k, l, 1.0F);
|
||||
public final void b(World world, int i, int j, int k, int l, int i1) {
|
||||
this.dropNaturally(world, i, j, k, l, 1.0F, i1);
|
||||
}
|
||||
|
||||
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) {
|
||||
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
|
||||
if (world.random.nextFloat() < f) {
|
||||
int k1 = this.a(l, world.random);
|
||||
int l1 = this.a(l, world.random, i1);
|
||||
|
||||
if (k1 > 0) {
|
||||
this.a(world, i, j, k, new ItemStack(k1, 1, this.a_(l)));
|
||||
if (l1 > 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -487,10 +505,36 @@ public class Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void f() {}
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
entityhuman.a(StatisticList.C[this.id], 1);
|
||||
entityhuman.b(0.025F);
|
||||
this.g(world, i, j, k, l);
|
||||
entityhuman.c(0.025F);
|
||||
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) {
|
||||
|
@ -504,26 +548,26 @@ public class Block {
|
|||
return this;
|
||||
}
|
||||
|
||||
public String k() {
|
||||
return StatisticCollector.a(this.l() + ".name");
|
||||
public String m() {
|
||||
return StatisticCollector.a(this.n() + ".name");
|
||||
}
|
||||
|
||||
public String l() {
|
||||
public String n() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, int i1) {}
|
||||
|
||||
public boolean m() {
|
||||
return this.bE;
|
||||
public boolean o() {
|
||||
return this.bS;
|
||||
}
|
||||
|
||||
protected Block n() {
|
||||
this.bE = false;
|
||||
protected Block p() {
|
||||
this.bS = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
public int g() {
|
||||
return this.material.l();
|
||||
}
|
||||
|
||||
|
@ -535,7 +579,8 @@ public class Block {
|
|||
Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling");
|
||||
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves");
|
||||
Item.byId[VINE.id] = new ItemColoredBlock(VINE.id - 256, false);
|
||||
Item.byId[LONG_GRASS.id] = new ItemColoredBlock(LONG_GRASS.id - 256, true);
|
||||
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_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
|
||||
|
@ -543,9 +588,27 @@ public class Block {
|
|||
Item.byId[MOB_SPAWNER.id] = new ItemMobSpawner(MOB_SPAWNER.id - 256); // CraftBukkit
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
if (byId[i] != null && Item.byId[i] == null) {
|
||||
Item.byId[i] = new ItemBlock(i - 256);
|
||||
byId[i].h();
|
||||
if (byId[i] != null) {
|
||||
if (Item.byId[i] == null) {
|
||||
Item.byId[i] = new ItemBlock(i - 256);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ public class BlockButton extends Block {
|
|||
return null;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class BlockButton extends Block {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class BlockButton extends Block {
|
|||
|
||||
private boolean h(World world, int i, int j, int 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);
|
||||
return false;
|
||||
} else {
|
||||
|
@ -162,7 +162,7 @@ public class BlockButton extends Block {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,13 +53,17 @@ public class BlockCactus extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 13;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,11 +17,11 @@ public class BlockDispenser extends BlockContainer {
|
|||
this.textureId = 45;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
public int a(int i, Random random, int j) {
|
||||
return Block.DISPENSER.id;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public class BlockDispenser extends BlockContainer {
|
|||
double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
|
||||
|
||||
if (itemstack == null) {
|
||||
world.e(1001, i, j, k, 0);
|
||||
world.f(1001, i, j, k, 0);
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
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.fromPlayer = true;
|
||||
world.addEntity(entityarrow);
|
||||
world.e(1002, i, j, k, 0);
|
||||
world.f(1002, i, j, k, 0);
|
||||
} else if (itemstack.id == Item.EGG.id) {
|
||||
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
|
||||
|
||||
entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
||||
world.addEntity(entityegg);
|
||||
world.e(1002, i, j, k, 0);
|
||||
world.f(1002, i, j, k, 0);
|
||||
} else if (itemstack.id == Item.SNOW_BALL.id) {
|
||||
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
|
||||
|
||||
entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
||||
world.addEntity(entitysnowball);
|
||||
world.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 {
|
||||
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||
// CraftBukkit start
|
||||
|
@ -170,10 +176,10 @@ public class BlockDispenser extends BlockContainer {
|
|||
entityitem.motZ = motZ;
|
||||
// CraftBukkit end
|
||||
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);
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class BlockDoor extends Block {
|
|||
|
||||
public int a(int i, int j) {
|
||||
if (i != 0 && i != 1) {
|
||||
int k = this.d(j);
|
||||
int k = this.e(j);
|
||||
|
||||
if ((k == 0 || k == 2) ^ i <= 3) {
|
||||
return this.textureId;
|
||||
|
@ -50,16 +50,20 @@ public class BlockDoor extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
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!
|
||||
return super.e(world, i, j, 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;
|
||||
|
||||
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 (!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()) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -193,20 +197,19 @@ public class BlockDoor extends Block {
|
|||
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;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
world.getClass();
|
||||
return j >= 128 - 1 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
|
||||
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);
|
||||
}
|
||||
|
||||
public static boolean e(int i) {
|
||||
public static boolean f(int i) {
|
||||
return (i & 4) != 0;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
public int g() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class BlockFire extends Block {
|
|||
this.a(true);
|
||||
}
|
||||
|
||||
public void h() {
|
||||
public void j() {
|
||||
this.a(Block.WOOD.id, 5, 20);
|
||||
this.a(Block.FENCE.id, 5, 20);
|
||||
this.a(Block.WOOD_STAIRS.id, 5, 20);
|
||||
|
@ -50,22 +50,30 @@ public class BlockFire extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public int a(Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return 40;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
|
||||
|
||||
if (world.worldProvider instanceof WorldProviderSky && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
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);
|
||||
} else {
|
||||
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.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 (!world.e(i, j - 1, k) || l > 3) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
|
@ -112,7 +120,7 @@ public class BlockFire extends Block {
|
|||
if (i2 > 0) {
|
||||
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;
|
||||
|
||||
if (k2 > 15) {
|
||||
|
@ -167,7 +175,7 @@ public class BlockFire extends Block {
|
|||
}
|
||||
// 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;
|
||||
|
||||
if (k1 > 15) {
|
||||
|
@ -206,7 +214,7 @@ public class BlockFire extends Block {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean q_() {
|
||||
public boolean v_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -231,11 +239,11 @@ public class BlockFire extends Block {
|
|||
}
|
||||
|
||||
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)) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
world.c(i, j, k, this.id, this.c());
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class BlockFlowing extends BlockFluids {
|
|||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} else if (flag) {
|
||||
|
@ -103,6 +103,12 @@ public class BlockFlowing extends BlockFluids {
|
|||
}
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (this.material == Material.LAVA && world.getMaterial(i, j - 1, k) == Material.WATER) {
|
||||
world.setTypeId(i, j - 1, k, Block.STONE.id);
|
||||
this.h(world, i, j - 1, k);
|
||||
return;
|
||||
}
|
||||
|
||||
if (l >= 8) {
|
||||
world.setTypeIdAndData(i, j - 1, k, this.id, l);
|
||||
} else {
|
||||
|
@ -152,7 +158,7 @@ public class BlockFlowing extends BlockFluids {
|
|||
if (this.material == Material.LAVA) {
|
||||
this.h(world, i, j, k);
|
||||
} 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;
|
||||
|
||||
for (int k1 = 0; k1 < 4; ++k1) {
|
||||
|
@ -190,7 +196,7 @@ public class BlockFlowing extends BlockFluids {
|
|||
}
|
||||
|
||||
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) {
|
||||
j1 = j2;
|
||||
|
@ -232,7 +238,7 @@ public class BlockFlowing extends BlockFluids {
|
|||
if (!this.k(world, i1, j - 1, j1)) {
|
||||
this.c[l] = 0;
|
||||
} 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 {
|
||||
Material material = Block.byId[l].material;
|
||||
|
||||
return material.isSolid();
|
||||
return material == Material.PORTAL ? true : material.isSolid();
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
|
@ -295,7 +301,7 @@ public class BlockFlowing extends BlockFluids {
|
|||
public void a(World world, int i, int j, int k) {
|
||||
super.a(world, i, j, k);
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@ public class BlockGrass extends Block {
|
|||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
if (world.getLightLevel(i, j + 1, k) < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) {
|
||||
if (random.nextInt(4) != 0) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState();
|
||||
|
@ -38,30 +35,32 @@ public class BlockGrass extends Block {
|
|||
}
|
||||
// CraftBukkit end
|
||||
} else if (world.getLightLevel(i, j + 1, k) >= 9) {
|
||||
int l = i + random.nextInt(3) - 1;
|
||||
int i1 = j + random.nextInt(5) - 3;
|
||||
int j1 = k + random.nextInt(3) - 1;
|
||||
int k1 = world.getTypeId(l, i1 + 1, j1);
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
int i1 = i + random.nextInt(3) - 1;
|
||||
int j1 = j + random.nextInt(5) - 3;
|
||||
int k1 = k + random.nextInt(3) - 1;
|
||||
int l1 = world.getTypeId(i1, j1 + 1, k1);
|
||||
|
||||
if (world.getTypeId(l, i1, j1) == Block.DIRT.id && world.getLightLevel(l, i1 + 1, j1) >= 4 && Block.q[k1] <= 2) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(l, i1, j1).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.q[l1] <= 2) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
blockState.update(true);
|
||||
if (!event.isCancelled()) {
|
||||
blockState.update(true);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
return Block.DIRT.a(0, random);
|
||||
public int a(int i, Random random, int j) {
|
||||
return Block.DIRT.a(0, random, j);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,12 +32,16 @@ public class BlockIce extends BlockBreakable {
|
|||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
public int e() {
|
||||
public int g() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected ItemStack a_(int i) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class BlockLeaves extends BlockLeavesBase {
|
|||
if (event.isCancelled()) return;
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -134,12 +134,12 @@ public class BlockLeaves extends BlockLeavesBase {
|
|||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
this.a(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
|
||||
} else {
|
||||
|
@ -147,7 +147,7 @@ public class BlockLeaves extends BlockLeavesBase {
|
|||
}
|
||||
}
|
||||
|
||||
protected int a_(int i) {
|
||||
protected int c(int i) {
|
||||
return i & 3;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@ public class BlockLever extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k, int l) {
|
||||
return l == 1 && world.e(i, j - 1, k) ? true : (l == 2 && world.e(i, j, k + 1) ? true : (l == 3 && world.e(i, j, k - 1) ? true : (l == 4 && world.e(i + 1, j, k) ? true : l == 5 && world.e(i - 1, j, k))));
|
||||
}
|
||||
|
@ -55,7 +59,7 @@ public class BlockLever extends Block {
|
|||
}
|
||||
|
||||
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);
|
||||
} else {
|
||||
world.setData(i, j, k, i1 + j1);
|
||||
|
@ -92,7 +96,7 @@ public class BlockLever extends Block {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +104,7 @@ public class BlockLever extends Block {
|
|||
|
||||
private boolean g(World world, int i, int j, int 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);
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -12,7 +12,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
|||
this.a(true);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
|||
}
|
||||
|
||||
if (flag1) {
|
||||
world.c(i, j, k, this.id, this.c());
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,28 +12,30 @@ public class BlockMobSpawner extends BlockContainer {
|
|||
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
|
||||
}
|
||||
|
||||
public int a(Random random) {
|
||||
return 0; // CraftBukkit
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 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);
|
||||
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) {
|
||||
dropNaturally(world, i, j, k, 0, 1.0f);
|
||||
dropNaturally(world, i, j, k, 0, 1.0f, 0);
|
||||
super.remove(world, i, j, k);
|
||||
}
|
||||
|
||||
protected int a_(int i) {
|
||||
protected int c(int i) {
|
||||
return i;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
|
|
@ -14,7 +14,7 @@ public class BlockMushroom extends BlockFlower {
|
|||
}
|
||||
|
||||
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;
|
||||
int l = 5;
|
||||
|
||||
|
@ -68,44 +68,37 @@ public class BlockMushroom extends BlockFlower {
|
|||
}
|
||||
}
|
||||
|
||||
protected boolean c(int i) {
|
||||
protected boolean d(int i) {
|
||||
return Block.o[i];
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
if (j >= 0) {
|
||||
world.getClass();
|
||||
if (j < 128) {
|
||||
return world.k(i, j, k) < 13 && this.c(world.getTypeId(i, j - 1, k));
|
||||
}
|
||||
}
|
||||
if (j >= 0 && j < world.height) {
|
||||
int l = world.getTypeId(i, j - 1, k);
|
||||
|
||||
return false;
|
||||
return l == Block.MYCEL.id || world.k(i, j, k) < 13 && this.d(l);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
world.setRawTypeId(i, j, k, 0);
|
||||
WorldGenHugeMushroom worldgenhugemushroom = null;
|
||||
|
||||
if (this.id == Block.BROWN_MUSHROOM.id) {
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(0);
|
||||
} else if (this.id == Block.RED_MUSHROOM.id) {
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(1);
|
||||
}
|
||||
|
||||
if (worldgenhugemushroom != null && worldgenhugemushroom.a(world, random, i, j, k)) {
|
||||
return true;
|
||||
} else {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
world.setRawTypeId(i, j, k, 0);
|
||||
WorldGenHugeMushroom worldgenhugemushroom = null;
|
||||
|
||||
if (this.id == Block.BROWN_MUSHROOM.id) {
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(0);
|
||||
} else if (this.id == Block.RED_MUSHROOM.id) {
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(1);
|
||||
}
|
||||
|
||||
if (worldgenhugemushroom != null && worldgenhugemushroom.a(world, random, i, j, k)) {
|
||||
return true;
|
||||
} else {
|
||||
world.setRawTypeIdAndData(i, j, k, this.id, i1);
|
||||
return false;
|
||||
}
|
||||
world.setRawTypeIdAndData(i, j, k, this.id, l);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package net.minecraft.server;
|
|||
import java.util.ArrayList;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
|
@ -12,7 +11,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
|
|||
public class BlockPiston extends Block {
|
||||
|
||||
private boolean a;
|
||||
private boolean b;
|
||||
private static boolean b;
|
||||
|
||||
public BlockPiston(int i, int j, boolean flag) {
|
||||
super(i, j, Material.PISTON);
|
||||
|
@ -22,9 +21,13 @@ public class BlockPiston extends Block {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
@ -39,32 +42,32 @@ public class BlockPiston extends Block {
|
|||
int l = c(world, i, j, k, (EntityHuman) entityliving);
|
||||
|
||||
world.setData(i, j, k, l);
|
||||
if (!world.isStatic) {
|
||||
if (!world.isStatic && !b) {
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int 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);
|
||||
|
||||
if (l != 7) {
|
||||
if (flag && !d(l)) {
|
||||
if (flag && !e(l)) {
|
||||
// CraftBukkit start
|
||||
int length = h(world, i, j, k, i1);
|
||||
int length = g(world, i, j, k, i1);
|
||||
if (length >= 0) {
|
||||
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.playNote(i, j, k, 0, i1);
|
||||
}
|
||||
} else if (!flag && d(l)) {
|
||||
} else if (!flag && e(l)) {
|
||||
// CraftBukkit start
|
||||
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) {
|
||||
this.b = true;
|
||||
b = true;
|
||||
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.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) {
|
||||
TileEntity tileentity = world.getTileEntity(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1]);
|
||||
|
||||
if (tileentity != null && tileentity instanceof TileEntityPiston) {
|
||||
((TileEntityPiston) tileentity).e();
|
||||
((TileEntityPiston) tileentity).g();
|
||||
}
|
||||
|
||||
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) {
|
||||
TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1;
|
||||
|
||||
if (tileentitypiston.d() == i1 && tileentitypiston.c()) {
|
||||
tileentitypiston.e();
|
||||
i2 = tileentitypiston.a();
|
||||
if (tileentitypiston.f() == i1 && tileentitypiston.e()) {
|
||||
tileentitypiston.g();
|
||||
i2 = tileentitypiston.c();
|
||||
j2 = tileentitypiston.j();
|
||||
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)) {
|
||||
this.b = false;
|
||||
world.setTypeId(j1, k1, l1, 0);
|
||||
this.b = true;
|
||||
if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].g() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
|
||||
i += PistonBlockTextures.b[i1];
|
||||
j += PistonBlockTextures.c[i1];
|
||||
k += PistonBlockTextures.d[i1];
|
||||
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2);
|
||||
world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
|
||||
b = false;
|
||||
world.setTypeId(j1, k1, l1, 0);
|
||||
b = true;
|
||||
} else if (!flag) {
|
||||
this.b = false;
|
||||
b = false;
|
||||
world.setTypeId(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1], 0);
|
||||
this.b = true;
|
||||
b = true;
|
||||
}
|
||||
} else {
|
||||
this.b = false;
|
||||
b = false;
|
||||
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);
|
||||
}
|
||||
|
||||
this.b = false;
|
||||
b = false;
|
||||
}
|
||||
|
||||
public void a(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.getData(i, j, k);
|
||||
|
||||
if (d(l)) {
|
||||
switch (c(l)) {
|
||||
if (e(l)) {
|
||||
switch (d(l)) {
|
||||
case 0:
|
||||
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
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) {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
|
@ -208,11 +217,11 @@ public class BlockPiston extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static int c(int i) {
|
||||
public static int d(int i) {
|
||||
return i & 7;
|
||||
}
|
||||
|
||||
public static boolean d(int i) {
|
||||
public static boolean e(int i) {
|
||||
return (i & 8) != 0;
|
||||
}
|
||||
|
||||
|
@ -239,29 +248,27 @@ public class BlockPiston extends Block {
|
|||
return false;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
if (Block.byId[i].e() == 2) {
|
||||
if (Block.byId[i].g() == 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!flag && Block.byId[i].e() == 1) {
|
||||
if (!flag && Block.byId[i].g() == 1) {
|
||||
return false;
|
||||
}
|
||||
} else if (d(world.getData(j, k, l))) {
|
||||
} else if (e(world.getData(j, k, l))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(j, k, l);
|
||||
|
||||
return tileentity == null;
|
||||
return !(Block.byId[i] instanceof BlockContainer);
|
||||
}
|
||||
}
|
||||
|
||||
// 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 j1 = j + PistonBlockTextures.c[l];
|
||||
int k1 = k + PistonBlockTextures.d[l];
|
||||
|
@ -269,41 +276,36 @@ public class BlockPiston extends Block {
|
|||
|
||||
while (true) {
|
||||
if (l1 < 13) {
|
||||
if (j1 > 0) {
|
||||
world.getClass();
|
||||
if (j1 < 128 - 1) {
|
||||
int i2 = world.getTypeId(i1, j1, k1);
|
||||
|
||||
if (i2 != 0) {
|
||||
if (!a(i2, world, i1, j1, k1, true)) {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
if (Block.byId[i2].e() != 1) {
|
||||
if (l1 == 12) {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
i1 += PistonBlockTextures.b[l];
|
||||
j1 += PistonBlockTextures.c[l];
|
||||
k1 += PistonBlockTextures.d[l];
|
||||
++l1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return l1; // CraftBukkit
|
||||
}
|
||||
if (j1 <= 0 || j1 >= world.height - 1) {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
return -1; // CraftBukkit
|
||||
int i2 = world.getTypeId(i1, j1, k1);
|
||||
|
||||
if (i2 != 0) {
|
||||
if (!a(i2, world, i1, j1, k1, true)) {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
if (Block.byId[i2].g() != 1) {
|
||||
if (l1 == 12) {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
i1 += PistonBlockTextures.b[l];
|
||||
j1 += PistonBlockTextures.c[l];
|
||||
k1 += PistonBlockTextures.d[l];
|
||||
++l1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 j1 = j + PistonBlockTextures.c[l];
|
||||
int k1 = k + PistonBlockTextures.d[l];
|
||||
|
@ -313,36 +315,30 @@ public class BlockPiston extends Block {
|
|||
int i2;
|
||||
|
||||
if (l1 < 13) {
|
||||
label63: {
|
||||
if (j1 > 0) {
|
||||
world.getClass();
|
||||
if (j1 < 128 - 1) {
|
||||
i2 = world.getTypeId(i1, j1, k1);
|
||||
if (i2 != 0) {
|
||||
if (!a(i2, world, i1, j1, k1, true)) {
|
||||
return false;
|
||||
}
|
||||
if (j1 <= 0 || j1 >= world.height - 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.byId[i2].e() != 1) {
|
||||
if (l1 == 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
i1 += PistonBlockTextures.b[l];
|
||||
j1 += PistonBlockTextures.c[l];
|
||||
k1 += PistonBlockTextures.d[l];
|
||||
++l1;
|
||||
continue;
|
||||
}
|
||||
|
||||
Block.byId[i2].g(world, i1, j1, k1, world.getData(i1, j1, k1));
|
||||
world.setTypeId(i1, j1, k1, 0);
|
||||
}
|
||||
break label63;
|
||||
}
|
||||
i2 = world.getTypeId(i1, j1, k1);
|
||||
if (i2 != 0) {
|
||||
if (!a(i2, world, i1, j1, k1, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (Block.byId[i2].g() != 1) {
|
||||
if (l1 == 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
i1 += PistonBlockTextures.b[l];
|
||||
j1 += PistonBlockTextures.c[l];
|
||||
k1 += PistonBlockTextures.d[l];
|
||||
++l1;
|
||||
continue;
|
||||
}
|
||||
|
||||
Block.byId[i2].b(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
|
||||
world.setTypeId(i1, j1, k1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ public class BlockPistonExtension extends Block {
|
|||
|
||||
if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) {
|
||||
l = world.getData(i, j, k);
|
||||
if (BlockPiston.d(l)) {
|
||||
Block.byId[j1].g(world, i, j, k, l);
|
||||
if (BlockPiston.e(l)) {
|
||||
Block.byId[j1].b(world, i, j, k, l, 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);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 17;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ public class BlockPortal extends BlockBreakable {
|
|||
world.getServer().getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
entity.T();
|
||||
entity.Y();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class BlockPressurePlate extends Block {
|
|||
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class BlockPressurePlate extends Block {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ public class BlockPressurePlate extends Block {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,21 @@ public class BlockPumpkin extends Block {
|
|||
|
||||
public void a(World world, int i, int j, int 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) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|||
this.a(true);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -145,14 +145,14 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
super.doPhysics(world, i, j, k, l);
|
||||
world.c(i, j, k, this.id, this.c());
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ public class BlockRedstoneWire extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int 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);
|
||||
|
||||
if (!flag) {
|
||||
this.g(world, i, j, k, i1);
|
||||
this.b(world, i, j, k, i1, 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -306,25 +310,25 @@ public class BlockRedstoneWire extends Block {
|
|||
} else if (l == 1) {
|
||||
return true;
|
||||
} 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 flag1 = c(iblockaccess, i + 1, j, k, 3) || !iblockaccess.e(i + 1, j, k) && c(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 flag3 = c(iblockaccess, i, j, k + 1, 0) || !iblockaccess.e(i, j, k + 1) && c(iblockaccess, i, j - 1, k + 1, -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 = d(iblockaccess, i + 1, j, k, 3) || !iblockaccess.e(i + 1, j, k) && d(iblockaccess, i + 1, j - 1, k, -1);
|
||||
boolean flag2 = d(iblockaccess, i, j, k - 1, 2) || !iblockaccess.e(i, j, k - 1) && d(iblockaccess, i, j - 1, k - 1, -1);
|
||||
boolean flag3 = d(iblockaccess, i, j, k + 1, 0) || !iblockaccess.e(i, j, k + 1) && d(iblockaccess, i, j - 1, k + 1, -1);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -344,14 +348,30 @@ public class BlockRedstoneWire extends Block {
|
|||
return true;
|
||||
} else if (i1 == 0) {
|
||||
return false;
|
||||
} else if (Block.byId[i1].isPowerSource()) {
|
||||
} else if (Block.byId[i1].isPowerSource() && l != -1) {
|
||||
return true;
|
||||
} else if (i1 != Block.DIODE_OFF.id && i1 != Block.DIODE_ON.id) {
|
||||
return false;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,30 +11,32 @@ public class BlockSand extends Block {
|
|||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
this.g(world, i, j, k);
|
||||
this.h(world, i, j, k);
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
if (d_(world, i, j - 1, k) && j >= 0) {
|
||||
private void h(World world, int i, int j, int k) {
|
||||
if (g(world, i, j - 1, k) && j >= 0) {
|
||||
byte b0 = 32;
|
||||
|
||||
if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
// 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));
|
||||
if (!world.isStatic) {
|
||||
// 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));
|
||||
|
||||
world.addEntity(entityfallingsand);
|
||||
world.addEntity(entityfallingsand);
|
||||
}
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -45,11 +47,11 @@ public class BlockSand extends Block {
|
|||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
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);
|
||||
|
||||
if (l == 0) {
|
||||
|
|
|
@ -16,7 +16,7 @@ public class BlockSapling extends BlockFlower {
|
|||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
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);
|
||||
|
||||
if ((l & 8) == 0) {
|
||||
|
@ -42,15 +42,16 @@ public class BlockSapling extends BlockFlower {
|
|||
boolean grownTree;
|
||||
BlockChangeWithNotify delegate = new BlockChangeWithNotify(world);
|
||||
|
||||
// All of these are 'false' because we need the 'raw' calls so the block-delegate works
|
||||
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) {
|
||||
grownTree = new WorldGenForest().generate(delegate, random, i, j, k);
|
||||
grownTree = new WorldGenForest(false).generate(delegate, random, i, j, k);
|
||||
} else {
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
protected int a_(int i) {
|
||||
protected int c(int i) {
|
||||
return i & 3;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,10 @@ public class BlockSign extends BlockContainer {
|
|||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -101,7 +105,7 @@ public class BlockSign extends BlockContainer {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BlockSnow extends Block {
|
|||
|
||||
private boolean g(World world, int i, int j, int 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);
|
||||
return false;
|
||||
} else {
|
||||
|
@ -66,7 +66,7 @@ public class BlockSnow extends Block {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class BlockSnow extends Block {
|
|||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class BlockSoil extends Block {
|
|||
this.textureId = 87;
|
||||
this.a(true);
|
||||
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) {
|
||||
|
@ -34,18 +34,16 @@ public class BlockSoil extends Block {
|
|||
}
|
||||
|
||||
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.s(i, j + 1, k)) {
|
||||
int l = world.getData(i, j, k);
|
||||
if (!this.h(world, i, j, k) && !world.v(i, j + 1, k)) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l > 0) {
|
||||
world.setData(i, j, k, l - 1);
|
||||
} else if (!this.g(world, i, j, k)) {
|
||||
world.setTypeId(i, j, k, Block.DIRT.id);
|
||||
}
|
||||
} else {
|
||||
world.setData(i, j, k, 7);
|
||||
if (l > 0) {
|
||||
world.setData(i, j, k, l - 1);
|
||||
} else if (!this.g(world, i, j, k)) {
|
||||
world.setTypeId(i, j, k, Block.DIRT.id);
|
||||
}
|
||||
} else {
|
||||
world.setData(i, j, k, 7);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +106,7 @@ public class BlockSoil extends Block {
|
|||
}
|
||||
}
|
||||
|
||||
public int a(int i, Random random) {
|
||||
return Block.DIRT.a(0, random);
|
||||
public int a(int i, Random random, int j) {
|
||||
return Block.DIRT.a(0, random, j);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class BlockStairs extends Block {
|
|||
this.c(block.strength);
|
||||
this.b(block.durability / 3.0F);
|
||||
this.a(block.stepSound);
|
||||
this.f(255);
|
||||
this.g(255);
|
||||
}
|
||||
|
||||
public void a(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
|
@ -32,6 +32,10 @@ public class BlockStairs extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
|
@ -72,14 +76,6 @@ public class BlockStairs extends Block {
|
|||
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) {
|
||||
return this.a.a(i, 0);
|
||||
}
|
||||
|
@ -88,16 +84,16 @@ public class BlockStairs extends Block {
|
|||
return this.a.a(i, 0);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.a.c();
|
||||
public int d() {
|
||||
return this.a.d();
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) {
|
||||
this.a.a(world, i, j, k, entity, vec3d);
|
||||
}
|
||||
|
||||
public boolean q_() {
|
||||
return this.a.q_();
|
||||
public boolean v_() {
|
||||
return this.a.v_();
|
||||
}
|
||||
|
||||
public boolean a(int i, boolean flag) {
|
||||
|
@ -117,8 +113,8 @@ public class BlockStairs extends Block {
|
|||
this.a.remove(world, i, j, k);
|
||||
}
|
||||
|
||||
public void dropNaturally(World world, int i, int j, int k, int l, float f) {
|
||||
this.a.dropNaturally(world, i, j, k, 0, f); // CraftBukkit - don't propagate stair direction
|
||||
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, i1); // CraftBukkit - don't propagate stair direction
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Entity entity) {
|
||||
|
|
|
@ -27,7 +27,7 @@ public class BlockStationary extends BlockFluids {
|
|||
world.suppressPhysics = true;
|
||||
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.c(i, j, k, this.id - 1, this.c());
|
||||
world.c(i, j, k, this.id - 1, this.d());
|
||||
world.suppressPhysics = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,20 +25,30 @@ public class BlockTrapdoor extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
if (d(i)) {
|
||||
if (e(i)) {
|
||||
if ((i & 3) == 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (!world.e(j1, j, k1)) {
|
||||
if (!f(world.getTypeId(j1, j, k1))) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
this.g(world, i, j, k, i1);
|
||||
this.b(world, i, j, k, i1, 0);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
|
@ -179,11 +189,21 @@ public class BlockTrapdoor extends Block {
|
|||
--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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Bukkit; // CraftBukkit
|
||||
|
||||
public class Chunk {
|
||||
|
||||
|
@ -24,6 +24,7 @@ public class Chunk {
|
|||
public int k;
|
||||
public final int x;
|
||||
public final int z;
|
||||
private boolean v;
|
||||
public Map tileEntities;
|
||||
public List[] entitySlices;
|
||||
public boolean done;
|
||||
|
@ -36,14 +37,14 @@ public class Chunk {
|
|||
public Chunk(World world, int i, int j) {
|
||||
this.c = new int[256];
|
||||
this.d = new boolean[256];
|
||||
this.v = false;
|
||||
this.tileEntities = new HashMap();
|
||||
this.done = false;
|
||||
this.q = false;
|
||||
this.s = false;
|
||||
this.t = 0L;
|
||||
this.u = false;
|
||||
world.getClass();
|
||||
this.entitySlices = new List[128 / 16];
|
||||
this.entitySlices = new List[world.height / 16];
|
||||
this.world = world;
|
||||
this.x = i;
|
||||
this.z = j;
|
||||
|
@ -71,14 +72,9 @@ public class Chunk {
|
|||
public Chunk(World world, byte[] abyte, int i, int j) {
|
||||
this(world, i, j);
|
||||
this.b = abyte;
|
||||
|
||||
int k = abyte.length;
|
||||
|
||||
// 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
|
||||
this.g = new NibbleArray(abyte.length, world.heightBits);
|
||||
this.h = new NibbleArray(abyte.length, world.heightBits);
|
||||
this.i = new NibbleArray(abyte.length, world.heightBits);
|
||||
}
|
||||
|
||||
public boolean a(int i, int j) {
|
||||
|
@ -92,22 +88,18 @@ public class Chunk {
|
|||
public void a() {}
|
||||
|
||||
public void initLighting() {
|
||||
|
||||
int i = 128 - 1;
|
||||
int i = this.world.height - 1;
|
||||
|
||||
int j;
|
||||
int k;
|
||||
|
||||
for (j = 0; j < 16; ++j) {
|
||||
for (k = 0; k < 16; ++k) {
|
||||
int l = this.world.height - 1;
|
||||
|
||||
int l = 128 - 1;
|
||||
int i1;
|
||||
|
||||
int i1 = j << 11;
|
||||
|
||||
int j1;
|
||||
|
||||
for (j1 = i1 | k << 7; l > 0 && Block.q[this.b[j1 + l - 1] & 255] == 0; --l) {
|
||||
for (i1 = j << this.world.heightBitsPlusFour | k << this.world.heightBits; l > 0 && Block.q[this.b[i1 + l - 1] & 255] == 0; --l) {
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -117,18 +109,17 @@ public class Chunk {
|
|||
}
|
||||
|
||||
if (!this.world.worldProvider.e) {
|
||||
int k1 = 15;
|
||||
|
||||
int l1 = 128 - 1;
|
||||
int j1 = 15;
|
||||
int k1 = this.world.height - 1;
|
||||
|
||||
do {
|
||||
k1 -= Block.q[this.b[j1 + l1] & 255];
|
||||
if (k1 > 0) {
|
||||
this.h.a(j, l1, k, k1);
|
||||
j1 -= Block.q[this.b[i1 + k1] & 255];
|
||||
if (j1 > 0) {
|
||||
this.h.a(j, k1, k, j1);
|
||||
}
|
||||
|
||||
--l1;
|
||||
} while (l1 > 0 && k1 > 0);
|
||||
--k1;
|
||||
} while (k1 > 0 && j1 > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,44 +139,41 @@ public class Chunk {
|
|||
|
||||
private void d(int i, int j) {
|
||||
this.d[i + j * 16] = true;
|
||||
this.v = true;
|
||||
}
|
||||
|
||||
private void i() {
|
||||
World j0000 = this.world;
|
||||
int j0001 = this.x * 16 + 8;
|
||||
private void k() {
|
||||
if (this.world.areChunksLoaded(this.x * 16 + 8, this.world.height / 2, this.z * 16 + 8, 16)) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
if (this.d[i + j * 16]) {
|
||||
this.d[i + j * 16] = false;
|
||||
int k = this.b(i, j);
|
||||
int l = this.x * 16 + i;
|
||||
int i1 = this.z * 16 + j;
|
||||
int j1 = this.world.getHighestBlockYAt(l - 1, i1);
|
||||
int k1 = this.world.getHighestBlockYAt(l + 1, i1);
|
||||
int l1 = this.world.getHighestBlockYAt(l, i1 - 1);
|
||||
int i2 = this.world.getHighestBlockYAt(l, i1 + 1);
|
||||
|
||||
if (j0000.areChunksLoaded(j0001, 128 / 2, this.z * 16 + 8, 16)) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
for (int k = 0; k < 16; ++k) {
|
||||
if (this.d[j + k * 16]) {
|
||||
this.d[j + k * 16] = false;
|
||||
int l = this.b(j, k);
|
||||
int i1 = this.x * 16 + j;
|
||||
int j1 = this.z * 16 + k;
|
||||
int k1 = this.world.getHighestBlockYAt(i1 - 1, j1);
|
||||
int l1 = this.world.getHighestBlockYAt(i1 + 1, j1);
|
||||
int i2 = this.world.getHighestBlockYAt(i1, j1 - 1);
|
||||
int j2 = this.world.getHighestBlockYAt(i1, j1 + 1);
|
||||
|
||||
if (l1 < k1) {
|
||||
k1 = l1;
|
||||
if (k1 < j1) {
|
||||
j1 = k1;
|
||||
}
|
||||
|
||||
if (i2 < k1) {
|
||||
k1 = i2;
|
||||
if (l1 < j1) {
|
||||
j1 = l1;
|
||||
}
|
||||
|
||||
if (j2 < k1) {
|
||||
k1 = j2;
|
||||
if (i2 < j1) {
|
||||
j1 = i2;
|
||||
}
|
||||
|
||||
this.u = true;
|
||||
this.f(i1, j1, k1);
|
||||
this.u = true;
|
||||
this.f(i1 - 1, j1, l);
|
||||
this.f(i1 + 1, j1, l);
|
||||
this.f(i1, j1 - 1, l);
|
||||
this.f(i1, j1 + 1, l);
|
||||
this.f(l, i1, j1);
|
||||
this.f(l - 1, i1, k);
|
||||
this.f(l + 1, i1, k);
|
||||
this.f(l, i1 - 1, k);
|
||||
this.f(l, i1 + 1, k);
|
||||
this.v = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,16 +191,12 @@ public class Chunk {
|
|||
}
|
||||
|
||||
private void d(int i, int j, int k, int l) {
|
||||
if (l > k) {
|
||||
World world = this.world;
|
||||
|
||||
if (world.areChunksLoaded(i, 128 / 2, j, 16)) {
|
||||
for (int i1 = k; i1 < l; ++i1) {
|
||||
this.world.b(EnumSkyBlock.SKY, i, i1, j);
|
||||
}
|
||||
|
||||
this.q = true;
|
||||
if (l > k && this.world.areChunksLoaded(i, this.world.height / 2, j, 16)) {
|
||||
for (int i1 = k; i1 < l; ++i1) {
|
||||
this.world.b(EnumSkyBlock.SKY, i, i1, j);
|
||||
}
|
||||
|
||||
this.q = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,88 +207,87 @@ public class Chunk {
|
|||
if (j > l) {
|
||||
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) {
|
||||
this.world.g(i, k, i1, l);
|
||||
this.heightMap[k << 4 | i] = (byte) i1;
|
||||
int k1;
|
||||
int l1;
|
||||
int i2;
|
||||
int j2;
|
||||
|
||||
if (i1 < this.k) {
|
||||
this.k = i1;
|
||||
} else {
|
||||
k1 = this.world.height - 1;
|
||||
|
||||
l1 = 128 - 1;
|
||||
|
||||
for (i2 = 0; i2 < 16; ++i2) {
|
||||
for (j2 = 0; j2 < 16; ++j2) {
|
||||
if ((this.heightMap[j2 << 4 | i2] & 255) < l1) {
|
||||
l1 = this.heightMap[j2 << 4 | i2] & 255;
|
||||
for (l1 = 0; l1 < 16; ++l1) {
|
||||
for (i2 = 0; i2 < 16; ++i2) {
|
||||
if ((this.heightMap[i2 << 4 | l1] & 255) < k1) {
|
||||
k1 = this.heightMap[i2 << 4 | l1] & 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.k = l1;
|
||||
this.k = k1;
|
||||
}
|
||||
|
||||
l1 = this.x * 16 + i;
|
||||
i2 = this.z * 16 + k;
|
||||
if (i1 < l) {
|
||||
for (j2 = i1; j2 < l; ++j2) {
|
||||
this.h.a(i, j2, k, 15);
|
||||
}
|
||||
} else {
|
||||
for (j2 = l; j2 < i1; ++j2) {
|
||||
this.h.a(i, j2, k, 0);
|
||||
}
|
||||
}
|
||||
k1 = this.x * 16 + i;
|
||||
l1 = this.z * 16 + k;
|
||||
int j2;
|
||||
|
||||
for (j2 = 15; i1 > 0 && j2 > 0; this.h.a(i, i1, k, j2)) {
|
||||
--i1;
|
||||
int k2 = Block.q[this.getTypeId(i, i1, k)];
|
||||
|
||||
if (k2 == 0) {
|
||||
k2 = 1;
|
||||
if (!this.world.worldProvider.e) {
|
||||
if (i1 < l) {
|
||||
for (i2 = i1; i2 < l; ++i2) {
|
||||
this.h.a(i, i2, k, 15);
|
||||
}
|
||||
} else {
|
||||
for (i2 = l; i2 < i1; ++i2) {
|
||||
this.h.a(i, i2, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
j2 -= k2;
|
||||
if (j2 < 0) {
|
||||
j2 = 0;
|
||||
for (i2 = 15; i1 > 0 && i2 > 0; this.h.a(i, i1, k, i2)) {
|
||||
--i1;
|
||||
j2 = Block.q[this.getTypeId(i, i1, k)];
|
||||
if (j2 == 0) {
|
||||
j2 = 1;
|
||||
}
|
||||
|
||||
i2 -= j2;
|
||||
if (i2 < 0) {
|
||||
i2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
byte b0 = this.heightMap[k << 4 | i];
|
||||
int l2 = l;
|
||||
int i3 = b0;
|
||||
|
||||
j2 = l;
|
||||
int k2 = b0;
|
||||
|
||||
if (b0 < l) {
|
||||
l2 = b0;
|
||||
i3 = l;
|
||||
j2 = b0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public int getTypeId(int i, int j, int k) {
|
||||
byte[] abyte = this.b;
|
||||
|
||||
int l = i << 11;
|
||||
|
||||
return abyte[l | k << 7 | j] & 255;
|
||||
return this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
|
||||
}
|
||||
|
||||
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;
|
||||
byte[] j2000 = this.b;
|
||||
int l1 = this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
|
||||
|
||||
int j2001 = i << 11;
|
||||
|
||||
int i2 = j2000[j2001 | k << 7 | j] & 255;
|
||||
|
||||
if (i2 == l && this.g.a(i, j, k) == i1) {
|
||||
if (l1 == l && this.g.a(i, j, k) == i1) {
|
||||
return false;
|
||||
} else {
|
||||
int j2 = this.x * 16 + i;
|
||||
int k2 = this.z * 16 + k;
|
||||
int i2 = this.x * 16 + i;
|
||||
int j2 = this.z * 16 + k;
|
||||
|
||||
j2000 = this.b;
|
||||
|
||||
j2001 = i << 11;
|
||||
|
||||
j2000[j2001 | k << 7 | j] = (byte) (b0 & 255);
|
||||
if (i2 != 0 && !this.world.isStatic) {
|
||||
Block.byId[i2].remove(this.world, j2, j, k2);
|
||||
this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255);
|
||||
if (l1 != 0) {
|
||||
if (!this.world.isStatic) {
|
||||
Block.byId[l1].remove(this.world, i2, j, j2);
|
||||
} else if (Block.byId[l1] instanceof BlockContainer) {
|
||||
this.world.n(i2, j, j2);
|
||||
}
|
||||
}
|
||||
|
||||
this.g.a(i, j, k, i1);
|
||||
|
@ -347,17 +326,17 @@ public class Chunk {
|
|||
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.g.a(i, j, k, i1);
|
||||
TileEntity tileentity;
|
||||
|
||||
if (l != 0) {
|
||||
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) {
|
||||
|
@ -368,13 +347,13 @@ public class Chunk {
|
|||
}
|
||||
|
||||
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);
|
||||
if (tileentity != null) {
|
||||
tileentity.g();
|
||||
tileentity.d();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,25 +371,17 @@ public class Chunk {
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
int l1 = j2000[j2001 | k << 7 | j] & 255;
|
||||
|
||||
if (l1 == l) {
|
||||
if (k1 == l) {
|
||||
return false;
|
||||
} else {
|
||||
int i2 = this.x * 16 + i;
|
||||
int j2 = this.z * 16 + k;
|
||||
int l1 = this.x * 16 + i;
|
||||
int i2 = this.z * 16 + k;
|
||||
|
||||
j2000 = this.b;
|
||||
|
||||
j2001 = i << 11;
|
||||
|
||||
j2000[j2001 | k << 7 | j] = (byte) (b0 & 255);
|
||||
if (l1 != 0) {
|
||||
Block.byId[l1].remove(this.world, i2, j, j2);
|
||||
this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255);
|
||||
if (k1 != 0) {
|
||||
Block.byId[k1].remove(this.world, l1, j, i2);
|
||||
}
|
||||
|
||||
this.g.a(i, j, k, 0);
|
||||
|
@ -422,14 +393,14 @@ public class Chunk {
|
|||
this.g(i, j, k);
|
||||
}
|
||||
|
||||
this.world.a(EnumSkyBlock.SKY, i2, j, j2, i2, j, j2);
|
||||
this.world.a(EnumSkyBlock.BLOCK, i2, j, j2, i2, j, j2);
|
||||
this.world.a(EnumSkyBlock.SKY, l1, j, i2, l1, j, i2);
|
||||
this.world.a(EnumSkyBlock.BLOCK, l1, j, i2, l1, j, i2);
|
||||
this.d(i, k);
|
||||
TileEntity tileentity;
|
||||
|
||||
if (l != 0) {
|
||||
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) {
|
||||
|
@ -440,13 +411,13 @@ public class Chunk {
|
|||
}
|
||||
|
||||
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);
|
||||
if (tileentity != null) {
|
||||
tileentity.g();
|
||||
tileentity.d();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,18 +430,26 @@ public class Chunk {
|
|||
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.g.a(i, j, k, l);
|
||||
int i1 = this.getTypeId(i, j, k);
|
||||
int i1 = this.g.a(i, j, k);
|
||||
|
||||
if (i1 > 0 && Block.byId[i1] instanceof BlockContainer) {
|
||||
TileEntity tileentity = this.d(i, j, k);
|
||||
if (i1 == l) {
|
||||
return false;
|
||||
} else {
|
||||
this.g.a(i, j, k, l);
|
||||
int j1 = this.getTypeId(i, j, k);
|
||||
|
||||
if (tileentity != null) {
|
||||
tileentity.g();
|
||||
tileentity.n = l;
|
||||
if (j1 > 0 && Block.byId[j1] instanceof BlockContainer) {
|
||||
TileEntity tileentity = this.d(i, j, k);
|
||||
|
||||
if (tileentity != null) {
|
||||
tileentity.d();
|
||||
tileentity.p = l;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -481,7 +460,9 @@ public class Chunk {
|
|||
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
|
||||
this.q = true;
|
||||
if (enumskyblock == EnumSkyBlock.SKY) {
|
||||
this.h.a(i, j, k, l);
|
||||
if (!this.world.worldProvider.e) {
|
||||
this.h.a(i, j, k, l);
|
||||
}
|
||||
} else {
|
||||
if (enumskyblock != EnumSkyBlock.BLOCK) {
|
||||
return;
|
||||
|
@ -492,7 +473,7 @@ public class Chunk {
|
|||
}
|
||||
|
||||
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) {
|
||||
a = true;
|
||||
|
@ -531,15 +512,15 @@ public class Chunk {
|
|||
k = this.entitySlices.length - 1;
|
||||
}
|
||||
|
||||
entity.bV = true;
|
||||
entity.bW = this.x;
|
||||
entity.bX = k;
|
||||
entity.bY = this.z;
|
||||
entity.bW = true;
|
||||
entity.bX = this.x;
|
||||
entity.bY = k;
|
||||
entity.bZ = this.z;
|
||||
this.entitySlices[k].add(entity);
|
||||
}
|
||||
|
||||
public void b(Entity entity) {
|
||||
this.a(entity, entity.bX);
|
||||
this.a(entity, entity.bY);
|
||||
}
|
||||
|
||||
public void a(Entity entity, int i) {
|
||||
|
@ -577,7 +558,7 @@ public class Chunk {
|
|||
tileentity = (TileEntity) this.tileEntities.get(chunkposition);
|
||||
}
|
||||
|
||||
if (tileentity != null && tileentity.m()) {
|
||||
if (tileentity != null && tileentity.l()) {
|
||||
this.tileEntities.remove(chunkposition);
|
||||
return null;
|
||||
} else {
|
||||
|
@ -604,10 +585,10 @@ public class Chunk {
|
|||
tileentity.y = j;
|
||||
tileentity.z = this.z * 16 + k;
|
||||
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
|
||||
tileentity.n();
|
||||
tileentity.m();
|
||||
this.tileEntities.put(chunkposition, tileentity);
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
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!");
|
||||
// CraftBukkit end
|
||||
|
@ -689,6 +670,16 @@ public class Chunk {
|
|||
|
||||
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
|
||||
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) {
|
||||
i = 0;
|
||||
} else if (i >= this.entitySlices.length) {
|
||||
i = this.entitySlices.length - 1;
|
||||
}
|
||||
|
||||
if (j >= this.entitySlices.length) {
|
||||
j = this.entitySlices.length - 1;
|
||||
} else if (j < 0) {
|
||||
j = 0;
|
||||
}
|
||||
|
||||
for (int k = i; k <= j; ++k) {
|
||||
|
@ -755,53 +750,40 @@ public class Chunk {
|
|||
int l2;
|
||||
int i3;
|
||||
int j3;
|
||||
int k3;
|
||||
|
||||
for (k2 = i; k2 < l; ++k2) {
|
||||
for (i3 = k; i3 < j1; ++i3) {
|
||||
|
||||
l2 = k2 << 11;
|
||||
|
||||
j3 = l2 | i3 << 7 | j;
|
||||
k3 = i1 - j;
|
||||
System.arraycopy(this.b, j3, abyte, k1, k3);
|
||||
k1 += k3;
|
||||
for (l2 = k; l2 < j1; ++l2) {
|
||||
i3 = k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j;
|
||||
j3 = i1 - j;
|
||||
System.arraycopy(this.b, i3, abyte, k1, j3);
|
||||
k1 += j3;
|
||||
}
|
||||
}
|
||||
|
||||
for (k2 = i; k2 < l; ++k2) {
|
||||
for (i3 = k; i3 < j1; ++i3) {
|
||||
|
||||
l2 = k2 << 11;
|
||||
|
||||
j3 = (l2 | i3 << 7 | j) >> 1;
|
||||
k3 = (i1 - j) / 2;
|
||||
System.arraycopy(this.g.a, j3, abyte, k1, k3);
|
||||
k1 += k3;
|
||||
for (l2 = k; l2 < j1; ++l2) {
|
||||
i3 = (k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j) >> 1;
|
||||
j3 = (i1 - j) / 2;
|
||||
System.arraycopy(this.g.a, i3, abyte, k1, j3);
|
||||
k1 += j3;
|
||||
}
|
||||
}
|
||||
|
||||
for (k2 = i; k2 < l; ++k2) {
|
||||
for (i3 = k; i3 < j1; ++i3) {
|
||||
|
||||
l2 = k2 << 11;
|
||||
|
||||
j3 = (l2 | i3 << 7 | j) >> 1;
|
||||
k3 = (i1 - j) / 2;
|
||||
System.arraycopy(this.i.a, j3, abyte, k1, k3);
|
||||
k1 += k3;
|
||||
for (l2 = k; l2 < j1; ++l2) {
|
||||
i3 = (k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j) >> 1;
|
||||
j3 = (i1 - j) / 2;
|
||||
System.arraycopy(this.i.a, i3, abyte, k1, j3);
|
||||
k1 += j3;
|
||||
}
|
||||
}
|
||||
|
||||
for (k2 = i; k2 < l; ++k2) {
|
||||
for (i3 = k; i3 < j1; ++i3) {
|
||||
|
||||
l2 = k2 << 11;
|
||||
|
||||
j3 = (l2 | i3 << 7 | j) >> 1;
|
||||
k3 = (i1 - j) / 2;
|
||||
System.arraycopy(this.h.a, j3, abyte, k1, k3);
|
||||
k1 += k3;
|
||||
for (l2 = k; l2 < j1; ++l2) {
|
||||
i3 = (k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j) >> 1;
|
||||
j3 = (i1 - j) / 2;
|
||||
System.arraycopy(this.h.a, i3, abyte, k1, j3);
|
||||
k1 += j3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
public void g() {
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void h() {
|
||||
BlockRegister.a(this.b);
|
||||
}
|
||||
|
||||
|
@ -840,8 +826,7 @@ public class Chunk {
|
|||
int l = this.c[k];
|
||||
|
||||
if (l == -999) {
|
||||
|
||||
int i1 = 128 - 1;
|
||||
int i1 = this.world.height - 1;
|
||||
|
||||
l = -1;
|
||||
|
||||
|
@ -862,7 +847,13 @@ public class Chunk {
|
|||
return l;
|
||||
}
|
||||
|
||||
public void h() {
|
||||
this.i();
|
||||
public void i() {
|
||||
if (this.v && !this.world.worldProvider.e) {
|
||||
this.k();
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkCoordIntPair j() {
|
||||
return new ChunkCoordIntPair(this.x, this.z);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,11 +31,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||
// CraftBukkit end
|
||||
|
||||
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
|
||||
|
||||
worldserver.getClass();
|
||||
EmptyChunk emptychunk = new EmptyChunk(worldserver, new byte[256 * 128], 0, 0);
|
||||
|
||||
this.emptyChunk = emptychunk;
|
||||
this.emptyChunk = new EmptyChunk(worldserver, new byte[256 * worldserver.height], 0, 0);
|
||||
this.world = worldserver;
|
||||
this.e = ichunkloader;
|
||||
this.chunkProvider = ichunkprovider;
|
||||
|
@ -46,12 +42,16 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||
}
|
||||
|
||||
public void queueUnload(int i, int j) {
|
||||
ChunkCoordinates chunkcoordinates = this.world.getSpawn();
|
||||
int k = i * 16 + 8 - chunkcoordinates.x;
|
||||
int l = j * 16 + 8 - chunkcoordinates.z;
|
||||
short short1 = 128;
|
||||
if (this.world.worldProvider.c()) {
|
||||
ChunkCoordinates chunkcoordinates = this.world.getSpawn();
|
||||
int k = i * 16 + 8 - chunkcoordinates.x;
|
||||
int l = j * 16 + 8 - chunkcoordinates.z;
|
||||
short short1 = 128;
|
||||
|
||||
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
|
||||
}
|
||||
} else {
|
||||
this.unloadQueue.add(i, j); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
@ -253,4 +253,12 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||
public boolean canSave() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ContainerPlayer extends Container {
|
|||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
|
||||
if (slot != null && slot.b()) {
|
||||
if (slot != null && slot.c()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
|
@ -100,14 +100,14 @@ public class ContainerPlayer extends Container {
|
|||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
} else {
|
||||
slot.c();
|
||||
slot.d();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.a(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ContainerWorkbench extends Container {
|
|||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
|
||||
if (slot != null && slot.b()) {
|
||||
if (slot != null && slot.c()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
|
@ -95,14 +95,14 @@ public class ContainerWorkbench extends Container {
|
|||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
} else {
|
||||
slot.c();
|
||||
slot.d();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.a(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
|
|
@ -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.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.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Block.NETHER_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Item.STICK, Character.valueOf('W'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
|
||||
this.registerShapedRecipe(new ItemStack(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'), new ItemStack(Item.COAL, 1, 1), Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BOWL, 4), new Object[] { "# #", " # ", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Item.GLASS_BOTTLE, 3), new Object[] { "# #", " # ", Character.valueOf('#'), Block.GLASS});
|
||||
this.registerShapedRecipe(new ItemStack(Block.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.GOLD_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Block.STONE_PLATE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.CAULDRON, 1), new Object[] { "# #", "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BREWING_STAND, 1), new Object[] { " B ", "###", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('B'), Item.BLAZE_ROD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.PUMPKIN, Character.valueOf('B'), Block.TORCH});
|
||||
this.registerShapedRecipe(new ItemStack(Item.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.CHEST, Character.valueOf('B'), Item.MINECART});
|
||||
this.registerShapedRecipe(new ItemStack(Item.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
|
||||
|
@ -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.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.NETHER_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(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(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_STICKY, 1), new Object[] { "S", "P", Character.valueOf('S'), Item.SLIME_BALL, Character.valueOf('P'), Block.PISTON});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Block.OBSIDIAN, Character.valueOf('B'), Item.BOOK, Character.valueOf('D'), Item.DIAMOND});
|
||||
this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
|
||||
Collections.sort(this.b, new RecipeSorter(this));
|
||||
System.out.println(this.b.size() + " recipes");
|
||||
}
|
||||
|
@ -171,15 +178,51 @@ public class CraftingManager {
|
|||
}
|
||||
|
||||
public ItemStack craft(InventoryCrafting inventorycrafting) {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(i);
|
||||
int i = 0;
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack1 = null;
|
||||
|
||||
if (craftingrecipe.a(inventorycrafting)) {
|
||||
return craftingrecipe.b(inventorycrafting);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
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)) {
|
||||
return craftingrecipe.b(inventorycrafting);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List b() {
|
||||
|
|
|
@ -22,8 +22,8 @@ public abstract class Entity {
|
|||
|
||||
private static int entityCount = 0;
|
||||
public int id;
|
||||
public double aX;
|
||||
public boolean aY;
|
||||
public double bb;
|
||||
public boolean bc;
|
||||
public Entity passenger;
|
||||
public Entity vehicle;
|
||||
public World world;
|
||||
|
@ -43,83 +43,82 @@ public abstract class Entity {
|
|||
public final AxisAlignedBB boundingBox;
|
||||
public boolean onGround;
|
||||
public boolean positionChanged;
|
||||
public boolean bs;
|
||||
public boolean bt;
|
||||
public boolean velocityChanged;
|
||||
protected boolean bv;
|
||||
public boolean bw;
|
||||
public boolean bx;
|
||||
public boolean velocityChanged;
|
||||
protected boolean bz;
|
||||
public boolean bA;
|
||||
public boolean dead;
|
||||
public float height;
|
||||
public float length;
|
||||
public float width;
|
||||
public float bB;
|
||||
public float bC;
|
||||
public float bF;
|
||||
public float bG;
|
||||
public float fallDistance; // CraftBukkit - private -> public
|
||||
private int b;
|
||||
public double bE;
|
||||
public double bF;
|
||||
public double bG;
|
||||
public float bH;
|
||||
public float bI;
|
||||
public boolean bJ;
|
||||
public float bK;
|
||||
public double bI;
|
||||
public double bJ;
|
||||
public double bK;
|
||||
public float bL;
|
||||
public float bM;
|
||||
public boolean bN;
|
||||
public float bO;
|
||||
protected Random random;
|
||||
public int ticksLived;
|
||||
public int maxFireTicks;
|
||||
public int fireTicks;
|
||||
public int maxAirTicks; // CraftBukkit - protected - >public
|
||||
protected boolean bQ;
|
||||
public int fireTicks; // CraftBukkit - private -> public
|
||||
public int maxAirTicks; // CraftBukkit - protected -> public
|
||||
protected boolean bS;
|
||||
public int noDamageTicks;
|
||||
public int airTicks;
|
||||
private boolean justCreated;
|
||||
protected boolean fireProof;
|
||||
protected DataWatcher datawatcher;
|
||||
private double d;
|
||||
private double e;
|
||||
public boolean bV;
|
||||
public int bW;
|
||||
private double f;
|
||||
public boolean bW;
|
||||
public int bX;
|
||||
public int bY;
|
||||
public boolean bZ;
|
||||
public int bZ;
|
||||
public boolean ca;
|
||||
public boolean cb;
|
||||
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
|
||||
|
||||
public Entity(World world) {
|
||||
this.id = entityCount++;
|
||||
this.aX = 1.0D;
|
||||
this.aY = false;
|
||||
this.bb = 1.0D;
|
||||
this.bc = false;
|
||||
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
this.onGround = false;
|
||||
this.bt = false;
|
||||
this.bx = false;
|
||||
this.velocityChanged = false;
|
||||
this.bw = true;
|
||||
this.bA = true;
|
||||
this.dead = false;
|
||||
this.height = 0.0F;
|
||||
this.length = 0.6F;
|
||||
this.width = 1.8F;
|
||||
this.bB = 0.0F;
|
||||
this.bC = 0.0F;
|
||||
this.bF = 0.0F;
|
||||
this.bG = 0.0F;
|
||||
this.fallDistance = 0.0F;
|
||||
this.b = 1;
|
||||
this.bH = 0.0F;
|
||||
this.bI = 0.0F;
|
||||
this.bJ = false;
|
||||
this.bK = 0.0F;
|
||||
this.bL = 0.0F;
|
||||
this.bM = 0.0F;
|
||||
this.bN = false;
|
||||
this.bO = 0.0F;
|
||||
this.random = new Random();
|
||||
this.ticksLived = 0;
|
||||
this.maxFireTicks = 1;
|
||||
this.fireTicks = 0;
|
||||
this.maxAirTicks = 300;
|
||||
this.bQ = false;
|
||||
this.bS = false;
|
||||
this.noDamageTicks = 0;
|
||||
this.airTicks = 300;
|
||||
this.justCreated = true;
|
||||
this.fireProof = false;
|
||||
this.datawatcher = new DataWatcher();
|
||||
this.bV = false;
|
||||
this.bW = false;
|
||||
this.world = world;
|
||||
this.setPosition(0.0D, 0.0D, 0.0D);
|
||||
this.datawatcher.a(0, Byte.valueOf((byte) 0));
|
||||
this.datawatcher.a(1, Short.valueOf((short) 300));
|
||||
this.b();
|
||||
}
|
||||
|
||||
|
@ -185,20 +184,21 @@ public abstract class Entity {
|
|||
float f = this.length / 2.0F;
|
||||
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_() {
|
||||
this.aa();
|
||||
public void w_() {
|
||||
this.af();
|
||||
}
|
||||
|
||||
public void aa() {
|
||||
public void af() {
|
||||
MethodProfiler.a("entityBaseTick");
|
||||
if (this.vehicle != null && this.vehicle.dead) {
|
||||
this.vehicle = null;
|
||||
}
|
||||
|
||||
++this.ticksLived;
|
||||
this.bB = this.bC;
|
||||
this.bF = this.bG;
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
|
@ -218,8 +218,8 @@ public abstract class Entity {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.f_()) {
|
||||
if (!this.bQ && !this.justCreated) {
|
||||
if (this.i_()) {
|
||||
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;
|
||||
|
||||
if (f > 1.0F) {
|
||||
|
@ -246,10 +246,10 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.fallDistance = 0.0F;
|
||||
this.bQ = true;
|
||||
this.bS = true;
|
||||
this.fireTicks = 0;
|
||||
} else {
|
||||
this.bQ = false;
|
||||
this.bS = false;
|
||||
}
|
||||
|
||||
if (this.world.isStatic) {
|
||||
|
@ -280,12 +280,13 @@ public abstract class Entity {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.ap()) {
|
||||
this.am();
|
||||
if (this.aA()) {
|
||||
this.av();
|
||||
this.fallDistance *= 0.5F;
|
||||
}
|
||||
|
||||
if (this.locY < -64.0D) {
|
||||
this.ah();
|
||||
this.ao();
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
|
@ -294,9 +295,10 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.justCreated = false;
|
||||
MethodProfiler.a();
|
||||
}
|
||||
|
||||
protected void am() {
|
||||
protected void av() {
|
||||
if (!this.fireProof) {
|
||||
// CraftBukkit start - TODO: this event spams!
|
||||
if (this instanceof EntityLiving) {
|
||||
|
@ -319,22 +321,33 @@ public abstract class Entity {
|
|||
server.getPluginManager().callEvent(combustEvent);
|
||||
|
||||
if (!combustEvent.isCancelled()) {
|
||||
this.fireTicks = 600;
|
||||
this.j(15);
|
||||
}
|
||||
} else {
|
||||
// reset fire level back to max
|
||||
this.fireTicks = 600;
|
||||
this.j(15);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -346,18 +359,19 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
public void move(double d0, double d1, double d2) {
|
||||
if (this.bJ) {
|
||||
if (this.bN) {
|
||||
this.boundingBox.d(d0, d1, d2);
|
||||
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.bH;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.bL;
|
||||
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
|
||||
} else {
|
||||
this.bH *= 0.4F;
|
||||
MethodProfiler.a("move");
|
||||
this.bL *= 0.4F;
|
||||
double d3 = this.locX;
|
||||
double d4 = this.locZ;
|
||||
|
||||
if (this.bv) {
|
||||
this.bv = false;
|
||||
if (this.bz) {
|
||||
this.bz = false;
|
||||
d0 *= 0.25D;
|
||||
d1 *= 0.05000000074505806D;
|
||||
d2 *= 0.25D;
|
||||
|
@ -403,7 +417,7 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.boundingBox.d(0.0D, d1, 0.0D);
|
||||
if (!this.bw && d6 != d1) {
|
||||
if (!this.bA && d6 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
|
@ -418,7 +432,7 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.boundingBox.d(d0, 0.0D, 0.0D);
|
||||
if (!this.bw && d5 != d0) {
|
||||
if (!this.bA && d5 != d0) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
|
@ -429,7 +443,7 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.boundingBox.d(0.0D, 0.0D, d2);
|
||||
if (!this.bw && d7 != d2) {
|
||||
if (!this.bA && d7 != d2) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
|
@ -439,13 +453,13 @@ public abstract class Entity {
|
|||
double d10;
|
||||
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;
|
||||
d10 = d1;
|
||||
double d11 = d2;
|
||||
|
||||
d0 = d5;
|
||||
d1 = (double) this.bI;
|
||||
d1 = (double) this.bM;
|
||||
d2 = d7;
|
||||
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
|
||||
|
||||
|
@ -457,7 +471,7 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.boundingBox.d(0.0D, d1, 0.0D);
|
||||
if (!this.bw && d6 != d1) {
|
||||
if (!this.bA && d6 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
|
@ -468,7 +482,7 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.boundingBox.d(d0, 0.0D, 0.0D);
|
||||
if (!this.bw && d5 != d0) {
|
||||
if (!this.bA && d5 != d0) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
|
@ -479,18 +493,18 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
this.boundingBox.d(0.0D, 0.0D, d2);
|
||||
if (!this.bw && d7 != d2) {
|
||||
if (!this.bA && d7 != d2) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
}
|
||||
|
||||
if (!this.bw && d6 != d1) {
|
||||
if (!this.bA && d6 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
} else {
|
||||
d1 = (double) (-this.bI);
|
||||
d1 = (double) (-this.bM);
|
||||
|
||||
for (k = 0; k < list.size(); ++k) {
|
||||
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);
|
||||
|
||||
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.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.positionChanged = d5 != d0 || d7 != d2;
|
||||
this.bs = d6 != d1;
|
||||
this.bw = d6 != d1;
|
||||
this.onGround = d6 != d1 && d6 < 0.0D;
|
||||
this.bt = this.positionChanged || this.bs;
|
||||
this.bx = this.positionChanged || this.bw;
|
||||
this.a(d1, this.onGround);
|
||||
if (d5 != d0) {
|
||||
this.motX = 0.0D;
|
||||
|
@ -559,27 +575,19 @@ public abstract class Entity {
|
|||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.e_() && !flag && this.vehicle == null) {
|
||||
this.bC = (float) ((double) this.bC + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
|
||||
if (this.g_() && !flag && this.vehicle == null) {
|
||||
this.bG = (float) ((double) this.bG + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
|
||||
l = MathHelper.floor(this.locX);
|
||||
i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
|
||||
j1 = MathHelper.floor(this.locZ);
|
||||
k = this.world.getTypeId(l, i1, j1);
|
||||
if (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);
|
||||
}
|
||||
|
||||
if (this.bC > (float) this.b && k > 0) {
|
||||
this.b = (int) this.bC + 1;
|
||||
StepSound stepsound = Block.byId[k].stepSound;
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
if (this.bG > (float) this.b && k > 0) {
|
||||
this.b = (int) this.bG + 1;
|
||||
this.a(l, i1, j1, k);
|
||||
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))) {
|
||||
this.burn(1);
|
||||
|
@ -617,11 +625,11 @@ public abstract class Entity {
|
|||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.fireTicks = 300;
|
||||
this.j(8);
|
||||
}
|
||||
} else {
|
||||
// CraftBukkit end - reset fire level back to max
|
||||
this.fireTicks = 300;
|
||||
// CraftBukkit end
|
||||
this.j(8);
|
||||
}
|
||||
}
|
||||
} 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.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;
|
||||
}
|
||||
|
||||
protected void a(double d0, boolean flag) {
|
||||
if (flag) {
|
||||
if (this.fallDistance > 0.0F) {
|
||||
this.a(this.fallDistance);
|
||||
this.b(this.fallDistance);
|
||||
this.fallDistance = 0.0F;
|
||||
}
|
||||
} else if (d0 < 0.0D) {
|
||||
|
@ -650,7 +671,7 @@ public abstract class Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB f() {
|
||||
public AxisAlignedBB h_() {
|
||||
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) {
|
||||
this.passenger.a(f);
|
||||
this.passenger.b(f);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean an() {
|
||||
return this.bQ || this.world.s(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
|
||||
public boolean ay() {
|
||||
return this.bS || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
|
||||
}
|
||||
|
||||
public boolean ao() {
|
||||
return this.bQ;
|
||||
public boolean az() {
|
||||
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);
|
||||
}
|
||||
|
||||
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 j = MathHelper.d((float) MathHelper.floor(d0));
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
int l = this.world.getTypeId(i, j, k);
|
||||
|
||||
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;
|
||||
|
||||
return d0 < (double) f1;
|
||||
|
@ -707,11 +732,11 @@ public abstract class Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public float t() {
|
||||
public float x() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public boolean ap() {
|
||||
public boolean aA() {
|
||||
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 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;
|
||||
int k = MathHelper.floor(this.locY - (double) this.height + d0);
|
||||
|
||||
|
@ -766,7 +790,7 @@ public abstract class Entity {
|
|||
this.lastZ = this.locZ = d2;
|
||||
this.lastYaw = this.yaw = f;
|
||||
this.lastPitch = this.pitch = f1;
|
||||
this.bH = 0.0F;
|
||||
this.bL = 0.0F;
|
||||
double d3 = (double) (this.lastYaw - f);
|
||||
|
||||
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) {
|
||||
this.bE = this.lastX = this.locX = d0;
|
||||
this.bF = this.lastY = this.locY = d1 + (double) this.height;
|
||||
this.bG = this.lastZ = this.locZ = d2;
|
||||
this.bI = this.lastX = this.locX = d0;
|
||||
this.bJ = this.lastY = this.locY = d1 + (double) this.height;
|
||||
this.bK = this.lastZ = this.locZ = d2;
|
||||
this.yaw = f;
|
||||
this.pitch = f1;
|
||||
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 f1 = (float) (this.locY - entity.locY);
|
||||
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);
|
||||
}
|
||||
|
||||
public double h(Entity entity) {
|
||||
public double i(Entity entity) {
|
||||
double d0 = this.locX - entity.locX;
|
||||
double d1 = this.locY - entity.locY;
|
||||
double d2 = this.locZ - entity.locZ;
|
||||
|
@ -844,42 +868,42 @@ public abstract class Entity {
|
|||
d1 *= d3;
|
||||
d0 *= 0.05000000074505806D;
|
||||
d1 *= 0.05000000074505806D;
|
||||
d0 *= (double) (1.0F - this.bK);
|
||||
d1 *= (double) (1.0F - this.bK);
|
||||
this.b(-d0, 0.0D, -d1);
|
||||
entity.b(d0, 0.0D, d1);
|
||||
d0 *= (double) (1.0F - this.bO);
|
||||
d1 *= (double) (1.0F - this.bO);
|
||||
this.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.motY += d1;
|
||||
this.motZ += d2;
|
||||
this.ca = true;
|
||||
this.cb = true;
|
||||
}
|
||||
|
||||
protected void aq() {
|
||||
protected void aB() {
|
||||
this.velocityChanged = true;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.aq();
|
||||
this.aB();
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean r_() {
|
||||
public boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
public boolean f_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void b(Entity entity, int i) {}
|
||||
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
String s = this.ar();
|
||||
String s = this.aC();
|
||||
|
||||
if (!this.dead && s != null) {
|
||||
nbttagcompound.setString("id", s);
|
||||
|
@ -891,7 +915,7 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
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}));
|
||||
|
||||
// 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("FallDistance", this.fallDistance);
|
||||
nbttagcompound.a("Fire", (short) this.fireTicks);
|
||||
nbttagcompound.a("Air", (short) this.airTicks);
|
||||
nbttagcompound.a("Air", (short) this.getAirTicks());
|
||||
nbttagcompound.a("OnGround", this.onGround);
|
||||
// CraftBukkit start
|
||||
nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits());
|
||||
|
@ -920,9 +944,9 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
public void e(NBTTagCompound nbttagcompound) {
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Pos");
|
||||
NBTTagList nbttaglist1 = nbttagcompound.l("Motion");
|
||||
NBTTagList nbttaglist2 = nbttagcompound.l("Rotation");
|
||||
NBTTagList nbttaglist = nbttagcompound.m("Pos");
|
||||
NBTTagList nbttaglist1 = nbttagcompound.m("Motion");
|
||||
NBTTagList nbttaglist2 = nbttagcompound.m("Rotation");
|
||||
|
||||
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
|
||||
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
|
||||
|
@ -941,15 +965,15 @@ public abstract class Entity {
|
|||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
this.lastX = this.bE = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
|
||||
this.lastY = this.bF = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
|
||||
this.lastZ = this.bG = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
|
||||
this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
|
||||
this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
|
||||
this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
|
||||
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a;
|
||||
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a;
|
||||
this.fallDistance = nbttagcompound.g("FallDistance");
|
||||
this.fireTicks = nbttagcompound.d("Fire");
|
||||
this.airTicks = nbttagcompound.d("Air");
|
||||
this.onGround = nbttagcompound.m("OnGround");
|
||||
this.fallDistance = nbttagcompound.h("FallDistance");
|
||||
this.fireTicks = nbttagcompound.e("Fire");
|
||||
this.setAirTicks(nbttagcompound.e("Air"));
|
||||
this.onGround = nbttagcompound.n("OnGround");
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
|
||||
// CraftBukkit start
|
||||
|
@ -1004,7 +1028,7 @@ public abstract class Entity {
|
|||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected final String ar() {
|
||||
protected final String aC() {
|
||||
return EntityTypes.b(this);
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1044,7 @@ public abstract class Entity {
|
|||
for (int j = 0; j < i; ++j) {
|
||||
double d0 = adouble1[j];
|
||||
|
||||
nbttaglist.a((NBTBase) (new NBTTagDouble(d0)));
|
||||
nbttaglist.a((NBTBase) (new NBTTagDouble((String) null, d0)));
|
||||
}
|
||||
|
||||
return nbttaglist;
|
||||
|
@ -1034,7 +1058,7 @@ public abstract class Entity {
|
|||
for (int j = 0; j < i; ++j) {
|
||||
float f = afloat1[j];
|
||||
|
||||
nbttaglist.a((NBTBase) (new NBTTagFloat(f)));
|
||||
nbttaglist.a((NBTBase) (new NBTTagFloat((String) null, f)));
|
||||
}
|
||||
|
||||
return nbttaglist;
|
||||
|
@ -1056,17 +1080,17 @@ public abstract class Entity {
|
|||
return entityitem;
|
||||
}
|
||||
|
||||
public boolean ac() {
|
||||
public boolean aj() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public boolean O() {
|
||||
public boolean T() {
|
||||
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 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 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);
|
||||
|
||||
if (this.world.e(j, k, l)) {
|
||||
|
@ -1081,40 +1105,40 @@ public abstract class Entity {
|
|||
return false;
|
||||
}
|
||||
|
||||
public AxisAlignedBB b(Entity entity) {
|
||||
public AxisAlignedBB a_(Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void I() {
|
||||
public void M() {
|
||||
if (this.vehicle.dead) {
|
||||
this.vehicle = null;
|
||||
} else {
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.s_();
|
||||
this.w_();
|
||||
if (this.vehicle != null) {
|
||||
this.vehicle.g_();
|
||||
this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
|
||||
this.vehicle.i();
|
||||
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) {
|
||||
this.e += 360.0D;
|
||||
}
|
||||
|
||||
while (this.d >= 180.0D) {
|
||||
this.d -= 360.0D;
|
||||
}
|
||||
|
||||
while (this.d < -180.0D) {
|
||||
this.d += 360.0D;
|
||||
}
|
||||
|
||||
double d0 = this.e * 0.5D;
|
||||
double d1 = this.d * 0.5D;
|
||||
double d0 = this.f * 0.5D;
|
||||
double d1 = this.e * 0.5D;
|
||||
float f = 10.0F;
|
||||
|
||||
if (d0 > (double) f) {
|
||||
|
@ -1133,23 +1157,23 @@ public abstract class Entity {
|
|||
d1 = (double) (-f);
|
||||
}
|
||||
|
||||
this.e -= d0;
|
||||
this.d -= d1;
|
||||
this.f -= d0;
|
||||
this.e -= d1;
|
||||
this.yaw = (float) ((double) this.yaw + d0);
|
||||
this.pitch = (float) ((double) this.pitch + d1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void g_() {
|
||||
this.passenger.setPosition(this.locX, this.locY + this.n() + this.passenger.M(), this.locZ);
|
||||
public void i() {
|
||||
this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.R(), this.locZ);
|
||||
}
|
||||
|
||||
public double M() {
|
||||
public double R() {
|
||||
return (double) this.height;
|
||||
}
|
||||
|
||||
public double n() {
|
||||
public double q() {
|
||||
return (double) this.width * 0.75D;
|
||||
}
|
||||
|
||||
|
@ -1172,8 +1196,8 @@ public abstract class Entity {
|
|||
// so this method is needed
|
||||
|
||||
// CraftBukkit end
|
||||
this.d = 0.0D;
|
||||
this.e = 0.0D;
|
||||
this.f = 0.0D;
|
||||
if (entity == null) {
|
||||
if (this.vehicle != null) {
|
||||
// CraftBukkit start
|
||||
|
@ -1213,18 +1237,26 @@ public abstract class Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public Vec3D ai() {
|
||||
public float j_() {
|
||||
return 0.1F;
|
||||
}
|
||||
|
||||
public Vec3D ap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void T() {}
|
||||
public void Y() {}
|
||||
|
||||
public ItemStack[] getEquipment() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean z() {
|
||||
return this.fireTicks > 0 || this.k(0);
|
||||
}
|
||||
|
||||
public boolean isSneaking() {
|
||||
return this.e(1);
|
||||
return this.k(1);
|
||||
}
|
||||
|
||||
public void setSneak(boolean flag) {
|
||||
|
@ -1232,18 +1264,18 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
public boolean isSprinting() {
|
||||
return this.e(3);
|
||||
return this.k(3);
|
||||
}
|
||||
|
||||
public void setSprinting(boolean flag) {
|
||||
this.a(3, flag);
|
||||
}
|
||||
|
||||
public void h(boolean flag) {
|
||||
public void g(boolean flag) {
|
||||
this.a(4, flag);
|
||||
}
|
||||
|
||||
protected boolean e(int i) {
|
||||
protected boolean k(int i) {
|
||||
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) {
|
||||
// CraftBukkit start
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.LIGHTNING, 5);
|
||||
|
@ -1271,7 +1311,7 @@ public abstract class Entity {
|
|||
|
||||
++this.fireTicks;
|
||||
if (this.fireTicks == 0) {
|
||||
this.fireTicks = 300;
|
||||
this.j(8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1350,16 +1390,18 @@ public abstract class Entity {
|
|||
if (b0 == 5) {
|
||||
this.motZ = (double) f;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void q() {
|
||||
this.bv = true;
|
||||
public void s() {
|
||||
this.bz = true;
|
||||
}
|
||||
|
||||
public String Y() {
|
||||
public String ad() {
|
||||
String s = EntityTypes.b(this);
|
||||
|
||||
if (s == null) {
|
||||
|
@ -1368,4 +1410,12 @@ public abstract class Entity {
|
|||
|
||||
return StatisticCollector.a("entity." + s + ".name");
|
||||
}
|
||||
|
||||
public Entity[] aG() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity) {
|
||||
return this == entity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class EntityArrow extends Entity {
|
|||
this.shooter = entityliving;
|
||||
this.fromPlayer = entityliving instanceof EntityHuman;
|
||||
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.locY -= 0.10000000149011612D;
|
||||
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;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public void w_() {
|
||||
super.w_();
|
||||
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
|
||||
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) {
|
||||
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;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
|
||||
|
@ -174,7 +174,15 @@ public class EntityArrow extends Entity {
|
|||
int l = (int) Math.ceil((double) f2 * 2.0D);
|
||||
|
||||
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
|
||||
|
@ -196,18 +204,18 @@ public class EntityArrow extends Entity {
|
|||
stick = !projectile.doesBounce();
|
||||
} else {
|
||||
// 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 {
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.arrow(this, this.shooter), l);
|
||||
stick = movingobjectposition.entity.damageEntity(damagesource, l);
|
||||
}
|
||||
if (stick) {
|
||||
// CraftBukkit end
|
||||
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();
|
||||
} else {
|
||||
this.motX *= -0.10000000149011612D;
|
||||
|
@ -230,7 +238,7 @@ public class EntityArrow extends Entity {
|
|||
this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
|
||||
this.locY -= this.motY / (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.shake = 7;
|
||||
this.d = false;
|
||||
|
@ -270,7 +278,7 @@ public class EntityArrow extends Entity {
|
|||
float f3 = 0.99F;
|
||||
|
||||
f1 = 0.05F;
|
||||
if (this.ao()) {
|
||||
if (this.az()) {
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
float f4 = 0.25F;
|
||||
|
||||
|
@ -300,14 +308,14 @@ public class EntityArrow extends Entity {
|
|||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.e = nbttagcompound.d("xTile");
|
||||
this.f = nbttagcompound.d("yTile");
|
||||
this.g = nbttagcompound.d("zTile");
|
||||
this.h = nbttagcompound.c("inTile") & 255;
|
||||
this.i = nbttagcompound.c("inData") & 255;
|
||||
this.shake = nbttagcompound.c("shake") & 255;
|
||||
this.inGround = nbttagcompound.c("inGround") == 1;
|
||||
this.fromPlayer = nbttagcompound.m("player");
|
||||
this.e = nbttagcompound.e("xTile");
|
||||
this.f = nbttagcompound.e("yTile");
|
||||
this.g = nbttagcompound.e("zTile");
|
||||
this.h = nbttagcompound.d("inTile") & 255;
|
||||
this.i = nbttagcompound.d("inData") & 255;
|
||||
this.shake = nbttagcompound.d("shake") & 255;
|
||||
this.inGround = nbttagcompound.d("inGround") == 1;
|
||||
this.fromPlayer = nbttagcompound.n("player");
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {
|
||||
|
|
|
@ -16,15 +16,12 @@ import org.bukkit.event.vehicle.VehicleUpdateEvent;
|
|||
|
||||
public class EntityBoat extends Entity {
|
||||
|
||||
public int damage;
|
||||
public int b;
|
||||
public int c;
|
||||
private int d;
|
||||
private int a;
|
||||
private double b;
|
||||
private double c;
|
||||
private double d;
|
||||
private double e;
|
||||
private double f;
|
||||
private double g;
|
||||
private double h;
|
||||
private double i;
|
||||
|
||||
// CraftBukkit start
|
||||
public double maxSpeed = 0.4D;
|
||||
|
@ -49,29 +46,30 @@ public class EntityBoat extends Entity {
|
|||
|
||||
public EntityBoat(World world) {
|
||||
super(world);
|
||||
this.damage = 0;
|
||||
this.b = 0;
|
||||
this.c = 1;
|
||||
this.aY = true;
|
||||
this.bc = true;
|
||||
this.b(1.5F, 0.6F);
|
||||
this.height = this.width / 2.0F;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean g_() {
|
||||
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;
|
||||
}
|
||||
|
||||
public AxisAlignedBB f() {
|
||||
public AxisAlignedBB h_() {
|
||||
return this.boundingBox;
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
public boolean f_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -88,7 +86,7 @@ public class EntityBoat extends Entity {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -107,18 +105,17 @@ public class EntityBoat extends Entity {
|
|||
// i = event.getDamage(); // TODO Why don't we do this?
|
||||
// CraftBukkit end
|
||||
|
||||
this.c = -this.c;
|
||||
this.b = 10;
|
||||
this.damage += i * 10;
|
||||
this.aq();
|
||||
if (this.damage > 40) {
|
||||
|
||||
this.d(-this.l());
|
||||
this.c(10);
|
||||
this.setDamage(this.getDamage() + i * 10);
|
||||
this.aB();
|
||||
if (this.getDamage() > 40) {
|
||||
// CraftBukkit start
|
||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
|
||||
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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -146,11 +143,11 @@ public class EntityBoat extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean r_() {
|
||||
public boolean e_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
public void w_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
|
@ -159,13 +156,13 @@ public class EntityBoat extends Entity {
|
|||
float prevPitch = this.pitch;
|
||||
// CraftBukkit end
|
||||
|
||||
super.s_();
|
||||
if (this.b > 0) {
|
||||
--this.b;
|
||||
super.w_();
|
||||
if (this.k() > 0) {
|
||||
this.c(this.k() - 1);
|
||||
}
|
||||
|
||||
if (this.damage > 0) {
|
||||
--this.damage;
|
||||
if (this.getDamage() > 0) {
|
||||
this.setDamage(this.getDamage() - 1);
|
||||
}
|
||||
|
||||
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 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.d > 0) {
|
||||
d3 = this.locX + (this.e - this.locX) / (double) this.d;
|
||||
d4 = this.locY + (this.f - this.locY) / (double) this.d;
|
||||
d5 = this.locZ + (this.g - this.locZ) / (double) this.d;
|
||||
if (this.a > 0) {
|
||||
d4 = this.locX + (this.b - this.locX) / (double) this.a;
|
||||
d5 = this.locY + (this.c - this.locY) / (double) this.a;
|
||||
d10 = this.locZ + (this.d - this.locZ) / (double) this.a;
|
||||
|
||||
for (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) {
|
||||
d6 -= 360.0D;
|
||||
while (d11 >= 180.0D) {
|
||||
d11 -= 360.0D;
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d6 / (double) this.d);
|
||||
this.pitch = (float) ((double) this.pitch + (this.i - (double) this.pitch) / (double) this.d);
|
||||
--this.d;
|
||||
this.setPosition(d3, d4, d5);
|
||||
this.yaw = (float) ((double) this.yaw + d11 / (double) this.a);
|
||||
this.pitch = (float) ((double) this.pitch + (this.f - (double) this.pitch) / (double) this.a);
|
||||
--this.a;
|
||||
this.setPosition(d4, d5, d10);
|
||||
this.c(this.yaw, this.pitch);
|
||||
} else {
|
||||
d3 = this.locX + this.motX;
|
||||
d4 = this.locY + this.motY;
|
||||
d5 = this.locZ + this.motZ;
|
||||
this.setPosition(d3, d4, d5);
|
||||
d4 = this.locX + this.motX;
|
||||
d5 = this.locY + this.motY;
|
||||
d10 = this.locZ + this.motZ;
|
||||
this.setPosition(d4, d5, d10);
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.5D;
|
||||
this.motY *= 0.5D;
|
||||
|
@ -225,8 +246,8 @@ public class EntityBoat extends Entity {
|
|||
}
|
||||
} else {
|
||||
if (d0 < 1.0D) {
|
||||
d3 = d0 * 2.0D - 1.0D;
|
||||
this.motY += 0.03999999910593033D * d3;
|
||||
d4 = d0 * 2.0D - 1.0D;
|
||||
this.motY += 0.03999999910593033D * d4;
|
||||
} else {
|
||||
if (this.motY < 0.0D) {
|
||||
this.motY /= 2.0D;
|
||||
|
@ -254,21 +275,21 @@ public class EntityBoat extends Entity {
|
|||
// CraftBukkit end
|
||||
|
||||
// CraftBukkit
|
||||
d3 = this.maxSpeed;
|
||||
if (this.motX < -d3) {
|
||||
this.motX = -d3;
|
||||
d4 = this.maxSpeed;
|
||||
if (this.motX < -d4) {
|
||||
this.motX = -d4;
|
||||
}
|
||||
|
||||
if (this.motX > d3) {
|
||||
this.motX = d3;
|
||||
if (this.motX > d4) {
|
||||
this.motX = d4;
|
||||
}
|
||||
|
||||
if (this.motZ < -d3) {
|
||||
this.motZ = -d3;
|
||||
if (this.motZ < -d4) {
|
||||
this.motZ = -d4;
|
||||
}
|
||||
|
||||
if (this.motZ > d3) {
|
||||
this.motZ = d3;
|
||||
if (this.motZ > d4) {
|
||||
this.motZ = d4;
|
||||
}
|
||||
|
||||
if (this.onGround && !landBoats) { // CraftBukkit
|
||||
|
@ -278,30 +299,7 @@ public class EntityBoat extends Entity {
|
|||
}
|
||||
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
d4 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
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.positionChanged && d3 > 0.2D) {
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
|
@ -321,7 +319,7 @@ public class EntityBoat extends Entity {
|
|||
for (k = 0; k < 2; ++k) {
|
||||
this.a(Item.STICK.id, 1, 0.0F);
|
||||
}
|
||||
}// CraftBukkit
|
||||
} // CraftBukkit
|
||||
}
|
||||
} else {
|
||||
this.motX *= 0.9900000095367432D;
|
||||
|
@ -331,11 +329,10 @@ public class EntityBoat extends Entity {
|
|||
|
||||
this.pitch = 0.0F;
|
||||
d5 = (double) this.yaw;
|
||||
d6 = this.lastX - this.locX;
|
||||
double d11 = this.lastZ - this.locZ;
|
||||
|
||||
if (d6 * d6 + d11 * d11 > 0.0010D) {
|
||||
d5 = (double) ((float) (Math.atan2(d11, d6) * 180.0D / 3.141592653589793D));
|
||||
d10 = this.lastX - this.locX;
|
||||
d11 = this.lastZ - this.locZ;
|
||||
if (d10 * d10 + d11 * d11 > 0.0010D) {
|
||||
d5 = (double) ((float) (Math.atan2(d11, d10) * 180.0D / 3.141592653589793D));
|
||||
}
|
||||
|
||||
double d12;
|
||||
|
@ -382,7 +379,7 @@ public class EntityBoat extends Entity {
|
|||
for (l = 0; l < list.size(); ++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);
|
||||
}
|
||||
}
|
||||
|
@ -405,12 +402,12 @@ public class EntityBoat extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public void g_() {
|
||||
public void i() {
|
||||
if (this.passenger != null) {
|
||||
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
|
||||
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
|
||||
|
||||
this.passenger.setPosition(this.locX + d0, this.locY + this.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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,15 @@ public class EntityChicken extends EntityAnimal {
|
|||
super(world);
|
||||
this.texture = "/mob/chicken.png";
|
||||
this.b(0.3F, 0.7F);
|
||||
this.health = 4;
|
||||
this.j = this.random.nextInt(6000) + 6000;
|
||||
}
|
||||
|
||||
public void s() {
|
||||
super.s();
|
||||
public int getMaxHealth() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public void d() {
|
||||
super.d();
|
||||
this.h = this.b;
|
||||
this.g = this.c;
|
||||
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;
|
||||
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.b(Item.EGG.id, 1);
|
||||
this.j = this.random.nextInt(6000) + 6000;
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(float f) {}
|
||||
protected void b(float f) {}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
|
@ -63,33 +66,42 @@ public class EntityChicken extends EntityAnimal {
|
|||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.chicken";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.chickenhurt";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.chickenhurt";
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Item.FEATHER.id;
|
||||
}
|
||||
|
||||
protected void a(boolean flag) {
|
||||
protected void a(boolean flag, int i) {
|
||||
// CraftBukkit start - whole method
|
||||
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) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, count));
|
||||
loot.add(new org.bukkit.inventory.ItemStack(this.fireTicks > 0 ? Item.COOKED_CHICKEN.id : Item.RAW_CHICKEN.id, 1));
|
||||
if (j > 0) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, j));
|
||||
}
|
||||
|
||||
if (this.z()) {
|
||||
this.b(Item.COOKED_CHICKEN.id, 1);
|
||||
} else {
|
||||
this.b(Item.RAW_CHICKEN.id, 1);
|
||||
}
|
||||
|
||||
CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected EntityAnimal createChild(EntityAnimal entityanimal) {
|
||||
return new EntityChicken(this.world);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,8 @@ package net.minecraft.server;
|
|||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -19,6 +17,10 @@ public class EntityCow extends EntityAnimal {
|
|||
this.b(0.9F, 1.3F);
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
@ -27,39 +29,39 @@ public class EntityCow extends EntityAnimal {
|
|||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.cow";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.cowhurt";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.cowhurt";
|
||||
}
|
||||
|
||||
protected float l() {
|
||||
protected float o() {
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Item.LEATHER.id;
|
||||
}
|
||||
|
||||
protected void a(boolean flag) {
|
||||
protected void a(boolean flag, int i) {
|
||||
// CraftBukkit start - whole method
|
||||
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) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, count));
|
||||
if (j > 0) {
|
||||
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) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(this.fireTicks > 0 ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, count));
|
||||
if (j > 0) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(this.z() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
|
||||
}
|
||||
|
||||
CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
|
@ -87,7 +89,11 @@ public class EntityCow extends EntityAnimal {
|
|||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
return super.b(entityhuman);
|
||||
}
|
||||
}
|
||||
|
||||
protected EntityAnimal createChild(EntityAnimal entityanimal) {
|
||||
return new EntityCow(this.world);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,16 +17,17 @@ public abstract class EntityCreature extends EntityLiving {
|
|||
super(world);
|
||||
}
|
||||
|
||||
protected boolean v() {
|
||||
protected boolean w() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void c_() {
|
||||
protected void m_() {
|
||||
MethodProfiler.a("ai");
|
||||
if (this.f > 0) {
|
||||
--this.f;
|
||||
}
|
||||
|
||||
this.e = this.v();
|
||||
this.e = this.w();
|
||||
float f = 16.0F;
|
||||
|
||||
if (this.target == null) {
|
||||
|
@ -49,7 +50,7 @@ public abstract class EntityCreature extends EntityLiving {
|
|||
if (this.target != null) {
|
||||
this.pathEntity = this.world.findPath(this, this.target, f);
|
||||
}
|
||||
} else if (!this.target.ac()) {
|
||||
} else if (!this.target.aj()) {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -63,27 +64,29 @@ public abstract class EntityCreature extends EntityLiving {
|
|||
}
|
||||
// CraftBukkit end
|
||||
} 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);
|
||||
} else {
|
||||
this.b(this.target, f1);
|
||||
}
|
||||
}
|
||||
|
||||
MethodProfiler.a();
|
||||
if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
|
||||
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)) {
|
||||
this.A();
|
||||
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aS < 100) {
|
||||
this.C();
|
||||
}
|
||||
|
||||
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
|
||||
boolean flag = this.ao();
|
||||
boolean flag1 = this.ap();
|
||||
boolean flag = this.az();
|
||||
boolean flag1 = this.aA();
|
||||
|
||||
this.pitch = 0.0F;
|
||||
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
|
||||
MethodProfiler.a("followpath");
|
||||
Vec3D vec3d = this.pathEntity.a(this);
|
||||
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) {
|
||||
double d1 = vec3d.a - this.locX;
|
||||
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 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;
|
||||
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
|
||||
this.aP = -MathHelper.sin(f3) * this.aQ * 1.0F;
|
||||
this.aQ = MathHelper.cos(f3) * this.aQ * 1.0F;
|
||||
this.aT = -MathHelper.sin(f3) * this.aU * 1.0F;
|
||||
this.aU = MathHelper.cos(f3) * this.aU * 1.0F;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (this.positionChanged && !this.B()) {
|
||||
this.aS = true;
|
||||
if (this.positionChanged && !this.D()) {
|
||||
this.aW = true;
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
|
||||
this.aS = true;
|
||||
this.aW = true;
|
||||
}
|
||||
|
||||
MethodProfiler.a();
|
||||
} else {
|
||||
super.c_();
|
||||
super.m_();
|
||||
this.pathEntity = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void A() {
|
||||
protected void C() {
|
||||
MethodProfiler.a("stroll");
|
||||
boolean flag = false;
|
||||
int i = -1;
|
||||
int j = -1;
|
||||
|
@ -181,6 +187,8 @@ public abstract class EntityCreature extends EntityLiving {
|
|||
if (flag) {
|
||||
this.pathEntity = this.world.a(this, i, j, k, 10.0F);
|
||||
}
|
||||
|
||||
MethodProfiler.a();
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {}
|
||||
|
@ -195,15 +203,15 @@ public abstract class EntityCreature extends EntityLiving {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean g() {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.boundingBox.b);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -211,7 +219,7 @@ public abstract class EntityCreature extends EntityLiving {
|
|||
this.pathEntity = pathentity;
|
||||
}
|
||||
|
||||
public Entity C() {
|
||||
public Entity E() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
|
@ -219,8 +227,8 @@ public abstract class EntityCreature extends EntityLiving {
|
|||
this.target = entity;
|
||||
}
|
||||
|
||||
protected float D() {
|
||||
float f = super.D();
|
||||
protected float F() {
|
||||
float f = super.F();
|
||||
|
||||
if (this.f > 0) {
|
||||
f *= 2.0F;
|
||||
|
|
|
@ -16,6 +16,10 @@ public class EntityCreeper extends EntityMonster {
|
|||
this.texture = "/mob/creeper.png";
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) -1));
|
||||
|
@ -31,7 +35,7 @@ public class EntityCreeper extends EntityMonster {
|
|||
|
||||
public void a(NBTTagCompound 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) {
|
||||
|
@ -46,10 +50,10 @@ public class EntityCreeper extends EntityMonster {
|
|||
}
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
public void w_() {
|
||||
this.b = this.fuseTicks;
|
||||
if (this.world.isStatic) {
|
||||
int i = this.w();
|
||||
int i = this.A();
|
||||
|
||||
if (i > 0 && this.fuseTicks == 0) {
|
||||
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) {
|
||||
this.b(-1);
|
||||
--this.fuseTicks;
|
||||
|
@ -75,24 +79,24 @@ public class EntityCreeper extends EntityMonster {
|
|||
}
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.creeper";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.creeperdeath";
|
||||
}
|
||||
|
||||
public void die(DamageSource damagesource) {
|
||||
super.die(damagesource);
|
||||
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) {
|
||||
if (!this.world.isStatic) {
|
||||
int i = this.w();
|
||||
int i = this.A();
|
||||
|
||||
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
|
||||
this.b(-1);
|
||||
|
@ -132,11 +136,11 @@ public class EntityCreeper extends EntityMonster {
|
|||
return this.datawatcher.getByte(17) == 1;
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Item.SULPHUR.id;
|
||||
}
|
||||
|
||||
private int w() {
|
||||
private int A() {
|
||||
return this.datawatcher.getByte(16);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
|
|||
|
||||
public String a(EntityHuman entityhuman) {
|
||||
// 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});
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
|
@ -10,325 +8,82 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityEgg extends Entity {
|
||||
|
||||
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 class EntityEgg extends EntityProjectile {
|
||||
|
||||
public EntityEgg(World world) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
|
||||
public EntityEgg(World world, EntityLiving entityliving) {
|
||||
super(world);
|
||||
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);
|
||||
super(world, entityliving);
|
||||
}
|
||||
|
||||
public EntityEgg(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;
|
||||
super(world, d0, d1, d2);
|
||||
}
|
||||
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
// CraftBukkit start
|
||||
ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(phe);
|
||||
|
||||
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);
|
||||
if (movingobjectposition.entity != null) {
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
|
||||
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;
|
||||
}
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
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();
|
||||
if (event.isCancelled()) {
|
||||
stick = !projectile.doesBounce();
|
||||
} else {
|
||||
// this function returns if the egg should stick in or not, i.e. !bounce
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), event.getDamage());
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
|
||||
}
|
||||
|
||||
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;
|
||||
if (stick) {
|
||||
; // Original code does nothing *yet*
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0;
|
||||
int numHatching = (this.random.nextInt(32) == 0) ? 4 : 1;
|
||||
if (!hatching) {
|
||||
numHatching = 0;
|
||||
}
|
||||
|
||||
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);
|
||||
CreatureType hatchingType = CreatureType.CHICKEN;
|
||||
|
||||
if (this.shooter instanceof EntityPlayer) {
|
||||
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);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
hatching = event.isHatching();
|
||||
numHatching = event.getNumHatches();
|
||||
hatchingType = event.getHatchType();
|
||||
}
|
||||
|
||||
if (hatching) {
|
||||
for (int k = 0; k < numHatching; k++) {
|
||||
world.getWorld().spawn(new Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
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
|
||||
ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(phe);
|
||||
|
||||
if (movingobjectposition.entity != null) {
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
stick = !projectile.doesBounce();
|
||||
} else {
|
||||
// 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());
|
||||
}
|
||||
} else {
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.thrower), 0);
|
||||
}
|
||||
|
||||
if (stick) {
|
||||
; // Original code does nothing *yet*
|
||||
}
|
||||
}
|
||||
|
||||
boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0;
|
||||
int numHatching = (this.random.nextInt(32) == 0) ? 4 : 1;
|
||||
if (!hatching) {
|
||||
numHatching = 0;
|
||||
}
|
||||
|
||||
CreatureType hatchingType = CreatureType.CHICKEN;
|
||||
|
||||
if (this.thrower instanceof EntityPlayer) {
|
||||
org.bukkit.entity.Player player = (this.thrower == null) ? null : (org.bukkit.entity.Player) this.thrower.getBukkitEntity();
|
||||
|
||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
hatching = event.isHatching();
|
||||
numHatching = event.getNumHatches();
|
||||
hatchingType = event.getHatchType();
|
||||
}
|
||||
|
||||
if (hatching) {
|
||||
for (int k = 0; k < numHatching; k++) {
|
||||
Entity entity = null;
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
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.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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,14 @@ public class EntityEnderman extends EntityMonster {
|
|||
public EntityEnderman(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/enderman.png";
|
||||
this.aU = 0.2F;
|
||||
this.damage = 5;
|
||||
this.aY = 0.2F;
|
||||
this.damage = 7;
|
||||
this.b(0.6F, 2.9F);
|
||||
this.bI = 1.0F;
|
||||
this.bM = 1.0F;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 40;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
|
@ -34,17 +38,17 @@ public class EntityEnderman extends EntityMonster {
|
|||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
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) {
|
||||
super.a(nbttagcompound);
|
||||
this.setCarriedId(nbttagcompound.d("carried"));
|
||||
this.setCarriedData(nbttagcompound.d("carryingData"));
|
||||
this.setCarriedId(nbttagcompound.e("carried"));
|
||||
this.setCarriedData(nbttagcompound.e("carriedData"));
|
||||
}
|
||||
|
||||
protected Entity findTarget() {
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 64.0D);
|
||||
EntityHuman entityhuman = this.world.b(this, 64.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
if (this.c(entityhuman)) {
|
||||
|
@ -60,8 +64,8 @@ public class EntityEnderman extends EntityMonster {
|
|||
return null;
|
||||
}
|
||||
|
||||
public float a_(float f) {
|
||||
return super.a_(f);
|
||||
public float a(float f) {
|
||||
return super.a(f);
|
||||
}
|
||||
|
||||
private boolean c(EntityHuman entityhuman) {
|
||||
|
@ -70,24 +74,24 @@ public class EntityEnderman extends EntityMonster {
|
|||
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
|
||||
return false;
|
||||
} else {
|
||||
Vec3D vec3d = entityhuman.c(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 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.x()), this.locZ - entityhuman.locZ);
|
||||
double d0 = vec3d1.c();
|
||||
|
||||
vec3d1 = vec3d1.b();
|
||||
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() {
|
||||
if (this.an()) {
|
||||
public void d() {
|
||||
if (this.ay()) {
|
||||
this.damageEntity(DamageSource.DROWN, 1);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (this.world.d() && !this.world.isStatic) {
|
||||
float f = this.a_(1.0F);
|
||||
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) {
|
||||
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) {
|
||||
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 instanceof EntityHuman && this.c((EntityHuman) this.target)) {
|
||||
this.aP = this.aQ = 0.0F;
|
||||
this.aU = 0.0F;
|
||||
if (this.target.h(this) < 16.0D) {
|
||||
this.w();
|
||||
this.aT = this.aU = 0.0F;
|
||||
this.aY = 0.0F;
|
||||
if (this.target.i(this) < 16.0D) {
|
||||
this.u_();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
} 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 d1 = this.locY + (double) (this.random.nextInt(64) - 32);
|
||||
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) {
|
||||
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);
|
||||
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.x(), this.locZ - entity.locZ);
|
||||
|
||||
vec3d = vec3d.b();
|
||||
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 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 d4 = this.locY;
|
||||
double d5 = this.locZ;
|
||||
|
@ -244,39 +254,43 @@ public class EntityEnderman extends EntityMonster {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
return "mob.zombie";
|
||||
protected String c_() {
|
||||
return "mob.endermen.idle";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
return "mob.zombiehurt";
|
||||
protected String m() {
|
||||
return "mob.endermen.hit";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
return "mob.zombiedeath";
|
||||
protected String n() {
|
||||
return "mob.endermen.death";
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Item.ENDER_PEARL.id;
|
||||
}
|
||||
|
||||
protected void a(boolean flag) {
|
||||
int i = this.k();
|
||||
protected void a(boolean flag, int i) {
|
||||
int j = this.e();
|
||||
|
||||
// CraftBukkit start - whole method
|
||||
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
int count = this.random.nextInt(2);
|
||||
if (j > 0) {
|
||||
// CraftBukkit start - whole method
|
||||
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
int count = this.random.nextInt(2 + i);
|
||||
|
||||
if ((i > 0) && (count > 0)) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(i, count));
|
||||
if ((j > 0) && (count > 0)) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(j, count));
|
||||
}
|
||||
|
||||
CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void setCarriedId(int i) {
|
||||
|
@ -295,51 +309,34 @@ public class EntityEnderman extends EntityMonster {
|
|||
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 {
|
||||
b[Block.STONE.id] = true;
|
||||
b[Block.GRASS.id] = true;
|
||||
b[Block.DIRT.id] = true;
|
||||
b[Block.COBBLESTONE.id] = true;
|
||||
b[Block.WOOD.id] = true;
|
||||
b[Block.SAND.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.RED_ROSE.id] = true;
|
||||
b[Block.BROWN_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.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.CLAY.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.MYCEL.id] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,8 @@ public class EntityExperienceOrb extends Entity {
|
|||
public int a;
|
||||
public int b = 0;
|
||||
public int c;
|
||||
private int e = 5;
|
||||
private int d = 5;
|
||||
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) {
|
||||
super(world);
|
||||
|
@ -21,7 +20,7 @@ public class EntityExperienceOrb extends Entity {
|
|||
this.value = i;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -33,8 +32,8 @@ public class EntityExperienceOrb extends Entity {
|
|||
|
||||
protected void b() {}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public void w_() {
|
||||
super.w_();
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
}
|
||||
|
@ -56,7 +55,7 @@ public class EntityExperienceOrb extends Entity {
|
|||
|
||||
if (entityhuman != null) {
|
||||
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 d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -104,9 +103,9 @@ public class EntityExperienceOrb extends Entity {
|
|||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.aq();
|
||||
this.e -= i;
|
||||
if (this.e <= 0) {
|
||||
this.aB();
|
||||
this.d -= i;
|
||||
if (this.d <= 0) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
|
@ -114,30 +113,30 @@ public class EntityExperienceOrb extends Entity {
|
|||
}
|
||||
|
||||
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("Value", (short) this.value);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.e = nbttagcompound.d("Health") & 255;
|
||||
this.b = nbttagcompound.d("Age");
|
||||
this.value = nbttagcompound.d("Value");
|
||||
this.d = nbttagcompound.e("Health") & 255;
|
||||
this.b = nbttagcompound.e("Age");
|
||||
this.value = nbttagcompound.e("Value");
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic) {
|
||||
if (this.c == 0 && entityhuman.w == 0) {
|
||||
entityhuman.w = 2;
|
||||
this.world.makeSound(this, "random.pop", 0.2F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F));
|
||||
if (this.c == 0 && entityhuman.x == 0) {
|
||||
entityhuman.x = 2;
|
||||
this.world.makeSound(this, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
|
||||
entityhuman.receive(this, 1);
|
||||
entityhuman.d(this.value);
|
||||
entityhuman.h(this.value);
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int j_() {
|
||||
public int g() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ public class EntityFallingSand extends Entity {
|
|||
public EntityFallingSand(World world, double d0, double d1, double d2, int i, int data) {
|
||||
super(world);
|
||||
this.a = i;
|
||||
this.bc = true;
|
||||
this.data = data; // CraftBukkit
|
||||
this.aY = true;
|
||||
this.b(0.98F, 0.98F);
|
||||
this.height = this.width / 2.0F;
|
||||
this.setPosition(d0, d1, d2);
|
||||
|
@ -27,17 +27,17 @@ public class EntityFallingSand extends Entity {
|
|||
this.lastZ = d2;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
|
||||
public boolean r_() {
|
||||
public boolean e_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
public void w_() {
|
||||
if (this.a == 0) {
|
||||
this.die();
|
||||
} else {
|
||||
|
@ -54,18 +54,22 @@ public class EntityFallingSand extends Entity {
|
|||
int j = MathHelper.floor(this.locY);
|
||||
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);
|
||||
} else if (!this.world.isStatic && this.b == 1) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
this.die();
|
||||
// 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) {
|
||||
this.b(this.a, 1);
|
||||
if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
|
||||
this.die();
|
||||
// CraftBukkit -- setTypeId => setTypeIdAndData
|
||||
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);
|
||||
}
|
||||
}
|
||||
} else if (this.b > 100 && !this.world.isStatic) {
|
||||
this.b(this.a, 1);
|
||||
|
@ -80,7 +84,7 @@ public class EntityFallingSand extends Entity {
|
|||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.a = nbttagcompound.c("Tile") & 255;
|
||||
this.data = nbttagcompound.c("Data") & 15; // CraftBukkit
|
||||
this.a = nbttagcompound.d("Tile") & 255;
|
||||
this.data = nbttagcompound.d("Data") & 15; // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,15 +15,14 @@ import org.bukkit.event.entity.ProjectileHitEvent;
|
|||
|
||||
public class EntityFireball extends Entity {
|
||||
|
||||
private int e = -1;
|
||||
private int f = -1;
|
||||
private int g = -1;
|
||||
private int h = -1;
|
||||
private int i = 0;
|
||||
private boolean j = false;
|
||||
public int a = 0;
|
||||
private int h = 0;
|
||||
private boolean i = false;
|
||||
public EntityLiving shooter;
|
||||
private int k;
|
||||
private int l = 0;
|
||||
private int j;
|
||||
private int k = 0;
|
||||
public double dirX;
|
||||
public double dirY;
|
||||
public double dirZ;
|
||||
|
@ -61,33 +60,33 @@ public class EntityFireball extends Entity {
|
|||
this.dirZ = d2 / d3 * 0.1D;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
this.fireTicks = 10;
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
public void w_() {
|
||||
super.w_();
|
||||
this.j(1);
|
||||
if (!this.world.isStatic && (this.shooter == null || this.shooter.dead)) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
if (this.j) {
|
||||
int i = this.world.getTypeId(this.f, this.g, this.h);
|
||||
if (this.i) {
|
||||
int i = this.world.getTypeId(this.e, this.f, this.g);
|
||||
|
||||
if (i == this.i) {
|
||||
++this.k;
|
||||
if (this.k == 1200) {
|
||||
if (i == this.h) {
|
||||
++this.j;
|
||||
if (this.j == 1200) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.j = false;
|
||||
this.i = 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.j = 0;
|
||||
this.k = 0;
|
||||
this.l = 0;
|
||||
} else {
|
||||
++this.l;
|
||||
++this.k;
|
||||
}
|
||||
|
||||
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) {
|
||||
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;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
@ -128,6 +127,57 @@ public class EntityFireball extends Entity {
|
|||
}
|
||||
|
||||
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
|
||||
ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(phe);
|
||||
|
@ -170,82 +220,39 @@ public class EntityFireball extends Entity {
|
|||
// CraftBukkit end
|
||||
}
|
||||
|
||||
// this.world.createExplosion((Entity) null, this.locX, this.locY, this.locZ, 1.0F, true); // CraftBukkit
|
||||
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) {
|
||||
nbttagcompound.a("xTile", (short) this.f);
|
||||
nbttagcompound.a("yTile", (short) this.g);
|
||||
nbttagcompound.a("zTile", (short) this.h);
|
||||
nbttagcompound.a("inTile", (byte) this.i);
|
||||
nbttagcompound.a("shake", (byte) this.a);
|
||||
nbttagcompound.a("inGround", (byte) (this.j ? 1 : 0));
|
||||
nbttagcompound.a("xTile", (short) this.e);
|
||||
nbttagcompound.a("yTile", (short) this.f);
|
||||
nbttagcompound.a("zTile", (short) this.g);
|
||||
nbttagcompound.a("inTile", (byte) this.h);
|
||||
nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0));
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.f = nbttagcompound.d("xTile");
|
||||
this.g = nbttagcompound.d("yTile");
|
||||
this.h = nbttagcompound.d("zTile");
|
||||
this.i = nbttagcompound.c("inTile") & 255;
|
||||
this.a = nbttagcompound.c("shake") & 255;
|
||||
this.j = nbttagcompound.c("inGround") == 1;
|
||||
this.e = nbttagcompound.e("xTile");
|
||||
this.f = nbttagcompound.e("yTile");
|
||||
this.g = nbttagcompound.e("zTile");
|
||||
this.h = nbttagcompound.d("inTile") & 255;
|
||||
this.i = nbttagcompound.d("inGround") == 1;
|
||||
}
|
||||
|
||||
public boolean r_() {
|
||||
public boolean e_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public float j_() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.aq();
|
||||
this.aB();
|
||||
if (damagesource.getEntity() != null) {
|
||||
Vec3D vec3d = damagesource.getEntity().ai();
|
||||
Vec3D vec3d = damagesource.getEntity().ap();
|
||||
|
||||
if (vec3d != null) {
|
||||
this.motX = vec3d.a;
|
||||
|
@ -256,9 +263,17 @@ public class EntityFireball extends Entity {
|
|||
this.dirZ = this.motZ * 0.1D;
|
||||
}
|
||||
|
||||
if (damagesource.getEntity() instanceof EntityLiving) {
|
||||
this.shooter = (EntityLiving) damagesource.getEntity();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public float a(float f) {
|
||||
return 1.0F;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,12 +32,12 @@ public class EntityFishingHook extends Entity {
|
|||
public EntityFishingHook(World world) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
this.bZ = true;
|
||||
this.ca = true;
|
||||
}
|
||||
|
||||
public EntityFishingHook(World world, EntityHuman entityhuman) {
|
||||
super(world);
|
||||
this.bZ = true;
|
||||
this.ca = true;
|
||||
this.owner = entityhuman;
|
||||
this.owner.hookedFish = this;
|
||||
this.b(0.25F, 0.25F);
|
||||
|
@ -79,8 +79,8 @@ public class EntityFishingHook extends Entity {
|
|||
this.i = 0;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public void w_() {
|
||||
super.w_();
|
||||
if (this.l > 0) {
|
||||
double d0 = this.locX + (this.m - this.locX) / (double) this.l;
|
||||
double d1 = this.locY + (this.n - this.locY) / (double) this.l;
|
||||
|
@ -103,9 +103,9 @@ public class EntityFishingHook extends Entity {
|
|||
this.c(this.yaw, this.pitch);
|
||||
} else {
|
||||
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.owner.hookedFish = null;
|
||||
return;
|
||||
|
@ -168,7 +168,7 @@ public class EntityFishingHook extends Entity {
|
|||
for (int j = 0; j < list.size(); ++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;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
|
||||
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());
|
||||
}
|
||||
} else {
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), 0);
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0);
|
||||
}
|
||||
if (!stick) {
|
||||
// CraftBukkit end
|
||||
|
@ -267,7 +267,7 @@ public class EntityFishingHook extends Entity {
|
|||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -325,15 +325,15 @@ public class EntityFishingHook extends Entity {
|
|||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.d = nbttagcompound.d("xTile");
|
||||
this.e = nbttagcompound.d("yTile");
|
||||
this.f = nbttagcompound.d("zTile");
|
||||
this.g = nbttagcompound.c("inTile") & 255;
|
||||
this.a = nbttagcompound.c("shake") & 255;
|
||||
this.h = nbttagcompound.c("inGround") == 1;
|
||||
this.d = nbttagcompound.e("xTile");
|
||||
this.e = nbttagcompound.e("yTile");
|
||||
this.f = nbttagcompound.e("zTile");
|
||||
this.g = nbttagcompound.d("inTile") & 255;
|
||||
this.a = nbttagcompound.d("shake") & 255;
|
||||
this.h = nbttagcompound.d("inGround") == 1;
|
||||
}
|
||||
|
||||
public int i() {
|
||||
public int j() {
|
||||
byte b0 = 0;
|
||||
|
||||
if (this.c != null) {
|
||||
|
@ -347,6 +347,7 @@ public class EntityFishingHook extends Entity {
|
|||
return 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
double d0 = this.owner.locX - this.locX;
|
||||
double d1 = this.owner.locY - this.locY;
|
||||
double d2 = this.owner.locZ - this.locZ;
|
||||
|
@ -369,6 +370,7 @@ public class EntityFishingHook extends Entity {
|
|||
return 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
double d5 = this.owner.locX - this.locX;
|
||||
double d6 = this.owner.locY - this.locY;
|
||||
double d7 = this.owner.locZ - this.locZ;
|
||||
|
|
|
@ -21,7 +21,17 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||
this.texture = "/mob/ghast.png";
|
||||
this.b(4.0F, 4.0F);
|
||||
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() {
|
||||
|
@ -29,19 +39,23 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public int getMaxHealth() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void w_() {
|
||||
super.w_();
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
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) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
this.ad();
|
||||
this.ak();
|
||||
this.e = this.f;
|
||||
double d0 = this.b - this.locX;
|
||||
double d1 = this.c - this.locY;
|
||||
|
@ -84,7 +98,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||
|
||||
if (this.target == null || this.h-- <= 0) {
|
||||
// CraftBukkit start
|
||||
Entity target = this.world.findNearbyPlayer(this, 100.0D);
|
||||
Entity target = this.world.b(this, 100.0D);
|
||||
if (target != null) {
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -105,23 +119,23 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||
|
||||
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 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;
|
||||
|
||||
this.U = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.f(this.target)) {
|
||||
this.V = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.g(this.target)) {
|
||||
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;
|
||||
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);
|
||||
double d8 = 4.0D;
|
||||
Vec3D vec3d = this.c(1.0F);
|
||||
Vec3D vec3d = this.d(1.0F);
|
||||
|
||||
entityfireball.locX = this.locX + vec3d.a * d8;
|
||||
entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D;
|
||||
|
@ -133,7 +147,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||
--this.f;
|
||||
}
|
||||
} 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) {
|
||||
--this.f;
|
||||
}
|
||||
|
@ -165,31 +179,47 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.ghast.moan";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.ghast.scream";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.ghast.death";
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return this.random.nextInt(20) == 0 && super.d() && this.world.difficulty > 0;
|
||||
public boolean g() {
|
||||
return this.random.nextInt(20) == 0 && super.g() && this.world.difficulty > 0;
|
||||
}
|
||||
|
||||
public int m() {
|
||||
public int p() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,7 +29,7 @@ public class EntityItem extends Entity {
|
|||
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,8 +41,8 @@ public class EntityItem extends Entity {
|
|||
|
||||
protected void b() {}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public void w_() {
|
||||
super.w_();
|
||||
// CraftBukkit start
|
||||
int currentTick = (int) (System.currentTimeMillis() / 50);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class EntityItem extends Entity {
|
|||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.aq();
|
||||
this.aB();
|
||||
this.f -= i;
|
||||
if (this.f <= 0) {
|
||||
this.die();
|
||||
|
@ -112,9 +112,9 @@ public class EntityItem extends Entity {
|
|||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.f = nbttagcompound.d("Health") & 255;
|
||||
this.b = nbttagcompound.d("Age");
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item");
|
||||
this.f = nbttagcompound.e("Health") & 255;
|
||||
this.b = nbttagcompound.e("Age");
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.l("Item");
|
||||
|
||||
this.itemStack = ItemStack.a(nbttagcompound1);
|
||||
if (this.itemStack == null) {
|
||||
|
@ -153,6 +153,14 @@ public class EntityItem extends Entity {
|
|||
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);
|
||||
entityhuman.receive(this, i);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,21 +17,18 @@ import org.bukkit.event.vehicle.VehicleUpdateEvent;
|
|||
public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
private ItemStack[] items;
|
||||
public int damage;
|
||||
public int b;
|
||||
public int c;
|
||||
private boolean i;
|
||||
private int e;
|
||||
private boolean f;
|
||||
public int type;
|
||||
public int e;
|
||||
public double f;
|
||||
public double g;
|
||||
public double b;
|
||||
public double c;
|
||||
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 m;
|
||||
private double n;
|
||||
private double o;
|
||||
private double p;
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean slowWhenEmpty = true;
|
||||
|
@ -51,30 +48,33 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
public EntityMinecart(World world) {
|
||||
super(world);
|
||||
this.items = new ItemStack[27]; // CraftBukkit
|
||||
this.damage = 0;
|
||||
this.b = 0;
|
||||
this.c = 1;
|
||||
this.i = false;
|
||||
this.aY = true;
|
||||
this.e = 0;
|
||||
this.f = false;
|
||||
this.bc = true;
|
||||
this.b(0.98F, 0.7F);
|
||||
this.height = this.width / 2.0F;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean g_() {
|
||||
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;
|
||||
}
|
||||
|
||||
public AxisAlignedBB f() {
|
||||
public AxisAlignedBB h_() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
public boolean f_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -112,11 +112,11 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
i = event.getDamage();
|
||||
// CraftBukkit end
|
||||
|
||||
this.c = -this.c;
|
||||
this.b = 10;
|
||||
this.aq();
|
||||
this.damage += i * 10;
|
||||
if (this.damage > 40) {
|
||||
this.d(-this.m());
|
||||
this.c(10);
|
||||
this.aB();
|
||||
this.setDamage(this.getDamage() + i * 10);
|
||||
if (this.getDamage() > 40) {
|
||||
if (this.passenger != null) {
|
||||
this.passenger.mount(this);
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
|
||||
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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -175,7 +175,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean r_() {
|
||||
public boolean e_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
super.die();
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
public void w_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
|
@ -219,34 +219,38 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
float prevPitch = this.pitch;
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.b > 0) {
|
||||
--this.b;
|
||||
if (this.l() > 0) {
|
||||
this.c(this.l() - 1);
|
||||
}
|
||||
|
||||
if (this.damage > 0) {
|
||||
--this.damage;
|
||||
if (this.getDamage() > 0) {
|
||||
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.k > 0) {
|
||||
double d1 = this.locX + (this.l - this.locX) / (double) this.k;
|
||||
double d2 = this.locY + (this.m - this.locY) / (double) this.k;
|
||||
double d3 = this.locZ + (this.n - this.locZ) / (double) this.k;
|
||||
if (this.world.isStatic) {
|
||||
if (this.h > 0) {
|
||||
double d0 = this.locX + (this.i - this.locX) / (double) this.h;
|
||||
double d1 = this.locY + (this.j - this.locY) / (double) this.h;
|
||||
double d2 = this.locZ + (this.k - this.locZ) / (double) this.h;
|
||||
|
||||
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) {
|
||||
d0 -= 360.0D;
|
||||
while (d3 >= 180.0D) {
|
||||
d3 -= 360.0D;
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d0 / (double) this.k);
|
||||
this.pitch = (float) ((double) this.pitch + (this.p - (double) this.pitch) / (double) this.k);
|
||||
--this.k;
|
||||
this.setPosition(d1, d2, d3);
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.h);
|
||||
this.pitch = (float) ((double) this.pitch + (this.m - (double) this.pitch) / (double) this.h);
|
||||
--this.h;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.c(this.yaw, this.pitch);
|
||||
} else {
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
|
@ -267,25 +271,23 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
|
||||
// CraftBukkit
|
||||
double d4 = this.maxSpeed;
|
||||
boolean flag = false;
|
||||
|
||||
d0 = 0.0078125D;
|
||||
double d5 = 0.0078125D;
|
||||
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);
|
||||
int i1 = this.world.getData(i, j, k);
|
||||
|
||||
this.locY = (double) j;
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
boolean flag2 = false;
|
||||
|
||||
if (l == Block.GOLDEN_RAIL.id) {
|
||||
flag1 = (i1 & 8) != 0;
|
||||
flag2 = !flag1;
|
||||
flag = (i1 & 8) != 0;
|
||||
flag1 = !flag;
|
||||
}
|
||||
|
||||
if (((BlockMinecartTrack) Block.byId[l]).f()) {
|
||||
if (((BlockMinecartTrack) Block.byId[l]).h()) {
|
||||
i1 &= 7;
|
||||
}
|
||||
|
||||
|
@ -294,41 +296,41 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
|
||||
if (i1 == 2) {
|
||||
this.motX -= d0;
|
||||
this.motX -= d5;
|
||||
}
|
||||
|
||||
if (i1 == 3) {
|
||||
this.motX += d0;
|
||||
this.motX += d5;
|
||||
}
|
||||
|
||||
if (i1 == 4) {
|
||||
this.motZ += d0;
|
||||
this.motZ += d5;
|
||||
}
|
||||
|
||||
if (i1 == 5) {
|
||||
this.motZ -= d0;
|
||||
this.motZ -= d5;
|
||||
}
|
||||
|
||||
int[][] aint = matrix[i1];
|
||||
double d5 = (double) (aint[1][0] - aint[0][0]);
|
||||
double d6 = (double) (aint[1][2] - aint[0][2]);
|
||||
double d7 = Math.sqrt(d5 * d5 + d6 * d6);
|
||||
double d8 = this.motX * d5 + this.motZ * d6;
|
||||
double d6 = (double) (aint[1][0] - aint[0][0]);
|
||||
double d7 = (double) (aint[1][2] - aint[0][2]);
|
||||
double d8 = Math.sqrt(d6 * d6 + d7 * d7);
|
||||
double d9 = this.motX * d6 + this.motZ * d7;
|
||||
|
||||
if (d8 < 0.0D) {
|
||||
d5 = -d5;
|
||||
if (d9 < 0.0D) {
|
||||
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.motZ = d9 * d6 / d7;
|
||||
double d10;
|
||||
this.motX = d10 * d6 / d8;
|
||||
this.motZ = d10 * d7 / d8;
|
||||
double d11;
|
||||
|
||||
if (flag2) {
|
||||
d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d10 < 0.03D) {
|
||||
if (flag1) {
|
||||
d11 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d11 < 0.03D) {
|
||||
this.motX *= 0.0D;
|
||||
this.motY *= 0.0D;
|
||||
this.motZ *= 0.0D;
|
||||
|
@ -339,39 +341,39 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
}
|
||||
|
||||
d10 = 0.0D;
|
||||
double d11 = (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) i + 0.5D + (double) aint[1][0] * 0.5D;
|
||||
double d14 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
|
||||
d11 = 0.0D;
|
||||
double d12 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
|
||||
double d13 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
|
||||
double d14 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
|
||||
double d15 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
|
||||
|
||||
d5 = d13 - d11;
|
||||
d6 = d14 - d12;
|
||||
double d15;
|
||||
d7 = d15 - d13;
|
||||
double d16;
|
||||
double d17;
|
||||
double d18;
|
||||
|
||||
if (d5 == 0.0D) {
|
||||
if (d6 == 0.0D) {
|
||||
this.locX = (double) i + 0.5D;
|
||||
d10 = this.locZ - (double) k;
|
||||
} else if (d6 == 0.0D) {
|
||||
d11 = this.locZ - (double) k;
|
||||
} else if (d7 == 0.0D) {
|
||||
this.locZ = (double) k + 0.5D;
|
||||
d10 = this.locX - (double) i;
|
||||
d11 = this.locX - (double) i;
|
||||
} else {
|
||||
d16 = this.locX - d11;
|
||||
d15 = this.locZ - d12;
|
||||
d17 = (d16 * d5 + d15 * d6) * 2.0D;
|
||||
d10 = d17;
|
||||
d16 = this.locX - d12;
|
||||
d18 = this.locZ - d13;
|
||||
d17 = (d16 * d6 + d18 * d7) * 2.0D;
|
||||
d11 = d17;
|
||||
}
|
||||
|
||||
this.locX = d11 + d5 * d10;
|
||||
this.locZ = d12 + d6 * d10;
|
||||
this.locX = d12 + d6 * d11;
|
||||
this.locZ = d13 + d7 * d11;
|
||||
this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
|
||||
d16 = this.motX;
|
||||
d15 = this.motZ;
|
||||
d18 = this.motZ;
|
||||
if (this.passenger != null) {
|
||||
d16 *= 0.75D;
|
||||
d15 *= 0.75D;
|
||||
d18 *= 0.75D;
|
||||
}
|
||||
|
||||
if (d16 < -d4) {
|
||||
|
@ -382,15 +384,15 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
d16 = d4;
|
||||
}
|
||||
|
||||
if (d15 < -d4) {
|
||||
d15 = -d4;
|
||||
if (d18 < -d4) {
|
||||
d18 = -d4;
|
||||
}
|
||||
|
||||
if (d15 > d4) {
|
||||
d15 = d4;
|
||||
if (d18 > 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]) {
|
||||
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]) {
|
||||
|
@ -404,18 +406,17 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
this.motZ *= 0.996999979019165D;
|
||||
} else {
|
||||
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) {
|
||||
flag = true;
|
||||
this.f /= d17;
|
||||
this.g /= d17;
|
||||
double d18 = 0.04D;
|
||||
this.b /= d17;
|
||||
this.c /= d17;
|
||||
double d19 = 0.04D;
|
||||
|
||||
this.motX *= 0.800000011920929D;
|
||||
this.motY *= 0.0D;
|
||||
this.motZ *= 0.800000011920929D;
|
||||
this.motX += this.f * d18;
|
||||
this.motZ += this.g * d18;
|
||||
this.motX += this.b * d19;
|
||||
this.motZ += this.c * d19;
|
||||
} else {
|
||||
this.motX *= 0.8999999761581421D;
|
||||
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);
|
||||
|
||||
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);
|
||||
if (d9 > 0.0D) {
|
||||
this.motX = this.motX / d9 * (d9 + d19);
|
||||
this.motZ = this.motZ / d9 * (d9 + d19);
|
||||
d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d10 > 0.0D) {
|
||||
this.motX = this.motX / d10 * (d10 + d20);
|
||||
this.motZ = this.motZ / d10 * (d10 + d20);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (j1 != i || k1 != k) {
|
||||
d9 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
this.motX = d9 * (double) (j1 - i);
|
||||
this.motZ = d9 * (double) (k1 - k);
|
||||
d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
this.motX = d10 * (double) (j1 - i);
|
||||
this.motZ = d10 * (double) (k1 - k);
|
||||
}
|
||||
|
||||
double d20;
|
||||
double d21;
|
||||
|
||||
if (this.type == 2) {
|
||||
d20 = (double) MathHelper.a(this.f * this.f + this.g * this.g);
|
||||
if (d20 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
|
||||
this.f /= d20;
|
||||
this.g /= d20;
|
||||
if (this.f * this.motX + this.g * this.motZ < 0.0D) {
|
||||
this.f = 0.0D;
|
||||
this.g = 0.0D;
|
||||
d21 = (double) MathHelper.a(this.b * this.b + this.c * this.c);
|
||||
if (d21 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
|
||||
this.b /= d21;
|
||||
this.c /= d21;
|
||||
if (this.b * this.motX + this.c * this.motZ < 0.0D) {
|
||||
this.b = 0.0D;
|
||||
this.c = 0.0D;
|
||||
} else {
|
||||
this.f = this.motX;
|
||||
this.g = this.motZ;
|
||||
this.b = this.motX;
|
||||
this.c = this.motZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
d20 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d20 > 0.01D) {
|
||||
double d21 = 0.06D;
|
||||
if (flag) {
|
||||
d21 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d21 > 0.01D) {
|
||||
double d22 = 0.06D;
|
||||
|
||||
this.motX += this.motX / d20 * d21;
|
||||
this.motZ += this.motZ / d20 * d21;
|
||||
this.motX += this.motX / d21 * d22;
|
||||
this.motZ += this.motZ / d21 * d22;
|
||||
} else if (i1 == 1) {
|
||||
if (this.world.e(i - 1, j, k)) {
|
||||
this.motX = 0.02D;
|
||||
|
@ -525,29 +526,29 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
|
||||
this.pitch = 0.0F;
|
||||
double d22 = this.lastX - this.locX;
|
||||
double d23 = this.lastZ - this.locZ;
|
||||
double d23 = this.lastX - this.locX;
|
||||
double d24 = this.lastZ - this.locZ;
|
||||
|
||||
if (d22 * d22 + d23 * d23 > 0.0010D) {
|
||||
this.yaw = (float) (Math.atan2(d23, d22) * 180.0D / 3.141592653589793D);
|
||||
if (this.i) {
|
||||
if (d23 * d23 + d24 * d24 > 0.0010D) {
|
||||
this.yaw = (float) (Math.atan2(d24, d23) * 180.0D / 3.141592653589793D);
|
||||
if (this.f) {
|
||||
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) {
|
||||
d24 += 360.0D;
|
||||
while (d25 < -180.0D) {
|
||||
d25 += 360.0D;
|
||||
}
|
||||
|
||||
if (d24 < -170.0D || d24 >= 170.0D) {
|
||||
if (d25 < -170.0D || d25 >= 170.0D) {
|
||||
this.yaw += 180.0F;
|
||||
this.i = !this.i;
|
||||
this.f = !this.f;
|
||||
}
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.passenger != null && this.passenger.dead) {
|
||||
this.passenger.vehicle = null; // CraftBukkit
|
||||
if (this.passenger.vehicle == this) {
|
||||
this.passenger.vehicle = null;
|
||||
}
|
||||
|
||||
this.passenger = null;
|
||||
}
|
||||
|
||||
if (flag && this.random.nextInt(4) == 0) {
|
||||
if (this.e > 0) {
|
||||
--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);
|
||||
|
||||
if (BlockMinecartTrack.c(l)) {
|
||||
if (BlockMinecartTrack.d(l)) {
|
||||
int i1 = this.world.getData(i, j, k);
|
||||
|
||||
d1 = (double) j;
|
||||
if (((BlockMinecartTrack) Block.byId[l]).f()) {
|
||||
if (((BlockMinecartTrack) Block.byId[l]).h()) {
|
||||
i1 &= 7;
|
||||
}
|
||||
|
||||
|
@ -662,8 +667,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("Type", this.type);
|
||||
if (this.type == 2) {
|
||||
nbttagcompound.a("PushX", this.f);
|
||||
nbttagcompound.a("PushZ", this.g);
|
||||
nbttagcompound.a("PushX", this.b);
|
||||
nbttagcompound.a("PushZ", this.c);
|
||||
nbttagcompound.a("Fuel", (short) this.e);
|
||||
} else if (this.type == 1) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
@ -683,19 +688,19 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.type = nbttagcompound.e("Type");
|
||||
this.type = nbttagcompound.f("Type");
|
||||
if (this.type == 2) {
|
||||
this.f = nbttagcompound.h("PushX");
|
||||
this.g = nbttagcompound.h("PushZ");
|
||||
this.e = nbttagcompound.d("Fuel");
|
||||
this.b = nbttagcompound.i("PushX");
|
||||
this.c = nbttagcompound.i("PushZ");
|
||||
this.e = nbttagcompound.e("Fuel");
|
||||
} else if (this.type == 1) {
|
||||
NBTTagList nbttaglist = nbttagcompound.l("Items");
|
||||
NBTTagList nbttaglist = nbttagcompound.m("Items");
|
||||
|
||||
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);
|
||||
int j = nbttagcompound1.c("Slot") & 255;
|
||||
int j = nbttagcompound1.d("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < this.items.length) {
|
||||
this.items[j] = ItemStack.a(nbttagcompound1);
|
||||
|
@ -749,17 +754,18 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
d1 *= d3;
|
||||
d0 *= 0.10000000149011612D;
|
||||
d1 *= 0.10000000149011612D;
|
||||
d0 *= (double) (1.0F - this.bK);
|
||||
d1 *= (double) (1.0F - this.bK);
|
||||
d0 *= (double) (1.0F - this.bO);
|
||||
d1 *= (double) (1.0F - this.bO);
|
||||
d0 *= 0.5D;
|
||||
d1 *= 0.5D;
|
||||
if (entity instanceof EntityMinecart) {
|
||||
double d4 = entity.locX - this.locX;
|
||||
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 > 5.0D) {
|
||||
if (d6 < 0.800000011920929D) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -769,28 +775,28 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||
if (((EntityMinecart) entity).type == 2 && this.type != 2) {
|
||||
this.motX *= 0.20000000298023224D;
|
||||
this.motZ *= 0.20000000298023224D;
|
||||
this.b(entity.motX - d0, 0.0D, entity.motZ - d1);
|
||||
entity.motX *= 0.699999988079071D;
|
||||
entity.motZ *= 0.699999988079071D;
|
||||
this.b_(entity.motX - d0, 0.0D, entity.motZ - d1);
|
||||
entity.motX *= 0.949999988079071D;
|
||||
entity.motZ *= 0.949999988079071D;
|
||||
} else if (((EntityMinecart) entity).type != 2 && this.type == 2) {
|
||||
entity.motX *= 0.20000000298023224D;
|
||||
entity.motZ *= 0.20000000298023224D;
|
||||
entity.b(this.motX + d0, 0.0D, this.motZ + d1);
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
entity.b_(this.motX + d0, 0.0D, this.motZ + d1);
|
||||
this.motX *= 0.949999988079071D;
|
||||
this.motZ *= 0.949999988079071D;
|
||||
} else {
|
||||
d7 /= 2.0D;
|
||||
d8 /= 2.0D;
|
||||
this.motX *= 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.motZ *= 0.20000000298023224D;
|
||||
entity.b(d7 + d0, 0.0D, d8 + d1);
|
||||
entity.b_(d7 + d0, 0.0D, d8 + d1);
|
||||
}
|
||||
} else {
|
||||
this.b(-d0, 0.0D, -d1);
|
||||
entity.b(d0 / 4.0D, 0.0D, d1 / 4.0D);
|
||||
this.b_(-d0, 0.0D, -d1);
|
||||
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);
|
||||
}
|
||||
|
||||
this.e += 1200;
|
||||
this.e += 3600;
|
||||
}
|
||||
|
||||
this.f = this.locX - entityhuman.locX;
|
||||
this.g = this.locZ - entityhuman.locZ;
|
||||
this.b = this.locX - entityhuman.locX;
|
||||
this.c = this.locZ - entityhuman.locZ;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,31 +13,30 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
|||
|
||||
public EntityMonster(World world) {
|
||||
super(world);
|
||||
this.health = 20;
|
||||
this.ax = 5;
|
||||
this.az = 5;
|
||||
}
|
||||
|
||||
public void s() {
|
||||
float f = this.a_(1.0F);
|
||||
public void d() {
|
||||
float f = this.a(1.0F);
|
||||
|
||||
if (f > 0.5F) {
|
||||
this.aO += 2;
|
||||
this.aS += 2;
|
||||
}
|
||||
|
||||
super.s();
|
||||
super.d();
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public void w_() {
|
||||
super.w_();
|
||||
if (!this.world.isStatic && this.world.difficulty == 0) {
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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
|
||||
// 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.
|
||||
|
@ -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);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
i = event.getDamage();
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
return entity.damageEntity(DamageSource.mobAttack(this), event.getDamage());
|
||||
return entity.damageEntity(DamageSource.mobAttack(this), i);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// 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) {
|
||||
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
|
||||
this.attackTicks = 20;
|
||||
this.c(entity);
|
||||
this.d(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +121,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
|||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
protected boolean y() {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.boundingBox.b);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
@ -121,7 +131,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
|||
} else {
|
||||
int l = this.world.getLightLevel(i, j, k);
|
||||
|
||||
if (this.world.t()) {
|
||||
if (this.world.v()) {
|
||||
int i1 = this.world.k;
|
||||
|
||||
this.world.k = 10;
|
||||
|
@ -129,7 +139,11 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class EntityPainting extends Entity {
|
|||
|
||||
this.e = enumart;
|
||||
this.b(l);
|
||||
if (this.i()) {
|
||||
if (this.j()) {
|
||||
arraylist.add(enumart);
|
||||
}
|
||||
}
|
||||
|
@ -121,10 +121,10 @@ public class EntityPainting extends Entity {
|
|||
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
public void w_() {
|
||||
if (this.f++ == 100 && !this.world.isStatic) {
|
||||
this.f = 0;
|
||||
if (!this.i()) {
|
||||
if (!this.j()) {
|
||||
// CraftBukkit start
|
||||
Material material = this.world.getMaterial((int)this.locX, (int)this.locY, (int)this.locZ);
|
||||
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) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -210,7 +210,7 @@ public class EntityPainting extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean r_() {
|
||||
public boolean e_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -234,12 +234,12 @@ public class EntityPainting extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
if(!dead) {
|
||||
this.die();
|
||||
this.aq();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
if (dead) return true;
|
||||
// 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;
|
||||
|
@ -259,7 +259,7 @@ public class EntityPainting extends Entity {
|
|||
|
||||
++this.fireTicks;
|
||||
if (this.fireTicks == 0) {
|
||||
this.fireTicks = 300;
|
||||
this.j(8);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -273,10 +273,10 @@ public class EntityPainting extends Entity {
|
|||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.a = nbttagcompound.c("Dir");
|
||||
this.b = nbttagcompound.e("TileX");
|
||||
this.c = nbttagcompound.e("TileY");
|
||||
this.d = nbttagcompound.e("TileZ");
|
||||
this.a = nbttagcompound.d("Dir");
|
||||
this.b = nbttagcompound.f("TileX");
|
||||
this.c = nbttagcompound.f("TileY");
|
||||
this.d = nbttagcompound.f("TileZ");
|
||||
String s = nbttagcompound.getString("Motive");
|
||||
EnumArt[] aenumart = EnumArt.values();
|
||||
int i = aenumart.length;
|
||||
|
@ -298,25 +298,19 @@ public class EntityPainting extends Entity {
|
|||
|
||||
public void move(double d0, double d1, double d2) {
|
||||
if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
if (dead) return; // CraftBukkit
|
||||
|
||||
// CraftBukkit start
|
||||
if(!dead) {
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
}
|
||||
|
||||
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 (dead) return; // CraftBukkit
|
||||
|
||||
// CraftBukkit start
|
||||
if(!dead) {
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,12 @@ public class EntityPig extends EntityAnimal {
|
|||
this.b(0.9F, 0.9F);
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
|
@ -24,23 +29,25 @@ public class EntityPig extends EntityAnimal {
|
|||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.setSaddle(nbttagcompound.m("Saddle"));
|
||||
this.setSaddle(nbttagcompound.n("Saddle"));
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.pig";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.pig";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.pigdeath";
|
||||
}
|
||||
|
||||
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);
|
||||
return true;
|
||||
} else {
|
||||
|
@ -48,8 +55,8 @@ public class EntityPig extends EntityAnimal {
|
|||
}
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
return this.fireTicks > 0 ? Item.GRILLED_PORK.id : Item.PORK.id;
|
||||
protected int e() {
|
||||
return this.z() ? Item.GRILLED_PORK.id : Item.PORK.id;
|
||||
}
|
||||
|
||||
public boolean hasSaddle() {
|
||||
|
@ -84,10 +91,14 @@ public class EntityPig extends EntityAnimal {
|
|||
}
|
||||
}
|
||||
|
||||
protected void a(float f) {
|
||||
super.a(f);
|
||||
protected void b(float f) {
|
||||
super.b(f);
|
||||
if (f > 5.0F && this.passenger instanceof EntityHuman) {
|
||||
((EntityHuman) this.passenger).a((Statistic) AchievementList.u);
|
||||
}
|
||||
}
|
||||
|
||||
protected EntityAnimal createChild(EntityAnimal entityanimal) {
|
||||
return new EntityPig(this.world);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,21 +16,21 @@ public class EntityPigZombie extends EntityZombie {
|
|||
public EntityPigZombie(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/pigzombie.png";
|
||||
this.aU = 0.5F;
|
||||
this.aY = 0.5F;
|
||||
this.damage = 5;
|
||||
this.fireProof = true;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
this.aU = this.target != null ? 0.95F : 0.5F;
|
||||
public void w_() {
|
||||
this.aY = this.target != null ? 0.95F : 0.5F;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -41,15 +41,15 @@ public class EntityPigZombie extends EntityZombie {
|
|||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.angerLevel = nbttagcompound.d("Anger");
|
||||
this.angerLevel = nbttagcompound.e("Anger");
|
||||
}
|
||||
|
||||
protected Entity findTarget() {
|
||||
return this.angerLevel == 0 ? null : super.findTarget();
|
||||
}
|
||||
|
||||
public void s() {
|
||||
super.s();
|
||||
public void d() {
|
||||
super.d();
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
|
@ -64,17 +64,17 @@ public class EntityPigZombie extends EntityZombie {
|
|||
if (entity1 instanceof EntityPigZombie) {
|
||||
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
|
||||
|
||||
entitypigzombie.e(entity);
|
||||
entitypigzombie.f(entity);
|
||||
}
|
||||
}
|
||||
|
||||
this.e(entity);
|
||||
this.f(entity);
|
||||
}
|
||||
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
|
||||
private void e(Entity entity) {
|
||||
private void f(Entity entity) {
|
||||
// CraftBukkit start
|
||||
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);
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.zombiepig.zpig";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.zombiepig.zpighurt";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.zombiepig.zpigdeath";
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
return Item.GRILLED_PORK.id;
|
||||
protected void a(boolean flag, int i) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,15 +24,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
public double e;
|
||||
public List chunkCoordIntPairQueue = new LinkedList();
|
||||
public Set playerChunkCoordIntPairs = new HashSet();
|
||||
private int cb = -99999999;
|
||||
private int cc = -99999999;
|
||||
private boolean cd = true;
|
||||
private int ce = -99999999;
|
||||
private int cf = 60;
|
||||
private ItemStack[] cg = new ItemStack[] { null, null, null, null, null};
|
||||
private int ch = 0;
|
||||
private int cd = -99999999;
|
||||
private boolean ce = true;
|
||||
private int cf = -99999999;
|
||||
private int cg = 60;
|
||||
private ItemStack[] ch = new ItemStack[] { null, null, null, null, null};
|
||||
private int ci = 0;
|
||||
public boolean h;
|
||||
public int i;
|
||||
public boolean j = false;
|
||||
|
||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
|
||||
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.b = minecraftserver;
|
||||
this.bI = 0.0F;
|
||||
this.bM = 0.0F;
|
||||
this.name = s;
|
||||
this.height = 0.0F;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
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
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
super.b(i);
|
||||
this.cf = -1;
|
||||
}
|
||||
|
||||
public void syncInventory() {
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public ItemStack[] getEquipment() {
|
||||
return this.cg;
|
||||
return this.ch;
|
||||
}
|
||||
|
||||
protected void m_() {
|
||||
protected void w() {
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
public float t() {
|
||||
public float x() {
|
||||
return 1.62F;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
public void w_() {
|
||||
this.itemInWorldManager.c();
|
||||
--this.cf;
|
||||
--this.cg;
|
||||
this.activeContainer.a();
|
||||
|
||||
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.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];
|
||||
}
|
||||
|
||||
|
@ -179,7 +185,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
if (this.cf > 0) {
|
||||
if (this.cg > 0) {
|
||||
return false;
|
||||
} else {
|
||||
// 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;
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
super.c(i, RegainReason.EATING);
|
||||
public void d(int i) {
|
||||
super.d(i);
|
||||
}
|
||||
|
||||
public void b(boolean flag) {
|
||||
super.s_();
|
||||
public void a(boolean flag) {
|
||||
super.w_();
|
||||
|
||||
for (int i = 0; i < this.inventory.getSize(); ++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);
|
||||
|
||||
if (packet != null) {
|
||||
|
@ -240,31 +246,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
WorldServer worldserver = this.b.getWorldServer(this.dimension);
|
||||
|
||||
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;
|
||||
int k = chunkcoordintpair.z * 16;
|
||||
|
||||
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));
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
this.a((TileEntity) list.get(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.I) {
|
||||
if (this.J) {
|
||||
//if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
|
||||
if (this.activeContainer != this.defaultContainer) {
|
||||
this.closeInventory();
|
||||
|
@ -273,49 +265,80 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
if (this.vehicle != null) {
|
||||
this.mount(this.vehicle);
|
||||
} else {
|
||||
this.J += 0.0125F;
|
||||
if (this.J >= 1.0F) {
|
||||
this.J = 1.0F;
|
||||
this.H = 10;
|
||||
this.b.serverConfigurationManager.f(this);
|
||||
this.ce = -1;
|
||||
this.cb = -1;
|
||||
this.K += 0.0125F;
|
||||
if (this.K >= 1.0F) {
|
||||
this.K = 1.0F;
|
||||
this.I = 10;
|
||||
boolean flag2 = false;
|
||||
byte b0;
|
||||
|
||||
if (this.dimension == -1) {
|
||||
b0 = 0;
|
||||
} else {
|
||||
b0 = -1;
|
||||
}
|
||||
|
||||
this.b.serverConfigurationManager.a(this, b0);
|
||||
this.cf = -1;
|
||||
this.cc = -1;
|
||||
this.cd = -1;
|
||||
this.a((Statistic) AchievementList.x);
|
||||
}
|
||||
}
|
||||
|
||||
this.I = false;
|
||||
this.J = false;
|
||||
//} // CraftBukkit
|
||||
} else {
|
||||
if (this.J > 0.0F) {
|
||||
this.J -= 0.05F;
|
||||
if (this.K > 0.0F) {
|
||||
this.K -= 0.05F;
|
||||
}
|
||||
|
||||
if (this.J < 0.0F) {
|
||||
this.J = 0.0F;
|
||||
if (this.K < 0.0F) {
|
||||
this.K = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.H > 0) {
|
||||
--this.H;
|
||||
if (this.I > 0) {
|
||||
--this.I;
|
||||
}
|
||||
|
||||
if (this.health != this.cb || this.cc != this.foodData.a() || this.foodData.c() == 0.0F != this.cd) {
|
||||
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health, this.foodData.a(), this.foodData.c()));
|
||||
this.cb = this.health;
|
||||
this.cc = this.foodData.a();
|
||||
this.cd = this.foodData.c() == 0.0F;
|
||||
if (this.getHealth() != this.cc || this.cd != this.foodData.a() || this.foodData.c() == 0.0F != this.ce) {
|
||||
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.c()));
|
||||
this.cc = this.getHealth();
|
||||
this.cd = this.foodData.a();
|
||||
this.ce = this.foodData.c() == 0.0F;
|
||||
}
|
||||
|
||||
if (this.expTotal != this.ce) {
|
||||
this.ce = this.expTotal;
|
||||
this.netServerHandler.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
|
||||
if (this.exp != this.cf) {
|
||||
this.cf = this.exp;
|
||||
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) {
|
||||
if (tileentity != null) {
|
||||
Packet packet = tileentity.l();
|
||||
Packet packet = tileentity.k();
|
||||
|
||||
if (packet != null) {
|
||||
this.netServerHandler.sendPacket(packet);
|
||||
|
@ -344,17 +367,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
this.activeContainer.a();
|
||||
}
|
||||
|
||||
public void v() {
|
||||
if (!this.s) {
|
||||
this.t = -1;
|
||||
this.s = true;
|
||||
public void r_() {
|
||||
if (!this.t) {
|
||||
this.u = -1;
|
||||
this.t = true;
|
||||
EntityTracker entitytracker = this.b.getTracker(this.dimension);
|
||||
|
||||
entitytracker.a(this, new Packet18ArmAnimation(this, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public void w() {}
|
||||
public void A() {}
|
||||
|
||||
public EnumBedError a(int i, int j, int k) {
|
||||
EnumBedError enumbederror = super.a(i, j, k);
|
||||
|
@ -406,39 +429,55 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
super.a(d0, flag);
|
||||
}
|
||||
|
||||
private void au() {
|
||||
this.ch = this.ch % 100 + 1;
|
||||
private void aH() {
|
||||
this.ci = this.ci % 100 + 1;
|
||||
}
|
||||
|
||||
public void b(int i, int j, int k) {
|
||||
this.au();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 1, "Crafting", 9));
|
||||
this.aH();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 1, "Crafting", 9));
|
||||
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);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
this.au();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 0, iinventory.getName(), iinventory.getSize()));
|
||||
this.aH();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 0, iinventory.getName(), iinventory.getSize()));
|
||||
this.activeContainer = new ContainerChest(this.inventory, iinventory);
|
||||
this.activeContainer.windowId = this.ch;
|
||||
this.activeContainer.windowId = this.ci;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(TileEntityFurnace tileentityfurnace) {
|
||||
this.au();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
|
||||
this.aH();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
|
||||
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
|
||||
this.activeContainer.windowId = this.ch;
|
||||
this.activeContainer.windowId = this.ci;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(TileEntityDispenser tileentitydispenser) {
|
||||
this.au();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
|
||||
this.aH();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ci, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -467,24 +506,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
|
||||
public void closeInventory() {
|
||||
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
|
||||
this.z();
|
||||
this.D();
|
||||
}
|
||||
|
||||
public void y() {
|
||||
public void C() {
|
||||
if (!this.h) {
|
||||
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l()));
|
||||
}
|
||||
}
|
||||
|
||||
public void z() {
|
||||
public void D() {
|
||||
this.activeContainer.a((EntityHuman) this);
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
|
||||
public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) {
|
||||
this.aP = f;
|
||||
this.aQ = f1;
|
||||
this.aS = flag;
|
||||
this.aT = f;
|
||||
this.aU = f1;
|
||||
this.aW = flag;
|
||||
this.setSneak(flag1);
|
||||
this.pitch = f2;
|
||||
this.yaw = f3;
|
||||
|
@ -503,7 +542,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
}
|
||||
}
|
||||
|
||||
public void A() {
|
||||
public void E() {
|
||||
if (this.vehicle != null) {
|
||||
this.mount(this.vehicle);
|
||||
}
|
||||
|
@ -517,8 +556,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
}
|
||||
}
|
||||
|
||||
public void B() {
|
||||
this.cb = -99999999;
|
||||
public void s_() {
|
||||
this.cc = -99999999;
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
|
@ -528,25 +567,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
this.netServerHandler.sendPacket(new Packet3Chat(s1));
|
||||
}
|
||||
|
||||
protected void C() {
|
||||
protected void G() {
|
||||
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
|
||||
super.C();
|
||||
super.G();
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack, int 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.sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(MobEffect mobeffect) {
|
||||
super.a(mobeffect);
|
||||
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
|
||||
}
|
||||
|
||||
protected void b(MobEffect mobeffect) {
|
||||
super.b(mobeffect);
|
||||
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
|
||||
|
@ -554,9 +588,30 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||
|
||||
protected void c(MobEffect mobeffect) {
|
||||
super.c(mobeffect);
|
||||
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
|
||||
}
|
||||
|
||||
protected void d(MobEffect mobeffect) {
|
||||
super.d(mobeffect);
|
||||
this.netServerHandler.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
|
||||
}
|
||||
|
||||
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
|
||||
public long timeOffset = 0;
|
||||
public boolean relativeTime = true;
|
||||
|
|
224
src/main/java/net/minecraft/server/EntityProjectile.java
Normal file
224
src/main/java/net/minecraft/server/EntityProjectile.java
Normal file
|
@ -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) {}
|
||||
}
|
|
@ -13,12 +13,16 @@ public class EntitySheep extends EntityAnimal {
|
|||
this.b(0.9F, 1.3F);
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
protected void a(boolean flag) {
|
||||
protected void a(boolean flag, int i) {
|
||||
// CraftBukkit start - whole method
|
||||
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
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Block.WOOL.id;
|
||||
}
|
||||
|
||||
|
@ -54,7 +58,7 @@ public class EntitySheep extends EntityAnimal {
|
|||
itemstack.damage(1, entityhuman);
|
||||
}
|
||||
|
||||
return false;
|
||||
return super.b(entityhuman);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
|
@ -65,19 +69,19 @@ public class EntitySheep extends EntityAnimal {
|
|||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.setSheared(nbttagcompound.m("Sheared"));
|
||||
this.setColor(nbttagcompound.c("Color"));
|
||||
this.setSheared(nbttagcompound.n("Sheared"));
|
||||
this.setColor(nbttagcompound.d("Color"));
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.sheep";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.sheep";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
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))));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -14,15 +14,19 @@ public class EntitySkeleton extends EntityMonster {
|
|||
this.texture = "/mob/skeleton.png";
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
public int getMaxHealth() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
protected String c_() {
|
||||
return "mob.skeleton";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.skeletonhurt";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.skeletonhurt";
|
||||
}
|
||||
|
||||
|
@ -32,7 +36,7 @@ public class EntitySkeleton extends EntityMonster {
|
|||
|
||||
public void die(DamageSource 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();
|
||||
double d0 = entityhuman.locX - this.locX;
|
||||
double d1 = entityhuman.locZ - this.locZ;
|
||||
|
@ -43,9 +47,9 @@ public class EntitySkeleton extends EntityMonster {
|
|||
}
|
||||
}
|
||||
|
||||
public void s() {
|
||||
if (this.world.d() && !this.world.isStatic) {
|
||||
float f = this.a_(1.0F);
|
||||
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) {
|
||||
// CraftBukkit start
|
||||
|
@ -53,13 +57,13 @@ public class EntitySkeleton extends EntityMonster {
|
|||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.fireTicks = 300;
|
||||
this.j(8);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
super.s();
|
||||
super.d();
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
|
@ -69,7 +73,7 @@ public class EntitySkeleton extends EntityMonster {
|
|||
|
||||
if (this.attackTicks == 0) {
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Item.ARROW.id;
|
||||
}
|
||||
|
||||
protected void a(boolean flag) {
|
||||
protected void a(boolean flag, int i) {
|
||||
// CraftBukkit start - whole method
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
int count = this.random.nextInt(3);
|
||||
int count = this.random.nextInt(3 + i);
|
||||
if (count > 0) {
|
||||
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) {
|
||||
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);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public EnchantmentDamage t() {
|
||||
return EnchantmentDamage.b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
|||
|
||||
public float a;
|
||||
public float b;
|
||||
public float c;
|
||||
private int size = 0;
|
||||
|
||||
public EntitySlime(World world) {
|
||||
|
@ -14,7 +15,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
|||
this.height = 0.0F;
|
||||
this.size = this.random.nextInt(20) + 10;
|
||||
this.setSize(i);
|
||||
this.ax = i;
|
||||
this.az = i;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
|
@ -25,8 +26,14 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
|||
public void setSize(int i) {
|
||||
this.datawatcher.watch(16, new Byte((byte) i));
|
||||
this.b(0.6F * (float) i, 0.6F * (float) i);
|
||||
this.health = i * i;
|
||||
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() {
|
||||
|
@ -40,14 +47,27 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
|||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.setSize(nbttagcompound.e("Size") + 1);
|
||||
this.setSize(nbttagcompound.f("Size") + 1);
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
this.b = this.a;
|
||||
protected String w() {
|
||||
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;
|
||||
|
||||
super.s_();
|
||||
super.w_();
|
||||
if (this.onGround && !flag) {
|
||||
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 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) {
|
||||
this.world.makeSound(this, "mob.slime", this.l(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
|
||||
if (this.G()) {
|
||||
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.6F;
|
||||
this.B();
|
||||
}
|
||||
|
||||
protected void c_() {
|
||||
this.ad();
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D);
|
||||
protected void m_() {
|
||||
this.ak();
|
||||
EntityHuman entityhuman = this.world.b(this, 16.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
this.a(entityhuman, 10.0F, 20.0F);
|
||||
}
|
||||
|
||||
if (this.onGround && this.size-- <= 0) {
|
||||
this.size = this.random.nextInt(20) + 10;
|
||||
this.size = this.A();
|
||||
if (entityhuman != null) {
|
||||
this.size /= 3;
|
||||
}
|
||||
|
||||
this.aS = true;
|
||||
if (this.getSize() > 1) {
|
||||
this.world.makeSound(this, "mob.slime", this.l(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
|
||||
this.aW = true;
|
||||
if (this.I()) {
|
||||
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.aP = 1.0F - this.random.nextFloat() * 2.0F;
|
||||
this.aQ = (float) (1 * this.getSize());
|
||||
this.aT = 1.0F - this.random.nextFloat() * 2.0F;
|
||||
this.aU = (float) (1 * this.getSize());
|
||||
} else {
|
||||
this.aS = false;
|
||||
this.aW = false;
|
||||
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() {
|
||||
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
|
||||
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);
|
||||
|
||||
if (!event.isCancelled() && event.getCount() > 0) {
|
||||
for (int j = 0; j < event.getCount(); ++j) {
|
||||
float f = ((float) (j % 2) - 0.5F) * (float) i / 4.0F;
|
||||
float f1 = ((float) (j / 2) - 0.5F) * (float) i / 4.0F;
|
||||
EntitySlime entityslime = new EntitySlime(this.world);
|
||||
|
||||
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);
|
||||
this.world.addEntity(entityslime);
|
||||
}
|
||||
j = event.getCount();
|
||||
} else {
|
||||
super.die();
|
||||
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.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
this.world.addEntity(entityslime);
|
||||
}
|
||||
}
|
||||
|
||||
super.die();
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {
|
||||
int i = this.getSize();
|
||||
if (this.C()) {
|
||||
int i = this.getSize();
|
||||
|
||||
if (i > 1 && this.f(entityhuman) && (double) this.g(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), i)) {
|
||||
this.world.makeSound(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected boolean C() {
|
||||
return this.getSize() > 1;
|
||||
}
|
||||
|
||||
protected int D() {
|
||||
return this.getSize();
|
||||
}
|
||||
|
||||
protected String m() {
|
||||
return "mob.slime";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.slime";
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
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));
|
||||
|
||||
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() {
|
||||
return 0.6F;
|
||||
protected float o() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
|
@ -10,248 +8,65 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
|||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntitySnowball extends Entity {
|
||||
|
||||
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 class EntitySnowball extends EntityProjectile {
|
||||
|
||||
public EntitySnowball(World world) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
|
||||
public EntitySnowball(World world, EntityLiving entityliving) {
|
||||
super(world);
|
||||
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);
|
||||
super(world, entityliving);
|
||||
}
|
||||
|
||||
public EntitySnowball(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;
|
||||
super(world, d0, d1, d2);
|
||||
}
|
||||
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
if (movingobjectposition.entity != null) {
|
||||
byte b0 = 0;
|
||||
|
||||
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;
|
||||
if (movingobjectposition.entity instanceof EntityBlaze) {
|
||||
b0 = 3;
|
||||
}
|
||||
|
||||
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
|
||||
ProjectileHitEvent phe = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(phe);
|
||||
ProjectileHitEvent hitEvent = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(hitEvent);
|
||||
boolean stick = false;
|
||||
|
||||
if (movingobjectposition.entity != null) {
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
|
||||
// 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.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||
b0 = (byte) event.getDamage();
|
||||
|
||||
if (event.isCancelled()) {
|
||||
stick = !projectile.doesBounce();
|
||||
} else {
|
||||
// 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 {
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
|
||||
}
|
||||
if (stick) {
|
||||
;
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), b0);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
for (int k = 0; k < 8; ++k) {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
if (stick) {
|
||||
// CraftBukkit end
|
||||
;
|
||||
}
|
||||
|
||||
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) {
|
||||
;
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
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);
|
||||
if (!this.world.isStatic) {
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,43 +11,63 @@ public class EntitySpider extends EntityMonster {
|
|||
super(world);
|
||||
this.texture = "/mob/spider.png";
|
||||
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;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected Entity findTarget() {
|
||||
float f = this.a_(1.0F);
|
||||
float f = this.a(1.0F);
|
||||
|
||||
if (f < 0.5F) {
|
||||
double d0 = 16.0D;
|
||||
|
||||
return this.world.findNearbyPlayer(this, d0);
|
||||
return this.world.b(this, d0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.spider";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.spider";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.spiderdeath";
|
||||
}
|
||||
|
||||
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) {
|
||||
// CraftBukkit start
|
||||
|
@ -88,13 +108,44 @@ public class EntitySpider extends EntityMonster {
|
|||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Item.STRING.id;
|
||||
}
|
||||
|
||||
public boolean p() {
|
||||
return this.positionChanged;
|
||||
protected void a(boolean flag, int i) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@ public class EntitySquid extends EntityWaterAnimal {
|
|||
this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
@ -34,31 +38,31 @@ public class EntitySquid extends EntityWaterAnimal {
|
|||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected float l() {
|
||||
protected float o() {
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected void a(boolean flag) {
|
||||
protected void a(boolean flag, int i) {
|
||||
// CraftBukkit start - whole method
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
int count = this.random.nextInt(3) + 1;
|
||||
int count = this.random.nextInt(3 + i) + 1;
|
||||
if (count > 0) {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
public void s() {
|
||||
super.s();
|
||||
public void d() {
|
||||
super.d();
|
||||
this.b = this.a;
|
||||
this.g = this.c;
|
||||
this.i = this.h;
|
||||
|
@ -89,7 +93,7 @@ public class EntitySquid extends EntityWaterAnimal {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.ao()) {
|
||||
if (this.az()) {
|
||||
float f;
|
||||
|
||||
if (this.h < 3.1415927F) {
|
||||
|
@ -107,20 +111,20 @@ public class EntitySquid extends EntityWaterAnimal {
|
|||
this.n *= 0.99F;
|
||||
}
|
||||
|
||||
if (!this.ai) {
|
||||
if (!this.aj) {
|
||||
this.motX = (double) (this.o * this.l);
|
||||
this.motY = (double) (this.p * this.l);
|
||||
this.motZ = (double) (this.q * this.l);
|
||||
}
|
||||
|
||||
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.yaw = this.U;
|
||||
this.V += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.V) * 0.1F;
|
||||
this.yaw = this.V;
|
||||
this.c += 3.1415927F * this.n * 1.5F;
|
||||
this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
|
||||
} else {
|
||||
this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
|
||||
if (!this.ai) {
|
||||
if (!this.aj) {
|
||||
this.motX = 0.0D;
|
||||
this.motY -= 0.08D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
|
@ -135,8 +139,11 @@ public class EntitySquid extends EntityWaterAnimal {
|
|||
this.move(this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
protected void c_() {
|
||||
if (this.random.nextInt(50) == 0 || !this.bQ || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
|
||||
protected void m_() {
|
||||
++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;
|
||||
|
||||
this.o = MathHelper.cos(f) * 0.2F;
|
||||
|
@ -144,6 +151,10 @@ public class EntitySquid extends EntityWaterAnimal {
|
|||
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();
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ public class EntityTNTPrimed extends Entity {
|
|||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
this.fuseTicks = 0;
|
||||
this.aY = true;
|
||||
this.bc = true;
|
||||
this.b(0.98F, 0.98F);
|
||||
this.height = this.width / 2.0F;
|
||||
}
|
||||
|
@ -37,15 +37,15 @@ public class EntityTNTPrimed extends Entity {
|
|||
|
||||
protected void b() {}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean r_() {
|
||||
public boolean e_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
public void w_() {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
|
@ -95,6 +95,6 @@ public class EntityTNTPrimed extends Entity {
|
|||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.fuseTicks = nbttagcompound.c("Fuse");
|
||||
this.fuseTicks = nbttagcompound.d("Fuse");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,21 +37,31 @@ public class EntityTracker {
|
|||
this.addEntity(entity, 64, 5, true);
|
||||
} else if (entity instanceof EntityArrow) {
|
||||
this.addEntity(entity, 64, 20, false);
|
||||
} else if (entity instanceof EntitySmallFireball) {
|
||||
this.addEntity(entity, 64, 10, false);
|
||||
} else if (entity instanceof EntityFireball) {
|
||||
this.addEntity(entity, 64, 10, false);
|
||||
} else if (entity instanceof EntitySnowball) {
|
||||
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) {
|
||||
this.addEntity(entity, 64, 10, true);
|
||||
} else if (entity instanceof EntityPotion) {
|
||||
this.addEntity(entity, 64, 10, true);
|
||||
} else if (entity instanceof EntityItem) {
|
||||
this.addEntity(entity, 64, 20, true);
|
||||
} else if (entity instanceof EntityMinecart) {
|
||||
this.addEntity(entity, 160, 5, true);
|
||||
this.addEntity(entity, 80, 3, true);
|
||||
} else if (entity instanceof EntityBoat) {
|
||||
this.addEntity(entity, 160, 5, true);
|
||||
this.addEntity(entity, 80, 3, true);
|
||||
} else if (entity instanceof EntitySquid) {
|
||||
this.addEntity(entity, 160, 3, true);
|
||||
this.addEntity(entity, 64, 3, true);
|
||||
} else if (entity instanceof IAnimal) {
|
||||
this.addEntity(entity, 80, 3, true);
|
||||
} else if (entity instanceof EntityEnderDragon) {
|
||||
this.addEntity(entity, 160, 3, true);
|
||||
} else if (entity instanceof EntityTNTPrimed) {
|
||||
this.addEntity(entity, 160, 10, true);
|
||||
|
@ -61,6 +71,8 @@ public class EntityTracker {
|
|||
this.addEntity(entity, 160, Integer.MAX_VALUE, false);
|
||||
} else if (entity instanceof EntityExperienceOrb) {
|
||||
this.addEntity(entity, 160, 20, true);
|
||||
} else if (entity instanceof EntityEnderCrystal) {
|
||||
this.addEntity(entity, 256, Integer.MAX_VALUE, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class EntityTrackerEntry {
|
|||
}
|
||||
|
||||
++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 j = MathHelper.floor(this.tracker.locY * 32.0D);
|
||||
int k = MathHelper.floor(this.tracker.locZ * 32.0D);
|
||||
|
@ -70,8 +70,8 @@ public class EntityTrackerEntry {
|
|||
int k1 = j - this.e;
|
||||
int l1 = k - this.f;
|
||||
Object object = null;
|
||||
boolean flag = Math.abs(i) >= 8 || Math.abs(j) >= 8 || Math.abs(k) >= 8;
|
||||
boolean flag1 = Math.abs(l - this.g) >= 8 || Math.abs(i1 - this.h) >= 8;
|
||||
boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4;
|
||||
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 (flag && flag1) {
|
||||
|
@ -126,27 +126,26 @@ public class EntityTrackerEntry {
|
|||
}
|
||||
}
|
||||
|
||||
this.tracker.ca = false;
|
||||
this.tracker.cb = false;
|
||||
if (this.tracker.velocityChanged) {
|
||||
// CraftBukkit start - create PlayerVelocity event
|
||||
boolean cancelled = false;
|
||||
|
||||
if(this.tracker instanceof EntityPlayer) {
|
||||
if (this.tracker instanceof EntityPlayer) {
|
||||
org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.tracker.getBukkitEntity();
|
||||
org.bukkit.util.Vector velocity = player.getVelocity();
|
||||
|
||||
org.bukkit.event.player.PlayerVelocityEvent event = new org.bukkit.event.player.PlayerVelocityEvent(player, velocity);
|
||||
this.tracker.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if(event.isCancelled()) {
|
||||
if (event.isCancelled()) {
|
||||
cancelled = true;
|
||||
}
|
||||
else if(!velocity.equals(event.getVelocity())) {
|
||||
} else if (!velocity.equals(event.getVelocity())) {
|
||||
player.setVelocity(velocity);
|
||||
}
|
||||
}
|
||||
|
||||
if(!cancelled) {
|
||||
if (!cancelled) {
|
||||
this.b((Packet) (new Packet28EntityVelocity(this.tracker)));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -235,6 +234,10 @@ public class EntityTrackerEntry {
|
|||
}
|
||||
|
||||
private Packet b() {
|
||||
if (this.tracker.dead) {
|
||||
System.out.println("Fetching addPacket for removed entity");
|
||||
}
|
||||
|
||||
if (this.tracker instanceof EntityItem) {
|
||||
EntityItem entityitem = (EntityItem) this.tracker;
|
||||
Packet21PickupSpawn packet21pickupspawn = new Packet21PickupSpawn(entityitem);
|
||||
|
@ -271,6 +274,8 @@ public class EntityTrackerEntry {
|
|||
return new Packet23VehicleSpawn(this.tracker, 1);
|
||||
} else if (this.tracker instanceof IAnimal) {
|
||||
return new Packet24MobSpawn((EntityLiving) this.tracker);
|
||||
} else if (this.tracker instanceof EntityEnderDragon) {
|
||||
return new Packet24MobSpawn((EntityLiving) this.tracker);
|
||||
} else if (this.tracker instanceof EntityFishingHook) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 90);
|
||||
} else if (this.tracker instanceof EntityArrow) {
|
||||
|
@ -279,40 +284,73 @@ public class EntityTrackerEntry {
|
|||
return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
|
||||
} else if (this.tracker instanceof EntitySnowball) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 61);
|
||||
} else if (this.tracker instanceof EntityFireball) {
|
||||
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 packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, shooter);
|
||||
// CraftBukkit end
|
||||
|
||||
packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
|
||||
packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
|
||||
packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
|
||||
return packet23vehiclespawn;
|
||||
} else if (this.tracker instanceof EntityEgg) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 62);
|
||||
} else if (this.tracker instanceof EntityTNTPrimed) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 50);
|
||||
} else if (this.tracker instanceof 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 {
|
||||
if (this.tracker instanceof EntityFallingSand) {
|
||||
EntityFallingSand entityfallingsand = (EntityFallingSand) this.tracker;
|
||||
Packet23VehicleSpawn packet23vehiclespawn;
|
||||
|
||||
if (entityfallingsand.a == Block.SAND.id) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 70);
|
||||
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);
|
||||
}
|
||||
|
||||
if (entityfallingsand.a == Block.GRAVEL.id) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 71);
|
||||
}
|
||||
}
|
||||
packet23vehiclespawn.e = (int) (entitysmallfireball.dirX * 8000.0D);
|
||||
packet23vehiclespawn.f = (int) (entitysmallfireball.dirY * 8000.0D);
|
||||
packet23vehiclespawn.g = (int) (entitysmallfireball.dirZ * 8000.0D);
|
||||
return packet23vehiclespawn;
|
||||
} else if (this.tracker instanceof EntityFireball) {
|
||||
EntityFireball entityfireball = (EntityFireball) this.tracker;
|
||||
|
||||
if (this.tracker instanceof EntityPainting) {
|
||||
return new Packet25EntityPainting((EntityPainting) this.tracker);
|
||||
} else if (this.tracker instanceof EntityExperienceOrb) {
|
||||
return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
|
||||
packet23vehiclespawn = null;
|
||||
if (entityfireball.shooter != null) {
|
||||
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
|
||||
} else {
|
||||
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, 0);
|
||||
}
|
||||
|
||||
packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
|
||||
packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
|
||||
packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
|
||||
return packet23vehiclespawn;
|
||||
} else if (this.tracker instanceof EntityEgg) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 62);
|
||||
} else if (this.tracker instanceof EntityTNTPrimed) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 50);
|
||||
} else if (this.tracker instanceof EntityEnderCrystal) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 51);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
|
||||
if (this.tracker instanceof EntityFallingSand) {
|
||||
EntityFallingSand entityfallingsand = (EntityFallingSand) this.tracker;
|
||||
|
||||
if (entityfallingsand.a == Block.SAND.id) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 70);
|
||||
}
|
||||
|
||||
if (entityfallingsand.a == Block.GRAVEL.id) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 71);
|
||||
}
|
||||
|
||||
if (entityfallingsand.a == Block.DRAGON_EGG.id) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 74);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.tracker instanceof EntityPainting) {
|
||||
return new Packet25EntityPainting((EntityPainting) this.tracker);
|
||||
} else if (this.tracker instanceof EntityExperienceOrb) {
|
||||
return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,9 +86,17 @@ public class EntityTypes {
|
|||
static {
|
||||
a(EntityItem.class, "Item", 1);
|
||||
a(EntityExperienceOrb.class, "XPOrb", 2);
|
||||
a(EntityPainting.class, "Painting", 9);
|
||||
a(EntityArrow.class, "Arrow", 10);
|
||||
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(EntityMonster.class, "Monster", 49);
|
||||
a(EntityCreeper.class, "Creeper", 50);
|
||||
|
@ -102,15 +110,18 @@ public class EntityTypes {
|
|||
a(EntityEnderman.class, "Enderman", 58);
|
||||
a(EntityCaveSpider.class, "CaveSpider", 59);
|
||||
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(EntitySheep.class, "Sheep", 91);
|
||||
a(EntityCow.class, "Cow", 92);
|
||||
a(EntityChicken.class, "Chicken", 93);
|
||||
a(EntitySquid.class, "Squid", 94);
|
||||
a(EntityWolf.class, "Wolf", 95);
|
||||
a(EntityTNTPrimed.class, "PrimedTnt", 20);
|
||||
a(EntityFallingSand.class, "FallingSand", 21);
|
||||
a(EntityMinecart.class, "Minecart", 40);
|
||||
a(EntityBoat.class, "Boat", 41);
|
||||
a(EntityMushroomCow.class, "MushroomCow", 96);
|
||||
a(EntitySnowman.class, "SnowMan", 97);
|
||||
a(EntityVillager.class, "Villager", 120);
|
||||
a(EntityEnderCrystal.class, "EnderCrystal", 200);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ public class EntityWeatherStorm extends EntityWeather {
|
|||
this.lifeTicks = 2;
|
||||
this.a = this.random.nextLong();
|
||||
this.c = this.random.nextInt(3) + 1;
|
||||
|
||||
// CraftBukkit
|
||||
if (!isEffect && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
|
||||
int i = MathHelper.floor(d0);
|
||||
|
@ -72,8 +73,8 @@ public class EntityWeatherStorm extends EntityWeather {
|
|||
}
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public void w_() {
|
||||
super.w_();
|
||||
if (this.lifeTicks == 2) {
|
||||
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
||||
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
|
||||
|
|
|
@ -26,18 +26,21 @@ public class EntityWolf extends EntityAnimal {
|
|||
super(world);
|
||||
this.texture = "/mob/wolf.png";
|
||||
this.b(0.8F, 0.8F);
|
||||
this.aU = 1.1F;
|
||||
this.health = 8;
|
||||
this.aY = 1.1F;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return this.isTamed() ? 20 : 8;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -54,8 +57,8 @@ public class EntityWolf extends EntityAnimal {
|
|||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.setAngry(nbttagcompound.m("Angry"));
|
||||
this.setSitting(nbttagcompound.m("Sitting"));
|
||||
this.setAngry(nbttagcompound.n("Angry"));
|
||||
this.setSitting(nbttagcompound.n("Sitting"));
|
||||
String s = nbttagcompound.getString("Owner");
|
||||
|
||||
if (s.length() > 0) {
|
||||
|
@ -65,44 +68,44 @@ public class EntityWolf extends EntityAnimal {
|
|||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.wolf.hurt";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.wolf.death";
|
||||
}
|
||||
|
||||
protected float l() {
|
||||
protected float o() {
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected void c_() {
|
||||
super.c_();
|
||||
if (!this.e && !this.B() && this.isTamed() && this.vehicle == null) {
|
||||
protected void m_() {
|
||||
super.m_();
|
||||
if (!this.e && !this.D() && this.isTamed() && this.vehicle == null) {
|
||||
EntityHuman entityhuman = this.world.a(this.getOwnerName());
|
||||
|
||||
if (entityhuman != null) {
|
||||
float f = entityhuman.g(this);
|
||||
float f = entityhuman.h(this);
|
||||
|
||||
if (f > 5.0F) {
|
||||
this.c(entityhuman, f);
|
||||
}
|
||||
} else if (!this.ao()) {
|
||||
} else if (!this.az()) {
|
||||
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));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
|
@ -120,20 +123,20 @@ public class EntityWolf extends EntityAnimal {
|
|||
}
|
||||
}
|
||||
|
||||
if (this.ao()) {
|
||||
if (this.az()) {
|
||||
this.setSitting(false);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
this.datawatcher.watch(18, Integer.valueOf(this.health));
|
||||
this.datawatcher.watch(18, Integer.valueOf(this.getHealth()));
|
||||
}
|
||||
}
|
||||
|
||||
public void s() {
|
||||
super.s();
|
||||
public void d() {
|
||||
super.d();
|
||||
this.a = false;
|
||||
if (this.ae() && !this.B() && !this.isAngry()) {
|
||||
Entity entity = this.af();
|
||||
if (this.al() && !this.D() && !this.isAngry()) {
|
||||
Entity entity = this.am();
|
||||
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
|
@ -143,13 +146,13 @@ public class EntityWolf extends EntityAnimal {
|
|||
if (!this.isTamed() && itemstack.id == Item.BONE.id) {
|
||||
this.a = true;
|
||||
} 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.i = 0.0F;
|
||||
this.j = 0.0F;
|
||||
|
@ -157,8 +160,8 @@ public class EntityWolf extends EntityAnimal {
|
|||
}
|
||||
}
|
||||
|
||||
public void s_() {
|
||||
super.s_();
|
||||
public void w_() {
|
||||
super.w_();
|
||||
this.c = this.b;
|
||||
if (this.a) {
|
||||
this.b += (1.0F - this.b) * 0.4F;
|
||||
|
@ -167,17 +170,17 @@ public class EntityWolf extends EntityAnimal {
|
|||
}
|
||||
|
||||
if (this.a) {
|
||||
this.aV = 10;
|
||||
this.aZ = 10;
|
||||
}
|
||||
|
||||
if (this.an()) {
|
||||
if (this.ay()) {
|
||||
this.g = true;
|
||||
this.h = false;
|
||||
this.i = 0.0F;
|
||||
this.j = 0.0F;
|
||||
} else if ((this.g || this.h) && this.h) {
|
||||
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;
|
||||
|
@ -203,12 +206,12 @@ public class EntityWolf extends EntityAnimal {
|
|||
}
|
||||
}
|
||||
|
||||
public float t() {
|
||||
public float x() {
|
||||
return this.width * 0.8F;
|
||||
}
|
||||
|
||||
protected int u() {
|
||||
return this.isSitting() ? 20 : super.u();
|
||||
protected int q_() {
|
||||
return this.isSitting() ? 20 : super.q_();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -366,12 +369,12 @@ public class EntityWolf extends EntityAnimal {
|
|||
this.setTamed(true);
|
||||
this.setPathEntity((PathEntity) null);
|
||||
this.setSitting(true);
|
||||
this.health = 20;
|
||||
this.setHealth(20);
|
||||
this.setOwnerName(entityhuman.name);
|
||||
this.b(true);
|
||||
this.a(true);
|
||||
this.world.a(this, (byte) 7);
|
||||
} else {
|
||||
this.b(false);
|
||||
this.a(false);
|
||||
this.world.a(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
@ -382,9 +385,9 @@ public class EntityWolf extends EntityAnimal {
|
|||
if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) {
|
||||
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;
|
||||
this.c(itemfood.k(), RegainReason.EATING); // Craftbukkit
|
||||
this.d(itemfood.n(), RegainReason.EATING); // Craftbukkit
|
||||
if (itemstack.count <= 0) {
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
||||
}
|
||||
|
@ -396,7 +399,7 @@ public class EntityWolf extends EntityAnimal {
|
|||
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) {
|
||||
if (!this.world.isStatic) {
|
||||
this.setSitting(!this.isSitting());
|
||||
this.aS = false;
|
||||
this.aW = false;
|
||||
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";
|
||||
|
||||
if (!flag) {
|
||||
|
@ -423,7 +426,7 @@ public class EntityWolf extends EntityAnimal {
|
|||
}
|
||||
}
|
||||
|
||||
public int m() {
|
||||
public int p() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
|
@ -476,4 +479,8 @@ public class EntityWolf extends EntityAnimal {
|
|||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -5)));
|
||||
}
|
||||
}
|
||||
|
||||
protected EntityAnimal createChild(EntityAnimal entityanimal) {
|
||||
return new EntityWolf(this.world);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,21 @@ public class EntityZombie extends EntityMonster {
|
|||
public EntityZombie(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/zombie.png";
|
||||
this.aU = 0.5F;
|
||||
this.damage = 5;
|
||||
this.aY = 0.5F;
|
||||
this.damage = 4;
|
||||
}
|
||||
|
||||
public void s() {
|
||||
if (this.world.d() && !this.world.isStatic) {
|
||||
float f = this.a_(1.0F);
|
||||
public int getMaxHealth() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
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) {
|
||||
// CraftBukkit start
|
||||
|
@ -21,28 +29,32 @@ public class EntityZombie extends EntityMonster {
|
|||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.fireTicks = 300;
|
||||
this.j(8);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
super.s();
|
||||
super.d();
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
protected String c_() {
|
||||
return "mob.zombie";
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String m() {
|
||||
return "mob.zombiehurt";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String n() {
|
||||
return "mob.zombiedeath";
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
protected int e() {
|
||||
return Item.ROTTEN_FLESH.id;
|
||||
}
|
||||
|
||||
public EnchantmentDamage t() {
|
||||
return EnchantmentDamage.b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,20 +154,6 @@ public class Explosion {
|
|||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
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) {
|
||||
|
@ -209,13 +195,19 @@ public class Explosion {
|
|||
}
|
||||
// CraftBukkit end
|
||||
|
||||
for (int i = arraylist.size() - 1; i >= 0; --i) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(i);
|
||||
int j = chunkposition.x;
|
||||
int k = chunkposition.y;
|
||||
int l = chunkposition.z;
|
||||
int i1 = this.world.getTypeId(j, k, l);
|
||||
int i;
|
||||
ChunkPosition chunkposition;
|
||||
int j;
|
||||
int k;
|
||||
int l;
|
||||
int i1;
|
||||
|
||||
for (i = arraylist.size() - 1; i >= 0; --i) {
|
||||
chunkposition = (ChunkPosition) arraylist.get(i);
|
||||
j = chunkposition.x;
|
||||
k = chunkposition.y;
|
||||
l = chunkposition.z;
|
||||
i1 = this.world.getTypeId(j, k, l);
|
||||
if (flag) {
|
||||
double d0 = (double) ((float) j + 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
|
||||
if (i1 > 0 && i1 != Block.FIRE.id) {
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class FoodMetaData {
|
|||
}
|
||||
|
||||
public void a(ItemFood itemfood) {
|
||||
this.a(itemfood.k(), itemfood.l());
|
||||
this.a(itemfood.n(), itemfood.o());
|
||||
}
|
||||
|
||||
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;
|
||||
if (this.foodTickTimer >= 80) {
|
||||
// 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;
|
||||
}
|
||||
} else if (this.foodLevel <= 0) {
|
||||
++this.foodTickTimer;
|
||||
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
|
||||
EntityDamageEvent event = new EntityDamageEvent(entityhuman.getBukkitEntity(), EntityDamageEvent.DamageCause.STARVATION, 1);
|
||||
entityhuman.world.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -76,10 +76,10 @@ public class FoodMetaData {
|
|||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound.hasKey("foodLevel")) {
|
||||
this.foodLevel = nbttagcompound.e("foodLevel");
|
||||
this.foodTickTimer = nbttagcompound.e("foodTickTimer");
|
||||
this.saturationLevel = nbttagcompound.g("foodSaturationLevel");
|
||||
this.exhaustionLevel = nbttagcompound.g("foodExhaustionLevel");
|
||||
this.foodLevel = nbttagcompound.f("foodLevel");
|
||||
this.foodTickTimer = nbttagcompound.f("foodTickTimer");
|
||||
this.saturationLevel = nbttagcompound.h("foodSaturationLevel");
|
||||
this.exhaustionLevel = nbttagcompound.h("foodExhaustionLevel");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ public interface IInventory {
|
|||
|
||||
boolean a(EntityHuman entityhuman);
|
||||
|
||||
void e();
|
||||
void f();
|
||||
|
||||
void t_();
|
||||
void g();
|
||||
|
||||
public abstract ItemStack[] getContents(); // CraftBukkit
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class InventoryCraftResult implements IInventory {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void e() {}
|
||||
public void f() {}
|
||||
|
||||
public void t_() {}
|
||||
public void g() {}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class InventoryCrafting implements IInventory {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void e() {}
|
||||
public void f() {}
|
||||
|
||||
public void t_() {}
|
||||
public void g() {}
|
||||
}
|
||||
|
|
|
@ -67,13 +67,13 @@ public class InventoryLargeChest implements IInventory {
|
|||
return this.b.a(entityhuman) && this.c.a(entityhuman);
|
||||
}
|
||||
|
||||
public void e() {
|
||||
this.b.e();
|
||||
this.c.e();
|
||||
public void f() {
|
||||
this.b.f();
|
||||
this.c.f();
|
||||
}
|
||||
|
||||
public void t_() {
|
||||
this.b.t_();
|
||||
this.c.t_();
|
||||
public void g() {
|
||||
this.b.g();
|
||||
this.c.g();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class InventoryPlayer implements IInventory {
|
|||
return this.itemInHandIndex < 9 && this.itemInHandIndex >= 0 ? this.items[this.itemInHandIndex] : null;
|
||||
}
|
||||
|
||||
public static int g() {
|
||||
public static int h() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
|
@ -80,41 +80,55 @@ public class InventoryPlayer implements IInventory {
|
|||
private int e(ItemStack itemstack) {
|
||||
int i = itemstack.id;
|
||||
int j = itemstack.count;
|
||||
int k = this.firstPartial(itemstack);
|
||||
int k;
|
||||
|
||||
if (k < 0) {
|
||||
if (itemstack.getMaxStackSize() == 1) {
|
||||
k = this.m();
|
||||
}
|
||||
|
||||
if (k < 0) {
|
||||
return j;
|
||||
} else {
|
||||
if (this.items[k] == null) {
|
||||
this.items[k] = new ItemStack(i, 0, itemstack.getData());
|
||||
}
|
||||
|
||||
int l = j;
|
||||
|
||||
if (j > this.items[k].getMaxStackSize() - this.items[k].count) {
|
||||
l = this.items[k].getMaxStackSize() - this.items[k].count;
|
||||
}
|
||||
|
||||
if (l > this.getMaxStackSize() - this.items[k].count) {
|
||||
l = this.getMaxStackSize() - this.items[k].count;
|
||||
}
|
||||
|
||||
if (l == 0) {
|
||||
if (k < 0) {
|
||||
return j;
|
||||
} else {
|
||||
j -= l;
|
||||
this.items[k].count += l;
|
||||
this.items[k].b = 5;
|
||||
if (this.items[k] == null) {
|
||||
this.items[k] = ItemStack.b(itemstack);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
k = this.firstPartial(itemstack);
|
||||
if (k < 0) {
|
||||
k = this.m();
|
||||
}
|
||||
|
||||
if (k < 0) {
|
||||
return j;
|
||||
} else {
|
||||
if (this.items[k] == null) {
|
||||
this.items[k] = new ItemStack(i, 0, itemstack.getData());
|
||||
}
|
||||
|
||||
int l = j;
|
||||
|
||||
if (j > this.items[k].getMaxStackSize() - this.items[k].count) {
|
||||
l = this.items[k].getMaxStackSize() - this.items[k].count;
|
||||
}
|
||||
|
||||
if (l > this.getMaxStackSize() - this.items[k].count) {
|
||||
l = this.getMaxStackSize() - this.items[k].count;
|
||||
}
|
||||
|
||||
if (l == 0) {
|
||||
return j;
|
||||
} else {
|
||||
j -= l;
|
||||
this.items[k].count += l;
|
||||
this.items[k].b = 5;
|
||||
return j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void h() {
|
||||
public void i() {
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
if (this.items[i] != null) {
|
||||
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;
|
||||
itemstack.count = 0;
|
||||
return true;
|
||||
} else if (this.d.abilities.canInstantlyBuild) {
|
||||
itemstack.count = 0;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -161,7 +178,12 @@ public class InventoryPlayer implements IInventory {
|
|||
itemstack.count = this.e(itemstack);
|
||||
} while (itemstack.count > 0 && itemstack.count < i);
|
||||
|
||||
return itemstack.count < i;
|
||||
if (itemstack.count == i && this.d.abilities.canInstantlyBuild) {
|
||||
itemstack.count = 0;
|
||||
return true;
|
||||
} else {
|
||||
return itemstack.count < i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,9 +265,9 @@ public class InventoryPlayer implements IInventory {
|
|||
this.items = new ItemStack[36];
|
||||
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);
|
||||
int j = nbttagcompound.c("Slot") & 255;
|
||||
int j = nbttagcompound.d("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.a(nbttagcompound);
|
||||
|
||||
if (itemstack != null) {
|
||||
|
@ -299,33 +321,26 @@ public class InventoryPlayer implements IInventory {
|
|||
}
|
||||
}
|
||||
|
||||
public int i() {
|
||||
public int j() {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
|
||||
for (int l = 0; l < this.armor.length; ++l) {
|
||||
if (this.armor[l] != null && this.armor[l].getItem() instanceof ItemArmor) {
|
||||
int i1 = this.armor[l].i();
|
||||
int j1 = this.armor[l].g();
|
||||
int k1 = i1 - j1;
|
||||
for (int j = 0; j < this.armor.length; ++j) {
|
||||
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
|
||||
int k = ((ItemArmor) this.armor[j].getItem()).b;
|
||||
|
||||
j += k1;
|
||||
k += i1;
|
||||
int l1 = ((ItemArmor) this.armor[l].getItem()).bu;
|
||||
|
||||
i += l1;
|
||||
i += k;
|
||||
}
|
||||
}
|
||||
|
||||
if (k == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return (i - 1) * j / k + 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
i /= 4;
|
||||
if (i < 1) {
|
||||
i = 1;
|
||||
}
|
||||
|
||||
for (int j = 0; j < this.armor.length; ++j) {
|
||||
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
|
||||
this.armor[j].damage(i, this.d);
|
||||
|
@ -337,7 +352,7 @@ public class InventoryPlayer implements IInventory {
|
|||
}
|
||||
}
|
||||
|
||||
public void j() {
|
||||
public void k() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < this.items.length; ++i) {
|
||||
|
@ -369,7 +384,7 @@ public class InventoryPlayer implements IInventory {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -390,7 +405,19 @@ public class InventoryPlayer implements IInventory {
|
|||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ItemBed extends Item {
|
|||
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)) {
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
|
||||
|
@ -55,7 +55,10 @@ public class ItemBed extends Item {
|
|||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8);
|
||||
if (world.getTypeId(i, j, k) == blockbed.id) {
|
||||
world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8);
|
||||
}
|
||||
|
||||
--itemstack.count;
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ItemBlock extends Item {
|
|||
public ItemBlock(int i) {
|
||||
super(i);
|
||||
this.id = i + 256;
|
||||
this.b(Block.byId[i + 256].a(2));
|
||||
this.d(Block.byId[i + 256].a(2));
|
||||
}
|
||||
|
||||
public int a() {
|
||||
|
@ -54,87 +54,84 @@ public class ItemBlock extends Item {
|
|||
|
||||
if (itemstack.count == 0) {
|
||||
return false;
|
||||
} else if (!entityhuman.c(i, j, k)) {
|
||||
} else if (!entityhuman.d(i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
world.getClass();
|
||||
if (j == 128 - 1 && Block.byId[this.id].material.isBuildable()) {
|
||||
return false;
|
||||
} else if (world.a(this.id, i, j, k, false, l)) {
|
||||
Block block = Block.byId[this.id];
|
||||
} else if (j == world.height - 1 && Block.byId[this.id].material.isBuildable()) {
|
||||
return false;
|
||||
} else if (world.a(this.id, i, j, k, false, l)) {
|
||||
Block block = Block.byId[this.id];
|
||||
|
||||
// CraftBukkit start - This executes the placement of the block
|
||||
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||
// CraftBukkit start - This executes the placement of the block
|
||||
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||
|
||||
// There are like 30 combinations you can mix and match steps and double steps
|
||||
// of different materials, so there are a lot of different cases of what
|
||||
// would happen if you place x step onto another y step, so let's just keep
|
||||
// track of the entire state
|
||||
CraftBlockState blockStateBelow = null;
|
||||
// Toggles whether the normal or the block below is used for the place event
|
||||
boolean eventUseBlockBelow = false;
|
||||
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id)
|
||||
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
|
||||
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
|
||||
// Step is placed on step, forms a doublestep replacing the original step, so we need the lower block
|
||||
eventUseBlockBelow = itemstack.id == Block.STEP.id && blockStateBelow.getTypeId() == Block.STEP.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
|
||||
*
|
||||
* This replaces world.setTypeIdAndData(IIIII), we're doing this because we need to
|
||||
* hook between the 'placement' and the informing to 'world' so we can
|
||||
* sanely undo this.
|
||||
*
|
||||
* Whenever the call to 'world.setTypeIdAndData' changes we need to figure out again what to
|
||||
* replace this with.
|
||||
*/
|
||||
if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block
|
||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, eventUseBlockBelow ? blockStateBelow : replacedBlockState, clickedX, clickedY, clickedZ, block);
|
||||
|
||||
if (event.isCancelled() || !event.canBuild()) {
|
||||
if (blockStateBelow != null) { // Used for steps
|
||||
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
|
||||
world.setTypeIdAndData(i, j - 1, k, blockStateBelow.getTypeId(), blockStateBelow.getRawData());
|
||||
|
||||
} else {
|
||||
|
||||
if (this.id == Block.ICE.id) {
|
||||
// Ice will explode if we set straight to 0
|
||||
world.setTypeId(i, j, k, 20);
|
||||
}
|
||||
|
||||
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
world.update(i, j, k, this.id); // <-- world.setTypeIdAndData does this on success (tell the world)
|
||||
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
Block.byId[this.id].postPlace(world, i, j, k, l);
|
||||
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
|
||||
--itemstack.count;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
// There are like 30 combinations you can mix and match steps and double steps
|
||||
// of different materials, so there are a lot of different cases of what
|
||||
// would happen if you place x step onto another y step, so let's just keep
|
||||
// track of the entire state
|
||||
CraftBlockState blockStateBelow = null;
|
||||
// Toggles whether the normal or the block below is used for the place event
|
||||
boolean eventUseBlockBelow = false;
|
||||
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id)
|
||||
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
|
||||
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
|
||||
// Step is placed on step, forms a doublestep replacing the original step, so we need the lower block
|
||||
eventUseBlockBelow = itemstack.id == Block.STEP.id && blockStateBelow.getTypeId() == Block.STEP.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
|
||||
*
|
||||
* This replaces world.setTypeIdAndData(IIIII), we're doing this because we need to
|
||||
* hook between the 'placement' and the informing to 'world' so we can
|
||||
* sanely undo this.
|
||||
*
|
||||
* Whenever the call to 'world.setTypeIdAndData' changes we need to figure out again what to
|
||||
* replace this with.
|
||||
*/
|
||||
if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block
|
||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, eventUseBlockBelow ? blockStateBelow : replacedBlockState, clickedX, clickedY, clickedZ, block);
|
||||
|
||||
if (event.isCancelled() || !event.canBuild()) {
|
||||
if (blockStateBelow != null) { // Used for steps
|
||||
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
|
||||
world.setTypeIdAndData(i, j - 1, k, blockStateBelow.getTypeId(), blockStateBelow.getRawData());
|
||||
|
||||
} else {
|
||||
|
||||
if (this.id == Block.ICE.id) {
|
||||
// Ice will explode if we set straight to 0
|
||||
world.setTypeId(i, j, k, 20);
|
||||
}
|
||||
|
||||
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
world.update(i, j, k, this.id); // <-- world.setTypeIdAndData does this on success (tell the world)
|
||||
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
Block.byId[this.id].postPlace(world, i, j, k, l);
|
||||
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
|
||||
--itemstack.count;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String a(ItemStack itemstack) {
|
||||
return Block.byId[this.id].l();
|
||||
return Block.byId[this.id].n();
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return Block.byId[this.id].l();
|
||||
return Block.byId[this.id].n();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.Action;
|
||||
|
@ -34,31 +36,55 @@ public class ItemBoat extends Item {
|
|||
if (movingobjectposition == null) {
|
||||
return itemstack;
|
||||
} else {
|
||||
if (movingobjectposition.type == EnumMovingObjectType.TILE) {
|
||||
int i = movingobjectposition.b;
|
||||
int j = movingobjectposition.c;
|
||||
int k = movingobjectposition.d;
|
||||
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));
|
||||
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start - Boat placement
|
||||
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, movingobjectposition.face, itemstack);
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
if (entity.e_()) {
|
||||
float f10 = entity.j_();
|
||||
AxisAlignedBB axisalignedbb = entity.boundingBox.b((double) f10, (double) f10, (double) f10);
|
||||
|
||||
if (axisalignedbb.a(vec3d)) {
|
||||
flag = true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.getTypeId(i, j, k) == Block.SNOW.id) {
|
||||
--j;
|
||||
}
|
||||
|
||||
world.addEntity(new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.0F), (double) ((float) k + 0.5F)));
|
||||
}
|
||||
|
||||
--itemstack.count;
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
if (flag) {
|
||||
return itemstack;
|
||||
} else {
|
||||
if (movingobjectposition.type == EnumMovingObjectType.TILE) {
|
||||
int j = movingobjectposition.b;
|
||||
int k = movingobjectposition.c;
|
||||
int l = movingobjectposition.d;
|
||||
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start - Boat placement
|
||||
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, j, k, l, movingobjectposition.face, itemstack);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.getTypeId(j, k, l) == Block.SNOW.id) {
|
||||
--k;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,21 +20,11 @@ public class ItemBucket extends Item {
|
|||
|
||||
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
||||
float f = 1.0F;
|
||||
float f1 = entityhuman.lastPitch + (entityhuman.pitch - entityhuman.lastPitch) * f;
|
||||
float f2 = entityhuman.lastYaw + (entityhuman.yaw - entityhuman.lastYaw) * f;
|
||||
double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
|
||||
double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
|
||||
double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
|
||||
Vec3D vec3d = Vec3D.create(d0, d1, d2);
|
||||
float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
|
||||
float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
double d3 = 5.0D;
|
||||
Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
MovingObjectPosition movingobjectposition = world.rayTrace(vec3d, vec3d1, this.a == 0);
|
||||
boolean flag = this.a == 0;
|
||||
MovingObjectPosition movingobjectposition = this.a(world, entityhuman, flag);
|
||||
|
||||
if (movingobjectposition == null) {
|
||||
return itemstack;
|
||||
|
@ -49,7 +39,7 @@ public class ItemBucket extends Item {
|
|||
}
|
||||
|
||||
if (this.a == 0) {
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
@ -61,6 +51,10 @@ public class ItemBucket extends Item {
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
if (entityhuman.abilities.canInstantlyBuild) {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
||||
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
||||
// CraftBukkit end
|
||||
|
@ -77,6 +71,10 @@ public class ItemBucket extends Item {
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
if (entityhuman.abilities.canInstantlyBuild) {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
|
||||
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();
|
||||
// CraftBukkit end
|
||||
|
@ -125,7 +123,7 @@ public class ItemBucket extends Item {
|
|||
++i;
|
||||
}
|
||||
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ItemDoor extends Item {
|
|||
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)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -39,9 +39,8 @@ public class ItemDoor extends Item {
|
|||
if (a(world, i, j, k, i1, block, entityhuman)) {
|
||||
--itemstack.count;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
// CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -6,16 +6,16 @@ public class ItemFishingRod extends Item {
|
|||
|
||||
public ItemFishingRod(int i) {
|
||||
super(i);
|
||||
this.d(64);
|
||||
this.c(1);
|
||||
this.f(64);
|
||||
this.e(1);
|
||||
}
|
||||
|
||||
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
||||
if (entityhuman.hookedFish != null) {
|
||||
int i = entityhuman.hookedFish.i();
|
||||
int i = entityhuman.hookedFish.j();
|
||||
|
||||
itemstack.damage(i, entityhuman);
|
||||
entityhuman.v();
|
||||
entityhuman.r_();
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
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;
|
||||
}
|
||||
// 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) {
|
||||
world.addEntity(new EntityFishingHook(world, entityhuman));
|
||||
}
|
||||
|
||||
entityhuman.v();
|
||||
entityhuman.r_();
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
|
|
@ -13,7 +13,7 @@ public class ItemFlintAndSteel extends Item {
|
|||
public ItemFlintAndSteel(int i) {
|
||||
super(i);
|
||||
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) {
|
||||
|
@ -43,7 +43,7 @@ public class ItemFlintAndSteel extends Item {
|
|||
++i;
|
||||
}
|
||||
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
@ -64,7 +64,7 @@ public class ItemFlintAndSteel extends Item {
|
|||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||
// CraftBukkit end
|
||||
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, 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);
|
||||
|
||||
// CraftBukkit start
|
||||
|
|
|
@ -5,21 +5,21 @@ import org.bukkit.event.entity.FoodLevelChangeEvent; // CraftBukkit
|
|||
public class ItemFood extends Item {
|
||||
|
||||
public final int a;
|
||||
private final int bt;
|
||||
private final float bu;
|
||||
private final boolean bv;
|
||||
private boolean bw;
|
||||
private int bx;
|
||||
private int by;
|
||||
private int bz;
|
||||
private float bA;
|
||||
private final int b;
|
||||
private final float bR;
|
||||
private final boolean bS;
|
||||
private boolean bT;
|
||||
private int bU;
|
||||
private int bV;
|
||||
private int bW;
|
||||
private float bX;
|
||||
|
||||
public ItemFood(int i, int j, float f, boolean flag) {
|
||||
super(i);
|
||||
this.a = 32;
|
||||
this.bt = j;
|
||||
this.bv = flag;
|
||||
this.bu = f;
|
||||
this.b = j;
|
||||
this.bS = flag;
|
||||
this.bR = f;
|
||||
}
|
||||
|
||||
public ItemFood(int i, int j, boolean flag) {
|
||||
|
@ -31,16 +31,16 @@ public class ItemFood extends Item {
|
|||
// CraftBukkit start
|
||||
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);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.l());
|
||||
entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.o());
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (!world.isStatic && this.bx > 0 && world.random.nextFloat() < this.bA) {
|
||||
entityhuman.addEffect(new MobEffect(this.bx, this.by * 20, this.bz));
|
||||
if (!world.isStatic && this.bU > 0 && world.random.nextFloat() < this.bX) {
|
||||
entityhuman.addEffect(new MobEffect(this.bU, this.bV * 20, this.bW));
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -50,40 +50,40 @@ public class ItemFood extends Item {
|
|||
return 32;
|
||||
}
|
||||
|
||||
public EnumAnimation b(ItemStack itemstack) {
|
||||
public EnumAnimation d(ItemStack itemstack) {
|
||||
return EnumAnimation.b;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public int k() {
|
||||
return this.bt;
|
||||
public int n() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public float l() {
|
||||
return this.bu;
|
||||
public float o() {
|
||||
return this.bR;
|
||||
}
|
||||
|
||||
public boolean m() {
|
||||
return this.bv;
|
||||
public boolean p() {
|
||||
return this.bS;
|
||||
}
|
||||
|
||||
public ItemFood a(int i, int j, int k, float f) {
|
||||
this.bx = i;
|
||||
this.by = j;
|
||||
this.bz = k;
|
||||
this.bA = f;
|
||||
this.bU = i;
|
||||
this.bV = j;
|
||||
this.bW = k;
|
||||
this.bX = f;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemFood n() {
|
||||
this.bw = true;
|
||||
public ItemFood q() {
|
||||
this.bT = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ public class ItemHoe extends Item {
|
|||
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
|
||||
super(i);
|
||||
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) {
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
|
|
@ -215,17 +215,18 @@ public class ItemInWorldManager {
|
|||
if (this.b()) {
|
||||
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
|
||||
} else {
|
||||
ItemStack itemstack = this.player.K();
|
||||
ItemStack itemstack = this.player.P();
|
||||
boolean flag1 = this.player.b(Block.byId[l]);
|
||||
|
||||
if (itemstack != null) {
|
||||
itemstack.a(l, i, j, k, this.player);
|
||||
if (itemstack.count == 0) {
|
||||
itemstack.a(this.player);
|
||||
this.player.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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (BlockMinecartTrack.c(i1)) {
|
||||
if (BlockMinecartTrack.d(i1)) {
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start - Minecarts
|
||||
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);
|
||||
|
|
|
@ -32,12 +32,12 @@ public class ItemPainting extends Item {
|
|||
b0 = 3;
|
||||
}
|
||||
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
EntityPainting entitypainting = new EntityPainting(world, i, j, k, b0);
|
||||
|
||||
if (entitypainting.i()) {
|
||||
if (entitypainting.j()) {
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ItemRedstone extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ItemReed extends Item {
|
|||
}
|
||||
}
|
||||
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return false;
|
||||
} else if (itemstack.count == 0) {
|
||||
return false;
|
||||
|
|
|
@ -9,19 +9,21 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||
public class ItemSeeds extends Item {
|
||||
|
||||
private int id;
|
||||
private int b;
|
||||
|
||||
public ItemSeeds(int i, int j) {
|
||||
public ItemSeeds(int i, int j, int k) {
|
||||
super(i);
|
||||
this.id = j;
|
||||
this.b = k;
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
|
||||
if (l != 1) {
|
||||
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);
|
||||
|
||||
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
|
||||
|
||||
world.setTypeId(i, j + 1, k, this.id);
|
||||
|
|
|
@ -41,7 +41,7 @@ public class ItemSign extends Item {
|
|||
++i;
|
||||
}
|
||||
|
||||
if (!entityhuman.c(i, j, k)) {
|
||||
if (!entityhuman.d(i, j, k)) {
|
||||
return false;
|
||||
} else if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
|
||||
return false;
|
||||
|
|
|
@ -5,6 +5,7 @@ public final class ItemStack {
|
|||
public int count;
|
||||
public int b;
|
||||
public int id;
|
||||
public NBTTagCompound tag;
|
||||
private int damage;
|
||||
|
||||
public ItemStack(Block block) {
|
||||
|
@ -50,8 +51,14 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
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;
|
||||
return new ItemStack(this.id, i, this.damage);
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
|
@ -84,13 +91,20 @@ public final class ItemStack {
|
|||
nbttagcompound.a("id", (short) this.id);
|
||||
nbttagcompound.a("Count", (byte) this.count);
|
||||
nbttagcompound.a("Damage", (short) this.damage);
|
||||
if (this.tag != null) {
|
||||
nbttagcompound.a("tag", (NBTBase) this.tag);
|
||||
}
|
||||
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public void c(NBTTagCompound nbttagcompound) {
|
||||
this.id = nbttagcompound.d("id");
|
||||
this.count = nbttagcompound.c("Count");
|
||||
this.damage = nbttagcompound.d("Damage");
|
||||
this.id = nbttagcompound.e("id");
|
||||
this.count = nbttagcompound.d("Count");
|
||||
this.damage = nbttagcompound.e("Damage");
|
||||
if (nbttagcompound.hasKey("tag")) {
|
||||
this.tag = nbttagcompound.l("tag");
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
|
@ -106,7 +120,7 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
public boolean usesData() {
|
||||
return Item.byId[this.id].d();
|
||||
return Item.byId[this.id].e();
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
|
@ -129,12 +143,21 @@ public final class ItemStack {
|
|||
return Item.byId[this.id].getMaxDurability();
|
||||
}
|
||||
|
||||
public void damage(int i, Entity entity) {
|
||||
public void damage(int i, EntityLiving entityliving) {
|
||||
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;
|
||||
if (this.damage > this.i()) {
|
||||
if (entity instanceof EntityHuman) {
|
||||
((EntityHuman) entity).a(StatisticList.F[this.id], 1);
|
||||
entityliving.c(this);
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
((EntityHuman) entityliving).a(StatisticList.F[this.id], 1);
|
||||
}
|
||||
|
||||
--this.count;
|
||||
|
@ -178,7 +201,16 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -186,7 +218,7 @@ public final class 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) {
|
||||
|
@ -227,10 +259,55 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
public EnumAnimation m() {
|
||||
return this.getItem().b(this);
|
||||
return this.getItem().d(this);
|
||||
}
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, int 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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||
|
||||
protected ItemWorldMap(int i) {
|
||||
super(i);
|
||||
this.c(1);
|
||||
this.e(1);
|
||||
}
|
||||
|
||||
public WorldMap a(ItemStack itemstack, World world) {
|
||||
|
@ -21,8 +21,8 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||
String s = "map_" + itemstack.getData();
|
||||
|
||||
worldmap = new WorldMap(s);
|
||||
worldmap.b = world.p().c();
|
||||
worldmap.c = world.p().e();
|
||||
worldmap.b = world.r().c();
|
||||
worldmap.c = world.r().e();
|
||||
worldmap.e = 3;
|
||||
worldmap.map = (byte) world.worldProvider.dimension;
|
||||
worldmap.a();
|
||||
|
@ -105,18 +105,17 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||
j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
|
||||
if (j5 == 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (!flag1) {
|
||||
--k4;
|
||||
if (k4 <= 0) break; // CraftBukkit
|
||||
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;
|
||||
boolean flag2 = false;
|
||||
|
||||
|
@ -163,7 +162,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||
|
||||
i5 = 0;
|
||||
if (j4 > 0) {
|
||||
MaterialMapColor materialmapcolor = Block.byId[j4].material.D;
|
||||
MaterialMapColor materialmapcolor = Block.byId[j4].material.E;
|
||||
|
||||
if (materialmapcolor == MaterialMapColor.n) {
|
||||
d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
|
||||
|
|
|
@ -32,28 +32,34 @@ import org.bukkit.generator.ChunkGenerator;
|
|||
import org.bukkit.plugin.PluginLoadOrder;
|
||||
// CraftBukkit end
|
||||
|
||||
public class MinecraftServer implements Runnable, ICommandListener {
|
||||
public class MinecraftServer implements Runnable, ICommandListener, IMinecraftServer {
|
||||
|
||||
public static Logger log = Logger.getLogger("Minecraft");
|
||||
public static HashMap trackerList = new HashMap();
|
||||
private String s;
|
||||
private int t;
|
||||
public NetworkListenThread networkListenThread;
|
||||
public PropertyManager propertyManager;
|
||||
// public WorldServer[] worldServer; // CraftBukkit - removed!
|
||||
public long[] f = new long[100];
|
||||
public long[][] g;
|
||||
public ServerConfigurationManager serverConfigurationManager;
|
||||
public ConsoleCommandHandler consoleCommandHandler; // CraftBukkit - made public
|
||||
private boolean isRunning = true;
|
||||
public boolean isStopped = false;
|
||||
int ticks = 0;
|
||||
public String i;
|
||||
public int j;
|
||||
private List s = new ArrayList();
|
||||
private List t = Collections.synchronizedList(new ArrayList());
|
||||
// public EntityTracker[] tracker = new EntityTracker[2]; // CraftBukkit - removed!
|
||||
public String k;
|
||||
public int l;
|
||||
private List w = new ArrayList();
|
||||
private List x = Collections.synchronizedList(new ArrayList());
|
||||
// public EntityTracker[] tracker = new EntityTracker[3]; // CraftBukkit - removed!
|
||||
public boolean onlineMode;
|
||||
public boolean spawnAnimals;
|
||||
public boolean pvpMode;
|
||||
public boolean allowFlight;
|
||||
public String p;
|
||||
public String r;
|
||||
private RemoteStatusListener y;
|
||||
private RemoteControlListener z;
|
||||
|
||||
// CraftBukkit start
|
||||
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));
|
||||
// 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) {
|
||||
log.warning("**** NOT ENOUGH RAM!");
|
||||
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");
|
||||
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.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
|
||||
this.pvpMode = this.propertyManager.getBoolean("pvp", true);
|
||||
this.allowFlight = this.propertyManager.getBoolean("allow-flight", false);
|
||||
this.p = this.propertyManager.getString("motd", "A Minecraft Server");
|
||||
this.p.replace('\u00a7', '$');
|
||||
this.r = this.propertyManager.getString("motd", "A Minecraft Server");
|
||||
this.r.replace('\u00a7', '$');
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
if (s.length() > 0) {
|
||||
inetaddress = InetAddress.getByName(s);
|
||||
if (this.s.length() > 0) {
|
||||
inetaddress = InetAddress.getByName(this.s);
|
||||
}
|
||||
|
||||
int i = this.propertyManager.getInt("server-port", 25565);
|
||||
|
||||
log.info("Starting Minecraft server on " + (s.length() == 0 ? "*" : s) + ":" + i);
|
||||
this.t = this.propertyManager.getInt("server-port", 25565);
|
||||
log.info("Starting Minecraft server on " + (this.s.length() == 0 ? "*" : this.s) + ":" + this.t);
|
||||
|
||||
try {
|
||||
this.networkListenThread = new NetworkListenThread(this, inetaddress, i);
|
||||
this.networkListenThread = new NetworkListenThread(this, inetaddress, this.t);
|
||||
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
||||
log.warning("**** FAILED TO BIND TO PORT!");
|
||||
log.log(Level.WARNING, "The exception was: " + ioexception.toString());
|
||||
|
@ -135,33 +139,53 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
|
||||
this.serverConfigurationManager = new ServerConfigurationManager(this);
|
||||
// CraftBukkit - removed trackers
|
||||
long j = System.nanoTime();
|
||||
String s1 = this.propertyManager.getString("level-name", "world");
|
||||
String s2 = this.propertyManager.getString("level-seed", "");
|
||||
long k = (new Random()).nextLong();
|
||||
long i = System.nanoTime();
|
||||
String s = this.propertyManager.getString("level-name", "world");
|
||||
String s1 = this.propertyManager.getString("level-seed", "");
|
||||
long j = (new Random()).nextLong();
|
||||
|
||||
if (s2.length() > 0) {
|
||||
if (s1.length() > 0) {
|
||||
try {
|
||||
k = Long.parseLong(s2);
|
||||
long k = Long.parseLong(s1);
|
||||
|
||||
if (k != 0L) {
|
||||
j = k;
|
||||
}
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
k = (long) s2.hashCode();
|
||||
j = (long) s1.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
log.info("Preparing level \"" + s1 + "\"");
|
||||
this.a(new WorldLoaderServer(new File(".")), s1, k);
|
||||
log.info("Preparing level \"" + s + "\"");
|
||||
this.a(new WorldLoaderServer(new File(".")), s, j);
|
||||
|
||||
// CraftBukkit start
|
||||
long elapsed = System.nanoTime() - j;
|
||||
long elapsed = System.nanoTime() - i;
|
||||
String time = String.format("%.3fs", elapsed / 10000000000.0D);
|
||||
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")) {
|
||||
log.info("'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you.");
|
||||
this.server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16));
|
||||
this.propertyManager.properties.remove("spawn-protection");
|
||||
this.propertyManager.savePropertiesFile();
|
||||
}
|
||||
// CratBukkit end
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -171,21 +195,36 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
convertable.convert(s, new ConvertProgressUpdater(this));
|
||||
}
|
||||
|
||||
// CraftBukkit - removed world array
|
||||
// CraftBukkit - removed world and ticktime arrays
|
||||
int j = this.propertyManager.getInt("gamemode", 0);
|
||||
|
||||
j = WorldSettings.a(j);
|
||||
log.info("Default game type: " + j);
|
||||
|
||||
// CraftBukkit start (+ removed worldsettings and servernbtmanager)
|
||||
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;
|
||||
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 name = (dimension == 0) ? s : s + "_" + worldType;
|
||||
|
||||
ChunkGenerator gen = this.server.getGenerator(name);
|
||||
WorldSettings settings = new WorldSettings(i, j, true);
|
||||
WorldSettings settings = new WorldSettings(i, j, true, false);
|
||||
|
||||
if (k == 0) {
|
||||
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.difficulty = this.propertyManager.getInt("difficulty", 1);
|
||||
world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
|
||||
world.p().setGameType(j);
|
||||
world.r().setGameType(j);
|
||||
this.worlds.add(world);
|
||||
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 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;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
this.e();
|
||||
this.t();
|
||||
}
|
||||
|
||||
private void a(String s, int i) {
|
||||
this.i = s;
|
||||
this.j = i;
|
||||
private void b(String s, int i) {
|
||||
this.k = s;
|
||||
this.l = i;
|
||||
log.info(s + ": " + i + "%");
|
||||
}
|
||||
|
||||
private void e() {
|
||||
this.i = null;
|
||||
this.j = 0;
|
||||
private void t() {
|
||||
this.k = null;
|
||||
this.l = 0;
|
||||
|
||||
this.server.enablePlugins(PluginLoadOrder.POSTWORLD); // CraftBukkit
|
||||
}
|
||||
|
@ -365,13 +404,13 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
j += l;
|
||||
i = k;
|
||||
if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
|
||||
this.h();
|
||||
this.w();
|
||||
j = 0L;
|
||||
} else {
|
||||
while (j > 50L) {
|
||||
MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
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();
|
||||
Iterator iterator = trackerList.keySet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
int i = ((Integer) trackerList.get(s)).intValue();
|
||||
int j = ((Integer) trackerList.get(s)).intValue();
|
||||
|
||||
if (i > 0) {
|
||||
trackerList.put(s, Integer.valueOf(i - 1));
|
||||
if (j > 0) {
|
||||
trackerList.put(s, Integer.valueOf(j - 1));
|
||||
} else {
|
||||
arraylist.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
int j;
|
||||
int k;
|
||||
|
||||
for (j = 0; j < arraylist.size(); ++j) {
|
||||
trackerList.remove(arraylist.get(j));
|
||||
for (k = 0; k < arraylist.size(); ++k) {
|
||||
trackerList.remove(arraylist.get(k));
|
||||
}
|
||||
|
||||
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.
|
||||
if (this.ticks % 20 == 0) {
|
||||
for (int i = 0; i < this.serverConfigurationManager.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(i);
|
||||
for ( k = 0; k < this.serverConfigurationManager.players.size(); ++k) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(k);
|
||||
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < this.worlds.size(); ++j) {
|
||||
// if (j == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
|
||||
WorldServer worldserver = this.worlds.get(j);
|
||||
for (k = 0; k < this.worlds.size(); ++k) {
|
||||
long l = System.nanoTime();
|
||||
// if (k == 0 || this.propertyManager.getBoolean("allow-nether", true)) {
|
||||
WorldServer worldserver = this.worlds.get(k);
|
||||
|
||||
/* Drop global timeupdates
|
||||
if (this.ticks % 20 == 0) {
|
||||
|
@ -460,25 +501,28 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
|
||||
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
|
||||
|
||||
this.networkListenThread.a();
|
||||
this.serverConfigurationManager.b();
|
||||
|
||||
// CraftBukkit start
|
||||
for (j = 0; j < this.worlds.size(); ++j) {
|
||||
this.worlds.get(j).tracker.updatePlayers();
|
||||
for (k = 0; k < this.worlds.size(); ++k) {
|
||||
this.worlds.get(k).tracker.updatePlayers();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
for (j = 0; j < this.s.size(); ++j) {
|
||||
((IUpdatePlayerListBox) this.s.get(j)).a();
|
||||
for (k = 0; k < this.w.size(); ++k) {
|
||||
((IUpdatePlayerListBox) this.w.get(k)).a();
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -486,15 +530,17 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
} catch (Exception 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) {
|
||||
this.t.add(new ServerCommand(s, icommandlistener));
|
||||
this.x.add(new ServerCommand(s, icommandlistener));
|
||||
}
|
||||
|
||||
public void b() {
|
||||
while (this.t.size() > 0) {
|
||||
ServerCommand servercommand = (ServerCommand) this.t.remove(0);
|
||||
while (this.x.size() > 0) {
|
||||
ServerCommand servercommand = (ServerCommand) this.x.remove(0);
|
||||
|
||||
// CraftBukkit start - ServerCommand for preprocessing
|
||||
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
|
||||
|
@ -508,7 +554,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
}
|
||||
|
||||
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[])
|
||||
|
@ -533,7 +579,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
log.info(s);
|
||||
}
|
||||
|
||||
public void c(String s) {
|
||||
public void warning(String s) {
|
||||
log.warning(s);
|
||||
}
|
||||
|
||||
|
@ -557,6 +603,94 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||
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) {
|
||||
return minecraftserver.isRunning;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue