Update CraftBukkit to Minecraft 1.3.1
Dieser Commit ist enthalten in:
Ursprung
08e2923bd4
Commit
a43d621c01
6
pom.xml
6
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.2.5-R5.1-SNAPSHOT</version>
|
||||
<version>1.3.1-R0.1-SNAPSHOT</version>
|
||||
<name>CraftBukkit</name>
|
||||
<url>http://www.bukkit.org</url>
|
||||
|
||||
@ -51,14 +51,14 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.2.5-R5.1-SNAPSHOT</version>
|
||||
<version>1.3.1-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.2.5</version>
|
||||
<version>1.3.1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -1,10 +1,11 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Block {
|
||||
|
||||
private CreativeModeTab creativeTab;
|
||||
public static final StepSound d = new StepSound("stone", 1.0F, 1.0F);
|
||||
public static final StepSound e = new StepSound("wood", 1.0F, 1.0F);
|
||||
public static final StepSound f = new StepSound("gravel", 1.0F, 1.0F);
|
||||
@ -21,137 +22,149 @@ public class Block {
|
||||
public static final int[] lightEmission = new int[4096];
|
||||
public static final boolean[] r = new boolean[4096];
|
||||
public static boolean[] s = new boolean[4096];
|
||||
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 BlockWood(5)).c(2.0F).b(5.0F).a(e).a("wood").j();
|
||||
public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).a("sapling").j();
|
||||
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).l().b(6000000.0F).a(h).a("bedrock").s();
|
||||
public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).f(3).a("water").s().j();
|
||||
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).f(3).a("water").s().j();
|
||||
public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).f(255).a("lava").s().j();
|
||||
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).f(255).a("lava").s().j();
|
||||
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").j();
|
||||
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).f(1).a(g).a("leaves").j();
|
||||
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").j();
|
||||
public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).a("sandStone").j();
|
||||
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).a("musicBlock").j();
|
||||
public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed").s().j();
|
||||
public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).a("goldenRail").j();
|
||||
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).a("detectorRail").j();
|
||||
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).a("pistonStickyBase").j();
|
||||
public static final Block WEB = (new BlockWeb(30, 11)).f(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").j();
|
||||
public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).j();
|
||||
public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).a("cloth").j();
|
||||
public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).b("stone");
|
||||
public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).b("grass");
|
||||
public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).b("dirt");
|
||||
public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stonebrick").a(CreativeModeTab.b);
|
||||
public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(e).b("wood").p();
|
||||
public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).b("sapling").p();
|
||||
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).q().b(6000000.0F).a(h).b("bedrock").v().a(CreativeModeTab.b);
|
||||
public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).h(3).b("water").v().p();
|
||||
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).h(3).b("water").v().p();
|
||||
public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).h(255).b("lava").v().p();
|
||||
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).h(255).b("lava").v().p();
|
||||
public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).b("sand");
|
||||
public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).b("gravel");
|
||||
public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).b("oreGold");
|
||||
public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).b("oreIron");
|
||||
public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).b("oreCoal");
|
||||
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).b("log").p();
|
||||
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).h(1).a(g).b("leaves").p();
|
||||
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).b("sponge");
|
||||
public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).b("glass");
|
||||
public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).b("oreLapis");
|
||||
public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).b("blockLapis").a(CreativeModeTab.b);
|
||||
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).b("dispenser").p();
|
||||
public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).b("sandStone").p();
|
||||
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).b("musicBlock").p();
|
||||
public static final Block BED = (new BlockBed(26)).c(0.2F).b("bed").v().p();
|
||||
public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).b("goldenRail").p();
|
||||
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).b("detectorRail").p();
|
||||
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).b("pistonStickyBase").p();
|
||||
public static final Block WEB = (new BlockWeb(30, 11)).h(1).c(4.0F).b("web");
|
||||
public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).b("tallgrass");
|
||||
public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).b("deadbush");
|
||||
public static final Block PISTON = (new BlockPiston(33, 107, false)).b("pistonBase").p();
|
||||
public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).p();
|
||||
public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).b("cloth").p();
|
||||
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");
|
||||
public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, 29)).c(0.0F).a(g).a(0.125F).a("mushroom");
|
||||
public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, 28)).c(0.0F).a(g).a("mushroom");
|
||||
public static final Block GOLD_BLOCK = (new BlockOreBlock(41, 23)).c(3.0F).b(10.0F).a(i).a("blockGold");
|
||||
public static final Block IRON_BLOCK = (new BlockOreBlock(42, 22)).c(5.0F).b(10.0F).a(i).a("blockIron");
|
||||
public static final Block DOUBLE_STEP = (new BlockStep(43, true)).c(2.0F).b(10.0F).a(h).a("stoneSlab");
|
||||
public static final Block STEP = (new BlockStep(44, false)).c(2.0F).b(10.0F).a(h).a("stoneSlab");
|
||||
public static final Block BRICK = (new Block(45, 7, Material.STONE)).c(2.0F).b(10.0F).a(h).a("brick");
|
||||
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(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").j();
|
||||
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").s();
|
||||
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").s();
|
||||
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").j();
|
||||
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").j();
|
||||
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust").s().j();
|
||||
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").s().j();
|
||||
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland").j();
|
||||
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").j();
|
||||
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).a("furnace").j();
|
||||
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").s().j();
|
||||
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).a("doorWood").s().j();
|
||||
public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).a("ladder").j();
|
||||
public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).a("rail").j();
|
||||
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE)).a("stairsStone").j();
|
||||
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).a("sign").s().j();
|
||||
public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).a("lever").j();
|
||||
public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).a("pressurePlate").j();
|
||||
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).a("doorIron").s().j();
|
||||
public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).a("pressurePlate").j();
|
||||
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).a("oreRedstone").j();
|
||||
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").j();
|
||||
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).a("notGate").j();
|
||||
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).a("notGate").j();
|
||||
public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).a("button").j();
|
||||
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).a("snow").f(0);
|
||||
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).f(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").s();
|
||||
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").j();
|
||||
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").j();
|
||||
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.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").j();
|
||||
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake").s().j();
|
||||
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).a("diode").s().j();
|
||||
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").s().j();
|
||||
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).a("lockedchest").a(true).j();
|
||||
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").s().j();
|
||||
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").j();
|
||||
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).a("mushroom").j();
|
||||
public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).a("fenceIron");
|
||||
public static final Block THIN_GLASS = (new BlockThinFence(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").j();
|
||||
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).a("pumpkinStem").j();
|
||||
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).a("vine").j();
|
||||
public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).a("fenceGate").j();
|
||||
public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK)).a("stairsBrick").j();
|
||||
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK)).a("stairsStoneBrickSmooth").j();
|
||||
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").j();
|
||||
public static final Block NETHER_WART = (new BlockNetherWart(115)).a("netherStalk").j();
|
||||
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").j();
|
||||
public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).a("cauldron").j();
|
||||
public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).b("flower");
|
||||
public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).b("rose");
|
||||
public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, 29)).c(0.0F).a(g).a(0.125F).b("mushroom");
|
||||
public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, 28)).c(0.0F).a(g).b("mushroom");
|
||||
public static final Block GOLD_BLOCK = (new BlockOreBlock(41, 23)).c(3.0F).b(10.0F).a(i).b("blockGold");
|
||||
public static final Block IRON_BLOCK = (new BlockOreBlock(42, 22)).c(5.0F).b(10.0F).a(i).b("blockIron");
|
||||
public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
|
||||
public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
|
||||
public static final Block BRICK = (new Block(45, 7, Material.STONE)).c(2.0F).b(10.0F).a(h).b("brick").a(CreativeModeTab.b);
|
||||
public static final Block TNT = (new BlockTNT(46, 8)).c(0.0F).a(g).b("tnt");
|
||||
public static final Block BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).b("bookshelf");
|
||||
public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stoneMoss").a(CreativeModeTab.b);
|
||||
public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(50.0F).b(2000.0F).a(h).b("obsidian");
|
||||
public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).b("torch").p();
|
||||
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).b("fire").v();
|
||||
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).b("mobSpawner").v();
|
||||
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).b("stairsWood").p();
|
||||
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).b("chest").p();
|
||||
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).b("redstoneDust").v().p();
|
||||
public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).b("oreDiamond");
|
||||
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).b("blockDiamond");
|
||||
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).b("workbench");
|
||||
public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).b("crops").v().p();
|
||||
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).b("farmland").p();
|
||||
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).b("furnace").p().a(CreativeModeTab.c);
|
||||
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).b("furnace").p();
|
||||
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).b("sign").v().p();
|
||||
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).b("doorWood").v().p();
|
||||
public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).b("ladder").p();
|
||||
public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).b("rail").p();
|
||||
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).b("stairsStone").p();
|
||||
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).b("sign").v().p();
|
||||
public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).b("lever").p();
|
||||
public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).b("pressurePlate").p();
|
||||
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).b("doorIron").v().p();
|
||||
public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).b("pressurePlate").p();
|
||||
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).b("oreRedstone").p().a(CreativeModeTab.b);
|
||||
public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).b("oreRedstone").p();
|
||||
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).b("notGate").p();
|
||||
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).b("notGate").p().a(CreativeModeTab.d);
|
||||
public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).b("button").p();
|
||||
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).b("snow").p().h(0);
|
||||
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).h(3).a(j).b("ice");
|
||||
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(k).b("snow");
|
||||
public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).b("cactus");
|
||||
public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).b("clay");
|
||||
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).b("reeds").v();
|
||||
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).b("jukebox").p();
|
||||
public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).b("fence");
|
||||
public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).b("pumpkin").p();
|
||||
public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).b("hellrock");
|
||||
public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).b("hellsand");
|
||||
public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).b("lightgem");
|
||||
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).b("portal");
|
||||
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).b("litpumpkin").p();
|
||||
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).b("cake").v().p();
|
||||
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).b("diode").v().p();
|
||||
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).b("diode").v().p();
|
||||
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).b("lockedchest").b(true).p();
|
||||
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).b("trapdoor").v().p();
|
||||
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).b("monsterStoneEgg");
|
||||
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).b("stonebricksmooth");
|
||||
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).b("mushroom").p();
|
||||
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).b("mushroom").p();
|
||||
public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).b("fenceIron");
|
||||
public static final Block THIN_GLASS = (new BlockThinFence(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).b("thinGlass");
|
||||
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).b("melon");
|
||||
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).b("pumpkinStem").p();
|
||||
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).b("pumpkinStem").p();
|
||||
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).b("vine").p();
|
||||
public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).b("fenceGate").p();
|
||||
public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).b("stairsBrick").p();
|
||||
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).b("stairsStoneBrickSmooth").p();
|
||||
public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(g).b("mycel");
|
||||
public static final Block WATER_LILY = (new BlockWaterLily(111, 76)).c(0.0F).a(g).b("waterlily");
|
||||
public static final Block NETHER_BRICK = (new Block(112, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherBrick").a(CreativeModeTab.b);
|
||||
public static final Block NETHER_FENCE = (new BlockFence(113, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherFence");
|
||||
public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).b("stairsNetherBrick").p();
|
||||
public static final Block NETHER_WART = (new BlockNetherWart(115)).b("netherStalk").p();
|
||||
public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).b("enchantmentTable");
|
||||
public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).b("brewingStand").p();
|
||||
public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).b("cauldron").p();
|
||||
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").j().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 static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).a("redstoneLight");
|
||||
public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).a("redstoneLight");
|
||||
public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).b("endPortalFrame").p().b(6000000.0F).a(CreativeModeTab.c);
|
||||
public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).b("whiteStone").a(CreativeModeTab.b);
|
||||
public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).b("dragonEgg");
|
||||
public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).b("redstoneLight").a(CreativeModeTab.d);
|
||||
public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).b("redstoneLight");
|
||||
public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(e).b("woodSlab");
|
||||
public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(e).b("woodSlab");
|
||||
public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(e).b("cocoa").p();
|
||||
public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).b("stairsSandStone").p();
|
||||
public static final Block EMERALD_ORE = (new BlockOre(129, 171)).c(3.0F).b(5.0F).a(h).b("oreEmerald");
|
||||
public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(h).b("enderChest").p().a(0.5F);
|
||||
public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).b("tripWireSource").p();
|
||||
public static final Block TRIPWIRE = (new BlockTripwire(132)).b("tripWire").p();
|
||||
public static final Block EMERALD_BLOCK = (new BlockOreBlock(133, 25)).c(5.0F).b(10.0F).a(i).b("blockEmerald");
|
||||
public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).b("stairsWoodSpruce").p();
|
||||
public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).b("stairsWoodBirch").p();
|
||||
public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).b("stairsWoodJungle").p();
|
||||
public int textureId;
|
||||
public final int id;
|
||||
protected float strength;
|
||||
protected float durability;
|
||||
protected boolean bR;
|
||||
protected boolean bS;
|
||||
protected boolean bT;
|
||||
protected boolean cd;
|
||||
protected boolean ce;
|
||||
protected boolean cf;
|
||||
protected boolean isTileEntity;
|
||||
public double minX;
|
||||
public double minY;
|
||||
@ -160,16 +173,16 @@ public class Block {
|
||||
public double maxY;
|
||||
public double maxZ;
|
||||
public StepSound stepSound;
|
||||
public float cc;
|
||||
public float co;
|
||||
public final Material material;
|
||||
public float frictionFactor;
|
||||
private String name;
|
||||
|
||||
protected Block(int i, Material material) {
|
||||
this.bR = true;
|
||||
this.bS = true;
|
||||
this.cd = true;
|
||||
this.ce = true;
|
||||
this.stepSound = d;
|
||||
this.cc = 1.0F;
|
||||
this.co = 1.0F;
|
||||
this.frictionFactor = 0.6F;
|
||||
if (byId[i] != null) {
|
||||
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
|
||||
@ -178,18 +191,18 @@ public class Block {
|
||||
byId[i] = this;
|
||||
this.id = i;
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
n[i] = this.a();
|
||||
lightBlock[i] = this.a() ? 255 : 0;
|
||||
n[i] = this.d();
|
||||
lightBlock[i] = this.d() ? 255 : 0;
|
||||
p[i] = !material.blocksLight();
|
||||
}
|
||||
}
|
||||
|
||||
protected Block j() {
|
||||
protected Block p() {
|
||||
r[this.id] = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void k() {}
|
||||
protected void r_() {}
|
||||
|
||||
protected Block(int i, int j, Material material) {
|
||||
this(i, material);
|
||||
@ -201,7 +214,7 @@ public class Block {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block f(int i) {
|
||||
protected Block h(int i) {
|
||||
lightBlock[this.id] = i;
|
||||
return this;
|
||||
}
|
||||
@ -216,21 +229,21 @@ public class Block {
|
||||
return this;
|
||||
}
|
||||
|
||||
public static boolean g(int i) {
|
||||
public static boolean i(int i) {
|
||||
Block block = byId[i];
|
||||
|
||||
return block == null ? false : block.material.j() && block.b();
|
||||
return block == null ? false : block.material.k() && block.c();
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return !this.material.isSolid();
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -243,25 +256,25 @@ public class Block {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block l() {
|
||||
protected Block q() {
|
||||
this.c(-1.0F);
|
||||
return this;
|
||||
}
|
||||
|
||||
public float m() {
|
||||
public float m(World world, int i, int j, int k) {
|
||||
return this.strength;
|
||||
}
|
||||
|
||||
protected Block a(boolean flag) {
|
||||
this.bT = flag;
|
||||
protected Block b(boolean flag) {
|
||||
this.cf = flag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean n() {
|
||||
return this.bT;
|
||||
public boolean r() {
|
||||
return this.cf;
|
||||
}
|
||||
|
||||
public boolean o() {
|
||||
public boolean s() {
|
||||
return this.isTileEntity;
|
||||
}
|
||||
|
||||
@ -274,7 +287,7 @@ public class Block {
|
||||
this.maxZ = (double) f5;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return iblockaccess.getMaterial(i, j, k).isBuildable();
|
||||
}
|
||||
|
||||
@ -286,43 +299,43 @@ public class Block {
|
||||
return this.textureId;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
|
||||
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
|
||||
AxisAlignedBB axisalignedbb1 = this.e(world, i, j, k);
|
||||
|
||||
if (axisalignedbb1 != null && axisalignedbb.a(axisalignedbb1)) {
|
||||
arraylist.add(axisalignedbb1);
|
||||
list.add(axisalignedbb1);
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
return AxisAlignedBB.b((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ);
|
||||
return AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a(int i, boolean flag) {
|
||||
return this.E_();
|
||||
return this.l();
|
||||
}
|
||||
|
||||
public boolean E_() {
|
||||
public boolean l() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {}
|
||||
public void b(World world, int i, int j, int k, Random random) {}
|
||||
|
||||
public void postBreak(World world, int i, int j, int k, int l) {}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {}
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {}
|
||||
|
||||
public int a(Random random) {
|
||||
return 1;
|
||||
@ -332,11 +345,13 @@ public class Block {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public float getDamage(EntityHuman entityhuman) {
|
||||
return this.strength < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / this.strength / 100.0F : entityhuman.a(this) / this.strength / 30.0F);
|
||||
public float getDamage(EntityHuman entityhuman, World world, int i, int j, int k) {
|
||||
float f = this.m(world, i, j, k);
|
||||
|
||||
return f < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / f / 100.0F : entityhuman.a(this) / f / 30.0F);
|
||||
}
|
||||
|
||||
public final void b(World world, int i, int j, int k, int l, int i1) {
|
||||
public final void c(World world, int i, int j, int k, int l, int i1) {
|
||||
this.dropNaturally(world, i, j, k, l, 1.0F, i1);
|
||||
}
|
||||
|
||||
@ -370,6 +385,17 @@ public class Block {
|
||||
}
|
||||
}
|
||||
|
||||
protected void g(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic) {
|
||||
while (l > 0) {
|
||||
int i1 = EntityExperienceOrb.getOrbValue(l);
|
||||
|
||||
l -= i1;
|
||||
world.addEntity(new EntityExperienceOrb(world, (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, i1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int getDropData(int i) {
|
||||
return 0;
|
||||
}
|
||||
@ -382,12 +408,12 @@ public class Block {
|
||||
this.updateShape(world, i, j, k);
|
||||
vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k));
|
||||
vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k));
|
||||
Vec3D vec3d2 = vec3d.a(vec3d1, this.minX);
|
||||
Vec3D vec3d3 = vec3d.a(vec3d1, this.maxX);
|
||||
Vec3D vec3d4 = vec3d.b(vec3d1, this.minY);
|
||||
Vec3D vec3d5 = vec3d.b(vec3d1, this.maxY);
|
||||
Vec3D vec3d6 = vec3d.c(vec3d1, this.minZ);
|
||||
Vec3D vec3d7 = vec3d.c(vec3d1, this.maxZ);
|
||||
Vec3D vec3d2 = vec3d.b(vec3d1, this.minX);
|
||||
Vec3D vec3d3 = vec3d.b(vec3d1, this.maxX);
|
||||
Vec3D vec3d4 = vec3d.c(vec3d1, this.minY);
|
||||
Vec3D vec3d5 = vec3d.c(vec3d1, this.maxY);
|
||||
Vec3D vec3d6 = vec3d.d(vec3d1, this.minZ);
|
||||
Vec3D vec3d7 = vec3d.d(vec3d1, this.maxZ);
|
||||
|
||||
if (!this.a(vec3d2)) {
|
||||
vec3d2 = null;
|
||||
@ -415,27 +441,27 @@ public class Block {
|
||||
|
||||
Vec3D vec3d8 = null;
|
||||
|
||||
if (vec3d2 != null && (vec3d8 == null || vec3d.b(vec3d2) < vec3d.b(vec3d8))) {
|
||||
if (vec3d2 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d2) < vec3d.distanceSquared(vec3d8))) {
|
||||
vec3d8 = vec3d2;
|
||||
}
|
||||
|
||||
if (vec3d3 != null && (vec3d8 == null || vec3d.b(vec3d3) < vec3d.b(vec3d8))) {
|
||||
if (vec3d3 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d3) < vec3d.distanceSquared(vec3d8))) {
|
||||
vec3d8 = vec3d3;
|
||||
}
|
||||
|
||||
if (vec3d4 != null && (vec3d8 == null || vec3d.b(vec3d4) < vec3d.b(vec3d8))) {
|
||||
if (vec3d4 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d4) < vec3d.distanceSquared(vec3d8))) {
|
||||
vec3d8 = vec3d4;
|
||||
}
|
||||
|
||||
if (vec3d5 != null && (vec3d8 == null || vec3d.b(vec3d5) < vec3d.b(vec3d8))) {
|
||||
if (vec3d5 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d5) < vec3d.distanceSquared(vec3d8))) {
|
||||
vec3d8 = vec3d5;
|
||||
}
|
||||
|
||||
if (vec3d6 != null && (vec3d8 == null || vec3d.b(vec3d6) < vec3d.b(vec3d8))) {
|
||||
if (vec3d6 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d6) < vec3d.distanceSquared(vec3d8))) {
|
||||
vec3d8 = vec3d6;
|
||||
}
|
||||
|
||||
if (vec3d7 != null && (vec3d8 == null || vec3d.b(vec3d7) < vec3d.b(vec3d8))) {
|
||||
if (vec3d7 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d7) < vec3d.distanceSquared(vec3d8))) {
|
||||
vec3d8 = vec3d7;
|
||||
}
|
||||
|
||||
@ -493,16 +519,16 @@ public class Block {
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
int l = world.getTypeId(i, j, k);
|
||||
|
||||
return l == 0 || byId[l].material.isReplacable();
|
||||
return l == 0 || byId[l].material.isReplaceable();
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Entity entity) {}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) {}
|
||||
public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
|
||||
|
||||
@ -520,7 +546,7 @@ public class Block {
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity) {}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -528,9 +554,9 @@ public class Block {
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
entityhuman.a(StatisticList.C[this.id], 1);
|
||||
entityhuman.c(0.025F);
|
||||
if (this.h() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
|
||||
ItemStack itemstack = this.a_(l);
|
||||
entityhuman.j(0.025F);
|
||||
if (this.q_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
|
||||
ItemStack itemstack = this.c_(l);
|
||||
|
||||
if (itemstack != null) {
|
||||
this.a(world, i, j, k, itemstack);
|
||||
@ -538,18 +564,18 @@ public class Block {
|
||||
} else {
|
||||
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory);
|
||||
|
||||
this.b(world, i, j, k, l, i1);
|
||||
this.c(world, i, j, k, l, i1);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean h() {
|
||||
return this.b() && !this.isTileEntity;
|
||||
protected boolean q_() {
|
||||
return this.c() && !this.isTileEntity;
|
||||
}
|
||||
|
||||
protected ItemStack a_(int i) {
|
||||
protected ItemStack c_(int i) {
|
||||
int j = 0;
|
||||
|
||||
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].e()) {
|
||||
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].k()) {
|
||||
j = i;
|
||||
}
|
||||
|
||||
@ -560,74 +586,91 @@ public class Block {
|
||||
return this.a(random);
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
public boolean d(World world, int i, int j, int k) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {}
|
||||
|
||||
public Block a(String s) {
|
||||
public Block b(String s) {
|
||||
this.name = "tile." + s;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return LocaleI18n.get(this.q() + ".name");
|
||||
return LocaleI18n.get(this.a() + ".name");
|
||||
}
|
||||
|
||||
public String q() {
|
||||
public String a() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, int i1) {}
|
||||
public void b(World world, int i, int j, int k, int l, int i1) {}
|
||||
|
||||
public boolean r() {
|
||||
return this.bS;
|
||||
public boolean u() {
|
||||
return this.ce;
|
||||
}
|
||||
|
||||
protected Block s() {
|
||||
this.bS = false;
|
||||
protected Block v() {
|
||||
this.ce = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int g() {
|
||||
public int e() {
|
||||
return this.material.getPushReaction();
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity, float f) {}
|
||||
|
||||
public Block a(CreativeModeTab creativemodetab) {
|
||||
this.creativeTab = creativemodetab;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
|
||||
|
||||
public void h(World world, int i, int j, int k, int l) {}
|
||||
|
||||
public void f(World world, int i, int j, int k) {}
|
||||
|
||||
public void a(World world, long i, long j) {}
|
||||
|
||||
static {
|
||||
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth");
|
||||
Item.byId[LOG.id] = (new ItemWithAuxData(LOG.id - 256, LOG)).a("log");
|
||||
Item.byId[WOOD.id] = (new ItemWithAuxData(WOOD.id - 256, WOOD)).a("wood");
|
||||
Item.byId[SMOOTH_BRICK.id] = (new ItemWithAuxData(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).a("stonebricksmooth");
|
||||
Item.byId[SANDSTONE.id] = (new ItemWithAuxData(SANDSTONE.id - 256, SANDSTONE)).a("sandStone");
|
||||
Item.byId[STEP.id] = (new ItemStep(STEP.id - 256)).a("stoneSlab");
|
||||
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)).a(new String[] { "shrub", "grass", "fern"});
|
||||
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
|
||||
Item.byId[LOG.id] = (new ItemLog(LOG.id - 256, LOG)).b("log");
|
||||
Item.byId[WOOD.id] = (new ItemWood(WOOD.id - 256, WOOD)).b("wood");
|
||||
Item.byId[MONSTER_EGGS.id] = (new ItemMonsterEggs(MONSTER_EGGS.id - 256)).b("monsterStoneEgg");
|
||||
Item.byId[SMOOTH_BRICK.id] = (new ItemSmoothStone(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).b("stonebricksmooth");
|
||||
Item.byId[SANDSTONE.id] = (new ItemSandStone(SANDSTONE.id - 256, SANDSTONE)).b("sandStone");
|
||||
Item.byId[STEP.id] = (new ItemStep(STEP.id - 256, STEP, DOUBLE_STEP, false)).b("stoneSlab");
|
||||
Item.byId[DOUBLE_STEP.id] = (new ItemStep(DOUBLE_STEP.id - 256, STEP, DOUBLE_STEP, true)).b("stoneSlab");
|
||||
Item.byId[WOOD_STEP.id] = (new ItemStep(WOOD_STEP.id - 256, WOOD_STEP, WOOD_DOUBLE_STEP, false)).b("woodSlab");
|
||||
Item.byId[WOOD_DOUBLE_STEP.id] = (new ItemStep(WOOD_DOUBLE_STEP.id - 256, WOOD_STEP, WOOD_DOUBLE_STEP, true)).b("woodSlab");
|
||||
Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).b("sapling");
|
||||
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).b("leaves");
|
||||
Item.byId[VINE.id] = new ItemWithAuxData(VINE.id - 256, false);
|
||||
Item.byId[LONG_GRASS.id] = (new ItemWithAuxData(LONG_GRASS.id - 256, true)).a(new String[] { "shrub", "grass", "fern"});
|
||||
Item.byId[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 ItemWithAuxData(BIG_MUSHROOM_1.id - 256, BIG_MUSHROOM_1); // CraftBukkit
|
||||
Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, BIG_MUSHROOM_2); // CraftBukkit
|
||||
Item.byId[MOB_SPAWNER.id] = new ItemWithAuxData(MOB_SPAWNER.id - 256, MOB_SPAWNER); // CraftBukkit
|
||||
Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, false); // CraftBukkit
|
||||
Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, false); // CraftBukkit
|
||||
Item.byId[MOB_SPAWNER.id] = new ItemWithAuxData(MOB_SPAWNER.id - 256, false); // CraftBukkit
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
if (byId[i] != null) {
|
||||
if (Item.byId[i] == null) {
|
||||
Item.byId[i] = new ItemBlock(i - 256);
|
||||
byId[i].k();
|
||||
byId[i].r_();
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
if (i > 0 && byId[i].c() == 10) {
|
||||
if (i > 0 && byId[i].b() == 10) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (i > 0 && byId[i] instanceof BlockStep) {
|
||||
if (i > 0 && byId[i] instanceof BlockStepAbstract) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@ -639,6 +682,10 @@ public class Block {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (lightBlock[i] == 0) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
s[i] = flag;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ public class BlockBloodStone extends Block {
|
||||
|
||||
public BlockBloodStone(int i, int j) {
|
||||
super(i, j, Material.STONE);
|
||||
this.a(CreativeModeTab.b);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
|
@ -8,88 +8,89 @@ public class BlockButton extends Block {
|
||||
|
||||
protected BlockButton(int i, int j) {
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k, int l) {
|
||||
return l == 2 && world.e(i, j, k + 1) ? true : (l == 3 && world.e(i, j, k - 1) ? true : (l == 4 && world.e(i + 1, j, k) ? true : l == 5 && world.e(i - 1, j, k)));
|
||||
return l == 2 && world.s(i, j, k + 1) ? true : (l == 3 && world.s(i, j, k - 1) ? true : (l == 4 && world.s(i + 1, j, k) ? true : l == 5 && world.s(i - 1, j, k)));
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.e(i - 1, j, k) ? true : (world.e(i + 1, j, k) ? true : (world.e(i, j, k - 1) ? true : world.e(i, j, k + 1)));
|
||||
return world.s(i - 1, j, k) ? true : (world.s(i + 1, j, k) ? true : (world.s(i, j, k - 1) ? true : world.s(i, j, k + 1)));
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) {
|
||||
public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
int j1 = i1 & 8;
|
||||
|
||||
i1 &= 7;
|
||||
if (l == 2 && world.e(i, j, k + 1)) {
|
||||
if (l == 2 && world.s(i, j, k + 1)) {
|
||||
i1 = 4;
|
||||
} else if (l == 3 && world.e(i, j, k - 1)) {
|
||||
} else if (l == 3 && world.s(i, j, k - 1)) {
|
||||
i1 = 3;
|
||||
} else if (l == 4 && world.e(i + 1, j, k)) {
|
||||
} else if (l == 4 && world.s(i + 1, j, k)) {
|
||||
i1 = 2;
|
||||
} else if (l == 5 && world.e(i - 1, j, k)) {
|
||||
} else if (l == 5 && world.s(i - 1, j, k)) {
|
||||
i1 = 1;
|
||||
} else {
|
||||
i1 = this.g(world, i, j, k);
|
||||
i1 = this.l(world, i, j, k);
|
||||
}
|
||||
|
||||
world.setData(i, j, k, i1 + j1);
|
||||
}
|
||||
|
||||
private int g(World world, int i, int j, int k) {
|
||||
return world.e(i - 1, j, k) ? 1 : (world.e(i + 1, j, k) ? 2 : (world.e(i, j, k - 1) ? 3 : (world.e(i, j, k + 1) ? 4 : 1)));
|
||||
private int l(World world, int i, int j, int k) {
|
||||
return world.s(i - 1, j, k) ? 1 : (world.s(i + 1, j, k) ? 2 : (world.s(i, j, k - 1) ? 3 : (world.s(i, j, k + 1) ? 4 : 1)));
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (this.h(world, i, j, k)) {
|
||||
if (this.n(world, i, j, k)) {
|
||||
int i1 = world.getData(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.e(i - 1, j, k) && i1 == 1) {
|
||||
if (!world.s(i - 1, j, k) && i1 == 1) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i + 1, j, k) && i1 == 2) {
|
||||
if (!world.s(i + 1, j, k) && i1 == 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i, j, k - 1) && i1 == 3) {
|
||||
if (!world.s(i, j, k - 1) && i1 == 3) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i, j, k + 1) && i1 == 4) {
|
||||
if (!world.s(i, j, k + 1) && i1 == 4) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean h(World world, int i, int j, int k) {
|
||||
private boolean n(World world, int i, int j, int k) {
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return false;
|
||||
} else {
|
||||
@ -122,79 +123,77 @@ public class BlockButton extends Block {
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.interact(world, i, j, k, entityhuman);
|
||||
this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
int j1 = 8 - (l & 8);
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
int j1 = i1 & 7;
|
||||
int k1 = 8 - (i1 & 8);
|
||||
|
||||
if (j1 == 0) {
|
||||
if (k1 == 0) {
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
int old = (k1 != 8) ? 1 : 0;
|
||||
int current = (k1 == 8) ? 1 : 0;
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8)) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setData(i, j, k, i1 + j1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.setData(i, j, k, j1 + k1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
if (i1 == 1) {
|
||||
if (j1 == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
} else if (j1 == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
} else if (j1 == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
} else if (j1 == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) > 0) {
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
if ((i1 & 8) > 0) {
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
int i1 = l & 7;
|
||||
int j1 = i1 & 7;
|
||||
|
||||
if (i1 == 1) {
|
||||
if (j1 == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
} else if (j1 == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
} else if (j1 == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
} else if (j1 == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
super.remove(world, i, j, k);
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.getData(i, j, k) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
@ -210,7 +209,7 @@ public class BlockButton extends Block {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
@ -221,7 +220,9 @@ public class BlockButton extends Block {
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
if (eventRedstone.getNewCurrent() > 0) return;
|
||||
if (eventRedstone.getNewCurrent() > 0) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setData(i, j, k, l & 7);
|
||||
@ -241,7 +242,7 @@ public class BlockButton extends Block {
|
||||
}
|
||||
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,11 @@ public class BlockCactus extends Block {
|
||||
|
||||
protected BlockCactus(int i, int j) {
|
||||
super(i, j, Material.CACTUS);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.c);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (world.isEmpty(i, j + 1, k)) {
|
||||
int l;
|
||||
|
||||
@ -35,37 +36,37 @@ public class BlockCactus extends Block {
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
float f = 0.0625F;
|
||||
|
||||
return AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f));
|
||||
return AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f));
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId + 1 : this.textureId);
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 13;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
|
||||
return !super.canPlace(world, i, j, k) ? false : this.d(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.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
if (!this.d(world, i, j, k)) {
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
public boolean d(World world, int i, int j, int k) {
|
||||
if (world.getMaterial(i - 1, j, k).isBuildable()) {
|
||||
return false;
|
||||
} else if (world.getMaterial(i + 1, j, k).isBuildable()) {
|
||||
|
@ -1,97 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockCauldron extends Block {
|
||||
|
||||
public BlockCauldron(int i) {
|
||||
super(i, Material.ORE);
|
||||
this.textureId = 154;
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return i == 1 ? 138 : (i == 0 ? 155 : 154);
|
||||
}
|
||||
|
||||
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, 0.3125F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
float f = 0.125F;
|
||||
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
this.f();
|
||||
}
|
||||
|
||||
public void f() {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 24;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (itemstack == null) {
|
||||
return true;
|
||||
} else {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (itemstack.id == Item.WATER_BUCKET.id) {
|
||||
if (l < 3) {
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Item.BUCKET));
|
||||
}
|
||||
|
||||
world.setData(i, j, k, 3);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if (itemstack.id == Item.GLASS_BOTTLE.id && l > 0) {
|
||||
ItemStack itemstack1 = new ItemStack(Item.POTION, 1, 0);
|
||||
|
||||
if (!entityhuman.inventory.pickup(itemstack1)) {
|
||||
world.addEntity(new EntityItem(world, (double) i + 0.5D, (double) j + 1.5D, (double) k + 0.5D, itemstack1));
|
||||
} else if (entityhuman instanceof EntityPlayer) { // CraftBukkit
|
||||
((EntityPlayer) entityhuman).updateInventory(entityhuman.defaultContainer); // CraftBukkit
|
||||
}
|
||||
|
||||
--itemstack.count;
|
||||
if (itemstack.count <= 0) {
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
||||
}
|
||||
|
||||
world.setData(i, j, k, l - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
return Item.CAULDRON.id;
|
||||
}
|
||||
}
|
@ -7,23 +7,24 @@ public class BlockCrops extends BlockFlower {
|
||||
protected BlockCrops(int i, int j) {
|
||||
super(i, j);
|
||||
this.textureId = j;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
float f = 0.5F;
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
|
||||
this.a((CreativeModeTab) null);
|
||||
}
|
||||
|
||||
protected boolean d(int i) {
|
||||
protected boolean d_(int i) {
|
||||
return i == Block.SOIL.id;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
super.a(world, i, j, k, random);
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
super.b(world, i, j, k, random);
|
||||
if (world.getLightLevel(i, j + 1, k) >= 9) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l < 7) {
|
||||
float f = this.i(world, i, j, k);
|
||||
float f = this.l(world, i, j, k);
|
||||
|
||||
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
|
||||
@ -32,11 +33,11 @@ public class BlockCrops extends BlockFlower {
|
||||
}
|
||||
}
|
||||
|
||||
public void g(World world, int i, int j, int k) {
|
||||
public void c_(World world, int i, int j, int k) {
|
||||
world.setData(i, j, k, 7);
|
||||
}
|
||||
|
||||
private float i(World world, int i, int j, int k) {
|
||||
private float l(World world, int i, int j, int k) {
|
||||
float f = 1.0F;
|
||||
int l = world.getTypeId(i, j, k - 1);
|
||||
int i1 = world.getTypeId(i, j, k + 1);
|
||||
@ -85,7 +86,7 @@ public class BlockCrops extends BlockFlower {
|
||||
return this.textureId + j;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,10 @@ public class BlockDispenser extends BlockContainer {
|
||||
protected BlockDispenser(int i) {
|
||||
super(i, Material.STONE);
|
||||
this.textureId = 45;
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@ -26,10 +27,10 @@ public class BlockDispenser extends BlockContainer {
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
super.onPlace(world, i, j, k);
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
if (!world.isStatic) {
|
||||
int l = world.getTypeId(i, j, k - 1);
|
||||
int i1 = world.getTypeId(i, j, k + 1);
|
||||
@ -61,7 +62,7 @@ public class BlockDispenser extends BlockContainer {
|
||||
return i == 1 ? this.textureId + 17 : (i == 0 ? this.textureId + 17 : (i == 3 ? this.textureId + 1 : this.textureId));
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
@ -75,7 +76,7 @@ public class BlockDispenser extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit - priv to public
|
||||
// CraftBukkit - private to public
|
||||
public void dispense(World world, int i, int j, int k, Random random) {
|
||||
int l = world.getData(i, j, k);
|
||||
byte b0 = 0;
|
||||
@ -94,103 +95,53 @@ public class BlockDispenser extends BlockContainer {
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentitydispenser != null) {
|
||||
// CraftBukkit start
|
||||
int dispenseSlot = tileentitydispenser.findDispenseSlot();
|
||||
ItemStack itemstack = null;
|
||||
if (dispenseSlot > -1) {
|
||||
itemstack = tileentitydispenser.getContents()[dispenseSlot];
|
||||
int i1 = tileentitydispenser.i();
|
||||
|
||||
// Copy item stack, because we want it to have 1 item
|
||||
itemstack = new ItemStack(itemstack.id, 1, itemstack.getData(), itemstack.getEnchantments());
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
double d0 = (double) i + (double) b0 * 0.6D + 0.5D;
|
||||
double d1 = (double) j + 0.5D;
|
||||
double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
|
||||
|
||||
if (itemstack == null) {
|
||||
if (i1 < 0) {
|
||||
world.triggerEffect(1001, i, j, k, 0);
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
double d3 = random.nextDouble() * 0.1D + 0.2D;
|
||||
double motX = (double) b0 * d3;
|
||||
double motY = 0.20000000298023224D;
|
||||
double motZ = (double) b1 * d3;
|
||||
motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
double d0 = (double) i + (double) b0 * 0.6D + 0.5D;
|
||||
double d1 = (double) j + 0.5D;
|
||||
double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
|
||||
ItemStack itemstack = tileentitydispenser.getItem(i1);
|
||||
int j1 = a(tileentitydispenser, world, itemstack, random, i, j, k, b0, b1, d0, d1, d2);
|
||||
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(motX, motY, motZ));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItem().equals(bukkitItem)) {
|
||||
// Actually remove the item
|
||||
tileentitydispenser.splitStack(dispenseSlot, 1);
|
||||
}
|
||||
|
||||
motX = event.getVelocity().getX();
|
||||
motY = event.getVelocity().getY();
|
||||
motZ = event.getVelocity().getZ();
|
||||
|
||||
itemstack = CraftItemStack.createNMSItemStack(event.getItem());
|
||||
// CraftBukkit end
|
||||
|
||||
if (itemstack.id == Item.ARROW.id) {
|
||||
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
|
||||
|
||||
entityarrow.shoot((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
||||
entityarrow.fromPlayer = true;
|
||||
world.addEntity(entityarrow);
|
||||
world.triggerEffect(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.triggerEffect(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.triggerEffect(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.triggerEffect(1002, i, j, k, 0);
|
||||
} else if (itemstack.id == Item.EXP_BOTTLE.id) {
|
||||
EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, d0, d1, d2);
|
||||
|
||||
entitythrownexpbottle.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
|
||||
world.addEntity(entitythrownexpbottle);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
} else if (itemstack.id == Item.MONSTER_EGG.id) {
|
||||
ItemMonsterEgg.a(world, itemstack.getData(), d0 + (double) b0 * 0.3D, d1 - 0.3D, d2 + (double) b1 * 0.3D);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
} else if (itemstack.id == Item.FIREBALL.id) {
|
||||
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0 + (double) b0 * 0.3D, d1, d2 + (double) b1 * 0.3D, (double) b0 + random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, (double) b1 + random.nextGaussian() * 0.05D);
|
||||
|
||||
world.addEntity(entitysmallfireball);
|
||||
world.triggerEffect(1009, i, j, k, 0);
|
||||
} else {
|
||||
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||
if (j1 == 1) {
|
||||
tileentitydispenser.splitStack(i1, 1);
|
||||
} else if (j1 == 0) {
|
||||
// CraftBukkit start
|
||||
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
|
||||
entityitem.motX = motX;
|
||||
entityitem.motY = motY;
|
||||
entityitem.motZ = motZ;
|
||||
double d3 = random.nextDouble() * 0.1D + 0.2D;
|
||||
double motX = (double) b0 * d3;
|
||||
double motY = 0.20000000298023224D;
|
||||
double motZ = (double) b1 * d3;
|
||||
motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(motX, motY, motZ));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItem().equals(bukkitItem)) {
|
||||
// Actually remove the item
|
||||
tileentitydispenser.splitStack(i1, 1);
|
||||
}
|
||||
|
||||
motX = event.getVelocity().getX();
|
||||
motY = event.getVelocity().getY();
|
||||
motZ = event.getVelocity().getZ();
|
||||
|
||||
itemstack = CraftItemStack.createNMSItemStack(event.getItem());
|
||||
|
||||
a(world, itemstack, random, motX, motY, motZ, d0, d1, d2);
|
||||
// CraftBukkit end
|
||||
world.addEntity(entityitem);
|
||||
|
||||
world.triggerEffect(1000, i, j, k, 0);
|
||||
}
|
||||
|
||||
@ -204,18 +155,18 @@ 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.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic && (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k))) {
|
||||
this.dispense(world, i, j, k, random);
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity a_() {
|
||||
public TileEntity a(World world) {
|
||||
return new TileEntityDispenser();
|
||||
}
|
||||
|
||||
@ -239,12 +190,12 @@ public class BlockDispenser extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentitydispenser != null) {
|
||||
for (int l = 0; l < tileentitydispenser.getSize(); ++l) {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(l);
|
||||
for (int j1 = 0; j1 < tileentitydispenser.getSize(); ++j1) {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
@ -252,14 +203,14 @@ public class BlockDispenser extends BlockContainer {
|
||||
float f2 = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.count > 0) {
|
||||
int i1 = this.a.nextInt(21) + 10;
|
||||
int k1 = this.a.nextInt(21) + 10;
|
||||
|
||||
if (i1 > itemstack.count) {
|
||||
i1 = itemstack.count;
|
||||
if (k1 > itemstack.count) {
|
||||
k1 = itemstack.count;
|
||||
}
|
||||
|
||||
itemstack.count -= i1;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData()));
|
||||
itemstack.count -= k1;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, k1, itemstack.getData()));
|
||||
|
||||
if (itemstack.hasTag()) {
|
||||
entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
|
||||
@ -276,6 +227,150 @@ public class BlockDispenser extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
super.remove(world, i, j, k);
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
// CraftBukkit start - change of method signature!
|
||||
private static void a(World world, ItemStack itemstack, Random random, double motX, double motY, double motZ, double d0, double d1, double d2) {
|
||||
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
|
||||
|
||||
entityitem.motX = motX;
|
||||
entityitem.motY = motY;
|
||||
entityitem.motZ = motZ;
|
||||
world.addEntity(entityitem);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
private static int a(TileEntityDispenser tileentitydispenser, World world, ItemStack itemstack, Random random, int i, int j, int k, int l, int i1, double d0, double d1, double d2) {
|
||||
float f = 1.1F;
|
||||
byte b0 = 6;
|
||||
|
||||
if (itemstack.id == Item.ARROW.id) {
|
||||
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
|
||||
|
||||
entityarrow.shoot((double) l, 0.10000000149011612D, (double) i1, f, (float) b0);
|
||||
entityarrow.fromPlayer = 1;
|
||||
world.addEntity(entityarrow);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id == Item.EGG.id) {
|
||||
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
|
||||
|
||||
entityegg.c((double) l, 0.10000000149011612D, (double) i1, f, (float) b0);
|
||||
world.addEntity(entityegg);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id == Item.SNOW_BALL.id) {
|
||||
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
|
||||
|
||||
entitysnowball.c((double) l, 0.10000000149011612D, (double) i1, f, (float) b0);
|
||||
world.addEntity(entitysnowball);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id == Item.POTION.id && ItemPotion.g(itemstack.getData())) {
|
||||
EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData());
|
||||
|
||||
entitypotion.c((double) l, 0.10000000149011612D, (double) i1, f * 1.25F, (float) b0 * 0.5F);
|
||||
world.addEntity(entitypotion);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id == Item.EXP_BOTTLE.id) {
|
||||
EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, d0, d1, d2);
|
||||
|
||||
entitythrownexpbottle.c((double) l, 0.10000000149011612D, (double) i1, f * 1.25F, (float) b0 * 0.5F);
|
||||
world.addEntity(entitythrownexpbottle);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id == Item.MONSTER_EGG.id) {
|
||||
ItemMonsterEgg.a(world, itemstack.getData(), d0 + (double) l * 0.3D, d1 - 0.3D, d2 + (double) i1 * 0.3D);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id == Item.FIREBALL.id) {
|
||||
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0 + (double) l * 0.3D, d1, d2 + (double) i1 * 0.3D, (double) l + random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, (double) i1 + random.nextGaussian() * 0.05D);
|
||||
|
||||
world.addEntity(entitysmallfireball);
|
||||
world.triggerEffect(1009, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id != Item.LAVA_BUCKET.id && itemstack.id != Item.WATER_BUCKET.id) {
|
||||
if (itemstack.id == Item.BUCKET.id) {
|
||||
int j1 = i + l;
|
||||
int k1 = k + i1;
|
||||
Material material = world.getMaterial(j1, j, k1);
|
||||
int l1 = world.getData(j1, j, k1);
|
||||
|
||||
if (material == Material.WATER && l1 == 0) {
|
||||
world.setTypeId(j1, j, k1, 0);
|
||||
if (--itemstack.count == 0) {
|
||||
itemstack.id = Item.WATER_BUCKET.id;
|
||||
itemstack.count = 1;
|
||||
} else if (tileentitydispenser.a(new ItemStack(Item.WATER_BUCKET)) < 0) {
|
||||
a(world, new ItemStack(Item.WATER_BUCKET), random, 6, l, i1, d0, d1, d2);
|
||||
}
|
||||
|
||||
return 2;
|
||||
} else if (material == Material.LAVA && l1 == 0) {
|
||||
world.setTypeId(j1, j, k1, 0);
|
||||
if (--itemstack.count == 0) {
|
||||
itemstack.id = Item.LAVA_BUCKET.id;
|
||||
itemstack.count = 1;
|
||||
} else if (tileentitydispenser.a(new ItemStack(Item.LAVA_BUCKET)) < 0) {
|
||||
a(world, new ItemStack(Item.LAVA_BUCKET), random, 6, l, i1, d0, d1, d2);
|
||||
}
|
||||
|
||||
return 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (itemstack.getItem() instanceof ItemMinecart) {
|
||||
d0 = (double) i + (l < 0 ? (double) l * 0.8D : (double) ((float) l * 1.8F)) + (double) ((float) Math.abs(i1) * 0.5F);
|
||||
d2 = (double) k + (i1 < 0 ? (double) i1 * 0.8D : (double) ((float) i1 * 1.8F)) + (double) ((float) Math.abs(l) * 0.5F);
|
||||
if (BlockMinecartTrack.d_(world, i + l, j, k + i1)) {
|
||||
d1 = (double) ((float) j + 0.5F);
|
||||
} else {
|
||||
if (!world.isEmpty(i + l, j, k + i1) || !BlockMinecartTrack.d_(world, i + l, j - 1, k + i1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
d1 = (double) ((float) j - 0.5F);
|
||||
}
|
||||
|
||||
EntityMinecart entityminecart = new EntityMinecart(world, d0, d1, d2, ((ItemMinecart) itemstack.getItem()).a);
|
||||
|
||||
world.addEntity(entityminecart);
|
||||
world.triggerEffect(1000, i, j, k, 0);
|
||||
return 1;
|
||||
} else if (itemstack.id == Item.BOAT.id) {
|
||||
d0 = (double) i + (l < 0 ? (double) l * 0.8D : (double) ((float) l * 1.8F)) + (double) ((float) Math.abs(i1) * 0.5F);
|
||||
d2 = (double) k + (i1 < 0 ? (double) i1 * 0.8D : (double) ((float) i1 * 1.8F)) + (double) ((float) Math.abs(l) * 0.5F);
|
||||
if (world.getMaterial(i + l, j, k + i1) == Material.WATER) {
|
||||
d1 = (double) ((float) j + 1.0F);
|
||||
} else {
|
||||
if (!world.isEmpty(i + l, j, k + i1) || world.getMaterial(i + l, j - 1, k + i1) != Material.WATER) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
d1 = (double) j;
|
||||
}
|
||||
|
||||
EntityBoat entityboat = new EntityBoat(world, d0, d1, d2);
|
||||
|
||||
world.addEntity(entityboat);
|
||||
world.triggerEffect(1000, i, j, k, 0);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
|
||||
|
||||
if (itembucket.a(world, (double) i, (double) j, (double) k, i + l, j, k + i1)) {
|
||||
itemstack.id = Item.BUCKET.id;
|
||||
itemstack.count = 1;
|
||||
return 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,21 +19,21 @@ public class BlockDoor extends Block {
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = this.e(iblockaccess, i, j, k);
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = this.b_(iblockaccess, i, j, k);
|
||||
|
||||
return (l & 4) != 0;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
@ -43,18 +43,18 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
this.d(this.e(iblockaccess, i, j, k));
|
||||
this.e(this.b_(iblockaccess, i, j, k));
|
||||
}
|
||||
|
||||
public int c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.e(iblockaccess, i, j, k) & 3;
|
||||
public int d(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.b_(iblockaccess, i, j, k) & 3;
|
||||
}
|
||||
|
||||
public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return (this.e(iblockaccess, i, j, k) & 4) != 0;
|
||||
public boolean a_(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return (this.b_(iblockaccess, i, j, k) & 4) != 0;
|
||||
}
|
||||
|
||||
private void d(int i) {
|
||||
private void e(int i) {
|
||||
float f = 0.1875F;
|
||||
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
||||
@ -63,58 +63,66 @@ public class BlockDoor extends Block {
|
||||
boolean flag1 = (i & 16) != 0;
|
||||
|
||||
if (j == 0) {
|
||||
if (!flag) {
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
} else if (!flag1) {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
if (flag) {
|
||||
if (!flag1) {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
} else {
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
} else {
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
}
|
||||
} else if (j == 1) {
|
||||
if (!flag) {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
} else if (!flag1) {
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
if (flag) {
|
||||
if (!flag1) {
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
} else {
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
}
|
||||
} else {
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
}
|
||||
} else if (j == 2) {
|
||||
if (!flag) {
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
} else if (!flag1) {
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
if (flag) {
|
||||
if (!flag1) {
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
} else {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
}
|
||||
} else {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
} else if (j == 3) {
|
||||
if (!flag) {
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
} else if (!flag1) {
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
if (flag) {
|
||||
if (!flag1) {
|
||||
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
|
||||
} else {
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
} else {
|
||||
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.interact(world, i, j, k, entityhuman);
|
||||
this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (this.material == Material.ORE) {
|
||||
return true;
|
||||
} else {
|
||||
int l = this.e((IBlockAccess) world, i, j, k);
|
||||
int i1 = l & 7;
|
||||
int i1 = this.b_(world, i, j, k);
|
||||
int j1 = i1 & 7;
|
||||
|
||||
i1 ^= 4;
|
||||
if ((l & 8) != 0) {
|
||||
world.setData(i, j - 1, k, i1);
|
||||
world.b(i, j - 1, k, i, j, k);
|
||||
j1 ^= 4;
|
||||
if ((i1 & 8) == 0) {
|
||||
world.setData(i, j, k, j1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
} else {
|
||||
world.setData(i, j, k, i1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.setData(i, j - 1, k, j1);
|
||||
world.d(i, j - 1, k, i, j, k);
|
||||
}
|
||||
|
||||
world.a(entityhuman, 1003, i, j, k, 0);
|
||||
@ -123,19 +131,19 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
|
||||
public void setDoor(World world, int i, int j, int k, boolean flag) {
|
||||
int l = this.e((IBlockAccess) world, i, j, k);
|
||||
int l = this.b_(world, i, j, k);
|
||||
boolean flag1 = (l & 4) != 0;
|
||||
|
||||
if (flag1 != flag) {
|
||||
int i1 = l & 7;
|
||||
|
||||
i1 ^= 4;
|
||||
if ((l & 8) != 0) {
|
||||
world.setData(i, j - 1, k, i1);
|
||||
world.b(i, j - 1, k, i, j, k);
|
||||
} else {
|
||||
if ((l & 8) == 0) {
|
||||
world.setData(i, j, k, i1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
} else {
|
||||
world.setData(i, j - 1, k, i1);
|
||||
world.d(i, j - 1, k, i, j, k);
|
||||
}
|
||||
|
||||
world.a((EntityHuman) null, 1003, i, j, k, 0);
|
||||
@ -145,14 +153,7 @@ public class BlockDoor extends Block {
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) != 0) {
|
||||
if (world.getTypeId(i, j - 1, k) != this.id) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
else if (l > 0 && l != this.id) { // CraftBukkit
|
||||
this.doPhysics(world, i, j - 1, k, l);
|
||||
}
|
||||
} else {
|
||||
if ((i1 & 8) == 0) {
|
||||
boolean flag = false;
|
||||
|
||||
if (world.getTypeId(i, j + 1, k) != this.id) {
|
||||
@ -160,7 +161,7 @@ public class BlockDoor extends Block {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i, j - 1, k)) {
|
||||
if (!world.t(i, j - 1, k)) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
flag = true;
|
||||
if (world.getTypeId(i, j + 1, k) == this.id) {
|
||||
@ -170,7 +171,7 @@ public class BlockDoor extends Block {
|
||||
|
||||
if (flag) {
|
||||
if (!world.isStatic) {
|
||||
this.b(world, i, j, k, i1, 0);
|
||||
this.c(world, i, j, k, i1, 0);
|
||||
}
|
||||
// CraftBukkit start
|
||||
} else if (l > 0 && Block.byId[l].isPowerSource()) {
|
||||
@ -191,6 +192,13 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
if (world.getTypeId(i, j - 1, k) != this.id) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
else if (l > 0 && l != this.id) { // CraftBukkit
|
||||
this.doPhysics(world, i, j - 1, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,14 +212,14 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return j >= 255 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
|
||||
return j >= 255 ? false : world.t(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
|
||||
}
|
||||
|
||||
public int g() {
|
||||
public int e() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int e(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
public int b_(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.getData(i, j, k);
|
||||
boolean flag = (l & 8) != 0;
|
||||
int i1;
|
||||
@ -226,8 +234,7 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
|
||||
boolean flag1 = (j1 & 1) != 0;
|
||||
int k1 = i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0);
|
||||
|
||||
return k1;
|
||||
return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0);
|
||||
}
|
||||
}
|
||||
|
@ -11,22 +11,22 @@ public class BlockDragonEgg extends Block {
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
this.g(world, i, j, k);
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
|
||||
byte b0 = 32;
|
||||
|
||||
if (!BlockSand.instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
if (!BlockSand.instaFall && world.c(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
// CraftBukkit - added data
|
||||
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
|
||||
|
||||
@ -45,16 +45,16 @@ public class BlockDragonEgg extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.h(world, i, j, k);
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
this.n(world, i, j, k);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.h(world, i, j, k);
|
||||
this.n(world, i, j, k);
|
||||
}
|
||||
|
||||
private void h(World world, int i, int j, int k) {
|
||||
private void n(World world, int i, int j, int k) {
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
if (!world.isStatic) {
|
||||
for (int l = 0; l < 1000; ++l) {
|
||||
@ -72,6 +72,7 @@ public class BlockDragonEgg extends Block {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
i1 = event.getToBlock().getX();
|
||||
j1 = event.getToBlock().getY();
|
||||
k1 = event.getToBlock().getZ();
|
||||
@ -100,23 +101,19 @@ public class BlockDragonEgg extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return super.canPlace(world, i, j, k);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 27;
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,18 @@ public class BlockFire extends Block {
|
||||
|
||||
protected BlockFire(int i, int j) {
|
||||
super(i, j, Material.FIRE);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public void k() {
|
||||
public void r_() {
|
||||
this.a(Block.WOOD.id, 5, 20);
|
||||
this.a(Block.WOOD_DOUBLE_STEP.id, 5, 20);
|
||||
this.a(Block.WOOD_STEP.id, 5, 20);
|
||||
this.a(Block.FENCE.id, 5, 20);
|
||||
this.a(Block.WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.BIRCH_WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.SPRUCE_WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.JUNGLE_WOOD_STAIRS.id, 5, 20);
|
||||
this.a(Block.LOG.id, 5, 5);
|
||||
this.a(Block.LEAVES.id, 30, 60);
|
||||
this.a(Block.BOOKSHELF.id, 30, 20);
|
||||
@ -40,15 +45,15 @@ public class BlockFire extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ -56,11 +61,11 @@ public class BlockFire extends Block {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(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 WorldProviderTheEnd && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
|
||||
@ -68,11 +73,11 @@ public class BlockFire extends Block {
|
||||
}
|
||||
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
if (!flag && world.x() && (world.y(i, j, k) || world.y(i - 1, j, k) || world.y(i + 1, j, k) || world.y(i, j, k - 1) || world.y(i, j, k + 1))) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
|
||||
if (!flag && world.J() && (world.B(i, j, k) || world.B(i - 1, j, k) || world.B(i + 1, j, k) || world.B(i, j, k - 1) || world.B(i, j, k + 1))) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
|
||||
} else {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
@ -80,15 +85,15 @@ public class BlockFire extends Block {
|
||||
world.setRawData(i, j, k, l + random.nextInt(3) / 2);
|
||||
}
|
||||
|
||||
world.c(i, j, k, this.id, this.d() + random.nextInt(10));
|
||||
if (!flag && !this.g(world, i, j, k)) {
|
||||
if (!world.e(i, j - 1, k) || l > 3) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
|
||||
world.a(i, j, k, this.id, this.p_() + random.nextInt(10));
|
||||
if (!flag && !this.l(world, i, j, k)) {
|
||||
if (!world.t(i, j - 1, k) || l > 3) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
|
||||
}
|
||||
} else if (!flag && !this.c(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
|
||||
} else if (!flag && !this.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
|
||||
} else {
|
||||
boolean flag1 = world.z(i, j, k);
|
||||
boolean flag1 = world.C(i, j, k);
|
||||
byte b0 = 0;
|
||||
|
||||
if (flag1) {
|
||||
@ -102,7 +107,7 @@ public class BlockFire extends Block {
|
||||
this.a(world, i, j, k - 1, 300 + b0, random, l);
|
||||
this.a(world, i, j, k + 1, 300 + b0, random, l);
|
||||
|
||||
// CraftBukkit start - Call to stop spread of fire.
|
||||
// CraftBukkit start - call to stop spread of fire
|
||||
org.bukkit.Server server = world.getServer();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
|
||||
@ -120,7 +125,7 @@ public class BlockFire extends Block {
|
||||
l1 += (k1 - (j + 1)) * 100;
|
||||
}
|
||||
|
||||
int i2 = this.h(world, i1, k1, j1);
|
||||
int i2 = this.n(world, i1, k1, j1);
|
||||
|
||||
if (i2 > 0) {
|
||||
int j2 = (i2 + 40) / (l + 30);
|
||||
@ -129,13 +134,14 @@ public class BlockFire extends Block {
|
||||
j2 /= 2;
|
||||
}
|
||||
|
||||
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.x() || !world.y(i1, k1, j1)) && !world.y(i1 - 1, k1, k) && !world.y(i1 + 1, k1, j1) && !world.y(i1, k1, j1 - 1) && !world.y(i1, k1, j1 + 1)) {
|
||||
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.J() || !world.B(i1, k1, j1)) && !world.B(i1 - 1, k1, k) && !world.B(i1 + 1, k1, j1) && !world.B(i1, k1, j1 - 1) && !world.B(i1, k1, j1 + 1)) {
|
||||
int k2 = l + random.nextInt(5) / 4;
|
||||
|
||||
if (k2 > 15) {
|
||||
k2 = 15;
|
||||
}
|
||||
// CraftBukkit start - Call to stop spread of fire.
|
||||
|
||||
// CraftBukkit start - call to stop spread of fire
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i1, k1, j1);
|
||||
|
||||
if (block.getTypeId() != Block.FIRE.id) {
|
||||
@ -173,6 +179,7 @@ public class BlockFire extends Block {
|
||||
|
||||
if (random.nextInt(l) < j1) {
|
||||
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
@ -184,7 +191,7 @@ public class BlockFire extends Block {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (random.nextInt(i1 + 10) < 5 && !world.y(i, j, k)) {
|
||||
if (random.nextInt(i1 + 10) < 5 && !world.B(i, j, k)) {
|
||||
int k1 = i1 + random.nextInt(5) / 4;
|
||||
|
||||
if (k1 > 15) {
|
||||
@ -202,60 +209,61 @@ public class BlockFire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
return this.c(world, i + 1, j, k) ? true : (this.c(world, i - 1, j, k) ? true : (this.c(world, i, j - 1, k) ? true : (this.c(world, i, j + 1, k) ? true : (this.c(world, i, j, k - 1) ? true : this.c(world, i, j, k + 1)))));
|
||||
private boolean l(World world, int i, int j, int k) {
|
||||
return this.d((IBlockAccess) world, i + 1, j, k) ? true : (this.d((IBlockAccess) world, i - 1, j, k) ? true : (this.d((IBlockAccess) world, i, j - 1, k) ? true : (this.d((IBlockAccess) world, i, j + 1, k) ? true : (this.d((IBlockAccess) world, i, j, k - 1) ? true : this.d((IBlockAccess) world, i, j, k + 1)))));
|
||||
}
|
||||
|
||||
private int h(World world, int i, int j, int k) {
|
||||
private int n(World world, int i, int j, int k) {
|
||||
byte b0 = 0;
|
||||
|
||||
if (!world.isEmpty(i, j, k)) {
|
||||
return 0;
|
||||
} else {
|
||||
int l = this.f(world, i + 1, j, k, b0);
|
||||
int l = this.e(world, i + 1, j, k, b0);
|
||||
|
||||
l = this.f(world, i - 1, j, k, l);
|
||||
l = this.f(world, i, j - 1, k, l);
|
||||
l = this.f(world, i, j + 1, k, l);
|
||||
l = this.f(world, i, j, k - 1, l);
|
||||
l = this.f(world, i, j, k + 1, l);
|
||||
l = this.e(world, i - 1, j, k, l);
|
||||
l = this.e(world, i, j - 1, k, l);
|
||||
l = this.e(world, i, j + 1, k, l);
|
||||
l = this.e(world, i, j, k - 1, l);
|
||||
l = this.e(world, i, j, k + 1, l);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean E_() {
|
||||
public boolean l() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
|
||||
}
|
||||
|
||||
public int f(World world, int i, int j, int k, int l) {
|
||||
public int e(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.a[world.getTypeId(i, j, k)];
|
||||
|
||||
return i1 > l ? i1 : l;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.e(i, j - 1, k) || this.g(world, i, j, k);
|
||||
return world.t(i, j - 1, k) || this.l(world, i, j, k);
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone
|
||||
if (!world.t(i, j - 1, k) && !this.l(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) {
|
||||
if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
|
||||
if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.i_(world, i, j, k)) {
|
||||
if (!world.t(i, j - 1, k) && !this.l(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
|
||||
} else {
|
||||
world.c(i, j, k, this.id, this.d() + world.random.nextInt(10));
|
||||
world.a(i, j, k, this.id, this.p_() + world.random.nextInt(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
private void fireExtinguished(World world, int x, int y, int z) {
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled() == false) {
|
||||
|
@ -17,26 +17,25 @@ public class BlockFlowing extends BlockFluids {
|
||||
super(i, material);
|
||||
}
|
||||
|
||||
private void i(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.setRawTypeIdAndData(i, j, k, this.id + 1, l);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.notify(i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.material != Material.LAVA;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.Server server = world.getServer();
|
||||
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
|
||||
// CraftBukkit end
|
||||
|
||||
int l = this.g(world, i, j, k);
|
||||
int l = this.f_(world, i, j, k);
|
||||
byte b0 = 1;
|
||||
|
||||
if (this.material == Material.LAVA && !world.worldProvider.d) {
|
||||
@ -50,18 +49,18 @@ public class BlockFlowing extends BlockFluids {
|
||||
byte b1 = -100;
|
||||
|
||||
this.a = 0;
|
||||
int j1 = this.f(world, i - 1, j, k, b1);
|
||||
int j1 = this.e(world, i - 1, j, k, b1);
|
||||
|
||||
j1 = this.f(world, i + 1, j, k, j1);
|
||||
j1 = this.f(world, i, j, k - 1, j1);
|
||||
j1 = this.f(world, i, j, k + 1, j1);
|
||||
j1 = this.e(world, i + 1, j, k, j1);
|
||||
j1 = this.e(world, i, j, k - 1, j1);
|
||||
j1 = this.e(world, i, j, k + 1, j1);
|
||||
i1 = j1 + b0;
|
||||
if (i1 >= 8 || j1 < 0) {
|
||||
i1 = -1;
|
||||
}
|
||||
|
||||
if (this.g(world, i, j + 1, k) >= 0) {
|
||||
int k1 = this.g(world, i, j + 1, k);
|
||||
if (this.f_(world, i, j + 1, k) >= 0) {
|
||||
int k1 = this.f_(world, i, j + 1, k);
|
||||
|
||||
if (k1 >= 8) {
|
||||
i1 = k1;
|
||||
@ -83,23 +82,25 @@ public class BlockFlowing extends BlockFluids {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (i1 != l) {
|
||||
if (i1 == l) {
|
||||
if (flag) {
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
} else {
|
||||
l = i1;
|
||||
if (i1 < 0) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
world.setData(i, j, k, i1);
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
}
|
||||
} else if (flag) {
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
} else {
|
||||
this.i(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
|
||||
if (this.l(world, i, j - 1, k)) {
|
||||
if (this.p(world, i, j - 1, k)) {
|
||||
// CraftBukkit start - send "down" to the server
|
||||
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
|
||||
if (server != null) {
|
||||
@ -114,14 +115,14 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
|
||||
if (l >= 8) {
|
||||
world.setTypeIdAndData(i, j - 1, k, this.id, l);
|
||||
this.flow(world, i, j - 1, k, l);
|
||||
} else {
|
||||
world.setTypeIdAndData(i, j - 1, k, this.id, l + 8);
|
||||
this.flow(world, i, j - 1, k, l + 8);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else if (l >= 0 && (l == 0 || this.k(world, i, j - 1, k))) {
|
||||
boolean[] aboolean = this.j(world, i, j, k);
|
||||
} else if (l >= 0 && (l == 0 || this.o(world, i, j - 1, k))) {
|
||||
boolean[] aboolean = this.n(world, i, j, k);
|
||||
|
||||
i1 = l + b0;
|
||||
if (l >= 8) {
|
||||
@ -155,14 +156,14 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
|
||||
private void flow(World world, int i, int j, int k, int l) {
|
||||
if (this.l(world, i, j, k)) {
|
||||
if (this.p(world, i, j, k)) {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (i1 > 0) {
|
||||
if (this.material == Material.LAVA) {
|
||||
this.fizz(world, i, j, k);
|
||||
} else {
|
||||
Block.byId[i1].b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
Block.byId[i1].c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +171,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
private int c(World world, int i, int j, int k, int l, int i1) {
|
||||
private int d(World world, int i, int j, int k, int l, int i1) {
|
||||
int j1 = 1000;
|
||||
|
||||
for (int k1 = 0; k1 < 4; ++k1) {
|
||||
@ -194,13 +195,13 @@ public class BlockFlowing extends BlockFluids {
|
||||
++i2;
|
||||
}
|
||||
|
||||
if (!this.k(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
|
||||
if (!this.k(world, l1, j - 1, i2)) {
|
||||
if (!this.o(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
|
||||
if (!this.o(world, l1, j - 1, i2)) {
|
||||
return l;
|
||||
}
|
||||
|
||||
if (l < 4) {
|
||||
int j2 = this.c(world, l1, j, i2, l + 1, k1);
|
||||
int j2 = this.d(world, l1, j, i2, l + 1, k1);
|
||||
|
||||
if (j2 < j1) {
|
||||
j1 = j2;
|
||||
@ -213,7 +214,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
return j1;
|
||||
}
|
||||
|
||||
private boolean[] j(World world, int i, int j, int k) {
|
||||
private boolean[] n(World world, int i, int j, int k) {
|
||||
int l;
|
||||
int i1;
|
||||
|
||||
@ -238,11 +239,11 @@ public class BlockFlowing extends BlockFluids {
|
||||
++j1;
|
||||
}
|
||||
|
||||
if (!this.k(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
|
||||
if (!this.k(world, i1, j - 1, j1)) {
|
||||
this.c[l] = 0;
|
||||
if (!this.o(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
|
||||
if (this.o(world, i1, j - 1, j1)) {
|
||||
this.c[l] = this.d(world, i1, j, j1, 1, l);
|
||||
} else {
|
||||
this.c[l] = this.c(world, i1, j, j1, 1, l);
|
||||
this.c[l] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -262,7 +263,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
private boolean k(World world, int i, int j, int k) {
|
||||
private boolean o(World world, int i, int j, int k) {
|
||||
int l = world.getTypeId(i, j, k);
|
||||
|
||||
if (l != Block.WOODEN_DOOR.id && l != Block.IRON_DOOR_BLOCK.id && l != Block.SIGN_POST.id && l != Block.LADDER.id && l != Block.SUGAR_CANE_BLOCK.id) {
|
||||
@ -278,8 +279,8 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
protected int f(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.g(world, i, j, k);
|
||||
protected int e(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.f_(world, i, j, k);
|
||||
|
||||
if (i1 < 0) {
|
||||
return l;
|
||||
@ -296,16 +297,16 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean l(World world, int i, int j, int k) {
|
||||
private boolean p(World world, int i, int j, int k) {
|
||||
Material material = world.getMaterial(i, j, k);
|
||||
|
||||
return material == this.material ? false : (material == Material.LAVA ? false : !this.k(world, i, j, k));
|
||||
return material == this.material ? false : (material == Material.LAVA ? false : !this.o(world, i, j, k));
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
super.onPlace(world, i, j, k);
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,17 +13,18 @@ public class BlockGrass extends Block {
|
||||
protected BlockGrass(int i) {
|
||||
super(i, Material.GRASS);
|
||||
this.textureId = 3;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.b);
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return i == 1 ? 0 : (i == 0 ? 2 : 3);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
|
||||
// CraftBukkit start - reuse getLightLevel
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
BlockState blockState = bworld.getBlockAt(i, j, k).getState();
|
||||
blockState.setTypeId(Block.DIRT.id);
|
||||
@ -46,7 +47,7 @@ public class BlockGrass extends Block {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
blockState.setTypeId(Block.GRASS.id);
|
||||
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -7,15 +7,33 @@ public class BlockIce extends BlockHalfTransparant {
|
||||
public BlockIce(int i, int j) {
|
||||
super(i, j, Material.ICE, false);
|
||||
this.frictionFactor = 0.98F;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.b);
|
||||
}
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
super.a(world, entityhuman, i, j, k, l);
|
||||
Material material = world.getMaterial(i, j - 1, k);
|
||||
entityhuman.a(StatisticList.C[this.id], 1);
|
||||
entityhuman.j(0.025F);
|
||||
if (this.q_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
|
||||
ItemStack itemstack = this.c_(l);
|
||||
|
||||
if (material.isSolid() || material.isLiquid()) {
|
||||
world.setTypeId(i, j, k, Block.WATER.id);
|
||||
if (itemstack != null) {
|
||||
this.a(world, i, j, k, itemstack);
|
||||
}
|
||||
} else {
|
||||
if (world.worldProvider.d) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory);
|
||||
|
||||
this.c(world, i, j, k, l, i1);
|
||||
Material material = world.getMaterial(i, j - 1, k);
|
||||
|
||||
if (material.isSolid() || material.isLiquid()) {
|
||||
world.setTypeId(i, j, k, Block.WATER.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,24 +41,25 @@ public class BlockIce extends BlockHalfTransparant {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
if (world.worldProvider.d) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, Block.STATIONARY_WATER.id);
|
||||
}
|
||||
}
|
||||
|
||||
public int g() {
|
||||
public int e() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected ItemStack a_(int i) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -6,29 +6,31 @@ import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
|
||||
|
||||
public class BlockLeaves extends BlockTransparant {
|
||||
|
||||
private int c;
|
||||
int[] a;
|
||||
private int cr;
|
||||
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
|
||||
int[] b;
|
||||
|
||||
protected BlockLeaves(int i, int j) {
|
||||
super(i, j, Material.LEAVES, false);
|
||||
this.c = j;
|
||||
this.a(true);
|
||||
this.cr = j;
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.c);
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
byte b0 = 1;
|
||||
int l = b0 + 1;
|
||||
int j1 = b0 + 1;
|
||||
|
||||
if (world.a(i - l, j - l, k - l, i + l, j + l, k + l)) {
|
||||
for (int i1 = -b0; i1 <= b0; ++i1) {
|
||||
for (int j1 = -b0; j1 <= b0; ++j1) {
|
||||
for (int k1 = -b0; k1 <= b0; ++k1) {
|
||||
int l1 = world.getTypeId(i + i1, j + j1, k + k1);
|
||||
if (world.c(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
|
||||
for (int k1 = -b0; k1 <= b0; ++k1) {
|
||||
for (int l1 = -b0; l1 <= b0; ++l1) {
|
||||
for (int i2 = -b0; i2 <= b0; ++i2) {
|
||||
int j2 = world.getTypeId(i + k1, j + l1, k + i2);
|
||||
|
||||
if (l1 == Block.LEAVES.id) {
|
||||
int i2 = world.getData(i + i1, j + j1, k + k1);
|
||||
if (j2 == Block.LEAVES.id) {
|
||||
int k2 = world.getData(i + k1, j + l1, k + i2);
|
||||
|
||||
world.setRawData(i + i1, j + j1, k + k1, i2 | 8);
|
||||
world.setRawData(i + k1, j + l1, k + i2, k2 | 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -36,7 +38,7 @@ public class BlockLeaves extends BlockTransparant {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
@ -47,13 +49,13 @@ public class BlockLeaves extends BlockTransparant {
|
||||
int j1 = b1 * b1;
|
||||
int k1 = b1 / 2;
|
||||
|
||||
if (this.a == null) {
|
||||
this.a = new int[b1 * b1 * b1];
|
||||
if (this.b == null) {
|
||||
this.b = new int[b1 * b1 * b1];
|
||||
}
|
||||
|
||||
int l1;
|
||||
|
||||
if (world.a(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
|
||||
if (world.c(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
@ -63,11 +65,11 @@ public class BlockLeaves extends BlockTransparant {
|
||||
for (j2 = -b0; j2 <= b0; ++j2) {
|
||||
k2 = world.getTypeId(i + l1, j + i2, k + j2);
|
||||
if (k2 == Block.LOG.id) {
|
||||
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
|
||||
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
|
||||
} else if (k2 == Block.LEAVES.id) {
|
||||
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
||||
} else {
|
||||
this.a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,29 +79,29 @@ public class BlockLeaves extends BlockTransparant {
|
||||
for (i2 = -b0; i2 <= b0; ++i2) {
|
||||
for (j2 = -b0; j2 <= b0; ++j2) {
|
||||
for (k2 = -b0; k2 <= b0; ++k2) {
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
|
||||
if (this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
|
||||
if (this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
|
||||
}
|
||||
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
|
||||
}
|
||||
|
||||
if (this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
|
||||
this.a[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
|
||||
this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,25 +110,27 @@ public class BlockLeaves extends BlockTransparant {
|
||||
}
|
||||
}
|
||||
|
||||
l1 = this.a[k1 * j1 + k1 * b1 + k1];
|
||||
l1 = this.b[k1 * j1 + k1 * b1 + k1];
|
||||
if (l1 >= 0) {
|
||||
world.setRawData(i, j, k, l & -9);
|
||||
} else {
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
// CraftBukkit start
|
||||
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
|
||||
@ -159,7 +163,7 @@ public class BlockLeaves extends BlockTransparant {
|
||||
}
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
if (!world.isStatic && entityhuman.U() != null && entityhuman.U().id == Item.SHEARS.id) {
|
||||
if (!world.isStatic && entityhuman.bC() != null && entityhuman.bC().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 {
|
||||
@ -171,15 +175,11 @@ public class BlockLeaves extends BlockTransparant {
|
||||
return i & 3;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return !this.b;
|
||||
public boolean d() {
|
||||
return !this.c;
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return (j & 3) == 1 ? this.textureId + 80 : ((j & 3) == 3 ? this.textureId + 144 : this.textureId);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Entity entity) {
|
||||
super.b(world, i, j, k, entity);
|
||||
}
|
||||
}
|
||||
|
@ -6,105 +6,143 @@ public class BlockLever extends Block {
|
||||
|
||||
protected BlockLever(int i, int j) {
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
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))));
|
||||
return l == 0 && world.s(i, j + 1, k) ? true : (l == 1 && world.t(i, j - 1, k) ? true : (l == 2 && world.s(i, j, k + 1) ? true : (l == 3 && world.s(i, j, k - 1) ? true : (l == 4 && world.s(i + 1, j, k) ? true : l == 5 && world.s(i - 1, j, k)))));
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.e(i - 1, j, k) ? true : (world.e(i + 1, j, k) ? true : (world.e(i, j, k - 1) ? true : (world.e(i, j, k + 1) ? true : world.e(i, j - 1, k))));
|
||||
return world.s(i - 1, j, k) ? true : (world.s(i + 1, j, k) ? true : (world.s(i, j, k - 1) ? true : (world.s(i, j, k + 1) ? true : (world.t(i, j - 1, k) ? true : world.s(i, j + 1, k)))));
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) {
|
||||
public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
int j1 = i1 & 8;
|
||||
|
||||
i1 &= 7;
|
||||
i1 = -1;
|
||||
if (l == 1 && world.e(i, j - 1, k)) {
|
||||
if (l == 0 && world.s(i, j + 1, k)) {
|
||||
i1 = world.random.nextBoolean() ? 0 : 7;
|
||||
}
|
||||
|
||||
if (l == 1 && world.t(i, j - 1, k)) {
|
||||
i1 = 5 + world.random.nextInt(2);
|
||||
}
|
||||
|
||||
if (l == 2 && world.e(i, j, k + 1)) {
|
||||
if (l == 2 && world.s(i, j, k + 1)) {
|
||||
i1 = 4;
|
||||
}
|
||||
|
||||
if (l == 3 && world.e(i, j, k - 1)) {
|
||||
if (l == 3 && world.s(i, j, k - 1)) {
|
||||
i1 = 3;
|
||||
}
|
||||
|
||||
if (l == 4 && world.e(i + 1, j, k)) {
|
||||
if (l == 4 && world.s(i + 1, j, k)) {
|
||||
i1 = 2;
|
||||
}
|
||||
|
||||
if (l == 5 && world.e(i - 1, j, k)) {
|
||||
if (l == 5 && world.s(i - 1, j, k)) {
|
||||
i1 = 1;
|
||||
}
|
||||
|
||||
if (i1 == -1) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
world.setData(i, j, k, i1 + j1);
|
||||
}
|
||||
}
|
||||
|
||||
public static int d(int i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return 0;
|
||||
|
||||
case 1:
|
||||
return 5;
|
||||
|
||||
case 2:
|
||||
return 4;
|
||||
|
||||
case 3:
|
||||
return 3;
|
||||
|
||||
case 4:
|
||||
return 2;
|
||||
|
||||
case 5:
|
||||
return 1;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (this.g(world, i, j, k)) {
|
||||
if (this.l(world, i, j, k)) {
|
||||
int i1 = world.getData(i, j, k) & 7;
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.e(i - 1, j, k) && i1 == 1) {
|
||||
if (!world.s(i - 1, j, k) && i1 == 1) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i + 1, j, k) && i1 == 2) {
|
||||
if (!world.s(i + 1, j, k) && i1 == 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i, j, k - 1) && i1 == 3) {
|
||||
if (!world.s(i, j, k - 1) && i1 == 3) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i, j, k + 1) && i1 == 4) {
|
||||
if (!world.s(i, j, k + 1) && i1 == 4) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i, j - 1, k) && i1 == 5) {
|
||||
if (!world.t(i, j - 1, k) && i1 == 5) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.e(i, j - 1, k) && i1 == 6) {
|
||||
if (!world.t(i, j - 1, k) && i1 == 6) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.s(i, j + 1, k) && i1 == 0) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.s(i, j + 1, k) && i1 == 7) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
private boolean l(World world, int i, int j, int k) {
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return false;
|
||||
} else {
|
||||
@ -124,6 +162,11 @@ public class BlockLever extends Block {
|
||||
this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
|
||||
} else if (l == 4) {
|
||||
this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
|
||||
} else if (l != 5 && l != 6) {
|
||||
if (l == 0 || l == 7) {
|
||||
f = 0.25F;
|
||||
this.a(0.5F - f, 0.4F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
|
||||
}
|
||||
} else {
|
||||
f = 0.25F;
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
|
||||
@ -131,42 +174,46 @@ public class BlockLever extends Block {
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.interact(world, i, j, k, entityhuman);
|
||||
this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
int j1 = 8 - (l & 8);
|
||||
int i1 = world.getData(i, j, k);
|
||||
int j1 = i1 & 7;
|
||||
int k1 = 8 - (i1 & 8);
|
||||
|
||||
// CraftBukkit start - Interact Lever
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
int old = (k1 != 8) ? 1 : 0;
|
||||
int current = (k1 == 8) ? 1 : 0;
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8)) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setData(i, j, k, i1 + j1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, j1 > 0 ? 0.6F : 0.5F);
|
||||
world.setData(i, j, k, j1 + k1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F);
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
if (i1 == 1) {
|
||||
if (j1 == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
} else if (j1 == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
} else if (j1 == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
} else if (j1 == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
} else if (j1 != 5 && j1 != 6) {
|
||||
if (j1 == 0 || j1 == 7) {
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
}
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
@ -175,34 +222,36 @@ public class BlockLever extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) > 0) {
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
if ((i1 & 8) > 0) {
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
int i1 = l & 7;
|
||||
int j1 = i1 & 7;
|
||||
|
||||
if (i1 == 1) {
|
||||
if (j1 == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
} else if (j1 == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
} else if (j1 == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
} else if (j1 == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
} else if (j1 != 5 && j1 != 6) {
|
||||
if (j1 == 0 || j1 == 7) {
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
}
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
super.remove(world, i, j, k);
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.getData(i, j, k) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
@ -210,7 +259,7 @@ public class BlockLever extends Block {
|
||||
} else {
|
||||
int j1 = i1 & 7;
|
||||
|
||||
return j1 == 6 && l == 1 ? true : (j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5))));
|
||||
return j1 == 0 && l == 0 ? true : (j1 == 7 && l == 0 ? true : (j1 == 6 && l == 1 ? true : (j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5))))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,10 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
|
||||
public BlockMinecartDetector(int i, int j) {
|
||||
super(i, j, true);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@ -25,17 +25,17 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) == 0) {
|
||||
this.f(world, i, j, k, l);
|
||||
this.e(world, i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) != 0) {
|
||||
this.f(world, i, j, k, l);
|
||||
this.e(world, i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -44,17 +44,17 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
return (iblockaccess.getData(i, j, k) & 8) != 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return (world.getData(i, j, k) & 8) == 0 ? false : l == 1;
|
||||
}
|
||||
|
||||
private void f(World world, int i, int j, int k, int l) {
|
||||
private void e(World world, int i, int j, int k, int l) {
|
||||
boolean flag = (l & 8) != 0;
|
||||
boolean flag1 = false;
|
||||
float f = 0.125F;
|
||||
List list = world.a(EntityMinecart.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
|
||||
List list = world.a(EntityMinecart.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
|
||||
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
@ -73,18 +73,18 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
world.setData(i, j, k, l | 8);
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
}
|
||||
|
||||
if (!flag1 && flag) {
|
||||
world.setData(i, j, k, l & 7);
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class BlockMinecartTrack extends Block {
|
||||
|
||||
private final boolean a;
|
||||
|
||||
public static final boolean g(World world, int i, int j, int k) {
|
||||
public static final boolean d_(World world, int i, int j, int k) {
|
||||
int l = world.getTypeId(i, j, k);
|
||||
|
||||
return l == Block.RAILS.id || l == Block.GOLDEN_RAIL.id || l == Block.DETECTOR_RAIL.id;
|
||||
@ -20,9 +20,10 @@ public class BlockMinecartTrack extends Block {
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
this.a = flag;
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
this.a(CreativeModeTab.e);
|
||||
}
|
||||
|
||||
public boolean i() {
|
||||
public boolean n() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@ -30,7 +31,7 @@ public class BlockMinecartTrack extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -61,11 +62,11 @@ public class BlockMinecartTrack extends Block {
|
||||
return this.textureId;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@ -74,14 +75,14 @@ public class BlockMinecartTrack extends Block {
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.e(i, j - 1, k);
|
||||
return world.t(i, j - 1, k);
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
if (!world.isStatic) {
|
||||
this.a(world, i, j, k, true);
|
||||
if (this.id == Block.GOLDEN_RAIL.id) {
|
||||
// this.doPhysics(world, i, j, k, this.id); // CraftBukkit - Fix issues with rails
|
||||
// this.doPhysics(world, i, j, k, this.id); // CraftBukkit - fix issues with rails
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,28 +98,28 @@ public class BlockMinecartTrack extends Block {
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.e(i, j - 1, k)) {
|
||||
if (!world.t(i, j - 1, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (j1 == 2 && !world.e(i + 1, j, k)) {
|
||||
if (j1 == 2 && !world.t(i + 1, j, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (j1 == 3 && !world.e(i - 1, j, k)) {
|
||||
if (j1 == 3 && !world.t(i - 1, j, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (j1 == 4 && !world.e(i, j, k - 1)) {
|
||||
if (j1 == 4 && !world.t(i, j, k - 1)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (j1 == 5 && !world.e(i, j, k + 1)) {
|
||||
if (j1 == 5 && !world.t(i, j, k + 1)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else if (this.id == Block.GOLDEN_RAIL.id) {
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(i, j, k);
|
||||
@ -255,7 +256,7 @@ public class BlockMinecartTrack extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int g() {
|
||||
public int e() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,10 @@ public class BlockMushroom extends BlockFlower {
|
||||
float f = 0.2F;
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (random.nextInt(25) == 0) {
|
||||
byte b0 = 4;
|
||||
int l = 5;
|
||||
@ -49,7 +49,7 @@ public class BlockMushroom extends BlockFlower {
|
||||
k1 = k + random.nextInt(3) - 1;
|
||||
|
||||
for (int l1 = 0; l1 < 4; ++l1) {
|
||||
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
|
||||
if (world.isEmpty(i1, j1, k1) && this.d(world, i1, j1, k1)) {
|
||||
i = i1;
|
||||
j = j1;
|
||||
k = k1;
|
||||
@ -60,7 +60,7 @@ public class BlockMushroom extends BlockFlower {
|
||||
k1 = k + random.nextInt(3) - 1;
|
||||
}
|
||||
|
||||
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
|
||||
if (world.isEmpty(i1, j1, k1) && this.d(world, i1, j1, k1)) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
|
||||
@ -78,18 +78,18 @@ public class BlockMushroom extends BlockFlower {
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return super.canPlace(world, i, j, k) && this.f(world, i, j, k);
|
||||
return super.canPlace(world, i, j, k) && this.d(world, i, j, k);
|
||||
}
|
||||
|
||||
protected boolean d(int i) {
|
||||
protected boolean d_(int i) {
|
||||
return Block.n[i];
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
public boolean d(World world, int i, int j, int k) {
|
||||
if (j >= 0 && j < 256) {
|
||||
int l = world.getTypeId(i, j - 1, k);
|
||||
|
||||
return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.d(l);
|
||||
return l == Block.MYCEL.id || world.k(i, j, k) < 13 && this.d_(l);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -113,6 +113,7 @@ public class BlockMushroom extends BlockFlower {
|
||||
event = new StructureGrowEvent(location, TreeType.RED_MUSHROOM, bonemeal, player, new ArrayList<BlockState>());
|
||||
worldgenhugemushroom = new WorldGenHugeMushroom(1);
|
||||
}
|
||||
|
||||
if (worldgenhugemushroom != null && event != null) {
|
||||
grown = worldgenhugemushroom.grow((org.bukkit.BlockChangeDelegate)world, random, i, j, k, event, itemstack, world.getWorld());
|
||||
if (event.isFromBonemeal() && itemstack != null) {
|
||||
|
@ -13,14 +13,15 @@ public class BlockMycel extends Block {
|
||||
protected BlockMycel(int i) {
|
||||
super(i, Material.GRASS);
|
||||
this.textureId = 77;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.b);
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return i == 1 ? 78 : (i == 0 ? 2 : 77);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
|
||||
// CraftBukkit start
|
||||
|
@ -6,39 +6,36 @@ public class BlockNetherWart extends BlockFlower {
|
||||
|
||||
protected BlockNetherWart(int i) {
|
||||
super(i, 226);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
float f = 0.5F;
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
|
||||
this.a((CreativeModeTab) null);
|
||||
}
|
||||
|
||||
protected boolean d(int i) {
|
||||
protected boolean d_(int i) {
|
||||
return i == Block.SOUL_SAND.id;
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
return this.d(world.getTypeId(i, j - 1, k));
|
||||
public boolean d(World world, int i, int j, int k) {
|
||||
return this.d_(world.getTypeId(i, j - 1, k));
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l < 3) {
|
||||
BiomeBase biomebase = world.getBiome(i, k);
|
||||
|
||||
if (biomebase instanceof BiomeHell && random.nextInt(10) == 0) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
|
||||
}
|
||||
if (l < 3 && random.nextInt(10) == 0) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
|
||||
}
|
||||
|
||||
super.a(world, i, j, k, random);
|
||||
super.b(world, i, j, k, random);
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return j >= 3 ? this.textureId + 2 : (j > 0 ? this.textureId + 1 : this.textureId);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
@ -11,63 +11,64 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
public class BlockPiston extends Block {
|
||||
|
||||
private boolean a;
|
||||
private static boolean b;
|
||||
|
||||
public BlockPiston(int i, int j, boolean flag) {
|
||||
super(i, j, Material.PISTON);
|
||||
this.a = flag;
|
||||
this.a(h);
|
||||
this.c(0.5F);
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
int k = d(j);
|
||||
int k = e(j);
|
||||
|
||||
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 == Facing.OPPOSITE_FACING[k] ? 109 : 108));
|
||||
return k > 5 ? this.textureId : (i == k ? (!f(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == Facing.OPPOSITE_FACING[k] ? 109 : 108));
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
|
||||
int l = c(world, i, j, k, (EntityHuman) entityliving);
|
||||
int l = b(world, i, j, k, (EntityHuman) entityliving);
|
||||
|
||||
world.setData(i, j, k, l);
|
||||
if (!world.isStatic && !b) {
|
||||
this.g(world, i, j, k);
|
||||
if (!world.isStatic) {
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic && !b) {
|
||||
this.g(world, i, j, k);
|
||||
if (!world.isStatic) {
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
if (!world.isStatic && world.getTileEntity(i, j, k) == null && !b) {
|
||||
this.g(world, i, j, k);
|
||||
if (!world.isStatic && world.getTileEntity(i, j, k) == null) {
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = d(l);
|
||||
boolean flag = this.f(world, i, j, k, i1);
|
||||
int i1 = e(l);
|
||||
|
||||
if (l != 7) {
|
||||
if (flag && !e(l)) {
|
||||
if (i1 != 7) {
|
||||
boolean flag = this.e(world, i, j, k, i1);
|
||||
|
||||
if (flag && !f(l)) {
|
||||
// CraftBukkit start
|
||||
int length = g(world, i, j, k, i1);
|
||||
int length = i(world, i, j, k, i1);
|
||||
if (length >= 0) {
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
@ -79,10 +80,9 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setRawData(i, j, k, i1 | 8);
|
||||
world.playNote(i, j, k, 0, i1);
|
||||
world.playNote(i, j, k, this.id, 0, i1);
|
||||
}
|
||||
} else if (!flag && e(l)) {
|
||||
} else if (!flag && f(l)) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
@ -94,20 +94,24 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setRawData(i, j, k, i1);
|
||||
world.playNote(i, j, k, 1, i1);
|
||||
world.playNote(i, j, k, this.id, 1, i1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean f(World world, int i, int j, int k, int l) {
|
||||
private boolean e(World world, int i, int j, int k, int l) {
|
||||
return l != 0 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : (world.isBlockFaceIndirectlyPowered(i, j, k, 0) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 2, k, 1) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFaceIndirectlyPowered(i - 1, j + 1, k, 4) ? true : world.isBlockFaceIndirectlyPowered(i + 1, j + 1, k, 5)))))))))));
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, int i1) {
|
||||
b = true;
|
||||
public void b(World world, int i, int j, int k, int l, int i1) {
|
||||
if (l == 0) {
|
||||
if (this.h(world, i, j, k, i1)) {
|
||||
world.setRawData(i, j, k, i1 | 8);
|
||||
} else {
|
||||
world.setRawData(i, j, k, i1);
|
||||
}
|
||||
|
||||
if (l == 0) {
|
||||
if (this.j(world, i, j, k, i1)) {
|
||||
world.setData(i, j, k, i1 | 8);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
|
||||
} else {
|
||||
@ -116,8 +120,8 @@ public class BlockPiston extends Block {
|
||||
} else if (l == 1) {
|
||||
TileEntity tileentity = world.getTileEntity(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
|
||||
|
||||
if (tileentity != null && tileentity instanceof TileEntityPiston) {
|
||||
((TileEntityPiston) tileentity).g();
|
||||
if (tileentity instanceof TileEntityPiston) {
|
||||
((TileEntityPiston) tileentity).i();
|
||||
}
|
||||
|
||||
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
|
||||
@ -133,49 +137,41 @@ public class BlockPiston extends Block {
|
||||
if (i2 == Block.PISTON_MOVING.id) {
|
||||
TileEntity tileentity1 = world.getTileEntity(j1, k1, l1);
|
||||
|
||||
if (tileentity1 != null && tileentity1 instanceof TileEntityPiston) {
|
||||
if (tileentity1 instanceof TileEntityPiston) {
|
||||
TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1;
|
||||
|
||||
if (tileentitypiston.f() == i1 && tileentitypiston.e()) {
|
||||
tileentitypiston.g();
|
||||
i2 = tileentitypiston.c();
|
||||
j2 = tileentitypiston.k();
|
||||
if (tileentitypiston.c() == i1 && tileentitypiston.b()) {
|
||||
tileentitypiston.i();
|
||||
i2 = tileentitypiston.a();
|
||||
j2 = tileentitypiston.n();
|
||||
flag = 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)) {
|
||||
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)) {
|
||||
i += Facing.b[i1];
|
||||
j += Facing.c[i1];
|
||||
k += Facing.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) {
|
||||
b = false;
|
||||
world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
|
||||
b = true;
|
||||
}
|
||||
} else {
|
||||
b = false;
|
||||
world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
|
||||
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);
|
||||
}
|
||||
|
||||
b = false;
|
||||
}
|
||||
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.getData(i, j, k);
|
||||
|
||||
if (e(l)) {
|
||||
switch (d(l)) {
|
||||
if (f(l)) {
|
||||
switch (e(l)) {
|
||||
case 0:
|
||||
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
@ -208,9 +204,9 @@ public class BlockPiston extends Block {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
|
||||
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
@ -218,20 +214,20 @@ public class BlockPiston extends Block {
|
||||
return super.e(world, i, j, k);
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int d(int i) {
|
||||
public static int e(int i) {
|
||||
if ((i & 7) >= Facing.OPPOSITE_FACING.length) return 0; // CraftBukkit - check for AIOOB on piston data
|
||||
return i & 7;
|
||||
}
|
||||
|
||||
public static boolean e(int i) {
|
||||
public static boolean f(int i) {
|
||||
return (i & 8) != 0;
|
||||
}
|
||||
|
||||
private static int c(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
public static int b(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (MathHelper.abs((float) entityhuman.locX - (float) i) < 2.0F && MathHelper.abs((float) entityhuman.locZ - (float) k) < 2.0F) {
|
||||
double d0 = entityhuman.locY + 1.82D - (double) entityhuman.height;
|
||||
|
||||
@ -254,18 +250,18 @@ public class BlockPiston extends Block {
|
||||
return false;
|
||||
} else {
|
||||
if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) {
|
||||
if (Block.byId[i].m() == -1.0F) {
|
||||
if (Block.byId[i].m(world, j, k, l) == -1.0F) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.byId[i].g() == 2) {
|
||||
if (Block.byId[i].e() == 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!flag && Block.byId[i].g() == 1) {
|
||||
if (!flag && Block.byId[i].e() == 1) {
|
||||
return false;
|
||||
}
|
||||
} else if (e(world.getData(j, k, l))) {
|
||||
} else if (f(world.getData(j, k, l))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -273,8 +269,8 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit - boolean -> int
|
||||
private static int g(World world, int i, int j, int k, int l) {
|
||||
// CraftBukkit - change return from boolean to int
|
||||
private static int i(World world, int i, int j, int k, int l) {
|
||||
int i1 = i + Facing.b[l];
|
||||
int j1 = j + Facing.c[l];
|
||||
int k1 = k + Facing.d[l];
|
||||
@ -293,7 +289,7 @@ public class BlockPiston extends Block {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
if (Block.byId[i2].g() != 1) {
|
||||
if (Block.byId[i2].e() != 1) {
|
||||
if (l1 == 12) {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
@ -311,7 +307,7 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean h(World world, int i, int j, int k, int l) {
|
||||
private boolean j(World world, int i, int j, int k, int l) {
|
||||
int i1 = i + Facing.b[l];
|
||||
int j1 = j + Facing.c[l];
|
||||
int k1 = k + Facing.d[l];
|
||||
@ -331,7 +327,7 @@ public class BlockPiston extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.byId[i2].g() != 1) {
|
||||
if (Block.byId[i2].e() != 1) {
|
||||
if (l1 == 12) {
|
||||
return false;
|
||||
}
|
||||
@ -343,7 +339,7 @@ public class BlockPiston extends Block {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block.byId[i2].b(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
|
||||
Block.byId[i2].c(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
|
||||
world.setTypeId(i1, j1, k1, 0);
|
||||
}
|
||||
}
|
||||
@ -356,10 +352,10 @@ public class BlockPiston extends Block {
|
||||
int l2 = world.getData(l1, i2, j2);
|
||||
|
||||
if (k2 == this.id && l1 == i && i2 == j && j2 == k) {
|
||||
world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0));
|
||||
world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0), false);
|
||||
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(Block.PISTON_EXTENSION.id, l | (this.a ? 8 : 0), l, true, false));
|
||||
} else {
|
||||
world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l2);
|
||||
world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l2, false);
|
||||
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k2, l2, l, true, false));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPistonExtension extends Block {
|
||||
@ -13,41 +13,40 @@ public class BlockPistonExtension extends Block {
|
||||
this.c(0.5F);
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
super.remove(world, i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
if (l > 5 || l < 0) return; // CraftBukkit - fixed a piston AIOOBE issue.
|
||||
int i1 = Facing.OPPOSITE_FACING[b(l)];
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue
|
||||
int j1 = Facing.OPPOSITE_FACING[f(i1)];
|
||||
|
||||
i += Facing.b[i1];
|
||||
j += Facing.c[i1];
|
||||
k += Facing.d[i1];
|
||||
int j1 = world.getTypeId(i, j, k);
|
||||
i += Facing.b[j1];
|
||||
j += Facing.c[j1];
|
||||
k += Facing.d[j1];
|
||||
int k1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) {
|
||||
l = world.getData(i, j, k);
|
||||
if (BlockPiston.e(l)) {
|
||||
Block.byId[j1].b(world, i, j, k, l, 0);
|
||||
if (k1 == Block.PISTON.id || k1 == Block.PISTON_STICKY.id) {
|
||||
i1 = world.getData(i, j, k);
|
||||
if (BlockPiston.f(i1)) {
|
||||
Block.byId[k1].c(world, i, j, k, i1, 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
int k = b(j);
|
||||
int k = f(j);
|
||||
|
||||
return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == Facing.OPPOSITE_FACING[k] ? 107 : 108);
|
||||
return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (k < 6 && i == Facing.OPPOSITE_FACING[k] ? 107 : 108);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 17;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -63,50 +62,50 @@ public class BlockPistonExtension extends Block {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) {
|
||||
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
switch (b(l)) {
|
||||
switch (f(l)) {
|
||||
case 0:
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
this.a(0.375F, 0.25F, 0.375F, 0.625F, 1.0F, 0.625F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
this.a(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
this.a(0.375F, 0.0F, 0.375F, 0.625F, 0.75F, 0.625F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
this.a(0.25F, 0.375F, 0.25F, 0.75F, 0.625F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this.a(0.0F, 0.0F, 0.75F, 1.0F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
this.a(0.25F, 0.375F, 0.0F, 0.75F, 0.625F, 0.75F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
this.a(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
this.a(0.375F, 0.25F, 0.25F, 0.625F, 0.75F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
this.a(0.75F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
this.a(0.0F, 0.375F, 0.25F, 0.75F, 0.625F, 0.75F);
|
||||
super.a(world, i, j, k, axisalignedbb, arraylist);
|
||||
super.a(world, i, j, k, axisalignedbb, list, entity);
|
||||
}
|
||||
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
@ -115,7 +114,7 @@ public class BlockPistonExtension extends Block {
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.getData(i, j, k);
|
||||
|
||||
switch (b(l)) {
|
||||
switch (f(l)) {
|
||||
case 0:
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
|
||||
break;
|
||||
@ -142,8 +141,8 @@ public class BlockPistonExtension extends Block {
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
int i1 = b(world.getData(i, j, k));
|
||||
if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue.
|
||||
int i1 = f(world.getData(i, j, k));
|
||||
if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue
|
||||
int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
|
||||
|
||||
if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
|
||||
@ -153,7 +152,7 @@ public class BlockPistonExtension extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public static int b(int i) {
|
||||
public static int f(int i) {
|
||||
return i & 7;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,22 @@ public class BlockPortal extends BlockHalfTransparant {
|
||||
|
||||
public BlockPortal(int i, int j) {
|
||||
super(i, j, Material.PORTAL, false);
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
super.b(world, i, j, k, random);
|
||||
if (world.worldProvider.d() && random.nextInt(2000) < world.difficulty) {
|
||||
int l;
|
||||
|
||||
for (l = j; !world.t(i, l, k) && l > 0; --l) {
|
||||
;
|
||||
}
|
||||
|
||||
if (l > 0 && !world.s(i, l + 1, k)) {
|
||||
ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
@ -32,15 +48,15 @@ public class BlockPortal extends BlockHalfTransparant {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b_(World world, int i, int j, int k) {
|
||||
public boolean i_(World world, int i, int j, int k) {
|
||||
byte b0 = 0;
|
||||
byte b1 = 0;
|
||||
|
||||
@ -146,8 +162,10 @@ public class BlockPortal extends BlockHalfTransparant {
|
||||
|
||||
if (flag && flag1) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id || world.getTypeId(i - b0, j, k - b1) != this.id) && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id || world.getTypeId(i + b0, j, k + b1) != this.id)) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id || world.getTypeId(i - b0, j, k - b1) != this.id) && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id || world.getTypeId(i + b0, j, k + b1) != this.id)) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
@ -166,7 +184,7 @@ public class BlockPortal extends BlockHalfTransparant {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
entity.ad();
|
||||
entity.aa();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,14 @@ public class BlockPressurePlate extends Block {
|
||||
protected BlockPressurePlate(int i, int j, EnumMobType enummobtype, Material material) {
|
||||
super(i, j, material);
|
||||
this.a = enummobtype;
|
||||
this.a(true);
|
||||
this.a(CreativeModeTab.d);
|
||||
this.b(true);
|
||||
float f = 0.0625F;
|
||||
|
||||
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@ -29,41 +30,39 @@ public class BlockPressurePlate extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.FENCE.id;
|
||||
return world.t(i, j - 1, k) || BlockFence.c(world.getTypeId(i, j - 1, k));
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.e(i, j - 1, k) && world.getTypeId(i, j - 1, k) != Block.FENCE.id) {
|
||||
if (!world.t(i, j - 1, k) && !BlockFence.c(world.getTypeId(i, j - 1, k))) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
if (world.getData(i, j, k) != 0) {
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,30 +70,30 @@ public class BlockPressurePlate extends Block {
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
if (!world.isStatic) {
|
||||
if (world.getData(i, j, k) != 1) {
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
boolean flag = world.getData(i, j, k) == 1;
|
||||
boolean flag1 = false;
|
||||
float f = 0.125F;
|
||||
List list = null;
|
||||
|
||||
if (this.a == EnumMobType.EVERYTHING) {
|
||||
list = world.getEntities((Entity) null, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
list = world.getEntities((Entity) null, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
}
|
||||
|
||||
if (this.a == EnumMobType.MOBS) {
|
||||
list = world.a(EntityLiving.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
list = world.a(EntityLiving.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
}
|
||||
|
||||
if (this.a == EnumMobType.PLAYERS) {
|
||||
list = world.a(EntityHuman.class, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
list = world.a(EntityHuman.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
if (!list.isEmpty()) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
@ -116,6 +115,7 @@ public class BlockPressurePlate extends Block {
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cancellable.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
@ -134,7 +134,7 @@ public class BlockPressurePlate extends Block {
|
||||
world.setData(i, j, k, 1);
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
}
|
||||
|
||||
@ -142,24 +142,22 @@ public class BlockPressurePlate extends Block {
|
||||
world.setData(i, j, k, 0);
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l > 0) {
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
if (i1 > 0) {
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
|
||||
super.remove(world, i, j, k);
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
@ -177,7 +175,7 @@ public class BlockPressurePlate extends Block {
|
||||
return iblockaccess.getData(i, j, k) > 0;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return world.getData(i, j, k) == 0 ? false : l == 1;
|
||||
}
|
||||
|
||||
@ -193,7 +191,7 @@ public class BlockPressurePlate extends Block {
|
||||
this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
|
||||
}
|
||||
|
||||
public int g() {
|
||||
public int e() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,9 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
protected BlockPumpkin(int i, int j, boolean flag) {
|
||||
super(i, Material.PUMPKIN);
|
||||
this.textureId = j;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a = flag;
|
||||
this.a(CreativeModeTab.b);
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
@ -42,7 +43,7 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
if (world.suppressPhysics) return; // CraftBukkit
|
||||
if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start - Use BlockStateListPopulator
|
||||
// CraftBukkit start - use BlockStateListPopulator
|
||||
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
|
||||
blockList.setTypeId(i, j, k, 0);
|
||||
@ -66,12 +67,13 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id;
|
||||
|
||||
if (flag || flag1) {
|
||||
// CraftBukkit start - Use BlockStateListPopulator
|
||||
// CraftBukkit start - use BlockStateListPopulator
|
||||
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
|
||||
blockList.setTypeId(i, j, k, 0);
|
||||
blockList.setTypeId(i, j - 1, k, 0);
|
||||
blockList.setTypeId(i, j - 2, k, 0);
|
||||
|
||||
if (flag) {
|
||||
blockList.setTypeId(i - 1, j - 1, k, 0);
|
||||
blockList.setTypeId(i + 1, j - 1, k, 0);
|
||||
@ -82,7 +84,7 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
|
||||
EntityIronGolem entityirongolem = new EntityIronGolem(world);
|
||||
|
||||
entityirongolem.b(true);
|
||||
entityirongolem.f(true);
|
||||
entityirongolem.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
|
||||
if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
|
||||
for (int i1 = 0; i1 < 120; ++i1) {
|
||||
@ -99,7 +101,7 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
int l = world.getTypeId(i, j, k);
|
||||
|
||||
return (l == 0 || Block.byId[l].material.isReplacable()) && world.e(i, j - 1, k);
|
||||
return (l == 0 || Block.byId[l].material.isReplaceable()) && world.t(i, j - 1, k);
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
|
||||
|
@ -2,9 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
|
||||
public class BlockRedstoneLamp extends Block {
|
||||
|
||||
@ -22,13 +20,14 @@ public class BlockRedstoneLamp extends Block {
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
if (!world.isStatic) {
|
||||
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
world.c(i, j, k, this.id, 4);
|
||||
world.a(i, j, k, this.id, 4);
|
||||
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
|
||||
}
|
||||
}
|
||||
@ -37,25 +36,27 @@ public class BlockRedstoneLamp extends Block {
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic) {
|
||||
if (this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
world.c(i, j, k, this.id, 4);
|
||||
world.a(i, j, k, this.id, 4);
|
||||
} else if (!this.a && world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic && this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setTypeId(i, j, k, Block.REDSTONE_LAMP_OFF.id);
|
||||
}
|
||||
}
|
||||
|
@ -11,18 +11,18 @@ public class BlockRedstoneOre extends Block {
|
||||
public BlockRedstoneOre(int i, int j, boolean flag) {
|
||||
super(i, j, Material.STONE);
|
||||
if (flag) {
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
this.a = flag;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
super.attack(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
@ -31,33 +31,33 @@ public class BlockRedstoneOre extends Block {
|
||||
if (entity instanceof EntityHuman) {
|
||||
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||
if (!event.isCancelled()) {
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
super.b(world, i, j, k, entity);
|
||||
}
|
||||
} else {
|
||||
EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
super.b(world, i, j, k, entity);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.g(world, i, j, k);
|
||||
return super.interact(world, i, j, k, entityhuman);
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
this.l(world, i, j, k);
|
||||
return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
this.h(world, i, j, k);
|
||||
private void l(World world, int i, int j, int k) {
|
||||
this.n(world, i, j, k);
|
||||
if (this.id == Block.REDSTONE_ORE.id) {
|
||||
world.setTypeId(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (this.id == Block.GLOWING_REDSTONE_ORE.id) {
|
||||
world.setTypeId(i, j, k, Block.REDSTONE_ORE.id);
|
||||
}
|
||||
@ -75,7 +75,16 @@ public class BlockRedstoneOre extends Block {
|
||||
return 4 + random.nextInt(2);
|
||||
}
|
||||
|
||||
private void h(World world, int i, int j, int k) {
|
||||
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
|
||||
super.dropNaturally(world, i, j, k, l, f, i1);
|
||||
if (this.getDropType(l, world.random, i1) != this.id) {
|
||||
int j1 = 1 + world.random.nextInt(5);
|
||||
|
||||
this.g(world, i, j, k, j1);
|
||||
}
|
||||
}
|
||||
|
||||
private void n(World world, int i, int j, int k) {
|
||||
Random random = world.random;
|
||||
double d0 = 0.0625D;
|
||||
|
||||
@ -114,7 +123,7 @@ public class BlockRedstoneOre extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
protected ItemStack a_(int i) {
|
||||
protected ItemStack c_(int i) {
|
||||
return new ItemStack(Block.REDSTONE_ORE);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
@ -9,21 +12,26 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
private boolean isOn = false;
|
||||
private static List b = new ArrayList();
|
||||
private static Map b = new HashMap();
|
||||
|
||||
public int a(int i, int j) {
|
||||
return i == 1 ? Block.REDSTONE_WIRE.a(i, j) : super.a(i, j);
|
||||
}
|
||||
|
||||
private boolean a(World world, int i, int j, int k, boolean flag) {
|
||||
if (!b.containsKey(world)) {
|
||||
b.put(world, new ArrayList());
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
b.add(new RedstoneUpdateInfo(i, j, k, world.getTime()));
|
||||
((List) b.get(world)).add(new RedstoneUpdateInfo(i, j, k, world.getTime()));
|
||||
}
|
||||
|
||||
int l = 0;
|
||||
Iterator iterator = ((List) b.get(world)).iterator();
|
||||
|
||||
for (int i1 = 0; i1 < b.size(); ++i1) {
|
||||
RedstoneUpdateInfo redstoneupdateinfo = (RedstoneUpdateInfo) b.get(i1);
|
||||
while (iterator.hasNext()) {
|
||||
RedstoneUpdateInfo redstoneupdateinfo = (RedstoneUpdateInfo) iterator.next();
|
||||
|
||||
if (redstoneupdateinfo.a == i && redstoneupdateinfo.b == j && redstoneupdateinfo.c == k) {
|
||||
++l;
|
||||
@ -39,10 +47,11 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
protected BlockRedstoneTorch(int i, int j, boolean flag) {
|
||||
super(i, j);
|
||||
this.isOn = flag;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a((CreativeModeTab) null);
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -61,7 +70,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
if (this.isOn) {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
@ -82,17 +91,18 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
private boolean l(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
return l == 5 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l == 3 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l == 4 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l == 1 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : l == 2 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5))));
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
boolean flag = this.g(world, i, j, k);
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
boolean flag = this.l(world, i, j, k);
|
||||
List list = (List) b.get(world);
|
||||
|
||||
while (b.size() > 0 && world.getTime() - ((RedstoneUpdateInfo) b.get(0)).d > 60L) {
|
||||
b.remove(0);
|
||||
while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).d > 60L) {
|
||||
list.remove(0);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -145,10 +155,10 @@ 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.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return l == 0 ? this.a(world, i, j, k, l) : false;
|
||||
}
|
||||
|
||||
@ -159,4 +169,15 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
public boolean isPowerSource() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(World world, long i, long j) {
|
||||
List list = (List) b.get(world);
|
||||
RedstoneUpdateInfo redstoneupdateinfo;
|
||||
|
||||
if (list != null) {
|
||||
for (Iterator iterator = list.iterator(); iterator.hasNext(); redstoneupdateinfo.d += i) {
|
||||
redstoneupdateinfo = (RedstoneUpdateInfo) iterator.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
@ -25,30 +26,31 @@ public class BlockRedstoneWire extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
|
||||
return world.t(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
|
||||
}
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
this.a(world, i, j, k, i, j, k);
|
||||
ArrayList arraylist = new ArrayList(this.b);
|
||||
|
||||
this.b.clear();
|
||||
Iterator iterator = arraylist.iterator();
|
||||
|
||||
for (int l = 0; l < arraylist.size(); ++l) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l);
|
||||
while (iterator.hasNext()) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) iterator.next();
|
||||
|
||||
world.applyPhysics(chunkposition.x, chunkposition.y, chunkposition.z, this.id);
|
||||
}
|
||||
@ -92,11 +94,11 @@ public class BlockRedstoneWire extends Block {
|
||||
l1 = this.getPower(world, j2, j, k2, l1);
|
||||
}
|
||||
|
||||
if (world.e(j2, j, k2) && !world.e(i, j + 1, k)) {
|
||||
if (world.s(j2, j, k2) && !world.s(i, j + 1, k)) {
|
||||
if (j2 != l || j + 1 != i1 || k2 != j1) {
|
||||
l1 = this.getPower(world, j2, j + 1, k2, l1);
|
||||
}
|
||||
} else if (!world.e(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
|
||||
} else if (!world.s(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
|
||||
l1 = this.getPower(world, j2, j - 1, k2, l1);
|
||||
}
|
||||
}
|
||||
@ -120,7 +122,7 @@ public class BlockRedstoneWire extends Block {
|
||||
if (k1 != l1) {
|
||||
world.suppressPhysics = true;
|
||||
world.setData(i, j, k, l1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.suppressPhysics = false;
|
||||
|
||||
for (i2 = 0; i2 < 4; ++i2) {
|
||||
@ -144,7 +146,7 @@ public class BlockRedstoneWire extends Block {
|
||||
++k2;
|
||||
}
|
||||
|
||||
if (world.e(j2, j, k2)) {
|
||||
if (world.s(j2, j, k2)) {
|
||||
l2 += 2;
|
||||
}
|
||||
|
||||
@ -183,7 +185,7 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private void h(World world, int i, int j, int k) {
|
||||
private void n(World world, int i, int j, int k) {
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
@ -199,41 +201,41 @@ public class BlockRedstoneWire extends Block {
|
||||
if (world.suppressPhysics) return; // CraftBukkit
|
||||
super.onPlace(world, i, j, k);
|
||||
if (!world.isStatic) {
|
||||
this.g(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
this.h(world, i - 1, j, k);
|
||||
this.h(world, i + 1, j, k);
|
||||
this.h(world, i, j, k - 1);
|
||||
this.h(world, i, j, k + 1);
|
||||
if (world.e(i - 1, j, k)) {
|
||||
this.h(world, i - 1, j + 1, k);
|
||||
this.n(world, i - 1, j, k);
|
||||
this.n(world, i + 1, j, k);
|
||||
this.n(world, i, j, k - 1);
|
||||
this.n(world, i, j, k + 1);
|
||||
if (world.s(i - 1, j, k)) {
|
||||
this.n(world, i - 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i - 1, j - 1, k);
|
||||
this.n(world, i - 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.e(i + 1, j, k)) {
|
||||
this.h(world, i + 1, j + 1, k);
|
||||
if (world.s(i + 1, j, k)) {
|
||||
this.n(world, i + 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i + 1, j - 1, k);
|
||||
this.n(world, i + 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.e(i, j, k - 1)) {
|
||||
this.h(world, i, j + 1, k - 1);
|
||||
if (world.s(i, j, k - 1)) {
|
||||
this.n(world, i, j + 1, k - 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k - 1);
|
||||
this.n(world, i, j - 1, k - 1);
|
||||
}
|
||||
|
||||
if (world.e(i, j, k + 1)) {
|
||||
this.h(world, i, j + 1, k + 1);
|
||||
if (world.s(i, j, k + 1)) {
|
||||
this.n(world, i, j + 1, k + 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k + 1);
|
||||
this.n(world, i, j - 1, k + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
super.remove(world, i, j, k);
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
if (!world.isStatic) {
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
@ -241,33 +243,33 @@ public class BlockRedstoneWire extends Block {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
this.g(world, i, j, k);
|
||||
this.h(world, i - 1, j, k);
|
||||
this.h(world, i + 1, j, k);
|
||||
this.h(world, i, j, k - 1);
|
||||
this.h(world, i, j, k + 1);
|
||||
if (world.e(i - 1, j, k)) {
|
||||
this.h(world, i - 1, j + 1, k);
|
||||
this.l(world, i, j, k);
|
||||
this.n(world, i - 1, j, k);
|
||||
this.n(world, i + 1, j, k);
|
||||
this.n(world, i, j, k - 1);
|
||||
this.n(world, i, j, k + 1);
|
||||
if (world.s(i - 1, j, k)) {
|
||||
this.n(world, i - 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i - 1, j - 1, k);
|
||||
this.n(world, i - 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.e(i + 1, j, k)) {
|
||||
this.h(world, i + 1, j + 1, k);
|
||||
if (world.s(i + 1, j, k)) {
|
||||
this.n(world, i + 1, j + 1, k);
|
||||
} else {
|
||||
this.h(world, i + 1, j - 1, k);
|
||||
this.n(world, i + 1, j - 1, k);
|
||||
}
|
||||
|
||||
if (world.e(i, j, k - 1)) {
|
||||
this.h(world, i, j + 1, k - 1);
|
||||
if (world.s(i, j, k - 1)) {
|
||||
this.n(world, i, j + 1, k - 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k - 1);
|
||||
this.n(world, i, j - 1, k - 1);
|
||||
}
|
||||
|
||||
if (world.e(i, j, k + 1)) {
|
||||
this.h(world, i, j + 1, k + 1);
|
||||
if (world.s(i, j, k + 1)) {
|
||||
this.n(world, i, j + 1, k + 1);
|
||||
} else {
|
||||
this.h(world, i, j - 1, k + 1);
|
||||
this.n(world, i, j - 1, k + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -288,11 +290,11 @@ public class BlockRedstoneWire extends Block {
|
||||
int i1 = world.getData(i, j, k);
|
||||
boolean flag = this.canPlace(world, i, j, k);
|
||||
|
||||
if (!flag) {
|
||||
this.b(world, i, j, k, i1, 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
if (flag) {
|
||||
this.l(world, i, j, k);
|
||||
} else {
|
||||
this.g(world, i, j, k);
|
||||
this.c(world, i, j, k, i1, 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
|
||||
super.doPhysics(world, i, j, k, l);
|
||||
@ -303,7 +305,7 @@ public class BlockRedstoneWire extends Block {
|
||||
return Item.REDSTONE.id;
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return !this.a ? false : this.a(world, i, j, k, l);
|
||||
}
|
||||
|
||||
@ -315,25 +317,25 @@ public class BlockRedstoneWire extends Block {
|
||||
} else if (l == 1) {
|
||||
return true;
|
||||
} else {
|
||||
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);
|
||||
boolean flag = f(iblockaccess, i - 1, j, k, 1) || !iblockaccess.s(i - 1, j, k) && f(iblockaccess, i - 1, j - 1, k, -1);
|
||||
boolean flag1 = f(iblockaccess, i + 1, j, k, 3) || !iblockaccess.s(i + 1, j, k) && f(iblockaccess, i + 1, j - 1, k, -1);
|
||||
boolean flag2 = f(iblockaccess, i, j, k - 1, 2) || !iblockaccess.s(i, j, k - 1) && f(iblockaccess, i, j - 1, k - 1, -1);
|
||||
boolean flag3 = f(iblockaccess, i, j, k + 1, 0) || !iblockaccess.s(i, j, k + 1) && f(iblockaccess, i, j - 1, k + 1, -1);
|
||||
|
||||
if (!iblockaccess.e(i, j + 1, k)) {
|
||||
if (iblockaccess.e(i - 1, j, k) && d(iblockaccess, i - 1, j + 1, k, -1)) {
|
||||
if (!iblockaccess.s(i, j + 1, k)) {
|
||||
if (iblockaccess.s(i - 1, j, k) && f(iblockaccess, i - 1, j + 1, k, -1)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.e(i + 1, j, k) && d(iblockaccess, i + 1, j + 1, k, -1)) {
|
||||
if (iblockaccess.s(i + 1, j, k) && f(iblockaccess, i + 1, j + 1, k, -1)) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.e(i, j, k - 1) && d(iblockaccess, i, j + 1, k - 1, -1)) {
|
||||
if (iblockaccess.s(i, j, k - 1) && f(iblockaccess, i, j + 1, k - 1, -1)) {
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.e(i, j, k + 1) && d(iblockaccess, i, j + 1, k + 1, -1)) {
|
||||
if (iblockaccess.s(i, j, k + 1) && f(iblockaccess, i, j + 1, k + 1, -1)) {
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
@ -346,7 +348,7 @@ public class BlockRedstoneWire extends Block {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public static boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public static boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int i1 = iblockaccess.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == Block.REDSTONE_WIRE.id) {
|
||||
@ -362,8 +364,8 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (c(iblockaccess, i, j, k, l)) {
|
||||
public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (e(iblockaccess, i, j, k, l)) {
|
||||
return true;
|
||||
} else {
|
||||
int i1 = iblockaccess.getTypeId(i, j, k);
|
||||
|
@ -10,10 +10,10 @@ public class BlockReed extends Block {
|
||||
float f = 0.375F;
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (world.isEmpty(i, j + 1, k)) {
|
||||
int l;
|
||||
|
||||
@ -41,17 +41,17 @@ public class BlockReed extends Block {
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
this.g(world, i, j, k);
|
||||
this.k_(world, i, j, k);
|
||||
}
|
||||
|
||||
protected final void g(World world, int i, int j, int k) {
|
||||
if (!this.f(world, i, j, k)) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
protected final void k_(World world, int i, int j, int k) {
|
||||
if (!this.d(world, i, j, k)) {
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
public boolean d(World world, int i, int j, int k) {
|
||||
return this.canPlace(world, i, j, k);
|
||||
}
|
||||
|
||||
@ -63,15 +63,15 @@ public class BlockReed extends Block {
|
||||
return Item.SUGAR_CANE.id;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -8,27 +8,30 @@ public class BlockSand extends Block {
|
||||
|
||||
public BlockSand(int i, int j) {
|
||||
super(i, j, Material.SAND);
|
||||
this.a(CreativeModeTab.b);
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
this.h(world, i, j, k);
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private void h(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
if (canFall(world, i, j - 1, k) && j >= 0) {
|
||||
byte b0 = 32;
|
||||
|
||||
if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
if (!instaFall && world.c(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit - Change call to add data
|
||||
// CraftBukkit - change call to add data
|
||||
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
|
||||
|
||||
world.addEntity(entityfallingblock);
|
||||
@ -47,7 +50,7 @@ public class BlockSand extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int p_() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
@ -11,16 +11,19 @@ import org.bukkit.event.world.StructureGrowEvent;
|
||||
|
||||
public class BlockSapling extends BlockFlower {
|
||||
|
||||
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
|
||||
|
||||
protected BlockSapling(int i, int j) {
|
||||
super(i, j);
|
||||
float f = 0.4F;
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
|
||||
this.a(CreativeModeTab.c);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic) {
|
||||
super.a(world, i, j, k, random);
|
||||
super.b(world, i, j, k, random);
|
||||
if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
@ -43,12 +46,12 @@ public class BlockSapling extends BlockFlower {
|
||||
int l = world.getData(i, j, k) & 3;
|
||||
int i1 = 0;
|
||||
int j1 = 0;
|
||||
boolean flag = false;
|
||||
// CraftBukkit start - records tree generation and calls StructureGrowEvent
|
||||
StructureGrowDelegate delegate = new StructureGrowDelegate(world);
|
||||
TreeType treeType = null;
|
||||
TreeGenerator gen = null;
|
||||
boolean grownTree = false;
|
||||
boolean flag = false;
|
||||
|
||||
if (l == 1) {
|
||||
treeType = TreeType.REDWOOD;
|
||||
@ -59,7 +62,7 @@ public class BlockSapling extends BlockFlower {
|
||||
} else if (l == 3) {
|
||||
for (i1 = 0; i1 >= -1; --i1) {
|
||||
for (j1 = 0; j1 >= -1; --j1) {
|
||||
if (this.f(world, i + i1, j, k + j1, 3) && this.f(world, i + i1 + 1, j, k + j1, 3) && this.f(world, i + i1, j, k + j1 + 1, 3) && this.f(world, i + i1 + 1, j, k + j1 + 1, 3)) {
|
||||
if (this.e(world, i + i1, j, k + j1, 3) && this.e(world, i + i1 + 1, j, k + j1, 3) && this.e(world, i + i1, j, k + j1 + 1, 3) && this.e(world, i + i1 + 1, j, k + j1 + 1, 3)) {
|
||||
treeType = TreeType.JUNGLE;
|
||||
gen = new WorldGenMegaTree(false, 10 + random.nextInt(20), 3, 3);
|
||||
flag = true;
|
||||
@ -95,6 +98,7 @@ public class BlockSapling extends BlockFlower {
|
||||
} else {
|
||||
world.setRawTypeId(i, j, k, 0);
|
||||
}
|
||||
|
||||
grownTree = gen.generate(delegate, random, i + i1, j, k + j1);
|
||||
if (grownTree) {
|
||||
Location location = new Location(world.getWorld(), i, j, k);
|
||||
@ -124,7 +128,7 @@ public class BlockSapling extends BlockFlower {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k, int l) {
|
||||
public boolean e(World world, int i, int j, int k, int l) {
|
||||
return world.getTypeId(i, j, k) == this.id && (world.getData(i, j, k) & 3) == l;
|
||||
}
|
||||
|
||||
|
@ -52,23 +52,23 @@ public class BlockSign extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileEntity a_() {
|
||||
public TileEntity a(World world) {
|
||||
try {
|
||||
return (TileEntity) this.a.newInstance();
|
||||
} catch (Exception exception) {
|
||||
@ -109,7 +109,7 @@ public class BlockSign extends BlockContainer {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
|
||||
|
@ -7,20 +7,21 @@ public class BlockSnow extends Block {
|
||||
protected BlockSnow(int i, int j) {
|
||||
super(i, j, Material.SNOW_LAYER);
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.c);
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k) & 7;
|
||||
|
||||
return l >= 3 ? AxisAlignedBB.b((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + 0.5F), (double) k + this.maxZ) : null;
|
||||
return l >= 3 ? AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + 0.5F), (double) k + this.maxZ) : null;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -34,16 +35,16 @@ public class BlockSnow extends Block {
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
int l = world.getTypeId(i, j - 1, k);
|
||||
|
||||
return l != 0 && (l == Block.LEAVES.id || Block.byId[l].a()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
|
||||
return l != 0 && (l == Block.LEAVES.id || Block.byId[l].d()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
this.g(world, i, j, k);
|
||||
this.n(world, i, j, k);
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
private boolean n(World world, int i, int j, int k) {
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setRawTypeId(i, j, k, 0); // CraftBukkit
|
||||
world.notify(i, j, k); // CraftBukkit - Notify clients of the reversion
|
||||
return false;
|
||||
@ -74,15 +75,15 @@ public class BlockSnow extends Block {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) {
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), 0).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
this.c(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
@ -9,20 +9,20 @@ public class BlockSoil extends Block {
|
||||
protected BlockSoil(int i) {
|
||||
super(i, Material.EARTH);
|
||||
this.textureId = 87;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
|
||||
this.f(255);
|
||||
this.h(255);
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
return AxisAlignedBB.b((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
|
||||
return AxisAlignedBB.a().a((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -30,13 +30,13 @@ public class BlockSoil extends Block {
|
||||
return i == 1 && j > 0 ? this.textureId - 1 : (i == 1 ? this.textureId : 2);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (!this.h(world, i, j, k) && !world.y(i, j + 1, k)) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!this.n(world, i, j, k) && !world.B(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)) {
|
||||
} else if (!this.l(world, i, j, k)) {
|
||||
world.setTypeId(i, j, k, Block.DIRT.id);
|
||||
}
|
||||
} else {
|
||||
@ -45,8 +45,8 @@ public class BlockSoil extends Block {
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity, float f) {
|
||||
if (world.random.nextFloat() < f - 0.5F) {
|
||||
// CraftBukkit start - Interact Soil
|
||||
if (!world.isStatic && world.random.nextFloat() < f - 0.5F) {
|
||||
// CraftBukkit start - interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
if (entity instanceof EntityHuman) {
|
||||
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||
@ -64,7 +64,7 @@ public class BlockSoil extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
private boolean l(World world, int i, int j, int k) {
|
||||
byte b0 = 0;
|
||||
|
||||
for (int l = i - b0; l <= i + b0; ++l) {
|
||||
@ -80,7 +80,7 @@ public class BlockSoil extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean h(World world, int i, int j, int k) {
|
||||
private boolean n(World world, int i, int j, int k) {
|
||||
for (int l = i - 4; l <= i + 4; ++l) {
|
||||
for (int i1 = j; i1 <= j + 1; ++i1) {
|
||||
for (int j1 = k - 4; j1 <= k + 4; ++j1) {
|
||||
|
@ -11,41 +11,41 @@ public class BlockStationary extends BlockFluids {
|
||||
|
||||
protected BlockStationary(int i, Material material) {
|
||||
super(i, material);
|
||||
this.a(false);
|
||||
this.b(false);
|
||||
if (material == Material.LAVA) {
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return this.material != Material.LAVA;
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
super.doPhysics(world, i, j, k, l);
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
this.i(world, i, j, k);
|
||||
this.l(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private void i(World world, int i, int j, int k) {
|
||||
private void l(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.suppressPhysics = true;
|
||||
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.c(i, j, k, this.id - 1, this.d());
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.a(i, j, k, this.id - 1, this.p_());
|
||||
world.suppressPhysics = false;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (this.material == Material.LAVA) {
|
||||
int l = random.nextInt(3);
|
||||
|
||||
int i1;
|
||||
int j1;
|
||||
|
||||
// CraftBukkit start - prevent lava putting something on fire.
|
||||
// CraftBukkit start - prevent lava putting something on fire
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||
// CraftBukkit end
|
||||
@ -56,8 +56,8 @@ public class BlockStationary extends BlockFluids {
|
||||
k += random.nextInt(3) - 1;
|
||||
j1 = world.getTypeId(i, j, k);
|
||||
if (j1 == 0) {
|
||||
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
||||
// CraftBukkit start - prevent lava putting something on fire.
|
||||
if (this.n(world, i - 1, j, k) || this.n(world, i + 1, j, k) || this.n(world, i, j, k - 1) || this.n(world, i, j, k + 1) || this.n(world, i, j - 1, k) || this.n(world, i, j + 1, k)) {
|
||||
// CraftBukkit start - prevent lava putting something on fire
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
|
||||
if (block.getTypeId() != Block.FIRE.id) {
|
||||
if (CraftEventFactory.callEvent(new BlockIgniteEvent(block, igniteCause, null)).isCancelled()) {
|
||||
@ -81,8 +81,8 @@ public class BlockStationary extends BlockFluids {
|
||||
for (int k1 = 0; k1 < 3; ++k1) {
|
||||
i = i1 + random.nextInt(3) - 1;
|
||||
k = j1 + random.nextInt(3) - 1;
|
||||
if (world.isEmpty(i, j + 1, k) && this.j(world, i, j, k)) {
|
||||
// CraftBukkit start - prevent lava putting something on fire.
|
||||
if (world.isEmpty(i, j + 1, k) && this.n(world, i, j, k)) {
|
||||
// CraftBukkit start - prevent lava putting something on fire
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i, j + 1, k);
|
||||
if (block.getTypeId() != Block.FIRE.id) {
|
||||
if (CraftEventFactory.callEvent(new BlockIgniteEvent(block, igniteCause, null)).isCancelled()) {
|
||||
@ -98,7 +98,7 @@ public class BlockStationary extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean j(World world, int i, int j, int k) {
|
||||
private boolean n(World world, int i, int j, int k) {
|
||||
return world.getMaterial(i, j, k).isBurnable();
|
||||
}
|
||||
}
|
||||
|
@ -11,20 +11,21 @@ public class BlockStem extends BlockFlower {
|
||||
protected BlockStem(int i, Block block) {
|
||||
super(i, 111);
|
||||
this.blockFruit = block;
|
||||
this.a(true);
|
||||
this.b(true);
|
||||
float f = 0.125F;
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
|
||||
this.a((CreativeModeTab) null);
|
||||
}
|
||||
|
||||
protected boolean d(int i) {
|
||||
protected boolean d_(int i) {
|
||||
return i == Block.SOIL.id;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
super.a(world, i, j, k, random);
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
super.b(world, i, j, k, random);
|
||||
if (world.getLightLevel(i, j + 1, k) >= 9) {
|
||||
float f = this.i(world, i, j, k);
|
||||
float f = this.n(world, i, j, k);
|
||||
|
||||
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
||||
int l = world.getData(i, j, k);
|
||||
@ -79,11 +80,11 @@ public class BlockStem extends BlockFlower {
|
||||
}
|
||||
}
|
||||
|
||||
public void g(World world, int i, int j, int k) {
|
||||
public void l(World world, int i, int j, int k) {
|
||||
world.setData(i, j, k, 7);
|
||||
}
|
||||
|
||||
private float i(World world, int i, int j, int k) {
|
||||
private float n(World world, int i, int j, int k) {
|
||||
float f = 1.0F;
|
||||
int l = world.getTypeId(i, j, k - 1);
|
||||
int i1 = world.getTypeId(i, j, k + 1);
|
||||
@ -141,7 +142,7 @@ public class BlockStem extends BlockFlower {
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, (float) this.maxY, 0.5F + f);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 19;
|
||||
}
|
||||
|
||||
@ -174,10 +175,6 @@ public class BlockStem extends BlockFlower {
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
if (i == 7) {
|
||||
;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ public class BlockTNT extends Block {
|
||||
|
||||
public BlockTNT(int i, int j) {
|
||||
super(i, j, Material.TNT);
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
@ -28,7 +29,7 @@ public class BlockTNT extends Block {
|
||||
}
|
||||
|
||||
public int a(Random random) {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void wasExploded(World world, int i, int j, int k) {
|
||||
@ -42,9 +43,7 @@ public class BlockTNT extends Block {
|
||||
|
||||
public void postBreak(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic) {
|
||||
if ((l & 1) == 0) {
|
||||
this.a(world, i, j, k, new ItemStack(Block.TNT.id, 1, 0));
|
||||
} else {
|
||||
if ((l & 1) == 1) {
|
||||
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
|
||||
|
||||
world.addEntity(entitytntprimed);
|
||||
@ -53,21 +52,17 @@ public class BlockTNT extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
super.attack(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (entityhuman.U() != null && entityhuman.U().id == Item.FLINT_AND_STEEL.id) {
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (entityhuman.bC() != null && entityhuman.bC().id == Item.FLINT_AND_STEEL.id) {
|
||||
this.postBreak(world, i, j, k, 1);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return true;
|
||||
} else {
|
||||
return super.interact(world, i, j, k, entityhuman);
|
||||
return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
|
||||
}
|
||||
}
|
||||
|
||||
protected ItemStack a_(int i) {
|
||||
protected ItemStack c_(int i) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -15,21 +15,22 @@ public class BlockTrapdoor extends Block {
|
||||
float f1 = 1.0F;
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return !e(iblockaccess.getData(i, j, k));
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
return !g(iblockaccess.getData(i, j, k));
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int b() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -39,7 +40,7 @@ public class BlockTrapdoor extends Block {
|
||||
}
|
||||
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
this.d(iblockaccess.getData(i, j, k));
|
||||
this.e(iblockaccess.getData(i, j, k));
|
||||
}
|
||||
|
||||
public void f() {
|
||||
@ -48,11 +49,11 @@ public class BlockTrapdoor extends Block {
|
||||
this.a(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
public void e(int i) {
|
||||
float f = 0.1875F;
|
||||
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
if (e(i)) {
|
||||
if (g(i)) {
|
||||
if ((i & 3) == 0) {
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
@ -72,16 +73,16 @@ public class BlockTrapdoor extends Block {
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.interact(world, i, j, k, entityhuman);
|
||||
this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (this.material == Material.ORE) {
|
||||
return true;
|
||||
} else {
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
world.setData(i, j, k, l ^ 4);
|
||||
world.setData(i, j, k, i1 ^ 4);
|
||||
world.a(entityhuman, 1003, i, j, k, 0);
|
||||
return true;
|
||||
}
|
||||
@ -119,9 +120,9 @@ public class BlockTrapdoor extends Block {
|
||||
--j1;
|
||||
}
|
||||
|
||||
if (!h(world.getTypeId(j1, j, k1))) {
|
||||
if (!j(world.getTypeId(j1, j, k1))) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
this.b(world, i, j, k, i1, 0);
|
||||
this.c(world, i, j, k, i1, 0);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -148,7 +149,7 @@ public class BlockTrapdoor extends Block {
|
||||
return super.a(world, i, j, k, vec3d, vec3d1);
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) {
|
||||
public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
|
||||
byte b0 = 0;
|
||||
|
||||
if (l == 2) {
|
||||
@ -193,21 +194,21 @@ public class BlockTrapdoor extends Block {
|
||||
--i;
|
||||
}
|
||||
|
||||
return h(world.getTypeId(i, j, k));
|
||||
return j(world.getTypeId(i, j, k));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean e(int i) {
|
||||
public static boolean g(int i) {
|
||||
return (i & 4) != 0;
|
||||
}
|
||||
|
||||
private static boolean h(int i) {
|
||||
private static boolean j(int i) {
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
Block block = Block.byId[i];
|
||||
|
||||
return block != null && block.material.j() && block.b() || block == Block.GLOWSTONE;
|
||||
return block != null && block.material.k() && block.c() || block == Block.GLOWSTONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// import java.util.ArrayList; // CraftBukkit
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -11,7 +11,6 @@ import java.util.Random;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.util.UnsafeList;
|
||||
// CraftBukkit end
|
||||
|
||||
public class Chunk {
|
||||
@ -58,7 +57,7 @@ public class Chunk {
|
||||
this.heightMap = new int[256];
|
||||
|
||||
for (int k = 0; k < this.entitySlices.length; ++k) {
|
||||
this.entitySlices[k] = new UnsafeList(); // CraftBukkit - use UnsafeList
|
||||
this.entitySlices[k] = new ArrayList();
|
||||
}
|
||||
|
||||
Arrays.fill(this.b, -999);
|
||||
@ -104,22 +103,22 @@ public class Chunk {
|
||||
return this.heightMap[j << 4 | i];
|
||||
}
|
||||
|
||||
public int g() {
|
||||
public int h() {
|
||||
for (int i = this.sections.length - 1; i >= 0; --i) {
|
||||
if (this.sections[i] != null) {
|
||||
return this.sections[i].c();
|
||||
return this.sections[i].d();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ChunkSection[] h() {
|
||||
public ChunkSection[] i() {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
public void initLighting() {
|
||||
int i = this.g();
|
||||
int i = this.h();
|
||||
|
||||
int j;
|
||||
int k;
|
||||
@ -152,7 +151,7 @@ public class Chunk {
|
||||
|
||||
if (chunksection != null) {
|
||||
chunksection.c(j, i1 & 15, k, l);
|
||||
this.world.o((this.x << 4) + j, i1, (this.z << 4) + k);
|
||||
this.world.n((this.x << 4) + j, i1, (this.z << 4) + k);
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,15 +174,13 @@ public class Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
public void loadNOP() {}
|
||||
|
||||
private void e(int i, int j) {
|
||||
this.c[i + j * 16] = true;
|
||||
this.s = true;
|
||||
}
|
||||
|
||||
private void o() {
|
||||
MethodProfiler.a("recheckGaps");
|
||||
private void q() {
|
||||
this.world.methodProfiler.a("recheckGaps");
|
||||
if (this.world.areChunksLoaded(this.x * 16 + 8, 0, this.z * 16 + 8, 16)) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
@ -221,7 +218,7 @@ public class Chunk {
|
||||
this.s = false;
|
||||
}
|
||||
|
||||
MethodProfiler.a();
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
private void g(int i, int j, int k) {
|
||||
@ -237,7 +234,7 @@ public class Chunk {
|
||||
private void d(int i, int j, int k, int l) {
|
||||
if (l > k && this.world.areChunksLoaded(i, 0, j, 16)) {
|
||||
for (int i1 = k; i1 < l; ++i1) {
|
||||
this.world.b(EnumSkyBlock.SKY, i, i1, j);
|
||||
this.world.c(EnumSkyBlock.SKY, i, i1, j);
|
||||
}
|
||||
|
||||
this.l = true;
|
||||
@ -272,7 +269,7 @@ public class Chunk {
|
||||
chunksection = this.sections[l1 >> 4];
|
||||
if (chunksection != null) {
|
||||
chunksection.c(i, l1 & 15, k, 15);
|
||||
this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
|
||||
this.world.n((this.x << 4) + i, l1, (this.z << 4) + k);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -280,7 +277,7 @@ public class Chunk {
|
||||
chunksection = this.sections[l1 >> 4];
|
||||
if (chunksection != null) {
|
||||
chunksection.c(i, l1 & 15, k, 0);
|
||||
this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
|
||||
this.world.n((this.x << 4) + i, l1, (this.z << 4) + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -365,8 +362,9 @@ public class Chunk {
|
||||
|
||||
int k1 = this.heightMap[j1];
|
||||
int l1 = this.getTypeId(i, j, k);
|
||||
int i2 = this.getData(i, j, k);
|
||||
|
||||
if (l1 == l && this.getData(i, j, k) == i1) {
|
||||
if (l1 == l && i2 == i1) {
|
||||
return false;
|
||||
} else {
|
||||
ChunkSection chunksection = this.sections[j >> 4];
|
||||
@ -381,15 +379,19 @@ public class Chunk {
|
||||
flag = j >= k1;
|
||||
}
|
||||
|
||||
chunksection.a(i, j & 15, k, l);
|
||||
int i2 = this.x * 16 + i;
|
||||
int j2 = this.z * 16 + k;
|
||||
int j2 = this.x * 16 + i;
|
||||
int k2 = this.z * 16 + k;
|
||||
|
||||
if (l1 != 0 && !this.world.isStatic) {
|
||||
Block.byId[l1].h(this.world, j2, j, k2, i2);
|
||||
}
|
||||
|
||||
chunksection.a(i, j & 15, k, l);
|
||||
if (l1 != 0) {
|
||||
if (!this.world.isStatic) {
|
||||
Block.byId[l1].remove(this.world, i2, j, j2);
|
||||
Block.byId[l1].remove(this.world, j2, j, k2, l1, i2);
|
||||
} else if (Block.byId[l1] instanceof BlockContainer && l1 != l) {
|
||||
this.world.q(i2, j, j2);
|
||||
this.world.q(j2, j, k2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,14 +417,14 @@ public class Chunk {
|
||||
|
||||
if (l != 0) {
|
||||
if (!this.world.isStatic) {
|
||||
Block.byId[l].onPlace(this.world, i2, j, j2);
|
||||
Block.byId[l].onPlace(this.world, j2, j, k2);
|
||||
}
|
||||
|
||||
if (Block.byId[l] instanceof BlockContainer) {
|
||||
tileentity = this.e(i, j, k);
|
||||
if (tileentity == null) {
|
||||
tileentity = ((BlockContainer) Block.byId[l]).a_();
|
||||
this.world.setTileEntity(i2, j, j2, tileentity);
|
||||
tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
|
||||
this.world.setTileEntity(j2, j, k2, tileentity);
|
||||
}
|
||||
|
||||
if (tileentity != null) {
|
||||
@ -474,7 +476,7 @@ public class Chunk {
|
||||
public int getBrightness(EnumSkyBlock enumskyblock, int i, int j, int k) {
|
||||
ChunkSection chunksection = this.sections[j >> 4];
|
||||
|
||||
return chunksection == null ? enumskyblock.c : (enumskyblock == EnumSkyBlock.SKY ? chunksection.c(i, j & 15, k) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.d(i, j & 15, k) : enumskyblock.c));
|
||||
return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? chunksection.c(i, j & 15, k) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.d(i, j & 15, k) : enumskyblock.c));
|
||||
}
|
||||
|
||||
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
|
||||
@ -490,11 +492,7 @@ public class Chunk {
|
||||
if (!this.world.worldProvider.e) {
|
||||
chunksection.c(i, j & 15, k, l);
|
||||
}
|
||||
} else {
|
||||
if (enumskyblock != EnumSkyBlock.BLOCK) {
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (enumskyblock == EnumSkyBlock.BLOCK) {
|
||||
chunksection.d(i, j & 15, k, l);
|
||||
}
|
||||
}
|
||||
@ -545,15 +543,15 @@ public class Chunk {
|
||||
k = this.entitySlices.length - 1;
|
||||
}
|
||||
|
||||
entity.bZ = true;
|
||||
entity.ca = this.x;
|
||||
entity.cb = k;
|
||||
entity.cc = this.z;
|
||||
entity.ag = true;
|
||||
entity.ah = this.x;
|
||||
entity.ai = k;
|
||||
entity.aj = this.z;
|
||||
this.entitySlices[k].add(entity);
|
||||
}
|
||||
|
||||
public void b(Entity entity) {
|
||||
this.a(entity, entity.cb);
|
||||
this.a(entity, entity.ai);
|
||||
}
|
||||
|
||||
public void a(Entity entity, int i) {
|
||||
@ -579,19 +577,19 @@ public class Chunk {
|
||||
if (tileentity == null) {
|
||||
int l = this.getTypeId(i, j, k);
|
||||
|
||||
if (l <= 0 || !Block.byId[l].o()) {
|
||||
if (l <= 0 || !Block.byId[l].s()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (tileentity == null) {
|
||||
tileentity = ((BlockContainer) Block.byId[l]).a_();
|
||||
tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
|
||||
this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity);
|
||||
}
|
||||
|
||||
tileentity = (TileEntity) this.tileEntities.get(chunkposition);
|
||||
}
|
||||
|
||||
if (tileentity != null && tileentity.l()) {
|
||||
if (tileentity != null && tileentity.p()) {
|
||||
this.tileEntities.remove(chunkposition);
|
||||
return null;
|
||||
} else {
|
||||
@ -613,12 +611,12 @@ public class Chunk {
|
||||
public void a(int i, int j, int k, TileEntity tileentity) {
|
||||
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||
|
||||
tileentity.world = this.world;
|
||||
tileentity.a(this.world);
|
||||
tileentity.x = this.x * 16 + i;
|
||||
tileentity.y = j;
|
||||
tileentity.z = this.z * 16 + k;
|
||||
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
|
||||
tileentity.m();
|
||||
tileentity.q();
|
||||
this.tileEntities.put(chunkposition, tileentity);
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
@ -645,9 +643,13 @@ public class Chunk {
|
||||
public void addEntities() {
|
||||
this.d = true;
|
||||
this.world.a(this.tileEntities.values());
|
||||
List[] alist = this.entitySlices;
|
||||
int i = alist.length;
|
||||
|
||||
for (int i = 0; i < this.entitySlices.length; ++i) {
|
||||
this.world.a(this.entitySlices[i]);
|
||||
for (int j = 0; j < i; ++j) {
|
||||
List list = alist[j];
|
||||
|
||||
this.world.a(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,9 +663,12 @@ public class Chunk {
|
||||
this.world.a(tileentity);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.entitySlices.length; ++i) {
|
||||
List[] alist = this.entitySlices;
|
||||
int i = alist.length;
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
// CraftBukkit start
|
||||
java.util.Iterator<Object> iter = this.entitySlices[i].iterator();
|
||||
java.util.Iterator<Object> iter = this.entitySlices[j].iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity entity = (Entity) iter.next();
|
||||
int cx = Location.locToBlock(entity.locX) >> 4;
|
||||
@ -677,7 +682,9 @@ public class Chunk {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.world.b(this.entitySlices[i]);
|
||||
List list = alist[j];
|
||||
|
||||
this.world.b(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -698,18 +705,19 @@ public class Chunk {
|
||||
}
|
||||
|
||||
for (int k = i; k <= j; ++k) {
|
||||
UnsafeList list1 = (UnsafeList) this.entitySlices[k]; // CraftBukkit - use UnsafeList
|
||||
List list1 = this.entitySlices[k];
|
||||
Iterator iterator = list1.iterator();
|
||||
|
||||
for (int l = 0; l < list1.size(); ++l) {
|
||||
Entity entity1 = (Entity) list1.unsafeGet(l); // CraftBukkit - use unsafeGet
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
|
||||
list.add(entity1);
|
||||
Entity[] aentity = entity1.bb();
|
||||
Entity[] aentity = entity1.al();
|
||||
|
||||
if (aentity != null) {
|
||||
for (int i1 = 0; i1 < aentity.length; ++i1) {
|
||||
entity1 = aentity[i1];
|
||||
for (int l = 0; l < aentity.length; ++l) {
|
||||
entity1 = aentity[l];
|
||||
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
|
||||
list.add(entity1);
|
||||
}
|
||||
@ -737,10 +745,11 @@ public class Chunk {
|
||||
}
|
||||
|
||||
for (int k = i; k <= j; ++k) {
|
||||
UnsafeList list1 = (UnsafeList) this.entitySlices[k]; // CraftBukkit - use UnsafeList
|
||||
List list1 = this.entitySlices[k];
|
||||
Iterator iterator = list1.iterator();
|
||||
|
||||
for (int l = 0; l < list1.size(); ++l) {
|
||||
Entity entity = (Entity) list1.unsafeGet(l); // CraftBukkit - use unsafeGet
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.a(axisalignedbb)) {
|
||||
list.add(entity);
|
||||
@ -769,19 +778,6 @@ public class Chunk {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void i() {
|
||||
ChunkSection[] achunksection = this.sections;
|
||||
int i = achunksection.length;
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
ChunkSection chunksection = achunksection[j];
|
||||
|
||||
if (chunksection != null) {
|
||||
chunksection.e();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
|
||||
if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) {
|
||||
ichunkprovider.getChunkAt(ichunkprovider1, i, j);
|
||||
@ -805,7 +801,7 @@ public class Chunk {
|
||||
int l = this.b[k];
|
||||
|
||||
if (l == -999) {
|
||||
int i1 = this.g() + 15;
|
||||
int i1 = this.h() + 15;
|
||||
|
||||
l = -1;
|
||||
|
||||
@ -826,13 +822,13 @@ public class Chunk {
|
||||
return l;
|
||||
}
|
||||
|
||||
public void j() {
|
||||
public void k() {
|
||||
if (this.s && !this.world.worldProvider.e) {
|
||||
this.o();
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkCoordIntPair k() {
|
||||
public ChunkCoordIntPair l() {
|
||||
return new ChunkCoordIntPair(this.x, this.z);
|
||||
}
|
||||
|
||||
@ -873,7 +869,7 @@ public class Chunk {
|
||||
return BiomeBase.biomes[k] == null ? BiomeBase.PLAINS : BiomeBase.biomes[k];
|
||||
}
|
||||
|
||||
public byte[] l() {
|
||||
public byte[] m() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
@ -881,11 +877,11 @@ public class Chunk {
|
||||
this.r = abyte;
|
||||
}
|
||||
|
||||
public void m() {
|
||||
public void n() {
|
||||
this.t = 0;
|
||||
}
|
||||
|
||||
public void n() {
|
||||
public void o() {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if (this.t >= 4096) {
|
||||
return;
|
||||
@ -904,30 +900,30 @@ public class Chunk {
|
||||
|
||||
if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].a(k, k1, l) == 0) {
|
||||
if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) {
|
||||
this.world.v(i1, l1 - 1, j1);
|
||||
this.world.x(i1, l1 - 1, j1);
|
||||
}
|
||||
|
||||
if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) {
|
||||
this.world.v(i1, l1 + 1, j1);
|
||||
this.world.x(i1, l1 + 1, j1);
|
||||
}
|
||||
|
||||
if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) {
|
||||
this.world.v(i1 - 1, l1, j1);
|
||||
this.world.x(i1 - 1, l1, j1);
|
||||
}
|
||||
|
||||
if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) {
|
||||
this.world.v(i1 + 1, l1, j1);
|
||||
this.world.x(i1 + 1, l1, j1);
|
||||
}
|
||||
|
||||
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) {
|
||||
this.world.v(i1, l1, j1 - 1);
|
||||
this.world.x(i1, l1, j1 - 1);
|
||||
}
|
||||
|
||||
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) {
|
||||
this.world.v(i1, l1, j1 + 1);
|
||||
this.world.x(i1, l1, j1 + 1);
|
||||
}
|
||||
|
||||
this.world.v(i1, l1, j1);
|
||||
this.world.x(i1, l1, j1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public Chunk emptyChunk;
|
||||
public IChunkProvider chunkProvider; // CraftBukkit
|
||||
private IChunkLoader e;
|
||||
public boolean forceChunkLoad = false;
|
||||
public boolean forceChunkLoad = true;
|
||||
public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
|
||||
public List chunkList = new ArrayList();
|
||||
public WorldServer world;
|
||||
@ -41,7 +41,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public void queueUnload(int i, int j) {
|
||||
if (this.world.worldProvider.c()) {
|
||||
if (this.world.worldProvider.e()) {
|
||||
ChunkCoordinates chunkcoordinates = this.world.getSpawn();
|
||||
int k = i * 16 + 8 - chunkcoordinates.x;
|
||||
int l = j * 16 + 8 - chunkcoordinates.z;
|
||||
@ -55,7 +55,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public void c() {
|
||||
public void a() {
|
||||
Iterator iterator = this.chunkList.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -86,7 +86,6 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
this.chunks.put(i, j, chunk); // CraftBukkit
|
||||
this.chunkList.add(chunk);
|
||||
if (chunk != null) {
|
||||
chunk.loadNOP();
|
||||
chunk.addEntities();
|
||||
}
|
||||
|
||||
@ -161,7 +160,12 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
this.e.a(this.world, chunk);
|
||||
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
ioexception.printStackTrace();
|
||||
// CraftBukkit start - remove extra exception
|
||||
}
|
||||
// } catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
// exceptionworldconflict.printStackTrace();
|
||||
// }
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,9 +202,10 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
|
||||
int i = 0;
|
||||
Iterator iterator = this.chunkList.iterator();
|
||||
|
||||
for (int j = 0; j < this.chunkList.size(); ++j) {
|
||||
Chunk chunk = (Chunk) this.chunkList.get(j);
|
||||
while (iterator.hasNext()) {
|
||||
Chunk chunk = (Chunk) iterator.next();
|
||||
|
||||
if (flag) {
|
||||
this.saveChunkNOP(chunk);
|
||||
@ -261,7 +266,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
return !this.world.savingDisabled;
|
||||
}
|
||||
|
||||
public String d() {
|
||||
public String getName() {
|
||||
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit
|
||||
}
|
||||
|
||||
@ -272,4 +277,8 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public ChunkPosition findNearestMapFeature(World world, String s, int i, int j, int k) {
|
||||
return this.chunkProvider.findNearestMapFeature(world, s, i, j, k);
|
||||
}
|
||||
|
||||
public int getLoadedChunks() {
|
||||
return this.chunks.values().size(); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
|
||||
|
||||
private List a = new ArrayList();
|
||||
private Set b = new HashSet();
|
||||
@ -29,9 +29,13 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
|
||||
synchronized (this.c) {
|
||||
if (this.b.contains(chunkcoordintpair)) {
|
||||
for (int k = 0; k < this.a.size(); ++k) {
|
||||
if (((PendingChunkToSave) this.a.get(k)).a.equals(chunkcoordintpair)) {
|
||||
nbttagcompound = ((PendingChunkToSave) this.a.get(k)).b;
|
||||
Iterator iterator = this.a.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
PendingChunkToSave pendingchunktosave = (PendingChunkToSave) iterator.next();
|
||||
|
||||
if (pendingchunktosave.a.equals(chunkcoordintpair)) {
|
||||
nbttagcompound = pendingchunktosave.b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -39,7 +43,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
}
|
||||
|
||||
if (nbttagcompound == null) {
|
||||
DataInputStream datainputstream = RegionFileCache.b(this.d, i, j);
|
||||
DataInputStream datainputstream = RegionFileCache.c(this.d, i, j);
|
||||
|
||||
if (datainputstream == null) {
|
||||
return null;
|
||||
@ -68,13 +72,18 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
chunk = this.a(world, nbttagcompound.getCompound("Level"));
|
||||
}
|
||||
|
||||
chunk.i();
|
||||
return chunk;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(World world, Chunk chunk) {
|
||||
world.m();
|
||||
// CraftBukkit start - "handle" exception
|
||||
try {
|
||||
world.B();
|
||||
} catch (ExceptionWorldConflict ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
try {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@ -82,7 +91,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
|
||||
nbttagcompound.set("Level", nbttagcompound1);
|
||||
this.a(chunk, world, nbttagcompound1);
|
||||
this.a(chunk.k(), nbttagcompound);
|
||||
this.a(chunk.l(), nbttagcompound);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
@ -112,7 +121,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
Object object = this.c;
|
||||
|
||||
synchronized (this.c) {
|
||||
if (this.a.size() <= 0) {
|
||||
if (this.a.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -131,8 +140,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - Added throws
|
||||
DataOutputStream dataoutputstream = RegionFileCache.c(this.d, pendingchunktosave.a.x, pendingchunktosave.a.z);
|
||||
public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - public -> private, added throws
|
||||
DataOutputStream dataoutputstream = RegionFileCache.d(this.d, pendingchunktosave.a.x, pendingchunktosave.a.z);
|
||||
|
||||
NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream);
|
||||
dataoutputstream.close();
|
||||
@ -145,13 +154,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
public void b() {}
|
||||
|
||||
private void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) {
|
||||
world.m();
|
||||
nbttagcompound.setInt("xPos", chunk.x);
|
||||
nbttagcompound.setInt("zPos", chunk.z);
|
||||
nbttagcompound.setLong("LastUpdate", world.getTime());
|
||||
nbttagcompound.setIntArray("HeightMap", chunk.heightMap);
|
||||
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
|
||||
ChunkSection[] achunksection = chunk.h();
|
||||
ChunkSection[] achunksection = chunk.i();
|
||||
NBTTagList nbttaglist = new NBTTagList("Sections");
|
||||
ChunkSection[] achunksection1 = achunksection;
|
||||
int i = achunksection.length;
|
||||
@ -161,23 +169,23 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
for (int j = 0; j < i; ++j) {
|
||||
ChunkSection chunksection = achunksection1[j];
|
||||
|
||||
if (chunksection != null && chunksection.f() != 0) {
|
||||
if (chunksection != null) {
|
||||
nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("Y", (byte) (chunksection.c() >> 4 & 255));
|
||||
nbttagcompound1.setByte("Y", (byte) (chunksection.d() >> 4 & 255));
|
||||
nbttagcompound1.setByteArray("Blocks", chunksection.g());
|
||||
if (chunksection.h() != null) {
|
||||
nbttagcompound1.setByteArray("Add", chunksection.h().a);
|
||||
if (chunksection.i() != null) {
|
||||
nbttagcompound1.setByteArray("Add", chunksection.i().a);
|
||||
}
|
||||
|
||||
nbttagcompound1.setByteArray("Data", chunksection.i().a);
|
||||
nbttagcompound1.setByteArray("SkyLight", chunksection.k().a);
|
||||
nbttagcompound1.setByteArray("BlockLight", chunksection.j().a);
|
||||
nbttagcompound1.setByteArray("Data", chunksection.j().a);
|
||||
nbttagcompound1.setByteArray("SkyLight", chunksection.l().a);
|
||||
nbttagcompound1.setByteArray("BlockLight", chunksection.k().a);
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.set("Sections", nbttaglist);
|
||||
nbttagcompound.setByteArray("Biomes", chunk.l());
|
||||
nbttagcompound.setByteArray("Biomes", chunk.m());
|
||||
chunk.m = false;
|
||||
NBTTagList nbttaglist1 = new NBTTagList();
|
||||
|
||||
@ -258,7 +266,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
chunksection.b(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4));
|
||||
chunksection.d(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4));
|
||||
chunksection.c(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4));
|
||||
chunksection.d();
|
||||
chunksection.e();
|
||||
achunksection[b1] = chunksection;
|
||||
}
|
||||
|
||||
@ -301,7 +309,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
for (int j1 = 0; j1 < nbttaglist3.size(); ++j1) {
|
||||
NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist3.get(j1);
|
||||
|
||||
world.d(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z"), nbttagcompound4.getInt("i"), nbttagcompound4.getInt("t"));
|
||||
world.b(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z"), nbttagcompound4.getInt("i"), nbttagcompound4.getInt("t"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class ChunkSection {
|
||||
this.f = new NibbleArray(this.d.length, 4);
|
||||
this.h = new NibbleArray(this.d.length, 4);
|
||||
this.g = new NibbleArray(this.d.length, 4);
|
||||
this.d();
|
||||
this.e();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -48,17 +48,17 @@ public class ChunkSection {
|
||||
|
||||
if (i1 == 0 && l != 0) {
|
||||
++this.b;
|
||||
if (Block.byId[l] != null && Block.byId[l].n()) {
|
||||
if (Block.byId[l] != null && Block.byId[l].r()) {
|
||||
++this.c;
|
||||
}
|
||||
} else if (i1 != 0 && l == 0) {
|
||||
--this.b;
|
||||
if (Block.byId[i1] != null && Block.byId[i1].n()) {
|
||||
if (Block.byId[i1] != null && Block.byId[i1].r()) {
|
||||
--this.c;
|
||||
}
|
||||
} else if (Block.byId[i1] != null && Block.byId[i1].n() && (Block.byId[l] == null || !Block.byId[l].n())) {
|
||||
} else if (Block.byId[i1] != null && Block.byId[i1].r() && (Block.byId[l] == null || !Block.byId[l].r())) {
|
||||
--this.c;
|
||||
} else if ((Block.byId[i1] == null || !Block.byId[i1].n()) && Block.byId[l] != null && Block.byId[l].n()) {
|
||||
} else if ((Block.byId[i1] == null || !Block.byId[i1].r()) && Block.byId[l] != null && Block.byId[l].r()) {
|
||||
++this.c;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class ChunkSection {
|
||||
return this.c > 0;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int d() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ public class ChunkSection {
|
||||
return this.g.a(i, j, k);
|
||||
}
|
||||
|
||||
public void d() {
|
||||
public void e() {
|
||||
this.b = 0;
|
||||
this.c = 0;
|
||||
|
||||
@ -127,7 +127,7 @@ public class ChunkSection {
|
||||
}
|
||||
} else {
|
||||
++this.b;
|
||||
if (Block.byId[l].n()) {
|
||||
if (Block.byId[l].r()) {
|
||||
++this.c;
|
||||
}
|
||||
}
|
||||
@ -137,29 +137,23 @@ public class ChunkSection {
|
||||
}
|
||||
}
|
||||
|
||||
public void e() {}
|
||||
|
||||
public int f() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public byte[] g() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public NibbleArray h() {
|
||||
public NibbleArray i() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public NibbleArray i() {
|
||||
public NibbleArray j() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public NibbleArray j() {
|
||||
public NibbleArray k() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public NibbleArray k() {
|
||||
public NibbleArray l() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ final class ConsoleLogFormatter extends Formatter {
|
||||
} else if (level == Level.SEVERE) {
|
||||
stringbuilder.append(" [SEVERE] ");
|
||||
} else if (level == Level.SEVERE) {
|
||||
stringbuilder.append(" [" + level.getLocalizedName() + "] ");
|
||||
stringbuilder.append(" [").append(level.getLocalizedName()).append("] ");
|
||||
}
|
||||
|
||||
stringbuilder.append(logrecord.getMessage());
|
||||
|
@ -12,8 +12,6 @@ public class ConsoleLogManager {
|
||||
public static Logger a = Logger.getLogger("Minecraft");
|
||||
public static Logger global = Logger.getLogger(""); // CraftBukkit
|
||||
|
||||
public ConsoleLogManager() {}
|
||||
|
||||
// CraftBukkit - change of method signature!
|
||||
public static void init(MinecraftServer server) {
|
||||
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(server.options.has("log-strip-color")); // CraftBukkit - pass strip color option
|
||||
|
@ -2,6 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ -12,12 +13,12 @@ import org.bukkit.inventory.InventoryView;
|
||||
|
||||
public abstract class Container {
|
||||
|
||||
public List d = new ArrayList();
|
||||
public List e = new ArrayList();
|
||||
public List a = new ArrayList();
|
||||
public List b = new ArrayList();
|
||||
public int windowId = 0;
|
||||
private short a = 0;
|
||||
private short e = 0;
|
||||
protected List listeners = new ArrayList();
|
||||
private Set b = new HashSet();
|
||||
private Set f = new HashSet();
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean checkReachable = true;
|
||||
@ -33,10 +34,11 @@ public abstract class Container {
|
||||
|
||||
public Container() {}
|
||||
|
||||
protected void a(Slot slot) {
|
||||
slot.c = this.e.size();
|
||||
this.e.add(slot);
|
||||
this.d.add(null);
|
||||
protected Slot a(Slot slot) {
|
||||
slot.d = this.b.size();
|
||||
this.b.add(slot);
|
||||
this.a.add(null);
|
||||
return slot;
|
||||
}
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
@ -44,32 +46,38 @@ public abstract class Container {
|
||||
throw new IllegalArgumentException("Listener already listening");
|
||||
} else {
|
||||
this.listeners.add(icrafting);
|
||||
icrafting.a(this, this.b());
|
||||
this.a();
|
||||
icrafting.a(this, this.a());
|
||||
this.b();
|
||||
}
|
||||
}
|
||||
|
||||
public List b() {
|
||||
public List a() {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Iterator iterator = this.b.iterator();
|
||||
|
||||
for (int i = 0; i < this.e.size(); ++i) {
|
||||
arraylist.add(((Slot) this.e.get(i)).getItem());
|
||||
while (iterator.hasNext()) {
|
||||
Slot slot = (Slot) iterator.next();
|
||||
|
||||
arraylist.add(slot.getItem());
|
||||
}
|
||||
|
||||
return arraylist;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
for (int i = 0; i < this.e.size(); ++i) {
|
||||
ItemStack itemstack = ((Slot) this.e.get(i)).getItem();
|
||||
ItemStack itemstack1 = (ItemStack) this.d.get(i);
|
||||
public void b() {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
ItemStack itemstack = ((Slot) this.b.get(i)).getItem();
|
||||
ItemStack itemstack1 = (ItemStack) this.a.get(i);
|
||||
|
||||
if (!ItemStack.matches(itemstack1, itemstack)) {
|
||||
itemstack1 = itemstack == null ? null : itemstack.cloneItemStack();
|
||||
this.d.set(i, itemstack1);
|
||||
this.a.set(i, itemstack1);
|
||||
Iterator iterator = this.listeners.iterator();
|
||||
|
||||
for (int j = 0; j < this.listeners.size(); ++j) {
|
||||
((ICrafting) this.listeners.get(j)).a(this, i, itemstack1);
|
||||
while (iterator.hasNext()) {
|
||||
ICrafting icrafting = (ICrafting) iterator.next();
|
||||
|
||||
icrafting.a(this, i, itemstack1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,23 +88,27 @@ public abstract class Container {
|
||||
}
|
||||
|
||||
public Slot a(IInventory iinventory, int i) {
|
||||
for (int j = 0; j < this.e.size(); ++j) {
|
||||
Slot slot = (Slot) this.e.get(j);
|
||||
Iterator iterator = this.b.iterator();
|
||||
|
||||
if (slot.a(iinventory, i)) {
|
||||
return slot;
|
||||
Slot slot;
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
slot = (Slot) iterator.next();
|
||||
} while (!slot.a(iinventory, i));
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
public Slot getSlot(int i) {
|
||||
return (Slot) this.e.get(i);
|
||||
return (Slot) this.b.get(i);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
public ItemStack b(int i) {
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
return slot != null ? slot.getItem() : null;
|
||||
}
|
||||
@ -118,7 +130,7 @@ public abstract class Container {
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
// CraftBukkit start - Store a reference
|
||||
// CraftBukkit start - store a reference
|
||||
ItemStack itemstack1 = playerinventory.getCarried();
|
||||
if (itemstack1.count > 0) {
|
||||
entityhuman.drop(itemstack1.a(1));
|
||||
@ -131,13 +143,13 @@ public abstract class Container {
|
||||
}
|
||||
}
|
||||
} else if (flag) {
|
||||
ItemStack itemstack1 = this.a(i);
|
||||
ItemStack itemstack1 = this.b(i);
|
||||
|
||||
if (itemstack1 != null) {
|
||||
int k = itemstack1.id;
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.getItem() != null && slot.getItem().id == k) {
|
||||
this.b(i, j, flag, entityhuman);
|
||||
@ -148,10 +160,9 @@ public abstract class Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
Slot slot1 = (Slot) this.e.get(i);
|
||||
Slot slot1 = (Slot) this.b.get(i);
|
||||
|
||||
if (slot1 != null) {
|
||||
slot1.d();
|
||||
ItemStack itemstack2 = slot1.getItem();
|
||||
ItemStack itemstack3 = playerinventory.getCarried();
|
||||
|
||||
@ -167,11 +178,13 @@ public abstract class Container {
|
||||
if (l > slot1.a()) {
|
||||
l = slot1.a();
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (itemstack3.count >= l) {
|
||||
slot1.set(itemstack3.a(l));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (itemstack3.count == 0) {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
@ -185,7 +198,7 @@ public abstract class Container {
|
||||
slot1.set((ItemStack) null);
|
||||
}
|
||||
|
||||
slot1.c(playerinventory.getCarried());
|
||||
slot1.b(playerinventory.getCarried());
|
||||
} else if (slot1.isAllowed(itemstack3)) {
|
||||
if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
|
||||
l = j == 0 ? itemstack3.count : 1;
|
||||
@ -216,9 +229,11 @@ public abstract class Container {
|
||||
slot1.set((ItemStack) null);
|
||||
}
|
||||
|
||||
slot1.c(playerinventory.getCarried());
|
||||
slot1.b(playerinventory.getCarried());
|
||||
}
|
||||
}
|
||||
|
||||
slot1.e();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,26 +256,26 @@ public abstract class Container {
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
this.a();
|
||||
this.b();
|
||||
}
|
||||
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
this.getSlot(i).set(itemstack);
|
||||
}
|
||||
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
return !this.b.contains(entityhuman);
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
return !this.f.contains(entityhuman);
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman, boolean flag) {
|
||||
if (flag) {
|
||||
this.b.remove(entityhuman);
|
||||
this.f.remove(entityhuman);
|
||||
} else {
|
||||
this.b.add(entityhuman);
|
||||
this.f.add(entityhuman);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean b(EntityHuman entityhuman);
|
||||
public abstract boolean c(EntityHuman entityhuman);
|
||||
|
||||
protected boolean a(ItemStack itemstack, int i, int j, boolean flag) {
|
||||
boolean flag1 = false;
|
||||
@ -275,7 +290,7 @@ public abstract class Container {
|
||||
|
||||
if (itemstack.isStackable()) {
|
||||
while (itemstack.count > 0 && (!flag && k < j || flag && k >= i)) {
|
||||
slot = (Slot) this.e.get(k);
|
||||
slot = (Slot) this.b.get(k);
|
||||
itemstack1 = slot.getItem();
|
||||
if (itemstack1 != null && itemstack1.id == itemstack.id && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) {
|
||||
int l = itemstack1.count + itemstack.count;
|
||||
@ -283,12 +298,12 @@ public abstract class Container {
|
||||
if (l <= itemstack.getMaxStackSize()) {
|
||||
itemstack.count = 0;
|
||||
itemstack1.count = l;
|
||||
slot.d();
|
||||
slot.e();
|
||||
flag1 = true;
|
||||
} else if (itemstack1.count < itemstack.getMaxStackSize()) {
|
||||
itemstack.count -= itemstack.getMaxStackSize() - itemstack1.count;
|
||||
itemstack1.count = itemstack.getMaxStackSize();
|
||||
slot.d();
|
||||
slot.e();
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
@ -309,11 +324,11 @@ public abstract class Container {
|
||||
}
|
||||
|
||||
while (!flag && k < j || flag && k >= i) {
|
||||
slot = (Slot) this.e.get(k);
|
||||
slot = (Slot) this.b.get(k);
|
||||
itemstack1 = slot.getItem();
|
||||
if (itemstack1 == null) {
|
||||
slot.set(itemstack.cloneItemStack());
|
||||
slot.d();
|
||||
slot.e();
|
||||
itemstack.count = 0;
|
||||
flag1 = true;
|
||||
break;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
@ -8,7 +10,8 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
public class ContainerBrewingStand extends Container {
|
||||
|
||||
private TileEntityBrewingStand brewingStand;
|
||||
private int b = 0;
|
||||
private final Slot f;
|
||||
private int g = 0;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
@ -17,10 +20,10 @@ public class ContainerBrewingStand extends Container {
|
||||
public ContainerBrewingStand(PlayerInventory playerinventory, TileEntityBrewingStand tileentitybrewingstand) {
|
||||
player = playerinventory; // CraftBukkit
|
||||
this.brewingStand = tileentitybrewingstand;
|
||||
this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 0, 56, 46));
|
||||
this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 1, 79, 53));
|
||||
this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 2, 102, 46));
|
||||
this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
|
||||
this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 0, 56, 46));
|
||||
this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 1, 79, 53));
|
||||
this.a(new SlotPotionBottle(playerinventory.player, tileentitybrewingstand, 2, 102, 46));
|
||||
this.f = this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
|
||||
|
||||
int i;
|
||||
|
||||
@ -37,38 +40,47 @@ public class ContainerBrewingStand extends Container {
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.i());
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.t_());
|
||||
}
|
||||
|
||||
public void a() {
|
||||
super.a();
|
||||
public void b() {
|
||||
super.b();
|
||||
Iterator iterator = this.listeners.iterator();
|
||||
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
ICrafting icrafting = (ICrafting) this.listeners.get(i);
|
||||
while (iterator.hasNext()) {
|
||||
ICrafting icrafting = (ICrafting) iterator.next();
|
||||
|
||||
if (this.b != this.brewingStand.i()) {
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.i());
|
||||
if (this.g != this.brewingStand.t_()) {
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.t_());
|
||||
}
|
||||
}
|
||||
|
||||
this.b = this.brewingStand.i();
|
||||
this.g = this.brewingStand.t_();
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.brewingStand.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.c()) {
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
if ((i < 0 || i > 2) && i != 3) {
|
||||
if (i >= 4 && i < 31) {
|
||||
if (!this.f.d() && this.f.isAllowed(itemstack1)) {
|
||||
if (!this.a(itemstack1, 3, 4, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (SlotPotionBottle.a_(itemstack)) {
|
||||
if (!this.a(itemstack1, 0, 3, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (i >= 4 && i < 31) {
|
||||
if (!this.a(itemstack1, 31, 40, false)) {
|
||||
return null;
|
||||
}
|
||||
@ -90,14 +102,14 @@ public class ContainerBrewingStand extends Container {
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.c(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@ -108,6 +120,7 @@ public class ContainerBrewingStand extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventory inventory = new CraftInventory(this.brewingStand);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
public class ContainerChest extends Container {
|
||||
|
||||
public IInventory container; // CraftBukkit - private->public
|
||||
private int b;
|
||||
private int f;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
@ -17,6 +17,7 @@ public class ContainerChest extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventory inventory;
|
||||
if (this.container instanceof PlayerInventory) {
|
||||
inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryPlayer((PlayerInventory) this.container);
|
||||
@ -25,6 +26,7 @@ public class ContainerChest extends Container {
|
||||
} else {
|
||||
inventory = new CraftInventory(this.container);
|
||||
}
|
||||
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
}
|
||||
@ -32,9 +34,9 @@ public class ContainerChest extends Container {
|
||||
|
||||
public ContainerChest(IInventory iinventory, IInventory iinventory1) {
|
||||
this.container = iinventory1;
|
||||
this.b = iinventory1.getSize() / 9;
|
||||
iinventory1.f();
|
||||
int i = (this.b - 4) * 18;
|
||||
this.f = iinventory1.getSize() / 9;
|
||||
iinventory1.startOpen();
|
||||
int i = (this.f - 4) * 18;
|
||||
// CraftBukkit start - save player
|
||||
// TODO: Should we check to make sure it really is an InventoryPlayer?
|
||||
this.player = (PlayerInventory)iinventory;
|
||||
@ -43,7 +45,7 @@ public class ContainerChest extends Container {
|
||||
int j;
|
||||
int k;
|
||||
|
||||
for (j = 0; j < this.b; ++j) {
|
||||
for (j = 0; j < this.f; ++j) {
|
||||
for (k = 0; k < 9; ++k) {
|
||||
this.a(new Slot(iinventory1, k + j * 9, 8 + k * 18, 18 + j * 18));
|
||||
}
|
||||
@ -60,31 +62,31 @@ public class ContainerChest extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.container.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.c()) {
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
if (i < this.b * 9) {
|
||||
if (!this.a(itemstack1, this.b * 9, this.e.size(), true)) {
|
||||
if (i < this.f * 9) {
|
||||
if (!this.a(itemstack1, this.f * 9, this.b.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.a(itemstack1, 0, this.b * 9, false)) {
|
||||
} else if (!this.a(itemstack1, 0, this.f * 9, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
slot.e();
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,6 +95,6 @@ public class ContainerChest extends Container {
|
||||
|
||||
public void a(EntityHuman entityhuman) {
|
||||
super.a(entityhuman);
|
||||
this.container.g();
|
||||
this.container.f();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
||||
public class ContainerDispenser extends Container {
|
||||
|
||||
public TileEntityDispenser items; // CraftBukkit - Private -> Public
|
||||
public TileEntityDispenser items; // CraftBukkit - private -> public
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
@ -40,16 +40,16 @@ public class ContainerDispenser extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.items.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.c()) {
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
@ -64,14 +64,14 @@ public class ContainerDispenser extends Container {
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.c(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@ -82,6 +82,7 @@ public class ContainerDispenser extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventory inventory = new CraftInventory(this.items);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// import java.util.Iterator; // CraftBukkit
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -24,7 +24,7 @@ public class ContainerEnchantTable extends Container {
|
||||
private int y;
|
||||
private int z;
|
||||
private Random l = new Random();
|
||||
public long b;
|
||||
public long f;
|
||||
public int[] costs = new int[3];
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
@ -49,8 +49,9 @@ public class ContainerEnchantTable extends Container {
|
||||
for (l = 0; l < 9; ++l) {
|
||||
this.a(new Slot(playerinventory, l, 8 + l * 18, 142));
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
player = (Player) playerinventory.player.bukkitEntity;
|
||||
player = (Player) playerinventory.player.getBukkitEntity();
|
||||
enchantSlots.player = player;
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -62,11 +63,12 @@ public class ContainerEnchantTable extends Container {
|
||||
icrafting.setContainerData(this, 2, this.costs[2]);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
super.a();
|
||||
public void b() {
|
||||
super.b();
|
||||
Iterator iterator = this.listeners.iterator();
|
||||
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
ICrafting icrafting = (ICrafting) this.listeners.get(i);
|
||||
while (iterator.hasNext()) {
|
||||
ICrafting icrafting = (ICrafting) iterator.next();
|
||||
|
||||
icrafting.setContainerData(this, 0, this.costs[0]);
|
||||
icrafting.setContainerData(this, 1, this.costs[1]);
|
||||
@ -79,8 +81,8 @@ public class ContainerEnchantTable extends Container {
|
||||
ItemStack itemstack = iinventory.getItem(0);
|
||||
int i;
|
||||
|
||||
if (itemstack != null && itemstack.q()) {
|
||||
this.b = this.l.nextLong();
|
||||
if (itemstack != null && itemstack.u()) {
|
||||
this.f = this.l.nextLong();
|
||||
if (!this.world.isStatic) {
|
||||
i = 0;
|
||||
|
||||
@ -134,7 +136,8 @@ public class ContainerEnchantTable extends Container {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.a();
|
||||
|
||||
this.b();
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 3; ++i) {
|
||||
@ -160,13 +163,14 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
CraftItemStack item = new CraftItemStack(itemstack);
|
||||
|
||||
EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.bukkitEntity, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs[i], enchants, i);
|
||||
EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs[i], enchants, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
int level = event.getExpLevelCost();
|
||||
if (event.isCancelled() || (level > entityhuman.expLevel && !entityhuman.abilities.canInstantlyBuild) || enchants.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
entityhuman.levelDown(level);
|
||||
for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
|
||||
try {
|
||||
@ -198,38 +202,48 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.world.getTypeId(this.x, this.y, this.z) != Block.ENCHANTMENT_TABLE.id ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.c()) {
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
if (i != 0) {
|
||||
return null;
|
||||
}
|
||||
if (i == 0) {
|
||||
if (!this.a(itemstack1, 1, 37, true)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (((Slot) this.b.get(0)).d() || !((Slot) this.b.get(0)).isAllowed(itemstack1)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!this.a(itemstack1, 1, 37, true)) {
|
||||
return null;
|
||||
if (itemstack1.hasTag() && itemstack1.count == 1) {
|
||||
((Slot) this.b.get(0)).set(itemstack1.cloneItemStack());
|
||||
itemstack1.count = 0;
|
||||
} else if (itemstack1.count >= 1) {
|
||||
((Slot) this.b.get(0)).set(new ItemStack(itemstack1.id, 1, itemstack1.getData()));
|
||||
--itemstack1.count;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.c(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@ -240,6 +254,7 @@ public class ContainerEnchantTable extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.enchantSlots);
|
||||
bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
||||
return bukkitEntity;
|
||||
|
@ -1,17 +1,53 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public class ContainerEnchantTableInventory extends ContainerEnchantTableSubcontainer { // CraftBukkit -> public
|
||||
// CraftBukkit start
|
||||
import java.util.List;
|
||||
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
// CraftBukkit end
|
||||
|
||||
public final ContainerEnchantTable enchantTable; // CraftBukkit -> public
|
||||
public class ContainerEnchantTableInventory extends InventorySubcontainer { // CraftBukkit -> public
|
||||
|
||||
private final ContainerEnchantTable enchantTable;
|
||||
|
||||
// CraftBukkit start
|
||||
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
public org.bukkit.entity.Player player;
|
||||
private int maxStack = MAX_STACK;
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public void onOpen(CraftHumanEntity who) {
|
||||
transaction.add(who);
|
||||
}
|
||||
|
||||
public void onClose(CraftHumanEntity who) {
|
||||
transaction.remove(who);
|
||||
}
|
||||
|
||||
public List<HumanEntity> getViewers() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
public org.bukkit.inventory.InventoryHolder getOwner() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public void setMaxStackSize(int size) {
|
||||
maxStack = size;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, int i) {
|
||||
super(s, i);
|
||||
this.enchantTable = containerenchanttable;
|
||||
super.setMaxStackSize(1); // CraftBukkit
|
||||
this.setMaxStackSize(1); // CraftBukkit
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
return super.getMaxStackSize(); // CraftBukkit
|
||||
return maxStack; // CraftBukkit
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
@ -7,10 +9,11 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
||||
public class ContainerFurnace extends Container {
|
||||
|
||||
public TileEntityFurnace furnace; // CraftBukkit - Private -> Public
|
||||
private int b = 0;
|
||||
private int c = 0;
|
||||
private TileEntityFurnace furnace;
|
||||
private int f = 0;
|
||||
private int g = 0;
|
||||
private int h = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
@ -30,7 +33,7 @@ public class ContainerFurnace extends Container {
|
||||
this.furnace = tileentityfurnace;
|
||||
this.a(new Slot(tileentityfurnace, 0, 56, 17));
|
||||
this.a(new Slot(tileentityfurnace, 1, 56, 53));
|
||||
this.a(new SlotResult2(playerinventory.player, tileentityfurnace, 2, 116, 35));
|
||||
this.a(new SlotFurnaceResult(playerinventory.player, tileentityfurnace, 2, 116, 35));
|
||||
this.player = playerinventory; // CraftBukkit - save player
|
||||
|
||||
int i;
|
||||
@ -53,17 +56,18 @@ public class ContainerFurnace extends Container {
|
||||
icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
super.a();
|
||||
public void b() {
|
||||
super.b();
|
||||
Iterator iterator = this.listeners.iterator();
|
||||
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
ICrafting icrafting = (ICrafting) this.listeners.get(i);
|
||||
while (iterator.hasNext()) {
|
||||
ICrafting icrafting = (ICrafting) iterator.next();
|
||||
|
||||
if (this.b != this.furnace.cookTime) {
|
||||
if (this.f != this.furnace.cookTime) {
|
||||
icrafting.setContainerData(this, 0, this.furnace.cookTime);
|
||||
}
|
||||
|
||||
if (this.c != this.furnace.burnTime) {
|
||||
if (this.g != this.furnace.burnTime) {
|
||||
icrafting.setContainerData(this, 1, this.furnace.burnTime);
|
||||
}
|
||||
|
||||
@ -72,21 +76,21 @@ public class ContainerFurnace extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
this.b = this.furnace.cookTime;
|
||||
this.c = this.furnace.burnTime;
|
||||
this.f = this.furnace.cookTime;
|
||||
this.g = this.furnace.burnTime;
|
||||
this.h = this.furnace.ticksForCurrentFuel;
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.furnace.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.c()) {
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
@ -97,7 +101,7 @@ public class ContainerFurnace extends Container {
|
||||
|
||||
slot.a(itemstack1, itemstack);
|
||||
} else if (i != 1 && i != 0) {
|
||||
if (FurnaceRecipes.getInstance().getResult(itemstack1.getItem().id) != null) {
|
||||
if (RecipesFurnace.getInstance().getResult(itemstack1.getItem().id) != null) {
|
||||
if (!this.a(itemstack1, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
@ -119,14 +123,14 @@ public class ContainerFurnace extends Container {
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.c(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
130
src/main/java/net/minecraft/server/ContainerMerchant.java
Normale Datei
130
src/main/java/net/minecraft/server/ContainerMerchant.java
Normale Datei
@ -0,0 +1,130 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
|
||||
|
||||
public class ContainerMerchant extends Container {
|
||||
|
||||
private IMerchant merchant;
|
||||
private InventoryMerchant f;
|
||||
private final World g;
|
||||
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
|
||||
@Override
|
||||
public CraftInventoryView getBukkitView() {
|
||||
if (bukkitEntity == null) {
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), new org.bukkit.craftbukkit.inventory.CraftInventoryMerchant(this.getMerchantInventory()), this);
|
||||
}
|
||||
return bukkitEntity;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) {
|
||||
this.merchant = imerchant;
|
||||
this.g = world;
|
||||
this.f = new InventoryMerchant(playerinventory.player, imerchant);
|
||||
this.a(new Slot(this.f, 0, 36, 53));
|
||||
this.a(new Slot(this.f, 1, 62, 53));
|
||||
this.a((Slot) (new SlotMerchantResult(playerinventory.player, imerchant, this.f, 2, 120, 53)));
|
||||
this.player = playerinventory; // CraftBukkit - save player
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.a(new Slot(playerinventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.a(new Slot(playerinventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryMerchant getMerchantInventory() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
}
|
||||
|
||||
public void b() {
|
||||
super.b();
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
this.f.g();
|
||||
super.a(iinventory);
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
this.f.c(i);
|
||||
}
|
||||
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
return this.merchant.l_() == entityhuman;
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
if (i == 2) {
|
||||
if (!this.a(itemstack1, 3, 39, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.a(itemstack1, itemstack);
|
||||
} else if (i != 0 && i != 1) {
|
||||
if (i >= 3 && i < 30) {
|
||||
if (!this.a(itemstack1, 30, 39, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (i >= 30 && i < 39 && !this.a(itemstack1, 3, 30, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.a(itemstack1, 3, 39, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman) {
|
||||
super.a(entityhuman);
|
||||
this.merchant.a_((EntityHuman) null);
|
||||
super.a(entityhuman);
|
||||
if (!this.g.isStatic) {
|
||||
ItemStack itemstack = this.f.splitWithoutUpdate(0);
|
||||
|
||||
if (itemstack != null) {
|
||||
entityhuman.drop(itemstack);
|
||||
}
|
||||
|
||||
itemstack = this.f.splitWithoutUpdate(1);
|
||||
if (itemstack != null) {
|
||||
entityhuman.drop(itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ public class ContainerPlayer extends Container {
|
||||
|
||||
public InventoryCrafting craftInventory;
|
||||
public IInventory resultInventory;
|
||||
public boolean c;
|
||||
public boolean g;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
@ -24,8 +24,8 @@ public class ContainerPlayer extends Container {
|
||||
this.craftInventory = new InventoryCrafting(this, 2, 2, playerinventory.player); // CraftBukkit - pass player
|
||||
this.craftInventory.resultInventory = this.resultInventory; // CraftBukkit - let InventoryCrafting know about its result slot
|
||||
this.player = playerinventory; // CraftBukkit - save player
|
||||
this.c = false;
|
||||
this.c = flag;
|
||||
this.g = false;
|
||||
this.g = flag;
|
||||
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 144, 36)));
|
||||
|
||||
int i;
|
||||
@ -82,15 +82,15 @@ public class ContainerPlayer extends Container {
|
||||
this.resultInventory.setItem(0, (ItemStack) null);
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.c()) {
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
@ -100,6 +100,20 @@ public class ContainerPlayer extends Container {
|
||||
}
|
||||
|
||||
slot.a(itemstack1, itemstack);
|
||||
} else if (i >= 1 && i < 5) {
|
||||
if (!this.a(itemstack1, 9, 45, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (i >= 5 && i < 9) {
|
||||
if (!this.a(itemstack1, 9, 45, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.b.get(5 + ((ItemArmor) itemstack.getItem()).a)).d()) {
|
||||
int j = 5 + ((ItemArmor) itemstack.getItem()).a;
|
||||
|
||||
if (!this.a(itemstack1, j, j + 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (i >= 9 && i < 36) {
|
||||
if (!this.a(itemstack1, 36, 45, false)) {
|
||||
return null;
|
||||
@ -115,14 +129,14 @@ public class ContainerPlayer extends Container {
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.c(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@ -133,6 +147,7 @@ public class ContainerPlayer extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
|
@ -9,7 +9,7 @@ public class ContainerWorkbench extends Container {
|
||||
|
||||
public InventoryCrafting craftInventory; // CraftBukkit - move initialization into constructor
|
||||
public IInventory resultInventory; // CraftBukkit - move initialization into constructor
|
||||
private World c;
|
||||
private World g;
|
||||
private int h;
|
||||
private int i;
|
||||
private int j;
|
||||
@ -25,7 +25,7 @@ public class ContainerWorkbench extends Container {
|
||||
this.craftInventory.resultInventory = this.resultInventory;
|
||||
this.player = playerinventory;
|
||||
// CraftBukkit end
|
||||
this.c = world;
|
||||
this.g = world;
|
||||
this.h = i;
|
||||
this.i = j;
|
||||
this.j = k;
|
||||
@ -69,7 +69,7 @@ public class ContainerWorkbench extends Container {
|
||||
|
||||
public void a(EntityHuman entityhuman) {
|
||||
super.a(entityhuman);
|
||||
if (!this.c.isStatic) {
|
||||
if (!this.g.isStatic) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
|
||||
|
||||
@ -80,16 +80,16 @@ public class ContainerWorkbench extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.c.getTypeId(this.h, this.i, this.j) != Block.WORKBENCH.id ? false : entityhuman.e((double) this.h + 0.5D, (double) this.i + 0.5D, (double) this.j + 0.5D) <= 64.0D;
|
||||
return this.g.getTypeId(this.h, this.i, this.j) != Block.WORKBENCH.id ? false : entityhuman.e((double) this.h + 0.5D, (double) this.i + 0.5D, (double) this.j + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
public ItemStack b(int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.e.get(i);
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.c()) {
|
||||
if (slot != null && slot.d()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
@ -114,14 +114,14 @@ public class ContainerWorkbench extends Container {
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.c(itemstack1);
|
||||
slot.b(itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@ -132,6 +132,7 @@ public class ContainerWorkbench extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
|
@ -3,6 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
@ -10,9 +11,9 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
public class CraftingManager {
|
||||
|
||||
private static final CraftingManager a = new CraftingManager();
|
||||
public List recipies = new ArrayList(); // CraftBukkit - private -> public
|
||||
public List recipes = new ArrayList(); // CraftBukkit - private -> public
|
||||
// CraftBukkit start
|
||||
public CraftingRecipe lastRecipe;
|
||||
public IRecipe lastRecipe;
|
||||
public org.bukkit.inventory.InventoryView lastCraftView;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -29,7 +30,8 @@ public class CraftingManager {
|
||||
(new RecipesArmor()).a(this);
|
||||
(new RecipesDyes()).a(this);
|
||||
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.registerShapelessRecipe(new ItemStack(Item.BOOK, 1), new Object[] { Item.PAPER, Item.PAPER, Item.PAPER, Item.LEATHER});
|
||||
this.registerShapelessRecipe(new ItemStack(Item.BOOK_AND_QUILL, 1), new Object[] { Item.BOOK, new ItemStack(Item.INK_SACK, 1, 0), Item.FEATHER});
|
||||
this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.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});
|
||||
@ -45,14 +47,17 @@ public class CraftingManager {
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Block.BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.LADDER, 3), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Item.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.SIGN, 1), new Object[] { "###", "###", " X ", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.SIGN, 3), new Object[] { "###", "###", " X ", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.CAKE, 1), new Object[] { "AAA", "BEB", "CCC", Character.valueOf('A'), Item.MILK_BUCKET, Character.valueOf('B'), Item.SUGAR, Character.valueOf('C'), Item.WHEAT, Character.valueOf('E'), Item.EGG});
|
||||
this.registerShapedRecipe(new ItemStack(Item.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Item.SUGAR_CANE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD, 4, 0), new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.LOG, 1, 0)});
|
||||
@ -77,15 +82,21 @@ public class CraftingManager {
|
||||
this.registerShapedRecipe(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.FLINT_AND_STEEL, 1), new Object[] { "A ", " B", Character.valueOf('A'), Item.IRON_INGOT, Character.valueOf('B'), Item.FLINT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Item.WHEAT});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.BIRCH_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.SPRUCE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.JUNGLE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
|
||||
this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
|
||||
this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.NETHER_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.SANDSTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SANDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(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('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.APPLE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.APPLE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.TRIPWIRE_SOURCE, 2), new Object[] { "I", "S", "#", Character.valueOf('#'), Block.WOOD, Character.valueOf('S'), Item.STICK, Character.valueOf('I'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Block.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.REDSTONE, Character.valueOf('I'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.REDSTONE});
|
||||
@ -104,12 +115,12 @@ public class CraftingManager {
|
||||
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, new ItemStack(Item.COAL, 1, 1)});
|
||||
//Collections.sort(this.b, new RecipeSorter(this)); // CraftBukkit - removed; see below
|
||||
this.sort(); // CraftBukkit - moved sort to a separate method
|
||||
System.out.println(this.recipies.size() + " recipes");
|
||||
System.out.println(this.recipes.size() + " recipes");
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public void sort() {
|
||||
Collections.sort(this.recipies, new RecipeSorter(this));
|
||||
Collections.sort(this.recipes, new RecipeSorter(this));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -118,12 +129,16 @@ public class CraftingManager {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int l;
|
||||
|
||||
if (aobject[i] instanceof String[]) {
|
||||
String[] astring = (String[]) ((String[]) aobject[i++]);
|
||||
String[] astring1 = astring;
|
||||
|
||||
for (int l = 0; l < astring.length; ++l) {
|
||||
String s1 = astring[l];
|
||||
l = astring.length;
|
||||
|
||||
for (int i1 = 0; i1 < l; ++i1) {
|
||||
String s1 = astring1[i1];
|
||||
|
||||
++k;
|
||||
j = s1.length();
|
||||
@ -158,17 +173,17 @@ public class CraftingManager {
|
||||
|
||||
ItemStack[] aitemstack = new ItemStack[j * k];
|
||||
|
||||
for (int i1 = 0; i1 < j * k; ++i1) {
|
||||
char c0 = s.charAt(i1);
|
||||
for (l = 0; l < j * k; ++l) {
|
||||
char c0 = s.charAt(l);
|
||||
|
||||
if (hashmap.containsKey(Character.valueOf(c0))) {
|
||||
aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
|
||||
aitemstack[l] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
|
||||
} else {
|
||||
aitemstack[i1] = null;
|
||||
aitemstack[l] = null;
|
||||
}
|
||||
}
|
||||
|
||||
this.recipies.add(new ShapedRecipes(j, k, aitemstack, itemstack));
|
||||
this.recipes.add(new ShapedRecipes(j, k, aitemstack, itemstack));
|
||||
}
|
||||
|
||||
public void registerShapelessRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
|
||||
@ -192,7 +207,7 @@ public class CraftingManager {
|
||||
}
|
||||
}
|
||||
|
||||
this.recipies.add(new ShapelessRecipes(itemstack, arraylist));
|
||||
this.recipes.add(new ShapelessRecipes(itemstack, arraylist));
|
||||
}
|
||||
|
||||
public ItemStack craft(InventoryCrafting inventorycrafting) {
|
||||
@ -200,9 +215,7 @@ public class CraftingManager {
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack1 = null;
|
||||
|
||||
int j;
|
||||
|
||||
for (j = 0; j < inventorycrafting.getSize(); ++j) {
|
||||
for (int j = 0; j < inventorycrafting.getSize(); ++j) {
|
||||
ItemStack itemstack2 = inventorycrafting.getItem(j);
|
||||
|
||||
if (itemstack2 != null) {
|
||||
@ -218,10 +231,10 @@ public class CraftingManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].g()) {
|
||||
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].m()) {
|
||||
Item item = Item.byId[itemstack.id];
|
||||
int k = item.getMaxDurability() - itemstack.g();
|
||||
int l = item.getMaxDurability() - itemstack1.g();
|
||||
int k = item.getMaxDurability() - itemstack.i();
|
||||
int l = item.getMaxDurability() - itemstack1.i();
|
||||
int i1 = k + l + item.getMaxDurability() * 10 / 100;
|
||||
int j1 = item.getMaxDurability() - i1;
|
||||
|
||||
@ -240,24 +253,27 @@ public class CraftingManager {
|
||||
return result;
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
for (j = 0; j < this.recipies.size(); ++j) {
|
||||
CraftingRecipe craftingrecipe = (CraftingRecipe) this.recipies.get(j);
|
||||
Iterator iterator = this.recipes.iterator();
|
||||
|
||||
if (craftingrecipe.a(inventorycrafting)) {
|
||||
// CraftBukkit start - INVENTORY_PRE_CRAFT event
|
||||
inventorycrafting.currentRecipe = craftingrecipe;
|
||||
ItemStack result = craftingrecipe.b(inventorycrafting);
|
||||
result = CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
|
||||
return result;
|
||||
// CraftBukkit end
|
||||
IRecipe irecipe;
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
inventorycrafting.currentRecipe = null; // CraftBukkit
|
||||
return null;
|
||||
|
||||
irecipe = (IRecipe) iterator.next();
|
||||
} while (!irecipe.a(inventorycrafting));
|
||||
|
||||
// CraftBukkit start - INVENTORY_PRE_CRAFT event
|
||||
inventorycrafting.currentRecipe = irecipe;
|
||||
ItemStack result = irecipe.b(inventorycrafting);
|
||||
return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
public List getRecipies() {
|
||||
return this.recipies;
|
||||
public List getRecipes() {
|
||||
return this.recipes;
|
||||
}
|
||||
}
|
||||
|
307
src/main/java/net/minecraft/server/DedicatedServer.java
Normale Datei
307
src/main/java/net/minecraft/server/DedicatedServer.java
Normale Datei
@ -0,0 +1,307 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.logging.Level;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.io.PrintStream;
|
||||
|
||||
import org.bukkit.craftbukkit.LoggerOutputStream;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
private final List l = Collections.synchronizedList(new ArrayList());
|
||||
private RemoteStatusListener m;
|
||||
private RemoteControlListener n;
|
||||
public PropertyManager propertyManager; // CraftBukkit - private -> public
|
||||
private boolean generateStructures;
|
||||
private EnumGamemode q;
|
||||
private ServerConnection r;
|
||||
private boolean s = false;
|
||||
|
||||
// CraftBukkit start - Signature changed
|
||||
public DedicatedServer(joptsimple.OptionSet options) {
|
||||
super(options);
|
||||
// CraftBukkit end
|
||||
new ThreadSleepForever(this);
|
||||
}
|
||||
|
||||
protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException
|
||||
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this);
|
||||
|
||||
threadcommandreader.setDaemon(true);
|
||||
threadcommandreader.start();
|
||||
ConsoleLogManager.init(this); // CraftBukkit
|
||||
|
||||
// CraftBukkit start
|
||||
System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
|
||||
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
|
||||
// CraftBukkit end
|
||||
|
||||
log.info("Starting minecraft server version 1.3.1");
|
||||
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
|
||||
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
}
|
||||
|
||||
log.info("Loading properties");
|
||||
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
|
||||
if (this.H()) {
|
||||
this.e("127.0.0.1");
|
||||
} else {
|
||||
this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
|
||||
this.e(this.propertyManager.getString("server-ip", ""));
|
||||
}
|
||||
|
||||
this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
|
||||
this.setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true));
|
||||
this.setPvP(this.propertyManager.getBoolean("pvp", true));
|
||||
this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
|
||||
this.setTexturePack(this.propertyManager.getString("texture-pack", ""));
|
||||
this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
|
||||
this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
|
||||
int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
|
||||
|
||||
this.q = WorldSettings.a(i);
|
||||
log.info("Default game type: " + this.q);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
if (this.getServerIp().length() > 0) {
|
||||
inetaddress = InetAddress.getByName(this.getServerIp());
|
||||
}
|
||||
|
||||
if (this.F() < 0) {
|
||||
this.setPort(this.propertyManager.getInt("server-port", 25565));
|
||||
}
|
||||
|
||||
log.info("Generating keypair");
|
||||
this.a(MinecraftEncryption.b());
|
||||
log.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.F());
|
||||
|
||||
try {
|
||||
this.r = new DedicatedServerConnection(this, inetaddress, this.F());
|
||||
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
||||
log.warning("**** FAILED TO BIND TO PORT!");
|
||||
log.log(Level.WARNING, "The exception was: " + ioexception.toString());
|
||||
log.warning("Perhaps a server is already running on that port?");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.getOnlineMode()) {
|
||||
log.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
log.warning("The server will make no attempt to authenticate usernames. Beware.");
|
||||
log.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
log.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
}
|
||||
|
||||
this.a((ServerConfigurationManagerAbstract) (new ServerConfigurationManager(this)));
|
||||
this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
|
||||
long j = System.nanoTime();
|
||||
|
||||
if (this.I() == null) {
|
||||
this.m(this.propertyManager.getString("level-name", "world"));
|
||||
}
|
||||
|
||||
String s = this.propertyManager.getString("level-seed", "");
|
||||
String s1 = this.propertyManager.getString("level-type", "DEFAULT");
|
||||
long k = (new Random()).nextLong();
|
||||
|
||||
if (s.length() > 0) {
|
||||
try {
|
||||
long l = Long.parseLong(s);
|
||||
|
||||
if (l != 0L) {
|
||||
k = l;
|
||||
}
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
k = (long) s.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
WorldType worldtype = WorldType.getType(s1);
|
||||
|
||||
if (worldtype == null) {
|
||||
worldtype = WorldType.NORMAL;
|
||||
}
|
||||
|
||||
this.d(this.propertyManager.getInt("max-build-height", 256));
|
||||
this.d((this.getMaxBuildHeight() + 8) / 16 * 16);
|
||||
this.d(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
|
||||
this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
|
||||
log.info("Preparing level \"" + this.I() + "\"");
|
||||
this.a(this.I(), this.I(), k, worldtype);
|
||||
long i1 = System.nanoTime() - j;
|
||||
String s2 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
|
||||
|
||||
log.info("Done (" + s2 + ")! For help, type \"help\" or \"?\"");
|
||||
if (this.propertyManager.getBoolean("enable-query", false)) {
|
||||
log.info("Starting GS4 status listener");
|
||||
this.m = new RemoteStatusListener(this);
|
||||
this.m.a();
|
||||
}
|
||||
|
||||
if (this.propertyManager.getBoolean("enable-rcon", false)) {
|
||||
log.info("Starting remote control listener");
|
||||
this.n = new RemoteControlListener(this);
|
||||
this.n.a();
|
||||
this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public PropertyManager getPropertyManager() {
|
||||
return this.propertyManager;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public boolean getGenerateStructures() {
|
||||
return this.generateStructures;
|
||||
}
|
||||
|
||||
public EnumGamemode getGamemode() {
|
||||
return this.q;
|
||||
}
|
||||
|
||||
public int getDifficulty() {
|
||||
return this.propertyManager.getInt("difficulty", 1);
|
||||
}
|
||||
|
||||
public boolean isHardcore() {
|
||||
return this.propertyManager.getBoolean("hardcore", false);
|
||||
}
|
||||
|
||||
protected void a(CrashReport crashreport) {
|
||||
while (this.isRunning()) {
|
||||
this.ah();
|
||||
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
} catch (InterruptedException interruptedexception) {
|
||||
interruptedexception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
crashreport.a("Type", (Callable) (new CrashReportType(this)));
|
||||
return super.b(crashreport);
|
||||
}
|
||||
|
||||
protected void o() {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void q() {
|
||||
super.q();
|
||||
this.ah();
|
||||
}
|
||||
|
||||
public boolean getAllowNether() {
|
||||
return this.propertyManager.getBoolean("allow-nether", true);
|
||||
}
|
||||
|
||||
public boolean getSpawnMonsters() {
|
||||
return this.propertyManager.getBoolean("spawn-monsters", true);
|
||||
}
|
||||
|
||||
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
|
||||
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.ai().getHasWhitelist()));
|
||||
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.ai().getWhitelisted().size()));
|
||||
super.a(mojangstatisticsgenerator);
|
||||
}
|
||||
|
||||
public boolean getSnooperEnabled() {
|
||||
return this.propertyManager.getBoolean("snooper-enabled", true);
|
||||
}
|
||||
|
||||
public void issueCommand(String s, ICommandListener icommandlistener) {
|
||||
this.l.add(new ServerCommand(s, icommandlistener));
|
||||
}
|
||||
|
||||
public void ah() {
|
||||
while (!this.l.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
|
||||
|
||||
// CraftBukkit start - ServerCommand for preprocessing
|
||||
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
servercommand = new ServerCommand(event.getCommand(), servercommand.source);
|
||||
|
||||
// this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
|
||||
this.server.dispatchServerCommand(this.console, servercommand);
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
public boolean S() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ServerConfigurationManager ai() {
|
||||
return (ServerConfigurationManager) super.getServerConfigurationManager();
|
||||
}
|
||||
|
||||
public ServerConnection ac() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public int a(String s, int i) {
|
||||
return this.propertyManager.getInt(s, i);
|
||||
}
|
||||
|
||||
public String a(String s, String s1) {
|
||||
return this.propertyManager.getString(s, s1);
|
||||
}
|
||||
|
||||
public boolean a(String s, boolean flag) {
|
||||
return this.propertyManager.getBoolean(s, flag);
|
||||
}
|
||||
|
||||
public void a(String s, Object object) {
|
||||
this.propertyManager.a(s, object);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.propertyManager.savePropertiesFile();
|
||||
}
|
||||
|
||||
public String c() {
|
||||
File file1 = this.propertyManager.c();
|
||||
|
||||
return file1 != null ? file1.getAbsolutePath() : "No settings file";
|
||||
}
|
||||
|
||||
public void aj() {
|
||||
ServerGUI.a(this);
|
||||
this.s = true;
|
||||
}
|
||||
|
||||
public boolean ae() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public String a(EnumGamemode enumgamemode, boolean flag) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public ServerConfigurationManagerAbstract getServerConfigurationManager() {
|
||||
return this.ai();
|
||||
}
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public abstract class Enchantment {
|
||||
// CraftBukkit - update CraftEnchant.getName(i) if this changes.
|
||||
|
||||
// CraftBukkit - update CraftEnchant.getName(i) if this changes
|
||||
public static final Enchantment[] byId = new Enchantment[256];
|
||||
public static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentProtection(0, 10, 0);
|
||||
public static final Enchantment PROTECTION_FIRE = new EnchantmentProtection(1, 5, 1);
|
||||
@ -74,7 +75,7 @@ public abstract class Enchantment {
|
||||
return this != enchantment;
|
||||
}
|
||||
|
||||
public Enchantment a(String s) {
|
||||
public Enchantment b(String s) {
|
||||
this.name = s;
|
||||
return this;
|
||||
}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -7,8 +7,8 @@ public abstract class EntityAgeable extends EntityCreature {
|
||||
super(world);
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(12, new Integer(0));
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ public abstract class EntityAgeable extends EntityCreature {
|
||||
this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
|
||||
}
|
||||
|
||||
public void e() {
|
||||
super.e();
|
||||
public void d() {
|
||||
super.d();
|
||||
int i = this.getAge();
|
||||
|
||||
if (ageLocked) return; // CraftBukkit
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
@ -11,29 +12,28 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
|
||||
public class EntityArrow extends Entity {
|
||||
|
||||
private int d = -1;
|
||||
private int e = -1;
|
||||
private int f = -1;
|
||||
private int g = -1;
|
||||
private int g = 0;
|
||||
private int h = 0;
|
||||
private int i = 0;
|
||||
private boolean inGround = false;
|
||||
public boolean fromPlayer = false;
|
||||
public int fromPlayer = 0;
|
||||
public int shake = 0;
|
||||
public Entity shooter;
|
||||
private int k;
|
||||
private int l = 0;
|
||||
private int j;
|
||||
private int an = 0;
|
||||
private double damage = 2.0D;
|
||||
private int n;
|
||||
public boolean d = false;
|
||||
private int ap;
|
||||
|
||||
public EntityArrow(World world) {
|
||||
super(world);
|
||||
this.b(0.5F, 0.5F);
|
||||
this.a(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntityArrow(World world, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.b(0.5F, 0.5F);
|
||||
this.a(0.5F, 0.5F);
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.height = 0.0F;
|
||||
}
|
||||
@ -41,7 +41,10 @@ public class EntityArrow extends Entity {
|
||||
public EntityArrow(World world, EntityLiving entityliving, EntityLiving entityliving1, float f, float f1) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
this.fromPlayer = entityliving instanceof EntityHuman;
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
this.fromPlayer = 1;
|
||||
}
|
||||
|
||||
this.locY = entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D;
|
||||
double d0 = entityliving1.locX - entityliving.locX;
|
||||
double d1 = entityliving1.locY + (double) entityliving1.getHeadHeight() - 0.699999988079071D - this.locY;
|
||||
@ -65,8 +68,11 @@ public class EntityArrow extends Entity {
|
||||
public EntityArrow(World world, EntityLiving entityliving, float f) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
this.fromPlayer = entityliving instanceof EntityHuman;
|
||||
this.b(0.5F, 0.5F);
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
this.fromPlayer = 1;
|
||||
}
|
||||
|
||||
this.a(0.5F, 0.5F);
|
||||
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
@ -79,7 +85,9 @@ public class EntityArrow extends Entity {
|
||||
this.shoot(this.motX, this.motY, this.motZ, f * 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public void shoot(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
@ -100,11 +108,11 @@ public class EntityArrow extends Entity {
|
||||
|
||||
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
|
||||
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
|
||||
this.k = 0;
|
||||
this.j = 0;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
super.F_();
|
||||
public void h_() {
|
||||
super.h_();
|
||||
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
|
||||
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
@ -112,13 +120,13 @@ public class EntityArrow extends Entity {
|
||||
this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
|
||||
}
|
||||
|
||||
int i = this.world.getTypeId(this.e, this.f, this.g);
|
||||
int i = this.world.getTypeId(this.d, this.e, this.f);
|
||||
|
||||
if (i > 0) {
|
||||
Block.byId[i].updateShape(this.world, this.e, this.f, this.g);
|
||||
AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.e, this.f, this.g);
|
||||
Block.byId[i].updateShape(this.world, this.d, this.e, this.f);
|
||||
AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.d, this.e, this.f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) {
|
||||
if (axisalignedbb != null && axisalignedbb.a(Vec3D.a().create(this.locX, this.locY, this.locZ))) {
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
@ -128,12 +136,12 @@ public class EntityArrow extends Entity {
|
||||
}
|
||||
|
||||
if (this.inGround) {
|
||||
i = this.world.getTypeId(this.e, this.f, this.g);
|
||||
int j = this.world.getData(this.e, this.f, this.g);
|
||||
int j = this.world.getTypeId(this.d, this.e, this.f);
|
||||
int k = this.world.getData(this.d, this.e, this.f);
|
||||
|
||||
if (i == this.h && j == this.i) {
|
||||
++this.k;
|
||||
if (this.k == 1200) {
|
||||
if (j == this.g && k == this.h) {
|
||||
++this.j;
|
||||
if (this.j == 1200) {
|
||||
this.die();
|
||||
}
|
||||
} else {
|
||||
@ -141,32 +149,32 @@ public class EntityArrow extends Entity {
|
||||
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.k = 0;
|
||||
this.l = 0;
|
||||
this.j = 0;
|
||||
this.an = 0;
|
||||
}
|
||||
} else {
|
||||
++this.l;
|
||||
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);
|
||||
++this.an;
|
||||
Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
|
||||
|
||||
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
int k;
|
||||
float f1;
|
||||
|
||||
for (k = 0; k < list.size(); ++k) {
|
||||
Entity entity1 = (Entity) list.get(k);
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1.o_() && (entity1 != this.shooter || this.l >= 5)) {
|
||||
if (entity1.L() && (entity1 != this.shooter || this.an >= 5)) {
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
|
||||
@ -196,9 +204,9 @@ public class EntityArrow extends Entity {
|
||||
// CraftBukkit end
|
||||
if (movingobjectposition.entity != null) {
|
||||
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
int l = (int) Math.ceil((double) f2 * this.damage);
|
||||
int l = MathHelper.f((double) f2 * this.damage);
|
||||
|
||||
if (this.d) {
|
||||
if (this.g()) {
|
||||
l += this.random.nextInt(l / 2 + 2);
|
||||
}
|
||||
|
||||
@ -222,14 +230,14 @@ public class EntityArrow extends Entity {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
//if (movingobjectposition.entity.damageEntity(damagesource, l)) { // CraftBukkit
|
||||
// if (movingobjectposition.entity.damageEntity(damagesource, l)) { // CraftBukkit - moved up
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
++((EntityLiving) movingobjectposition.entity).aI;
|
||||
if (this.n > 0) {
|
||||
++((EntityLiving) movingobjectposition.entity).bd;
|
||||
if (this.ap > 0) {
|
||||
float f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
if (f3 > 0.0F) {
|
||||
movingobjectposition.entity.b_(this.motX * (double) this.n * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.n * 0.6000000238418579D / (double) f3);
|
||||
movingobjectposition.entity.g(this.motX * (double) this.ap * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.ap * 0.6000000238418579D / (double) f3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,14 +250,14 @@ public class EntityArrow extends Entity {
|
||||
this.motZ *= -0.10000000149011612D;
|
||||
this.yaw += 180.0F;
|
||||
this.lastYaw += 180.0F;
|
||||
this.l = 0;
|
||||
this.an = 0;
|
||||
}
|
||||
} else {
|
||||
this.e = movingobjectposition.b;
|
||||
this.f = movingobjectposition.c;
|
||||
this.g = movingobjectposition.d;
|
||||
this.h = this.world.getTypeId(this.e, this.f, this.g);
|
||||
this.i = this.world.getData(this.e, this.f, this.g);
|
||||
this.d = movingobjectposition.b;
|
||||
this.e = movingobjectposition.c;
|
||||
this.f = movingobjectposition.d;
|
||||
this.g = this.world.getTypeId(this.d, this.e, this.f);
|
||||
this.h = this.world.getData(this.d, this.e, this.f);
|
||||
this.motX = (double) ((float) (movingobjectposition.pos.a - this.locX));
|
||||
this.motY = (double) ((float) (movingobjectposition.pos.b - this.locY));
|
||||
this.motZ = (double) ((float) (movingobjectposition.pos.c - this.locZ));
|
||||
@ -260,13 +268,13 @@ public class EntityArrow extends Entity {
|
||||
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;
|
||||
this.d(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.d) {
|
||||
for (k = 0; k < 4; ++k) {
|
||||
this.world.a("crit", this.locX + this.motX * (double) k / 4.0D, this.locY + this.motY * (double) k / 4.0D, this.locZ + this.motZ * (double) k / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
|
||||
if (this.g()) {
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
this.world.a("crit", this.locX + this.motX * (double) i1 / 4.0D, this.locY + this.motY * (double) i1 / 4.0D, this.locZ + this.motZ * (double) i1 / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,8 +305,8 @@ public class EntityArrow extends Entity {
|
||||
float f4 = 0.99F;
|
||||
|
||||
f1 = 0.05F;
|
||||
if (this.aU()) {
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
if (this.H()) {
|
||||
for (int j1 = 0; j1 < 4; ++j1) {
|
||||
float f5 = 0.25F;
|
||||
|
||||
this.world.a("bubble", this.locX - this.motX * (double) f5, this.locY - this.motY * (double) f5, this.locZ - this.motZ * (double) f5, this.motX, this.motY, this.motZ);
|
||||
@ -312,40 +320,46 @@ public class EntityArrow extends Entity {
|
||||
this.motZ *= (double) f4;
|
||||
this.motY -= (double) f1;
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.D();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("xTile", (short) this.e);
|
||||
nbttagcompound.setShort("yTile", (short) this.f);
|
||||
nbttagcompound.setShort("zTile", (short) this.g);
|
||||
nbttagcompound.setByte("inTile", (byte) this.h);
|
||||
nbttagcompound.setByte("inData", (byte) this.i);
|
||||
nbttagcompound.setShort("xTile", (short) this.d);
|
||||
nbttagcompound.setShort("yTile", (short) this.e);
|
||||
nbttagcompound.setShort("zTile", (short) this.f);
|
||||
nbttagcompound.setByte("inTile", (byte) this.g);
|
||||
nbttagcompound.setByte("inData", (byte) this.h);
|
||||
nbttagcompound.setByte("shake", (byte) this.shake);
|
||||
nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
|
||||
nbttagcompound.setBoolean("player", this.fromPlayer);
|
||||
nbttagcompound.setByte("pickup", (byte) this.fromPlayer);
|
||||
nbttagcompound.setDouble("damage", this.damage);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.e = nbttagcompound.getShort("xTile");
|
||||
this.f = nbttagcompound.getShort("yTile");
|
||||
this.g = nbttagcompound.getShort("zTile");
|
||||
this.h = nbttagcompound.getByte("inTile") & 255;
|
||||
this.i = nbttagcompound.getByte("inData") & 255;
|
||||
this.d = nbttagcompound.getShort("xTile");
|
||||
this.e = nbttagcompound.getShort("yTile");
|
||||
this.f = nbttagcompound.getShort("zTile");
|
||||
this.g = nbttagcompound.getByte("inTile") & 255;
|
||||
this.h = nbttagcompound.getByte("inData") & 255;
|
||||
this.shake = nbttagcompound.getByte("shake") & 255;
|
||||
this.inGround = nbttagcompound.getByte("inGround") == 1;
|
||||
this.fromPlayer = nbttagcompound.getBoolean("player");
|
||||
if (nbttagcompound.hasKey("damage")) {
|
||||
this.damage = nbttagcompound.getDouble("damage");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("pickup")) {
|
||||
this.fromPlayer = nbttagcompound.getByte("pickup");
|
||||
} else if (nbttagcompound.hasKey("player")) {
|
||||
this.fromPlayer = nbttagcompound.getBoolean("player") ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic) {
|
||||
public void b_(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic && this.inGround && this.shake <= 0) {
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack = new ItemStack(Item.ARROW);
|
||||
if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||
if (this.inGround && this.fromPlayer == 1 && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||
|
||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), 0);
|
||||
@ -357,7 +371,13 @@ public class EntityArrow extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
|
||||
boolean flag = this.fromPlayer == 1 || this.fromPlayer == 2 && entityhuman.abilities.canInstantlyBuild;
|
||||
|
||||
if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
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();
|
||||
@ -365,19 +385,35 @@ public class EntityArrow extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(double d0) {
|
||||
public void b(double d0) {
|
||||
this.damage = d0;
|
||||
}
|
||||
|
||||
public double k() {
|
||||
public double d() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
this.n = i;
|
||||
public void a(int i) {
|
||||
this.ap = i;
|
||||
}
|
||||
|
||||
public boolean k_() {
|
||||
public boolean an() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void d(boolean flag) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
if (flag) {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
|
||||
} else {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
return (b0 & 1) != 0;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package net.minecraft.server;
|
||||
|
||||
public class EntityBlaze extends EntityMonster {
|
||||
|
||||
private float a = 0.5F;
|
||||
private int b;
|
||||
private float d = 0.5F;
|
||||
private int e;
|
||||
private int g;
|
||||
|
||||
public EntityBlaze(World world) {
|
||||
@ -11,55 +11,47 @@ public class EntityBlaze extends EntityMonster {
|
||||
this.texture = "/mob/fire.png";
|
||||
this.fireProof = true;
|
||||
this.damage = 6;
|
||||
this.aA = 10;
|
||||
this.aV = 10;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.blaze.breathe";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.blaze.hit";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.blaze.death";
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
|
||||
public void die(DamageSource damagesource) {
|
||||
super.die(damagesource);
|
||||
}
|
||||
|
||||
public float b(float f) {
|
||||
public float c(float f) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public void e() {
|
||||
public void d() {
|
||||
if (!this.world.isStatic) {
|
||||
if (this.aT()) {
|
||||
if (this.G()) {
|
||||
this.damageEntity(DamageSource.DROWN, 1);
|
||||
}
|
||||
|
||||
--this.b;
|
||||
if (this.b <= 0) {
|
||||
this.b = 100;
|
||||
this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F;
|
||||
--this.e;
|
||||
if (this.e <= 0) {
|
||||
this.e = 100;
|
||||
this.d = 0.5F + (float) this.random.nextGaussian() * 3.0F;
|
||||
}
|
||||
|
||||
if (this.I() != null && this.I().locY + (double) this.I().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) {
|
||||
if (this.m() != null && this.m().locY + (double) this.m().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.d) {
|
||||
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
|
||||
}
|
||||
}
|
||||
@ -76,13 +68,13 @@ public class EntityBlaze extends EntityMonster {
|
||||
this.world.a("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
super.e();
|
||||
super.d();
|
||||
}
|
||||
|
||||
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.a(entity);
|
||||
this.k(entity);
|
||||
} else if (f < 30.0F) {
|
||||
double d0 = entity.locX - this.locX;
|
||||
double d1 = entity.boundingBox.b + (double) (entity.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
|
||||
@ -92,13 +84,13 @@ public class EntityBlaze extends EntityMonster {
|
||||
++this.g;
|
||||
if (this.g == 1) {
|
||||
this.attackTicks = 60;
|
||||
this.a(true);
|
||||
this.e(true);
|
||||
} else if (this.g <= 4) {
|
||||
this.attackTicks = 6;
|
||||
} else {
|
||||
this.attackTicks = 100;
|
||||
this.g = 0;
|
||||
this.a(false);
|
||||
this.e(false);
|
||||
}
|
||||
|
||||
if (this.g > 1) {
|
||||
@ -116,26 +108,18 @@ public class EntityBlaze extends EntityMonster {
|
||||
}
|
||||
|
||||
this.yaw = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
this.e = true;
|
||||
this.b = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(float f) {}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected int getLootId() {
|
||||
return Item.BLAZE_ROD.id;
|
||||
}
|
||||
|
||||
public boolean isBurning() {
|
||||
return this.A();
|
||||
return this.n();
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
@ -153,11 +137,11 @@ public class EntityBlaze extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean A() {
|
||||
public boolean n() {
|
||||
return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
public void e(boolean flag) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
if (flag) {
|
||||
@ -169,7 +153,7 @@ public class EntityBlaze extends EntityMonster {
|
||||
this.datawatcher.watch(16, Byte.valueOf(b0));
|
||||
}
|
||||
|
||||
protected boolean C() {
|
||||
protected boolean o() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
@ -13,12 +14,14 @@ import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
|
||||
public class EntityBoat extends Entity {
|
||||
|
||||
private int a;
|
||||
private boolean a;
|
||||
private double b;
|
||||
private double c;
|
||||
private int c;
|
||||
private double d;
|
||||
private double e;
|
||||
private double f;
|
||||
private double g;
|
||||
private double h;
|
||||
|
||||
// CraftBukkit start
|
||||
public double maxSpeed = 0.4D;
|
||||
@ -43,30 +46,32 @@ public class EntityBoat extends Entity {
|
||||
|
||||
public EntityBoat(World world) {
|
||||
super(world);
|
||||
this.bf = true;
|
||||
this.b(1.5F, 0.6F);
|
||||
this.a = true;
|
||||
this.b = 0.07D;
|
||||
this.m = true;
|
||||
this.a(1.5F, 0.6F);
|
||||
this.height = this.length / 2.0F;
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
protected void a() {
|
||||
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 g(Entity entity) {
|
||||
return entity.boundingBox;
|
||||
}
|
||||
|
||||
public AxisAlignedBB h() {
|
||||
public AxisAlignedBB E() {
|
||||
return this.boundingBox;
|
||||
}
|
||||
|
||||
public boolean e_() {
|
||||
public boolean M() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -83,7 +88,7 @@ public class EntityBoat extends Entity {
|
||||
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
|
||||
}
|
||||
|
||||
public double x_() {
|
||||
public double X() {
|
||||
return (double) this.length * 0.0D - 0.30000001192092896D;
|
||||
}
|
||||
|
||||
@ -102,10 +107,14 @@ public class EntityBoat extends Entity {
|
||||
// i = event.getDamage(); // TODO Why don't we do this?
|
||||
// CraftBukkit end
|
||||
|
||||
this.d(-this.m());
|
||||
this.c(10);
|
||||
this.c(-this.i());
|
||||
this.b(10);
|
||||
this.setDamage(this.getDamage() + i * 10);
|
||||
this.aW();
|
||||
this.K();
|
||||
if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
|
||||
this.setDamage(100);
|
||||
}
|
||||
|
||||
if (this.getDamage() > 40) {
|
||||
// CraftBukkit start
|
||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||
@ -121,16 +130,7 @@ public class EntityBoat extends Entity {
|
||||
this.passenger.mount(this);
|
||||
}
|
||||
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 3; ++j) {
|
||||
this.a(Block.WOOD.id, 1, 0.0F);
|
||||
}
|
||||
|
||||
for (j = 0; j < 2; ++j) {
|
||||
this.a(Item.STICK.id, 1, 0.0F);
|
||||
}
|
||||
|
||||
this.a(Item.BOAT.id, 1, 0.0F);
|
||||
this.die();
|
||||
}
|
||||
|
||||
@ -140,11 +140,11 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean o_() {
|
||||
public boolean L() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
public void h_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
@ -153,9 +153,9 @@ public class EntityBoat extends Entity {
|
||||
float prevPitch = this.pitch;
|
||||
// CraftBukkit end
|
||||
|
||||
super.F_();
|
||||
if (this.l() > 0) {
|
||||
this.c(this.l() - 1);
|
||||
super.h_();
|
||||
if (this.h() > 0) {
|
||||
this.b(this.h() - 1);
|
||||
}
|
||||
|
||||
if (this.getDamage() > 0) {
|
||||
@ -171,7 +171,7 @@ public class EntityBoat extends Entity {
|
||||
for (int i = 0; i < b0; ++i) {
|
||||
double d1 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 0) / (double) b0 - 0.125D;
|
||||
double d2 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (i + 1) / (double) b0 - 0.125D;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.b(this.boundingBox.a, d1, this.boundingBox.c, this.boundingBox.d, d2, this.boundingBox.f);
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.a().a(this.boundingBox.a, d1, this.boundingBox.c, this.boundingBox.d, d2, this.boundingBox.f);
|
||||
|
||||
if (this.world.b(axisalignedbb, Material.WATER)) {
|
||||
d0 += 1.0D / (double) b0;
|
||||
@ -182,7 +182,7 @@ public class EntityBoat extends Entity {
|
||||
double d4;
|
||||
double d5;
|
||||
|
||||
if (d3 > 0.15D) {
|
||||
if (d3 > 0.26249999999999996D) {
|
||||
d4 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D);
|
||||
d5 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D);
|
||||
|
||||
@ -207,25 +207,17 @@ public class EntityBoat extends Entity {
|
||||
double d10;
|
||||
double d11;
|
||||
|
||||
if (this.world.isStatic) {
|
||||
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 (d11 = this.e - (double) this.yaw; d11 < -180.0D; d11 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d11 >= 180.0D) {
|
||||
d11 -= 360.0D;
|
||||
}
|
||||
|
||||
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;
|
||||
if (this.world.isStatic && this.a) {
|
||||
if (this.c > 0) {
|
||||
d4 = this.locX + (this.d - this.locX) / (double) this.c;
|
||||
d5 = this.locY + (this.e - this.locY) / (double) this.c;
|
||||
d10 = this.locZ + (this.f - this.locZ) / (double) this.c;
|
||||
d11 = MathHelper.g(this.g - (double) this.yaw);
|
||||
this.yaw = (float) ((double) this.yaw + d11 / (double) this.c);
|
||||
this.pitch = (float) ((double) this.pitch + (this.h - (double) this.pitch) / (double) this.c);
|
||||
--this.c;
|
||||
this.setPosition(d4, d5, d10);
|
||||
this.c(this.yaw, this.pitch);
|
||||
this.b(this.yaw, this.pitch);
|
||||
} else {
|
||||
d4 = this.locX + this.motX;
|
||||
d5 = this.locY + this.motY;
|
||||
@ -254,8 +246,8 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
|
||||
if (this.passenger != null) {
|
||||
this.motX += this.passenger.motX * occupiedDeceleration; // CraftBukkit
|
||||
this.motZ += this.passenger.motZ * occupiedDeceleration; // CraftBukkit
|
||||
this.motX += this.passenger.motX * this.b;
|
||||
this.motZ += this.passenger.motZ * this.b;
|
||||
}
|
||||
// CraftBukkit start - block not in vanilla
|
||||
else if (unoccupiedDeceleration >= 0) {
|
||||
@ -271,25 +263,27 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
// CraftBukkit
|
||||
d4 = this.maxSpeed;
|
||||
if (this.motX < -d4) {
|
||||
this.motX = -d4;
|
||||
d4 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d4 > 0.35D) {
|
||||
d5 = 0.35D / d4;
|
||||
this.motX *= d5;
|
||||
this.motZ *= d5;
|
||||
d4 = 0.35D;
|
||||
}
|
||||
|
||||
if (this.motX > d4) {
|
||||
this.motX = d4;
|
||||
if (d4 > d3 && this.b < 0.35D) {
|
||||
this.b += (0.35D - this.b) / 35.0D;
|
||||
if (this.b > 0.35D) {
|
||||
this.b = 0.35D;
|
||||
}
|
||||
} else {
|
||||
this.b -= (this.b - 0.07D) / 35.0D;
|
||||
if (this.b < 0.07D) {
|
||||
this.b = 0.07D;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.motZ < -d4) {
|
||||
this.motZ = -d4;
|
||||
}
|
||||
|
||||
if (this.motZ > d4) {
|
||||
this.motZ = d4;
|
||||
}
|
||||
|
||||
if (this.onGround && !landBoats) { // CraftBukkit
|
||||
if (this.onGround && !this.landBoats) { // CraftBukkit
|
||||
this.motX *= 0.5D;
|
||||
this.motY *= 0.5D;
|
||||
this.motZ *= 0.5D;
|
||||
@ -302,7 +296,6 @@ public class EntityBoat extends Entity {
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
|
||||
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
|
||||
if (!destroyEvent.isCancelled()) {
|
||||
this.die();
|
||||
|
||||
@ -328,19 +321,11 @@ public class EntityBoat extends Entity {
|
||||
d5 = (double) this.yaw;
|
||||
d10 = this.lastX - this.locX;
|
||||
d11 = this.lastZ - this.locZ;
|
||||
if (d10 * d10 + d11 * d11 > 0.0010D) {
|
||||
if (d10 * d10 + d11 * d11 > 0.001D) {
|
||||
d5 = (double) ((float) (Math.atan2(d11, d10) * 180.0D / 3.141592653589793D));
|
||||
}
|
||||
|
||||
double d12;
|
||||
|
||||
for (d12 = d5 - (double) this.yaw; d12 >= 180.0D; d12 -= 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d12 < -180.0D) {
|
||||
d12 += 360.0D;
|
||||
}
|
||||
double d12 = MathHelper.g(d5 - (double) this.yaw);
|
||||
|
||||
if (d12 > 20.0D) {
|
||||
d12 = 20.0D;
|
||||
@ -351,7 +336,7 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d12);
|
||||
this.c(this.yaw, this.pitch);
|
||||
this.b(this.yaw, this.pitch);
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
@ -369,42 +354,53 @@ public class EntityBoat extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
int l;
|
||||
if (!this.world.isStatic) {
|
||||
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
for (l = 0; l < list.size(); ++l) {
|
||||
Entity entity = (Entity) list.get(l);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
if (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) {
|
||||
entity.collide(this);
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (entity != this.passenger && entity.M() && entity instanceof EntityBoat) {
|
||||
entity.collide(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (l = 0; l < 4; ++l) {
|
||||
int i1 = MathHelper.floor(this.locX + ((double) (l % 2) - 0.5D) * 0.8D);
|
||||
int j1 = MathHelper.floor(this.locY);
|
||||
int k1 = MathHelper.floor(this.locZ + ((double) (l / 2) - 0.5D) * 0.8D);
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
int i1 = MathHelper.floor(this.locX + ((double) (l % 2) - 0.5D) * 0.8D);
|
||||
int j1 = MathHelper.floor(this.locZ + ((double) (l / 2) - 0.5D) * 0.8D);
|
||||
|
||||
if (this.world.getTypeId(i1, j1, k1) == Block.SNOW.id) {
|
||||
this.world.setTypeId(i1, j1, k1, 0);
|
||||
for (int k1 = 0; k1 < 2; ++k1) {
|
||||
int l1 = MathHelper.floor(this.locY) + k1;
|
||||
int i2 = this.world.getTypeId(i1, l1, j1);
|
||||
int j2 = this.world.getData(i1, l1, j1);
|
||||
|
||||
if (i2 == Block.SNOW.id) {
|
||||
this.world.setTypeId(i1, l1, j1, 0);
|
||||
} else if (i2 == Block.WATER_LILY.id) {
|
||||
Block.WATER_LILY.dropNaturally(this.world, i1, l1, j1, j2, 0.3F, 0);
|
||||
this.world.setTypeId(i1, l1, j1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.passenger != null && this.passenger.dead) {
|
||||
this.passenger.vehicle = null; // CraftBukkit
|
||||
this.passenger = null;
|
||||
if (this.passenger != null && this.passenger.dead) {
|
||||
this.passenger.vehicle = null; // CraftBukkit
|
||||
this.passenger = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void i_() {
|
||||
public void V() {
|
||||
if (this.passenger != null) {
|
||||
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
|
||||
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
|
||||
|
||||
this.passenger.setPosition(this.locX + d0, this.locY + this.x_() + this.passenger.W(), this.locZ + d1);
|
||||
this.passenger.setPosition(this.locX + d0, this.locY + this.X() + this.passenger.W(), this.locZ + d1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +408,7 @@ public class EntityBoat extends Entity {
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
|
||||
return true;
|
||||
} else {
|
||||
@ -432,19 +428,19 @@ public class EntityBoat extends Entity {
|
||||
return this.datawatcher.getInt(19);
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
public void b(int i) {
|
||||
this.datawatcher.watch(17, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public int l() {
|
||||
public int h() {
|
||||
return this.datawatcher.getInt(17);
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
public void c(int i) {
|
||||
this.datawatcher.watch(18, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public int m() {
|
||||
public int i() {
|
||||
return this.datawatcher.getInt(18);
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ package net.minecraft.server;
|
||||
|
||||
public class EntityChicken extends EntityAnimal {
|
||||
|
||||
public boolean a = false;
|
||||
public float b = 0.0F;
|
||||
public float c = 0.0F;
|
||||
public boolean d = false;
|
||||
public float e = 0.0F;
|
||||
public float f = 0.0F;
|
||||
public float g;
|
||||
public float h;
|
||||
public float i = 1.0F;
|
||||
@ -13,7 +13,7 @@ public class EntityChicken extends EntityAnimal {
|
||||
public EntityChicken(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/chicken.png";
|
||||
this.b(0.3F, 0.7F);
|
||||
this.a(0.3F, 0.7F);
|
||||
this.j = this.random.nextInt(6000) + 6000;
|
||||
float f = 0.25F;
|
||||
|
||||
@ -27,7 +27,7 @@ public class EntityChicken extends EntityAnimal {
|
||||
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -35,17 +35,17 @@ public class EntityChicken extends EntityAnimal {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public void e() {
|
||||
super.e();
|
||||
this.h = this.b;
|
||||
this.g = this.c;
|
||||
this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D);
|
||||
if (this.c < 0.0F) {
|
||||
this.c = 0.0F;
|
||||
public void d() {
|
||||
super.d();
|
||||
this.h = this.e;
|
||||
this.g = this.f;
|
||||
this.f = (float) ((double) this.f + (double) (this.onGround ? -1 : 4) * 0.3D);
|
||||
if (this.f < 0.0F) {
|
||||
this.f = 0.0F;
|
||||
}
|
||||
|
||||
if (this.c > 1.0F) {
|
||||
this.c = 1.0F;
|
||||
if (this.f > 1.0F) {
|
||||
this.f = 1.0F;
|
||||
}
|
||||
|
||||
if (!this.onGround && this.i < 1.0F) {
|
||||
@ -57,7 +57,7 @@ public class EntityChicken extends EntityAnimal {
|
||||
this.motY *= 0.6D;
|
||||
}
|
||||
|
||||
this.b += this.i * 2.0F;
|
||||
this.e += this.i * 2.0F;
|
||||
if (!this.isBaby() && !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);
|
||||
@ -67,23 +67,15 @@ public class EntityChicken extends EntityAnimal {
|
||||
|
||||
protected void a(float f) {}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.chicken";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.chickenhurt";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.chickenhurt";
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,14 @@ package net.minecraft.server;
|
||||
|
||||
public class EntityComplex extends EntityLiving {
|
||||
|
||||
protected int t = 100;
|
||||
protected int a = 100;
|
||||
|
||||
public EntityComplex(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return this.t;
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, int i) {
|
||||
|
@ -1,14 +1,17 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
public EntityCow(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/cow.png";
|
||||
this.b(0.9F, 1.3F);
|
||||
this.al().a(true);
|
||||
this.a(0.9F, 1.3F);
|
||||
this.getNavigation().a(true);
|
||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
|
||||
this.goalSelector.a(2, new PathfinderGoalBreed(this, 0.2F));
|
||||
@ -19,7 +22,7 @@ public class EntityCow extends EntityAnimal {
|
||||
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -27,27 +30,19 @@ public class EntityCow extends EntityAnimal {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.cow";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.cowhurt";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.cowhurt";
|
||||
}
|
||||
|
||||
protected float p() {
|
||||
protected float aP() {
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
@ -60,6 +55,8 @@ public class EntityCow extends EntityAnimal {
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
|
||||
|
||||
int k;
|
||||
|
||||
if (j > 0) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, j));
|
||||
}
|
||||
@ -74,7 +71,7 @@ public class EntityCow extends EntityAnimal {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
|
||||
@ -86,12 +83,16 @@ public class EntityCow extends EntityAnimal {
|
||||
return false;
|
||||
}
|
||||
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, org.bukkit.craftbukkit.inventory.CraftItemStack.createNMSItemStack(event.getItemStack()));
|
||||
if (--itemstack.count <= 0) {
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, CraftItemStack.createNMSItemStack(event.getItemStack()));
|
||||
} else if (!entityhuman.inventory.pickup(new ItemStack(Item.MILK_BUCKET))) {
|
||||
entityhuman.drop(CraftItemStack.createNMSItemStack(event.getItemStack()));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return super.b(entityhuman);
|
||||
return super.c(entityhuman);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,24 +9,24 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
|
||||
public PathEntity pathEntity; // CraftBukkit - public
|
||||
public Entity target; // CraftBukkit - public
|
||||
protected boolean e = false;
|
||||
protected int f = 0;
|
||||
protected boolean b = false;
|
||||
protected int c = 0;
|
||||
|
||||
public EntityCreature(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
protected boolean F() {
|
||||
protected boolean i() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void d_() {
|
||||
// MethodProfiler.a("ai"); // CraftBukkit - not in production code
|
||||
if (this.f > 0) {
|
||||
--this.f;
|
||||
protected void be() {
|
||||
// this.world.methodProfiler.a("ai"); // CraftBukkit - not in production code
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
}
|
||||
|
||||
this.e = this.F();
|
||||
this.b = this.i();
|
||||
float f = 16.0F;
|
||||
|
||||
if (this.target == null) {
|
||||
@ -49,7 +49,13 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
if (this.target != null) {
|
||||
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
|
||||
}
|
||||
} else if (!this.target.isAlive()) {
|
||||
} else if (this.target.isAlive()) {
|
||||
float f1 = this.target.d((Entity) this);
|
||||
|
||||
if (this.l(this.target)) {
|
||||
this.a(this.target, f1);
|
||||
}
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
@ -62,30 +68,22 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
float f1 = this.target.i(this);
|
||||
|
||||
if (this.h(this.target)) {
|
||||
this.a(this.target, f1);
|
||||
} else {
|
||||
this.b(this.target, f1);
|
||||
}
|
||||
}
|
||||
|
||||
// MethodProfiler.a(); // CraftBukkit - not in production code
|
||||
if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
|
||||
// this.world.methodProfiler.b(); // CraftBukkit - not in production code
|
||||
if (!this.b && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
|
||||
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
|
||||
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aV < 100) {
|
||||
this.G();
|
||||
} else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bq < 100) {
|
||||
this.j();
|
||||
}
|
||||
|
||||
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
|
||||
boolean flag = this.aU();
|
||||
boolean flag1 = this.aV();
|
||||
boolean flag = this.H();
|
||||
boolean flag1 = this.J();
|
||||
|
||||
this.pitch = 0.0F;
|
||||
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
|
||||
// MethodProfiler.a("followpath"); // CraftBukkit - not in production code
|
||||
// this.world.methodProfiler.a("followpath"); // CraftBukkit - not in production code
|
||||
Vec3D vec3d = this.pathEntity.a((Entity) this);
|
||||
double d0 = (double) (this.width * 2.0F);
|
||||
|
||||
@ -99,23 +97,16 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
}
|
||||
}
|
||||
|
||||
this.aZ = false;
|
||||
this.bu = false;
|
||||
if (vec3d != null) {
|
||||
double d1 = vec3d.a - this.locX;
|
||||
double d2 = vec3d.c - this.locZ;
|
||||
double d3 = vec3d.b - (double) i;
|
||||
// CraftBukkit - Math -> TrigMath
|
||||
float f2 = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
float f3 = f2 - this.yaw;
|
||||
|
||||
for (this.aX = this.bb; f3 < -180.0F; f3 += 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
while (f3 >= 180.0F) {
|
||||
f3 -= 360.0F;
|
||||
}
|
||||
float f3 = MathHelper.g(f2 - this.yaw);
|
||||
|
||||
this.bs = this.bw;
|
||||
if (f3 > 30.0F) {
|
||||
f3 = 30.0F;
|
||||
}
|
||||
@ -125,19 +116,19 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
}
|
||||
|
||||
this.yaw += f3;
|
||||
if (this.e && this.target != null) {
|
||||
if (this.b && this.target != null) {
|
||||
double d4 = this.target.locX - this.locX;
|
||||
double d5 = this.target.locZ - this.locZ;
|
||||
float f4 = this.yaw;
|
||||
|
||||
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
|
||||
this.aW = -MathHelper.sin(f3) * this.aX * 1.0F;
|
||||
this.aX = MathHelper.cos(f3) * this.aX * 1.0F;
|
||||
this.br = -MathHelper.sin(f3) * this.bs * 1.0F;
|
||||
this.bs = MathHelper.cos(f3) * this.bs * 1.0F;
|
||||
}
|
||||
|
||||
if (d3 > 0.0D) {
|
||||
this.aZ = true;
|
||||
this.bu = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,23 +136,23 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.a(this.target, 30.0F, 30.0F);
|
||||
}
|
||||
|
||||
if (this.positionChanged && !this.H()) {
|
||||
this.aZ = true;
|
||||
if (this.positionChanged && !this.l()) {
|
||||
this.bu = true;
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
|
||||
this.aZ = true;
|
||||
this.bu = true;
|
||||
}
|
||||
|
||||
// MethodProfiler.a(); // CraftBukkit - not in production code
|
||||
// this.world.methodProfiler.b(); // CraftBukkit - not in production code
|
||||
} else {
|
||||
super.d_();
|
||||
super.be();
|
||||
this.pathEntity = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void G() {
|
||||
// MethodProfiler.a("stroll"); // CraftBukkit - not in production code
|
||||
protected void j() {
|
||||
// this.world.methodProfiler.a("stroll"); // CraftBukkit - not in production code
|
||||
boolean flag = false;
|
||||
int i = -1;
|
||||
int j = -1;
|
||||
@ -187,13 +178,11 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.pathEntity = this.world.a(this, i, j, k, 10.0F, true, false, false, true);
|
||||
}
|
||||
|
||||
// MethodProfiler.a(); // CraftBukkit - not in production code
|
||||
// this.world.methodProfiler.b(); // CraftBukkit - not in production code
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {}
|
||||
|
||||
protected void b(Entity entity, float f) {}
|
||||
|
||||
public float a(int i, int j, int k) {
|
||||
return 0.0F;
|
||||
}
|
||||
@ -210,7 +199,7 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
|
||||
}
|
||||
|
||||
public boolean H() {
|
||||
public boolean l() {
|
||||
return this.pathEntity != null;
|
||||
}
|
||||
|
||||
@ -218,7 +207,7 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.pathEntity = pathentity;
|
||||
}
|
||||
|
||||
public Entity I() {
|
||||
public Entity m() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
@ -226,13 +215,13 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.target = entity;
|
||||
}
|
||||
|
||||
protected float J() {
|
||||
if (this.c_()) {
|
||||
protected float bs() {
|
||||
if (this.aV()) {
|
||||
return 1.0F;
|
||||
} else {
|
||||
float f = super.J();
|
||||
float f = super.bs();
|
||||
|
||||
if (this.f > 0) {
|
||||
if (this.c > 0) {
|
||||
f *= 2.0F;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
public class EntityCreeper extends EntityMonster {
|
||||
|
||||
int fuseTicks;
|
||||
int b;
|
||||
int e;
|
||||
private int record = -1; // CraftBukkit
|
||||
|
||||
public EntityCreeper(World world) {
|
||||
@ -25,7 +25,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -33,8 +33,8 @@ public class EntityCreeper extends EntityMonster {
|
||||
return 20;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) -1));
|
||||
this.datawatcher.a(17, Byte.valueOf((byte) 0));
|
||||
}
|
||||
@ -51,10 +51,10 @@ public class EntityCreeper extends EntityMonster {
|
||||
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0)));
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
public void h_() {
|
||||
if (this.isAlive()) {
|
||||
this.b = this.fuseTicks;
|
||||
int i = this.A();
|
||||
this.e = this.fuseTicks;
|
||||
int i = this.p();
|
||||
|
||||
if (i > 0 && this.fuseTicks == 0) {
|
||||
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
|
||||
@ -67,30 +67,31 @@ public class EntityCreeper extends EntityMonster {
|
||||
|
||||
if (this.fuseTicks >= 30) {
|
||||
this.fuseTicks = 30;
|
||||
// CraftBukkit start
|
||||
float radius = this.isPowered() ? 6.0F : 3.0F;
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
float radius = this.isPowered() ? 6.0F : 3.0F;
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
this.die();
|
||||
} else {
|
||||
this.fuseTicks = 0;
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
this.die();
|
||||
} else {
|
||||
this.fuseTicks = 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
super.F_();
|
||||
super.h_();
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.creeper";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.creeperdeath";
|
||||
}
|
||||
|
||||
@ -100,6 +101,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
// this.b(Item.RECORD_1.id + this.random.nextInt(10), 1); // CraftBukkit
|
||||
this.record = Item.RECORD_1.id + this.random.nextInt(10);
|
||||
}
|
||||
|
||||
super.die(damagesource);
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -132,7 +134,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public boolean a(Entity entity) {
|
||||
public boolean k(Entity entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -144,19 +146,18 @@ public class EntityCreeper extends EntityMonster {
|
||||
return Item.SULPHUR.id;
|
||||
}
|
||||
|
||||
public int A() {
|
||||
public int p() {
|
||||
return this.datawatcher.getByte(16);
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
public void a(int i) {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) i));
|
||||
}
|
||||
|
||||
public void a(EntityWeatherLighting entityweatherlighting) {
|
||||
super.a(entityweatherlighting);
|
||||
|
||||
public void a(EntityLightning entitylightning) {
|
||||
super.a(entitylightning);
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callCreeperPowerEvent(this, entityweatherlighting, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
||||
if (CraftEventFactory.callCreeperPowerEvent(this, entitylightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
|
||||
this.owner = entity1;
|
||||
}
|
||||
|
||||
public Entity b() {
|
||||
return this.a;
|
||||
public Entity f() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
|
@ -23,8 +23,8 @@ public class EntityEgg extends EntityProjectile {
|
||||
}
|
||||
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
if (movingobjectposition.entity != null && movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0)) {
|
||||
;
|
||||
if (movingobjectposition.entity != null) {
|
||||
movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -50,7 +50,6 @@ public class EntityEgg extends EntityProjectile {
|
||||
if (hatching) {
|
||||
for (int k = 0; k < numHatching; k++) {
|
||||
org.bukkit.entity.Entity entity = world.getWorld().spawn(new org.bukkit.Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG);
|
||||
|
||||
if (entity instanceof Ageable) {
|
||||
((Ageable) entity).setBaby();
|
||||
}
|
||||
|
@ -7,22 +7,22 @@ public class EntityEnderCrystal extends Entity {
|
||||
|
||||
public EntityEnderCrystal(World world) {
|
||||
super(world);
|
||||
this.bf = true;
|
||||
this.b(2.0F, 2.0F);
|
||||
this.m = true;
|
||||
this.a(2.0F, 2.0F);
|
||||
this.height = this.length / 2.0F;
|
||||
this.b = 5;
|
||||
this.a = this.random.nextInt(100000);
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
protected void a() {
|
||||
this.datawatcher.a(8, Integer.valueOf(this.b));
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
public void h_() {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
@ -41,24 +41,23 @@ public class EntityEnderCrystal extends Entity {
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
public boolean o_() {
|
||||
public boolean L() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
if (!this.dead && !this.world.isStatic) {
|
||||
// CraftBukkit start - All non-living entities need this
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b = 0;
|
||||
if (this.b <= 0) {
|
||||
this.die();
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start - All non-living entities need this
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F); // CraftBukkit - (Entity) null -> this.
|
||||
} else {
|
||||
this.die();
|
||||
this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F); // CraftBukkit - (Entity) null -> this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,43 +15,43 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class EntityEnderDragon extends EntityComplex {
|
||||
|
||||
public double a;
|
||||
public double b;
|
||||
public double c;
|
||||
public double[][] d = new double[64][3];
|
||||
public int e = -1;
|
||||
public double d;
|
||||
public double[][] e = new double[64][3];
|
||||
public int f = -1;
|
||||
public EntityComplexPart[] children;
|
||||
public EntityComplexPart g;
|
||||
public EntityComplexPart h;
|
||||
public EntityComplexPart i;
|
||||
public EntityComplexPart j;
|
||||
public EntityComplexPart k;
|
||||
public EntityComplexPart l;
|
||||
public EntityComplexPart m;
|
||||
public float n = 0.0F;
|
||||
public float o = 0.0F;
|
||||
public boolean p = false;
|
||||
public boolean q = false;
|
||||
private Entity u;
|
||||
public int r = 0;
|
||||
public EntityEnderCrystal s = null;
|
||||
public EntityComplexPart by;
|
||||
public EntityComplexPart bz;
|
||||
public EntityComplexPart bA;
|
||||
public EntityComplexPart bB;
|
||||
public float bC = 0.0F;
|
||||
public float bD = 0.0F;
|
||||
public boolean bE = false;
|
||||
public boolean bF = false;
|
||||
private Entity bI;
|
||||
public int bG = 0;
|
||||
public EntityEnderCrystal bH = null;
|
||||
|
||||
public EntityEnderDragon(World world) {
|
||||
super(world);
|
||||
this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.k = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.l = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.m = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
|
||||
this.t = 200;
|
||||
this.setHealth(this.t);
|
||||
this.children = new EntityComplexPart[] { this.h = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.i = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.by = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bz = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bA = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bB = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
|
||||
this.a = 200;
|
||||
this.setHealth(this.a);
|
||||
this.texture = "/mob/enderdragon/ender.png";
|
||||
this.b(16.0F, 8.0F);
|
||||
this.bQ = true;
|
||||
this.a(16.0F, 8.0F);
|
||||
this.X = true;
|
||||
this.fireProof = true;
|
||||
this.b = 100.0D;
|
||||
this.cd = true;
|
||||
this.c = 100.0D;
|
||||
this.ak = true;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
this.datawatcher.a(16, new Integer(this.t));
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, new Integer(this.a));
|
||||
}
|
||||
|
||||
public double[] a(int i, float f) {
|
||||
@ -60,31 +60,22 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
|
||||
f = 1.0F - f;
|
||||
int j = this.e - i * 1 & 63;
|
||||
int k = this.e - i * 1 - 1 & 63;
|
||||
int j = this.f - i * 1 & 63;
|
||||
int k = this.f - i * 1 - 1 & 63;
|
||||
double[] adouble = new double[3];
|
||||
double d0 = this.d[j][0];
|
||||
|
||||
double d1;
|
||||
|
||||
for (d1 = this.d[k][0] - d0; d1 < -180.0D; d1 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d1 >= 180.0D) {
|
||||
d1 -= 360.0D;
|
||||
}
|
||||
double d0 = this.e[j][0];
|
||||
double d1 = MathHelper.g(this.e[k][0] - d0);
|
||||
|
||||
adouble[0] = d0 + d1 * (double) f;
|
||||
d0 = this.d[j][1];
|
||||
d1 = this.d[k][1] - d0;
|
||||
d0 = this.e[j][1];
|
||||
d1 = this.e[k][1] - d0;
|
||||
adouble[1] = d0 + d1 * (double) f;
|
||||
adouble[2] = this.d[j][2] + (this.d[k][2] - this.d[j][2]) * (double) f;
|
||||
adouble[2] = this.e[j][2] + (this.e[k][2] - this.e[j][2]) * (double) f;
|
||||
return adouble;
|
||||
}
|
||||
|
||||
public void e() {
|
||||
this.n = this.o;
|
||||
public void d() {
|
||||
this.bC = this.bD;
|
||||
if (!this.world.isStatic) {
|
||||
this.datawatcher.watch(16, Integer.valueOf(this.health));
|
||||
}
|
||||
@ -99,36 +90,29 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
f1 = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
this.world.a("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) d05, this.locZ + (double) f1, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
this.A();
|
||||
this.j();
|
||||
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
|
||||
f *= (float) Math.pow(2.0D, this.motY);
|
||||
if (this.q) {
|
||||
this.o += f * 0.5F;
|
||||
if (this.bF) {
|
||||
this.bD += f * 0.5F;
|
||||
} else {
|
||||
this.o += f;
|
||||
this.bD += f;
|
||||
}
|
||||
|
||||
while (this.yaw >= 180.0F) {
|
||||
this.yaw -= 360.0F;
|
||||
}
|
||||
|
||||
while (this.yaw < -180.0F) {
|
||||
this.yaw += 360.0F;
|
||||
}
|
||||
|
||||
if (this.e < 0) {
|
||||
for (int i = 0; i < this.d.length; ++i) {
|
||||
this.d[i][0] = (double) this.yaw;
|
||||
this.d[i][1] = this.locY;
|
||||
this.yaw = MathHelper.g(this.yaw);
|
||||
if (this.f < 0) {
|
||||
for (int i = 0; i < this.e.length; ++i) {
|
||||
this.e[i][0] = (double) this.yaw;
|
||||
this.e[i][1] = this.locY;
|
||||
}
|
||||
}
|
||||
|
||||
if (++this.e == this.d.length) {
|
||||
this.e = 0;
|
||||
if (++this.f == this.e.length) {
|
||||
this.f = 0;
|
||||
}
|
||||
|
||||
this.d[this.e][0] = (double) this.yaw;
|
||||
this.d[this.e][1] = this.locY;
|
||||
this.e[this.f][0] = (double) this.yaw;
|
||||
this.e[this.f][1] = this.locY;
|
||||
double d0;
|
||||
double d1;
|
||||
double d2;
|
||||
@ -136,35 +120,27 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
float f3;
|
||||
|
||||
if (this.world.isStatic) {
|
||||
if (this.aN > 0) {
|
||||
d0 = this.locX + (this.aO - this.locX) / (double) this.aN;
|
||||
d1 = this.locY + (this.aP - this.locY) / (double) this.aN;
|
||||
d2 = this.locZ + (this.aQ - this.locZ) / (double) this.aN;
|
||||
|
||||
for (d3 = this.aR - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d3 >= 180.0D) {
|
||||
d3 -= 360.0D;
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.aN);
|
||||
this.pitch = (float) ((double) this.pitch + (this.aS - (double) this.pitch) / (double) this.aN);
|
||||
--this.aN;
|
||||
if (this.bi > 0) {
|
||||
d0 = this.locX + (this.bj - this.locX) / (double) this.bi;
|
||||
d1 = this.locY + (this.bk - this.locY) / (double) this.bi;
|
||||
d2 = this.locZ + (this.bl - this.locZ) / (double) this.bi;
|
||||
d3 = MathHelper.g(this.bm - (double) this.yaw);
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bi);
|
||||
this.pitch = (float) ((double) this.pitch + (this.bn - (double) this.pitch) / (double) this.bi);
|
||||
--this.bi;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.c(this.yaw, this.pitch);
|
||||
this.b(this.yaw, this.pitch);
|
||||
}
|
||||
} else {
|
||||
d0 = this.a - this.locX;
|
||||
d1 = this.b - this.locY;
|
||||
d2 = this.c - this.locZ;
|
||||
d0 = this.b - this.locX;
|
||||
d1 = this.c - this.locY;
|
||||
d2 = this.d - this.locZ;
|
||||
d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
if (this.u != null) {
|
||||
this.a = this.u.locX;
|
||||
this.c = this.u.locZ;
|
||||
double d4 = this.a - this.locX;
|
||||
double d5 = this.c - this.locZ;
|
||||
if (this.bI != null) {
|
||||
this.b = this.bI.locX;
|
||||
this.d = this.bI.locZ;
|
||||
double d4 = this.b - this.locX;
|
||||
double d5 = this.d - this.locZ;
|
||||
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
|
||||
double d7 = 0.4000000059604645D + d6 / 80.0D - 1.0D;
|
||||
|
||||
@ -172,14 +148,14 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
d7 = 10.0D;
|
||||
}
|
||||
|
||||
this.b = this.u.boundingBox.b + d7;
|
||||
this.c = this.bI.boundingBox.b + d7;
|
||||
} else {
|
||||
this.a += this.random.nextGaussian() * 2.0D;
|
||||
this.c += this.random.nextGaussian() * 2.0D;
|
||||
this.b += this.random.nextGaussian() * 2.0D;
|
||||
this.d += this.random.nextGaussian() * 2.0D;
|
||||
}
|
||||
|
||||
if (this.p || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.bz) {
|
||||
this.E();
|
||||
if (this.bE || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
|
||||
this.k();
|
||||
}
|
||||
|
||||
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
@ -192,25 +168,10 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
d1 = (double) f3;
|
||||
}
|
||||
|
||||
for (this.motY += d1 * 0.10000000149011612D; this.yaw < -180.0F; this.yaw += 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
while (this.yaw >= 180.0F) {
|
||||
this.yaw -= 360.0F;
|
||||
}
|
||||
|
||||
this.motY += d1 * 0.10000000149011612D;
|
||||
this.yaw = MathHelper.g(this.yaw);
|
||||
double d8 = 180.0D - Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D;
|
||||
|
||||
double d9;
|
||||
|
||||
for (d9 = d8 - (double) this.yaw; d9 < -180.0D; d9 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d9 >= 180.0D) {
|
||||
d9 -= 360.0D;
|
||||
}
|
||||
double d9 = MathHelper.g(d8 - (double) this.yaw);
|
||||
|
||||
if (d9 > 50.0D) {
|
||||
d9 = 50.0D;
|
||||
@ -220,15 +181,15 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
d9 = -50.0D;
|
||||
}
|
||||
|
||||
Vec3D vec3d = Vec3D.create(this.a - this.locX, this.b - this.locY, this.c - this.locZ).b();
|
||||
Vec3D vec3d1 = Vec3D.create((double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F), this.motY, (double) (-MathHelper.cos(this.yaw * 3.1415927F / 180.0F))).b();
|
||||
float f4 = (float) (vec3d1.a(vec3d) + 0.5D) / 1.5F;
|
||||
Vec3D vec3d = Vec3D.a().create(this.b - this.locX, this.c - this.locY, this.d - this.locZ).b();
|
||||
Vec3D vec3d1 = Vec3D.a().create((double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F), this.motY, (double) (-MathHelper.cos(this.yaw * 3.1415927F / 180.0F))).b();
|
||||
float f4 = (float) (vec3d1.b(vec3d) + 0.5D) / 1.5F;
|
||||
|
||||
if (f4 < 0.0F) {
|
||||
f4 = 0.0F;
|
||||
}
|
||||
|
||||
this.aY *= 0.8F;
|
||||
this.bt *= 0.8F;
|
||||
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
|
||||
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
|
||||
|
||||
@ -236,20 +197,20 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
d10 = 40.0D;
|
||||
}
|
||||
|
||||
this.aY = (float) ((double) this.aY + d9 * (0.699999988079071D / d10 / (double) f5));
|
||||
this.yaw += this.aY * 0.1F;
|
||||
this.bt = (float) ((double) this.bt + d9 * (0.699999988079071D / d10 / (double) f5));
|
||||
this.yaw += this.bt * 0.1F;
|
||||
float f6 = (float) (2.0D / (d10 + 1.0D));
|
||||
float f7 = 0.06F;
|
||||
|
||||
this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6)));
|
||||
if (this.q) {
|
||||
if (this.bF) {
|
||||
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
|
||||
} else {
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
Vec3D vec3d2 = Vec3D.create(this.motX, this.motY, this.motZ).b();
|
||||
float f8 = (float) (vec3d2.a(vec3d1) + 1.0D) / 2.0F;
|
||||
Vec3D vec3d2 = Vec3D.a().create(this.motX, this.motY, this.motZ).b();
|
||||
float f8 = (float) (vec3d2.b(vec3d1) + 1.0D) / 2.0F;
|
||||
|
||||
f8 = 0.8F + 0.15F * f8;
|
||||
this.motX *= (double) f8;
|
||||
@ -257,17 +218,17 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
this.motY *= 0.9100000262260437D;
|
||||
}
|
||||
|
||||
this.V = this.yaw;
|
||||
this.g.width = this.g.length = 3.0F;
|
||||
this.i.width = this.i.length = 2.0F;
|
||||
this.aq = this.yaw;
|
||||
this.h.width = this.h.length = 3.0F;
|
||||
this.j.width = this.j.length = 2.0F;
|
||||
this.k.width = this.k.length = 2.0F;
|
||||
this.h.length = 3.0F;
|
||||
this.h.width = 5.0F;
|
||||
this.l.length = 2.0F;
|
||||
this.l.width = 4.0F;
|
||||
this.m.length = 3.0F;
|
||||
this.m.width = 4.0F;
|
||||
this.by.width = this.by.length = 2.0F;
|
||||
this.bz.width = this.bz.length = 2.0F;
|
||||
this.i.length = 3.0F;
|
||||
this.i.width = 5.0F;
|
||||
this.bA.length = 2.0F;
|
||||
this.bA.width = 4.0F;
|
||||
this.bB.length = 3.0F;
|
||||
this.bB.width = 4.0F;
|
||||
d05 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
|
||||
f1 = MathHelper.cos(d05);
|
||||
float f9 = -MathHelper.sin(d05);
|
||||
@ -275,72 +236,68 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
float f11 = MathHelper.sin(f10);
|
||||
float f12 = MathHelper.cos(f10);
|
||||
|
||||
this.h.F_();
|
||||
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
|
||||
this.l.F_();
|
||||
this.l.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
this.m.F_();
|
||||
this.m.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
if (!this.world.isStatic) {
|
||||
this.C();
|
||||
}
|
||||
|
||||
if (!this.world.isStatic && this.hurtTicks == 0) { // CraftBukkit
|
||||
this.a(this.world.getEntities(this, this.l.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.a(this.world.getEntities(this, this.m.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D)));
|
||||
this.i.h_();
|
||||
this.i.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
|
||||
this.bA.h_();
|
||||
this.bA.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
this.bB.h_();
|
||||
this.bB.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
if (!this.world.isStatic && this.hurtTicks == 0) {
|
||||
this.a(this.world.getEntities(this, this.bA.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.a(this.world.getEntities(this, this.bB.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.b(this.world.getEntities(this, this.h.boundingBox.grow(1.0D, 1.0D, 1.0D)));
|
||||
}
|
||||
|
||||
double[] adouble = this.a(5, 1.0F);
|
||||
double[] adouble1 = this.a(0, 1.0F);
|
||||
|
||||
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.aY * 0.01F);
|
||||
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.aY * 0.01F);
|
||||
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bt * 0.01F);
|
||||
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bt * 0.01F);
|
||||
|
||||
this.g.F_();
|
||||
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f1), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f1), 0.0F, 0.0F);
|
||||
this.h.h_();
|
||||
this.h.setPositionRotation(this.locX + (double) (f3 * 5.5F * f1), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f1), 0.0F, 0.0F);
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
EntityComplexPart entitycomplexpart = null;
|
||||
|
||||
if (j == 0) {
|
||||
entitycomplexpart = this.i;
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
entitycomplexpart = this.j;
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
entitycomplexpart = this.by;
|
||||
}
|
||||
|
||||
if (j == 2) {
|
||||
entitycomplexpart = this.k;
|
||||
entitycomplexpart = this.bz;
|
||||
}
|
||||
|
||||
double[] adouble2 = this.a(12 + j * 2, 1.0F);
|
||||
float f14 = this.yaw * 3.1415927F / 180.0F + this.a(adouble2[0] - adouble[0]) * 3.1415927F / 180.0F * 1.0F;
|
||||
float f14 = this.yaw * 3.1415927F / 180.0F + this.b(adouble2[0] - adouble[0]) * 3.1415927F / 180.0F * 1.0F;
|
||||
float f15 = MathHelper.sin(f14);
|
||||
float f16 = MathHelper.cos(f14);
|
||||
float f17 = 1.5F;
|
||||
float f18 = (float) (j + 1) * 2.0F;
|
||||
|
||||
entitycomplexpart.F_();
|
||||
entitycomplexpart.h_();
|
||||
entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f1), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f1), 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
this.q = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
|
||||
this.bF = this.a(this.h.boundingBox) | this.a(this.i.boundingBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void A() {
|
||||
if (this.s != null) {
|
||||
if (this.s.dead) {
|
||||
private void j() {
|
||||
if (this.bH != null) {
|
||||
if (this.bH.dead) {
|
||||
if (!this.world.isStatic) {
|
||||
this.a(this.g, DamageSource.EXPLOSION, 10);
|
||||
this.a(this.h, DamageSource.EXPLOSION, 10);
|
||||
}
|
||||
|
||||
this.s = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.health < this.t) {
|
||||
this.bH = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.health < this.a) {
|
||||
// CraftBukkit start
|
||||
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
@ -360,24 +317,22 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
double d1 = entity.j(this);
|
||||
EntityEnderCrystal entityendercrystal1 = (EntityEnderCrystal) iterator.next();
|
||||
double d1 = entityendercrystal1.e(this);
|
||||
|
||||
if (d1 < d0) {
|
||||
d0 = d1;
|
||||
entityendercrystal = (EntityEnderCrystal) entity;
|
||||
entityendercrystal = entityendercrystal1;
|
||||
}
|
||||
}
|
||||
|
||||
this.s = entityendercrystal;
|
||||
this.bH = entityendercrystal;
|
||||
}
|
||||
}
|
||||
|
||||
private void C() {}
|
||||
|
||||
private void a(List list) {
|
||||
double d0 = (this.h.boundingBox.a + this.h.boundingBox.d) / 2.0D;
|
||||
double d1 = (this.h.boundingBox.c + this.h.boundingBox.f) / 2.0D;
|
||||
double d0 = (this.i.boundingBox.a + this.i.boundingBox.d) / 2.0D;
|
||||
double d1 = (this.i.boundingBox.c + this.i.boundingBox.f) / 2.0D;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -388,14 +343,16 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
double d3 = entity.locZ - d1;
|
||||
double d4 = d2 * d2 + d3 * d3;
|
||||
|
||||
entity.b_(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
|
||||
entity.g(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b(List list) {
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
// CraftBukkit start - throw damage events when the dragon attacks
|
||||
@ -416,40 +373,32 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
}
|
||||
|
||||
private void E() {
|
||||
this.p = false;
|
||||
if (this.random.nextInt(2) == 0 && this.world.players.size() > 0) {
|
||||
this.u = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
private void k() {
|
||||
this.bE = false;
|
||||
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
|
||||
this.bI = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
} else {
|
||||
boolean flag = false;
|
||||
|
||||
do {
|
||||
this.a = 0.0D;
|
||||
this.b = (double) (70.0F + this.random.nextFloat() * 50.0F);
|
||||
this.c = 0.0D;
|
||||
this.a += (double) (this.random.nextFloat() * 120.0F - 60.0F);
|
||||
this.c += (double) (this.random.nextFloat() * 120.0F - 60.0F);
|
||||
double d0 = this.locX - this.a;
|
||||
double d1 = this.locY - this.b;
|
||||
double d2 = this.locZ - this.c;
|
||||
this.b = 0.0D;
|
||||
this.c = (double) (70.0F + this.random.nextFloat() * 50.0F);
|
||||
this.d = 0.0D;
|
||||
this.b += (double) (this.random.nextFloat() * 120.0F - 60.0F);
|
||||
this.d += (double) (this.random.nextFloat() * 120.0F - 60.0F);
|
||||
double d0 = this.locX - this.b;
|
||||
double d1 = this.locY - this.c;
|
||||
double d2 = this.locZ - this.d;
|
||||
|
||||
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
|
||||
} while (!flag);
|
||||
|
||||
this.u = null;
|
||||
this.bI = null;
|
||||
}
|
||||
}
|
||||
|
||||
private float a(double d0) {
|
||||
while (d0 >= 180.0D) {
|
||||
d0 -= 360.0D;
|
||||
}
|
||||
|
||||
while (d0 < -180.0D) {
|
||||
d0 += 360.0D;
|
||||
}
|
||||
|
||||
return (float) d0;
|
||||
private float b(double d0) {
|
||||
return (float) MathHelper.g(d0);
|
||||
}
|
||||
|
||||
private boolean a(AxisAlignedBB axisalignedbb) {
|
||||
@ -466,6 +415,7 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
|
||||
org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld();
|
||||
// CraftBukkit end
|
||||
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
for (int i2 = k; i2 <= j1; ++i2) {
|
||||
@ -475,7 +425,7 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id) {
|
||||
flag1 = true;
|
||||
// CraftBukkit start - add blocks to list rather than destroying them
|
||||
//this.world.setTypeId(k1, l1, i2, 0);
|
||||
// this.world.setTypeId(k1, l1, i2, 0);
|
||||
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
@ -501,6 +451,7 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
double d0 = axisalignedbb.a + (axisalignedbb.d - axisalignedbb.a) * (double) this.random.nextFloat();
|
||||
double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat();
|
||||
double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat();
|
||||
@ -512,7 +463,7 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
|
||||
public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, int i) {
|
||||
if (entitycomplexpart != this.g) {
|
||||
if (entitycomplexpart != this.h) {
|
||||
i = i / 4 + 1;
|
||||
}
|
||||
|
||||
@ -520,10 +471,10 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
float f1 = MathHelper.sin(f);
|
||||
float f2 = MathHelper.cos(f);
|
||||
|
||||
this.a = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
|
||||
this.b = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
|
||||
this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
|
||||
this.u = null;
|
||||
this.b = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
|
||||
this.c = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
|
||||
this.d = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
|
||||
this.bI = null;
|
||||
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
|
||||
this.dealDamage(damagesource, i);
|
||||
}
|
||||
@ -531,9 +482,9 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void aB() {
|
||||
++this.r;
|
||||
if (this.r >= 180 && this.r <= 200) {
|
||||
protected void aI() {
|
||||
++this.bG;
|
||||
if (this.bG >= 180 && this.bG <= 200) {
|
||||
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
|
||||
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
@ -544,8 +495,8 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
if (!this.world.isStatic && this.r > 150 && this.r % 5 == 0) {
|
||||
i = expToDrop / 20; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
|
||||
if (!this.world.isStatic && this.bG > 150 && this.bG % 5 == 0) {
|
||||
i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
@ -555,9 +506,9 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
|
||||
this.move(0.0D, 0.10000000149011612D, 0.0D);
|
||||
this.V = this.yaw += 20.0F;
|
||||
if (this.r == 200) {
|
||||
i = expToDrop - 10 * (expToDrop / 20); // CraftBukkit - drop the remaining experience
|
||||
this.aq = this.yaw += 20.0F;
|
||||
if (this.bG == 200 && !this.world.isStatic) {
|
||||
i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
@ -566,7 +517,6 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
|
||||
this.a(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
|
||||
this.aH();
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
@ -585,16 +535,16 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
for (int i1 = j - b1; i1 <= j + b1; ++i1) {
|
||||
double d0 = (double) (l - i);
|
||||
double d1 = (double) (i1 - j);
|
||||
double d2 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
|
||||
if (d2 <= (double) b1 - 0.5D) {
|
||||
if (d2 <= ((double) b1 - 0.5D) * ((double) b1 - 0.5D)) {
|
||||
if (k < b0) {
|
||||
if (d2 <= (double) (b1 - 1) - 0.5D) {
|
||||
if (d2 <= ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
|
||||
world.setTypeId(l, k, i1, Block.BEDROCK.id);
|
||||
}
|
||||
} else if (k > b0) {
|
||||
world.setTypeId(l, k, i1, 0);
|
||||
} else if (d2 > (double) (b1 - 1) - 0.5D) {
|
||||
} else if (d2 > ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) {
|
||||
world.setTypeId(l, k, i1, Block.BEDROCK.id);
|
||||
} else {
|
||||
world.setTypeId(l, k, i1, Block.ENDER_PORTAL.id);
|
||||
@ -637,21 +587,21 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
BlockEnderPortal.a = false;
|
||||
}
|
||||
|
||||
protected void aG() {}
|
||||
protected void bb() {}
|
||||
|
||||
public Entity[] bb() {
|
||||
public Entity[] al() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
public boolean o_() {
|
||||
public boolean L() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public int getExpReward() {
|
||||
// This value is equal to the amount of experience dropped while falling from the sky (10 * 1000)
|
||||
// plus what is dropped when the dragon hits the ground (10000)
|
||||
return 20000;
|
||||
// plus what is dropped when the dragon hits the ground (2000)
|
||||
return 12000;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -17,13 +17,9 @@ public class EntityEnderPearl extends EntityProjectile {
|
||||
super(world, entityliving);
|
||||
}
|
||||
|
||||
public EntityEnderPearl(World world, double d0, double d1, double d2) {
|
||||
super(world, d0, d1, d2);
|
||||
}
|
||||
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
if (movingobjectposition.entity != null && movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0)) {
|
||||
;
|
||||
if (movingobjectposition.entity != null) {
|
||||
movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
@ -31,47 +27,36 @@ public class EntityEnderPearl extends EntityProjectile {
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start - dupe fix + damage event
|
||||
boolean teleport = false;
|
||||
PlayerTeleportEvent teleEvent = null;
|
||||
if (this.shooter != null && this.shooter instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.shooter;
|
||||
|
||||
if (this.shooter != null) {
|
||||
if (this.shooter instanceof EntityPlayer) {
|
||||
if (!entityplayer.netServerHandler.disconnected && entityplayer.world == this.world) {
|
||||
// CraftBukkit start
|
||||
CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity;
|
||||
teleport = player.isOnline() && player.getWorld() == getBukkitEntity().getWorld();
|
||||
org.bukkit.Location location = getBukkitEntity().getLocation();
|
||||
location.setPitch(player.getLocation().getPitch());
|
||||
location.setYaw(player.getLocation().getYaw());
|
||||
|
||||
if (teleport) {
|
||||
teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||
Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
teleport = !teleEvent.isCancelled();
|
||||
PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||
Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
if (!teleEvent.isCancelled()) {
|
||||
((EntityPlayer) this.shooter).netServerHandler.teleport(teleEvent.getTo());
|
||||
this.shooter.fallDistance = 0.0F;
|
||||
|
||||
EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5);
|
||||
Bukkit.getPluginManager().callEvent(damageEvent);
|
||||
|
||||
if (!damageEvent.isCancelled()) {
|
||||
org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name);
|
||||
((CraftPlayer) bPlayer).getHandle().invulnerableTicks = -1; // Remove spawning invulnerability
|
||||
bPlayer.setLastDamageCause(damageEvent);
|
||||
((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, damageEvent.getDamage()); // Damage the new player instead of the old
|
||||
}
|
||||
}
|
||||
} else {
|
||||
teleport = true;
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
if (teleport) {
|
||||
if (this.shooter instanceof EntityPlayer) {
|
||||
((EntityPlayer) this.shooter).netServerHandler.teleport(teleEvent.getTo());
|
||||
} else {
|
||||
this.shooter.enderTeleportTo(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
this.shooter.fallDistance = 0.0F;
|
||||
EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5);
|
||||
Bukkit.getPluginManager().callEvent(damageEvent);
|
||||
|
||||
if (!damageEvent.isCancelled()) {
|
||||
org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name);
|
||||
((CraftPlayer) bPlayer).getHandle().invulnerableTicks = -1; // Remove spawning invulnerability.
|
||||
bPlayer.setLastDamageCause(damageEvent);
|
||||
((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, damageEvent.getDamage()); // Damage the new player instead of the old
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
@ -8,28 +8,28 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
|
||||
public class EntityEnderman extends EntityMonster {
|
||||
|
||||
private static boolean[] b = new boolean[256];
|
||||
public boolean a = false;
|
||||
private static boolean[] d = new boolean[256];
|
||||
private int e = 0;
|
||||
private int g = 0;
|
||||
private int h = 0;
|
||||
|
||||
public EntityEnderman(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/enderman.png";
|
||||
this.bb = 0.2F;
|
||||
this.bw = 0.2F;
|
||||
this.damage = 7;
|
||||
this.b(0.6F, 2.9F);
|
||||
this.bP = 1.0F;
|
||||
this.a(0.6F, 2.9F);
|
||||
this.W = 1.0F;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 40;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
this.datawatcher.a(17, new Byte((byte) 0));
|
||||
this.datawatcher.a(18, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
@ -48,47 +48,43 @@ public class EntityEnderman extends EntityMonster {
|
||||
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
if (this.c(entityhuman)) {
|
||||
if (this.h++ == 5) {
|
||||
this.h = 0;
|
||||
if (this.d(entityhuman)) {
|
||||
if (this.g++ == 5) {
|
||||
this.g = 0;
|
||||
this.e(true);
|
||||
return entityhuman;
|
||||
}
|
||||
} else {
|
||||
this.h = 0;
|
||||
this.g = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public float b(float f) {
|
||||
return super.b(f);
|
||||
}
|
||||
|
||||
private boolean c(EntityHuman entityhuman) {
|
||||
private boolean d(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.armor[3];
|
||||
|
||||
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
|
||||
return false;
|
||||
} else {
|
||||
Vec3D vec3d = entityhuman.f(1.0F).b();
|
||||
Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
|
||||
Vec3D vec3d = entityhuman.i(1.0F).b();
|
||||
Vec3D vec3d1 = Vec3D.a().create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
|
||||
double d0 = vec3d1.c();
|
||||
|
||||
vec3d1 = vec3d1.b();
|
||||
double d1 = vec3d.a(vec3d1);
|
||||
double d1 = vec3d.b(vec3d1);
|
||||
|
||||
return d1 > 1.0D - 0.025D / d0 ? entityhuman.h(this) : false;
|
||||
return d1 > 1.0D - 0.025D / d0 ? entityhuman.l(this) : false;
|
||||
}
|
||||
}
|
||||
|
||||
public void e() {
|
||||
if (this.aT()) {
|
||||
public void d() {
|
||||
if (this.G()) {
|
||||
this.damageEntity(DamageSource.DROWN, 1);
|
||||
}
|
||||
|
||||
this.a = this.target != null;
|
||||
this.bb = this.target != null ? 6.5F : 0.3F;
|
||||
this.bw = this.target != null ? 6.5F : 0.3F;
|
||||
int i;
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
@ -102,7 +98,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D);
|
||||
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
|
||||
l = this.world.getTypeId(i, j, k);
|
||||
if (b[l]) {
|
||||
if (d[l]) {
|
||||
// CraftBukkit start - pickup event
|
||||
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
|
||||
this.setCarriedId(this.world.getTypeId(i, j, k));
|
||||
@ -119,7 +115,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
l = this.world.getTypeId(i, j, k);
|
||||
int i1 = this.world.getTypeId(i, j - 1, k);
|
||||
|
||||
if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
|
||||
if (l == 0 && i1 > 0 && Block.byId[i1].c()) {
|
||||
// CraftBukkit start - place event
|
||||
org.bukkit.block.Block bblock = this.world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
@ -136,56 +132,59 @@ public class EntityEnderman extends EntityMonster {
|
||||
this.world.a("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D);
|
||||
}
|
||||
|
||||
if (this.world.e() && !this.world.isStatic) {
|
||||
float f = this.b(1.0F);
|
||||
if (this.world.r() && !this.world.isStatic) {
|
||||
float f = this.c(1.0F);
|
||||
|
||||
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
if (f > 0.5F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
this.target = null;
|
||||
this.x();
|
||||
this.e(false);
|
||||
this.n();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.aT()) {
|
||||
if (this.G()) {
|
||||
this.target = null;
|
||||
this.x();
|
||||
this.e(false);
|
||||
this.n();
|
||||
}
|
||||
|
||||
this.aZ = false;
|
||||
this.bu = false;
|
||||
if (this.target != null) {
|
||||
this.a(this.target, 100.0F, 100.0F);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic && this.isAlive()) {
|
||||
if (this.target != null) {
|
||||
if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) {
|
||||
this.aW = this.aX = 0.0F;
|
||||
this.bb = 0.0F;
|
||||
if (this.target.j(this) < 16.0D) {
|
||||
this.x();
|
||||
if (this.target instanceof EntityHuman && this.d((EntityHuman) this.target)) {
|
||||
this.br = this.bs = 0.0F;
|
||||
this.bw = 0.0F;
|
||||
if (this.target.e((Entity) this) < 16.0D) {
|
||||
this.n();
|
||||
}
|
||||
|
||||
this.g = 0;
|
||||
} else if (this.target.j(this) > 256.0D && this.g++ >= 30 && this.e(this.target)) {
|
||||
this.g = 0;
|
||||
this.e = 0;
|
||||
} else if (this.target.e((Entity) this) > 256.0D && this.e++ >= 30 && this.c(this.target)) {
|
||||
this.e = 0;
|
||||
}
|
||||
} else {
|
||||
this.g = 0;
|
||||
this.e(false);
|
||||
this.e = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.e();
|
||||
super.d();
|
||||
}
|
||||
|
||||
protected boolean x() {
|
||||
protected boolean n() {
|
||||
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.b(d0, d1, d2);
|
||||
return this.j(d0, d1, d2);
|
||||
}
|
||||
|
||||
protected boolean e(Entity entity) {
|
||||
Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
|
||||
protected boolean c(Entity entity) {
|
||||
Vec3D vec3d = Vec3D.a().create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
|
||||
|
||||
vec3d = vec3d.b();
|
||||
double d0 = 16.0D;
|
||||
@ -193,10 +192,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.b(d1, d2, d3);
|
||||
return this.j(d1, d2, d3);
|
||||
}
|
||||
|
||||
protected boolean b(double d0, double d1, double d2) {
|
||||
protected boolean j(double d0, double d1, double d2) {
|
||||
double d3 = this.locX;
|
||||
double d4 = this.locY;
|
||||
double d5 = this.locZ;
|
||||
@ -235,7 +234,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
this.setPosition(to.getX(), to.getY(), to.getZ());
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox)) {
|
||||
if (this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
@ -265,15 +264,15 @@ public class EntityEnderman extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.endermen.idle";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.endermen.hit";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.endermen.death";
|
||||
}
|
||||
|
||||
@ -317,31 +316,39 @@ public class EntityEnderman extends EntityMonster {
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
if (damagesource instanceof EntityDamageSourceIndirect) {
|
||||
for (int j = 0; j < 64; ++j) {
|
||||
if (this.x()) {
|
||||
if (this.n()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
if (damagesource.getEntity() instanceof EntityHuman) {
|
||||
this.e(true);
|
||||
}
|
||||
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
}
|
||||
|
||||
public void e(boolean flag) {
|
||||
this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
|
||||
}
|
||||
|
||||
static {
|
||||
b[Block.GRASS.id] = true;
|
||||
b[Block.DIRT.id] = true;
|
||||
b[Block.SAND.id] = true;
|
||||
b[Block.GRAVEL.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.TNT.id] = true;
|
||||
b[Block.CACTUS.id] = true;
|
||||
b[Block.CLAY.id] = true;
|
||||
b[Block.PUMPKIN.id] = true;
|
||||
b[Block.MELON.id] = true;
|
||||
b[Block.MYCEL.id] = true;
|
||||
d[Block.GRASS.id] = true;
|
||||
d[Block.DIRT.id] = true;
|
||||
d[Block.SAND.id] = true;
|
||||
d[Block.GRAVEL.id] = true;
|
||||
d[Block.YELLOW_FLOWER.id] = true;
|
||||
d[Block.RED_ROSE.id] = true;
|
||||
d[Block.BROWN_MUSHROOM.id] = true;
|
||||
d[Block.RED_MUSHROOM.id] = true;
|
||||
d[Block.TNT.id] = true;
|
||||
d[Block.CACTUS.id] = true;
|
||||
d[Block.CLAY.id] = true;
|
||||
d[Block.PUMPKIN.id] = true;
|
||||
d[Block.MELON.id] = true;
|
||||
d[Block.MYCEL.id] = true;
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ public class EntityExperienceOrb extends Entity {
|
||||
public int b = 0;
|
||||
public int c;
|
||||
private int d = 5;
|
||||
public int value; // CraftBukkit - priv to pub
|
||||
public int value; // CraftBukkit - private -> public
|
||||
|
||||
public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) {
|
||||
super(world);
|
||||
this.b(0.5F, 0.5F);
|
||||
this.a(0.5F, 0.5F);
|
||||
this.height = this.length / 2.0F;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.yaw = (float) (Math.random() * 360.0D);
|
||||
@ -25,20 +25,20 @@ public class EntityExperienceOrb extends Entity {
|
||||
this.value = i;
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public EntityExperienceOrb(World world) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.height = this.length / 2.0F;
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {}
|
||||
|
||||
public void F_() {
|
||||
super.F_();
|
||||
public void h_() {
|
||||
super.h_();
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
this.world.makeSound(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
}
|
||||
|
||||
this.g(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
|
||||
this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
|
||||
double d0 = 8.0D;
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, d0);
|
||||
|
||||
@ -105,7 +105,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean h_() {
|
||||
public boolean I() {
|
||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.aW();
|
||||
this.K();
|
||||
this.d -= i;
|
||||
if (this.d <= 0) {
|
||||
this.die();
|
||||
@ -135,10 +135,10 @@ public class EntityExperienceOrb extends Entity {
|
||||
this.value = nbttagcompound.getShort("Value");
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {
|
||||
public void b_(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic) {
|
||||
if (this.c == 0 && entityhuman.x == 0) {
|
||||
entityhuman.x = 2;
|
||||
if (this.c == 0 && entityhuman.bL == 0) {
|
||||
entityhuman.bL = 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.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value to event.getAmount()
|
||||
@ -147,7 +147,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public int y_() {
|
||||
public int d() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
return i >= 2477 ? 2477 : (i >= 1237 ? 1237 : (i >= 617 ? 617 : (i >= 307 ? 307 : (i >= 149 ? 149 : (i >= 73 ? 73 : (i >= 37 ? 37 : (i >= 17 ? 17 : (i >= 7 ? 7 : (i >= 3 ? 3 : 1)))))))));
|
||||
}
|
||||
|
||||
public boolean k_() {
|
||||
public boolean an() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,90 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
public int id;
|
||||
public int data; // CraftBukkit
|
||||
public int b = 0;
|
||||
|
||||
public EntityFallingBlock(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
// CraftBukkit - changed method signature
|
||||
public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int data) {
|
||||
super(world);
|
||||
this.id = i;
|
||||
this.bf = true;
|
||||
this.data = data; // CraftBukkit
|
||||
this.b(0.98F, 0.98F);
|
||||
this.height = this.length / 2.0F;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
|
||||
public boolean o_() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
if (this.id == 0) {
|
||||
this.die();
|
||||
} else {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
++this.b;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (this.b == 1 && this.world.getTypeId(i, j, k) == this.id) {
|
||||
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;
|
||||
if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
|
||||
this.die();
|
||||
// CraftBukkit - setTypeId => setTypeIdAndData
|
||||
if ((!this.world.mayPlace(this.id, i, j, k, true, 1) || BlockSand.canFall(this.world, i, j - 1, k) || !this.world.setTypeIdAndData(i, j, k, this.id, this.data)) && !this.world.isStatic) {
|
||||
this.b(this.id, 1);
|
||||
}
|
||||
}
|
||||
} else if (this.b > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.b > 600) {
|
||||
this.b(this.id, 1);
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setByte("Tile", (byte) this.id);
|
||||
nbttagcompound.setByte("Data", (byte) this.data); // CraftBukkit
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.id = nbttagcompound.getByte("Tile") & 255;
|
||||
this.data = nbttagcompound.getByte("Data") & 15; // CraftBukkit
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
@ -16,24 +17,23 @@ public class EntityFireball extends Entity {
|
||||
private boolean i = false;
|
||||
public EntityLiving shooter;
|
||||
private int j;
|
||||
private int k = 0;
|
||||
private int an = 0;
|
||||
public double dirX;
|
||||
public double dirY;
|
||||
public double dirZ;
|
||||
|
||||
public float yield = 1; // CraftBukkit
|
||||
public boolean isIncendiary = true; // CraftBukkit
|
||||
|
||||
public EntityFireball(World world) {
|
||||
super(world);
|
||||
this.b(1.0F, 1.0F);
|
||||
this.a(1.0F, 1.0F);
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {}
|
||||
|
||||
public EntityFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||
super(world);
|
||||
this.b(1.0F, 1.0F);
|
||||
this.a(1.0F, 1.0F);
|
||||
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
|
||||
this.setPosition(d0, d1, d2);
|
||||
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
@ -46,7 +46,7 @@ public class EntityFireball extends Entity {
|
||||
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
this.b(1.0F, 1.0F);
|
||||
this.a(1.0F, 1.0F);
|
||||
this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.height = 0.0F;
|
||||
@ -67,11 +67,11 @@ public class EntityFireball extends Entity {
|
||||
this.dirZ = d2 / d3 * 0.1D;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
public void h_() {
|
||||
if (!this.world.isStatic && (this.shooter != null && this.shooter.dead || !this.world.isLoaded((int) this.locX, (int) this.locY, (int) this.locZ))) {
|
||||
this.die();
|
||||
} else {
|
||||
super.F_();
|
||||
super.h_();
|
||||
this.setOnFire(1);
|
||||
if (this.i) {
|
||||
int i = this.world.getTypeId(this.e, this.f, this.g);
|
||||
@ -90,29 +90,30 @@ public class EntityFireball extends Entity {
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.j = 0;
|
||||
this.k = 0;
|
||||
this.an = 0;
|
||||
} else {
|
||||
++this.k;
|
||||
++this.an;
|
||||
}
|
||||
|
||||
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);
|
||||
Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.a().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);
|
||||
vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1.o_() && (!entity1.a_((Entity) this.shooter) || this.k >= 25)) {
|
||||
if (entity1.L() && (!entity1.i(this.shooter) || this.an >= 25)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -134,6 +135,7 @@ public class EntityFireball extends Entity {
|
||||
|
||||
if (movingobjectposition != null) {
|
||||
this.a(movingobjectposition);
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.dead) {
|
||||
ProjectileHitEvent phe = new ProjectileHitEvent((org.bukkit.entity.Projectile) this.getBukkitEntity());
|
||||
@ -169,8 +171,8 @@ public class EntityFireball extends Entity {
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.95F;
|
||||
|
||||
if (this.aU()) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
if (this.H()) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
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);
|
||||
@ -192,9 +194,10 @@ public class EntityFireball extends Entity {
|
||||
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
if (!this.world.isStatic) {
|
||||
if (movingobjectposition.entity != null && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 4)) {
|
||||
;
|
||||
if (movingobjectposition.entity != null) {
|
||||
movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
@ -214,8 +217,7 @@ public class EntityFireball extends Entity {
|
||||
nbttagcompound.setShort("zTile", (short) this.g);
|
||||
nbttagcompound.setByte("inTile", (byte) this.h);
|
||||
nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
|
||||
// CraftBukkit
|
||||
nbttagcompound.set("Direction", this.a(new double[] { this.dirX, this.dirY, this.dirZ}));
|
||||
nbttagcompound.set("direction", this.a(new double[] { this.motX, this.motY, this.motZ}));
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@ -224,30 +226,29 @@ public class EntityFireball extends Entity {
|
||||
this.g = nbttagcompound.getShort("zTile");
|
||||
this.h = nbttagcompound.getByte("inTile") & 255;
|
||||
this.i = nbttagcompound.getByte("inGround") == 1;
|
||||
// CraftBukkit start
|
||||
if (nbttagcompound.hasKey("Direction")) {
|
||||
NBTTagList nbttaglist1 = nbttagcompound.getList("Direction");
|
||||
this.dirX = ((NBTTagDouble) nbttaglist1.get(0)).data;
|
||||
this.dirY = ((NBTTagDouble) nbttaglist1.get(1)).data;
|
||||
this.dirZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
|
||||
if (nbttagcompound.hasKey("direction")) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getList("direction");
|
||||
|
||||
this.motX = ((NBTTagDouble) nbttaglist.get(0)).data;
|
||||
this.motY = ((NBTTagDouble) nbttaglist.get(1)).data;
|
||||
this.motZ = ((NBTTagDouble) nbttaglist.get(2)).data;
|
||||
} else {
|
||||
this.die();
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean o_() {
|
||||
public boolean L() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public float j_() {
|
||||
public float Y() {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.aW();
|
||||
this.K();
|
||||
if (damagesource.getEntity() != null) {
|
||||
Vec3D vec3d = damagesource.getEntity().aJ();
|
||||
Vec3D vec3d = damagesource.getEntity().Z();
|
||||
|
||||
if (vec3d != null) {
|
||||
this.motX = vec3d.a;
|
||||
@ -268,7 +269,7 @@ public class EntityFireball extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public float b(float f) {
|
||||
public float c(float f) {
|
||||
return 1.0F;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
@ -18,27 +19,27 @@ public class EntityFishingHook extends Entity {
|
||||
public EntityHuman owner;
|
||||
private int i;
|
||||
private int j = 0;
|
||||
private int k = 0;
|
||||
private int an = 0;
|
||||
public Entity hooked = null;
|
||||
private int l;
|
||||
private double m;
|
||||
private double n;
|
||||
private double o;
|
||||
private double p;
|
||||
private double q;
|
||||
private int ao;
|
||||
private double ap;
|
||||
private double aq;
|
||||
private double ar;
|
||||
private double as;
|
||||
private double at;
|
||||
|
||||
public EntityFishingHook(World world) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
this.cd = true;
|
||||
this.a(0.25F, 0.25F);
|
||||
this.ak = true;
|
||||
}
|
||||
|
||||
public EntityFishingHook(World world, EntityHuman entityhuman) {
|
||||
super(world);
|
||||
this.cd = true;
|
||||
this.ak = true;
|
||||
this.owner = entityhuman;
|
||||
this.owner.hookedFish = this;
|
||||
this.b(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.setPositionRotation(entityhuman.locX, entityhuman.locY + 1.62D - (double) entityhuman.height, entityhuman.locZ, entityhuman.yaw, entityhuman.pitch);
|
||||
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
@ -50,12 +51,12 @@ public class EntityFishingHook extends Entity {
|
||||
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);
|
||||
this.c(this.motX, this.motY, this.motZ, 1.5F, 1.0F);
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {}
|
||||
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
public void c(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d0 /= (double) f2;
|
||||
@ -77,33 +78,24 @@ public class EntityFishingHook extends Entity {
|
||||
this.i = 0;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
super.F_();
|
||||
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;
|
||||
double d2 = this.locZ + (this.o - this.locZ) / (double) this.l;
|
||||
public void h_() {
|
||||
super.h_();
|
||||
if (this.ao > 0) {
|
||||
double d0 = this.locX + (this.ap - this.locX) / (double) this.ao;
|
||||
double d1 = this.locY + (this.aq - this.locY) / (double) this.ao;
|
||||
double d2 = this.locZ + (this.ar - this.locZ) / (double) this.ao;
|
||||
double d3 = MathHelper.g(this.as - (double) this.yaw);
|
||||
|
||||
double d3;
|
||||
|
||||
for (d3 = this.p - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d3 >= 180.0D) {
|
||||
d3 -= 360.0D;
|
||||
}
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.l);
|
||||
this.pitch = (float) ((double) this.pitch + (this.q - (double) this.pitch) / (double) this.l);
|
||||
--this.l;
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.ao);
|
||||
this.pitch = (float) ((double) this.pitch + (this.at - (double) this.pitch) / (double) this.ao);
|
||||
--this.ao;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.c(this.yaw, this.pitch);
|
||||
this.b(this.yaw, this.pitch);
|
||||
} else {
|
||||
if (!this.world.isStatic) {
|
||||
ItemStack itemstack = this.owner.U();
|
||||
ItemStack itemstack = this.owner.bC();
|
||||
|
||||
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.j(this.owner) > 1024.0D) {
|
||||
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
return;
|
||||
@ -147,26 +139,27 @@ public class EntityFishingHook extends Entity {
|
||||
++this.j;
|
||||
}
|
||||
|
||||
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);
|
||||
Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.a().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);
|
||||
vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
|
||||
double d4 = 0.0D;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
double d5;
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1.o_() && (entity1 != this.owner || this.j >= 5)) {
|
||||
if (entity1.L() && (entity1 != this.owner || this.j >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -228,10 +221,10 @@ public class EntityFishingHook extends Entity {
|
||||
byte b0 = 5;
|
||||
double d6 = 0.0D;
|
||||
|
||||
for (int k = 0; k < b0; ++k) {
|
||||
double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 0) / (double) b0 - 0.125D + 0.125D;
|
||||
double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (k + 1) / (double) b0 - 0.125D + 0.125D;
|
||||
AxisAlignedBB axisalignedbb1 = AxisAlignedBB.b(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f);
|
||||
for (int j = 0; j < b0; ++j) {
|
||||
double d7 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (j + 0) / (double) b0 - 0.125D + 0.125D;
|
||||
double d8 = this.boundingBox.b + (this.boundingBox.e - this.boundingBox.b) * (double) (j + 1) / (double) b0 - 0.125D + 0.125D;
|
||||
AxisAlignedBB axisalignedbb1 = AxisAlignedBB.a().a(this.boundingBox.a, d7, this.boundingBox.c, this.boundingBox.d, d8, this.boundingBox.f);
|
||||
|
||||
if (this.world.b(axisalignedbb1, Material.WATER)) {
|
||||
d6 += 1.0D / (double) b0;
|
||||
@ -239,32 +232,32 @@ public class EntityFishingHook extends Entity {
|
||||
}
|
||||
|
||||
if (d6 > 0.0D) {
|
||||
if (this.k > 0) {
|
||||
--this.k;
|
||||
if (this.an > 0) {
|
||||
--this.an;
|
||||
} else {
|
||||
short short1 = 500;
|
||||
|
||||
if (this.world.y(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
|
||||
if (this.world.B(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
|
||||
short1 = 300;
|
||||
}
|
||||
|
||||
if (this.random.nextInt(short1) == 0) {
|
||||
this.k = this.random.nextInt(30) + 10;
|
||||
this.an = this.random.nextInt(30) + 10;
|
||||
this.motY -= 0.20000000298023224D;
|
||||
this.world.makeSound(this, "random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
float f3 = (float) MathHelper.floor(this.boundingBox.b);
|
||||
|
||||
float f4;
|
||||
int l;
|
||||
int k;
|
||||
float f5;
|
||||
|
||||
for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
|
||||
for (k = 0; (float) k < 1.0F + this.width * 20.0F; ++k) {
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
this.world.a("bubble", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
|
||||
}
|
||||
|
||||
for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
|
||||
for (k = 0; (float) k < 1.0F + this.width * 20.0F; ++k) {
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
this.world.a("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ);
|
||||
@ -273,7 +266,7 @@ public class EntityFishingHook extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.k > 0) {
|
||||
if (this.an > 0) {
|
||||
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
|
||||
}
|
||||
|
||||
@ -310,80 +303,93 @@ public class EntityFishingHook extends Entity {
|
||||
this.h = nbttagcompound.getByte("inGround") == 1;
|
||||
}
|
||||
|
||||
public int k() {
|
||||
byte b0 = 0;
|
||||
public int d() {
|
||||
if (this.world.isStatic) {
|
||||
return 0;
|
||||
} else {
|
||||
byte b0 = 0;
|
||||
|
||||
if (this.hooked != null) {
|
||||
// CraftBukkit start
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
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;
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
double d4 = 0.1D;
|
||||
|
||||
this.hooked.motX += d0 * d4;
|
||||
this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
|
||||
this.hooked.motZ += d2 * d4;
|
||||
b0 = 3;
|
||||
} else if (this.an > 0) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
||||
// CraftBukkit start
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
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;
|
||||
double d8 = (double) MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
|
||||
double d9 = 0.1D;
|
||||
|
||||
entityitem.motX = d5 * d9;
|
||||
entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
|
||||
entityitem.motZ = d7 * d9;
|
||||
this.world.addEntity(entityitem);
|
||||
this.owner.a(StatisticList.B, 1);
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
if (this.h) {
|
||||
// CraftBukkit start
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.IN_GROUND);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
return 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
if (this.hooked != null) {
|
||||
// CraftBukkit start
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
return 0;
|
||||
if (b0 == 0) {
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
double d0 = this.owner.locX - this.locX;
|
||||
double d1 = this.owner.locY - this.locY;
|
||||
double d2 = this.owner.locZ - this.locZ;
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
double d4 = 0.1D;
|
||||
|
||||
this.hooked.motX += d0 * d4;
|
||||
this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
|
||||
this.hooked.motZ += d2 * d4;
|
||||
b0 = 3;
|
||||
} else if (this.k > 0) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
||||
// CraftBukkit start
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
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;
|
||||
double d8 = (double) MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
|
||||
double d9 = 0.1D;
|
||||
|
||||
entityitem.motX = d5 * d9;
|
||||
entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
|
||||
entityitem.motZ = d7 * d9;
|
||||
this.world.addEntity(entityitem);
|
||||
this.owner.a(StatisticList.B, 1);
|
||||
b0 = 1;
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
return b0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.h) {
|
||||
// CraftBukkit start
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.IN_GROUND);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
return 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
b0 = 2;
|
||||
public void die() {
|
||||
super.die();
|
||||
if (this.owner != null) {
|
||||
this.owner.hookedFish = null;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (b0 == 0) {
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, PlayerFishEvent.State.FAILED_ATTEMPT);
|
||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
this.owner.hookedFish = null;
|
||||
return b0;
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
public EntityGhast(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/ghast.png";
|
||||
this.b(4.0F, 4.0F);
|
||||
this.a(4.0F, 4.0F);
|
||||
this.fireProof = true;
|
||||
this.aA = 5;
|
||||
this.aV = 5;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
@ -35,8 +35,8 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
}
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
@ -44,26 +44,26 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
super.F_();
|
||||
public void h_() {
|
||||
super.h_();
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
|
||||
}
|
||||
|
||||
protected void d_() {
|
||||
protected void be() {
|
||||
if (!this.world.isStatic && this.world.difficulty == 0) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
this.aG();
|
||||
this.bb();
|
||||
this.e = this.f;
|
||||
double d0 = this.b - this.locX;
|
||||
double d1 = this.c - this.locY;
|
||||
double d2 = this.d - this.locZ;
|
||||
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
if (d3 < 1.0D || d3 > 60.0D) {
|
||||
if (d3 < 1.0D || d3 > 3600.0D) {
|
||||
this.b = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.c = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.d = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
@ -71,6 +71,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
if (this.a-- <= 0) {
|
||||
this.a += this.random.nextInt(5) + 2;
|
||||
d3 = (double) MathHelper.sqrt(d3);
|
||||
if (this.a(this.b, this.c, this.d, d3)) {
|
||||
this.motX += d0 / d3 * 0.1D;
|
||||
this.motY += d1 / d3 * 0.1D;
|
||||
@ -113,6 +114,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.target != null) {
|
||||
this.h = 20;
|
||||
}
|
||||
@ -120,13 +122,13 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
double d4 = 64.0D;
|
||||
|
||||
if (this.target != null && this.target.j(this) < d4 * d4) {
|
||||
if (this.target != null && this.target.e((Entity) this) < d4 * d4) {
|
||||
double d5 = this.target.locX - this.locX;
|
||||
double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
|
||||
double d7 = this.target.locZ - this.locZ;
|
||||
|
||||
this.V = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.h(this.target)) {
|
||||
this.aq = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.l(this.target)) {
|
||||
if (this.f == 10) {
|
||||
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
}
|
||||
@ -136,7 +138,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
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.f(1.0F);
|
||||
Vec3D vec3d = this.i(1.0F);
|
||||
|
||||
entityfireball.locX = this.locX + vec3d.a * d8;
|
||||
entityfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
|
||||
@ -148,7 +150,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
--this.f;
|
||||
}
|
||||
} else {
|
||||
this.V = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
|
||||
this.aq = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
|
||||
if (this.f > 0) {
|
||||
--this.f;
|
||||
}
|
||||
@ -172,7 +174,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
for (int i = 1; (double) i < d3; ++i) {
|
||||
axisalignedbb.d(d4, d5, d6);
|
||||
if (this.world.getCubes(this, axisalignedbb).size() > 0) {
|
||||
if (!this.world.getCubes(this, axisalignedbb).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -180,15 +182,15 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.ghast.moan";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.ghast.scream";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.ghast.death";
|
||||
}
|
||||
|
||||
@ -217,7 +219,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected float p() {
|
||||
protected float aP() {
|
||||
return 10.0F;
|
||||
}
|
||||
|
||||
@ -225,7 +227,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
|
||||
}
|
||||
|
||||
public int q() {
|
||||
public int bl() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -4,16 +4,16 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
||||
|
||||
public class EntityIronGolem extends EntityGolem {
|
||||
|
||||
private int b = 0;
|
||||
Village a = null;
|
||||
private int c;
|
||||
private int e = 0;
|
||||
Village d = null;
|
||||
private int f;
|
||||
private int g;
|
||||
|
||||
public EntityIronGolem(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/villager_golem.png";
|
||||
this.b(1.4F, 2.9F);
|
||||
this.al().a(true);
|
||||
this.a(1.4F, 2.9F);
|
||||
this.getNavigation().a(true);
|
||||
this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 0.25F, true));
|
||||
this.goalSelector.a(2, new PathfinderGoalMoveTowardsTarget(this, 0.22F, 32.0F));
|
||||
this.goalSelector.a(3, new PathfinderGoalMoveThroughVillage(this, 0.16F, true));
|
||||
@ -27,43 +27,43 @@ public class EntityIronGolem extends EntityGolem {
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityMonster.class, 16.0F, 0, false, true));
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void g() {
|
||||
if (--this.b <= 0) {
|
||||
this.b = 70 + this.random.nextInt(50);
|
||||
this.a = this.world.villages.getClosestVillage(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32);
|
||||
if (this.a == null) {
|
||||
this.ax();
|
||||
protected void bd() {
|
||||
if (--this.e <= 0) {
|
||||
this.e = 70 + this.random.nextInt(50);
|
||||
this.d = this.world.villages.getClosestVillage(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32);
|
||||
if (this.d == null) {
|
||||
this.aE();
|
||||
} else {
|
||||
ChunkCoordinates chunkcoordinates = this.a.getCenter();
|
||||
ChunkCoordinates chunkcoordinates = this.d.getCenter();
|
||||
|
||||
this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, this.a.getSize());
|
||||
this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, this.d.getSize());
|
||||
}
|
||||
}
|
||||
|
||||
super.g();
|
||||
super.bd();
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
protected int b_(int i) {
|
||||
protected int h(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public void e() {
|
||||
super.e();
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
public void d() {
|
||||
super.d();
|
||||
if (this.f > 0) {
|
||||
--this.f;
|
||||
}
|
||||
|
||||
if (this.g > 0) {
|
||||
@ -83,21 +83,11 @@ public class EntityIronGolem extends EntityGolem {
|
||||
}
|
||||
|
||||
public boolean a(Class oclass) {
|
||||
return this.n_() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
|
||||
return this.q() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setBoolean("PlayerCreated", this.n_());
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.b(nbttagcompound.getBoolean("PlayerCreated"));
|
||||
}
|
||||
|
||||
public boolean a(Entity entity) {
|
||||
this.c = 10;
|
||||
public boolean k(Entity entity) {
|
||||
this.f = 10;
|
||||
this.world.broadcastEntityEffect(this, (byte) 4);
|
||||
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), 7 + this.random.nextInt(15));
|
||||
|
||||
@ -109,24 +99,24 @@ public class EntityIronGolem extends EntityGolem {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public Village l_() {
|
||||
return this.a;
|
||||
public Village n() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
public void e(boolean flag) {
|
||||
this.g = flag ? 400 : 0;
|
||||
this.world.broadcastEntityEffect(this, (byte) 11);
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "none";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.irongolem.hit";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.irongolem.death";
|
||||
}
|
||||
|
||||
@ -141,29 +131,29 @@ public class EntityIronGolem extends EntityGolem {
|
||||
|
||||
int k;
|
||||
|
||||
for (k = 0; k < j; ++k) {
|
||||
loot.add(new CraftItemStack(Block.RED_ROSE.id, 1));
|
||||
if (j > 0) {
|
||||
loot.add(new CraftItemStack(Block.RED_ROSE.id, j));
|
||||
}
|
||||
|
||||
k = 3 + this.random.nextInt(3);
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
loot.add(new CraftItemStack(Item.IRON_INGOT.id, 1));
|
||||
if (k > 0) {
|
||||
loot.add(new CraftItemStack(Item.IRON_INGOT.id, k));
|
||||
}
|
||||
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public int m_() {
|
||||
public int p() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public boolean n_() {
|
||||
public boolean q() {
|
||||
return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void b(boolean flag) {
|
||||
public void f(boolean flag) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
if (flag) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
|
||||
|
||||
public class EntityItem extends Entity {
|
||||
@ -13,7 +15,7 @@ public class EntityItem extends Entity {
|
||||
|
||||
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.height = this.length / 2.0F;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.itemStack = itemstack;
|
||||
@ -31,20 +33,20 @@ public class EntityItem extends Entity {
|
||||
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public EntityItem(World world) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.height = this.length / 2.0F;
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {}
|
||||
|
||||
public void F_() {
|
||||
super.F_();
|
||||
public void h_() {
|
||||
super.h_();
|
||||
// CraftBukkit start
|
||||
int currentTick = (int) (System.currentTimeMillis() / 50);
|
||||
this.pickupDelay -= (currentTick - this.lastTick);
|
||||
@ -55,15 +57,29 @@ public class EntityItem extends Entity {
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
if (this.world.getMaterial(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) == Material.LAVA) {
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
|
||||
this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
|
||||
this.world.makeSound(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
boolean flag = (int) this.lastX != (int) this.locX || (int) this.lastY != (int) this.locY || (int) this.lastZ != (int) this.locZ;
|
||||
|
||||
if (flag) {
|
||||
if (this.world.getMaterial(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) == Material.LAVA) {
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
|
||||
this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
|
||||
this.world.makeSound(this, "random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityItem entityitem = (EntityItem) iterator.next();
|
||||
|
||||
this.a(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.g(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
float f = 0.98F;
|
||||
|
||||
if (this.onGround) {
|
||||
@ -94,11 +110,35 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void k() {
|
||||
public boolean a(EntityItem entityitem) {
|
||||
if (entityitem == this) {
|
||||
return false;
|
||||
} else if (entityitem.isAlive() && this.isAlive()) {
|
||||
if (entityitem.itemStack.getItem() != this.itemStack.getItem()) {
|
||||
return false;
|
||||
} else if (entityitem.itemStack.getItem().k() && entityitem.itemStack.getData() != this.itemStack.getData()) {
|
||||
return false;
|
||||
} else if (entityitem.itemStack.count < this.itemStack.count) {
|
||||
return entityitem.a(this);
|
||||
} else if (entityitem.itemStack.count + this.itemStack.count > entityitem.itemStack.getMaxStackSize()) {
|
||||
return false;
|
||||
} else {
|
||||
entityitem.itemStack.count += this.itemStack.count;
|
||||
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
|
||||
entityitem.age = Math.min(entityitem.age, this.age);
|
||||
this.die();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
this.age = 4800;
|
||||
}
|
||||
|
||||
public boolean h_() {
|
||||
public boolean I() {
|
||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||
}
|
||||
|
||||
@ -107,7 +147,7 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.aW();
|
||||
this.K();
|
||||
this.e -= i;
|
||||
if (this.e <= 0) {
|
||||
this.die();
|
||||
@ -119,8 +159,9 @@ public class EntityItem extends Entity {
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("Health", (short) ((byte) this.e));
|
||||
nbttagcompound.setShort("Age", (short) this.age);
|
||||
if (this.itemStack != null) // CraftBukkit - Nullchex!
|
||||
nbttagcompound.setCompound("Item", this.itemStack.save(new NBTTagCompound()));
|
||||
if (this.itemStack != null) {
|
||||
nbttagcompound.setCompound("Item", this.itemStack.save(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@ -134,13 +175,14 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {
|
||||
public void b_(EntityHuman entityhuman) {
|
||||
if ((!this.world.isStatic) && (this.itemStack != null)) { // CraftBukkit - nullcheck
|
||||
int i = this.itemStack.count;
|
||||
|
||||
// CraftBukkit start
|
||||
int canHold = entityhuman.inventory.canHold(this.itemStack);
|
||||
int remaining = this.itemStack.count - canHold;
|
||||
|
||||
if (this.pickupDelay <= 0 && canHold > 0) {
|
||||
this.itemStack.count = canHold;
|
||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
||||
@ -184,10 +226,10 @@ public class EntityItem extends Entity {
|
||||
|
||||
public String getLocalizedName() {
|
||||
if (this.itemStack == null) return LocaleI18n.get("item.unknown"); // CraftBukkit - nullcheck
|
||||
return LocaleI18n.get("item." + this.itemStack.k());
|
||||
return LocaleI18n.get("item." + this.itemStack.a());
|
||||
}
|
||||
|
||||
public boolean k_() {
|
||||
public boolean an() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.event.block.BlockIgniteEvent; // CraftBukkit
|
||||
|
||||
public class EntityWeatherLighting extends EntityWeather {
|
||||
public class EntityLightning extends EntityWeather {
|
||||
|
||||
private int lifeTicks;
|
||||
public long a = 0L;
|
||||
@ -14,11 +15,11 @@ public class EntityWeatherLighting extends EntityWeather {
|
||||
private org.bukkit.craftbukkit.CraftWorld cworld;
|
||||
public boolean isEffect = false;
|
||||
|
||||
public EntityWeatherLighting(World world, double d0, double d1, double d2) {
|
||||
public EntityLightning(World world, double d0, double d1, double d2) {
|
||||
this(world, d0, d1, d2, false);
|
||||
}
|
||||
|
||||
public EntityWeatherLighting(World world, double d0, double d1, double d2, boolean isEffect) {
|
||||
public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect) {
|
||||
// CraftBukkit end
|
||||
|
||||
super(world);
|
||||
@ -69,8 +70,8 @@ public class EntityWeatherLighting extends EntityWeather {
|
||||
}
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
super.F_();
|
||||
public void h_() {
|
||||
super.h_();
|
||||
if (this.lifeTicks == 2) {
|
||||
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
||||
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
|
||||
@ -106,19 +107,20 @@ public class EntityWeatherLighting extends EntityWeather {
|
||||
|
||||
if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit
|
||||
double d0 = 3.0D;
|
||||
List list = this.world.getEntities(this, AxisAlignedBB.b(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
|
||||
List list = this.world.getEntities(this, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
for (int l = 0; l < list.size(); ++l) {
|
||||
Entity entity = (Entity) list.get(l);
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
entity.a(this);
|
||||
}
|
||||
|
||||
this.world.n = 2;
|
||||
this.world.s = 2;
|
||||
}
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -6,26 +6,26 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
super(world);
|
||||
this.texture = "/mob/lava.png";
|
||||
this.fireProof = true;
|
||||
this.al = 0.2F;
|
||||
this.aG = 0.2F;
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
|
||||
return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
|
||||
}
|
||||
|
||||
public int T() {
|
||||
public int aO() {
|
||||
return this.getSize() * 3;
|
||||
}
|
||||
|
||||
public float b(float f) {
|
||||
public float c(float f) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
protected String A() {
|
||||
protected String i() {
|
||||
return "flame";
|
||||
}
|
||||
|
||||
protected EntitySlime C() {
|
||||
protected EntitySlime j() {
|
||||
return new EntityMagmaCube(this.world);
|
||||
}
|
||||
|
||||
@ -58,46 +58,46 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected int E() {
|
||||
return super.E() * 4;
|
||||
protected int k() {
|
||||
return super.k() * 4;
|
||||
}
|
||||
|
||||
protected void F() {
|
||||
protected void l() {
|
||||
this.a *= 0.9F;
|
||||
}
|
||||
|
||||
protected void ac() {
|
||||
protected void aZ() {
|
||||
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
|
||||
this.ce = true;
|
||||
this.al = true;
|
||||
}
|
||||
|
||||
protected void a(float f) {}
|
||||
|
||||
protected boolean G() {
|
||||
protected boolean m() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected int H() {
|
||||
return super.H() + 2;
|
||||
protected int n() {
|
||||
return super.n() + 2;
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.slime";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.slime";
|
||||
}
|
||||
|
||||
protected String I() {
|
||||
protected String o() {
|
||||
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
|
||||
}
|
||||
|
||||
public boolean aV() {
|
||||
public boolean J() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean K() {
|
||||
protected boolean p() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
private int h;
|
||||
private double i;
|
||||
private double j;
|
||||
private double k;
|
||||
private double l;
|
||||
private double m;
|
||||
private double an;
|
||||
private double ao;
|
||||
private double ap;
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean slowWhenEmpty = true;
|
||||
@ -74,31 +74,31 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.items = new ItemStack[27]; // CraftBukkit
|
||||
this.e = 0;
|
||||
this.f = false;
|
||||
this.bf = true;
|
||||
this.b(0.98F, 0.7F);
|
||||
this.m = true;
|
||||
this.a(0.98F, 0.7F);
|
||||
this.height = this.length / 2.0F;
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
protected void a() {
|
||||
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 g(Entity entity) {
|
||||
return entity.boundingBox;
|
||||
}
|
||||
|
||||
public AxisAlignedBB h() {
|
||||
public AxisAlignedBB E() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean e_() {
|
||||
public boolean M() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
|
||||
}
|
||||
|
||||
public double x_() {
|
||||
public double X() {
|
||||
return (double) this.length * 0.0D - 0.30000001192092896D;
|
||||
}
|
||||
|
||||
@ -136,14 +136,19 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
i = event.getDamage();
|
||||
// CraftBukkit end
|
||||
|
||||
this.e(-this.n());
|
||||
this.d(10);
|
||||
this.aW();
|
||||
this.i(-this.k());
|
||||
this.h(10);
|
||||
this.K();
|
||||
this.setDamage(this.getDamage() + i * 10);
|
||||
if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
|
||||
this.setDamage(100);
|
||||
}
|
||||
|
||||
if (this.getDamage() > 40) {
|
||||
if (this.passenger != null) {
|
||||
this.passenger.mount(this);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
|
||||
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
@ -199,7 +204,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean o_() {
|
||||
public boolean L() {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
@ -239,7 +244,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
super.die();
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
public void h_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
@ -248,8 +253,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
float prevPitch = this.pitch;
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.m() > 0) {
|
||||
this.d(this.m() - 1);
|
||||
if (this.j() > 0) {
|
||||
this.h(this.j() - 1);
|
||||
}
|
||||
|
||||
if (this.getDamage() > 0) {
|
||||
@ -257,10 +262,10 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
if (this.locY < -64.0D) {
|
||||
this.aI();
|
||||
this.C();
|
||||
}
|
||||
|
||||
if (this.k() && this.random.nextInt(4) == 0) {
|
||||
if (this.h() && this.random.nextInt(4) == 0) {
|
||||
this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@ -268,26 +273,17 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
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;
|
||||
|
||||
double d3;
|
||||
|
||||
for (d3 = this.l - (double) this.yaw; d3 < -180.0D; d3 += 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d3 >= 180.0D) {
|
||||
d3 -= 360.0D;
|
||||
}
|
||||
double d2 = this.locZ + (this.an - this.locZ) / (double) this.h;
|
||||
double d3 = MathHelper.g(this.ao - (double) this.yaw);
|
||||
|
||||
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.pitch = (float) ((double) this.pitch + (this.ap - (double) this.pitch) / (double) this.h);
|
||||
--this.h;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.c(this.yaw, this.pitch);
|
||||
this.b(this.yaw, this.pitch);
|
||||
} else {
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.c(this.yaw, this.pitch);
|
||||
this.b(this.yaw, this.pitch);
|
||||
}
|
||||
} else {
|
||||
this.lastX = this.locX;
|
||||
@ -298,7 +294,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
int j = MathHelper.floor(this.locY);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (BlockMinecartTrack.g(this.world, i, j - 1, k)) {
|
||||
if (BlockMinecartTrack.d_(this.world, i, j - 1, k)) {
|
||||
--j;
|
||||
}
|
||||
|
||||
@ -308,7 +304,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
int l = this.world.getTypeId(i, j, k);
|
||||
|
||||
if (BlockMinecartTrack.d(l)) {
|
||||
Vec3D vec3d = this.h(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
|
||||
int i1 = this.world.getData(i, j, k);
|
||||
|
||||
this.locY = (double) j;
|
||||
@ -320,7 +316,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
flag1 = !flag;
|
||||
}
|
||||
|
||||
if (((BlockMinecartTrack) Block.byId[l]).i()) {
|
||||
if (((BlockMinecartTrack) Block.byId[l]).n()) {
|
||||
i1 &= 7;
|
||||
}
|
||||
|
||||
@ -360,10 +356,21 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.motX = d10 * d6 / d8;
|
||||
this.motZ = d10 * d7 / d8;
|
||||
double d11;
|
||||
double d12;
|
||||
|
||||
if (this.passenger != null) {
|
||||
d12 = this.passenger.motX * this.passenger.motX + this.passenger.motZ * this.passenger.motZ;
|
||||
d11 = this.motX * this.motX + this.motZ * this.motZ;
|
||||
if (d12 > 1.0E-4D && d11 < 0.01D) {
|
||||
this.motX += this.passenger.motX * 0.1D;
|
||||
this.motZ += this.passenger.motZ * 0.1D;
|
||||
flag1 = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
d11 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d11 < 0.03D) {
|
||||
d12 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d12 < 0.03D) {
|
||||
this.motX *= 0.0D;
|
||||
this.motY *= 0.0D;
|
||||
this.motZ *= 0.0D;
|
||||
@ -374,39 +381,37 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
d11 = 0.0D;
|
||||
double d12 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
|
||||
d12 = 0.0D;
|
||||
d11 = (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;
|
||||
|
||||
d6 = d14 - d12;
|
||||
d6 = d14 - d11;
|
||||
d7 = d15 - d13;
|
||||
double d16;
|
||||
double d17;
|
||||
double d18;
|
||||
|
||||
if (d6 == 0.0D) {
|
||||
this.locX = (double) i + 0.5D;
|
||||
d11 = this.locZ - (double) k;
|
||||
d12 = this.locZ - (double) k;
|
||||
} else if (d7 == 0.0D) {
|
||||
this.locZ = (double) k + 0.5D;
|
||||
d11 = this.locX - (double) i;
|
||||
d12 = this.locX - (double) i;
|
||||
} else {
|
||||
d16 = this.locX - d12;
|
||||
d18 = this.locZ - d13;
|
||||
d17 = (d16 * d6 + d18 * d7) * 2.0D;
|
||||
d11 = d17;
|
||||
d16 = this.locX - d11;
|
||||
d17 = this.locZ - d13;
|
||||
d12 = (d16 * d6 + d17 * d7) * 2.0D;
|
||||
}
|
||||
|
||||
this.locX = d12 + d6 * d11;
|
||||
this.locZ = d13 + d7 * d11;
|
||||
this.locX = d11 + d6 * d12;
|
||||
this.locZ = d13 + d7 * d12;
|
||||
this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
|
||||
d16 = this.motX;
|
||||
d18 = this.motZ;
|
||||
d17 = this.motZ;
|
||||
if (this.passenger != null) {
|
||||
d16 *= 0.75D;
|
||||
d18 *= 0.75D;
|
||||
d17 *= 0.75D;
|
||||
}
|
||||
|
||||
if (d16 < -d4) {
|
||||
@ -417,15 +422,15 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d16 = d4;
|
||||
}
|
||||
|
||||
if (d18 < -d4) {
|
||||
d18 = -d4;
|
||||
if (d17 < -d4) {
|
||||
d17 = -d4;
|
||||
}
|
||||
|
||||
if (d18 > d4) {
|
||||
d18 = d4;
|
||||
if (d17 > d4) {
|
||||
d17 = d4;
|
||||
}
|
||||
|
||||
this.move(d16, 0.0D, d18);
|
||||
this.move(d16, 0.0D, d17);
|
||||
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]) {
|
||||
@ -439,10 +444,12 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.motZ *= 0.996999979019165D;
|
||||
} else {
|
||||
if (this.type == 2) {
|
||||
d17 = (double) MathHelper.sqrt(this.b * this.b + this.c * this.c);
|
||||
if (d17 > 0.01D) {
|
||||
this.b /= d17;
|
||||
this.c /= d17;
|
||||
double d18 = this.b * this.b + this.c * this.c;
|
||||
|
||||
if (d18 > 1.0E-4D) {
|
||||
d18 = (double) MathHelper.sqrt(d18);
|
||||
this.b /= d18;
|
||||
this.c /= d18;
|
||||
double d19 = 0.04D;
|
||||
|
||||
this.motX *= 0.800000011920929D;
|
||||
@ -462,7 +469,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.motZ *= 0.9599999785423279D;
|
||||
}
|
||||
|
||||
Vec3D vec3d1 = this.h(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = this.a(this.locX, this.locY, this.locZ);
|
||||
|
||||
if (vec3d1 != null && vec3d != null) {
|
||||
double d20 = (vec3d.b - vec3d1.b) * 0.05D;
|
||||
@ -488,8 +495,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
double d21;
|
||||
|
||||
if (this.type == 2) {
|
||||
d21 = (double) MathHelper.sqrt(this.b * this.b + this.c * this.c);
|
||||
if (d21 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
|
||||
d21 = this.b * this.b + this.c * this.c;
|
||||
if (d21 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) {
|
||||
d21 = (double) MathHelper.sqrt(d21);
|
||||
this.b /= d21;
|
||||
this.c /= d21;
|
||||
if (this.b * this.motX + this.c * this.motZ < 0.0D) {
|
||||
@ -510,19 +518,21 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.motX += this.motX / d21 * d22;
|
||||
this.motZ += this.motZ / d21 * d22;
|
||||
} else if (i1 == 1) {
|
||||
if (this.world.e(i - 1, j, k)) {
|
||||
if (this.world.s(i - 1, j, k)) {
|
||||
this.motX = 0.02D;
|
||||
} else if (this.world.e(i + 1, j, k)) {
|
||||
} else if (this.world.s(i + 1, j, k)) {
|
||||
this.motX = -0.02D;
|
||||
}
|
||||
} else if (i1 == 0) {
|
||||
if (this.world.e(i, j, k - 1)) {
|
||||
if (this.world.s(i, j, k - 1)) {
|
||||
this.motZ = 0.02D;
|
||||
} else if (this.world.e(i, j, k + 1)) {
|
||||
} else if (this.world.s(i, j, k + 1)) {
|
||||
this.motZ = -0.02D;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.D();
|
||||
} else {
|
||||
if (this.motX < -d4) {
|
||||
this.motX = -d4;
|
||||
@ -562,29 +572,21 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
double d23 = this.lastX - this.locX;
|
||||
double d24 = this.lastZ - this.locZ;
|
||||
|
||||
if (d23 * d23 + d24 * d24 > 0.0010D) {
|
||||
if (d23 * d23 + d24 * d24 > 0.001D) {
|
||||
this.yaw = (float) (Math.atan2(d24, d23) * 180.0D / 3.141592653589793D);
|
||||
if (this.f) {
|
||||
this.yaw += 180.0F;
|
||||
}
|
||||
}
|
||||
|
||||
double d25;
|
||||
|
||||
for (d25 = (double) (this.yaw - this.lastYaw); d25 >= 180.0D; d25 -= 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (d25 < -180.0D) {
|
||||
d25 += 360.0D;
|
||||
}
|
||||
double d25 = (double) MathHelper.g(this.yaw - this.lastYaw);
|
||||
|
||||
if (d25 < -170.0D || d25 >= 170.0D) {
|
||||
this.yaw += 180.0F;
|
||||
this.f = !this.f;
|
||||
}
|
||||
|
||||
this.c(this.yaw, this.pitch);
|
||||
this.b(this.yaw, this.pitch);
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
@ -601,11 +603,11 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (int l1 = 0; l1 < list.size(); ++l1) {
|
||||
Entity entity = (Entity) list.get(l1);
|
||||
|
||||
if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) {
|
||||
if (entity != this.passenger && entity.M() && entity instanceof EntityMinecart) {
|
||||
entity.collide(this);
|
||||
}
|
||||
}
|
||||
@ -627,16 +629,16 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.b = this.c = 0.0D;
|
||||
}
|
||||
|
||||
this.a(this.e > 0);
|
||||
this.d(this.e > 0);
|
||||
}
|
||||
}
|
||||
|
||||
public Vec3D h(double d0, double d1, double d2) {
|
||||
public Vec3D a(double d0, double d1, double d2) {
|
||||
int i = MathHelper.floor(d0);
|
||||
int j = MathHelper.floor(d1);
|
||||
int k = MathHelper.floor(d2);
|
||||
|
||||
if (BlockMinecartTrack.g(this.world, i, j - 1, k)) {
|
||||
if (BlockMinecartTrack.d_(this.world, i, j - 1, k)) {
|
||||
--j;
|
||||
}
|
||||
|
||||
@ -646,7 +648,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
int i1 = this.world.getData(i, j, k);
|
||||
|
||||
d1 = (double) j;
|
||||
if (((BlockMinecartTrack) Block.byId[l]).i()) {
|
||||
if (((BlockMinecartTrack) Block.byId[l]).n()) {
|
||||
i1 &= 7;
|
||||
}
|
||||
|
||||
@ -675,9 +677,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
} else {
|
||||
double d13 = d0 - d4;
|
||||
double d14 = d2 - d6;
|
||||
double d15 = (d13 * d10 + d14 * d12) * 2.0D;
|
||||
|
||||
d3 = d15;
|
||||
d3 = (d13 * d10 + d14 * d12) * 2.0D;
|
||||
}
|
||||
|
||||
d0 = d4 + d10 * d3;
|
||||
@ -691,7 +692,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d1 += 0.5D;
|
||||
}
|
||||
|
||||
return Vec3D.create(d0, d1, d2);
|
||||
return Vec3D.a().create(d0, d1, d2);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -765,7 +766,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
double d1 = entity.locZ - this.locZ;
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
|
||||
// CraftBukkit - Collision
|
||||
// CraftBukkit - collision
|
||||
if (d2 >= 9.999999747378752E-5D && !collisionEvent.isCollisionCancelled()) {
|
||||
d2 = (double) MathHelper.sqrt(d2);
|
||||
d0 /= d2;
|
||||
@ -780,16 +781,16 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d1 *= d3;
|
||||
d0 *= 0.10000000149011612D;
|
||||
d1 *= 0.10000000149011612D;
|
||||
d0 *= (double) (1.0F - this.bR);
|
||||
d1 *= (double) (1.0F - this.bR);
|
||||
d0 *= (double) (1.0F - this.Y);
|
||||
d1 *= (double) (1.0F - this.Y);
|
||||
d0 *= 0.5D;
|
||||
d1 *= 0.5D;
|
||||
if (entity instanceof EntityMinecart) {
|
||||
double d4 = entity.locX - this.locX;
|
||||
double d5 = entity.locZ - this.locZ;
|
||||
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));
|
||||
Vec3D vec3d = Vec3D.a().create(d4, 0.0D, d5).b();
|
||||
Vec3D vec3d1 = Vec3D.a().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.b(vec3d1));
|
||||
|
||||
if (d6 < 0.800000011920929D) {
|
||||
return;
|
||||
@ -801,13 +802,13 @@ 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);
|
||||
this.g(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);
|
||||
entity.g(this.motX + d0, 0.0D, this.motZ + d1);
|
||||
this.motX *= 0.949999988079071D;
|
||||
this.motZ *= 0.949999988079071D;
|
||||
} else {
|
||||
@ -815,14 +816,14 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d8 /= 2.0D;
|
||||
this.motX *= 0.20000000298023224D;
|
||||
this.motZ *= 0.20000000298023224D;
|
||||
this.b_(d7 - d0, 0.0D, d8 - d1);
|
||||
this.g(d7 - d0, 0.0D, d8 - d1);
|
||||
entity.motX *= 0.20000000298023224D;
|
||||
entity.motZ *= 0.20000000298023224D;
|
||||
entity.b_(d7 + d0, 0.0D, d8 + d1);
|
||||
entity.g(d7 + d0, 0.0D, d8 + d1);
|
||||
}
|
||||
} else {
|
||||
this.b_(-d0, 0.0D, -d1);
|
||||
entity.b_(d0 / 4.0D, 0.0D, d1 / 4.0D);
|
||||
this.g(-d0, 0.0D, -d1);
|
||||
entity.g(d0 / 4.0D, 0.0D, d1 / 4.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -886,7 +887,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
public void update() {}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (this.type == 0) {
|
||||
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
|
||||
return true;
|
||||
@ -918,14 +919,14 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
return this.dead ? false : entityhuman.j(this) <= 64.0D;
|
||||
return this.dead ? false : entityhuman.e(this) <= 64.0D;
|
||||
}
|
||||
|
||||
protected boolean k() {
|
||||
protected boolean h() {
|
||||
return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
protected void a(boolean flag) {
|
||||
protected void d(boolean flag) {
|
||||
if (flag) {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) | 1)));
|
||||
} else {
|
||||
@ -933,9 +934,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public void f() {}
|
||||
public void startOpen() {}
|
||||
|
||||
public void g() {}
|
||||
public void f() {}
|
||||
|
||||
public void setDamage(int i) {
|
||||
this.datawatcher.watch(19, Integer.valueOf(i));
|
||||
@ -945,19 +946,19 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
return this.datawatcher.getInt(19);
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
public void h(int i) {
|
||||
this.datawatcher.watch(17, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public int m() {
|
||||
public int j() {
|
||||
return this.datawatcher.getInt(17);
|
||||
}
|
||||
|
||||
public void e(int i) {
|
||||
public void i(int i) {
|
||||
this.datawatcher.watch(18, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public int n() {
|
||||
public int k() {
|
||||
return this.datawatcher.getInt(18);
|
||||
}
|
||||
|
||||
|
@ -8,21 +8,21 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
|
||||
public EntityMonster(World world) {
|
||||
super(world);
|
||||
this.aA = 5;
|
||||
this.aV = 5;
|
||||
}
|
||||
|
||||
public void e() {
|
||||
float f = this.b(1.0F);
|
||||
public void d() {
|
||||
float f = this.c(1.0F);
|
||||
|
||||
if (f > 0.5F) {
|
||||
this.aV += 2;
|
||||
this.bq += 2;
|
||||
}
|
||||
|
||||
super.e();
|
||||
super.d();
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
super.F_();
|
||||
public void h_() {
|
||||
super.h_();
|
||||
if (!this.world.isStatic && this.world.difficulty == 0) {
|
||||
this.die();
|
||||
}
|
||||
@ -31,7 +31,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
protected Entity findTarget() {
|
||||
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
|
||||
|
||||
return entityhuman != null && this.h(entityhuman) ? entityhuman : null;
|
||||
return entityhuman != null && this.l(entityhuman) ? entityhuman : null;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
@ -40,7 +40,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
|
||||
if (this.passenger != entity && this.vehicle != entity) {
|
||||
if (entity != this) {
|
||||
// CraftBukkit start - We still need to call events for entities without goals
|
||||
// CraftBukkit start - we still need to call events for entities without goals
|
||||
if (entity != this.target && (this instanceof EntityBlaze || this instanceof EntityEnderman || this instanceof EntitySpider || this instanceof EntityGiantZombie || this instanceof EntitySilverfish)) {
|
||||
EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this, entity, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
|
||||
@ -66,7 +66,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(Entity entity) {
|
||||
public boolean k(Entity entity) {
|
||||
int i = this.damage;
|
||||
|
||||
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
|
||||
@ -83,38 +83,30 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
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.a(entity);
|
||||
this.k(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public float a(int i, int j, int k) {
|
||||
return 0.5F - this.world.p(i, j, k);
|
||||
return 0.5F - this.world.o(i, j, k);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected boolean C() {
|
||||
protected boolean o() {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.boundingBox.b);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (this.world.a(EnumSkyBlock.SKY, i, j, k) > this.random.nextInt(32)) {
|
||||
if (this.world.b(EnumSkyBlock.SKY, i, j, k) > this.random.nextInt(32)) {
|
||||
return false;
|
||||
} else {
|
||||
int l = this.world.getLightLevel(i, j, k);
|
||||
|
||||
if (this.world.w()) {
|
||||
int i1 = this.world.f;
|
||||
if (this.world.I()) {
|
||||
int i1 = this.world.k;
|
||||
|
||||
this.world.f = 10;
|
||||
this.world.k = 10;
|
||||
l = this.world.getLightLevel(i, j, k);
|
||||
this.world.f = i1;
|
||||
this.world.k = i1;
|
||||
}
|
||||
|
||||
return l <= this.random.nextInt(8);
|
||||
@ -122,6 +114,6 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
return this.C() && super.canSpawn();
|
||||
return this.o() && super.canSpawn();
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ public class EntityMushroomCow extends EntityCow {
|
||||
public EntityMushroomCow(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/redcow.png";
|
||||
this.b(0.9F, 1.3F);
|
||||
this.a(0.9F, 1.3F);
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
|
||||
@ -42,7 +42,7 @@ public class EntityMushroomCow extends EntityCow {
|
||||
|
||||
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
entitycow.setHealth(this.getHealth());
|
||||
entitycow.V = this.V;
|
||||
entitycow.aq = this.aq;
|
||||
this.world.addEntity(entitycow);
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
@ -52,7 +52,7 @@ public class EntityMushroomCow extends EntityCow {
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return super.b(entityhuman);
|
||||
return super.c(entityhuman);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,16 +2,16 @@ package net.minecraft.server;
|
||||
|
||||
public class EntityOcelot extends EntityTameableAnimal {
|
||||
|
||||
private PathfinderGoalTempt b;
|
||||
private PathfinderGoalTempt e;
|
||||
|
||||
public EntityOcelot(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/ozelot.png";
|
||||
this.b(0.6F, 0.8F);
|
||||
this.al().a(true);
|
||||
this.a(0.6F, 0.8F);
|
||||
this.getNavigation().a(true);
|
||||
this.goalSelector.a(1, new PathfinderGoalFloat(this));
|
||||
this.goalSelector.a(2, this.a);
|
||||
this.goalSelector.a(3, this.b = new PathfinderGoalTempt(this, 0.18F, Item.RAW_FISH.id, true));
|
||||
this.goalSelector.a(2, this.d);
|
||||
this.goalSelector.a(3, this.e = new PathfinderGoalTempt(this, 0.18F, Item.RAW_FISH.id, true));
|
||||
this.goalSelector.a(4, new PathfinderGoalAvoidPlayer(this, EntityHuman.class, 16.0F, 0.23F, 0.4F));
|
||||
this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, 0.3F, 10.0F, 5.0F));
|
||||
this.goalSelector.a(6, new PathfinderGoalJumpOnBlock(this, 0.4F));
|
||||
@ -23,36 +23,36 @@ public class EntityOcelot extends EntityTameableAnimal {
|
||||
this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed(this, EntityChicken.class, 14.0F, 750, false));
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(18, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public void g() {
|
||||
if (!this.getControllerMove().a()) {
|
||||
this.setSneak(false);
|
||||
this.setSprinting(false);
|
||||
} else {
|
||||
public void bd() {
|
||||
if (this.getControllerMove().a()) {
|
||||
float f = this.getControllerMove().b();
|
||||
|
||||
if (f == 0.18F) {
|
||||
this.setSneak(true);
|
||||
this.setSneaking(true);
|
||||
this.setSprinting(false);
|
||||
} else if (f == 0.4F) {
|
||||
this.setSneak(false);
|
||||
this.setSneaking(false);
|
||||
this.setSprinting(true);
|
||||
} else {
|
||||
this.setSneak(false);
|
||||
this.setSneaking(false);
|
||||
this.setSprinting(false);
|
||||
}
|
||||
} else {
|
||||
this.setSneaking(false);
|
||||
this.setSprinting(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean n() {
|
||||
protected boolean ba() {
|
||||
return !this.isTamed();
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -72,19 +72,19 @@ public class EntityOcelot extends EntityTameableAnimal {
|
||||
this.setCatType(nbttagcompound.getInt("CatType"));
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
return this.isTamed() ? (this.r_() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
|
||||
protected String aQ() {
|
||||
return this.isTamed() ? (this.s() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.cat.hitt";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.cat.hitt";
|
||||
}
|
||||
|
||||
protected float p() {
|
||||
protected float aP() {
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
@ -92,12 +92,12 @@ public class EntityOcelot extends EntityTameableAnimal {
|
||||
return Item.LEATHER.id;
|
||||
}
|
||||
|
||||
public boolean a(Entity entity) {
|
||||
public boolean k(Entity entity) {
|
||||
return entity.damageEntity(DamageSource.mobAttack(this), 3);
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
this.a.a(false);
|
||||
this.d.a(false);
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
|
||||
@ -105,40 +105,41 @@ public class EntityOcelot extends EntityTameableAnimal {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit - Call EntityDeathEvent
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (!this.isTamed()) {
|
||||
if (this.b.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.j(this) < 9.0D) {
|
||||
if (!entityhuman.abilities.canInstantlyBuild) --itemstack.count; // CraftBukkit - if the player can instantly build, don't decrement the item stack
|
||||
if (itemstack.count <= 0) {
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
||||
}
|
||||
if (this.isTamed()) {
|
||||
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.b(itemstack)) {
|
||||
this.d.a(!this.isSitting());
|
||||
}
|
||||
} else if (this.e.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.e(this) < 9.0D) {
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
--itemstack.count;
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit - added event call and isCancelled check.
|
||||
if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.setTamed(true);
|
||||
this.setCatType(1 + this.world.random.nextInt(3));
|
||||
this.setOwnerName(entityhuman.name);
|
||||
this.a(true);
|
||||
this.a.a(true);
|
||||
this.world.broadcastEntityEffect(this, (byte) 7);
|
||||
} else {
|
||||
this.a(false);
|
||||
this.world.broadcastEntityEffect(this, (byte) 6);
|
||||
}
|
||||
if (itemstack.count <= 0) {
|
||||
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit - added event call and isCancelled check
|
||||
if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.setTamed(true);
|
||||
this.setCatType(1 + this.world.random.nextInt(3));
|
||||
this.setOwnerName(entityhuman.name);
|
||||
this.e(true);
|
||||
this.d.a(true);
|
||||
this.world.broadcastEntityEffect(this, (byte) 7);
|
||||
} else {
|
||||
this.e(false);
|
||||
this.world.broadcastEntityEffect(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.a(itemstack)) {
|
||||
this.a.a(!this.isSitting());
|
||||
}
|
||||
|
||||
return super.b(entityhuman);
|
||||
}
|
||||
|
||||
return super.c(entityhuman);
|
||||
}
|
||||
|
||||
public EntityAnimal createChild(EntityAnimal entityanimal) {
|
||||
@ -153,7 +154,7 @@ public class EntityOcelot extends EntityTameableAnimal {
|
||||
return entityocelot;
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
public boolean b(ItemStack itemstack) {
|
||||
return itemstack != null && itemstack.id == Item.RAW_FISH.id;
|
||||
}
|
||||
|
||||
@ -167,7 +168,7 @@ public class EntityOcelot extends EntityTameableAnimal {
|
||||
} else {
|
||||
EntityOcelot entityocelot = (EntityOcelot) entityanimal;
|
||||
|
||||
return !entityocelot.isTamed() ? false : this.r_() && entityocelot.r_();
|
||||
return !entityocelot.isTamed() ? false : this.s() && entityocelot.s();
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ public class EntityOcelot extends EntityTameableAnimal {
|
||||
if (this.world.random.nextInt(3) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox)) {
|
||||
if (this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox)) {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.boundingBox.b);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
@ -23,7 +24,7 @@ public class EntityPainting extends Entity {
|
||||
this.f = 0;
|
||||
this.direction = 0;
|
||||
this.height = 0.0F;
|
||||
this.b(0.5F, 0.5F);
|
||||
this.a(0.5F, 0.5F);
|
||||
this.art = EnumArt.values()[this.random.nextInt(EnumArt.values().length)]; // CraftBukkit - generate a non-null painting
|
||||
}
|
||||
|
||||
@ -46,14 +47,14 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (arraylist.size() > 0) {
|
||||
if (!arraylist.isEmpty()) {
|
||||
this.art = (EnumArt) arraylist.get(this.random.nextInt(arraylist.size()));
|
||||
}
|
||||
|
||||
this.setDirection(l);
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {}
|
||||
|
||||
public void setDirection(int i) {
|
||||
this.direction = i;
|
||||
@ -93,39 +94,40 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
f3 -= this.c(this.art.B);
|
||||
f3 -= this.b(this.art.B);
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
f5 += this.c(this.art.B);
|
||||
f5 += this.b(this.art.B);
|
||||
}
|
||||
|
||||
if (i == 2) {
|
||||
f3 += this.c(this.art.B);
|
||||
f3 += this.b(this.art.B);
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
f5 -= this.c(this.art.B);
|
||||
f5 -= this.b(this.art.B);
|
||||
}
|
||||
|
||||
f4 += this.c(this.art.C);
|
||||
f4 += this.b(this.art.C);
|
||||
this.setPosition((double) f3, (double) f4, (double) f5);
|
||||
float f7 = -0.00625F;
|
||||
|
||||
this.boundingBox.c((double) (f3 - f - f7), (double) (f4 - f1 - f7), (double) (f5 - f2 - f7), (double) (f3 + f + f7), (double) (f4 + f1 + f7), (double) (f5 + f2 + f7));
|
||||
this.boundingBox.b((double) (f3 - f - f7), (double) (f4 - f1 - f7), (double) (f5 - f2 - f7), (double) (f3 + f + f7), (double) (f4 + f1 + f7), (double) (f5 + f2 + f7));
|
||||
}
|
||||
|
||||
private float c(int i) {
|
||||
private float b(int i) {
|
||||
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
public void h_() {
|
||||
if (this.f++ == 100 && !this.world.isStatic) {
|
||||
this.f = 0;
|
||||
if (!this.dead && !this.survives()) {
|
||||
// CraftBukkit start
|
||||
Material material = this.world.getMaterial((int) this.locX, (int) this.locY, (int) this.locZ);
|
||||
RemoveCause cause;
|
||||
|
||||
if (material.equals(Material.WATER)) {
|
||||
cause = RemoveCause.WATER;
|
||||
} else if (!material.equals(Material.AIR)) {
|
||||
@ -134,6 +136,7 @@ public class EntityPainting extends Entity {
|
||||
} else {
|
||||
cause = RemoveCause.PHYSICS;
|
||||
}
|
||||
|
||||
PaintingBreakEvent event = new PaintingBreakEvent((Painting) this.getBukkitEntity(), cause);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -149,7 +152,7 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
|
||||
public boolean survives() {
|
||||
if (this.world.getCubes(this, this.boundingBox).size() > 0) {
|
||||
if (!this.world.getCubes(this, this.boundingBox).isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
int i = this.art.B / 16;
|
||||
@ -176,16 +179,14 @@ public class EntityPainting extends Entity {
|
||||
|
||||
l = MathHelper.floor(this.locY - (double) ((float) this.art.C / 32.0F));
|
||||
|
||||
int j1;
|
||||
|
||||
for (int k1 = 0; k1 < i; ++k1) {
|
||||
for (j1 = 0; j1 < j; ++j1) {
|
||||
for (int j1 = 0; j1 < i; ++j1) {
|
||||
for (int k1 = 0; k1 < j; ++k1) {
|
||||
Material material;
|
||||
|
||||
if (this.direction != 0 && this.direction != 2) {
|
||||
material = this.world.getMaterial(this.x, l + j1, i1 + k1);
|
||||
material = this.world.getMaterial(this.x, l + k1, i1 + j1);
|
||||
} else {
|
||||
material = this.world.getMaterial(k + k1, l + j1, this.z);
|
||||
material = this.world.getMaterial(k + j1, l + k1, this.z);
|
||||
}
|
||||
|
||||
if (!material.isBuildable()) {
|
||||
@ -195,18 +196,23 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
|
||||
List list = this.world.getEntities(this, this.boundingBox);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
for (j1 = 0; j1 < list.size(); ++j1) {
|
||||
if (list.get(j1) instanceof EntityPainting) {
|
||||
return false;
|
||||
Entity entity;
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
entity = (Entity) iterator.next();
|
||||
} while (!(entity instanceof EntityPainting));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean o_() {
|
||||
public boolean L() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -222,6 +228,7 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
// TODO: Could put other stuff here?
|
||||
}
|
||||
|
||||
if (event != null) {
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -230,11 +237,23 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (dead) return true;
|
||||
if (this.dead) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.die();
|
||||
this.aW();
|
||||
this.K();
|
||||
EntityHuman entityhuman = null;
|
||||
|
||||
if (damagesource.getEntity() instanceof EntityHuman) {
|
||||
entityhuman = (EntityHuman) damagesource.getEntity();
|
||||
}
|
||||
|
||||
if (entityhuman != null && entityhuman.abilities.canInstantlyBuild) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
|
||||
@ -282,8 +301,8 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void b_(double d0, double d1, double d2) {
|
||||
if (false && !this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit start - not needed for paintings
|
||||
public void g(double d0, double d1, double d2) {
|
||||
if (false && !this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed for paintings
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ public class EntityPig extends EntityAnimal {
|
||||
public EntityPig(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/pig.png";
|
||||
this.b(0.9F, 0.9F);
|
||||
this.al().a(true);
|
||||
this.a(0.9F, 0.9F);
|
||||
this.getNavigation().a(true);
|
||||
float f = 0.25F;
|
||||
|
||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
@ -19,7 +19,7 @@ public class EntityPig extends EntityAnimal {
|
||||
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@ public class EntityPig extends EntityAnimal {
|
||||
return 10;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
@ -42,20 +42,20 @@ public class EntityPig extends EntityAnimal {
|
||||
this.setSaddle(nbttagcompound.getBoolean("Saddle"));
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.pig";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.pig";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.pigdeath";
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
if (super.b(entityhuman)) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (super.c(entityhuman)) {
|
||||
return true;
|
||||
} else if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
|
||||
entityhuman.mount(this);
|
||||
@ -69,6 +69,18 @@ public class EntityPig extends EntityAnimal {
|
||||
return this.isBurning() ? Item.GRILLED_PORK.id : Item.PORK.id;
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
int j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
if (this.isBurning()) {
|
||||
this.b(Item.GRILLED_PORK.id, 1);
|
||||
} else {
|
||||
this.b(Item.PORK.id, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasSaddle() {
|
||||
return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
}
|
||||
@ -81,12 +93,12 @@ public class EntityPig extends EntityAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(EntityWeatherLighting entityweatherlighting) {
|
||||
public void a(EntityLightning entitylightning) {
|
||||
if (!this.world.isStatic) {
|
||||
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
|
||||
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callPigZapEvent(this, entityweatherlighting, entitypigzombie).isCancelled()) {
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
@ -16,26 +17,26 @@ public class EntityPigZombie extends EntityZombie {
|
||||
public EntityPigZombie(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/pigzombie.png";
|
||||
this.bb = 0.5F;
|
||||
this.bw = 0.5F;
|
||||
this.damage = 5;
|
||||
this.fireProof = true;
|
||||
}
|
||||
|
||||
protected boolean c_() {
|
||||
protected boolean aV() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
this.bb = this.target != null ? 0.95F : 0.5F;
|
||||
public void h_() {
|
||||
this.bw = this.target != null ? 0.95F : 0.5F;
|
||||
if (this.soundDelay > 0 && --this.soundDelay == 0) {
|
||||
this.world.makeSound(this, "mob.zombiepig.zpigangry", this.p() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
|
||||
this.world.makeSound(this, "mob.zombiepig.zpigangry", this.aP() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
|
||||
}
|
||||
|
||||
super.F_();
|
||||
super.h_();
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
|
||||
return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
@ -52,33 +53,30 @@ public class EntityPigZombie extends EntityZombie {
|
||||
return this.angerLevel == 0 ? null : super.findTarget();
|
||||
}
|
||||
|
||||
public void e() {
|
||||
super.e();
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
if (entity instanceof EntityHuman) {
|
||||
List list = this.world.getEntities(this, this.boundingBox.grow(32.0D, 32.0D, 32.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1 instanceof EntityPigZombie) {
|
||||
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
|
||||
|
||||
entitypigzombie.e(entity);
|
||||
entitypigzombie.c(entity);
|
||||
}
|
||||
}
|
||||
|
||||
this.e(entity);
|
||||
this.c(entity);
|
||||
}
|
||||
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
|
||||
private void e(Entity entity) {
|
||||
private void c(Entity entity) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||
|
||||
@ -101,15 +99,15 @@ public class EntityPigZombie extends EntityZombie {
|
||||
this.soundDelay = this.random.nextInt(40);
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.zombiepig.zpig";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.zombiepig.zpighurt";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.zombiepig.zpigdeath";
|
||||
}
|
||||
|
||||
@ -133,7 +131,7 @@ public class EntityPigZombie extends EntityZombie {
|
||||
int k = this.random.nextInt(200) - i;
|
||||
|
||||
if (k < 5) {
|
||||
ItemStack itemstack = this.b(k <= 0 ? 1 : 0);
|
||||
ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
|
||||
if (itemstack != null) {
|
||||
loot.add(new CraftItemStack(itemstack));
|
||||
}
|
||||
@ -145,7 +143,7 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
|
||||
// CraftBukkit start - return rare dropped item instead of dropping it
|
||||
protected ItemStack b(int i) {
|
||||
protected ItemStack l(int i) {
|
||||
if (i > 0) {
|
||||
ItemStack itemstack = new ItemStack(Item.GOLD_SWORD);
|
||||
|
||||
|
@ -1,9 +1,12 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
@ -16,50 +19,28 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
private LocaleLanguage locale = new LocaleLanguage("en_US");
|
||||
public NetServerHandler netServerHandler;
|
||||
public MinecraftServer server;
|
||||
public ItemInWorldManager itemInWorldManager;
|
||||
public double d;
|
||||
public double e;
|
||||
public List chunkCoordIntPairQueue = new LinkedList();
|
||||
public Set playerChunkCoordIntPairs = new HashSet();
|
||||
private int cf = -99999999;
|
||||
private int cg = -99999999;
|
||||
private boolean ch = true;
|
||||
public int lastSentExp = -99999999; // CraftBukkit - priv to pub
|
||||
public int invulnerableTicks = 60; // CraftBukkit - private to public; temporary until we get an API out
|
||||
private ItemStack[] ck = new ItemStack[] { null, null, null, null, null};
|
||||
public final List chunkCoordIntPairQueue = new LinkedList();
|
||||
public final List g = new LinkedList();
|
||||
private int ch = -99999999;
|
||||
private int ci = -99999999;
|
||||
private boolean cj = true;
|
||||
public int lastSentExp = -99999999; // CraftBukkit - private -> public
|
||||
public int invulnerableTicks = 60; // CraftBukkit - private -> public
|
||||
private int cm = 0;
|
||||
private int cn = 0;
|
||||
private boolean co = true;
|
||||
private ItemStack[] cp = new ItemStack[] { null, null, null, null, null};
|
||||
private int containerCounter = 0;
|
||||
public boolean h;
|
||||
public int ping;
|
||||
public boolean viewingCredits = false;
|
||||
|
||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
|
||||
super(world);
|
||||
iteminworldmanager.player = this;
|
||||
this.itemInWorldManager = iteminworldmanager;
|
||||
ChunkCoordinates chunkcoordinates = world.getSpawn();
|
||||
int i = chunkcoordinates.x;
|
||||
int j = chunkcoordinates.z;
|
||||
int k = chunkcoordinates.y;
|
||||
|
||||
if (!world.worldProvider.e) {
|
||||
i += this.random.nextInt(20) - 10;
|
||||
k = world.g(i, j);
|
||||
j += this.random.nextInt(20) - 10;
|
||||
}
|
||||
|
||||
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
|
||||
this.server = minecraftserver;
|
||||
this.bP = 0.0F;
|
||||
this.name = s;
|
||||
this.height = 0.0F;
|
||||
|
||||
// CraftBukkit start
|
||||
this.displayName = this.name;
|
||||
this.listName = this.name;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public String displayName;
|
||||
public String listName;
|
||||
public org.bukkit.Location compassTarget;
|
||||
@ -69,23 +50,48 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public boolean keepLevel = false;
|
||||
// CraftBukkit end
|
||||
|
||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
|
||||
super(world);
|
||||
iteminworldmanager.player = this;
|
||||
this.itemInWorldManager = iteminworldmanager;
|
||||
this.cm = minecraftserver.getServerConfigurationManager().o();
|
||||
ChunkCoordinates chunkcoordinates = world.getSpawn();
|
||||
int i = chunkcoordinates.x;
|
||||
int j = chunkcoordinates.z;
|
||||
int k = chunkcoordinates.y;
|
||||
|
||||
if (!world.worldProvider.e && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
|
||||
i += this.random.nextInt(20) - 10;
|
||||
k = world.h(i, j);
|
||||
j += this.random.nextInt(20) - 10;
|
||||
}
|
||||
|
||||
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
|
||||
this.server = minecraftserver;
|
||||
this.W = 0.0F;
|
||||
this.name = s;
|
||||
this.height = 0.0F;
|
||||
this.displayName = this.name; // CraftBukkit
|
||||
this.listName = this.name; // CraftBukkit
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
if (nbttagcompound.hasKey("playerGameType")) {
|
||||
this.itemInWorldManager.setGameMode(nbttagcompound.getInt("playerGameType"));
|
||||
this.itemInWorldManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType")));
|
||||
}
|
||||
this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setInt("playerGameType", this.itemInWorldManager.getGameMode());
|
||||
nbttagcompound.setInt("playerGameType", this.itemInWorldManager.getGameMode().a());
|
||||
this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
|
||||
}
|
||||
|
||||
// CraftBukkit start - world fallback code, either respawn location or global spawn
|
||||
public void spawnIn(World world) {
|
||||
super.spawnIn(world);
|
||||
// CraftBukkit start - world fallback code, either respawn location or global spawn
|
||||
if (world == null) {
|
||||
this.dead = false;
|
||||
ChunkCoordinates position = null;
|
||||
@ -105,8 +111,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
this.dimension = ((WorldServer) this.world).dimension;
|
||||
this.itemInWorldManager.a((WorldServer) world);
|
||||
// CraftBukkit end
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void levelDown(int i) {
|
||||
super.levelDown(i);
|
||||
@ -118,10 +124,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
public ItemStack[] getEquipment() {
|
||||
return this.ck;
|
||||
return this.cp;
|
||||
}
|
||||
|
||||
protected void A() {
|
||||
protected void d_() {
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
@ -129,22 +135,150 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
return 1.62F;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
this.itemInWorldManager.c();
|
||||
public void h_() {
|
||||
this.itemInWorldManager.a();
|
||||
--this.invulnerableTicks;
|
||||
this.activeContainer.a();
|
||||
this.activeContainer.b();
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
ItemStack itemstack = this.c(i);
|
||||
int i;
|
||||
|
||||
if (itemstack != this.ck[i]) {
|
||||
this.server.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
|
||||
this.ck[i] = itemstack;
|
||||
for (i = 0; i < 5; ++i) {
|
||||
ItemStack itemstack = this.b(i);
|
||||
|
||||
if (itemstack != this.cp[i]) {
|
||||
this.q().getTracker().a(this, new Packet5EntityEquipment(this.id, i, itemstack));
|
||||
this.cp[i] = itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.chunkCoordIntPairQueue.isEmpty()) {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Iterator iterator = this.chunkCoordIntPairQueue.iterator();
|
||||
ArrayList arraylist1 = new ArrayList();
|
||||
|
||||
while (iterator.hasNext() && arraylist.size() < 5) {
|
||||
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
|
||||
|
||||
iterator.remove();
|
||||
if (chunkcoordintpair != null && this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
|
||||
arraylist.add(this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z));
|
||||
arraylist1.addAll(((WorldServer) this.world).getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 256, chunkcoordintpair.z * 16 + 16));
|
||||
}
|
||||
}
|
||||
|
||||
if (!arraylist.isEmpty()) {
|
||||
this.netServerHandler.sendPacket(new Packet56MapChunkBulk(arraylist));
|
||||
Iterator iterator1 = arraylist1.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
TileEntity tileentity = (TileEntity) iterator1.next();
|
||||
|
||||
this.a(tileentity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.g.isEmpty()) {
|
||||
i = Math.min(this.g.size(), 127);
|
||||
int[] aint = new int[i];
|
||||
Iterator iterator2 = this.g.iterator();
|
||||
int j = 0;
|
||||
|
||||
while (iterator2.hasNext() && j < i) {
|
||||
aint[j++] = ((Integer) iterator2.next()).intValue();
|
||||
iterator2.remove();
|
||||
}
|
||||
|
||||
this.netServerHandler.sendPacket(new Packet29DestroyEntity(aint));
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack c(int i) {
|
||||
public void g() {
|
||||
super.h_();
|
||||
|
||||
for (int i = 0; i < this.inventory.getSize(); ++i) {
|
||||
ItemStack itemstack = this.inventory.getItem(i);
|
||||
|
||||
if (itemstack != null && Item.byId[itemstack.id].m_() && this.netServerHandler.lowPriorityCount() <= 2) {
|
||||
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
|
||||
|
||||
if (packet != null) {
|
||||
this.netServerHandler.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bX) {
|
||||
// if (this.server.getAllowNether()) { // CraftBukkit
|
||||
if (this.activeContainer != this.defaultContainer) {
|
||||
this.closeInventory();
|
||||
}
|
||||
|
||||
if (this.vehicle != null) {
|
||||
this.mount(this.vehicle);
|
||||
} else {
|
||||
this.bY += 0.0125F;
|
||||
if (this.bY >= 1.0F) {
|
||||
this.bY = 1.0F;
|
||||
this.bW = 10;
|
||||
boolean flag = false;
|
||||
byte b0;
|
||||
|
||||
if (this.dimension == -1) {
|
||||
b0 = 0;
|
||||
} else {
|
||||
b0 = -1;
|
||||
}
|
||||
|
||||
this.server.getServerConfigurationManager().changeDimension(this, b0);
|
||||
this.lastSentExp = -1;
|
||||
this.ch = -1;
|
||||
this.ci = -1;
|
||||
this.a((Statistic) AchievementList.x);
|
||||
}
|
||||
}
|
||||
|
||||
this.bX = false;
|
||||
// } // CraftBukkit
|
||||
} else {
|
||||
if (this.bY > 0.0F) {
|
||||
this.bY -= 0.05F;
|
||||
}
|
||||
|
||||
if (this.bY < 0.0F) {
|
||||
this.bY = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bW > 0) {
|
||||
--this.bW;
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.ch || this.ci != this.foodData.a() || this.foodData.e() == 0.0F != this.cj) {
|
||||
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.e()));
|
||||
this.ch = this.getHealth();
|
||||
this.ci = this.foodData.a();
|
||||
this.cj = this.foodData.e() == 0.0F;
|
||||
}
|
||||
|
||||
if (this.expTotal != this.lastSentExp) {
|
||||
this.lastSentExp = this.expTotal;
|
||||
this.netServerHandler.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.oldLevel == -1) {
|
||||
this.oldLevel = this.expLevel;
|
||||
}
|
||||
|
||||
if (this.oldLevel != this.expLevel) {
|
||||
CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.expLevel);
|
||||
this.oldLevel = this.expLevel;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
|
||||
}
|
||||
|
||||
@ -169,7 +303,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
String deathMessage = event.getDeathMessage();
|
||||
|
||||
if (deathMessage != null && deathMessage.length() > 0) {
|
||||
this.server.serverConfigurationManager.sendAll(new Packet3Chat(event.getDeathMessage()));
|
||||
this.server.getServerConfigurationManager().sendAll(new Packet3Chat(event.getDeathMessage()));
|
||||
}
|
||||
|
||||
// CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
||||
@ -189,7 +323,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
if (this.invulnerableTicks > 0) {
|
||||
return false;
|
||||
} else {
|
||||
// CraftBukkit - this.b.pvpMode -> this.world.pvpMode
|
||||
// CraftBukkit - this.server.getPvP() -> this.world.pvpMode
|
||||
if (!this.world.pvpMode && damagesource instanceof EntityDamageSource) {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
@ -210,142 +344,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean C() {
|
||||
return this.server.pvpMode;
|
||||
protected boolean h() {
|
||||
return this.server.getPvP();
|
||||
}
|
||||
|
||||
public void heal(int i) {
|
||||
super.heal(i);
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
super.F_();
|
||||
|
||||
for (int i = 0; i < this.inventory.getSize(); ++i) {
|
||||
ItemStack itemstack = this.inventory.getItem(i);
|
||||
|
||||
if (itemstack != null && Item.byId[itemstack.id].t_() && this.netServerHandler.lowPriorityCount() <= 2) {
|
||||
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
|
||||
|
||||
if (packet != null) {
|
||||
this.netServerHandler.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag && !this.chunkCoordIntPairQueue.isEmpty()) {
|
||||
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(0);
|
||||
double d0 = chunkcoordintpair.a(this);
|
||||
|
||||
for (int j = 0; j < this.chunkCoordIntPairQueue.size(); ++j) {
|
||||
ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(j);
|
||||
double d1 = chunkcoordintpair1.a(this);
|
||||
|
||||
if (d1 < d0) {
|
||||
chunkcoordintpair = chunkcoordintpair1;
|
||||
d0 = d1;
|
||||
}
|
||||
}
|
||||
|
||||
if (chunkcoordintpair != null) {
|
||||
boolean flag1 = false;
|
||||
|
||||
// CraftBukkit - Add check against Chunk Packets in the ChunkCompressionThread.
|
||||
if (this.netServerHandler.lowPriorityCount() + org.bukkit.craftbukkit.ChunkCompressionThread.getPlayerQueueSize(this) < 4) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
WorldServer worldserver = this.server.getWorldServer(this.dimension);
|
||||
|
||||
if (worldserver.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
|
||||
Chunk chunk = worldserver.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
|
||||
|
||||
if (chunk.done) {
|
||||
this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
|
||||
this.netServerHandler.sendPacket(new Packet51MapChunk(worldserver.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z), true, 0));
|
||||
List list = worldserver.getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 256, chunkcoordintpair.z * 16 + 16);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k) {
|
||||
this.a((TileEntity) list.get(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.J) {
|
||||
//if (this.server.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
|
||||
if (this.activeContainer != this.defaultContainer) {
|
||||
this.closeInventory();
|
||||
}
|
||||
|
||||
if (this.vehicle != null) {
|
||||
this.mount(this.vehicle);
|
||||
} else {
|
||||
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.server.serverConfigurationManager.changeDimension(this, b0);
|
||||
this.lastSentExp = -1;
|
||||
this.cf = -1;
|
||||
this.cg = -1;
|
||||
this.a((Statistic) AchievementList.x);
|
||||
}
|
||||
}
|
||||
|
||||
this.J = false;
|
||||
//} // CraftBukkit
|
||||
} else {
|
||||
if (this.K > 0.0F) {
|
||||
this.K -= 0.05F;
|
||||
}
|
||||
|
||||
if (this.K < 0.0F) {
|
||||
this.K = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.I > 0) {
|
||||
--this.I;
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.cf || this.cg != this.foodData.a() || this.foodData.c() == 0.0F != this.ch) {
|
||||
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.c()));
|
||||
this.cf = this.getHealth();
|
||||
this.cg = this.foodData.a();
|
||||
this.ch = this.foodData.c() == 0.0F;
|
||||
}
|
||||
|
||||
if (this.expTotal != this.lastSentExp) {
|
||||
this.lastSentExp = this.expTotal;
|
||||
this.netServerHandler.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.oldLevel == -1) {
|
||||
this.oldLevel = this.expLevel;
|
||||
}
|
||||
|
||||
if (this.oldLevel != this.expLevel) {
|
||||
CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.expLevel);
|
||||
this.oldLevel = this.expLevel;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void e(int i) {
|
||||
public void c(int i) {
|
||||
if (this.dimension == 1 && i == 1) {
|
||||
this.a((Statistic) AchievementList.C);
|
||||
this.world.kill(this);
|
||||
@ -354,23 +357,23 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
} else {
|
||||
this.a((Statistic) AchievementList.B);
|
||||
/* CraftBukkit start - removed to fix our handling of The End portals
|
||||
ChunkCoordinates chunkcoordinates = this.b.getWorldServer(i).d();
|
||||
ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();
|
||||
|
||||
if (chunkcoordinates != null) {
|
||||
this.netServerHandler.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
this.server.serverConfigurationManager.changeDimension(this, 1);
|
||||
this.server.getServerConfigurationManager().changeDimension(this, 1);
|
||||
this.lastSentExp = -1;
|
||||
this.cf = -1;
|
||||
this.cg = -1;
|
||||
this.ch = -1;
|
||||
this.ci = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(TileEntity tileentity) {
|
||||
if (tileentity != null) {
|
||||
Packet packet = tileentity.d();
|
||||
Packet packet = tileentity.e();
|
||||
|
||||
if (packet != null) {
|
||||
this.netServerHandler.sendPacket(packet);
|
||||
@ -380,7 +383,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public void receive(Entity entity, int i) {
|
||||
if (!entity.dead) {
|
||||
EntityTracker entitytracker = this.server.getTracker(this.dimension);
|
||||
EntityTracker entitytracker = this.q().getTracker();
|
||||
|
||||
if (entity instanceof EntityItem) {
|
||||
entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
|
||||
@ -396,29 +399,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
super.receive(entity, i);
|
||||
this.activeContainer.a();
|
||||
this.activeContainer.b();
|
||||
}
|
||||
|
||||
public void C_() {
|
||||
if (!this.t) {
|
||||
this.u = -1;
|
||||
this.t = true;
|
||||
EntityTracker entitytracker = this.server.getTracker(this.dimension);
|
||||
|
||||
entitytracker.a(this, new Packet18ArmAnimation(this, 1));
|
||||
public void i() {
|
||||
if (!this.bH) {
|
||||
this.bI = -1;
|
||||
this.bH = true;
|
||||
this.q().getTracker().a(this, new Packet18ArmAnimation(this, 1));
|
||||
}
|
||||
}
|
||||
|
||||
public void E() {}
|
||||
|
||||
public EnumBedResult a(int i, int j, int k) {
|
||||
EnumBedResult enumbedresult = super.a(i, j, k);
|
||||
|
||||
if (enumbedresult == EnumBedResult.OK) {
|
||||
EntityTracker entitytracker = this.server.getTracker(this.dimension);
|
||||
Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
|
||||
|
||||
entitytracker.a(this, packet17entitylocationaction);
|
||||
this.q().getTracker().a(this, packet17entitylocationaction);
|
||||
this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
this.netServerHandler.sendPacket(packet17entitylocationaction);
|
||||
}
|
||||
@ -428,9 +426,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public void a(boolean flag, boolean flag1, boolean flag2) {
|
||||
if (this.isSleeping()) {
|
||||
EntityTracker entitytracker = this.server.getTracker(this.dimension);
|
||||
|
||||
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
|
||||
this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
|
||||
}
|
||||
|
||||
super.a(flag, flag1, flag2);
|
||||
@ -493,6 +489,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
public void openContainer(IInventory iinventory) {
|
||||
if (this.activeContainer != this.defaultContainer) {
|
||||
this.closeInventory();
|
||||
}
|
||||
|
||||
// CraftBukkit start - INVENTORY_OPEN hook
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
|
||||
if(container == null) return;
|
||||
@ -544,6 +544,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
public void openTrade(IMerchant imerchant) {
|
||||
// CraftBukkit start - INVENTORY_OPEN hook
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.nextContainerCounter();
|
||||
this.activeContainer = container; // CraftBukkit - User container passed to event
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory();
|
||||
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, inventorymerchant.getName(), inventorymerchant.getSize()));
|
||||
MerchantRecipeList merchantrecipelist = imerchant.getOffers(this);
|
||||
|
||||
if (merchantrecipelist != null) {
|
||||
try {
|
||||
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
|
||||
DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
|
||||
|
||||
dataoutputstream.writeInt(this.containerCounter);
|
||||
merchantrecipelist.a(dataoutputstream);
|
||||
this.netServerHandler.sendPacket(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray()));
|
||||
} catch (IOException ioexception) {
|
||||
ioexception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Container container, int i, ItemStack itemstack) {
|
||||
if (!(container.getSlot(i) instanceof SlotResult)) {
|
||||
if (!this.h) {
|
||||
@ -553,7 +582,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
public void updateInventory(Container container) {
|
||||
this.a(container, container.b());
|
||||
this.a(container, container.a());
|
||||
}
|
||||
|
||||
public void a(Container container, List list) {
|
||||
@ -570,11 +599,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j));
|
||||
}
|
||||
|
||||
public void carriedChanged(ItemStack itemstack) {}
|
||||
|
||||
public void closeInventory() {
|
||||
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
|
||||
this.H();
|
||||
this.l();
|
||||
}
|
||||
|
||||
public void broadcastCarriedItem() {
|
||||
@ -583,7 +610,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
public void H() {
|
||||
public void l() {
|
||||
this.activeContainer.a((EntityHuman) this);
|
||||
this.activeContainer = this.defaultContainer;
|
||||
}
|
||||
@ -601,7 +628,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
public void I() {
|
||||
public void m() {
|
||||
if (this.vehicle != null) {
|
||||
this.mount(this.vehicle);
|
||||
}
|
||||
@ -615,32 +642,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
public void D_() {
|
||||
this.cf = -99999999;
|
||||
public void n() {
|
||||
this.ch = -99999999;
|
||||
this.lastSentExp = -1; // CraftBukkit - Added to reset
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
public void c(String s) {
|
||||
LocaleLanguage localelanguage = LocaleLanguage.a();
|
||||
String s1 = localelanguage.b(s);
|
||||
|
||||
this.netServerHandler.sendPacket(new Packet3Chat(s1));
|
||||
}
|
||||
|
||||
protected void K() {
|
||||
protected void o() {
|
||||
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
|
||||
super.K();
|
||||
super.o();
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack, int i) {
|
||||
super.a(itemstack, i);
|
||||
if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().d(itemstack) == EnumAnimation.b) {
|
||||
EntityTracker entitytracker = this.server.getTracker(this.dimension);
|
||||
|
||||
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
|
||||
if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().b(itemstack) == EnumAnimation.b) {
|
||||
this.q().getTracker().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));
|
||||
@ -648,11 +678,6 @@ 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));
|
||||
}
|
||||
|
||||
@ -660,16 +685,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.netServerHandler.a(d0, d1, d2, this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
public void c(Entity entity) {
|
||||
EntityTracker entitytracker = this.server.getTracker(this.dimension);
|
||||
|
||||
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
|
||||
public void b(Entity entity) {
|
||||
this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
|
||||
}
|
||||
|
||||
public void d(Entity entity) {
|
||||
EntityTracker entitytracker = this.server.getTracker(this.dimension);
|
||||
|
||||
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
|
||||
public void c(Entity entity) {
|
||||
this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
|
||||
}
|
||||
|
||||
public void updateAbilities() {
|
||||
@ -678,6 +699,63 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
public WorldServer q() {
|
||||
return (WorldServer) this.world;
|
||||
}
|
||||
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
this.itemInWorldManager.setGameMode(enumgamemode);
|
||||
this.netServerHandler.sendPacket(new Packet70Bed(3, enumgamemode.a()));
|
||||
}
|
||||
|
||||
public void sendMessage(String s) {
|
||||
this.netServerHandler.sendPacket(new Packet3Chat(s));
|
||||
}
|
||||
|
||||
public boolean b(String s) {
|
||||
return "seed".equals(s) && !this.server.S() ? true : this.server.getServerConfigurationManager().isOp(this.name);
|
||||
}
|
||||
|
||||
public String r() {
|
||||
String s = this.netServerHandler.networkManager.getSocketAddress().toString();
|
||||
|
||||
s = s.substring(s.indexOf("/") + 1);
|
||||
s = s.substring(0, s.indexOf(":"));
|
||||
return s;
|
||||
}
|
||||
|
||||
public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
|
||||
if (this.locale.b().containsKey(packet204localeandviewdistance.d())) {
|
||||
this.locale.a(packet204localeandviewdistance.d());
|
||||
}
|
||||
|
||||
int i = 256 >> packet204localeandviewdistance.f();
|
||||
|
||||
if (i > 3 && i < 15) {
|
||||
this.cm = i;
|
||||
}
|
||||
|
||||
this.cn = packet204localeandviewdistance.g();
|
||||
this.co = packet204localeandviewdistance.h();
|
||||
if (this.server.H() && this.server.G().equals(this.name)) {
|
||||
this.server.c(packet204localeandviewdistance.i());
|
||||
}
|
||||
}
|
||||
|
||||
public LocaleLanguage getLocale() {
|
||||
return this.locale;
|
||||
}
|
||||
|
||||
public int getChatFlags() {
|
||||
return this.cn;
|
||||
}
|
||||
|
||||
public void a(String s, int i) {
|
||||
String s1 = s + "\0" + i; // CraftBukkit - fix decompile error
|
||||
|
||||
this.netServerHandler.sendPacket(new Packet250CustomPayload("MC|TPack", s1.getBytes()));
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public long timeOffset = 0;
|
||||
public boolean relativeTime = true;
|
||||
|
@ -28,15 +28,15 @@ public class EntityPotion extends EntityProjectile {
|
||||
this.d = i;
|
||||
}
|
||||
|
||||
protected float e() {
|
||||
protected float h() {
|
||||
return 0.05F;
|
||||
}
|
||||
|
||||
protected float c() {
|
||||
protected float d() {
|
||||
return 0.5F;
|
||||
}
|
||||
|
||||
protected float d() {
|
||||
protected float g() {
|
||||
return -20.0F;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public class EntityPotion extends EntityProjectile {
|
||||
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
if (!this.world.isStatic) {
|
||||
List list = Item.POTION.b(this.d);
|
||||
List list = Item.POTION.f(this.d);
|
||||
|
||||
if (list != null && !list.isEmpty()) {
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.grow(4.0D, 2.0D, 4.0D);
|
||||
@ -59,18 +59,18 @@ public class EntityPotion extends EntityProjectile {
|
||||
HashMap<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
double d0 = this.j(entity);
|
||||
EntityLiving entityliving = (EntityLiving) iterator.next();
|
||||
double d0 = this.e(entityliving);
|
||||
|
||||
if (d0 < 16.0D) {
|
||||
double d1 = 1.0D - Math.sqrt(d0) / 4.0D;
|
||||
|
||||
if (entity == movingobjectposition.entity) {
|
||||
if (entityliving == movingobjectposition.entity) {
|
||||
d1 = 1.0D;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
affected.put((LivingEntity) entity.getBukkitEntity(), d1);
|
||||
affected.put((LivingEntity) entityliving.getBukkitEntity(), d1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,7 +80,8 @@ public class EntityPotion extends EntityProjectile {
|
||||
if (!(victim instanceof CraftLivingEntity)) {
|
||||
continue;
|
||||
}
|
||||
EntityLiving entity = ((CraftLivingEntity) victim).getHandle();
|
||||
|
||||
EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle();
|
||||
double d1 = event.getIntensity(victim);
|
||||
// CraftBukkit end
|
||||
|
||||
@ -91,7 +92,7 @@ public class EntityPotion extends EntityProjectile {
|
||||
int i = mobeffect.getEffectId();
|
||||
|
||||
// CraftBukkit start - abide by PVP settings
|
||||
if (!this.world.pvpMode && entity instanceof EntityPlayer && entity != this.shooter) {
|
||||
if (!this.world.pvpMode && entityliving instanceof EntityPlayer && entityliving != this.shooter) {
|
||||
// Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions
|
||||
if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) continue;
|
||||
}
|
||||
@ -99,12 +100,12 @@ public class EntityPotion extends EntityProjectile {
|
||||
|
||||
if (MobEffectList.byId[i].isInstant()) {
|
||||
// CraftBukkit - added 'this'
|
||||
MobEffectList.byId[i].applyInstantEffect(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1, this);
|
||||
MobEffectList.byId[i].applyInstantEffect(this.shooter, entityliving, mobeffect.getAmplifier(), d1, this);
|
||||
} else {
|
||||
int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
|
||||
|
||||
if (j > 20) {
|
||||
((EntityLiving) entity).addEffect(new MobEffect(i, j, mobeffect.getAmplifier()));
|
||||
entityliving.addEffect(new MobEffect(i, j, mobeffect.getAmplifier()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,4 +118,14 @@ public class EntityPotion extends EntityProjectile {
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.d = nbttagcompound.getInt("potionValue");
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setInt("potionValue", this.d);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit
|
||||
|
||||
public abstract class EntityProjectile extends Entity {
|
||||
|
||||
@ -14,21 +13,21 @@ public abstract class EntityProjectile extends Entity {
|
||||
private int inBlockId = 0;
|
||||
protected boolean inGround = false;
|
||||
public int shake = 0;
|
||||
public EntityLiving shooter; // CraftBukkit - prot to public
|
||||
public EntityLiving shooter; // CraftBukkit - protected -> public
|
||||
private int h;
|
||||
private int i = 0;
|
||||
|
||||
public EntityProjectile(World world) {
|
||||
super(world);
|
||||
this.b(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
}
|
||||
|
||||
protected void b() {}
|
||||
protected void a() {}
|
||||
|
||||
public EntityProjectile(World world, EntityLiving entityliving) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
this.b(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
this.locY -= 0.10000000149011612D;
|
||||
@ -39,27 +38,27 @@ public abstract class EntityProjectile extends Entity {
|
||||
|
||||
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);
|
||||
this.motY = (double) (-MathHelper.sin((this.pitch + this.g()) / 180.0F * 3.1415927F) * f);
|
||||
this.c(this.motX, this.motY, this.motZ, this.d(), 1.0F);
|
||||
}
|
||||
|
||||
public EntityProjectile(World world, double d0, double d1, double d2) {
|
||||
super(world);
|
||||
this.h = 0;
|
||||
this.b(0.25F, 0.25F);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
protected float c() {
|
||||
protected float d() {
|
||||
return 1.5F;
|
||||
}
|
||||
|
||||
protected float d() {
|
||||
protected float g() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
public void c(double d0, double d1, double d2, float f, float f1) {
|
||||
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d0 /= (double) f2;
|
||||
@ -81,11 +80,11 @@ public abstract class EntityProjectile extends Entity {
|
||||
this.h = 0;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
this.bL = this.locX;
|
||||
this.bM = this.locY;
|
||||
this.bN = this.locZ;
|
||||
super.F_();
|
||||
public void h_() {
|
||||
this.S = this.locX;
|
||||
this.T = this.locY;
|
||||
this.U = this.locZ;
|
||||
super.h_();
|
||||
if (this.shake > 0) {
|
||||
--this.shake;
|
||||
}
|
||||
@ -112,25 +111,26 @@ public abstract class EntityProjectile extends Entity {
|
||||
++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);
|
||||
Vec3D vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = Vec3D.a().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);
|
||||
vec3d = Vec3D.a().create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.a().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
Entity entity = null;
|
||||
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
|
||||
double d0 = 0.0D;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
Entity entity1 = (Entity) list.get(j);
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1.o_() && (entity1 != this.shooter || this.i >= 5)) {
|
||||
if (entity1.L() && (entity1 != this.shooter || this.i >= 5)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -187,10 +187,10 @@ public abstract class EntityProjectile extends Entity {
|
||||
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
|
||||
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
|
||||
float f2 = 0.99F;
|
||||
float f3 = this.e();
|
||||
float f3 = this.h();
|
||||
|
||||
if (this.aU()) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
if (this.H()) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
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);
|
||||
@ -206,7 +206,7 @@ public abstract class EntityProjectile extends Entity {
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
protected float e() {
|
||||
protected float h() {
|
||||
return 0.03F;
|
||||
}
|
||||
|
||||
@ -229,6 +229,4 @@ public abstract class EntityProjectile extends Entity {
|
||||
this.shake = nbttagcompound.getByte("shake") & 255;
|
||||
this.inGround = nbttagcompound.getByte("inGround") == 1;
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {}
|
||||
}
|
||||
|
@ -9,51 +9,51 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
|
||||
public class EntitySheep extends EntityAnimal {
|
||||
|
||||
public static final float[][] a = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.95F, 0.7F, 0.2F}, { 0.9F, 0.5F, 0.85F}, { 0.6F, 0.7F, 0.95F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.7F, 0.8F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.6F, 0.7F}, { 0.7F, 0.4F, 0.9F}, { 0.2F, 0.4F, 0.8F}, { 0.5F, 0.4F, 0.3F}, { 0.4F, 0.5F, 0.2F}, { 0.8F, 0.3F, 0.3F}, { 0.1F, 0.1F, 0.1F}};
|
||||
private int b;
|
||||
private PathfinderGoalEatTile c = new PathfinderGoalEatTile(this);
|
||||
public static final float[][] d = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.95F, 0.7F, 0.2F}, { 0.9F, 0.5F, 0.85F}, { 0.6F, 0.7F, 0.95F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.7F, 0.8F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.6F, 0.7F}, { 0.7F, 0.4F, 0.9F}, { 0.2F, 0.4F, 0.8F}, { 0.5F, 0.4F, 0.3F}, { 0.4F, 0.5F, 0.2F}, { 0.8F, 0.3F, 0.3F}, { 0.1F, 0.1F, 0.1F}};
|
||||
private int e;
|
||||
private PathfinderGoalEatTile f = new PathfinderGoalEatTile(this);
|
||||
|
||||
public EntitySheep(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/sheep.png";
|
||||
this.b(0.9F, 1.3F);
|
||||
this.a(0.9F, 1.3F);
|
||||
float f = 0.23F;
|
||||
|
||||
this.al().a(true);
|
||||
this.getNavigation().a(true);
|
||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
|
||||
this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
|
||||
this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
|
||||
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.25F));
|
||||
this.goalSelector.a(5, this.c);
|
||||
this.goalSelector.a(5, this.f);
|
||||
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, f));
|
||||
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
||||
}
|
||||
|
||||
protected boolean c_() {
|
||||
protected boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void z_() {
|
||||
this.b = this.c.f();
|
||||
super.z_();
|
||||
protected void bc() {
|
||||
this.e = this.f.f();
|
||||
super.bc();
|
||||
}
|
||||
|
||||
public void e() {
|
||||
public void d() {
|
||||
if (this.world.isStatic) {
|
||||
this.b = Math.max(0, this.b - 1);
|
||||
this.e = Math.max(0, this.e - 1);
|
||||
}
|
||||
|
||||
super.e();
|
||||
super.d();
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ public class EntitySheep extends EntityAnimal {
|
||||
return Block.WOOL.id;
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.isBaby()) {
|
||||
@ -92,6 +92,7 @@ public class EntitySheep extends EntityAnimal {
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EntityItem entityitem = this.a(new ItemStack(Block.WOOL.id, 1, this.getColor()), 1.0F);
|
||||
|
||||
entityitem.motY += (double) (this.random.nextFloat() * 0.05F);
|
||||
entityitem.motX += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
|
||||
entityitem.motZ += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F);
|
||||
@ -101,7 +102,7 @@ public class EntitySheep extends EntityAnimal {
|
||||
itemstack.damage(1, entityhuman);
|
||||
}
|
||||
|
||||
return super.b(entityhuman);
|
||||
return super.c(entityhuman);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
@ -116,15 +117,15 @@ public class EntitySheep extends EntityAnimal {
|
||||
this.setColor(nbttagcompound.getByte("Color"));
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.sheep";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.sheep";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.sheep";
|
||||
}
|
||||
|
||||
@ -171,7 +172,7 @@ public class EntitySheep extends EntityAnimal {
|
||||
return entitysheep1;
|
||||
}
|
||||
|
||||
public void z() {
|
||||
public void aA() {
|
||||
// CraftBukkit start
|
||||
SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -4,13 +4,13 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
|
||||
public class EntitySilverfish extends EntityMonster {
|
||||
|
||||
private int a;
|
||||
private int d;
|
||||
|
||||
public EntitySilverfish(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/silverfish.png";
|
||||
this.b(0.3F, 0.7F);
|
||||
this.bb = 0.6F;
|
||||
this.a(0.3F, 0.7F);
|
||||
this.bw = 0.6F;
|
||||
this.damage = 1;
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ public class EntitySilverfish extends EntityMonster {
|
||||
return 8;
|
||||
}
|
||||
|
||||
protected boolean g_() {
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -28,21 +28,21 @@ public class EntitySilverfish extends EntityMonster {
|
||||
return this.world.findNearbyVulnerablePlayer(this, d0);
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.silverfish.say";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.silverfish.hit";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.silverfish.kill";
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
if (this.a <= 0 && damagesource instanceof EntityDamageSource) {
|
||||
this.a = 20;
|
||||
if (this.d <= 0 && (damagesource instanceof EntityDamageSource || damagesource == DamageSource.MAGIC)) {
|
||||
this.d = 20;
|
||||
}
|
||||
|
||||
return super.damageEntity(damagesource, i);
|
||||
@ -59,34 +59,26 @@ public class EntitySilverfish extends EntityMonster {
|
||||
this.world.makeSound(this, "mob.silverfish.step", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
}
|
||||
|
||||
protected int getLootId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
this.V = this.yaw;
|
||||
super.F_();
|
||||
public void h_() {
|
||||
this.aq = this.yaw;
|
||||
super.h_();
|
||||
}
|
||||
|
||||
protected void d_() {
|
||||
super.d_();
|
||||
protected void be() {
|
||||
super.be();
|
||||
if (!this.world.isStatic) {
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int l;
|
||||
|
||||
if (this.a > 0) {
|
||||
--this.a;
|
||||
if (this.a == 0) {
|
||||
if (this.d > 0) {
|
||||
--this.d;
|
||||
if (this.d == 0) {
|
||||
i = MathHelper.floor(this.locX);
|
||||
j = MathHelper.floor(this.locY);
|
||||
k = MathHelper.floor(this.locZ);
|
||||
@ -103,6 +95,7 @@ public class EntitySilverfish extends EntityMonster {
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.world.triggerEffect(2001, i + i1, j + l, k + j1, Block.MONSTER_EGGS.id + (this.world.getData(i + i1, j + l, k + j1) << 12));
|
||||
this.world.setTypeId(i + i1, j + l, k + j1, 0);
|
||||
Block.MONSTER_EGGS.postBreak(this.world, i + i1, j + l, k + j1, 0);
|
||||
@ -117,26 +110,27 @@ public class EntitySilverfish extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.target == null && !this.H()) {
|
||||
if (this.target == null && !this.l()) {
|
||||
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 + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
|
||||
if (BlockMonsterEggs.d(l)) {
|
||||
if (BlockMonsterEggs.e(l)) {
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.world.setTypeIdAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l));
|
||||
this.aC();
|
||||
|
||||
this.world.setTypeIdAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.f(l));
|
||||
this.aK();
|
||||
this.die();
|
||||
} else {
|
||||
this.G();
|
||||
this.j();
|
||||
}
|
||||
} else if (this.target != null && !this.H()) {
|
||||
} else if (this.target != null && !this.l()) {
|
||||
this.target = null;
|
||||
}
|
||||
}
|
||||
@ -146,7 +140,7 @@ public class EntitySilverfish extends EntityMonster {
|
||||
return this.world.getTypeId(i, j - 1, k) == Block.STONE.id ? 10.0F : super.a(i, j, k);
|
||||
}
|
||||
|
||||
protected boolean C() {
|
||||
protected boolean o() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -160,7 +154,7 @@ public class EntitySilverfish extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
public MonsterType getMonsterType() {
|
||||
return MonsterType.ARTHROPOD;
|
||||
public EnumMonsterType getMonsterType() {
|
||||
return EnumMonsterType.ARTHROPOD;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,24 @@ import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
|
||||
|
||||
public class EntitySkeleton extends EntityMonster {
|
||||
|
||||
private static final ItemStack a = new ItemStack(Item.BOW, 1);
|
||||
private static final ItemStack d = new ItemStack(Item.BOW, 1);
|
||||
|
||||
public EntitySkeleton(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/skeleton.png";
|
||||
this.bb = 0.25F;
|
||||
this.bw = 0.25F;
|
||||
this.goalSelector.a(1, new PathfinderGoalFloat(this));
|
||||
this.goalSelector.a(2, new PathfinderGoalRestrictSun(this));
|
||||
this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bb));
|
||||
this.goalSelector.a(4, new PathfinderGoalArrowAttack(this, this.bb, 1, 60));
|
||||
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bb));
|
||||
this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bw));
|
||||
this.goalSelector.a(4, new PathfinderGoalArrowAttack(this, this.bw, 1, 60));
|
||||
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bw));
|
||||
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
|
||||
this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
|
||||
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
|
||||
}
|
||||
|
||||
public boolean c_() {
|
||||
public boolean aV() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -29,27 +29,27 @@ public class EntitySkeleton extends EntityMonster {
|
||||
return 20;
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String aQ() {
|
||||
return "mob.skeleton";
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.skeletonhurt";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.skeletonhurt";
|
||||
}
|
||||
|
||||
public MonsterType getMonsterType() {
|
||||
return MonsterType.UNDEAD;
|
||||
public EnumMonsterType getMonsterType() {
|
||||
return EnumMonsterType.UNDEAD;
|
||||
}
|
||||
|
||||
public void e() {
|
||||
if (this.world.e() && !this.world.isStatic) {
|
||||
float f = this.b(1.0F);
|
||||
public void d() {
|
||||
if (this.world.r() && !this.world.isStatic) {
|
||||
float f = this.c(1.0F);
|
||||
|
||||
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
if (f > 0.5F && this.world.j(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
// CraftBukkit start
|
||||
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
@ -61,12 +61,12 @@ public class EntitySkeleton extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
super.e();
|
||||
super.d();
|
||||
}
|
||||
|
||||
public void die(DamageSource damagesource) {
|
||||
super.die(damagesource);
|
||||
if (damagesource.b() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
|
||||
if (damagesource.f() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
|
||||
double d0 = entityhuman.locX - this.locX;
|
||||
double d1 = entityhuman.locZ - this.locZ;
|
||||
@ -84,6 +84,7 @@ public class EntitySkeleton extends EntityMonster {
|
||||
protected void dropDeathLoot(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 j = this.random.nextInt(3 + i);
|
||||
|
||||
int count = this.random.nextInt(3 + i);
|
||||
if (count > 0) {
|
||||
@ -100,7 +101,7 @@ public class EntitySkeleton extends EntityMonster {
|
||||
int k = this.random.nextInt(200) - i;
|
||||
|
||||
if (k < 5) {
|
||||
ItemStack itemstack = this.b(k <= 0 ? 1 : 0);
|
||||
ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
|
||||
if (itemstack != null) {
|
||||
loot.add(new org.bukkit.craftbukkit.inventory.CraftItemStack(itemstack));
|
||||
}
|
||||
@ -112,7 +113,7 @@ public class EntitySkeleton extends EntityMonster {
|
||||
}
|
||||
|
||||
// CraftBukkit start - return rare dropped item instead of dropping it
|
||||
protected ItemStack b(int i) {
|
||||
protected ItemStack l(int i) {
|
||||
if (i > 0) {
|
||||
ItemStack itemstack = new ItemStack(Item.BOW);
|
||||
|
||||
|
@ -19,17 +19,17 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
this.setSize(i);
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
super.b();
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, new Byte((byte) 1));
|
||||
}
|
||||
|
||||
public void setSize(int i) {
|
||||
this.datawatcher.watch(16, new Byte((byte) i));
|
||||
this.b(0.6F * (float) i, 0.6F * (float) i);
|
||||
this.a(0.6F * (float) i, 0.6F * (float) i);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.aA = i;
|
||||
this.aV = i;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
@ -52,15 +52,15 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
this.setSize(nbttagcompound.getInt("Size") + 1);
|
||||
}
|
||||
|
||||
protected String A() {
|
||||
protected String i() {
|
||||
return "slime";
|
||||
}
|
||||
|
||||
protected String I() {
|
||||
protected String o() {
|
||||
return "mob.slime";
|
||||
}
|
||||
|
||||
public void F_() {
|
||||
public void h_() {
|
||||
if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
|
||||
this.dead = true;
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
this.c = this.b;
|
||||
boolean flag = this.onGround;
|
||||
|
||||
super.F_();
|
||||
super.h_();
|
||||
if (this.onGround && !flag) {
|
||||
int i = this.getSize();
|
||||
|
||||
@ -79,21 +79,23 @@ 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(this.A(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
|
||||
this.world.a(this.i(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (this.K()) {
|
||||
this.world.makeSound(this, this.I(), this.p(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
|
||||
if (this.p()) {
|
||||
this.world.makeSound(this, this.o(), this.aP(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
|
||||
}
|
||||
|
||||
this.a = -0.5F;
|
||||
} else if (!this.onGround && flag) {
|
||||
this.a = 1.0F;
|
||||
}
|
||||
|
||||
this.F();
|
||||
this.l();
|
||||
}
|
||||
|
||||
protected void d_() {
|
||||
this.aG();
|
||||
protected void be() {
|
||||
this.bb();
|
||||
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // CraftBukkit TODO: EntityTargetEvent
|
||||
|
||||
if (entityhuman != null) {
|
||||
@ -101,36 +103,35 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
}
|
||||
|
||||
if (this.onGround && this.jumpDelay-- <= 0) {
|
||||
this.jumpDelay = this.E();
|
||||
this.jumpDelay = this.k();
|
||||
if (entityhuman != null) {
|
||||
this.jumpDelay /= 3;
|
||||
}
|
||||
|
||||
this.aZ = true;
|
||||
if (this.M()) {
|
||||
this.world.makeSound(this, this.I(), this.p(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
|
||||
this.bu = true;
|
||||
if (this.r()) {
|
||||
this.world.makeSound(this, this.o(), this.aP(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
|
||||
}
|
||||
|
||||
this.a = 1.0F;
|
||||
this.aW = 1.0F - this.random.nextFloat() * 2.0F;
|
||||
this.aX = (float) (1 * this.getSize());
|
||||
this.br = 1.0F - this.random.nextFloat() * 2.0F;
|
||||
this.bs = (float) (1 * this.getSize());
|
||||
} else {
|
||||
this.aZ = false;
|
||||
this.bu = false;
|
||||
if (this.onGround) {
|
||||
this.aW = this.aX = 0.0F;
|
||||
this.br = this.bs = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void F() {
|
||||
protected void l() {
|
||||
this.a *= 0.6F;
|
||||
}
|
||||
|
||||
protected int E() {
|
||||
protected int k() {
|
||||
return this.random.nextInt(20) + 10;
|
||||
}
|
||||
|
||||
protected EntitySlime C() {
|
||||
protected EntitySlime j() {
|
||||
return new EntitySlime(this.world);
|
||||
}
|
||||
|
||||
@ -155,7 +156,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
for (int k = 0; k < j; ++k) {
|
||||
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
|
||||
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
|
||||
EntitySlime entityslime = this.C();
|
||||
EntitySlime entityslime = this.j();
|
||||
|
||||
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);
|
||||
@ -166,29 +167,29 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
super.die();
|
||||
}
|
||||
|
||||
public void a_(EntityHuman entityhuman) {
|
||||
if (this.G()) {
|
||||
public void b_(EntityHuman entityhuman) {
|
||||
if (this.m()) {
|
||||
int i = this.getSize();
|
||||
|
||||
if (this.h(entityhuman) && (double) this.i(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.H())) {
|
||||
if (this.l(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.n())) {
|
||||
this.world.makeSound(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean G() {
|
||||
protected boolean m() {
|
||||
return this.getSize() > 1;
|
||||
}
|
||||
|
||||
protected int H() {
|
||||
protected int n() {
|
||||
return this.getSize();
|
||||
}
|
||||
|
||||
protected String j() {
|
||||
protected String aR() {
|
||||
return "mob.slime";
|
||||
}
|
||||
|
||||
protected String k() {
|
||||
protected String aS() {
|
||||
return "mob.slime";
|
||||
}
|
||||
|
||||
@ -199,22 +200,22 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
public boolean canSpawn() {
|
||||
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 < 40.0D ? super.canSpawn() : false;
|
||||
return this.world.getWorldData().getType() == WorldType.FLAT && this.random.nextInt(4) != 1 ? false : ((this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.canSpawn() : false);
|
||||
}
|
||||
|
||||
protected float p() {
|
||||
protected float aP() {
|
||||
return 0.4F * (float) this.getSize();
|
||||
}
|
||||
|
||||
public int D() {
|
||||
public int bf() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected boolean M() {
|
||||
protected boolean r() {
|
||||
return this.getSize() > 1;
|
||||
}
|
||||
|
||||
protected boolean K() {
|
||||
protected boolean p() {
|
||||
return this.getSize() > 2;
|
||||
}
|
||||
}
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
In neuem Issue referenzieren
Einen Benutzer sperren