Update CraftBukkit to Minecraft 1.4(.2).
Dieser Commit ist enthalten in:
Ursprung
b9a72531b6
Commit
60819c6693
6
pom.xml
6
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.3.2-R3.0</version>
|
||||
<version>1.4.2-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.3.2-R3.0</version>
|
||||
<version>1.4.2-R0.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<version>1.4.2</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -7,10 +7,10 @@ public class AABBPool {
|
||||
|
||||
private final int a;
|
||||
private final int b;
|
||||
private final List c = new ArrayList();
|
||||
private final List pool = new ArrayList();
|
||||
private int d = 0;
|
||||
private int e = 0;
|
||||
private int f = 0;
|
||||
private int largestSize = 0;
|
||||
private int resizeTime = 0;
|
||||
|
||||
public AABBPool(int i, int j) {
|
||||
this.a = i;
|
||||
@ -18,15 +18,15 @@ public class AABBPool {
|
||||
}
|
||||
|
||||
public AxisAlignedBB a(double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||
if (this.f == 0) return new AxisAlignedBB(d0, d1, d2, d3, d4, d5); // CraftBukkit - don't pool objects indefinitely if thread doesn't adhere to contract
|
||||
|
||||
// CraftBukkit - don't pool objects indefinitely if thread doesn't adhere to contract
|
||||
if (this.resizeTime == 0) return new AxisAlignedBB(d0, d1, d2, d3, d4, d5);
|
||||
AxisAlignedBB axisalignedbb;
|
||||
|
||||
if (this.d >= this.c.size()) {
|
||||
if (this.d >= this.pool.size()) {
|
||||
axisalignedbb = new AxisAlignedBB(d0, d1, d2, d3, d4, d5);
|
||||
this.c.add(axisalignedbb);
|
||||
this.pool.add(axisalignedbb);
|
||||
} else {
|
||||
axisalignedbb = (AxisAlignedBB) this.c.get(this.d);
|
||||
axisalignedbb = (AxisAlignedBB) this.pool.get(this.d);
|
||||
axisalignedbb.b(d0, d1, d2, d3, d4, d5);
|
||||
}
|
||||
|
||||
@ -35,24 +35,34 @@ public class AABBPool {
|
||||
}
|
||||
|
||||
public void a() {
|
||||
if (this.d > this.e) {
|
||||
this.e = this.d;
|
||||
if (this.d > this.largestSize) {
|
||||
this.largestSize = this.d;
|
||||
}
|
||||
|
||||
// CraftBukkit start - intelligent cache
|
||||
if ((this.f++ & 0xff) == 0) {
|
||||
int newSize = this.c.size() - (this.c.size() >> 3);
|
||||
if (newSize > this.e) { // newSize will be 87.5%, but if we were not in that range, we clear some of the cache
|
||||
for (int i = this.c.size() - 1; i > newSize; i--) { // Work down from size() to prevent insane array copies
|
||||
this.c.remove(i);
|
||||
if ((this.resizeTime++ & 0xff) == 0) {
|
||||
int newSize = this.pool.size() - (this.pool.size() >> 3);
|
||||
// newSize will be 87.5%, but if we were not in that range, we clear some of the cache
|
||||
if (newSize > this.largestSize) {
|
||||
// Work down from size() to prevent insane array copies
|
||||
for (int i = this.pool.size() - 1; i > newSize; i--) {
|
||||
this.pool.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
this.e = 0;
|
||||
// this.f = 0; // We do not reset to zero; it doubles for a flag
|
||||
this.largestSize = 0;
|
||||
// this.resizeTime = 0; // We do not reset to zero; it doubles for a flag
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.d = 0;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.pool.size();
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.d;
|
||||
}
|
||||
}
|
||||
|
@ -14,49 +14,52 @@ public class Block {
|
||||
public static final StepSound i = new StepSound("stone", 1.0F, 1.5F);
|
||||
public static final StepSound j = new StepSoundStone("stone", 1.0F, 1.0F);
|
||||
public static final StepSound k = new StepSound("cloth", 1.0F, 1.0F);
|
||||
public static final StepSound l = new StepSoundSand("sand", 1.0F, 1.0F);
|
||||
public static final StepSound l = new StepSound("sand", 1.0F, 1.0F);
|
||||
public static final StepSound m = new StepSound("snow", 1.0F, 1.0F);
|
||||
public static final StepSound n = new StepSoundLadder("ladder", 1.0F, 1.0F);
|
||||
public static final StepSound o = new StepSoundAnvil("anvil", 0.3F, 1.0F);
|
||||
public static final Block[] byId = new Block[4096];
|
||||
public static final boolean[] n = new boolean[4096];
|
||||
public static final boolean[] q = new boolean[4096];
|
||||
public static final int[] lightBlock = new int[4096];
|
||||
public static final boolean[] p = new boolean[4096];
|
||||
public static final boolean[] s = new boolean[4096];
|
||||
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 boolean[] u = new boolean[4096];
|
||||
public static boolean[] v = new boolean[4096];
|
||||
public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).b("stone");
|
||||
public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).b("grass");
|
||||
public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).b("dirt");
|
||||
public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stonebrick").a(CreativeModeTab.b);
|
||||
public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(e).b("wood").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 WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(e).b("wood").r();
|
||||
public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).b("sapling").r();
|
||||
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).s().b(6000000.0F).a(h).b("bedrock").D().a(CreativeModeTab.b);
|
||||
public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).h(3).b("water").D().r();
|
||||
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).h(3).b("water").D().r();
|
||||
public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).h(255).b("lava").D().r();
|
||||
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).h(255).b("lava").D().r();
|
||||
public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).b("sand");
|
||||
public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).b("gravel");
|
||||
public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).b("oreGold");
|
||||
public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).b("oreIron");
|
||||
public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).b("oreCoal");
|
||||
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).b("log").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 LOG = (new BlockLog(17)).c(2.0F).a(e).b("log").r();
|
||||
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).h(1).a(g).b("leaves").r();
|
||||
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).b("sponge");
|
||||
public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).b("glass");
|
||||
public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).b("oreLapis");
|
||||
public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).b("blockLapis").a(CreativeModeTab.b);
|
||||
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).b("dispenser").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 DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).b("dispenser").r();
|
||||
public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).b("sandStone").r();
|
||||
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).b("musicBlock").r();
|
||||
public static final Block BED = (new BlockBed(26)).c(0.2F).b("bed").D().r();
|
||||
public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).b("goldenRail").r();
|
||||
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).b("detectorRail").r();
|
||||
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).b("pistonStickyBase").r();
|
||||
public static final Block WEB = (new BlockWeb(30, 11)).h(1).c(4.0F).b("web");
|
||||
public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).b("tallgrass");
|
||||
public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).b("deadbush");
|
||||
public static final Block PISTON = (new BlockPiston(33, 107, false)).b("pistonBase").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 Block PISTON = (new BlockPiston(33, 107, false)).b("pistonBase").r();
|
||||
public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).r();
|
||||
public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).b("cloth").r();
|
||||
public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
|
||||
public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).b("flower");
|
||||
public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).b("rose");
|
||||
@ -71,118 +74,127 @@ public class Block {
|
||||
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 TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).b("torch").r();
|
||||
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).b("fire").D();
|
||||
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).b("mobSpawner").D();
|
||||
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).b("stairsWood").r();
|
||||
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).b("chest").r();
|
||||
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).b("redstoneDust").D().r();
|
||||
public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).b("oreDiamond");
|
||||
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).b("blockDiamond");
|
||||
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).b("workbench");
|
||||
public static final Block CROPS = (new BlockCrops(59, 88)).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 CROPS = (new BlockCrops(59, 88)).b("crops");
|
||||
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).b("farmland").r();
|
||||
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).b("furnace").r().a(CreativeModeTab.c);
|
||||
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).b("furnace").r();
|
||||
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).b("sign").D().r();
|
||||
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).b("doorWood").D().r();
|
||||
public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(n).b("ladder").r();
|
||||
public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).b("rail").r();
|
||||
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).b("stairsStone").r();
|
||||
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).b("sign").D().r();
|
||||
public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).b("lever").r();
|
||||
public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).b("pressurePlate").r();
|
||||
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).b("doorIron").D().r();
|
||||
public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).b("pressurePlate").r();
|
||||
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).b("oreRedstone").r().a(CreativeModeTab.b);
|
||||
public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).b("oreRedstone").r();
|
||||
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).b("notGate").r();
|
||||
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).b("notGate").r().a(CreativeModeTab.d);
|
||||
public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId, false)).c(0.5F).a(h).b("button").r();
|
||||
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(m).b("snow").r().h(0);
|
||||
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).h(3).a(j).b("ice");
|
||||
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(k).b("snow");
|
||||
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(m).b("snow");
|
||||
public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).b("cactus");
|
||||
public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).b("clay");
|
||||
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).b("reeds").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 SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).b("reeds").D();
|
||||
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).b("jukebox").r();
|
||||
public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).b("fence");
|
||||
public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).b("pumpkin").p();
|
||||
public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).b("pumpkin").r();
|
||||
public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).b("hellrock");
|
||||
public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).b("hellsand");
|
||||
public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).b("lightgem");
|
||||
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).b("portal");
|
||||
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).b("litpumpkin").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 JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).b("litpumpkin").r();
|
||||
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).b("cake").D().r();
|
||||
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).b("diode").D().r();
|
||||
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).b("diode").D().r();
|
||||
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).b("lockedchest").b(true).r();
|
||||
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).b("trapdoor").D().r();
|
||||
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).b("monsterStoneEgg");
|
||||
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).b("stonebricksmooth");
|
||||
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).b("mushroom").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 BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).b("mushroom").r();
|
||||
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).b("mushroom").r();
|
||||
public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).b("fenceIron");
|
||||
public static final Block THIN_GLASS = (new BlockThinFence(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).b("thinGlass");
|
||||
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).b("melon");
|
||||
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).b("pumpkinStem").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 Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).b("pumpkinStem").r();
|
||||
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).b("pumpkinStem").r();
|
||||
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).b("vine").r();
|
||||
public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).b("fenceGate").r();
|
||||
public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).b("stairsBrick").r();
|
||||
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).b("stairsStoneBrickSmooth").r();
|
||||
public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(g).b("mycel");
|
||||
public static final Block WATER_LILY = (new BlockWaterLily(111, 76)).c(0.0F).a(g).b("waterlily");
|
||||
public static final Block NETHER_BRICK = (new Block(112, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherBrick").a(CreativeModeTab.b);
|
||||
public static final Block NETHER_FENCE = (new BlockFence(113, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherFence");
|
||||
public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).b("stairsNetherBrick").p();
|
||||
public static final Block NETHER_WART = (new BlockNetherWart(115)).b("netherStalk").p();
|
||||
public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).b("stairsNetherBrick").r();
|
||||
public static final Block NETHER_WART = (new BlockNetherWart(115)).b("netherStalk").r();
|
||||
public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).b("enchantmentTable");
|
||||
public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).b("brewingStand").p();
|
||||
public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).b("cauldron").p();
|
||||
public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).b("brewingStand").r();
|
||||
public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).b("cauldron").r();
|
||||
public static final Block ENDER_PORTAL = (new BlockEnderPortal(119, Material.PORTAL)).c(-1.0F).b(6000000.0F);
|
||||
public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).b("endPortalFrame").p().b(6000000.0F).a(CreativeModeTab.c);
|
||||
public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).b("endPortalFrame").r().b(6000000.0F).a(CreativeModeTab.c);
|
||||
public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).b("whiteStone").a(CreativeModeTab.b);
|
||||
public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).b("dragonEgg");
|
||||
public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).b("redstoneLight").a(CreativeModeTab.d);
|
||||
public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).b("redstoneLight");
|
||||
public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(e).b("woodSlab");
|
||||
public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(e).b("woodSlab");
|
||||
public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(e).b("cocoa").p();
|
||||
public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).b("stairsSandStone").p();
|
||||
public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(e).b("cocoa").r();
|
||||
public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).b("stairsSandStone").r();
|
||||
public static final Block EMERALD_ORE = (new BlockOre(129, 171)).c(3.0F).b(5.0F).a(h).b("oreEmerald");
|
||||
public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(h).b("enderChest").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 ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(h).b("enderChest").r().a(0.5F);
|
||||
public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).b("tripWireSource").r();
|
||||
public static final Block TRIPWIRE = (new BlockTripwire(132)).b("tripWire").r();
|
||||
public static final Block EMERALD_BLOCK = (new BlockOreBlock(133, 25)).c(5.0F).b(10.0F).a(i).b("blockEmerald");
|
||||
public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).b("stairsWoodSpruce").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 static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).b("stairsWoodSpruce").r();
|
||||
public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).b("stairsWoodBirch").r();
|
||||
public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).b("stairsWoodJungle").r();
|
||||
public static final Block COMMAND = (new BlockCommand(137)).b("commandBlock");
|
||||
public static final Block BEACON = (new BlockBeacon(138)).b("beacon").a(1.0F);
|
||||
public static final Block COBBLE_WALL = (new BlockCobbleWall(139, COBBLESTONE)).b("cobbleWall");
|
||||
public static final Block FLOWER_POT = (new BlockFlowerPot(140)).c(0.0F).a(d).b("flowerPot");
|
||||
public static final Block CARROTS = (new BlockCarrots(141)).b("carrots");
|
||||
public static final Block POTATOES = (new BlockPotatoes(142)).b("potatoes");
|
||||
public static final Block WOOD_BUTTON = (new BlockButton(143, WOOD.textureId, true)).c(0.5F).a(e).b("button").r();
|
||||
public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(h).b("skull").r();
|
||||
public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(o).b(2000.0F).b("anvil").r();
|
||||
public int textureId;
|
||||
public final int id;
|
||||
protected float strength;
|
||||
protected float durability;
|
||||
protected boolean cd;
|
||||
protected boolean ce;
|
||||
protected boolean cf;
|
||||
protected boolean cp;
|
||||
protected boolean cq;
|
||||
protected boolean cr;
|
||||
protected boolean isTileEntity;
|
||||
public double minX;
|
||||
public double minY;
|
||||
public double minZ;
|
||||
public double maxX;
|
||||
public double maxY;
|
||||
public double maxZ;
|
||||
protected double minX;
|
||||
protected double minY;
|
||||
protected double minZ;
|
||||
protected double maxX;
|
||||
protected double maxY;
|
||||
protected double maxZ;
|
||||
public StepSound stepSound;
|
||||
public float co;
|
||||
public float cA;
|
||||
public final Material material;
|
||||
public float frictionFactor;
|
||||
private String name;
|
||||
|
||||
protected Block(int i, Material material) {
|
||||
this.cd = true;
|
||||
this.ce = true;
|
||||
this.cp = true;
|
||||
this.cq = true;
|
||||
this.stepSound = d;
|
||||
this.co = 1.0F;
|
||||
this.cA = 1.0F;
|
||||
this.frictionFactor = 0.6F;
|
||||
if (byId[i] != null) {
|
||||
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
|
||||
@ -191,18 +203,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.d();
|
||||
lightBlock[i] = this.d() ? 255 : 0;
|
||||
p[i] = !material.blocksLight();
|
||||
q[i] = this.c();
|
||||
lightBlock[i] = this.c() ? 255 : 0;
|
||||
s[i] = !material.blocksLight();
|
||||
}
|
||||
}
|
||||
|
||||
protected Block p() {
|
||||
r[this.id] = true;
|
||||
protected Block r() {
|
||||
u[this.id] = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void r_() {}
|
||||
protected void t_() {}
|
||||
|
||||
protected Block(int i, int j, Material material) {
|
||||
this(i, material);
|
||||
@ -232,10 +244,10 @@ public class Block {
|
||||
public static boolean i(int i) {
|
||||
Block block = byId[i];
|
||||
|
||||
return block == null ? false : block.material.k() && block.c();
|
||||
return block == null ? false : block.material.k() && block.b();
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -243,7 +255,7 @@ public class Block {
|
||||
return !this.material.isSolid();
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int d() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -256,7 +268,7 @@ public class Block {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block q() {
|
||||
protected Block s() {
|
||||
this.c(-1.0F);
|
||||
return this;
|
||||
}
|
||||
@ -266,19 +278,19 @@ public class Block {
|
||||
}
|
||||
|
||||
protected Block b(boolean flag) {
|
||||
this.cf = flag;
|
||||
this.cr = flag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean r() {
|
||||
return this.cf;
|
||||
public boolean isTicking() {
|
||||
return this.cr;
|
||||
}
|
||||
|
||||
public boolean s() {
|
||||
public boolean u() {
|
||||
return this.isTileEntity;
|
||||
}
|
||||
|
||||
public void a(float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
protected final void a(float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
this.minX = (double) f;
|
||||
this.minY = (double) f1;
|
||||
this.minZ = (double) f2;
|
||||
@ -287,7 +299,7 @@ public class Block {
|
||||
this.maxZ = (double) f5;
|
||||
}
|
||||
|
||||
public boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean a_(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return iblockaccess.getMaterial(i, j, k).isBuildable();
|
||||
}
|
||||
|
||||
@ -311,15 +323,15 @@ public class Block {
|
||||
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 d() {
|
||||
public boolean c() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean a(int i, boolean flag) {
|
||||
return this.l();
|
||||
return this.m();
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
public boolean m() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -329,7 +341,7 @@ public class Block {
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ -373,7 +385,7 @@ public class Block {
|
||||
}
|
||||
|
||||
protected void a(World world, int i, int j, int k, ItemStack itemstack) {
|
||||
if (!world.isStatic) {
|
||||
if (!world.isStatic && world.getGameRules().getBoolean("doTileDrops")) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
@ -385,7 +397,7 @@ public class Block {
|
||||
}
|
||||
}
|
||||
|
||||
protected void g(World world, int i, int j, int k, int l) {
|
||||
protected void f(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic) {
|
||||
while (l > 0) {
|
||||
int i1 = EntityExperienceOrb.getOrbValue(l);
|
||||
@ -396,7 +408,7 @@ public class Block {
|
||||
}
|
||||
}
|
||||
|
||||
protected int getDropData(int i) {
|
||||
public int getDropData(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -499,15 +511,15 @@ public class Block {
|
||||
}
|
||||
|
||||
private boolean a(Vec3D vec3d) {
|
||||
return vec3d == null ? false : vec3d.b >= this.minY && vec3d.b <= this.maxY && vec3d.c >= this.minZ && vec3d.c <= this.maxZ;
|
||||
return vec3d == null ? false : vec3d.d >= this.minY && vec3d.d <= this.maxY && vec3d.e >= this.minZ && vec3d.e <= this.maxZ;
|
||||
}
|
||||
|
||||
private boolean b(Vec3D vec3d) {
|
||||
return vec3d == null ? false : vec3d.a >= this.minX && vec3d.a <= this.maxX && vec3d.c >= this.minZ && vec3d.c <= this.maxZ;
|
||||
return vec3d == null ? false : vec3d.c >= this.minX && vec3d.c <= this.maxX && vec3d.e >= this.minZ && vec3d.e <= this.maxZ;
|
||||
}
|
||||
|
||||
private boolean c(Vec3D vec3d) {
|
||||
return vec3d == null ? false : vec3d.a >= this.minX && vec3d.a <= this.maxX && vec3d.b >= this.minY && vec3d.b <= this.maxY;
|
||||
return vec3d == null ? false : vec3d.c >= this.minX && vec3d.c <= this.maxX && vec3d.d >= this.minY && vec3d.d <= this.maxY;
|
||||
}
|
||||
|
||||
public void wasExploded(World world, int i, int j, int k) {}
|
||||
@ -536,7 +548,31 @@ public class Block {
|
||||
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public final double v() {
|
||||
return this.minX;
|
||||
}
|
||||
|
||||
public final double w() {
|
||||
return this.maxX;
|
||||
}
|
||||
|
||||
public final double x() {
|
||||
return this.minY;
|
||||
}
|
||||
|
||||
public final double y() {
|
||||
return this.maxY;
|
||||
}
|
||||
|
||||
public final double z() {
|
||||
return this.minZ;
|
||||
}
|
||||
|
||||
public final double A() {
|
||||
return this.maxZ;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -546,7 +582,7 @@ public class Block {
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity) {}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -555,27 +591,27 @@ 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.j(0.025F);
|
||||
if (this.q_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
|
||||
ItemStack itemstack = this.c_(l);
|
||||
if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
|
||||
ItemStack itemstack = this.f_(l);
|
||||
|
||||
if (itemstack != null) {
|
||||
this.a(world, i, j, k, itemstack);
|
||||
}
|
||||
} else {
|
||||
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory);
|
||||
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
|
||||
|
||||
this.c(world, i, j, k, l, i1);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean q_() {
|
||||
return this.c() && !this.isTileEntity;
|
||||
protected boolean s_() {
|
||||
return this.b() && !this.isTileEntity;
|
||||
}
|
||||
|
||||
protected ItemStack c_(int i) {
|
||||
protected ItemStack f_(int i) {
|
||||
int j = 0;
|
||||
|
||||
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].k()) {
|
||||
if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].l()) {
|
||||
j = i;
|
||||
}
|
||||
|
||||
@ -607,21 +643,25 @@ public class Block {
|
||||
|
||||
public void b(World world, int i, int j, int k, int l, int i1) {}
|
||||
|
||||
public boolean u() {
|
||||
return this.ce;
|
||||
public boolean C() {
|
||||
return this.cq;
|
||||
}
|
||||
|
||||
protected Block v() {
|
||||
this.ce = false;
|
||||
protected Block D() {
|
||||
this.cq = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
public int q_() {
|
||||
return this.material.getPushReaction();
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity, float f) {}
|
||||
|
||||
public int getDropData(World world, int i, int j, int k) {
|
||||
return this.getDropData(world.getData(i, j, k));
|
||||
}
|
||||
|
||||
public Block a(CreativeModeTab creativemodetab) {
|
||||
this.creativeTab = creativemodetab;
|
||||
return this;
|
||||
@ -629,30 +669,34 @@ public class Block {
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
|
||||
|
||||
public void h(World world, int i, int j, int k, int l) {}
|
||||
public void g(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) {}
|
||||
public boolean l() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static {
|
||||
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[LOG.id] = (new ItemMultiTexture(LOG.id - 256, LOG, BlockLog.a)).b("log");
|
||||
Item.byId[WOOD.id] = (new ItemMultiTexture(WOOD.id - 256, WOOD, BlockWood.a)).b("wood");
|
||||
Item.byId[MONSTER_EGGS.id] = (new ItemMultiTexture(MONSTER_EGGS.id - 256, MONSTER_EGGS, BlockMonsterEggs.a)).b("monsterStoneEgg");
|
||||
Item.byId[SMOOTH_BRICK.id] = (new ItemMultiTexture(SMOOTH_BRICK.id - 256, SMOOTH_BRICK, BlockSmoothBrick.a)).b("stonebricksmooth");
|
||||
Item.byId[SANDSTONE.id] = (new ItemMultiTexture(SANDSTONE.id - 256, SANDSTONE, BlockSandStone.a)).b("sandStone");
|
||||
Item.byId[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[SAPLING.id] = (new ItemMultiTexture(SAPLING.id - 256, SAPLING, BlockSapling.a)).b("sapling");
|
||||
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).b("leaves");
|
||||
Item.byId[VINE.id] = new ItemWithAuxData(VINE.id - 256, false);
|
||||
Item.byId[LONG_GRASS.id] = (new ItemWithAuxData(LONG_GRASS.id - 256, true)).a(new String[] { "shrub", "grass", "fern"});
|
||||
Item.byId[WATER_LILY.id] = new ItemWaterLily(WATER_LILY.id - 256);
|
||||
Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256);
|
||||
Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256);
|
||||
Item.byId[COBBLE_WALL.id] = (new ItemMultiTexture(COBBLE_WALL.id - 256, COBBLE_WALL, BlockCobbleWall.a)).b("cobbleWall");
|
||||
Item.byId[ANVIL.id] = (new ItemAnvil(ANVIL)).b("anvil");
|
||||
// CraftBukkit start
|
||||
Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, true);
|
||||
Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, true);
|
||||
@ -663,12 +707,12 @@ public class Block {
|
||||
if (byId[i] != null) {
|
||||
if (Item.byId[i] == null) {
|
||||
Item.byId[i] = new ItemBlock(i - 256);
|
||||
byId[i].r_();
|
||||
byId[i].t_();
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
if (i > 0 && byId[i].b() == 10) {
|
||||
if (i > 0 && byId[i].d() == 10) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@ -680,7 +724,7 @@ public class Block {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (p[i]) {
|
||||
if (s[i]) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@ -688,19 +732,15 @@ public class Block {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
s[i] = flag;
|
||||
v[i] = flag;
|
||||
}
|
||||
}
|
||||
|
||||
p[0] = true;
|
||||
s[0] = true;
|
||||
StatisticList.b();
|
||||
}
|
||||
|
||||
// CraftBukkit start - getDropData(int) is protected
|
||||
public static int getDropData(Block block, int data) {
|
||||
return block.getDropData(data);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public int getExpDrop(World world, int data, int enchantmentLevel) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,33 +1,37 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockButton extends Block {
|
||||
|
||||
protected BlockButton(int i, int j) {
|
||||
private final boolean a;
|
||||
|
||||
protected BlockButton(int i, int j, boolean flag) {
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.d);
|
||||
this.a = flag;
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
public int r_() {
|
||||
return this.a ? 30 : 20;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k, int l) {
|
||||
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)));
|
||||
}
|
||||
@ -100,8 +104,13 @@ public class BlockButton extends Block {
|
||||
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
boolean flag = (l & 8) > 0;
|
||||
|
||||
this.e(l);
|
||||
}
|
||||
|
||||
private void e(int i) {
|
||||
int j = i & 7;
|
||||
boolean flag = (i & 8) > 0;
|
||||
float f = 0.375F;
|
||||
float f1 = 0.625F;
|
||||
float f2 = 0.1875F;
|
||||
@ -111,20 +120,18 @@ public class BlockButton extends Block {
|
||||
f3 = 0.0625F;
|
||||
}
|
||||
|
||||
if (i1 == 1) {
|
||||
if (j == 1) {
|
||||
this.a(0.0F, f, 0.5F - f2, f3, f1, 0.5F + f2);
|
||||
} else if (i1 == 2) {
|
||||
} else if (j == 2) {
|
||||
this.a(1.0F - f3, f, 0.5F - f2, 1.0F, f1, 0.5F + f2);
|
||||
} else if (i1 == 3) {
|
||||
} else if (j == 3) {
|
||||
this.a(0.5F - f2, f, 0.0F, 0.5F + f2, f1, f3);
|
||||
} else if (i1 == 4) {
|
||||
} else if (j == 4) {
|
||||
this.a(0.5F - f2, f, 1.0F - f3, 0.5F + f2, f1, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
@ -148,53 +155,30 @@ public class BlockButton extends Block {
|
||||
// CraftBukkit end
|
||||
|
||||
world.setData(i, j, k, j1 + k1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.e(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 (j1 == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (j1 == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (j1 == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (j1 == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
this.d(world, i, j, k, j1);
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
if ((i1 & 8) > 0) {
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
int j1 = i1 & 7;
|
||||
|
||||
if (j1 == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (j1 == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (j1 == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (j1 == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
this.d(world, i, j, k, j1);
|
||||
}
|
||||
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.getData(i, j, k) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int i1 = iblockaccess.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
return false;
|
||||
@ -225,24 +209,16 @@ public class BlockButton extends Block {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setData(i, j, k, l & 7);
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
int i1 = l & 7;
|
||||
|
||||
if (i1 == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (i1 == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (i1 == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (i1 == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
if (this.a) {
|
||||
this.o(world, i, j, k);
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
world.setData(i, j, k, l & 7);
|
||||
int i1 = l & 7;
|
||||
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
world.d(i, j, k, i, j, k);
|
||||
this.d(world, i, j, k, i1);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
world.e(i, j, k, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -254,4 +230,57 @@ public class BlockButton extends Block {
|
||||
|
||||
this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
if (!world.isStatic) {
|
||||
if (this.a) {
|
||||
if ((world.getData(i, j, k) & 8) == 0) {
|
||||
this.o(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void o(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = l & 7;
|
||||
boolean flag = (l & 8) != 0;
|
||||
|
||||
this.e(l);
|
||||
List list = world.a(EntityArrow.class, AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ));
|
||||
boolean flag1 = !list.isEmpty();
|
||||
|
||||
if (flag1 && !flag) {
|
||||
world.setData(i, j, k, i1 | 8);
|
||||
this.d(world, i, j, k, i1);
|
||||
world.e(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
}
|
||||
|
||||
if (!flag1 && flag) {
|
||||
world.setData(i, j, k, i1);
|
||||
this.d(world, i, j, k, i1);
|
||||
world.e(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
}
|
||||
|
||||
private void d(World world, int i, int j, int k, int l) {
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
if (l == 1) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
} else if (l == 2) {
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
} else if (l == 3) {
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
} else if (l == 4) {
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
} else {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,15 +43,15 @@ public class BlockCactus extends Block {
|
||||
return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId + 1 : this.textureId);
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int d() {
|
||||
return 13;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class BlockCactus extends Block {
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
|
||||
// CraftBukkit start - EntityDamageByBlock event
|
||||
if (entity instanceof EntityLiving) {
|
||||
org.bukkit.block.Block damager = world.getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
|
53
src/main/java/net/minecraft/server/BlockCommand.java
Normale Datei
53
src/main/java/net/minecraft/server/BlockCommand.java
Normale Datei
@ -0,0 +1,53 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockCommand extends BlockContainer {
|
||||
|
||||
public BlockCommand(int i) {
|
||||
super(i, 184, Material.ORE);
|
||||
}
|
||||
|
||||
public TileEntity a(World world) {
|
||||
return new TileEntityCommand();
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic) {
|
||||
boolean flag = world.isBlockIndirectlyPowered(i, j, k);
|
||||
int i1 = world.getData(i, j, k);
|
||||
boolean flag1 = (i1 & 1) != 0;
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int old = flag1 ? 1 : 0;
|
||||
int current = flag ? 1 : 0;
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
// CraftBukkit end
|
||||
|
||||
if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentity != null && tileentity instanceof TileEntityCommand) {
|
||||
((TileEntityCommand) tileentity).a(world);
|
||||
}
|
||||
|
||||
world.setRawData(i, j, k, i1 | 1);
|
||||
} else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
|
||||
world.setRawData(i, j, k, i1 & -2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
TileEntityCommand tileentitycommand = (TileEntityCommand) world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentitycommand != null) {
|
||||
entityhuman.a((TileEntity) tileentitycommand);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -12,6 +12,10 @@ public class BlockCrops extends BlockFlower {
|
||||
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
|
||||
this.a((CreativeModeTab) null);
|
||||
this.c(0.0F);
|
||||
this.a(g);
|
||||
this.D();
|
||||
this.r();
|
||||
}
|
||||
|
||||
protected boolean d_(int i) {
|
||||
@ -86,32 +90,35 @@ public class BlockCrops extends BlockFlower {
|
||||
return this.textureId + j;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int d() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
protected int h() {
|
||||
return Item.SEEDS.id;
|
||||
}
|
||||
|
||||
protected int j() {
|
||||
return Item.WHEAT.id;
|
||||
}
|
||||
|
||||
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, 0);
|
||||
if (!world.isStatic) {
|
||||
int j1 = 3 + i1;
|
||||
if (l >= 7) {
|
||||
int j1 = 3 + i1;
|
||||
|
||||
for (int k1 = 0; k1 < j1; ++k1) {
|
||||
if (world.random.nextInt(15) <= l) {
|
||||
float f1 = 0.7F;
|
||||
float f2 = world.random.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
float f3 = world.random.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
float f4 = world.random.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f2), (double) ((float) j + f3), (double) ((float) k + f4), new ItemStack(Item.SEEDS));
|
||||
|
||||
entityitem.pickupDelay = 10;
|
||||
world.addEntity(entityitem);
|
||||
for (int k1 = 0; k1 < j1; ++k1) {
|
||||
if (world.random.nextInt(15) <= l) {
|
||||
this.a(world, i, j, k, new ItemStack(this.h(), 1, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
return i == 7 ? Item.WHEAT.id : -1;
|
||||
return i == 7 ? this.j() : this.h();
|
||||
}
|
||||
|
||||
public int a(Random random) {
|
||||
|
@ -2,14 +2,11 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockDispenser extends BlockContainer {
|
||||
|
||||
private Random a = new Random();
|
||||
public static final IRegistry a = new RegistryDefault(new DispenseBehaviorItem());
|
||||
private Random b = new Random();
|
||||
public static boolean eventFired = false; // CraftBukkit
|
||||
|
||||
protected BlockDispenser(int i) {
|
||||
super(i, Material.STONE);
|
||||
@ -17,7 +14,7 @@ public class BlockDispenser extends BlockContainer {
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@ -38,19 +35,19 @@ public class BlockDispenser extends BlockContainer {
|
||||
int k1 = world.getTypeId(i + 1, j, k);
|
||||
byte b0 = 3;
|
||||
|
||||
if (Block.n[l] && !Block.n[i1]) {
|
||||
if (Block.q[l] && !Block.q[i1]) {
|
||||
b0 = 3;
|
||||
}
|
||||
|
||||
if (Block.n[i1] && !Block.n[l]) {
|
||||
if (Block.q[i1] && !Block.q[l]) {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
if (Block.n[j1] && !Block.n[k1]) {
|
||||
if (Block.q[j1] && !Block.q[k1]) {
|
||||
b0 = 5;
|
||||
}
|
||||
|
||||
if (Block.n[k1] && !Block.n[j1]) {
|
||||
if (Block.q[k1] && !Block.q[j1]) {
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
@ -76,104 +73,26 @@ public class BlockDispenser extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
byte b1 = 0;
|
||||
|
||||
if (l == 3) {
|
||||
b1 = 1;
|
||||
} else if (l == 2) {
|
||||
b1 = -1;
|
||||
} else if (l == 5) {
|
||||
b0 = 1;
|
||||
} else {
|
||||
b0 = -1;
|
||||
}
|
||||
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
|
||||
// CraftBukkit - private -> public
|
||||
public void dispense(World world, int i, int j, int k) {
|
||||
SourceBlock sourceblock = new SourceBlock(world, i, j, k);
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
|
||||
|
||||
if (tileentitydispenser != null) {
|
||||
int i1 = tileentitydispenser.i();
|
||||
int l = tileentitydispenser.i();
|
||||
|
||||
if (i1 < 0) {
|
||||
if (l < 0) {
|
||||
world.triggerEffect(1001, i, j, k, 0);
|
||||
} else {
|
||||
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);
|
||||
ItemStack itemstack = tileentitydispenser.getItem(l);
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) a.a(itemstack.getItem());
|
||||
|
||||
// CraftBukkit start
|
||||
// Clone item stack, then set the count to 1
|
||||
itemstack = itemstack.cloneItemStack();
|
||||
itemstack.count = 1;
|
||||
if (idispensebehavior != IDispenseBehavior.a) {
|
||||
ItemStack itemstack1 = idispensebehavior.a(sourceblock, itemstack);
|
||||
eventFired = false; // CraftBukkit - reset event status
|
||||
|
||||
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;
|
||||
tileentitydispenser.setItem(l, itemstack1.count == 0 ? null : itemstack1);
|
||||
}
|
||||
|
||||
itemstack = CraftItemStack.createNMSItemStack(event.getItem());
|
||||
// CraftBukkit end
|
||||
|
||||
int j1 = a(tileentitydispenser, world, itemstack, random, i, j, k, b0, b1, d0, d1, d2);
|
||||
|
||||
if (j1 == 1) {
|
||||
// CraftBukkit start
|
||||
if (event.getItem().equals(bukkitItem)) {
|
||||
// Actually remove the item
|
||||
tileentitydispenser.splitStack(i1, 1);
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else if (j1 == 0) {
|
||||
// CraftBukkit start
|
||||
motX = event.getVelocity().getX();
|
||||
motY = event.getVelocity().getY();
|
||||
motZ = event.getVelocity().getZ();
|
||||
|
||||
if (event.getItem().equals(bukkitItem)) {
|
||||
// Actually remove the item
|
||||
tileentitydispenser.splitStack(i1, 1);
|
||||
}
|
||||
|
||||
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||
entityitem.motX = event.getVelocity().getX();
|
||||
entityitem.motY = event.getVelocity().getY();
|
||||
entityitem.motZ = event.getVelocity().getZ();
|
||||
world.addEntity(entityitem);
|
||||
// CraftBukkit end
|
||||
|
||||
world.triggerEffect(1000, i, j, k, 0);
|
||||
// CraftBukkit start - new condition
|
||||
} else if (j1 == 2) {
|
||||
ItemStack old = tileentitydispenser.getItem(i1);
|
||||
if (old.id == Item.BUCKET.id && old.count > 1) {
|
||||
old.count--;
|
||||
if (tileentitydispenser.a(itemstack) < 0) {
|
||||
a(world, itemstack, random, 6, l, i1, d0, d1, d2);
|
||||
}
|
||||
} else {
|
||||
tileentitydispenser.setItem(i1, itemstack);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
world.triggerEffect(2000, i, j, k, b0 + 1 + (b1 + 1) * 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,14 +102,14 @@ public class BlockDispenser extends BlockContainer {
|
||||
boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
|
||||
|
||||
if (flag) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
if (!world.isStatic && (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k))) {
|
||||
this.dispense(world, i, j, k, random);
|
||||
this.dispense(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,12 +145,12 @@ public class BlockDispenser extends BlockContainer {
|
||||
ItemStack itemstack = tileentitydispenser.getItem(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.a.nextFloat() * 0.8F + 0.1F;
|
||||
float f = this.b.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.b.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.b.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.count > 0) {
|
||||
int k1 = this.a.nextInt(21) + 10;
|
||||
int k1 = this.b.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.count) {
|
||||
k1 = itemstack.count;
|
||||
@ -246,9 +165,9 @@ public class BlockDispenser extends BlockContainer {
|
||||
|
||||
float f3 = 0.05F;
|
||||
|
||||
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
|
||||
entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
|
||||
entityitem.motX = (double) ((float) this.b.nextGaussian() * f3);
|
||||
entityitem.motY = (double) ((float) this.b.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motZ = (double) ((float) this.b.nextGaussian() * f3);
|
||||
world.addEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@ -258,148 +177,12 @@ public class BlockDispenser extends BlockContainer {
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
private static void a(World world, ItemStack itemstack, Random random, int i, int j, int k, 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;
|
||||
public static IPosition a(ISourceBlock isourceblock) {
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
double d0 = isourceblock.getX() + 0.6D * (double) enumfacing.c();
|
||||
double d1 = isourceblock.getY();
|
||||
double d2 = isourceblock.getZ() + 0.6D * (double) enumfacing.e();
|
||||
|
||||
entityitem.motX = (double) j * d3;
|
||||
entityitem.motY = 0.20000000298023224D;
|
||||
entityitem.motZ = (double) k * d3;
|
||||
entityitem.motX += random.nextGaussian() * 0.007499999832361937D * (double) i;
|
||||
entityitem.motY += random.nextGaussian() * 0.007499999832361937D * (double) i;
|
||||
entityitem.motZ += random.nextGaussian() * 0.007499999832361937D * (double) i;
|
||||
world.addEntity(entityitem);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
return new Position(d0, d1, d2);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class BlockDoor extends Block {
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -29,11 +29,11 @@ public class BlockDoor extends Block {
|
||||
return (l & 4) != 0;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int d() {
|
||||
return 7;
|
||||
}
|
||||
|
||||
@ -105,9 +105,7 @@ public class BlockDoor extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.interact(world, i, j, k, entityhuman, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (this.material == Material.ORE) {
|
||||
@ -119,10 +117,10 @@ public class BlockDoor extends Block {
|
||||
j1 ^= 4;
|
||||
if ((i1 & 8) == 0) {
|
||||
world.setData(i, j, k, j1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.e(i, j, k, i, j, k);
|
||||
} else {
|
||||
world.setData(i, j - 1, k, j1);
|
||||
world.d(i, j - 1, k, i, j, k);
|
||||
world.e(i, j - 1, k, i, j, k);
|
||||
}
|
||||
|
||||
world.a(entityhuman, 1003, i, j, k, 0);
|
||||
@ -140,10 +138,10 @@ public class BlockDoor extends Block {
|
||||
i1 ^= 4;
|
||||
if ((l & 8) == 0) {
|
||||
world.setData(i, j, k, i1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.e(i, j, k, i, j, k);
|
||||
} else {
|
||||
world.setData(i, j - 1, k, i1);
|
||||
world.d(i, j - 1, k, i, j, k);
|
||||
world.e(i, j - 1, k, i, j, k);
|
||||
}
|
||||
|
||||
world.a((EntityHuman) null, 1003, i, j, k, 0);
|
||||
@ -215,7 +213,7 @@ public class BlockDoor extends Block {
|
||||
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 e() {
|
||||
public int q_() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,11 @@ public class BlockDragonEgg extends Block {
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
@ -26,7 +26,7 @@ public class BlockDragonEgg extends Block {
|
||||
if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
|
||||
byte b0 = 32;
|
||||
|
||||
if (!BlockSand.instaFall && world.c(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
if (!BlockSand.instaFall && world.d(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));
|
||||
|
||||
@ -91,7 +91,7 @@ public class BlockDragonEgg extends Block {
|
||||
double d2 = (double) j1 + (double) (j - j1) * d0 + world.random.nextDouble() * 1.0D - 0.5D;
|
||||
double d3 = (double) k1 + (double) (k - k1) * d0 + (world.random.nextDouble() - 0.5D) * 1.0D + 0.5D;
|
||||
|
||||
world.a("portal", d1, d2, d3, (double) f, (double) f1, (double) f2);
|
||||
world.addParticle("portal", d1, d2, d3, (double) f, (double) f1, (double) f2);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -101,19 +101,19 @@ public class BlockDragonEgg extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return 27;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class BlockFire extends Block {
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public void r_() {
|
||||
public void t_() {
|
||||
this.a(Block.WOOD.id, 5, 20);
|
||||
this.a(Block.WOOD_DOUBLE_STEP.id, 5, 20);
|
||||
this.a(Block.WOOD_STEP.id, 5, 20);
|
||||
@ -45,15 +45,15 @@ public class BlockFire extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ -61,109 +61,111 @@ public class BlockFire extends Block {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
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.getGameRules().getBoolean("doFireTick")) {
|
||||
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) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (l < 15) {
|
||||
world.setRawData(i, j, k, l + random.nextInt(3) / 2);
|
||||
if (world.worldProvider instanceof WorldProviderTheEnd && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
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.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
if (!flag && world.M() && (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 {
|
||||
boolean flag1 = world.C(i, j, k);
|
||||
byte b0 = 0;
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (flag1) {
|
||||
b0 = -50;
|
||||
if (l < 15) {
|
||||
world.setRawData(i, j, k, l + random.nextInt(3) / 2);
|
||||
}
|
||||
|
||||
this.a(world, i + 1, j, k, 300 + b0, random, l);
|
||||
this.a(world, i - 1, j, k, 300 + b0, random, l);
|
||||
this.a(world, i, j - 1, k, 250 + b0, random, l);
|
||||
this.a(world, i, j + 1, k, 250 + b0, random, l);
|
||||
this.a(world, i, j, k - 1, 300 + b0, random, l);
|
||||
this.a(world, i, j, k + 1, 300 + b0, random, l);
|
||||
world.a(i, j, k, this.id, this.r_() + random.nextInt(10));
|
||||
if (!flag && !this.l(world, i, j, k)) {
|
||||
if (!world.t(i, j - 1, k) || l > 3) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
} 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.C(i, j, k);
|
||||
byte b0 = 0;
|
||||
|
||||
// CraftBukkit start - call to stop spread of fire
|
||||
org.bukkit.Server server = world.getServer();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
if (flag1) {
|
||||
b0 = -50;
|
||||
}
|
||||
|
||||
BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||
org.bukkit.block.Block fromBlock = bworld.getBlockAt(i, j, k);
|
||||
// CraftBukkit end
|
||||
this.a(world, i + 1, j, k, 300 + b0, random, l);
|
||||
this.a(world, i - 1, j, k, 300 + b0, random, l);
|
||||
this.a(world, i, j - 1, k, 250 + b0, random, l);
|
||||
this.a(world, i, j + 1, k, 250 + b0, random, l);
|
||||
this.a(world, i, j, k - 1, 300 + b0, random, l);
|
||||
this.a(world, i, j, k + 1, 300 + b0, random, l);
|
||||
|
||||
for (int i1 = i - 1; i1 <= i + 1; ++i1) {
|
||||
for (int j1 = k - 1; j1 <= k + 1; ++j1) {
|
||||
for (int k1 = j - 1; k1 <= j + 4; ++k1) {
|
||||
if (i1 != i || k1 != j || j1 != k) {
|
||||
int l1 = 100;
|
||||
// CraftBukkit start - call to stop spread of fire
|
||||
org.bukkit.Server server = world.getServer();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
|
||||
if (k1 > j + 1) {
|
||||
l1 += (k1 - (j + 1)) * 100;
|
||||
}
|
||||
BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||
org.bukkit.block.Block fromBlock = bworld.getBlockAt(i, j, k);
|
||||
// CraftBukkit end
|
||||
|
||||
int i2 = this.n(world, i1, k1, j1);
|
||||
for (int i1 = i - 1; i1 <= i + 1; ++i1) {
|
||||
for (int j1 = k - 1; j1 <= k + 1; ++j1) {
|
||||
for (int k1 = j - 1; k1 <= j + 4; ++k1) {
|
||||
if (i1 != i || k1 != j || j1 != k) {
|
||||
int l1 = 100;
|
||||
|
||||
if (i2 > 0) {
|
||||
int j2 = (i2 + 40) / (l + 30);
|
||||
|
||||
if (flag1) {
|
||||
j2 /= 2;
|
||||
if (k1 > j + 1) {
|
||||
l1 += (k1 - (j + 1)) * 100;
|
||||
}
|
||||
|
||||
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;
|
||||
int i2 = this.n(world, i1, k1, j1);
|
||||
|
||||
if (k2 > 15) {
|
||||
k2 = 15;
|
||||
if (i2 > 0) {
|
||||
int j2 = (i2 + 40 + world.difficulty * 7) / (l + 30);
|
||||
|
||||
if (flag1) {
|
||||
j2 /= 2;
|
||||
}
|
||||
|
||||
// CraftBukkit start - call to stop spread of fire
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i1, k1, j1);
|
||||
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.M() || !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 (block.getTypeId() != Block.FIRE.id) {
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(block, igniteCause, null);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
if (k2 > 15) {
|
||||
k2 = 15;
|
||||
}
|
||||
|
||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
blockState.setData(new org.bukkit.material.MaterialData(this.id, (byte) k2));
|
||||
// CraftBukkit start - call to stop spread of fire
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i1, k1, j1);
|
||||
|
||||
BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), fromBlock, blockState);
|
||||
server.getPluginManager().callEvent(spreadEvent);
|
||||
if (block.getTypeId() != Block.FIRE.id) {
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(block, igniteCause, null);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!spreadEvent.isCancelled()) {
|
||||
blockState.update(true);
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
blockState.setData(new org.bukkit.material.MaterialData(this.id, (byte) k2));
|
||||
|
||||
BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), fromBlock, blockState);
|
||||
server.getPluginManager().callEvent(spreadEvent);
|
||||
|
||||
if (!spreadEvent.isCancelled()) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,6 +176,10 @@ public class BlockFire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void a(World world, int i, int j, int k, int l, Random random, int i1) {
|
||||
int j1 = this.b[world.getTypeId(i, j, k)];
|
||||
|
||||
@ -219,18 +225,18 @@ public class BlockFire extends Block {
|
||||
if (!world.isEmpty(i, j, k)) {
|
||||
return 0;
|
||||
} else {
|
||||
int l = this.e(world, i + 1, j, k, b0);
|
||||
int l = this.d(world, i + 1, j, k, b0);
|
||||
|
||||
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);
|
||||
l = this.d(world, i - 1, j, k, l);
|
||||
l = this.d(world, i, j - 1, k, l);
|
||||
l = this.d(world, i, j + 1, k, l);
|
||||
l = this.d(world, i, j, k - 1, l);
|
||||
l = this.d(world, i, j, k + 1, l);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
public boolean m() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -238,7 +244,7 @@ public class BlockFire extends Block {
|
||||
return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
|
||||
}
|
||||
|
||||
public int e(World world, int i, int j, int k, int l) {
|
||||
public int d(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.a[world.getTypeId(i, j, k)];
|
||||
|
||||
return i1 > l ? i1 : l;
|
||||
@ -259,7 +265,7 @@ public class BlockFire extends Block {
|
||||
if (!world.t(i, j - 1, k) && !this.l(world, i, j, k)) {
|
||||
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
|
||||
} else {
|
||||
world.a(i, j, k, this.id, this.p_() + world.random.nextInt(10));
|
||||
world.a(i, j, k, this.id, this.r_() + world.random.nextInt(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.setRawTypeIdAndData(i, j, k, this.id + 1, l);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.e(i, j, k, i, j, k);
|
||||
}
|
||||
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
@ -38,7 +38,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
int l = this.f_(world, i, j, k);
|
||||
byte b0 = 1;
|
||||
|
||||
if (this.material == Material.LAVA && !world.worldProvider.d) {
|
||||
if (this.material == Material.LAVA && !world.worldProvider.e) {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
@ -49,11 +49,11 @@ public class BlockFlowing extends BlockFluids {
|
||||
byte b1 = -100;
|
||||
|
||||
this.a = 0;
|
||||
int j1 = this.e(world, i - 1, j, k, b1);
|
||||
int j1 = this.d(world, i - 1, j, k, b1);
|
||||
|
||||
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);
|
||||
j1 = this.d(world, i + 1, j, k, j1);
|
||||
j1 = this.d(world, i, j, k - 1, j1);
|
||||
j1 = this.d(world, i, j, k + 1, j1);
|
||||
i1 = j1 + b0;
|
||||
if (i1 >= 8 || j1 < 0) {
|
||||
i1 = -1;
|
||||
@ -92,7 +92,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
world.setData(i, j, k, i1);
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
}
|
||||
}
|
||||
@ -279,7 +279,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
}
|
||||
|
||||
protected int e(World world, int i, int j, int k, int l) {
|
||||
protected int d(World world, int i, int j, int k, int l) {
|
||||
int i1 = this.f_(world, i, j, k);
|
||||
|
||||
if (i1 < 0) {
|
||||
@ -306,7 +306,11 @@ public class BlockFlowing extends BlockFluids {
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
super.onPlace(world, i, j, k);
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGravel extends BlockSand {
|
||||
|
||||
public BlockGravel(int i, int j) {
|
||||
super(i, j);
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
j = Math.min(j, 3); // CraftBukkit - added to fix crash when j > 3
|
||||
return random.nextInt(10 - j * 3) == 0 ? Item.FLINT.id : this.id;
|
||||
}
|
||||
}
|
@ -14,19 +14,19 @@ public class BlockIce extends BlockHalfTransparant {
|
||||
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
entityhuman.a(StatisticList.C[this.id], 1);
|
||||
entityhuman.j(0.025F);
|
||||
if (this.q_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
|
||||
ItemStack itemstack = this.c_(l);
|
||||
if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
|
||||
ItemStack itemstack = this.f_(l);
|
||||
|
||||
if (itemstack != null) {
|
||||
this.a(world, i, j, k, itemstack);
|
||||
}
|
||||
} else {
|
||||
if (world.worldProvider.d) {
|
||||
if (world.worldProvider.e) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory);
|
||||
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
|
||||
|
||||
this.c(world, i, j, k, l, i1);
|
||||
Material material = world.getMaterial(i, j - 1, k);
|
||||
@ -49,7 +49,7 @@ public class BlockIce extends BlockHalfTransparant {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.worldProvider.d) {
|
||||
if (world.worldProvider.e) {
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return;
|
||||
}
|
||||
@ -59,7 +59,7 @@ public class BlockIce extends BlockHalfTransparant {
|
||||
}
|
||||
}
|
||||
|
||||
public int e() {
|
||||
public int q_() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,13 @@ import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
|
||||
|
||||
public class BlockLeaves extends BlockTransparant {
|
||||
|
||||
private int cr;
|
||||
private int cD;
|
||||
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.cr = j;
|
||||
this.cD = j;
|
||||
this.b(true);
|
||||
this.a(CreativeModeTab.c);
|
||||
}
|
||||
@ -21,7 +21,7 @@ public class BlockLeaves extends BlockTransparant {
|
||||
byte b0 = 1;
|
||||
int j1 = b0 + 1;
|
||||
|
||||
if (world.c(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
|
||||
if (world.d(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) {
|
||||
@ -55,7 +55,7 @@ public class BlockLeaves extends BlockTransparant {
|
||||
|
||||
int l1;
|
||||
|
||||
if (world.c(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
|
||||
if (world.d(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
|
||||
int i2;
|
||||
int j2;
|
||||
int k2;
|
||||
@ -163,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.bC() != null && entityhuman.bC().id == Item.SHEARS.id) {
|
||||
if (!world.isStatic && entityhuman.bP() != null && entityhuman.bP().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,11 +171,11 @@ public class BlockLeaves extends BlockTransparant {
|
||||
}
|
||||
}
|
||||
|
||||
protected int getDropData(int i) {
|
||||
public int getDropData(int i) {
|
||||
return i & 3;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return !this.c;
|
||||
}
|
||||
|
||||
|
@ -13,15 +13,15 @@ public class BlockLever extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@ -173,9 +173,7 @@ 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, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (world.isStatic) {
|
||||
@ -199,7 +197,7 @@ public class BlockLever extends Block {
|
||||
// CraftBukkit end
|
||||
|
||||
world.setData(i, j, k, j1 + k1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.e(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 (j1 == 1) {
|
||||
@ -247,12 +245,12 @@ public class BlockLever extends Block {
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.getData(i, j, k) & 8) > 0;
|
||||
}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int i1 = iblockaccess.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) == 0) {
|
||||
return false;
|
||||
|
@ -12,7 +12,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) == 0) {
|
||||
this.e(world, i, j, k, l);
|
||||
this.d(world, i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,20 +35,20 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if ((l & 8) != 0) {
|
||||
this.e(world, i, j, k, l);
|
||||
this.d(world, i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.getData(i, j, k) & 8) != 0;
|
||||
}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return (world.getData(i, j, k) & 8) == 0 ? false : l == 1;
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.getData(i, j, k) & 8) == 0 ? false : l == 1;
|
||||
}
|
||||
|
||||
private void e(World world, int i, int j, int k, int l) {
|
||||
private void d(World world, int i, int j, int k, int l) {
|
||||
boolean flag = (l & 8) != 0;
|
||||
boolean flag1 = false;
|
||||
float f = 0.125F;
|
||||
@ -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.d(i, j, k, i, j, k);
|
||||
world.e(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.d(i, j, k, i, j, k);
|
||||
world.e(i, j, k, i, j, k);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class BlockMobSpawner extends BlockContainer {
|
||||
/* CraftBukkit start - delegate to getExpDrop
|
||||
int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15);
|
||||
|
||||
this.g(world, i, j, k, j1); */
|
||||
this.f(world, i, j, k, j1);*/
|
||||
}
|
||||
|
||||
public int getExpDrop(World world, int data, int enchantmentLevel) {
|
||||
@ -35,7 +35,7 @@ public class BlockMobSpawner extends BlockContainer {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class BlockMushroom extends BlockFlower {
|
||||
}
|
||||
|
||||
protected boolean d_(int i) {
|
||||
return Block.n[i];
|
||||
return Block.q[i];
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k) {
|
||||
|
@ -35,7 +35,7 @@ public class BlockNetherWart extends BlockFlower {
|
||||
return j >= 3 ? this.textureId + 2 : (j > 0 ? this.textureId + 1 : this.textureId);
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int d() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
@ -38,16 +38,16 @@ public class BlockOre extends Block {
|
||||
int j1 = 0;
|
||||
|
||||
if (this.id == Block.COAL_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 0, 2);
|
||||
j1 = MathHelper.nextInt(world.random, 0, 2);
|
||||
} else if (this.id == Block.DIAMOND_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 3, 7);
|
||||
j1 = MathHelper.nextInt(world.random, 3, 7);
|
||||
} else if (this.id == Block.EMERALD_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 3, 7);
|
||||
j1 = MathHelper.nextInt(world.random, 3, 7);
|
||||
} else if (this.id == Block.LAPIS_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 2, 5);
|
||||
j1 = MathHelper.nextInt(world.random, 2, 5);
|
||||
}
|
||||
|
||||
this.g(world, i, j, k, j1);
|
||||
this.f(world, i, j, k, j1);
|
||||
} */
|
||||
}
|
||||
|
||||
@ -56,13 +56,13 @@ public class BlockOre extends Block {
|
||||
int j1 = 0;
|
||||
|
||||
if (this.id == Block.COAL_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 0, 2);
|
||||
j1 = MathHelper.nextInt(world.random, 0, 2);
|
||||
} else if (this.id == Block.DIAMOND_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 3, 7);
|
||||
j1 = MathHelper.nextInt(world.random, 3, 7);
|
||||
} else if (this.id == Block.EMERALD_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 3, 7);
|
||||
j1 = MathHelper.nextInt(world.random, 3, 7);
|
||||
} else if (this.id == Block.LAPIS_ORE.id) {
|
||||
j1 = MathHelper.a(world.random, 2, 5);
|
||||
j1 = MathHelper.nextInt(world.random, 2, 5);
|
||||
}
|
||||
|
||||
return j1;
|
||||
@ -72,7 +72,7 @@ public class BlockOre extends Block {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected int getDropData(int i) {
|
||||
public int getDropData(int i) {
|
||||
return this.id == Block.LAPIS_ORE.id ? 4 : 0;
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ public class BlockPiston extends Block {
|
||||
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 b() {
|
||||
public int d() {
|
||||
return 16;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -64,14 +64,13 @@ public class BlockPiston extends Block {
|
||||
int i1 = e(l);
|
||||
|
||||
if (i1 != 7) {
|
||||
boolean flag = this.e(world, i, j, k, i1);
|
||||
boolean flag = this.d(world, i, j, k, i1);
|
||||
|
||||
if (flag && !f(l)) {
|
||||
// CraftBukkit start
|
||||
int length = i(world, i, j, k, i1);
|
||||
int length = h(world, i, j, k, i1);
|
||||
if (length >= 0) {
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
BlockPistonExtendEvent event = new BlockPistonExtendEvent(block, length, CraftBlock.notchToBlockFace(i1));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -85,7 +84,6 @@ public class BlockPiston extends Block {
|
||||
} else if (!flag && f(l)) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, CraftBlock.notchToBlockFace(i1));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -99,7 +97,7 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean e(World world, int i, int j, int k, int l) {
|
||||
private boolean d(World world, int i, int j, int k, int l) {
|
||||
return l != 0 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : (world.isBlockFaceIndirectlyPowered(i, j, k, 0) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 2, k, 1) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFaceIndirectlyPowered(i - 1, j + 1, k, 4) ? true : world.isBlockFaceIndirectlyPowered(i + 1, j + 1, k, 5)))))))))));
|
||||
}
|
||||
|
||||
@ -111,7 +109,7 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
|
||||
if (l == 0) {
|
||||
if (this.j(world, i, j, k, i1)) {
|
||||
if (this.i(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 {
|
||||
@ -121,7 +119,7 @@ public class BlockPiston extends Block {
|
||||
TileEntity tileentity = world.getTileEntity(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
|
||||
|
||||
if (tileentity instanceof TileEntityPiston) {
|
||||
((TileEntityPiston) tileentity).i();
|
||||
((TileEntityPiston) tileentity).f();
|
||||
}
|
||||
|
||||
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
|
||||
@ -141,15 +139,15 @@ public class BlockPiston extends Block {
|
||||
TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1;
|
||||
|
||||
if (tileentitypiston.c() == i1 && tileentitypiston.b()) {
|
||||
tileentitypiston.i();
|
||||
tileentitypiston.f();
|
||||
i2 = tileentitypiston.a();
|
||||
j2 = tileentitypiston.n();
|
||||
j2 = tileentitypiston.p();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].e() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
|
||||
if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].q_() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
|
||||
i += Facing.b[i1];
|
||||
j += Facing.c[i1];
|
||||
k += Facing.d[i1];
|
||||
@ -214,7 +212,7 @@ public class BlockPiston extends Block {
|
||||
return super.e(world, i, j, k);
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -254,11 +252,11 @@ public class BlockPiston extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.byId[i].e() == 2) {
|
||||
if (Block.byId[i].q_() == 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!flag && Block.byId[i].e() == 1) {
|
||||
if (!flag && Block.byId[i].q_() == 1) {
|
||||
return false;
|
||||
}
|
||||
} else if (f(world.getData(j, k, l))) {
|
||||
@ -269,8 +267,8 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit - change return from boolean to int
|
||||
private static int i(World world, int i, int j, int k, int l) {
|
||||
// CraftBukkit - boolean -> int return
|
||||
private static int h(World world, int i, int j, int k, int l) {
|
||||
int i1 = i + Facing.b[l];
|
||||
int j1 = j + Facing.c[l];
|
||||
int k1 = k + Facing.d[l];
|
||||
@ -289,7 +287,7 @@ public class BlockPiston extends Block {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
if (Block.byId[i2].e() != 1) {
|
||||
if (Block.byId[i2].q_() != 1) {
|
||||
if (l1 == 12) {
|
||||
return -1; // CraftBukkit
|
||||
}
|
||||
@ -307,7 +305,7 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean j(World world, int i, int j, int k, int l) {
|
||||
private boolean i(World world, int i, int j, int k, int l) {
|
||||
int i1 = i + Facing.b[l];
|
||||
int j1 = j + Facing.c[l];
|
||||
int k1 = k + Facing.d[l];
|
||||
@ -327,7 +325,7 @@ public class BlockPiston extends Block {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Block.byId[i2].e() != 1) {
|
||||
if (Block.byId[i2].q_() != 1) {
|
||||
if (l1 == 12) {
|
||||
return false;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class BlockPistonExtension extends Block {
|
||||
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fixed a piston AIOOBE issue
|
||||
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
|
||||
int j1 = Facing.OPPOSITE_FACING[f(i1)];
|
||||
|
||||
i += Facing.b[j1];
|
||||
@ -38,15 +38,15 @@ public class BlockPistonExtension extends Block {
|
||||
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 b() {
|
||||
public int d() {
|
||||
return 17;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ public class BlockPistonExtension extends Block {
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
int i1 = f(world.getData(i, j, k));
|
||||
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fixed a piston AIOOBE issue
|
||||
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
|
||||
int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
|
||||
|
||||
if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
|
||||
|
@ -24,7 +24,11 @@ public class BlockPortal extends BlockHalfTransparant {
|
||||
}
|
||||
|
||||
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);
|
||||
Entity entity = ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
|
||||
|
||||
if (entity != null) {
|
||||
entity.an = entity.ab();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -48,11 +52,11 @@ public class BlockPortal extends BlockHalfTransparant {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -22,7 +23,7 @@ public class BlockPressurePlate extends Block {
|
||||
this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@ -30,11 +31,11 @@ public class BlockPressurePlate extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -94,7 +95,16 @@ public class BlockPressurePlate extends Block {
|
||||
}
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
flag1 = true;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (!entity.au()) {
|
||||
flag1 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start - Interact Pressure Plate
|
||||
@ -134,7 +144,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.d(i, j, k, i, j, k);
|
||||
world.e(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
}
|
||||
|
||||
@ -142,12 +152,12 @@ 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.d(i, j, k, i, j, k);
|
||||
world.e(i, j, k, i, j, k);
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,12 +181,12 @@ public class BlockPressurePlate extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return iblockaccess.getData(i, j, k) > 0;
|
||||
}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return world.getData(i, j, k) == 0 ? false : l == 1;
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return iblockaccess.getData(i, j, k) == 0 ? false : l == 1;
|
||||
}
|
||||
|
||||
public boolean isPowerSource() {
|
||||
@ -191,7 +201,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 e() {
|
||||
public int q_() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
}
|
||||
|
||||
for (int l = 0; l < 120; ++l) {
|
||||
world.a("snowshovel", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 2.5D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle("snowshovel", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 2.5D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
} else if (world.getTypeId(i, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.IRON_BLOCK.id) {
|
||||
boolean flag = world.getTypeId(i - 1, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i + 1, j - 1, k) == Block.IRON_BLOCK.id;
|
||||
@ -84,11 +84,11 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
|
||||
EntityIronGolem entityirongolem = new EntityIronGolem(world);
|
||||
|
||||
entityirongolem.f(true);
|
||||
entityirongolem.setPlayerCreated(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) {
|
||||
world.a("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
blockList.updateList();
|
||||
|
@ -17,7 +17,7 @@ public class BlockRedstoneOre extends Block {
|
||||
this.a = flag;
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class BlockRedstoneOre extends Block {
|
||||
if (this.getDropType(l, world.random, i1) != this.id) {
|
||||
int j1 = 1 + world.random.nextInt(5);
|
||||
|
||||
this.g(world, i, j, k, j1);
|
||||
this.f(world, i, j, k, j1);
|
||||
} */
|
||||
}
|
||||
|
||||
@ -130,12 +130,12 @@ public class BlockRedstoneOre extends Block {
|
||||
}
|
||||
|
||||
if (d1 < (double) i || d1 > (double) (i + 1) || d2 < 0.0D || d2 > (double) (j + 1) || d3 < (double) k || d3 > (double) (k + 1)) {
|
||||
world.a("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle("reddust", d1, d2, d3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ItemStack c_(int i) {
|
||||
protected ItemStack f_(int i) {
|
||||
return new ItemStack(Block.REDSTONE_ORE);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
this.a((CreativeModeTab) null);
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (!this.isOn) {
|
||||
return false;
|
||||
} else {
|
||||
@ -134,7 +134,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
double d1 = (double) j + random.nextDouble() * 0.6D + 0.2D;
|
||||
double d2 = (double) k + random.nextDouble() * 0.6D + 0.2D;
|
||||
|
||||
world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -155,11 +155,11 @@ 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.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return l == 0 ? this.a(world, i, j, k, l) : false;
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return l == 0 ? this.b(iblockaccess, i, j, k, l) : false;
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
@ -169,15 +169,4 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,15 +26,15 @@ public class BlockRedstoneWire extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ public class BlockRedstoneWire extends Block {
|
||||
if (k1 != l1) {
|
||||
world.suppressPhysics = true;
|
||||
world.setData(i, j, k, l1);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.e(i, j, k, i, j, k);
|
||||
world.suppressPhysics = false;
|
||||
|
||||
for (i2 = 0; i2 < 4; ++i2) {
|
||||
@ -305,11 +305,11 @@ public class BlockRedstoneWire extends Block {
|
||||
return Item.REDSTONE.id;
|
||||
}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
return !this.a ? false : this.a(world, i, j, k, l);
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return !this.a ? false : this.b(iblockaccess, i, j, k, l);
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (!this.a) {
|
||||
return false;
|
||||
} else if (iblockaccess.getData(i, j, k) == 0) {
|
||||
@ -317,25 +317,25 @@ public class BlockRedstoneWire extends Block {
|
||||
} else if (l == 1) {
|
||||
return true;
|
||||
} else {
|
||||
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);
|
||||
boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.s(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
|
||||
boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.s(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
|
||||
boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.s(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
|
||||
boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.s(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
|
||||
|
||||
if (!iblockaccess.s(i, j + 1, k)) {
|
||||
if (iblockaccess.s(i - 1, j, k) && f(iblockaccess, i - 1, j + 1, k, -1)) {
|
||||
if (iblockaccess.s(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.s(i + 1, j, k) && f(iblockaccess, i + 1, j + 1, k, -1)) {
|
||||
if (iblockaccess.s(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.s(i, j, k - 1) && f(iblockaccess, i, j + 1, k - 1, -1)) {
|
||||
if (iblockaccess.s(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
if (iblockaccess.s(i, j, k + 1) && f(iblockaccess, i, j + 1, k + 1, -1)) {
|
||||
if (iblockaccess.s(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
|
||||
flag3 = true;
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ public class BlockRedstoneWire extends Block {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public static boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int i1 = iblockaccess.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == Block.REDSTONE_WIRE.id) {
|
||||
@ -360,12 +360,12 @@ public class BlockRedstoneWire extends Block {
|
||||
} else {
|
||||
int j1 = iblockaccess.getData(i, j, k);
|
||||
|
||||
return l == (j1 & 3) || l == Direction.e[j1 & 3];
|
||||
return l == (j1 & 3) || l == Direction.f[j1 & 3];
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (e(iblockaccess, i, j, k, l)) {
|
||||
public static boolean g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (f(iblockaccess, i, j, k, l)) {
|
||||
return true;
|
||||
} else {
|
||||
int i1 = iblockaccess.getTypeId(i, j, k);
|
||||
|
@ -63,15 +63,15 @@ public class BlockReed extends Block {
|
||||
return Item.SUGAR_CANE.id;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,16 @@ public class BlockSand extends Block {
|
||||
this.a(CreativeModeTab.b);
|
||||
}
|
||||
|
||||
public BlockSand(int i, int j, Material material) {
|
||||
super(i, j, material);
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
|
||||
public void b(World world, int i, int j, int k, Random random) {
|
||||
@ -29,11 +33,11 @@ public class BlockSand extends Block {
|
||||
if (canFall(world, i, j - 1, k) && j >= 0) {
|
||||
byte b0 = 32;
|
||||
|
||||
if (!instaFall && world.c(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
if (!instaFall && world.d(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
|
||||
if (!world.isStatic) {
|
||||
// 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));
|
||||
|
||||
this.a(entityfallingblock);
|
||||
world.addEntity(entityfallingblock);
|
||||
}
|
||||
} else {
|
||||
@ -50,7 +54,9 @@ public class BlockSand extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
protected void a(EntityFallingBlock entityfallingblock) {}
|
||||
|
||||
public int r_() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ -67,4 +73,6 @@ public class BlockSand extends Block {
|
||||
return material == Material.WATER ? true : material == Material.LAVA;
|
||||
}
|
||||
}
|
||||
|
||||
public void a_(World world, int i, int j, int k, int l) {}
|
||||
}
|
||||
|
@ -62,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.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)) {
|
||||
if (this.d(world, i + i1, j, k + j1, 3) && this.d(world, i + i1 + 1, j, k + j1, 3) && this.d(world, i + i1, j, k + j1 + 1, 3) && this.d(world, i + i1 + 1, j, k + j1 + 1, 3)) {
|
||||
treeType = TreeType.JUNGLE;
|
||||
gen = new WorldGenMegaTree(false, 10 + random.nextInt(20), 3, 3);
|
||||
flag = true;
|
||||
@ -128,11 +128,11 @@ public class BlockSapling extends BlockFlower {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean e(World world, int i, int j, int k, int l) {
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
return world.getTypeId(i, j, k) == this.id && (world.getData(i, j, k) & 3) == l;
|
||||
}
|
||||
|
||||
protected int getDropData(int i) {
|
||||
public int getDropData(int i) {
|
||||
return i & 3;
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ public class BlockSign extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int d() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ public class BlockSign extends BlockContainer {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
198
src/main/java/net/minecraft/server/BlockSkull.java
Normale Datei
198
src/main/java/net/minecraft/server/BlockSkull.java
Normale Datei
@ -0,0 +1,198 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockSkull extends BlockContainer {
|
||||
|
||||
protected BlockSkull(int i) {
|
||||
super(i, Material.ORIENTABLE);
|
||||
this.textureId = 104;
|
||||
this.a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
int l = iblockaccess.getData(i, j, k) & 7;
|
||||
|
||||
switch (l) {
|
||||
case 1:
|
||||
default:
|
||||
this.a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.a(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this.a(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
this.a(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
this.a(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F);
|
||||
}
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
this.updateShape(world, i, j, k);
|
||||
return super.e(world, i, j, k);
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
|
||||
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 2.5D) & 3;
|
||||
|
||||
world.setData(i, j, k, l);
|
||||
}
|
||||
|
||||
public TileEntity a(World world) {
|
||||
return new TileEntitySkull();
|
||||
}
|
||||
|
||||
public int getDropData(World world, int i, int j, int k) {
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
|
||||
return tileentity != null && tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).a() : super.getDropData(world, i, j, k);
|
||||
}
|
||||
|
||||
public int getDropData(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {}
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
|
||||
if (entityhuman.abilities.canInstantlyBuild) {
|
||||
l |= 8;
|
||||
world.setData(i, j, k, l);
|
||||
}
|
||||
|
||||
super.a(world, i, j, k, l, entityhuman);
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
if (!world.isStatic) {
|
||||
if ((i1 & 8) == 0) {
|
||||
this.a(world, i, j, k, new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k)));
|
||||
}
|
||||
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
return Item.SKULL.id;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, TileEntitySkull tileentityskull) {
|
||||
if (tileentityskull.a() == 1 && j >= 2) {
|
||||
int l = Block.SOUL_SAND.id;
|
||||
|
||||
int i1;
|
||||
EntityWither entitywither;
|
||||
int j1;
|
||||
|
||||
for (i1 = -2; i1 <= 0; ++i1) {
|
||||
if (world.getTypeId(i, j - 1, k + i1) == l && world.getTypeId(i, j - 1, k + i1 + 1) == l && world.getTypeId(i, j - 2, k + i1 + 1) == l && world.getTypeId(i, j - 1, k + i1 + 2) == l && this.d(world, i, j, k + i1, 1) && this.d(world, i, j, k + i1 + 1, 1) && this.d(world, i, j, k + i1 + 2, 1)) {
|
||||
// CraftBukkit start - use BlockStateListPopulator
|
||||
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
|
||||
world.setRawData(i, j, k + i1, 8);
|
||||
world.setRawData(i, j, k + i1 + 1, 8);
|
||||
world.setRawData(i, j, k + i1 + 2, 8);
|
||||
|
||||
blockList.setTypeId(i, j, k + i1, 0);
|
||||
blockList.setTypeId(i, j, k + i1 + 1, 0);
|
||||
blockList.setTypeId(i, j, k + i1 + 2, 0);
|
||||
blockList.setTypeId(i, j - 1, k + i1, 0);
|
||||
blockList.setTypeId(i, j - 1, k + i1 + 1, 0);
|
||||
blockList.setTypeId(i, j - 1, k + i1 + 2, 0);
|
||||
blockList.setTypeId(i, j - 2, k + i1 + 1, 0);
|
||||
|
||||
if (!world.isStatic) {
|
||||
entitywither = new EntityWither(world);
|
||||
entitywither.setPositionRotation((double) i + 0.5D, (double) j - 1.45D, (double) (k + i1) + 1.5D, 90.0F, 0.0F);
|
||||
entitywither.aw = 90.0F;
|
||||
entitywither.m();
|
||||
|
||||
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
blockList.updateList();
|
||||
}
|
||||
}
|
||||
|
||||
for (j1 = 0; j1 < 120; ++j1) {
|
||||
world.addParticle("snowballpoof", (double) i + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) (k + i1 + 1) + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i1 = -2; i1 <= 0; ++i1) {
|
||||
if (world.getTypeId(i + i1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 2, k) == l && world.getTypeId(i + i1 + 2, j - 1, k) == l && this.d(world, i + i1, j, k, 1) && this.d(world, i + i1 + 1, j, k, 1) && this.d(world, i + i1 + 2, j, k, 1)) {
|
||||
// CraftBukkit start - use BlockStateListPopulator
|
||||
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
|
||||
world.setRawData(i + i1, j, k, 8);
|
||||
world.setRawData(i + i1 + 1, j, k, 8);
|
||||
world.setRawData(i + i1 + 2, j, k, 8);
|
||||
|
||||
blockList.setTypeId(i + i1, j, k, 0);
|
||||
blockList.setTypeId(i + i1 + 1, j, k, 0);
|
||||
blockList.setTypeId(i + i1 + 2, j, k, 0);
|
||||
blockList.setTypeId(i + i1, j - 1, k, 0);
|
||||
blockList.setTypeId(i + i1 + 1, j - 1, k, 0);
|
||||
blockList.setTypeId(i + i1 + 2, j - 1, k, 0);
|
||||
blockList.setTypeId(i + i1 + 1, j - 2, k, 0);
|
||||
|
||||
if (!world.isStatic) {
|
||||
entitywither = new EntityWither(world);
|
||||
entitywither.setPositionRotation((double) (i + i1) + 1.5D, (double) j - 1.45D, (double) k + 0.5D, 0.0F, 0.0F);
|
||||
entitywither.m();
|
||||
|
||||
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
|
||||
blockList.updateList();
|
||||
}
|
||||
}
|
||||
|
||||
for (j1 = 0; j1 < 120; ++j1) {
|
||||
world.addParticle("snowballpoof", (double) (i + i1 + 1) + world.random.nextDouble(), (double) (j - 2) + world.random.nextDouble() * 3.9D, (double) k + world.random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean d(World world, int i, int j, int k, int l) {
|
||||
if (world.getTypeId(i, j, k) != this.id) {
|
||||
return false;
|
||||
} else {
|
||||
TileEntity tileentity = world.getTileEntity(i, j, k);
|
||||
|
||||
return tileentity != null && tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).a() == l : false;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,11 +17,11 @@ public class BlockSnow extends Block {
|
||||
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 d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ 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].d()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
|
||||
return l != 0 && (l == Block.LEAVES.id || Block.byId[l].c()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
@ -55,14 +55,8 @@ public class BlockSnow extends Block {
|
||||
|
||||
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
int i1 = Item.SNOW_BALL.id;
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(i1, 1, 0));
|
||||
|
||||
entityitem.pickupDelay = 10;
|
||||
world.addEntity(entityitem);
|
||||
this.a(world, i, j, k, new ItemStack(i1, 1, 0));
|
||||
world.setTypeId(i, j, k, 0);
|
||||
entityhuman.a(StatisticList.C[this.id], 1);
|
||||
}
|
||||
|
@ -18,11 +18,11 @@ public class BlockSoil extends Block {
|
||||
return AxisAlignedBB.a().a((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ public class BlockStationary extends BlockFluids {
|
||||
|
||||
world.suppressPhysics = true;
|
||||
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
|
||||
world.d(i, j, k, i, j, k);
|
||||
world.a(i, j, k, this.id - 1, this.p_());
|
||||
world.e(i, j, k, i, j, k);
|
||||
world.a(i, j, k, this.id - 1, this.r_());
|
||||
world.suppressPhysics = false;
|
||||
}
|
||||
|
||||
|
@ -142,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 b() {
|
||||
public int d() {
|
||||
return 19;
|
||||
}
|
||||
|
||||
@ -161,14 +161,7 @@ public class BlockStem extends BlockFlower {
|
||||
|
||||
for (int j1 = 0; j1 < 3; ++j1) {
|
||||
if (world.random.nextInt(15) <= l) {
|
||||
float f1 = 0.7F;
|
||||
float f2 = world.random.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
float f3 = world.random.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
float f4 = world.random.nextFloat() * f1 + (1.0F - f1) * 0.5F;
|
||||
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f2), (double) ((float) j + f3), (double) ((float) k + f4), new ItemStack(item));
|
||||
|
||||
entityitem.pickupDelay = 10;
|
||||
world.addEntity(entityitem);
|
||||
this.a(world, i, j, k, new ItemStack(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class BlockTNT extends Block {
|
||||
}
|
||||
|
||||
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) {
|
||||
if (entityhuman.bP() != null && entityhuman.bP().id == Item.FLINT_AND_STEEL.id) {
|
||||
this.postBreak(world, i, j, k, 1);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
return true;
|
||||
@ -62,7 +62,14 @@ public class BlockTNT extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
protected ItemStack c_(int i) {
|
||||
return null;
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
if (entity instanceof EntityArrow && !world.isStatic) {
|
||||
EntityArrow entityarrow = (EntityArrow) entity;
|
||||
|
||||
if (entityarrow.isBurning()) {
|
||||
this.postBreak(world, i, j, k, 1);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,11 +18,11 @@ public class BlockTrapdoor extends Block {
|
||||
this.a(CreativeModeTab.d);
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class BlockTrapdoor extends Block {
|
||||
return !g(iblockaccess.getData(i, j, k));
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int d() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -52,7 +52,12 @@ public class BlockTrapdoor extends Block {
|
||||
public void e(int i) {
|
||||
float f = 0.1875F;
|
||||
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
if ((i & 8) != 0) {
|
||||
this.a(0.0F, 1.0F - f, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
} else {
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||
}
|
||||
|
||||
if (g(i)) {
|
||||
if ((i & 3) == 0) {
|
||||
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
|
||||
@ -72,9 +77,7 @@ 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, 0, 0.0F, 0.0F, 0.0F);
|
||||
}
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
if (this.material == Material.ORE) {
|
||||
@ -150,25 +153,31 @@ public class BlockTrapdoor extends Block {
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l, float f, float f1, float f2) {
|
||||
byte b0 = 0;
|
||||
int i1 = 0;
|
||||
|
||||
if (l == 2) {
|
||||
b0 = 0;
|
||||
i1 = 0;
|
||||
}
|
||||
|
||||
if (l == 3) {
|
||||
b0 = 1;
|
||||
i1 = 1;
|
||||
}
|
||||
|
||||
if (l == 4) {
|
||||
b0 = 2;
|
||||
i1 = 2;
|
||||
}
|
||||
|
||||
if (l == 5) {
|
||||
b0 = 3;
|
||||
i1 = 3;
|
||||
}
|
||||
|
||||
world.setData(i, j, k, b0);
|
||||
int j1 = Block.TRAP_DOOR.id;
|
||||
|
||||
if (l != 1 && l != 0 && f1 > 0.5F) {
|
||||
i1 |= 8;
|
||||
}
|
||||
|
||||
world.setTypeIdAndData(i, j, k, j1, i1);
|
||||
doPhysics(world, i, j, k, Block.REDSTONE_WIRE.id); // CraftBukkit
|
||||
}
|
||||
|
||||
@ -208,7 +217,7 @@ public class BlockTrapdoor extends Block {
|
||||
} else {
|
||||
Block block = Block.byId[i];
|
||||
|
||||
return block != null && block.material.k() && block.c() || block == Block.GLOWSTONE;
|
||||
return block != null && block.material.k() && block.b() || block == Block.GLOWSTONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -13,7 +14,7 @@ public class BlockTripwire extends Block {
|
||||
this.b(true);
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ -21,15 +22,15 @@ public class BlockTripwire extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return 30;
|
||||
}
|
||||
|
||||
@ -66,22 +67,22 @@ public class BlockTripwire extends Block {
|
||||
int l = world.t(i, j - 1, k) ? 0 : 2;
|
||||
|
||||
world.setData(i, j, k, l);
|
||||
this.e(world, i, j, k, l);
|
||||
this.d(world, i, j, k, l);
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k, int l, int i1) {
|
||||
this.e(world, i, j, k, i1 | 1);
|
||||
this.d(world, i, j, k, i1 | 1);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
|
||||
if (!world.isStatic) {
|
||||
if (entityhuman.bC() != null && entityhuman.bC().id == Item.SHEARS.id) {
|
||||
if (entityhuman.bP() != null && entityhuman.bP().id == Item.SHEARS.id) {
|
||||
world.setData(i, j, k, l | 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void e(World world, int i, int j, int k, int l) {
|
||||
private void d(World world, int i, int j, int k, int l) {
|
||||
int i1 = 0;
|
||||
|
||||
while (i1 < 2) {
|
||||
@ -96,7 +97,7 @@ public class BlockTripwire extends Block {
|
||||
if (i2 == Block.TRIPWIRE_SOURCE.id) {
|
||||
int j2 = world.getData(k1, j, l1) & 3;
|
||||
|
||||
if (j2 == Direction.e[i1]) {
|
||||
if (j2 == Direction.f[i1]) {
|
||||
Block.TRIPWIRE_SOURCE.a(world, k1, j, l1, i2, world.getData(k1, j, l1), true, j1, l);
|
||||
}
|
||||
} else if (i2 == Block.TRIPWIRE.id) {
|
||||
@ -134,7 +135,16 @@ public class BlockTripwire extends Block {
|
||||
List list = world.getEntities((Entity) null, 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));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
flag1 = true;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (!entity.au()) {
|
||||
flag1 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@ -175,11 +185,11 @@ public class BlockTripwire extends Block {
|
||||
|
||||
if (flag1 != flag) {
|
||||
world.setData(i, j, k, l);
|
||||
this.e(world, i, j, k, l);
|
||||
this.d(world, i, j, k, l);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
world.a(i, j, k, this.id, this.p_());
|
||||
world.a(i, j, k, this.id, this.r_());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,19 +16,19 @@ public class BlockTripwireHook extends Block {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return 29;
|
||||
}
|
||||
|
||||
public int p_() {
|
||||
public int r_() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ public class BlockTripwireHook extends Block {
|
||||
j3 = world.getTypeId(l2, j, k3);
|
||||
if (j3 == Block.TRIPWIRE_SOURCE.id) {
|
||||
l3 = world.getData(l2, j, k3);
|
||||
if ((l3 & 3) == Direction.e[l1]) {
|
||||
if ((l3 & 3) == Direction.f[l1]) {
|
||||
k2 = i3;
|
||||
}
|
||||
break;
|
||||
@ -136,7 +136,7 @@ public class BlockTripwireHook extends Block {
|
||||
flag4 |= flag6 && flag7;
|
||||
aint[i3] = l3;
|
||||
if (i3 == j1) {
|
||||
world.a(i, j, k, l, this.p_());
|
||||
world.a(i, j, k, l, this.r_());
|
||||
flag3 &= flag6;
|
||||
}
|
||||
}
|
||||
@ -149,9 +149,9 @@ public class BlockTripwireHook extends Block {
|
||||
if (k2 > 0) {
|
||||
l2 = i + i2 * k2;
|
||||
k3 = k + j2 * k2;
|
||||
j3 = Direction.e[l1];
|
||||
j3 = Direction.f[l1];
|
||||
world.setData(l2, j, k3, j3 | i3);
|
||||
this.e(world, l2, j, k3, j3);
|
||||
this.d(world, l2, j, k3, j3);
|
||||
this.a(world, l2, j, k3, flag3, flag4, flag1, flag2);
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ public class BlockTripwireHook extends Block {
|
||||
if (l > 0) {
|
||||
world.setData(i, j, k, i1);
|
||||
if (flag) {
|
||||
this.e(world, i, j, k, l1);
|
||||
this.d(world, i, j, k, l1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ public class BlockTripwireHook extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
private void e(World world, int i, int j, int k, int l) {
|
||||
private void d(World world, int i, int j, int k, int l) {
|
||||
world.applyPhysics(i, j, k, this.id);
|
||||
if (l == 3) {
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
@ -272,12 +272,12 @@ public class BlockTripwireHook extends Block {
|
||||
super.remove(world, i, j, k, l, i1);
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
return (iblockaccess.getData(i, j, k) & 8) == 8;
|
||||
}
|
||||
|
||||
public boolean c(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int i1 = iblockaccess.getData(i, j, k);
|
||||
|
||||
if ((i1 & 8) != 8) {
|
||||
return false;
|
||||
|
@ -17,7 +17,7 @@ public class Chunk {
|
||||
|
||||
public static boolean a;
|
||||
private ChunkSection[] sections;
|
||||
private byte[] r;
|
||||
private byte[] s;
|
||||
public int[] b;
|
||||
public boolean[] c;
|
||||
public boolean d;
|
||||
@ -25,7 +25,7 @@ public class Chunk {
|
||||
public int[] heightMap;
|
||||
public final int x;
|
||||
public final int z;
|
||||
private boolean s;
|
||||
private boolean t;
|
||||
public Map tileEntities;
|
||||
public List[] entitySlices;
|
||||
public boolean done;
|
||||
@ -33,23 +33,25 @@ public class Chunk {
|
||||
public boolean m;
|
||||
public long n;
|
||||
public boolean seenByPlayer;
|
||||
private int t;
|
||||
boolean p;
|
||||
public int p;
|
||||
private int u;
|
||||
boolean q;
|
||||
|
||||
public Chunk(World world, int i, int j) {
|
||||
this.sections = new ChunkSection[16];
|
||||
this.r = new byte[256];
|
||||
this.s = new byte[256];
|
||||
this.b = new int[256];
|
||||
this.c = new boolean[256];
|
||||
this.s = false;
|
||||
this.t = false;
|
||||
this.tileEntities = new HashMap();
|
||||
this.done = false;
|
||||
this.l = false;
|
||||
this.m = false;
|
||||
this.n = 0L;
|
||||
this.seenByPlayer = false;
|
||||
this.t = 4096;
|
||||
this.p = false;
|
||||
this.p = 0;
|
||||
this.u = 4096;
|
||||
this.q = false;
|
||||
this.entitySlices = new List[16];
|
||||
this.world = world;
|
||||
this.x = i;
|
||||
@ -61,7 +63,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
Arrays.fill(this.b, -999);
|
||||
Arrays.fill(this.r, (byte) -1);
|
||||
Arrays.fill(this.s, (byte) -1);
|
||||
|
||||
// CraftBukkit start
|
||||
if (!(this instanceof EmptyChunk)) {
|
||||
@ -121,6 +123,8 @@ public class Chunk {
|
||||
public void initLighting() {
|
||||
int i = this.h();
|
||||
|
||||
this.p = Integer.MAX_VALUE;
|
||||
|
||||
int j;
|
||||
int k;
|
||||
|
||||
@ -139,9 +143,12 @@ public class Chunk {
|
||||
}
|
||||
|
||||
this.heightMap[k << 4 | j] = l;
|
||||
if (l < this.p) {
|
||||
this.p = l;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.world.worldProvider.e) {
|
||||
if (!this.world.worldProvider.f) {
|
||||
l = 15;
|
||||
int i1 = i + 16 - 1;
|
||||
|
||||
@ -177,7 +184,7 @@ public class Chunk {
|
||||
|
||||
private void e(int i, int j) {
|
||||
this.c[i + j * 16] = true;
|
||||
this.s = true;
|
||||
this.t = true;
|
||||
}
|
||||
|
||||
private void q() {
|
||||
@ -190,10 +197,10 @@ public class Chunk {
|
||||
int k = this.b(i, j);
|
||||
int l = this.x * 16 + i;
|
||||
int i1 = this.z * 16 + j;
|
||||
int j1 = this.world.getHighestBlockYAt(l - 1, i1);
|
||||
int k1 = this.world.getHighestBlockYAt(l + 1, i1);
|
||||
int l1 = this.world.getHighestBlockYAt(l, i1 - 1);
|
||||
int i2 = this.world.getHighestBlockYAt(l, i1 + 1);
|
||||
int j1 = this.world.g(l - 1, i1);
|
||||
int k1 = this.world.g(l + 1, i1);
|
||||
int l1 = this.world.g(l, i1 - 1);
|
||||
int i2 = this.world.g(l, i1 + 1);
|
||||
|
||||
if (k1 < j1) {
|
||||
j1 = k1;
|
||||
@ -216,7 +223,7 @@ public class Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
this.s = false;
|
||||
this.t = false;
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
@ -262,7 +269,7 @@ public class Chunk {
|
||||
int l1;
|
||||
int i2;
|
||||
|
||||
if (!this.world.worldProvider.e) {
|
||||
if (!this.world.worldProvider.f) {
|
||||
ChunkSection chunksection;
|
||||
|
||||
if (i1 < l) {
|
||||
@ -314,7 +321,11 @@ public class Chunk {
|
||||
j2 = l;
|
||||
}
|
||||
|
||||
if (!this.world.worldProvider.e) {
|
||||
if (l1 < this.p) {
|
||||
this.p = l1;
|
||||
}
|
||||
|
||||
if (!this.world.worldProvider.f) {
|
||||
this.d(j1 - 1, k1, i2, j2);
|
||||
this.d(j1 + 1, k1, i2, j2);
|
||||
this.d(j1, k1 - 1, i2, j2);
|
||||
@ -384,7 +395,7 @@ public class Chunk {
|
||||
int k2 = this.z * 16 + k;
|
||||
|
||||
if (l1 != 0 && !this.world.isStatic) {
|
||||
Block.byId[l1].h(this.world, j2, j, k2, i2);
|
||||
Block.byId[l1].g(this.world, j2, j, k2, i2);
|
||||
}
|
||||
|
||||
chunksection.a(i, j & 15, k, l);
|
||||
@ -494,7 +505,7 @@ public class Chunk {
|
||||
|
||||
this.l = true;
|
||||
if (enumskyblock == EnumSkyBlock.SKY) {
|
||||
if (!this.world.worldProvider.e) {
|
||||
if (!this.world.worldProvider.f) {
|
||||
chunksection.c(i, j & 15, k, l);
|
||||
}
|
||||
} else if (enumskyblock == EnumSkyBlock.BLOCK) {
|
||||
@ -506,9 +517,9 @@ public class Chunk {
|
||||
ChunkSection chunksection = this.sections[j >> 4];
|
||||
|
||||
if (chunksection == null) {
|
||||
return !this.world.worldProvider.e && l < EnumSkyBlock.SKY.c ? EnumSkyBlock.SKY.c - l : 0;
|
||||
return !this.world.worldProvider.f && l < EnumSkyBlock.SKY.c ? EnumSkyBlock.SKY.c - l : 0;
|
||||
} else {
|
||||
int i1 = this.world.worldProvider.e ? 0 : chunksection.c(i, j & 15, k);
|
||||
int i1 = this.world.worldProvider.f ? 0 : chunksection.c(i, j & 15, k);
|
||||
|
||||
if (i1 > 0) {
|
||||
a = true;
|
||||
@ -548,15 +559,15 @@ public class Chunk {
|
||||
k = this.entitySlices.length - 1;
|
||||
}
|
||||
|
||||
entity.ag = true;
|
||||
entity.ah = this.x;
|
||||
entity.ai = k;
|
||||
entity.aj = this.z;
|
||||
entity.ah = true;
|
||||
entity.ai = this.x;
|
||||
entity.aj = k;
|
||||
entity.ak = this.z;
|
||||
this.entitySlices[k].add(entity);
|
||||
}
|
||||
|
||||
public void b(Entity entity) {
|
||||
this.a(entity, entity.ai);
|
||||
this.a(entity, entity.aj);
|
||||
}
|
||||
|
||||
public void a(Entity entity, int i) {
|
||||
@ -582,7 +593,7 @@ public class Chunk {
|
||||
if (tileentity == null) {
|
||||
int l = this.getTypeId(i, j, k);
|
||||
|
||||
if (l <= 0 || !Block.byId[l].s()) {
|
||||
if (l <= 0 || !Block.byId[l].u()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -594,7 +605,7 @@ public class Chunk {
|
||||
tileentity = (TileEntity) this.tileEntities.get(chunkposition);
|
||||
}
|
||||
|
||||
if (tileentity != null && tileentity.p()) {
|
||||
if (tileentity != null && tileentity.r()) {
|
||||
this.tileEntities.remove(chunkposition);
|
||||
return null;
|
||||
} else {
|
||||
@ -616,14 +627,14 @@ public class Chunk {
|
||||
public void a(int i, int j, int k, TileEntity tileentity) {
|
||||
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||
|
||||
tileentity.a(this.world);
|
||||
tileentity.b(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.q();
|
||||
tileentity.s();
|
||||
this.tileEntities.put(chunkposition, tileentity);
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z
|
||||
+ " (" + org.bukkit.Material.getMaterial(getTypeId(i, j, k)) + ") where there was no entity tile!");
|
||||
@ -640,7 +651,7 @@ public class Chunk {
|
||||
TileEntity tileentity = (TileEntity) this.tileEntities.remove(chunkposition);
|
||||
|
||||
if (tileentity != null) {
|
||||
tileentity.j();
|
||||
tileentity.w_();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -718,7 +729,7 @@ public class Chunk {
|
||||
|
||||
if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
|
||||
list.add(entity1);
|
||||
Entity[] aentity = entity1.al();
|
||||
Entity[] aentity = entity1.ao();
|
||||
|
||||
if (aentity != null) {
|
||||
for (int l = 0; l < aentity.length; ++l) {
|
||||
@ -733,7 +744,7 @@ public class Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Class oclass, AxisAlignedBB axisalignedbb, List list) {
|
||||
public void a(Class oclass, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) {
|
||||
int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
|
||||
int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
|
||||
|
||||
@ -756,7 +767,7 @@ public class Chunk {
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.a(axisalignedbb)) {
|
||||
if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity))) {
|
||||
list.add(entity);
|
||||
}
|
||||
}
|
||||
@ -828,7 +839,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public void k() {
|
||||
if (this.s && !this.world.worldProvider.e) {
|
||||
if (this.t && !this.world.worldProvider.f) {
|
||||
this.q();
|
||||
}
|
||||
}
|
||||
@ -862,41 +873,41 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public BiomeBase a(int i, int j, WorldChunkManager worldchunkmanager) {
|
||||
int k = this.r[j << 4 | i] & 255;
|
||||
int k = this.s[j << 4 | i] & 255;
|
||||
|
||||
if (k == 255) {
|
||||
BiomeBase biomebase = worldchunkmanager.getBiome((this.x << 4) + i, (this.z << 4) + j);
|
||||
|
||||
k = biomebase.id;
|
||||
this.r[j << 4 | i] = (byte) (k & 255);
|
||||
this.s[j << 4 | i] = (byte) (k & 255);
|
||||
}
|
||||
|
||||
return BiomeBase.biomes[k] == null ? BiomeBase.PLAINS : BiomeBase.biomes[k];
|
||||
}
|
||||
|
||||
public byte[] m() {
|
||||
return this.r;
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public void a(byte[] abyte) {
|
||||
this.r = abyte;
|
||||
this.s = abyte;
|
||||
}
|
||||
|
||||
public void n() {
|
||||
this.t = 0;
|
||||
this.u = 0;
|
||||
}
|
||||
|
||||
public void o() {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
if (this.t >= 4096) {
|
||||
if (this.u >= 4096) {
|
||||
return;
|
||||
}
|
||||
|
||||
int j = this.t % 16;
|
||||
int k = this.t / 16 % 16;
|
||||
int l = this.t / 256;
|
||||
int j = this.u % 16;
|
||||
int k = this.u / 16 % 16;
|
||||
int l = this.u / 256;
|
||||
|
||||
++this.t;
|
||||
++this.u;
|
||||
int i1 = (this.x << 4) + k;
|
||||
int j1 = (this.z << 4) + l;
|
||||
|
||||
|
@ -146,6 +146,9 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
|
||||
if (chunk != null) {
|
||||
chunk.n = this.world.getTime();
|
||||
if (this.chunkProvider != null) {
|
||||
this.chunkProvider.recreateStructures(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
return chunk;
|
||||
@ -249,7 +252,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
if (!this.world.savingDisabled) {
|
||||
// CraftBukkit start
|
||||
Server server = this.world.getServer();
|
||||
for (int i = 0; i < 50 && !this.unloadQueue.isEmpty(); i++) {
|
||||
for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); i++) {
|
||||
long chunkcoordinates = this.unloadQueue.popFirst();
|
||||
Chunk chunk = this.chunks.get(chunkcoordinates);
|
||||
if (chunk == null) continue;
|
||||
@ -293,4 +296,6 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public int getLoadedChunks() {
|
||||
return this.chunks.values().size(); // CraftBukkit
|
||||
}
|
||||
|
||||
public void recreateStructures(int i, int j) {}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
|
||||
public void a(World world, Chunk chunk) {
|
||||
// CraftBukkit start - "handle" exception
|
||||
try {
|
||||
world.B();
|
||||
world.C();
|
||||
} catch (ExceptionWorldConflict ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -266,7 +266,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
|
||||
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.e();
|
||||
chunksection.recalcBlockCounts();
|
||||
achunksection[b1] = chunksection;
|
||||
}
|
||||
|
||||
|
@ -2,159 +2,159 @@ package net.minecraft.server;
|
||||
|
||||
public class ChunkSection {
|
||||
|
||||
private int a;
|
||||
private int b;
|
||||
private int c;
|
||||
private byte[] d;
|
||||
private NibbleArray e;
|
||||
private NibbleArray f;
|
||||
private NibbleArray g;
|
||||
private NibbleArray h;
|
||||
private int yPos;
|
||||
private int nonEmptyBlockCount;
|
||||
private int tickingBlockCount;
|
||||
private byte[] blockIds;
|
||||
private NibbleArray extBlockIds;
|
||||
private NibbleArray blockData;
|
||||
private NibbleArray blockLight;
|
||||
private NibbleArray skyLight;
|
||||
|
||||
public ChunkSection(int i) {
|
||||
this.a = i;
|
||||
this.d = new byte[4096];
|
||||
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.yPos = i;
|
||||
this.blockIds = new byte[4096];
|
||||
this.blockData = new NibbleArray(this.blockIds.length, 4);
|
||||
this.skyLight = new NibbleArray(this.blockIds.length, 4);
|
||||
this.blockLight = new NibbleArray(this.blockIds.length, 4);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public ChunkSection(int y, byte[] blkData, byte[] extBlkData) {
|
||||
this.a = y;
|
||||
this.d = blkData;
|
||||
if (extBlkData != null) {
|
||||
this.e = new NibbleArray(extBlkData, 4);
|
||||
public ChunkSection(int y, byte[] blkIds, byte[] extBlkIds) {
|
||||
this.yPos = y;
|
||||
this.blockIds = blkIds;
|
||||
if (extBlkIds != null) {
|
||||
this.extBlockIds = new NibbleArray(extBlkIds, 4);
|
||||
}
|
||||
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.e();
|
||||
this.blockData = new NibbleArray(this.blockIds.length, 4);
|
||||
this.blockLight = new NibbleArray(this.blockIds.length, 4);
|
||||
this.skyLight = new NibbleArray(this.blockIds.length, 4);
|
||||
this.recalcBlockCounts();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public int a(int i, int j, int k) {
|
||||
int l = this.d[j << 8 | k << 4 | i] & 255;
|
||||
int l = this.blockIds[j << 8 | k << 4 | i] & 255;
|
||||
|
||||
return this.e != null ? this.e.a(i, j, k) << 8 | l : l;
|
||||
return this.extBlockIds != null ? this.extBlockIds.a(i, j, k) << 8 | l : l;
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, int l) {
|
||||
int i1 = this.d[j << 8 | k << 4 | i] & 255;
|
||||
int i1 = this.blockIds[j << 8 | k << 4 | i] & 255;
|
||||
|
||||
if (this.e != null) {
|
||||
i1 |= this.e.a(i, j, k) << 8;
|
||||
if (this.extBlockIds != null) {
|
||||
i1 |= this.extBlockIds.a(i, j, k) << 8;
|
||||
}
|
||||
|
||||
if (i1 == 0 && l != 0) {
|
||||
++this.b;
|
||||
if (Block.byId[l] != null && Block.byId[l].r()) {
|
||||
++this.c;
|
||||
++this.nonEmptyBlockCount;
|
||||
if (Block.byId[l] != null && Block.byId[l].isTicking()) {
|
||||
++this.tickingBlockCount;
|
||||
}
|
||||
} else if (i1 != 0 && l == 0) {
|
||||
--this.b;
|
||||
if (Block.byId[i1] != null && Block.byId[i1].r()) {
|
||||
--this.c;
|
||||
--this.nonEmptyBlockCount;
|
||||
if (Block.byId[i1] != null && Block.byId[i1].isTicking()) {
|
||||
--this.tickingBlockCount;
|
||||
}
|
||||
} 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].r()) && Block.byId[l] != null && Block.byId[l].r()) {
|
||||
++this.c;
|
||||
} else if (Block.byId[i1] != null && Block.byId[i1].isTicking() && (Block.byId[l] == null || !Block.byId[l].isTicking())) {
|
||||
--this.tickingBlockCount;
|
||||
} else if ((Block.byId[i1] == null || !Block.byId[i1].isTicking()) && Block.byId[l] != null && Block.byId[l].isTicking()) {
|
||||
++this.tickingBlockCount;
|
||||
}
|
||||
|
||||
this.d[j << 8 | k << 4 | i] = (byte) (l & 255);
|
||||
this.blockIds[j << 8 | k << 4 | i] = (byte) (l & 255);
|
||||
if (l > 255) {
|
||||
if (this.e == null) {
|
||||
this.e = new NibbleArray(this.d.length, 4);
|
||||
if (this.extBlockIds == null) {
|
||||
this.extBlockIds = new NibbleArray(this.blockIds.length, 4);
|
||||
}
|
||||
|
||||
this.e.a(i, j, k, (l & 3840) >> 8);
|
||||
} else if (this.e != null) {
|
||||
this.e.a(i, j, k, 0);
|
||||
this.extBlockIds.a(i, j, k, (l & 3840) >> 8);
|
||||
} else if (this.extBlockIds != null) {
|
||||
this.extBlockIds.a(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public int b(int i, int j, int k) {
|
||||
return this.f.a(i, j, k);
|
||||
return this.blockData.a(i, j, k);
|
||||
}
|
||||
|
||||
public void b(int i, int j, int k, int l) {
|
||||
this.f.a(i, j, k, l);
|
||||
this.blockData.a(i, j, k, l);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.b == 0;
|
||||
return this.nonEmptyBlockCount == 0;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.c > 0;
|
||||
return this.tickingBlockCount > 0;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.a;
|
||||
return this.yPos;
|
||||
}
|
||||
|
||||
public void c(int i, int j, int k, int l) {
|
||||
this.h.a(i, j, k, l);
|
||||
this.skyLight.a(i, j, k, l);
|
||||
}
|
||||
|
||||
public int c(int i, int j, int k) {
|
||||
return this.h.a(i, j, k);
|
||||
return this.skyLight.a(i, j, k);
|
||||
}
|
||||
|
||||
public void d(int i, int j, int k, int l) {
|
||||
this.g.a(i, j, k, l);
|
||||
this.blockLight.a(i, j, k, l);
|
||||
}
|
||||
|
||||
public int d(int i, int j, int k) {
|
||||
return this.g.a(i, j, k);
|
||||
return this.blockLight.a(i, j, k);
|
||||
}
|
||||
|
||||
public void e() {
|
||||
public void recalcBlockCounts() {
|
||||
// CraftBukkit start - optimize for speed
|
||||
byte[] dd = this.d;
|
||||
int cntb = 0;
|
||||
int cntc = 0;
|
||||
if (this.e == null) { // No extended block IDs? Don't waste time messing with them
|
||||
for (int off = 0; off < dd.length; off++) {
|
||||
int l = dd[off] & 0xFF;
|
||||
byte[] blkIds = this.blockIds;
|
||||
int cntNonEmpty = 0;
|
||||
int cntTicking = 0;
|
||||
if (this.extBlockIds == null) { // No extended block IDs? Don't waste time messing with them
|
||||
for (int off = 0; off < blkIds.length; off++) {
|
||||
int l = blkIds[off] & 0xFF;
|
||||
if (l > 0) {
|
||||
if (Block.byId[l] == null) {
|
||||
dd[off] = 0;
|
||||
blkIds[off] = 0;
|
||||
} else {
|
||||
++cntb;
|
||||
if (Block.byId[l].r()) {
|
||||
++cntc;
|
||||
++cntNonEmpty;
|
||||
if (Block.byId[l].isTicking()) {
|
||||
++cntTicking;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
byte[] ext = this.e.a;
|
||||
for (int off = 0, off2 = 0; off < dd.length;) {
|
||||
byte[] ext = this.extBlockIds.a;
|
||||
for (int off = 0, off2 = 0; off < blkIds.length;) {
|
||||
byte extid = ext[off2];
|
||||
int l = (dd[off] & 0xFF) | ((extid & 0xF) << 8); // Even data
|
||||
int l = (blkIds[off] & 0xFF) | ((extid & 0xF) << 8); // Even data
|
||||
if (l > 0) {
|
||||
if (Block.byId[l] == null) {
|
||||
dd[off] = 0;
|
||||
blkIds[off] = 0;
|
||||
ext[off2] &= 0xF0;
|
||||
} else {
|
||||
++cntb;
|
||||
if (Block.byId[l].r()) {
|
||||
++cntc;
|
||||
++cntNonEmpty;
|
||||
if (Block.byId[l].isTicking()) {
|
||||
++cntTicking;
|
||||
}
|
||||
}
|
||||
}
|
||||
off++;
|
||||
l = (dd[off] & 0xFF) | ((extid & 0xF0) << 4); // Odd data
|
||||
l = (blkIds[off] & 0xFF) | ((extid & 0xF0) << 4); // Odd data
|
||||
if (l > 0) {
|
||||
if (Block.byId[l] == null) {
|
||||
dd[off] = 0;
|
||||
blkIds[off] = 0;
|
||||
ext[off2] &= 0x0F;
|
||||
} else {
|
||||
++cntb;
|
||||
if (Block.byId[l].r()) {
|
||||
++cntc;
|
||||
++cntNonEmpty;
|
||||
if (Block.byId[l].isTicking()) {
|
||||
++cntTicking;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,14 +162,14 @@ public class ChunkSection {
|
||||
off2++;
|
||||
}
|
||||
}
|
||||
this.b = cntb;
|
||||
this.c = cntc;
|
||||
this.nonEmptyBlockCount = cntNonEmpty;
|
||||
this.tickingBlockCount = cntTicking;
|
||||
}
|
||||
|
||||
private void old_e() {
|
||||
public void old_recalcBlockCounts() {
|
||||
// CraftBukkit end
|
||||
this.b = 0;
|
||||
this.c = 0;
|
||||
this.nonEmptyBlockCount = 0;
|
||||
this.tickingBlockCount = 0;
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
for (int j = 0; j < 16; ++j) {
|
||||
@ -178,14 +178,14 @@ public class ChunkSection {
|
||||
|
||||
if (l > 0) {
|
||||
if (Block.byId[l] == null) {
|
||||
this.d[j << 8 | k << 4 | i] = 0;
|
||||
if (this.e != null) {
|
||||
this.e.a(i, j, k, 0);
|
||||
this.blockIds[j << 8 | k << 4 | i] = 0;
|
||||
if (this.extBlockIds != null) {
|
||||
this.extBlockIds.a(i, j, k, 0);
|
||||
}
|
||||
} else {
|
||||
++this.b;
|
||||
if (Block.byId[l].r()) {
|
||||
++this.c;
|
||||
++this.nonEmptyBlockCount;
|
||||
if (Block.byId[l].isTicking()) {
|
||||
++this.tickingBlockCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,42 +195,42 @@ public class ChunkSection {
|
||||
}
|
||||
|
||||
public byte[] g() {
|
||||
return this.d;
|
||||
return this.blockIds;
|
||||
}
|
||||
|
||||
public NibbleArray i() {
|
||||
return this.e;
|
||||
return this.extBlockIds;
|
||||
}
|
||||
|
||||
public NibbleArray j() {
|
||||
return this.f;
|
||||
return this.blockData;
|
||||
}
|
||||
|
||||
public NibbleArray k() {
|
||||
return this.g;
|
||||
return this.blockLight;
|
||||
}
|
||||
|
||||
public NibbleArray l() {
|
||||
return this.h;
|
||||
return this.skyLight;
|
||||
}
|
||||
|
||||
public void a(byte[] abyte) {
|
||||
this.d = abyte;
|
||||
this.blockIds = abyte;
|
||||
}
|
||||
|
||||
public void a(NibbleArray nibblearray) {
|
||||
this.e = nibblearray;
|
||||
this.extBlockIds = nibblearray;
|
||||
}
|
||||
|
||||
public void b(NibbleArray nibblearray) {
|
||||
this.f = nibblearray;
|
||||
this.blockData = nibblearray;
|
||||
}
|
||||
|
||||
public void c(NibbleArray nibblearray) {
|
||||
this.g = nibblearray;
|
||||
this.blockLight = nibblearray;
|
||||
}
|
||||
|
||||
public void d(NibbleArray nibblearray) {
|
||||
this.h = nibblearray;
|
||||
this.skyLight = nibblearray;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public abstract class Container {
|
||||
public Container() {}
|
||||
|
||||
protected Slot a(Slot slot) {
|
||||
slot.d = this.b.size();
|
||||
slot.g = this.b.size();
|
||||
this.b.add(slot);
|
||||
this.a.add(null);
|
||||
return slot;
|
||||
@ -107,107 +107,104 @@ public abstract class Container {
|
||||
return (Slot) this.b.get(i);
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
return slot != null ? slot.getItem() : null;
|
||||
}
|
||||
|
||||
public ItemStack clickItem(int i, int j, boolean flag, EntityHuman entityhuman) {
|
||||
public ItemStack clickItem(int i, int j, int k, EntityHuman entityhuman) {
|
||||
ItemStack itemstack = null;
|
||||
PlayerInventory playerinventory = entityhuman.inventory;
|
||||
Slot slot;
|
||||
ItemStack itemstack1;
|
||||
int l;
|
||||
ItemStack itemstack2;
|
||||
|
||||
if (j > 1) {
|
||||
return null;
|
||||
} else {
|
||||
if (j == 0 || j == 1) {
|
||||
PlayerInventory playerinventory = entityhuman.inventory;
|
||||
if ((k == 0 || k == 1) && (j == 0 || j == 1)) {
|
||||
if (i == -999) {
|
||||
if (playerinventory.getCarried() != null && i == -999) {
|
||||
if (j == 0) {
|
||||
entityhuman.drop(playerinventory.getCarried());
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
|
||||
if (i == -999) {
|
||||
if (playerinventory.getCarried() != null && i == -999) {
|
||||
if (j == 0) {
|
||||
entityhuman.drop(playerinventory.getCarried());
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
if (j == 1) {
|
||||
// CraftBukkit start - store a reference
|
||||
ItemStack itemstack3 = playerinventory.getCarried();
|
||||
if (itemstack3.count > 0) {
|
||||
entityhuman.drop(itemstack3.a(1));
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
// CraftBukkit start - store a reference
|
||||
ItemStack itemstack1 = playerinventory.getCarried();
|
||||
if (itemstack1.count > 0) {
|
||||
entityhuman.drop(itemstack1.a(1));
|
||||
if (itemstack3.count == 0) {
|
||||
// CraftBukkit end
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (k == 1) {
|
||||
slot = (Slot) this.b.get(i);
|
||||
if (slot != null && slot.a(entityhuman)) {
|
||||
itemstack1 = this.b(entityhuman, i);
|
||||
if (itemstack1 != null) {
|
||||
int i1 = itemstack1.id;
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
if (slot != null && slot.getItem() != null && slot.getItem().id == i1) {
|
||||
this.a(i, j, true, entityhuman);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot = (Slot) this.b.get(i);
|
||||
if (slot != null) {
|
||||
itemstack1 = slot.getItem();
|
||||
ItemStack itemstack3 = playerinventory.getCarried();
|
||||
|
||||
if (itemstack1 != null) {
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
}
|
||||
|
||||
if (itemstack1 == null) {
|
||||
if (itemstack3 != null && slot.isAllowed(itemstack3)) {
|
||||
l = j == 0 ? itemstack3.count : 1;
|
||||
if (l > slot.a()) {
|
||||
l = slot.a();
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
// CraftBukkit end
|
||||
// CraftBukkit start
|
||||
if (itemstack3.count >= l) {
|
||||
slot.set(itemstack3.a(l));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (itemstack3.count == 0) {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (flag) {
|
||||
ItemStack itemstack1 = this.b(i);
|
||||
|
||||
if (itemstack1 != null) {
|
||||
int k = itemstack1.id;
|
||||
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
if (slot != null && slot.getItem() != null && slot.getItem().id == k) {
|
||||
this.b(i, j, flag, entityhuman);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (i < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Slot slot1 = (Slot) this.b.get(i);
|
||||
|
||||
if (slot1 != null) {
|
||||
ItemStack itemstack2 = slot1.getItem();
|
||||
ItemStack itemstack3 = playerinventory.getCarried();
|
||||
|
||||
if (itemstack2 != null) {
|
||||
itemstack = itemstack2.cloneItemStack();
|
||||
}
|
||||
|
||||
int l;
|
||||
|
||||
if (itemstack2 == null) {
|
||||
if (itemstack3 != null && slot1.isAllowed(itemstack3)) {
|
||||
l = j == 0 ? itemstack3.count : 1;
|
||||
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);
|
||||
}
|
||||
}
|
||||
} else if (itemstack3 == null) {
|
||||
l = j == 0 ? itemstack2.count : (itemstack2.count + 1) / 2;
|
||||
ItemStack itemstack4 = slot1.a(l);
|
||||
|
||||
playerinventory.setCarried(itemstack4);
|
||||
if (itemstack2.count == 0) {
|
||||
slot1.set((ItemStack) null);
|
||||
} else if (slot.a(entityhuman)) {
|
||||
if (itemstack3 == null) {
|
||||
l = j == 0 ? itemstack1.count : (itemstack1.count + 1) / 2;
|
||||
itemstack2 = slot.a(l);
|
||||
playerinventory.setCarried(itemstack2);
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
}
|
||||
|
||||
slot1.b(playerinventory.getCarried());
|
||||
} else if (slot1.isAllowed(itemstack3)) {
|
||||
if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
|
||||
slot.a(entityhuman, playerinventory.getCarried());
|
||||
} else if (slot.isAllowed(itemstack3)) {
|
||||
if (itemstack1.id == itemstack3.id && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) {
|
||||
l = j == 0 ? itemstack3.count : 1;
|
||||
if (l > slot1.a() - itemstack2.count) {
|
||||
l = slot1.a() - itemstack2.count;
|
||||
if (l > slot.a() - itemstack1.count) {
|
||||
l = slot.a() - itemstack1.count;
|
||||
}
|
||||
|
||||
if (l > itemstack3.getMaxStackSize() - itemstack2.count) {
|
||||
l = itemstack3.getMaxStackSize() - itemstack2.count;
|
||||
if (l > itemstack3.getMaxStackSize() - itemstack1.count) {
|
||||
l = itemstack3.getMaxStackSize() - itemstack1.count;
|
||||
}
|
||||
|
||||
itemstack3.a(l);
|
||||
@ -215,35 +212,72 @@ public abstract class Container {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
|
||||
itemstack2.count += l;
|
||||
} else if (itemstack3.count <= slot1.a()) {
|
||||
slot1.set(itemstack3);
|
||||
playerinventory.setCarried(itemstack2);
|
||||
itemstack1.count += l;
|
||||
} else if (itemstack3.count <= slot.a()) {
|
||||
slot.set(itemstack3);
|
||||
playerinventory.setCarried(itemstack1);
|
||||
}
|
||||
} else if (itemstack2.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
|
||||
l = itemstack2.count;
|
||||
} else if (itemstack1.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) {
|
||||
l = itemstack1.count;
|
||||
if (l > 0 && l + itemstack3.count <= itemstack3.getMaxStackSize()) {
|
||||
itemstack3.count += l;
|
||||
itemstack2 = slot1.a(l);
|
||||
if (itemstack2.count == 0) {
|
||||
slot1.set((ItemStack) null);
|
||||
itemstack1 = slot.a(l);
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
}
|
||||
|
||||
slot1.b(playerinventory.getCarried());
|
||||
slot.a(entityhuman, playerinventory.getCarried());
|
||||
}
|
||||
}
|
||||
|
||||
slot1.e();
|
||||
}
|
||||
|
||||
slot.e();
|
||||
}
|
||||
}
|
||||
} else if (k == 2 && j >= 0 && j < 9) {
|
||||
slot = (Slot) this.b.get(i);
|
||||
if (slot.a(entityhuman)) {
|
||||
itemstack1 = playerinventory.getItem(j);
|
||||
boolean flag = itemstack1 == null || slot.inventory == playerinventory && slot.isAllowed(itemstack1);
|
||||
|
||||
return itemstack;
|
||||
l = -1;
|
||||
if (!flag) {
|
||||
l = playerinventory.i();
|
||||
flag |= l > -1;
|
||||
}
|
||||
|
||||
if (slot.d() && flag) {
|
||||
itemstack2 = slot.getItem();
|
||||
playerinventory.setItem(j, itemstack2);
|
||||
if ((slot.inventory != playerinventory || !slot.isAllowed(itemstack1)) && itemstack1 != null) {
|
||||
if (l > -1) {
|
||||
playerinventory.pickup(itemstack1);
|
||||
slot.set((ItemStack) null);
|
||||
slot.a(entityhuman, itemstack2);
|
||||
}
|
||||
} else {
|
||||
slot.set(itemstack1);
|
||||
slot.a(entityhuman, itemstack2);
|
||||
}
|
||||
} else if (!slot.d() && itemstack1 != null && slot.isAllowed(itemstack1)) {
|
||||
playerinventory.setItem(j, (ItemStack) null);
|
||||
slot.set(itemstack1);
|
||||
}
|
||||
}
|
||||
} else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i > 0) {
|
||||
slot = (Slot) this.b.get(i);
|
||||
if (slot != null && slot.d()) {
|
||||
itemstack1 = slot.getItem().cloneItemStack();
|
||||
itemstack1.count = itemstack1.getMaxStackSize();
|
||||
playerinventory.setCarried(itemstack1);
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected void b(int i, int j, boolean flag, EntityHuman entityhuman) {
|
||||
this.clickItem(i, j, flag, entityhuman);
|
||||
protected void a(int i, int j, boolean flag, EntityHuman entityhuman) {
|
||||
this.clickItem(i, j, 1, entityhuman);
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman) {
|
||||
|
370
src/main/java/net/minecraft/server/ContainerAnvil.java
Normale Datei
370
src/main/java/net/minecraft/server/ContainerAnvil.java
Normale Datei
@ -0,0 +1,370 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryAnvil;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ContainerAnvil extends Container {
|
||||
|
||||
private IInventory f = new InventoryCraftResult();
|
||||
private IInventory g = new ContainerAnvilInventory(this, "Repair", 2);
|
||||
private World h;
|
||||
private int i;
|
||||
private int j;
|
||||
private int k;
|
||||
public int e = 0;
|
||||
private int l = 0;
|
||||
private String m;
|
||||
private final EntityHuman n;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
// CraftBukkit end
|
||||
|
||||
public ContainerAnvil(PlayerInventory playerinventory, World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
this.player = playerinventory; // CraftBukkit
|
||||
this.h = world;
|
||||
this.i = i;
|
||||
this.j = j;
|
||||
this.k = k;
|
||||
this.n = entityhuman;
|
||||
this.a(new Slot(this.g, 0, 27, 47));
|
||||
this.a(new Slot(this.g, 1, 76, 47));
|
||||
this.a((Slot) (new SlotAnvilResult(this, this.f, 2, 134, 47, world, i, j, k)));
|
||||
|
||||
int l;
|
||||
|
||||
for (l = 0; l < 3; ++l) {
|
||||
for (int i1 = 0; i1 < 9; ++i1) {
|
||||
this.a(new Slot(playerinventory, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (l = 0; l < 9; ++l) {
|
||||
this.a(new Slot(playerinventory, l, 8 + l * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
super.a(iinventory);
|
||||
if (iinventory == this.g) {
|
||||
this.d();
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
ItemStack itemstack = this.g.getItem(0);
|
||||
|
||||
this.e = 0;
|
||||
int i = 0;
|
||||
byte b0 = 0;
|
||||
int j = 0;
|
||||
|
||||
if (itemstack == null) {
|
||||
this.f.setItem(0, (ItemStack) null);
|
||||
this.e = 0;
|
||||
} else {
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
ItemStack itemstack2 = this.g.getItem(1);
|
||||
Map map = EnchantmentManager.a(itemstack1);
|
||||
int k = b0 + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost());
|
||||
|
||||
this.l = 0;
|
||||
int l;
|
||||
int i1;
|
||||
int j1;
|
||||
int k1;
|
||||
Enchantment enchantment;
|
||||
Iterator iterator;
|
||||
|
||||
if (itemstack2 != null) {
|
||||
if (itemstack1.f() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
|
||||
l = Math.min(itemstack1.i(), itemstack1.k() / 4);
|
||||
if (l <= 0) {
|
||||
this.f.setItem(0, (ItemStack) null);
|
||||
this.e = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i1 = 0; l > 0 && i1 < itemstack2.count; ++i1) {
|
||||
j1 = itemstack1.i() - l;
|
||||
itemstack1.setData(j1);
|
||||
i += Math.max(1, l / 100) + map.size();
|
||||
l = Math.min(itemstack1.i(), itemstack1.k() / 4);
|
||||
}
|
||||
|
||||
this.l = i1;
|
||||
} else {
|
||||
if (itemstack1.id != itemstack2.id || !itemstack1.f()) {
|
||||
this.f.setItem(0, (ItemStack) null);
|
||||
this.e = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemstack1.f()) {
|
||||
l = itemstack.k() - itemstack.i();
|
||||
i1 = itemstack2.k() - itemstack2.i();
|
||||
j1 = i1 + itemstack1.k() * 12 / 100;
|
||||
int l1 = l + j1;
|
||||
|
||||
k1 = itemstack1.k() - l1;
|
||||
if (k1 < 0) {
|
||||
k1 = 0;
|
||||
}
|
||||
|
||||
if (k1 < itemstack1.getData()) {
|
||||
itemstack1.setData(k1);
|
||||
i += Math.max(1, j1 / 100);
|
||||
}
|
||||
}
|
||||
|
||||
Map map1 = EnchantmentManager.a(itemstack2);
|
||||
|
||||
iterator = map1.keySet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
j1 = ((Integer) iterator.next()).intValue();
|
||||
enchantment = Enchantment.byId[j1];
|
||||
k1 = map.containsKey(Integer.valueOf(j1)) ? ((Integer) map.get(Integer.valueOf(j1))).intValue() : 0;
|
||||
int i2 = ((Integer) map1.get(Integer.valueOf(j1))).intValue();
|
||||
int j2;
|
||||
|
||||
if (k1 == i2) {
|
||||
++i2;
|
||||
j2 = i2;
|
||||
} else {
|
||||
j2 = Math.max(i2, k1);
|
||||
}
|
||||
|
||||
i2 = j2;
|
||||
int k2 = i2 - k1;
|
||||
boolean flag = true;
|
||||
Iterator iterator1 = map.keySet().iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
int l2 = ((Integer) iterator1.next()).intValue();
|
||||
|
||||
if (l2 != j1 && !enchantment.a(Enchantment.byId[l2])) {
|
||||
flag = false;
|
||||
i += k2;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
if (i2 > enchantment.getMaxLevel()) {
|
||||
i2 = enchantment.getMaxLevel();
|
||||
}
|
||||
|
||||
map.put(Integer.valueOf(j1), Integer.valueOf(i2));
|
||||
byte b1 = 0;
|
||||
|
||||
switch (enchantment.getRandomWeight()) {
|
||||
case 1:
|
||||
b1 = 8;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
b1 = 4;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
default:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
b1 = 2;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
b1 = 1;
|
||||
}
|
||||
|
||||
i += b1 * k2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.m != null && !this.m.equalsIgnoreCase(itemstack.r()) && this.m.length() > 0) {
|
||||
j = itemstack.f() ? 7 : itemstack.count * 5;
|
||||
i += j;
|
||||
if (itemstack.s()) {
|
||||
k += j / 2;
|
||||
}
|
||||
|
||||
itemstack1.c(this.m);
|
||||
}
|
||||
|
||||
l = 0;
|
||||
|
||||
byte b2;
|
||||
|
||||
for (iterator = map.keySet().iterator(); iterator.hasNext(); k += l + k1 * b2) {
|
||||
j1 = ((Integer) iterator.next()).intValue();
|
||||
enchantment = Enchantment.byId[j1];
|
||||
k1 = ((Integer) map.get(Integer.valueOf(j1))).intValue();
|
||||
b2 = 0;
|
||||
++l;
|
||||
switch (enchantment.getRandomWeight()) {
|
||||
case 1:
|
||||
b2 = 8;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
b2 = 4;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
default:
|
||||
break;
|
||||
|
||||
case 5:
|
||||
b2 = 2;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
b2 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
this.e = k + i;
|
||||
if (i <= 0) {
|
||||
itemstack1 = null;
|
||||
}
|
||||
|
||||
if (j == i && j > 0 && this.e >= 40) {
|
||||
System.out.println("Naming an item only, cost too high; giving discount to cap cost to 39 levels");
|
||||
this.e = 39;
|
||||
}
|
||||
|
||||
if (this.e >= 40 && !this.n.abilities.canInstantlyBuild) {
|
||||
itemstack1 = null;
|
||||
}
|
||||
|
||||
if (itemstack1 != null) {
|
||||
i1 = itemstack1.getRepairCost();
|
||||
if (itemstack2 != null && i1 < itemstack2.getRepairCost()) {
|
||||
i1 = itemstack2.getRepairCost();
|
||||
}
|
||||
|
||||
if (itemstack1.s()) {
|
||||
i1 -= 5;
|
||||
}
|
||||
|
||||
if (i1 < 0) {
|
||||
i1 = 0;
|
||||
}
|
||||
|
||||
i1 += 2;
|
||||
itemstack1.setRepairCost(i1);
|
||||
EnchantmentManager.a(map, itemstack1);
|
||||
}
|
||||
|
||||
this.f.setItem(0, itemstack1);
|
||||
this.b();
|
||||
}
|
||||
}
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
icrafting.setContainerData(this, 0, this.e);
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman) {
|
||||
super.a(entityhuman);
|
||||
if (!this.h.isStatic) {
|
||||
for (int i = 0; i < this.g.getSize(); ++i) {
|
||||
ItemStack itemstack = this.g.splitWithoutUpdate(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
entityhuman.drop(itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.h.getTypeId(this.i, this.j, this.k) != Block.ANVIL.id ? false : entityhuman.e((double) this.i + 0.5D, (double) this.j + 0.5D, (double) this.k + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
public ItemStack b(EntityHuman entityhuman, 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 < 39 && !this.a(itemstack1, 0, 2, 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.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
this.m = s;
|
||||
if (this.getSlot(2).d()) {
|
||||
this.getSlot(2).getItem().c(this.m);
|
||||
}
|
||||
|
||||
this.d();
|
||||
}
|
||||
|
||||
static IInventory a(ContainerAnvil containeranvil) {
|
||||
return containeranvil.g;
|
||||
}
|
||||
|
||||
static int b(ContainerAnvil containeranvil) {
|
||||
return containeranvil.l;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public CraftInventoryView getBukkitView() {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventory inventory = new CraftInventoryAnvil(this.g);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
53
src/main/java/net/minecraft/server/ContainerAnvilInventory.java
Normale Datei
53
src/main/java/net/minecraft/server/ContainerAnvilInventory.java
Normale Datei
@ -0,0 +1,53 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.List;
|
||||
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBukkit - public
|
||||
|
||||
final ContainerAnvil a;
|
||||
|
||||
// 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
|
||||
|
||||
ContainerAnvilInventory(ContainerAnvil containeranvil, String s, int i) {
|
||||
super(s, i);
|
||||
this.a = containeranvil;
|
||||
this.setMaxStackSize(1); // CraftBukkit
|
||||
}
|
||||
|
||||
public void update() {
|
||||
super.update();
|
||||
this.a.a((IInventory) this);
|
||||
}
|
||||
}
|
122
src/main/java/net/minecraft/server/ContainerBeacon.java
Normale Datei
122
src/main/java/net/minecraft/server/ContainerBeacon.java
Normale Datei
@ -0,0 +1,122 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ContainerBeacon extends Container {
|
||||
|
||||
private TileEntityBeacon e;
|
||||
private final SlotBeacon f;
|
||||
private int g;
|
||||
private int h;
|
||||
private int i;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
// CraftBukkit end
|
||||
|
||||
public ContainerBeacon(PlayerInventory playerinventory, TileEntityBeacon tileentitybeacon) {
|
||||
player = playerinventory; // CraftBukkit
|
||||
this.e = tileentitybeacon;
|
||||
this.a(this.f = new SlotBeacon(this, tileentitybeacon, 0, 136, 110));
|
||||
byte b0 = 36;
|
||||
short short1 = 137;
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
this.a(new Slot(playerinventory, j + i * 9 + 9, b0 + j * 18, short1 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i) {
|
||||
this.a(new Slot(playerinventory, i, b0 + i * 18, 58 + short1));
|
||||
}
|
||||
|
||||
this.g = tileentitybeacon.k();
|
||||
this.h = tileentitybeacon.i();
|
||||
this.i = tileentitybeacon.j();
|
||||
}
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
icrafting.setContainerData(this, 0, this.g);
|
||||
icrafting.setContainerData(this, 1, this.h);
|
||||
icrafting.setContainerData(this, 2, this.i);
|
||||
}
|
||||
|
||||
public void b() {
|
||||
super.b();
|
||||
}
|
||||
|
||||
public TileEntityBeacon d() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.e.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack b(EntityHuman entityhuman, 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 == 0) {
|
||||
if (!this.a(itemstack1, 1, 37, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.a(itemstack1, itemstack);
|
||||
} else if (!this.f.d() && this.f.isAllowed(itemstack1) && itemstack1.count == 1) {
|
||||
if (!this.a(itemstack1, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (i >= 1 && i < 28) {
|
||||
if (!this.a(itemstack1, 28, 37, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (i >= 28 && i < 37) {
|
||||
if (!this.a(itemstack1, 1, 28, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.a(itemstack1, 1, 37, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.e();
|
||||
}
|
||||
|
||||
if (itemstack1.count == itemstack.count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public CraftInventoryView getBukkitView() {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
||||
CraftInventory inventory = new CraftInventoryBeacon(this.e);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
@ -40,7 +40,7 @@ public class ContainerBrewingStand extends Container {
|
||||
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.t_());
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.x_());
|
||||
}
|
||||
|
||||
public void b() {
|
||||
@ -50,12 +50,12 @@ public class ContainerBrewingStand extends Container {
|
||||
while (iterator.hasNext()) {
|
||||
ICrafting icrafting = (ICrafting) iterator.next();
|
||||
|
||||
if (this.g != this.brewingStand.t_()) {
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.t_());
|
||||
if (this.g != this.brewingStand.x_()) {
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.x_());
|
||||
}
|
||||
}
|
||||
|
||||
this.g = this.brewingStand.t_();
|
||||
this.g = this.brewingStand.x_();
|
||||
}
|
||||
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
@ -63,7 +63,7 @@ public class ContainerBrewingStand extends Container {
|
||||
return this.brewingStand.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
@ -109,7 +109,7 @@ public class ContainerBrewingStand extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -67,7 +67,7 @@ public class ContainerChest extends Container {
|
||||
return this.container.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class ContainerDispenser extends Container {
|
||||
return this.items.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
@ -71,7 +71,7 @@ public class ContainerDispenser extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -81,7 +81,7 @@ public class ContainerEnchantTable extends Container {
|
||||
ItemStack itemstack = iinventory.getItem(0);
|
||||
int i;
|
||||
|
||||
if (itemstack != null && itemstack.u()) {
|
||||
if (itemstack != null && itemstack.v()) {
|
||||
this.f = this.l.nextLong();
|
||||
if (!this.world.isStatic) {
|
||||
i = 0;
|
||||
@ -171,7 +171,7 @@ public class ContainerEnchantTable extends Container {
|
||||
return false;
|
||||
}
|
||||
|
||||
entityhuman.levelDown(level);
|
||||
entityhuman.levelDown(-level);
|
||||
for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
|
||||
try {
|
||||
item.addEnchantment(entry.getKey(), entry.getValue());
|
||||
@ -207,7 +207,7 @@ public class ContainerEnchantTable extends Container {
|
||||
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 b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
@ -243,7 +243,7 @@ public class ContainerEnchantTable extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -86,7 +86,7 @@ public class ContainerFurnace extends Container {
|
||||
return this.furnace.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
@ -130,7 +130,7 @@ public class ContainerFurnace extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -60,15 +60,15 @@ public class ContainerMerchant extends Container {
|
||||
super.a(iinventory);
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
public void b(int i) {
|
||||
this.f.c(i);
|
||||
}
|
||||
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
return this.merchant.l_() == entityhuman;
|
||||
return this.merchant.m_() == entityhuman;
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
@ -104,7 +104,7 @@ public class ContainerMerchant extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -7,25 +7,22 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
||||
public class ContainerPlayer extends Container {
|
||||
|
||||
public InventoryCrafting craftInventory;
|
||||
public IInventory resultInventory;
|
||||
public boolean g;
|
||||
public InventoryCrafting craftInventory = new InventoryCrafting(this, 2, 2);
|
||||
public IInventory resultInventory = new InventoryCraftResult();
|
||||
public boolean g = false;
|
||||
private final EntityHuman h;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
// CraftBukkit end
|
||||
|
||||
public ContainerPlayer(PlayerInventory playerinventory) {
|
||||
this(playerinventory, true);
|
||||
}
|
||||
|
||||
public ContainerPlayer(PlayerInventory playerinventory, boolean flag) {
|
||||
public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) {
|
||||
this.g = flag;
|
||||
this.h = entityhuman;
|
||||
this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
|
||||
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.g = false;
|
||||
this.g = flag;
|
||||
this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 144, 36)));
|
||||
|
||||
int i;
|
||||
@ -57,7 +54,7 @@ public class ContainerPlayer extends Container {
|
||||
public void a(IInventory iinventory) {
|
||||
// CraftBukkit start (Note: the following line would cause an error if called during construction)
|
||||
CraftingManager.getInstance().lastCraftView = getBukkitView();
|
||||
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory);
|
||||
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory, this.h.world);
|
||||
this.resultInventory.setItem(0, craftResult);
|
||||
if (super.listeners.size() < 1) {
|
||||
return;
|
||||
@ -86,7 +83,7 @@ public class ContainerPlayer extends Container {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
@ -136,7 +133,7 @@ public class ContainerPlayer extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -56,7 +56,7 @@ public class ContainerWorkbench extends Container {
|
||||
public void a(IInventory iinventory) {
|
||||
// CraftBukkit start
|
||||
CraftingManager.getInstance().lastCraftView = getBukkitView();
|
||||
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory);
|
||||
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory, this.g);
|
||||
this.resultInventory.setItem(0, craftResult);
|
||||
if (super.listeners.size() < 1) {
|
||||
return;
|
||||
@ -85,7 +85,7 @@ public class ContainerWorkbench extends Container {
|
||||
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 b(int i) {
|
||||
public ItemStack b(EntityHuman entityhuman, int i) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.b.get(i);
|
||||
|
||||
@ -121,7 +121,7 @@ public class ContainerWorkbench extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.b(itemstack1);
|
||||
slot.a(entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
@ -53,20 +53,20 @@ public class ControllerLook {
|
||||
// CraftBukkit end
|
||||
|
||||
this.a.pitch = this.a(this.a.pitch, f1, this.c);
|
||||
this.a.as = this.a(this.a.as, f, this.b);
|
||||
this.a.ay = this.a(this.a.ay, f, this.b);
|
||||
} else {
|
||||
this.a.as = this.a(this.a.as, this.a.aq, 10.0F);
|
||||
this.a.ay = this.a(this.a.ay, this.a.aw, 10.0F);
|
||||
}
|
||||
|
||||
float f2 = MathHelper.g(this.a.as - this.a.aq);
|
||||
float f2 = MathHelper.g(this.a.ay - this.a.aw);
|
||||
|
||||
if (!this.a.getNavigation().f()) {
|
||||
if (f2 < -75.0F) {
|
||||
this.a.as = this.a.aq - 75.0F;
|
||||
this.a.ay = this.a.aw - 75.0F;
|
||||
}
|
||||
|
||||
if (f2 > 75.0F) {
|
||||
this.a.as = this.a.aq + 75.0F;
|
||||
this.a.ay = this.a.aw + 75.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class ControllerMove {
|
||||
float f = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
|
||||
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
|
||||
this.a.e(this.e);
|
||||
this.a.e(this.e * this.a.by());
|
||||
if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) {
|
||||
this.a.getControllerJump().a();
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
public class CraftingManager {
|
||||
|
||||
private static final CraftingManager a = new CraftingManager();
|
||||
public List recipes = new ArrayList(); // CraftBukkit - private -> public
|
||||
// CraftBukkit start
|
||||
public List recipes = new ArrayList(); // private -> public
|
||||
public IRecipe lastRecipe;
|
||||
public org.bukkit.inventory.InventoryView lastCraftView;
|
||||
// CraftBukkit end
|
||||
@ -21,7 +21,8 @@ public class CraftingManager {
|
||||
return a;
|
||||
}
|
||||
|
||||
public CraftingManager() { // CraftBukkit - private -> public
|
||||
// CraftBukkit - private -> public
|
||||
public CraftingManager() {
|
||||
(new RecipesTools()).a(this);
|
||||
(new RecipesWeapons()).a(this);
|
||||
(new RecipeIngots()).a(this);
|
||||
@ -29,10 +30,15 @@ public class CraftingManager {
|
||||
(new RecipesCrafting()).a(this);
|
||||
(new RecipesArmor()).a(this);
|
||||
(new RecipesDyes()).a(this);
|
||||
this.recipes.add(new RecipesArmorDye());
|
||||
this.recipes.add(new RecipesMapClone());
|
||||
this.recipes.add(new RecipesMapExtend());
|
||||
this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
|
||||
this.registerShapelessRecipe(new ItemStack(Item.BOOK, 1), new Object[] { Item.PAPER, Item.PAPER, Item.PAPER, Item.LEATHER});
|
||||
this.registerShapelessRecipe(new ItemStack(Item.BOOK_AND_QUILL, 1), new Object[] { Item.BOOK, new ItemStack(Item.INK_SACK, 1, 0), Item.FEATHER});
|
||||
this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.COBBLE_WALL, 6, 0), new Object[] { "###", "###", Character.valueOf('#'), Block.COBBLESTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.COBBLE_WALL, 6, 1), new Object[] { "###", "###", Character.valueOf('#'), Block.MOSSY_COBBLESTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Block.NETHER_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Item.STICK, Character.valueOf('W'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
|
||||
@ -80,6 +86,7 @@ public class CraftingManager {
|
||||
this.registerShapedRecipe(new ItemStack(Item.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.FLOWER_POT, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.CLAY_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.FLINT_AND_STEEL, 1), new Object[] { "A ", " B", Character.valueOf('A'), Item.IRON_INGOT, Character.valueOf('B'), Item.FLINT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Item.WHEAT});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
|
||||
@ -87,22 +94,26 @@ public class CraftingManager {
|
||||
this.registerShapedRecipe(new ItemStack(Block.SPRUCE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
|
||||
this.registerShapedRecipe(new ItemStack(Block.JUNGLE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
|
||||
this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
|
||||
this.registerShapedRecipe(new ItemStack(Item.CARROT_STICK, 1), new Object[] { "# ", " X", Character.valueOf('#'), Item.FISHING_ROD, Character.valueOf('X'), Item.CARROT});
|
||||
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.ITEM_FRAME, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.LEATHER});
|
||||
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.APPLE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.CARROT_GOLDEN, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.CARROT});
|
||||
this.registerShapedRecipe(new ItemStack(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});
|
||||
this.registerShapedRecipe(new ItemStack(Item.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.IRON_INGOT, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.MAP, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.PAPER, Character.valueOf('X'), Item.COMPASS});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STONE_BUTTON, 1), new Object[] { "#", "#", Character.valueOf('#'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.MAP_EMPTY, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.PAPER, Character.valueOf('X'), Item.COMPASS});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STONE_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.BOW, Character.valueOf('R'), Item.REDSTONE});
|
||||
@ -110,11 +121,12 @@ public class CraftingManager {
|
||||
this.registerShapedRecipe(new ItemStack(Block.PISTON_STICKY, 1), new Object[] { "S", "P", Character.valueOf('S'), Item.SLIME_BALL, Character.valueOf('P'), Block.PISTON});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Block.OBSIDIAN, Character.valueOf('B'), Item.BOOK, Character.valueOf('D'), Item.DIAMOND});
|
||||
this.registerShapedRecipe(new ItemStack(Block.ANVIL, 1), new Object[] { "III", " i ", "iii", Character.valueOf('I'), Block.IRON_BLOCK, Character.valueOf('i'), Item.IRON_INGOT});
|
||||
this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
|
||||
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, Item.COAL});
|
||||
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, new ItemStack(Item.COAL, 1, 1)});
|
||||
//Collections.sort(this.b, new RecipeSorter(this)); // CraftBukkit - removed; see below
|
||||
this.sort(); // CraftBukkit - moved sort to a separate method
|
||||
// Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
|
||||
this.sort(); // CraftBukkit - call new sort method
|
||||
System.out.println(this.recipes.size() + " recipes");
|
||||
}
|
||||
|
||||
@ -124,7 +136,8 @@ public class CraftingManager {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void registerShapedRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
|
||||
// CraftBukkit - default -> public
|
||||
public void registerShapedRecipe(ItemStack itemstack, Object... aobject) {
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
@ -186,7 +199,8 @@ public class CraftingManager {
|
||||
this.recipes.add(new ShapedRecipes(j, k, aitemstack, itemstack));
|
||||
}
|
||||
|
||||
public void registerShapelessRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
|
||||
// CraftBukkit - default -> public
|
||||
public void registerShapelessRecipe(ItemStack itemstack, Object... aobject) {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Object[] aobject1 = aobject;
|
||||
int i = aobject.length;
|
||||
@ -210,7 +224,7 @@ public class CraftingManager {
|
||||
this.recipes.add(new ShapelessRecipes(itemstack, arraylist));
|
||||
}
|
||||
|
||||
public ItemStack craft(InventoryCrafting inventorycrafting) {
|
||||
public ItemStack craft(InventoryCrafting inventorycrafting, World world) {
|
||||
int i = 0;
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack1 = null;
|
||||
@ -231,11 +245,11 @@ public class CraftingManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].m()) {
|
||||
if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].n()) {
|
||||
Item item = Item.byId[itemstack.id];
|
||||
int k = item.getMaxDurability() - itemstack.i();
|
||||
int l = item.getMaxDurability() - itemstack1.i();
|
||||
int i1 = k + l + item.getMaxDurability() * 10 / 100;
|
||||
int i1 = k + l + item.getMaxDurability() * 5 / 100;
|
||||
int j1 = item.getMaxDurability() - i1;
|
||||
|
||||
if (j1 < 0) {
|
||||
@ -263,11 +277,11 @@ public class CraftingManager {
|
||||
}
|
||||
|
||||
irecipe = (IRecipe) iterator.next();
|
||||
} while (!irecipe.a(inventorycrafting));
|
||||
} while (!irecipe.a(inventorycrafting, world));
|
||||
|
||||
// CraftBukkit start - INVENTORY_PRE_CRAFT event
|
||||
inventorycrafting.currentRecipe = irecipe;
|
||||
ItemStack result = irecipe.b(inventorycrafting);
|
||||
ItemStack result = irecipe.a(inventorycrafting);
|
||||
return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public class CrashReport {
|
||||
this.a("Java VM Version", (Callable) (new CrashReportJavaVMVersion(this)));
|
||||
this.a("Memory", (Callable) (new CrashReportMemory(this)));
|
||||
this.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this)));
|
||||
this.a("AABB Pool Size", (Callable) (new CrashReportAABBPoolSize(this)));
|
||||
this.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit
|
||||
}
|
||||
|
||||
|
@ -47,18 +47,18 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
|
||||
// CraftBukkit end
|
||||
|
||||
log.info("Starting minecraft server version 1.3.2");
|
||||
log.info("Starting minecraft server version 1.4.2");
|
||||
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");
|
||||
if (this.I()) {
|
||||
this.d("127.0.0.1");
|
||||
} else {
|
||||
this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
|
||||
this.e(this.propertyManager.getString("server-ip", ""));
|
||||
this.d(this.propertyManager.getString("server-ip", ""));
|
||||
}
|
||||
|
||||
this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
|
||||
@ -78,16 +78,16 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
inetaddress = InetAddress.getByName(this.getServerIp());
|
||||
}
|
||||
|
||||
if (this.F() < 0) {
|
||||
if (this.G() < 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());
|
||||
log.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.G());
|
||||
|
||||
try {
|
||||
this.r = new DedicatedServerConnection(this, inetaddress, this.F());
|
||||
this.r = new DedicatedServerConnection(this, inetaddress, this.G());
|
||||
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
|
||||
log.warning("**** FAILED TO BIND TO PORT!");
|
||||
log.log(Level.WARNING, "The exception was: " + ioexception.toString());
|
||||
@ -106,12 +106,13 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
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"));
|
||||
if (this.J() == null) {
|
||||
this.l(this.propertyManager.getString("level-name", "world"));
|
||||
}
|
||||
|
||||
String s = this.propertyManager.getString("level-seed", "");
|
||||
String s1 = this.propertyManager.getString("level-type", "DEFAULT");
|
||||
String s2 = this.propertyManager.getString("generator-settings", "");
|
||||
long k = (new Random()).nextLong();
|
||||
|
||||
if (s.length() > 0) {
|
||||
@ -136,12 +137,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
this.d((this.getMaxBuildHeight() + 8) / 16 * 16);
|
||||
this.d(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
|
||||
this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
|
||||
log.info("Preparing level \"" + this.I() + "\"");
|
||||
this.a(this.I(), this.I(), k, worldtype);
|
||||
log.info("Preparing level \"" + this.J() + "\"");
|
||||
this.a(this.J(), this.J(), k, worldtype, s2);
|
||||
long i1 = System.nanoTime() - j;
|
||||
String s2 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
|
||||
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
|
||||
|
||||
log.info("Done (" + s2 + ")! For help, type \"help\" or \"?\"");
|
||||
log.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
|
||||
if (this.propertyManager.getBoolean("enable-query", false)) {
|
||||
log.info("Starting GS4 status listener");
|
||||
this.m = new RemoteStatusListener(this);
|
||||
@ -189,7 +190,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
|
||||
protected void a(CrashReport crashreport) {
|
||||
while (this.isRunning()) {
|
||||
this.ai();
|
||||
this.al();
|
||||
|
||||
try {
|
||||
Thread.sleep(10L);
|
||||
@ -205,13 +206,13 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
return crashreport;
|
||||
}
|
||||
|
||||
protected void o() {
|
||||
protected void p() {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void q() {
|
||||
super.q();
|
||||
this.ai();
|
||||
public void r() {
|
||||
super.r();
|
||||
this.al();
|
||||
}
|
||||
|
||||
public boolean getAllowNether() {
|
||||
@ -223,8 +224,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
}
|
||||
|
||||
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
|
||||
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.aj().getHasWhitelist()));
|
||||
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.aj().getWhitelisted().size()));
|
||||
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.am().getHasWhitelist()));
|
||||
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.am().getWhitelisted().size()));
|
||||
super.a(mojangstatisticsgenerator);
|
||||
}
|
||||
|
||||
@ -236,7 +237,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
this.l.add(new ServerCommand(s, icommandlistener));
|
||||
}
|
||||
|
||||
public void ai() {
|
||||
public void al() {
|
||||
while (!this.l.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.l.remove(0);
|
||||
|
||||
@ -251,15 +252,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
}
|
||||
}
|
||||
|
||||
public boolean S() {
|
||||
public boolean T() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ServerConfigurationManager aj() {
|
||||
public ServerConfigurationManager am() {
|
||||
return (ServerConfigurationManager) super.getServerConfigurationManager();
|
||||
}
|
||||
|
||||
public ServerConnection ac() {
|
||||
public ServerConnection ae() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
@ -283,18 +284,18 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
this.propertyManager.savePropertiesFile();
|
||||
}
|
||||
|
||||
public String c() {
|
||||
public String b_() {
|
||||
File file1 = this.propertyManager.c();
|
||||
|
||||
return file1 != null ? file1.getAbsolutePath() : "No settings file";
|
||||
}
|
||||
|
||||
public void ak() {
|
||||
public void an() {
|
||||
ServerGUI.a(this);
|
||||
this.s = true;
|
||||
}
|
||||
|
||||
public boolean ae() {
|
||||
public boolean ag() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
@ -302,7 +303,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
return "";
|
||||
}
|
||||
|
||||
public boolean getEnableCommandBlock() {
|
||||
return this.propertyManager.getBoolean("enable-command-block", false);
|
||||
}
|
||||
|
||||
public int getSpawnProtection() {
|
||||
return this.propertyManager.getInt("spawn-protection", super.getSpawnProtection());
|
||||
}
|
||||
|
||||
public ServerConfigurationManagerAbstract getServerConfigurationManager() {
|
||||
return this.aj();
|
||||
return this.am();
|
||||
}
|
||||
}
|
||||
|
77
src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
Normale Datei
77
src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
Normale Datei
@ -0,0 +1,77 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem c;
|
||||
|
||||
final MinecraftServer b;
|
||||
|
||||
public DispenseBehaviorBoat(MinecraftServer minecraftserver) {
|
||||
this.b = minecraftserver;
|
||||
this.c = new DispenseBehaviorItem();
|
||||
}
|
||||
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
World world = isourceblock.k();
|
||||
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
|
||||
double d1 = isourceblock.getY();
|
||||
double d2 = isourceblock.getZ() + (double) ((float) enumfacing.e() * 1.125F);
|
||||
int i = isourceblock.getBlockX() + enumfacing.c();
|
||||
int j = isourceblock.getBlockY();
|
||||
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||
Material material = world.getMaterial(i, j, k);
|
||||
double d3;
|
||||
|
||||
if (Material.WATER.equals(material)) {
|
||||
d3 = 1.0D;
|
||||
} else {
|
||||
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getMaterial(i, j - 1, k))) {
|
||||
return this.c.a(isourceblock, itemstack);
|
||||
}
|
||||
|
||||
d3 = 0.0D;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.a(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack1).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
itemstack.count++;
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
itemstack.count++;
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
// CraftBukkit end
|
||||
|
||||
world.addEntity(entityboat);
|
||||
// itemstack.a(1); // CraftBukkit - handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
isourceblock.k().triggerEffect(1000, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||
}
|
||||
}
|
72
src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
Normale Datei
72
src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
Normale Datei
@ -0,0 +1,72 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem c;
|
||||
|
||||
final MinecraftServer b;
|
||||
|
||||
public DispenseBehaviorEmptyBucket(MinecraftServer minecraftserver) {
|
||||
this.b = minecraftserver;
|
||||
this.c = new DispenseBehaviorItem();
|
||||
}
|
||||
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
World world = isourceblock.k();
|
||||
int i = isourceblock.getBlockX() + enumfacing.c();
|
||||
int j = isourceblock.getBlockY();
|
||||
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||
Material material = world.getMaterial(i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
Item item;
|
||||
|
||||
if (Material.WATER.equals(material) && l == 0) {
|
||||
item = Item.WATER_BUCKET;
|
||||
} else {
|
||||
if (!Material.LAVA.equals(material) || l != 0) {
|
||||
return super.b(isourceblock, itemstack);
|
||||
}
|
||||
|
||||
item = Item.LAVA_BUCKET;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
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(0, 0, 0));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.setTypeId(i, j, k, 0);
|
||||
if (--itemstack.count == 0) {
|
||||
itemstack.id = item.id;
|
||||
itemstack.count = 1;
|
||||
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
|
||||
this.c.a(isourceblock, new ItemStack(item));
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
}
|
72
src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
Normale Datei
72
src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
Normale Datei
@ -0,0 +1,72 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem c;
|
||||
|
||||
final MinecraftServer b;
|
||||
|
||||
public DispenseBehaviorFilledBucket(MinecraftServer minecraftserver) {
|
||||
this.b = minecraftserver;
|
||||
this.c = new DispenseBehaviorItem();
|
||||
}
|
||||
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
|
||||
int i = isourceblock.getBlockX();
|
||||
int j = isourceblock.getBlockY();
|
||||
int k = isourceblock.getBlockZ();
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
|
||||
// CraftBukkit start
|
||||
World world = isourceblock.k();
|
||||
int i2 = i + enumfacing.c();
|
||||
int k2 = k + enumfacing.e();
|
||||
if (world.isEmpty(i2, j, k2) || world.getMaterial(i2, j, k2).isBuildable()) {
|
||||
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(0, 0, 0));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
itembucket = (ItemBucket) CraftItemStack.createNMSItemStack(event.getItem()).getItem();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (itembucket.a(isourceblock.k(), (double) i, (double) j, (double) k, i + enumfacing.c(), j, k + enumfacing.e())) {
|
||||
// CraftBukkit start - handle stacked buckets
|
||||
Item item = Item.BUCKET;
|
||||
if (--itemstack.count == 0) {
|
||||
itemstack.id = item.id;
|
||||
itemstack.count = 1;
|
||||
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
|
||||
this.c.a(isourceblock, new ItemStack(item));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return itemstack;
|
||||
} else {
|
||||
return this.c.a(isourceblock, itemstack);
|
||||
}
|
||||
}
|
||||
}
|
65
src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
Normale Datei
65
src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
Normale Datei
@ -0,0 +1,65 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DispenseBehaviorFireball extends DispenseBehaviorItem {
|
||||
|
||||
final MinecraftServer b;
|
||||
|
||||
public DispenseBehaviorFireball(MinecraftServer minecraftserver) {
|
||||
this.b = minecraftserver;
|
||||
}
|
||||
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
IPosition iposition = BlockDispenser.a(isourceblock);
|
||||
double d0 = iposition.getX() + (double) ((float) enumfacing.c() * 0.3F);
|
||||
double d1 = iposition.getY();
|
||||
double d2 = iposition.getZ() + (double) ((float) enumfacing.e() * 0.3F);
|
||||
World world = isourceblock.k();
|
||||
Random random = world.random;
|
||||
double d3 = random.nextGaussian() * 0.05D + (double) enumfacing.c();
|
||||
double d4 = random.nextGaussian() * 0.05D;
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) enumfacing.e();
|
||||
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.a(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack1).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(d3, d4, d5));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
itemstack.count++;
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
itemstack.count++;
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
world.addEntity(new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()));
|
||||
// itemstack.a(1); // Handled during event processing
|
||||
// CraftBukkit end
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
isourceblock.k().triggerEffect(1009, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||
}
|
||||
}
|
107
src/main/java/net/minecraft/server/DispenseBehaviorItem.java
Normale Datei
107
src/main/java/net/minecraft/server/DispenseBehaviorItem.java
Normale Datei
@ -0,0 +1,107 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DispenseBehaviorItem implements IDispenseBehavior {
|
||||
|
||||
public DispenseBehaviorItem() {}
|
||||
|
||||
public final ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
ItemStack itemstack1 = this.b(isourceblock, itemstack);
|
||||
|
||||
this.a(isourceblock);
|
||||
this.a(isourceblock, EnumFacing.a(isourceblock.h()));
|
||||
return itemstack1;
|
||||
}
|
||||
|
||||
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
IPosition iposition = BlockDispenser.a(isourceblock);
|
||||
ItemStack itemstack1 = itemstack.a(1);
|
||||
|
||||
// CraftBukkit start
|
||||
if (!a(isourceblock.k(), itemstack1, 6, enumfacing, isourceblock)) {
|
||||
itemstack.count++;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
// CraftBukkit start - void -> boolean return, IPosition -> ISourceBlock last argument
|
||||
public static boolean a(World world, ItemStack itemstack, int i, EnumFacing enumfacing, ISourceBlock isourceblock) {
|
||||
IPosition iposition = BlockDispenser.a(isourceblock);
|
||||
// CraftBukkit end
|
||||
double d0 = iposition.getX();
|
||||
double d1 = iposition.getY();
|
||||
double d2 = iposition.getZ();
|
||||
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||
double d3 = world.random.nextDouble() * 0.1D + 0.2D;
|
||||
|
||||
entityitem.motX = (double) enumfacing.c() * d3;
|
||||
entityitem.motY = 0.20000000298023224D;
|
||||
entityitem.motZ = (double) enumfacing.e() * d3;
|
||||
entityitem.motX += world.random.nextGaussian() * 0.007499999832361937D * (double) i;
|
||||
entityitem.motY += world.random.nextGaussian() * 0.007499999832361937D * (double) i;
|
||||
entityitem.motZ += world.random.nextGaussian() * 0.007499999832361937D * (double) i;
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(entityitem.motX, entityitem.motY, entityitem.motZ));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
entityitem.itemStack = CraftItemStack.createNMSItemStack(event.getItem());
|
||||
entityitem.motX = event.getVelocity().getX();
|
||||
entityitem.motY = event.getVelocity().getY();
|
||||
entityitem.motZ = event.getVelocity().getZ();
|
||||
// CraftBukkit end
|
||||
|
||||
world.addEntity(entityitem);
|
||||
|
||||
// CraftBukkit start
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
if (event.getItem().getTypeId() == Item.BUCKET.id) {
|
||||
int x = isourceblock.getBlockX() + enumfacing.c();
|
||||
int y = isourceblock.getBlockY();
|
||||
int z = isourceblock.getBlockZ() + enumfacing.e();
|
||||
Material material = world.getMaterial(x, y, z);
|
||||
int data = world.getData(x, y, z);
|
||||
if (!(Material.WATER.equals(material) || Material.LAVA.equals(material)) || data != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior.getClass() != DispenseBehaviorItem.class) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
isourceblock.k().triggerEffect(1000, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock, EnumFacing enumfacing) {
|
||||
isourceblock.k().triggerEffect(2000, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), this.a(enumfacing));
|
||||
}
|
||||
|
||||
private int a(EnumFacing enumfacing) {
|
||||
return enumfacing.c() + 1 + (enumfacing.e() + 1) * 3;
|
||||
}
|
||||
}
|
78
src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
Normale Datei
78
src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
Normale Datei
@ -0,0 +1,78 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DispenseBehaviorMinecart extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem c;
|
||||
|
||||
final MinecraftServer b;
|
||||
|
||||
public DispenseBehaviorMinecart(MinecraftServer minecraftserver) {
|
||||
this.b = minecraftserver;
|
||||
this.c = new DispenseBehaviorItem();
|
||||
}
|
||||
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
World world = isourceblock.k();
|
||||
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
|
||||
double d1 = isourceblock.getY();
|
||||
double d2 = isourceblock.getZ() + (double) ((float) enumfacing.e() * 1.125F);
|
||||
int i = isourceblock.getBlockX() + enumfacing.c();
|
||||
int j = isourceblock.getBlockY();
|
||||
int k = isourceblock.getBlockZ() + enumfacing.e();
|
||||
int l = world.getTypeId(i, j, k);
|
||||
double d3;
|
||||
|
||||
if (BlockMinecartTrack.d(l)) {
|
||||
d3 = 0.0D;
|
||||
} else {
|
||||
if (l != 0 || !BlockMinecartTrack.d(world.getTypeId(i, j - 1, k))) {
|
||||
return this.c.a(isourceblock, itemstack);
|
||||
}
|
||||
|
||||
d3 = -1.0D;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.a(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack1).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
itemstack.count++;
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
itemstack.count++;
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
itemstack1 = CraftItemStack.createNMSItemStack(event.getItem());
|
||||
EntityMinecart entityminecart = new EntityMinecart(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).a);
|
||||
// CraftBukkit end
|
||||
|
||||
world.addEntity(entityminecart);
|
||||
// itemstack.a(1); // CraftBukkit - handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
isourceblock.k().triggerEffect(1000, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||
}
|
||||
}
|
58
src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
Normale Datei
58
src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
Normale Datei
@ -0,0 +1,58 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
|
||||
|
||||
final MinecraftServer b;
|
||||
|
||||
public DispenseBehaviorMonsterEgg(MinecraftServer minecraftserver) {
|
||||
this.b = minecraftserver;
|
||||
}
|
||||
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
double d0 = isourceblock.getX() + (double) enumfacing.c();
|
||||
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
|
||||
double d2 = isourceblock.getZ() + (double) enumfacing.e();
|
||||
|
||||
// CraftBukkit start
|
||||
World world = isourceblock.k();
|
||||
ItemStack itemstack1 = itemstack.a(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack1).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector(d0, d1, d2));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
itemstack.count++;
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
itemstack.count++;
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
itemstack1 = CraftItemStack.createNMSItemStack(event.getItem());
|
||||
ItemMonsterEgg.a(isourceblock.k(), itemstack1.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
// itemstack.a(1); // Handled during event processing
|
||||
// CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
isourceblock.k().triggerEffect(1002, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||
}
|
||||
}
|
64
src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
Normale Datei
64
src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
Normale Datei
@ -0,0 +1,64 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
|
||||
|
||||
public DispenseBehaviorProjectile() {}
|
||||
|
||||
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
World world = isourceblock.k();
|
||||
IPosition iposition = BlockDispenser.a(isourceblock);
|
||||
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
|
||||
IProjectile iprojectile = this.a(world, iposition);
|
||||
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.a(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack1).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new org.bukkit.util.Vector((double) enumfacing.c(), 0.10000000149011612D, (double) enumfacing.e()));
|
||||
if (!BlockDispenser.eventFired) {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
itemstack.count++;
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
if (!event.getItem().equals(bukkitItem)) {
|
||||
itemstack.count++;
|
||||
// Chain to handler for new item
|
||||
IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.a.a(itemstack.getItem());
|
||||
if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) {
|
||||
idispensebehavior.a(isourceblock, CraftItemStack.createNMSItemStack(event.getItem()));
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.b(), this.a());
|
||||
// CraftBukkit end
|
||||
|
||||
world.addEntity((Entity) iprojectile);
|
||||
// itemstack.a(1); // CraftBukkit - Handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected void a(ISourceBlock isourceblock) {
|
||||
isourceblock.k().triggerEffect(1002, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
|
||||
}
|
||||
|
||||
protected abstract IProjectile a(World world, IPosition iposition);
|
||||
|
||||
protected float a() {
|
||||
return 6.0F;
|
||||
}
|
||||
|
||||
protected float b() {
|
||||
return 1.1F;
|
||||
}
|
||||
}
|
@ -63,33 +63,39 @@ public abstract class Entity {
|
||||
public float length;
|
||||
public float P;
|
||||
public float Q;
|
||||
public float R;
|
||||
public float fallDistance;
|
||||
private int b;
|
||||
public double S;
|
||||
private int c;
|
||||
public double T;
|
||||
public double U;
|
||||
public float V;
|
||||
public double V;
|
||||
public float W;
|
||||
public boolean X;
|
||||
public float Y;
|
||||
public float X;
|
||||
public boolean Y;
|
||||
public float Z;
|
||||
protected Random random;
|
||||
public int ticksLived;
|
||||
public int maxFireTicks;
|
||||
public int fireTicks; // CraftBukkit - private -> public
|
||||
protected boolean ac;
|
||||
protected boolean ad;
|
||||
public int noDamageTicks;
|
||||
private boolean justCreated;
|
||||
protected boolean fireProof;
|
||||
protected DataWatcher datawatcher;
|
||||
private double e;
|
||||
private double f;
|
||||
public boolean ag;
|
||||
public int ah;
|
||||
private double g;
|
||||
public boolean ah;
|
||||
public int ai;
|
||||
public int aj;
|
||||
public boolean ak;
|
||||
public int ak;
|
||||
public boolean al;
|
||||
public EnumEntitySize am;
|
||||
public boolean am;
|
||||
public int an;
|
||||
protected boolean ao;
|
||||
private int h;
|
||||
public int dimension;
|
||||
protected int aq;
|
||||
public EnumEntitySize ar;
|
||||
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
|
||||
public boolean valid = false; // CraftBukkit
|
||||
|
||||
@ -108,25 +114,31 @@ public abstract class Entity {
|
||||
this.length = 1.8F;
|
||||
this.P = 0.0F;
|
||||
this.Q = 0.0F;
|
||||
this.R = 0.0F;
|
||||
this.fallDistance = 0.0F;
|
||||
this.b = 1;
|
||||
this.V = 0.0F;
|
||||
this.c = 1;
|
||||
this.W = 0.0F;
|
||||
this.X = false;
|
||||
this.Y = 0.0F;
|
||||
this.X = 0.0F;
|
||||
this.Y = false;
|
||||
this.Z = 0.0F;
|
||||
this.random = new Random();
|
||||
this.ticksLived = 0;
|
||||
this.maxFireTicks = 1;
|
||||
this.fireTicks = 0;
|
||||
this.ac = false;
|
||||
this.ad = false;
|
||||
this.noDamageTicks = 0;
|
||||
this.justCreated = true;
|
||||
this.fireProof = false;
|
||||
this.datawatcher = new DataWatcher();
|
||||
this.ag = false;
|
||||
this.am = EnumEntitySize.SIZE_2;
|
||||
this.ah = false;
|
||||
this.aq = 0;
|
||||
this.ar = EnumEntitySize.SIZE_2;
|
||||
this.world = world;
|
||||
this.setPosition(0.0D, 0.0D, 0.0D);
|
||||
if (world != null) {
|
||||
this.dimension = world.worldProvider.dimension;
|
||||
}
|
||||
|
||||
this.datawatcher.a(0, Byte.valueOf((byte) 0));
|
||||
this.datawatcher.a(1, Short.valueOf((short) 300));
|
||||
this.a();
|
||||
@ -156,17 +168,17 @@ public abstract class Entity {
|
||||
float f2 = f % 2.0F;
|
||||
|
||||
if ((double) f2 < 0.375D) {
|
||||
this.am = EnumEntitySize.SIZE_1;
|
||||
this.ar = EnumEntitySize.SIZE_1;
|
||||
} else if ((double) f2 < 0.75D) {
|
||||
this.am = EnumEntitySize.SIZE_2;
|
||||
this.ar = EnumEntitySize.SIZE_2;
|
||||
} else if ((double) f2 < 1.0D) {
|
||||
this.am = EnumEntitySize.SIZE_3;
|
||||
this.ar = EnumEntitySize.SIZE_3;
|
||||
} else if ((double) f2 < 1.375D) {
|
||||
this.am = EnumEntitySize.SIZE_4;
|
||||
this.ar = EnumEntitySize.SIZE_4;
|
||||
} else if ((double) f2 < 1.75D) {
|
||||
this.am = EnumEntitySize.SIZE_5;
|
||||
this.ar = EnumEntitySize.SIZE_5;
|
||||
} else {
|
||||
this.am = EnumEntitySize.SIZE_6;
|
||||
this.ar = EnumEntitySize.SIZE_6;
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,14 +221,14 @@ public abstract class Entity {
|
||||
float f = this.width / 2.0F;
|
||||
float f1 = this.length;
|
||||
|
||||
this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.V, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.V + (double) f1, d2 + (double) f);
|
||||
this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.W, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.W + (double) f1, d2 + (double) f);
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
this.z();
|
||||
public void j_() {
|
||||
this.y();
|
||||
}
|
||||
|
||||
public void z() {
|
||||
public void y() {
|
||||
this.world.methodProfiler.a("entityBaseTick");
|
||||
if (this.vehicle != null && this.vehicle.dead) {
|
||||
this.vehicle = null;
|
||||
@ -231,50 +243,89 @@ public abstract class Entity {
|
||||
this.lastYaw = this.yaw;
|
||||
int i;
|
||||
|
||||
if (this.isSprinting() && !this.H()) {
|
||||
int j = MathHelper.floor(this.locX);
|
||||
int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
|
||||
if (!this.world.isStatic && this.world instanceof WorldServer) {
|
||||
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
|
||||
|
||||
i = MathHelper.floor(this.locZ);
|
||||
int l = this.world.getTypeId(j, k, i);
|
||||
i = this.z();
|
||||
if (this.ao) {
|
||||
// if (minecraftserver.getAllowNether()) { // CraftBukkit
|
||||
if (this.vehicle == null && this.h++ >= i) {
|
||||
this.h = i;
|
||||
this.an = this.ab();
|
||||
byte b0;
|
||||
|
||||
if (this.world.worldProvider.dimension == -1) {
|
||||
b0 = 0;
|
||||
} else {
|
||||
b0 = -1;
|
||||
}
|
||||
|
||||
this.b(b0);
|
||||
}
|
||||
|
||||
this.ao = false;
|
||||
// } // CraftBukkit
|
||||
} else {
|
||||
if (this.h > 0) {
|
||||
this.h -= 4;
|
||||
}
|
||||
|
||||
if (this.h < 0) {
|
||||
this.h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.an > 0) {
|
||||
--this.an;
|
||||
}
|
||||
}
|
||||
|
||||
int j;
|
||||
|
||||
if (this.isSprinting() && !this.H()) {
|
||||
int k = MathHelper.floor(this.locX);
|
||||
|
||||
i = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
|
||||
j = MathHelper.floor(this.locZ);
|
||||
int l = this.world.getTypeId(k, i, j);
|
||||
|
||||
if (l > 0) {
|
||||
this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
|
||||
this.world.addParticle("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.I()) {
|
||||
if (!this.ac && !this.justCreated) {
|
||||
if (!this.ad && !this.justCreated) {
|
||||
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
|
||||
|
||||
if (f > 1.0F) {
|
||||
f = 1.0F;
|
||||
}
|
||||
|
||||
this.world.makeSound(this, "random.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
this.world.makeSound(this, "liquid.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
float f1 = (float) MathHelper.floor(this.boundingBox.b);
|
||||
|
||||
float f2;
|
||||
float f3;
|
||||
|
||||
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
|
||||
for (j = 0; (float) j < 1.0F + this.width * 20.0F; ++j) {
|
||||
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
this.world.a("bubble", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
|
||||
this.world.addParticle("bubble", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
|
||||
}
|
||||
|
||||
for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
|
||||
for (j = 0; (float) j < 1.0F + this.width * 20.0F; ++j) {
|
||||
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
|
||||
this.world.a("splash", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY, this.motZ);
|
||||
this.world.addParticle("splash", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
}
|
||||
|
||||
this.fallDistance = 0.0F;
|
||||
this.ac = true;
|
||||
this.ad = true;
|
||||
this.fireTicks = 0;
|
||||
} else {
|
||||
this.ac = false;
|
||||
this.ad = false;
|
||||
}
|
||||
|
||||
if (this.world.isStatic) {
|
||||
@ -324,6 +375,10 @@ public abstract class Entity {
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
public int z() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected void A() {
|
||||
if (!this.fireProof) {
|
||||
// CraftBukkit start - fallen in lava TODO: this event spams!
|
||||
@ -387,16 +442,17 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void move(double d0, double d1, double d2) {
|
||||
if (this.X) {
|
||||
if (this.Y) {
|
||||
this.boundingBox.d(d0, d1, d2);
|
||||
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.V;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.W;
|
||||
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
|
||||
} else {
|
||||
this.world.methodProfiler.a("move");
|
||||
this.V *= 0.4F;
|
||||
this.W *= 0.4F;
|
||||
double d3 = this.locX;
|
||||
double d4 = this.locZ;
|
||||
double d4 = this.locY;
|
||||
double d5 = this.locZ;
|
||||
|
||||
if (this.J) {
|
||||
this.J = false;
|
||||
@ -408,54 +464,54 @@ public abstract class Entity {
|
||||
this.motZ = 0.0D;
|
||||
}
|
||||
|
||||
double d5 = d0;
|
||||
double d6 = d1;
|
||||
double d7 = d2;
|
||||
double d6 = d0;
|
||||
double d7 = d1;
|
||||
double d8 = d2;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.clone();
|
||||
boolean flag = this.onGround && this.isSneaking() && this instanceof EntityHuman;
|
||||
|
||||
if (flag) {
|
||||
double d8;
|
||||
double d9;
|
||||
|
||||
for (d8 = 0.05D; d0 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, 0.0D)).isEmpty(); d5 = d0) {
|
||||
if (d0 < d8 && d0 >= -d8) {
|
||||
for (d9 = 0.05D; d0 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, 0.0D)).isEmpty(); d6 = d0) {
|
||||
if (d0 < d9 && d0 >= -d9) {
|
||||
d0 = 0.0D;
|
||||
} else if (d0 > 0.0D) {
|
||||
d0 -= d8;
|
||||
d0 -= d9;
|
||||
} else {
|
||||
d0 += d8;
|
||||
d0 += d9;
|
||||
}
|
||||
}
|
||||
|
||||
for (; d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(0.0D, -1.0D, d2)).isEmpty(); d7 = d2) {
|
||||
if (d2 < d8 && d2 >= -d8) {
|
||||
for (; d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(0.0D, -1.0D, d2)).isEmpty(); d8 = d2) {
|
||||
if (d2 < d9 && d2 >= -d9) {
|
||||
d2 = 0.0D;
|
||||
} else if (d2 > 0.0D) {
|
||||
d2 -= d8;
|
||||
d2 -= d9;
|
||||
} else {
|
||||
d2 += d8;
|
||||
d2 += d9;
|
||||
}
|
||||
}
|
||||
|
||||
while (d0 != 0.0D && d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, d2)).isEmpty()) {
|
||||
if (d0 < d8 && d0 >= -d8) {
|
||||
if (d0 < d9 && d0 >= -d9) {
|
||||
d0 = 0.0D;
|
||||
} else if (d0 > 0.0D) {
|
||||
d0 -= d8;
|
||||
d0 -= d9;
|
||||
} else {
|
||||
d0 += d8;
|
||||
d0 += d9;
|
||||
}
|
||||
|
||||
if (d2 < d8 && d2 >= -d8) {
|
||||
if (d2 < d9 && d2 >= -d9) {
|
||||
d2 = 0.0D;
|
||||
} else if (d2 > 0.0D) {
|
||||
d2 -= d8;
|
||||
d2 -= d9;
|
||||
} else {
|
||||
d2 += d8;
|
||||
d2 += d9;
|
||||
}
|
||||
|
||||
d5 = d0;
|
||||
d7 = d2;
|
||||
d6 = d0;
|
||||
d8 = d2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,13 +524,13 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, d1, 0.0D);
|
||||
if (!this.K && d6 != d1) {
|
||||
if (!this.K && d7 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
}
|
||||
|
||||
boolean flag1 = this.onGround || d6 != d1 && d6 < 0.0D;
|
||||
boolean flag1 = this.onGround || d7 != d1 && d7 < 0.0D;
|
||||
|
||||
AxisAlignedBB axisalignedbb2;
|
||||
Iterator iterator1;
|
||||
@ -484,7 +540,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(d0, 0.0D, 0.0D);
|
||||
if (!this.K && d5 != d0) {
|
||||
if (!this.K && d6 != d0) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -495,27 +551,27 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, 0.0D, d2);
|
||||
if (!this.K && d7 != d2) {
|
||||
if (!this.K && d8 != d2) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
}
|
||||
|
||||
double d9;
|
||||
double d10;
|
||||
double d11;
|
||||
double d12;
|
||||
|
||||
if (this.W > 0.0F && flag1 && (flag || this.V < 0.05F) && (d5 != d0 || d7 != d2)) {
|
||||
d9 = d0;
|
||||
d10 = d1;
|
||||
double d11 = d2;
|
||||
|
||||
d0 = d5;
|
||||
d1 = (double) this.W;
|
||||
d2 = d7;
|
||||
if (this.X > 0.0F && flag1 && (flag || this.W < 0.05F) && (d6 != d0 || d8 != d2)) {
|
||||
d10 = d0;
|
||||
d11 = d1;
|
||||
d12 = d2;
|
||||
d0 = d6;
|
||||
d1 = (double) this.X;
|
||||
d2 = d8;
|
||||
AxisAlignedBB axisalignedbb3 = this.boundingBox.clone();
|
||||
|
||||
this.boundingBox.c(axisalignedbb);
|
||||
list = this.world.getCubes(this, this.boundingBox.a(d5, d1, d7));
|
||||
list = this.world.getCubes(this, this.boundingBox.a(d6, d1, d8));
|
||||
|
||||
Iterator iterator2;
|
||||
AxisAlignedBB axisalignedbb4;
|
||||
@ -525,7 +581,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, d1, 0.0D);
|
||||
if (!this.K && d6 != d1) {
|
||||
if (!this.K && d7 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -536,7 +592,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(d0, 0.0D, 0.0D);
|
||||
if (!this.K && d5 != d0) {
|
||||
if (!this.K && d6 != d0) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
@ -547,18 +603,18 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
this.boundingBox.d(0.0D, 0.0D, d2);
|
||||
if (!this.K && d7 != d2) {
|
||||
if (!this.K && d8 != d2) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
}
|
||||
|
||||
if (!this.K && d6 != d1) {
|
||||
if (!this.K && d7 != d1) {
|
||||
d2 = 0.0D;
|
||||
d1 = 0.0D;
|
||||
d0 = 0.0D;
|
||||
} else {
|
||||
d1 = (double) (-this.W);
|
||||
d1 = (double) (-this.X);
|
||||
|
||||
for (iterator2 = list.iterator(); iterator2.hasNext(); d1 = axisalignedbb4.b(this.boundingBox, d1)) {
|
||||
axisalignedbb4 = (AxisAlignedBB) iterator2.next();
|
||||
@ -567,16 +623,16 @@ public abstract class Entity {
|
||||
this.boundingBox.d(0.0D, d1, 0.0D);
|
||||
}
|
||||
|
||||
if (d9 * d9 + d11 * d11 >= d0 * d0 + d2 * d2) {
|
||||
d0 = d9;
|
||||
d1 = d10;
|
||||
d2 = d11;
|
||||
if (d10 * d10 + d12 * d12 >= d0 * d0 + d2 * d2) {
|
||||
d0 = d10;
|
||||
d1 = d11;
|
||||
d2 = d12;
|
||||
this.boundingBox.c(axisalignedbb3);
|
||||
} else {
|
||||
double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
|
||||
double d13 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
|
||||
|
||||
if (d12 > 0.0D) {
|
||||
this.V = (float) ((double) this.V + d12 + 0.01D);
|
||||
if (d13 > 0.0D) {
|
||||
this.W = (float) ((double) this.W + d13 + 0.01D);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -584,40 +640,41 @@ public abstract class Entity {
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("rest");
|
||||
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.V;
|
||||
this.locY = this.boundingBox.b + (double) this.height - (double) this.W;
|
||||
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
|
||||
this.positionChanged = d5 != d0 || d7 != d2;
|
||||
this.G = d6 != d1;
|
||||
this.onGround = d6 != d1 && d6 < 0.0D;
|
||||
this.positionChanged = d6 != d0 || d8 != d2;
|
||||
this.G = d7 != d1;
|
||||
this.onGround = d7 != d1 && d7 < 0.0D;
|
||||
this.H = this.positionChanged || this.G;
|
||||
this.a(d1, this.onGround);
|
||||
if (d5 != d0) {
|
||||
if (d6 != d0) {
|
||||
this.motX = 0.0D;
|
||||
}
|
||||
|
||||
if (d6 != d1) {
|
||||
if (d7 != d1) {
|
||||
this.motY = 0.0D;
|
||||
}
|
||||
|
||||
if (d7 != d2) {
|
||||
if (d8 != d2) {
|
||||
this.motZ = 0.0D;
|
||||
}
|
||||
|
||||
d9 = this.locX - d3;
|
||||
d10 = this.locZ - d4;
|
||||
d10 = this.locX - d3;
|
||||
d11 = this.locY - d4;
|
||||
d12 = this.locZ - d5;
|
||||
|
||||
// CraftBukkit start
|
||||
if ((this.positionChanged) && (this.getBukkitEntity() instanceof Vehicle)) {
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY - (double) this.height), MathHelper.floor(this.locZ));
|
||||
|
||||
if (d5 > d0) {
|
||||
if (d6 > d0) {
|
||||
block = block.getRelative(BlockFace.SOUTH);
|
||||
} else if (d5 < d0) {
|
||||
} else if (d6 < d0) {
|
||||
block = block.getRelative(BlockFace.NORTH);
|
||||
} else if (d7 > d2) {
|
||||
} else if (d8 > d2) {
|
||||
block = block.getRelative(BlockFace.WEST);
|
||||
} else if (d7 < d2) {
|
||||
} else if (d8 < d2) {
|
||||
block = block.getRelative(BlockFace.EAST);
|
||||
}
|
||||
|
||||
@ -626,8 +683,7 @@ public abstract class Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.e_() && !flag && this.vehicle == null) {
|
||||
this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d9 * d9 + d10 * d10) * 0.6D);
|
||||
if (this.f_() && !flag && this.vehicle == null) {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
@ -637,8 +693,24 @@ public abstract class Entity {
|
||||
l = this.world.getTypeId(i, j - 1, k);
|
||||
}
|
||||
|
||||
if (this.Q > (float) this.b && l > 0) {
|
||||
this.b = (int) this.Q + 1;
|
||||
if (l != Block.LADDER.id) {
|
||||
d11 = 0.0D;
|
||||
}
|
||||
|
||||
this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D);
|
||||
this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D);
|
||||
if (this.R > (float) this.c && l > 0) {
|
||||
this.c = (int) this.R + 1;
|
||||
if (this.H()) {
|
||||
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.35F;
|
||||
|
||||
if (f > 1.0F) {
|
||||
f = 1.0F;
|
||||
}
|
||||
|
||||
this.world.makeSound(this, "liquid.swim", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||
}
|
||||
|
||||
this.a(i, j, k, l);
|
||||
Block.byId[l].b(this.world, i, j, k, this);
|
||||
}
|
||||
@ -685,7 +757,7 @@ public abstract class Entity {
|
||||
int i1 = MathHelper.floor(this.boundingBox.e - 0.001D);
|
||||
int j1 = MathHelper.floor(this.boundingBox.f - 0.001D);
|
||||
|
||||
if (this.world.c(i, j, k, l, i1, j1)) {
|
||||
if (this.world.d(i, j, k, l, i1, j1)) {
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
for (int i2 = k; i2 <= j1; ++i2) {
|
||||
@ -711,28 +783,13 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean f_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void a(double d0, boolean flag) {
|
||||
if (flag) {
|
||||
if (this.fallDistance > 0.0F) {
|
||||
if (this instanceof EntityLiving) {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
int l = this.world.getTypeId(i, j, k);
|
||||
|
||||
if (l == 0 && this.world.getTypeId(i, j - 1, k) == Block.FENCE.id) {
|
||||
l = this.world.getTypeId(i, j - 1, k);
|
||||
}
|
||||
|
||||
if (l > 0) {
|
||||
Block.byId[l].a(this.world, i, j, k, this, this.fallDistance);
|
||||
}
|
||||
}
|
||||
|
||||
this.a(this.fallDistance);
|
||||
this.fallDistance = 0.0F;
|
||||
}
|
||||
@ -776,11 +833,11 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public boolean G() {
|
||||
return this.ac || this.world.B(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
|
||||
return this.ad || this.world.B(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
|
||||
}
|
||||
|
||||
public boolean H() {
|
||||
return this.ac;
|
||||
return this.ad;
|
||||
}
|
||||
|
||||
public boolean I() {
|
||||
@ -864,7 +921,7 @@ public abstract class Entity {
|
||||
this.lastZ = this.locZ = d2;
|
||||
this.lastYaw = this.yaw = f;
|
||||
this.lastPitch = this.pitch = f1;
|
||||
this.V = 0.0F;
|
||||
this.W = 0.0F;
|
||||
double d3 = (double) (this.lastYaw - f);
|
||||
|
||||
if (d3 < -180.0D) {
|
||||
@ -880,9 +937,9 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
|
||||
this.S = this.lastX = this.locX = d0;
|
||||
this.T = this.lastY = this.locY = d1 + (double) this.height;
|
||||
this.U = this.lastZ = this.locZ = d2;
|
||||
this.T = this.lastX = this.locX = d0;
|
||||
this.U = this.lastY = this.locY = d1 + (double) this.height;
|
||||
this.V = this.lastZ = this.locZ = d2;
|
||||
this.yaw = f;
|
||||
this.pitch = f1;
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
@ -942,8 +999,8 @@ public abstract class Entity {
|
||||
d1 *= d3;
|
||||
d0 *= 0.05000000074505806D;
|
||||
d1 *= 0.05000000074505806D;
|
||||
d0 *= (double) (1.0F - this.Y);
|
||||
d1 *= (double) (1.0F - this.Y);
|
||||
d0 *= (double) (1.0F - this.Z);
|
||||
d1 *= (double) (1.0F - this.Z);
|
||||
this.g(-d0, 0.0D, -d1);
|
||||
entity.g(d0, 0.0D, d1);
|
||||
}
|
||||
@ -954,7 +1011,7 @@ public abstract class Entity {
|
||||
this.motX += d0;
|
||||
this.motY += d1;
|
||||
this.motZ += d2;
|
||||
this.al = true;
|
||||
this.am = true;
|
||||
}
|
||||
|
||||
protected void K() {
|
||||
@ -989,7 +1046,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void d(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.V, this.locZ}));
|
||||
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.W, this.locZ}));
|
||||
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
|
||||
|
||||
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
|
||||
@ -1008,6 +1065,7 @@ public abstract class Entity {
|
||||
nbttagcompound.setShort("Fire", (short) this.fireTicks);
|
||||
nbttagcompound.setShort("Air", (short) this.getAirTicks());
|
||||
nbttagcompound.setBoolean("OnGround", this.onGround);
|
||||
nbttagcompound.setInt("Dimension", this.dimension);
|
||||
// CraftBukkit start
|
||||
nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
|
||||
nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
|
||||
@ -1039,15 +1097,16 @@ public abstract class Entity {
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
this.lastX = this.S = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
|
||||
this.lastY = this.T = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
|
||||
this.lastZ = this.U = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
|
||||
this.lastX = this.T = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
|
||||
this.lastY = this.U = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
|
||||
this.lastZ = this.V = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
|
||||
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
|
||||
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
|
||||
this.fallDistance = nbttagcompound.getFloat("FallDistance");
|
||||
this.fireTicks = nbttagcompound.getShort("Fire");
|
||||
this.setAirTicks(nbttagcompound.getShort("Air"));
|
||||
this.onGround = nbttagcompound.getBoolean("OnGround");
|
||||
this.dimension = nbttagcompound.getInt("Dimension");
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
|
||||
// CraftBukkit start
|
||||
@ -1191,29 +1250,29 @@ public abstract class Entity {
|
||||
this.motX = 0.0D;
|
||||
this.motY = 0.0D;
|
||||
this.motZ = 0.0D;
|
||||
this.h_();
|
||||
this.j_();
|
||||
if (this.vehicle != null) {
|
||||
this.vehicle.V();
|
||||
this.f += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
|
||||
this.g += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
|
||||
|
||||
for (this.e += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.f >= 180.0D; this.f -= 360.0D) {
|
||||
for (this.f += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.g >= 180.0D; this.g -= 360.0D) {
|
||||
;
|
||||
}
|
||||
|
||||
while (this.g < -180.0D) {
|
||||
this.g += 360.0D;
|
||||
}
|
||||
|
||||
while (this.f >= 180.0D) {
|
||||
this.f -= 360.0D;
|
||||
}
|
||||
|
||||
while (this.f < -180.0D) {
|
||||
this.f += 360.0D;
|
||||
}
|
||||
|
||||
while (this.e >= 180.0D) {
|
||||
this.e -= 360.0D;
|
||||
}
|
||||
|
||||
while (this.e < -180.0D) {
|
||||
this.e += 360.0D;
|
||||
}
|
||||
|
||||
double d0 = this.f * 0.5D;
|
||||
double d1 = this.e * 0.5D;
|
||||
double d0 = this.g * 0.5D;
|
||||
double d1 = this.f * 0.5D;
|
||||
float f = 10.0F;
|
||||
|
||||
if (d0 > (double) f) {
|
||||
@ -1232,8 +1291,8 @@ public abstract class Entity {
|
||||
d1 = (double) (-f);
|
||||
}
|
||||
|
||||
this.f -= d0;
|
||||
this.e -= d1;
|
||||
this.g -= d0;
|
||||
this.f -= d1;
|
||||
this.yaw = (float) ((double) this.yaw + d0);
|
||||
this.pitch = (float) ((double) this.pitch + d1);
|
||||
}
|
||||
@ -1241,10 +1300,10 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public void V() {
|
||||
if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bF()) {
|
||||
this.passenger.S = this.passenger.locX;
|
||||
this.passenger.T = this.passenger.locY;
|
||||
this.passenger.U = this.passenger.locZ;
|
||||
if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bS()) {
|
||||
this.passenger.T = this.T;
|
||||
this.passenger.U = this.U + this.X() + this.passenger.W();
|
||||
this.passenger.V = this.V;
|
||||
}
|
||||
|
||||
this.passenger.setPosition(this.locX, this.locY + this.X() + this.passenger.W(), this.locZ);
|
||||
@ -1279,8 +1338,8 @@ public abstract class Entity {
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
this.getBukkitEntity(); // make sure bukkitEntity is initialised
|
||||
// CraftBukkit end
|
||||
this.e = 0.0D;
|
||||
this.f = 0.0D;
|
||||
this.g = 0.0D;
|
||||
if (entity == null) {
|
||||
if (this.vehicle != null) {
|
||||
// CraftBukkit start
|
||||
@ -1370,18 +1429,41 @@ public abstract class Entity {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void aa() {}
|
||||
public void aa() {
|
||||
if (this.an > 0) {
|
||||
this.an = this.ab();
|
||||
} else {
|
||||
double d0 = this.lastX - this.locX;
|
||||
double d1 = this.lastZ - this.locZ;
|
||||
|
||||
if (!this.world.isStatic && !this.ao) {
|
||||
this.aq = Direction.a(d0, d1);
|
||||
}
|
||||
|
||||
this.ao = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int ab() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
public ItemStack[] getEquipment() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setEquipment(int i, ItemStack itemstack) {}
|
||||
|
||||
public boolean isBurning() {
|
||||
return this.fireTicks > 0 || this.f(0);
|
||||
return this.fireTicks > 0 || this.e(0);
|
||||
}
|
||||
|
||||
public boolean ag() {
|
||||
return this.vehicle != null || this.e(2);
|
||||
}
|
||||
|
||||
public boolean isSneaking() {
|
||||
return this.f(1);
|
||||
return this.e(1);
|
||||
}
|
||||
|
||||
public void setSneaking(boolean flag) {
|
||||
@ -1389,18 +1471,26 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
public boolean isSprinting() {
|
||||
return this.f(3);
|
||||
return this.e(3);
|
||||
}
|
||||
|
||||
public void setSprinting(boolean flag) {
|
||||
this.a(3, flag);
|
||||
}
|
||||
|
||||
public void c(boolean flag) {
|
||||
public boolean isInvisible() {
|
||||
return this.e(5);
|
||||
}
|
||||
|
||||
public void setInvisible(boolean flag) {
|
||||
this.a(5, flag);
|
||||
}
|
||||
|
||||
public void d(boolean flag) {
|
||||
this.a(4, flag);
|
||||
}
|
||||
|
||||
protected boolean f(int i) {
|
||||
protected boolean e(int i) {
|
||||
return (this.datawatcher.getByte(0) & 1 << i) != 0;
|
||||
}
|
||||
|
||||
@ -1542,7 +1632,7 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void aj() {
|
||||
public void am() {
|
||||
this.J = true;
|
||||
this.fallDistance = 0.0F;
|
||||
}
|
||||
@ -1557,7 +1647,7 @@ public abstract class Entity {
|
||||
return LocaleI18n.get("entity." + s + ".name");
|
||||
}
|
||||
|
||||
public Entity[] al() {
|
||||
public Entity[] ao() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1565,15 +1655,68 @@ public abstract class Entity {
|
||||
return this == entity;
|
||||
}
|
||||
|
||||
public float am() {
|
||||
public float ap() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
public boolean an() {
|
||||
public boolean aq() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] { this.getClass().getSimpleName(), this.getLocalizedName(), Integer.valueOf(this.id), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)});
|
||||
}
|
||||
|
||||
public void j(Entity entity) {
|
||||
this.setPositionRotation(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
|
||||
}
|
||||
|
||||
public void a(Entity entity, boolean flag) {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
entity.d(nbttagcompound);
|
||||
this.e(nbttagcompound);
|
||||
this.an = entity.an;
|
||||
this.aq = entity.aq;
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
if (!this.world.isStatic && !this.dead) {
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
int j = this.dimension;
|
||||
WorldServer worldserver = minecraftserver.getWorldServer(j);
|
||||
WorldServer worldserver1 = minecraftserver.getWorldServer(i);
|
||||
|
||||
this.dimension = i;
|
||||
this.world.kill(this);
|
||||
this.dead = false;
|
||||
minecraftserver.getServerConfigurationManager().a(this, j, worldserver, worldserver1);
|
||||
Entity entity = EntityTypes.createEntityByName(EntityTypes.b(this), worldserver1);
|
||||
|
||||
if (entity != null) {
|
||||
entity.a(this, true);
|
||||
worldserver1.addEntity(entity);
|
||||
}
|
||||
|
||||
this.dead = true;
|
||||
worldserver.i();
|
||||
worldserver1.i();
|
||||
}
|
||||
}
|
||||
|
||||
public float a(Explosion explosion, Block block, int i, int j, int k) {
|
||||
return block.a(this);
|
||||
}
|
||||
|
||||
public int as() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public int at() {
|
||||
return this.aq;
|
||||
}
|
||||
|
||||
public boolean au() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ public abstract class EntityAgeable extends EntityCreature {
|
||||
this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
|
||||
}
|
||||
|
||||
public void d() {
|
||||
super.d();
|
||||
public void c() {
|
||||
super.c();
|
||||
int i = this.getAge();
|
||||
|
||||
if (ageLocked) return; // CraftBukkit
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityArrow extends Entity {
|
||||
public class EntityArrow extends Entity implements IProjectile {
|
||||
|
||||
private int d = -1;
|
||||
private int e = -1;
|
||||
@ -22,9 +22,9 @@ public class EntityArrow extends Entity {
|
||||
public int shake = 0;
|
||||
public Entity shooter;
|
||||
private int j;
|
||||
private int an = 0;
|
||||
private int as = 0;
|
||||
private double damage = 2.0D;
|
||||
private int ap;
|
||||
private int au;
|
||||
|
||||
public EntityArrow(World world) {
|
||||
super(world);
|
||||
@ -111,8 +111,8 @@ public class EntityArrow extends Entity {
|
||||
this.j = 0;
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
super.h_();
|
||||
public void j_() {
|
||||
super.j_();
|
||||
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
|
||||
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
@ -126,7 +126,7 @@ public class EntityArrow extends Entity {
|
||||
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.a().create(this.locX, this.locY, this.locZ))) {
|
||||
if (axisalignedbb != null && axisalignedbb.a(this.world.getVec3DPool().create(this.locX, this.locY, this.locZ))) {
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
@ -150,18 +150,18 @@ public class EntityArrow extends Entity {
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.j = 0;
|
||||
this.an = 0;
|
||||
this.as = 0;
|
||||
}
|
||||
} else {
|
||||
++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);
|
||||
++this.as;
|
||||
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
|
||||
|
||||
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);
|
||||
vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
vec3d1 = this.world.getVec3DPool().create(movingobjectposition.pos.c, movingobjectposition.pos.d, movingobjectposition.pos.e);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
@ -174,7 +174,7 @@ public class EntityArrow extends Entity {
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1.L() && (entity1 != this.shooter || this.an >= 5)) {
|
||||
if (entity1.L() && (entity1 != this.shooter || this.as >= 5)) {
|
||||
f1 = 0.3F;
|
||||
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
|
||||
@ -206,7 +206,7 @@ public class EntityArrow extends Entity {
|
||||
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
int l = MathHelper.f((double) f2 * this.damage);
|
||||
|
||||
if (this.g()) {
|
||||
if (this.d()) {
|
||||
l += this.random.nextInt(l / 2 + 2);
|
||||
}
|
||||
|
||||
@ -232,12 +232,12 @@ public class EntityArrow extends Entity {
|
||||
|
||||
// if (movingobjectposition.entity.damageEntity(damagesource, l)) { // CraftBukkit - moved up
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
++((EntityLiving) movingobjectposition.entity).bd;
|
||||
if (this.ap > 0) {
|
||||
++((EntityLiving) movingobjectposition.entity).bk;
|
||||
if (this.au > 0) {
|
||||
float f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
if (f3 > 0.0F) {
|
||||
movingobjectposition.entity.g(this.motX * (double) this.ap * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.ap * 0.6000000238418579D / (double) f3);
|
||||
movingobjectposition.entity.g(this.motX * (double) this.au * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.au * 0.6000000238418579D / (double) f3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,7 @@ public class EntityArrow extends Entity {
|
||||
this.motZ *= -0.10000000149011612D;
|
||||
this.yaw += 180.0F;
|
||||
this.lastYaw += 180.0F;
|
||||
this.an = 0;
|
||||
this.as = 0;
|
||||
}
|
||||
} else {
|
||||
this.d = movingobjectposition.b;
|
||||
@ -258,9 +258,9 @@ public class EntityArrow extends Entity {
|
||||
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));
|
||||
this.motX = (double) ((float) (movingobjectposition.pos.c - this.locX));
|
||||
this.motY = (double) ((float) (movingobjectposition.pos.d - this.locY));
|
||||
this.motZ = (double) ((float) (movingobjectposition.pos.e - this.locZ));
|
||||
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
|
||||
this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
|
||||
@ -268,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.e(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.g()) {
|
||||
if (this.d()) {
|
||||
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);
|
||||
this.world.addParticle("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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ public class EntityArrow extends Entity {
|
||||
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);
|
||||
this.world.addParticle("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);
|
||||
}
|
||||
|
||||
f4 = 0.8F;
|
||||
@ -359,7 +359,7 @@ public class EntityArrow extends Entity {
|
||||
if (!this.world.isStatic && this.inGround && this.shake <= 0) {
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack = new ItemStack(Item.ARROW);
|
||||
if (this.inGround && this.fromPlayer == 1 && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||
if (this.fromPlayer == 1 && 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);
|
||||
@ -385,23 +385,27 @@ public class EntityArrow extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean f_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void b(double d0) {
|
||||
this.damage = d0;
|
||||
}
|
||||
|
||||
public double d() {
|
||||
public double c() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.ap = i;
|
||||
this.au = i;
|
||||
}
|
||||
|
||||
public boolean an() {
|
||||
public boolean aq() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void d(boolean flag) {
|
||||
public void e(boolean flag) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
if (flag) {
|
||||
@ -411,7 +415,7 @@ public class EntityArrow extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
public boolean d() {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
return (b0 & 1) != 0;
|
||||
|
@ -4,14 +4,13 @@ public class EntityBlaze extends EntityMonster {
|
||||
|
||||
private float d = 0.5F;
|
||||
private int e;
|
||||
private int g;
|
||||
private int f;
|
||||
|
||||
public EntityBlaze(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/fire.png";
|
||||
this.fireProof = true;
|
||||
this.damage = 6;
|
||||
this.aV = 10;
|
||||
this.bc = 10;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
@ -23,15 +22,15 @@ public class EntityBlaze extends EntityMonster {
|
||||
this.datawatcher.a(16, new Byte((byte) 0));
|
||||
}
|
||||
|
||||
protected String aQ() {
|
||||
protected String aW() {
|
||||
return "mob.blaze.breathe";
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
protected String aX() {
|
||||
return "mob.blaze.hit";
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
protected String aY() {
|
||||
return "mob.blaze.death";
|
||||
}
|
||||
|
||||
@ -39,7 +38,7 @@ public class EntityBlaze extends EntityMonster {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
public void d() {
|
||||
public void c() {
|
||||
if (!this.world.isStatic) {
|
||||
if (this.G()) {
|
||||
this.damageEntity(DamageSource.DROWN, 1);
|
||||
@ -51,7 +50,7 @@ public class EntityBlaze extends EntityMonster {
|
||||
this.d = 0.5F + (float) this.random.nextGaussian() * 3.0F;
|
||||
}
|
||||
|
||||
if (this.m() != null && this.m().locY + (double) this.m().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.d) {
|
||||
if (this.l() != null && this.l().locY + (double) this.l().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.d) {
|
||||
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
|
||||
}
|
||||
}
|
||||
@ -65,35 +64,35 @@ public class EntityBlaze extends EntityMonster {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
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);
|
||||
this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
super.d();
|
||||
super.c();
|
||||
}
|
||||
|
||||
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.k(entity);
|
||||
this.l(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));
|
||||
double d2 = entity.locZ - this.locZ;
|
||||
|
||||
if (this.attackTicks == 0) {
|
||||
++this.g;
|
||||
if (this.g == 1) {
|
||||
++this.f;
|
||||
if (this.f == 1) {
|
||||
this.attackTicks = 60;
|
||||
this.e(true);
|
||||
} else if (this.g <= 4) {
|
||||
this.f(true);
|
||||
} else if (this.f <= 4) {
|
||||
this.attackTicks = 6;
|
||||
} else {
|
||||
this.attackTicks = 100;
|
||||
this.g = 0;
|
||||
this.e(false);
|
||||
this.f = 0;
|
||||
this.f(false);
|
||||
}
|
||||
|
||||
if (this.g > 1) {
|
||||
if (this.f > 1) {
|
||||
float f1 = MathHelper.c(f) * 0.5F;
|
||||
|
||||
this.world.a((EntityHuman) null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
@ -119,7 +118,7 @@ public class EntityBlaze extends EntityMonster {
|
||||
}
|
||||
|
||||
public boolean isBurning() {
|
||||
return this.n();
|
||||
return this.m();
|
||||
}
|
||||
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
@ -137,11 +136,11 @@ public class EntityBlaze extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean n() {
|
||||
public boolean m() {
|
||||
return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void e(boolean flag) {
|
||||
public void f(boolean flag) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
if (flag) {
|
||||
@ -153,7 +152,11 @@ public class EntityBlaze extends EntityMonster {
|
||||
this.datawatcher.watch(16, Byte.valueOf(b0));
|
||||
}
|
||||
|
||||
protected boolean o() {
|
||||
protected boolean i_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int c(Entity entity) {
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class EntityBoat extends Entity {
|
||||
this.height = this.length / 2.0F;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean f_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -107,8 +107,8 @@ public class EntityBoat extends Entity {
|
||||
// i = event.getDamage(); // TODO Why don't we do this?
|
||||
// CraftBukkit end
|
||||
|
||||
this.c(-this.i());
|
||||
this.b(10);
|
||||
this.h(-this.h());
|
||||
this.g(10);
|
||||
this.setDamage(this.getDamage() + i * 10);
|
||||
this.K();
|
||||
if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
|
||||
@ -144,7 +144,7 @@ public class EntityBoat extends Entity {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
public void j_() {
|
||||
// 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.h_();
|
||||
if (this.h() > 0) {
|
||||
this.b(this.h() - 1);
|
||||
super.j_();
|
||||
if (this.g() > 0) {
|
||||
this.g(this.g() - 1);
|
||||
}
|
||||
|
||||
if (this.getDamage() > 0) {
|
||||
@ -195,11 +195,11 @@ public class EntityBoat extends Entity {
|
||||
if (this.random.nextBoolean()) {
|
||||
d8 = this.locX - d4 * d6 * 0.8D + d5 * d7;
|
||||
d9 = this.locZ - d5 * d6 * 0.8D - d4 * d7;
|
||||
this.world.a("splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
|
||||
this.world.addParticle("splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
|
||||
} else {
|
||||
d8 = this.locX + d4 + d5 * d6 * 0.7D;
|
||||
d9 = this.locZ + d5 - d4 * d6 * 0.7D;
|
||||
this.world.a("splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
|
||||
this.world.addParticle("splash", d8, this.locY - 0.125D, d9, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -428,19 +428,19 @@ public class EntityBoat extends Entity {
|
||||
return this.datawatcher.getInt(19);
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
public void g(int i) {
|
||||
this.datawatcher.watch(17, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public int h() {
|
||||
public int g() {
|
||||
return this.datawatcher.getInt(17);
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
public void h(int i) {
|
||||
this.datawatcher.watch(18, Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public int i() {
|
||||
public int h() {
|
||||
return this.datawatcher.getInt(18);
|
||||
}
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ public class EntityChicken extends EntityAnimal {
|
||||
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(3, new PathfinderGoalTempt(this, 0.25F, Item.SEEDS.id, false));
|
||||
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.28F));
|
||||
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, f));
|
||||
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
||||
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
|
||||
}
|
||||
|
||||
public boolean aV() {
|
||||
public boolean bb() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@ public class EntityChicken extends EntityAnimal {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public void d() {
|
||||
super.d();
|
||||
public void c() {
|
||||
super.c();
|
||||
this.h = this.e;
|
||||
this.g = this.f;
|
||||
this.f = (float) ((double) this.f + (double) (this.onGround ? -1 : 4) * 0.3D);
|
||||
@ -59,7 +59,7 @@ public class EntityChicken extends EntityAnimal {
|
||||
|
||||
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.world.makeSound(this, "mob.chicken.plop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
this.b(Item.EGG.id, 1);
|
||||
this.j = this.random.nextInt(6000) + 6000;
|
||||
}
|
||||
@ -67,16 +67,20 @@ public class EntityChicken extends EntityAnimal {
|
||||
|
||||
protected void a(float f) {}
|
||||
|
||||
protected String aQ() {
|
||||
return "mob.chicken";
|
||||
protected String aW() {
|
||||
return "mob.chicken.say";
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
return "mob.chickenhurt";
|
||||
protected String aX() {
|
||||
return "mob.chicken.hurt";
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
return "mob.chickenhurt";
|
||||
protected String aY() {
|
||||
return "mob.chicken.hurt";
|
||||
}
|
||||
|
||||
protected void a(int i, int j, int k, int l) {
|
||||
this.world.makeSound(this, "mob.chicken.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
protected int getLootId() {
|
||||
@ -105,4 +109,8 @@ public class EntityChicken extends EntityAnimal {
|
||||
public EntityAnimal createChild(EntityAnimal entityanimal) {
|
||||
return new EntityChicken(this.world);
|
||||
}
|
||||
|
||||
public boolean c(ItemStack itemstack) {
|
||||
return itemstack != null && itemstack.getItem() instanceof ItemSeeds;
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
public class EntityComplex extends EntityLiving {
|
||||
|
||||
protected int a = 100;
|
||||
|
||||
public EntityComplex(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, int i) {
|
||||
return this.damageEntity(damagesource, i);
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean dealDamage(DamageSource damagesource, int i) { // CraftBukkit - protected -> public
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ public class EntityCow extends EntityAnimal {
|
||||
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
|
||||
}
|
||||
|
||||
public boolean aV() {
|
||||
public boolean bb() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -30,19 +30,23 @@ public class EntityCow extends EntityAnimal {
|
||||
return 10;
|
||||
}
|
||||
|
||||
protected String aQ() {
|
||||
return "mob.cow";
|
||||
protected String aW() {
|
||||
return "mob.cow.say";
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
return "mob.cowhurt";
|
||||
protected String aX() {
|
||||
return "mob.cow.hurt";
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
return "mob.cowhurt";
|
||||
protected String aY() {
|
||||
return "mob.cow.hurt";
|
||||
}
|
||||
|
||||
protected float aP() {
|
||||
protected void a(int i, int j, int k, int l) {
|
||||
this.world.makeSound(this, "mob.cow.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
protected float aV() {
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,8 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
||||
|
||||
public abstract class EntityCreature extends EntityLiving {
|
||||
|
||||
public PathEntity pathEntity; // CraftBukkit - public
|
||||
public Entity target; // CraftBukkit - public
|
||||
public PathEntity pathEntity; // CraftBukkit - private -> public
|
||||
public Entity target; // CraftBukkit - protected -> public
|
||||
protected boolean b = false;
|
||||
protected int c = 0;
|
||||
|
||||
@ -16,17 +16,17 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
super(world);
|
||||
}
|
||||
|
||||
protected boolean i() {
|
||||
protected boolean h() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void be() {
|
||||
protected void bk() {
|
||||
this.world.methodProfiler.a("ai");
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
}
|
||||
|
||||
this.b = this.i();
|
||||
this.b = this.h();
|
||||
float f = 16.0F;
|
||||
|
||||
if (this.target == null) {
|
||||
@ -52,7 +52,7 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
} else if (this.target.isAlive()) {
|
||||
float f1 = this.target.d((Entity) this);
|
||||
|
||||
if (this.l(this.target)) {
|
||||
if (this.m(this.target)) {
|
||||
this.a(this.target, f1);
|
||||
}
|
||||
} else {
|
||||
@ -73,8 +73,8 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.world.methodProfiler.b();
|
||||
if (!this.b && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
|
||||
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
|
||||
} else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bq < 100) {
|
||||
this.j();
|
||||
} else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bC < 100) {
|
||||
this.i();
|
||||
}
|
||||
|
||||
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
|
||||
@ -87,7 +87,7 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
Vec3D vec3d = this.pathEntity.a((Entity) this);
|
||||
double d0 = (double) (this.width * 2.0F);
|
||||
|
||||
while (vec3d != null && vec3d.d(this.locX, vec3d.b, this.locZ) < d0 * d0) {
|
||||
while (vec3d != null && vec3d.d(this.locX, vec3d.d, this.locZ) < d0 * d0) {
|
||||
this.pathEntity.a();
|
||||
if (this.pathEntity.b()) {
|
||||
vec3d = null;
|
||||
@ -97,16 +97,16 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
}
|
||||
}
|
||||
|
||||
this.bu = false;
|
||||
this.bG = false;
|
||||
if (vec3d != null) {
|
||||
double d1 = vec3d.a - this.locX;
|
||||
double d2 = vec3d.c - this.locZ;
|
||||
double d3 = vec3d.b - (double) i;
|
||||
double d1 = vec3d.c - this.locX;
|
||||
double d2 = vec3d.e - this.locZ;
|
||||
double d3 = vec3d.d - (double) i;
|
||||
// CraftBukkit - Math -> TrigMath
|
||||
float f2 = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
float f3 = MathHelper.g(f2 - this.yaw);
|
||||
|
||||
this.bs = this.bw;
|
||||
this.bE = this.bI;
|
||||
if (f3 > 30.0F) {
|
||||
f3 = 30.0F;
|
||||
}
|
||||
@ -123,12 +123,12 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
|
||||
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
|
||||
this.br = -MathHelper.sin(f3) * this.bs * 1.0F;
|
||||
this.bs = MathHelper.cos(f3) * this.bs * 1.0F;
|
||||
this.bD = -MathHelper.sin(f3) * this.bE * 1.0F;
|
||||
this.bE = MathHelper.cos(f3) * this.bE * 1.0F;
|
||||
}
|
||||
|
||||
if (d3 > 0.0D) {
|
||||
this.bu = true;
|
||||
this.bG = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,22 +136,22 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.a(this.target, 30.0F, 30.0F);
|
||||
}
|
||||
|
||||
if (this.positionChanged && !this.l()) {
|
||||
this.bu = true;
|
||||
if (this.positionChanged && !this.k()) {
|
||||
this.bG = true;
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
|
||||
this.bu = true;
|
||||
this.bG = true;
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
} else {
|
||||
super.be();
|
||||
super.bk();
|
||||
this.pathEntity = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void j() {
|
||||
protected void i() {
|
||||
this.world.methodProfiler.a("stroll");
|
||||
boolean flag = false;
|
||||
int i = -1;
|
||||
@ -199,7 +199,7 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
public boolean k() {
|
||||
return this.pathEntity != null;
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.pathEntity = pathentity;
|
||||
}
|
||||
|
||||
public Entity m() {
|
||||
public Entity l() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
@ -215,17 +215,13 @@ public abstract class EntityCreature extends EntityLiving {
|
||||
this.target = entity;
|
||||
}
|
||||
|
||||
protected float bs() {
|
||||
if (this.aV()) {
|
||||
return 1.0F;
|
||||
} else {
|
||||
float f = super.bs();
|
||||
public float by() {
|
||||
float f = super.by();
|
||||
|
||||
if (this.c > 0) {
|
||||
f *= 2.0F;
|
||||
}
|
||||
|
||||
return f;
|
||||
if (this.c > 0 && !this.bb()) {
|
||||
f *= 2.0F;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,10 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
|
||||
public class EntityCreeper extends EntityMonster {
|
||||
|
||||
int fuseTicks;
|
||||
int e;
|
||||
private int d;
|
||||
private int fuseTicks;
|
||||
private int maxFuseTicks = 30;
|
||||
private int explosionRadius = 3;
|
||||
private int record = -1; // CraftBukkit
|
||||
|
||||
public EntityCreeper(World world) {
|
||||
@ -25,10 +27,22 @@ public class EntityCreeper extends EntityMonster {
|
||||
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
|
||||
}
|
||||
|
||||
public boolean aV() {
|
||||
public boolean bb() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int as() {
|
||||
return this.aF() == null ? 3 : 3 + (this.health - 1);
|
||||
}
|
||||
|
||||
protected void a(float f) {
|
||||
super.a(f);
|
||||
this.fuseTicks = (int) ((float) this.fuseTicks + f * 1.5F);
|
||||
if (this.fuseTicks > this.maxFuseTicks - 5) {
|
||||
this.fuseTicks = this.maxFuseTicks - 5;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 20;
|
||||
}
|
||||
@ -44,17 +58,27 @@ public class EntityCreeper extends EntityMonster {
|
||||
if (this.datawatcher.getByte(17) == 1) {
|
||||
nbttagcompound.setBoolean("powered", true);
|
||||
}
|
||||
|
||||
nbttagcompound.setShort("Fuse", (short) this.maxFuseTicks);
|
||||
nbttagcompound.setByte("ExplosionRadius", (byte) this.explosionRadius);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0)));
|
||||
if (nbttagcompound.hasKey("Fuse")) {
|
||||
this.maxFuseTicks = nbttagcompound.getShort("Fuse");
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("ExplosionRadius")) {
|
||||
this.explosionRadius = nbttagcompound.getByte("ExplosionRadius");
|
||||
}
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
public void j_() {
|
||||
if (this.isAlive()) {
|
||||
this.e = this.fuseTicks;
|
||||
int i = this.p();
|
||||
this.d = this.fuseTicks;
|
||||
int i = this.o();
|
||||
|
||||
if (i > 0 && this.fuseTicks == 0) {
|
||||
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
|
||||
@ -65,16 +89,17 @@ public class EntityCreeper extends EntityMonster {
|
||||
this.fuseTicks = 0;
|
||||
}
|
||||
|
||||
if (this.fuseTicks >= 30) {
|
||||
this.fuseTicks = 30;
|
||||
if (this.fuseTicks >= this.maxFuseTicks) {
|
||||
this.fuseTicks = this.maxFuseTicks;
|
||||
if (!this.world.isStatic) {
|
||||
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
||||
// CraftBukkit start
|
||||
float radius = this.isPowered() ? 6.0F : 3.0F;
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
|
||||
this.die();
|
||||
} else {
|
||||
this.fuseTicks = 0;
|
||||
@ -84,15 +109,15 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
super.h_();
|
||||
super.j_();
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
return "mob.creeper";
|
||||
protected String aX() {
|
||||
return "mob.creeper.say";
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
return "mob.creeperdeath";
|
||||
protected String aY() {
|
||||
return "mob.creeper.death";
|
||||
}
|
||||
|
||||
public void die(DamageSource damagesource) {
|
||||
@ -134,7 +159,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public boolean k(Entity entity) {
|
||||
public boolean l(Entity entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -146,7 +171,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
return Item.SULPHUR.id;
|
||||
}
|
||||
|
||||
public int p() {
|
||||
public int o() {
|
||||
return this.datawatcher.getByte(16);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
|
||||
}
|
||||
|
||||
public Entity f() {
|
||||
return this.o;
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
|
@ -57,7 +57,7 @@ public class EntityEgg extends EntityProjectile {
|
||||
// CraftBukkit end
|
||||
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
this.world.a("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
this.world.addParticle("snowballpoof", this.locX, this.locY, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
|
@ -14,7 +14,7 @@ public class EntityEnderCrystal extends Entity {
|
||||
this.a = this.random.nextInt(100000);
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean f_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ public class EntityEnderCrystal extends Entity {
|
||||
this.datawatcher.a(8, Integer.valueOf(this.b));
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
public void j_() {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
@ -57,7 +57,7 @@ public class EntityEnderCrystal extends Entity {
|
||||
if (this.b <= 0) {
|
||||
this.die();
|
||||
if (!this.world.isStatic) {
|
||||
this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F); // CraftBukkit - (Entity) null -> this
|
||||
this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F, true); // CraftBukkit - (Entity) null -> this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,45 +13,48 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityEnderDragon extends EntityComplex {
|
||||
public class EntityEnderDragon extends EntityLiving implements IComplex {
|
||||
|
||||
public double a;
|
||||
public double b;
|
||||
public double c;
|
||||
public double d;
|
||||
public double[][] e = new double[64][3];
|
||||
public int f = -1;
|
||||
public double[][] d = new double[64][3];
|
||||
public int e = -1;
|
||||
public EntityComplexPart[] children;
|
||||
public EntityComplexPart g;
|
||||
public EntityComplexPart h;
|
||||
public EntityComplexPart i;
|
||||
public EntityComplexPart j;
|
||||
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 EntityComplexPart bK;
|
||||
public EntityComplexPart bL;
|
||||
public EntityComplexPart bM;
|
||||
public float bN = 0.0F;
|
||||
public float bO = 0.0F;
|
||||
public boolean bP = false;
|
||||
public boolean bQ = false;
|
||||
private Entity bT;
|
||||
public int bR = 0;
|
||||
public EntityEnderCrystal bS = null;
|
||||
|
||||
public EntityEnderDragon(World world) {
|
||||
super(world);
|
||||
this.children = new EntityComplexPart[] { this.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.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bM = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
|
||||
this.setHealth(this.getMaxHealth());
|
||||
this.texture = "/mob/enderdragon/ender.png";
|
||||
this.a(16.0F, 8.0F);
|
||||
this.X = true;
|
||||
this.Y = true;
|
||||
this.fireProof = true;
|
||||
this.c = 100.0D;
|
||||
this.ak = true;
|
||||
this.b = 100.0D;
|
||||
this.al = true;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
super.a();
|
||||
this.datawatcher.a(16, new Integer(this.a));
|
||||
this.datawatcher.a(16, new Integer(this.getMaxHealth()));
|
||||
}
|
||||
|
||||
public double[] a(int i, float f) {
|
||||
@ -60,59 +63,66 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
|
||||
f = 1.0F - f;
|
||||
int j = this.f - i * 1 & 63;
|
||||
int k = this.f - i * 1 - 1 & 63;
|
||||
int j = this.e - i * 1 & 63;
|
||||
int k = this.e - i * 1 - 1 & 63;
|
||||
double[] adouble = new double[3];
|
||||
double d0 = this.e[j][0];
|
||||
double d1 = MathHelper.g(this.e[k][0] - d0);
|
||||
double d0 = this.d[j][0];
|
||||
double d1 = MathHelper.g(this.d[k][0] - d0);
|
||||
|
||||
adouble[0] = d0 + d1 * (double) f;
|
||||
d0 = this.e[j][1];
|
||||
d1 = this.e[k][1] - d0;
|
||||
d0 = this.d[j][1];
|
||||
d1 = this.d[k][1] - d0;
|
||||
adouble[1] = d0 + d1 * (double) f;
|
||||
adouble[2] = this.e[j][2] + (this.e[k][2] - this.e[j][2]) * (double) f;
|
||||
adouble[2] = this.d[j][2] + (this.d[k][2] - this.d[j][2]) * (double) f;
|
||||
return adouble;
|
||||
}
|
||||
|
||||
public void d() {
|
||||
this.bC = this.bD;
|
||||
if (!this.world.isStatic) {
|
||||
this.datawatcher.watch(16, Integer.valueOf(this.health));
|
||||
}
|
||||
|
||||
public void c() {
|
||||
float f;
|
||||
float f1;
|
||||
float d05;
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
this.datawatcher.watch(16, Integer.valueOf(this.health));
|
||||
} else {
|
||||
f = MathHelper.cos(this.bO * 3.1415927F * 2.0F);
|
||||
f1 = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
|
||||
if (f1 <= -0.3F && f >= -0.3F) {
|
||||
this.world.b(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F);
|
||||
}
|
||||
}
|
||||
|
||||
this.bN = this.bO;
|
||||
float f2;
|
||||
|
||||
if (this.health <= 0) {
|
||||
f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
d05 = (this.random.nextFloat() - 0.5F) * 4.0F;
|
||||
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);
|
||||
f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
|
||||
f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
this.world.addParticle("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
|
||||
} else {
|
||||
this.j();
|
||||
this.h();
|
||||
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
|
||||
f *= (float) Math.pow(2.0D, this.motY);
|
||||
if (this.bF) {
|
||||
this.bD += f * 0.5F;
|
||||
if (this.bQ) {
|
||||
this.bO += f * 0.5F;
|
||||
} else {
|
||||
this.bD += f;
|
||||
this.bO += f;
|
||||
}
|
||||
|
||||
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 < 0) {
|
||||
for (int d05 = 0; d05 < this.d.length; ++d05) {
|
||||
this.d[d05][0] = (double) this.yaw;
|
||||
this.d[d05][1] = this.locY;
|
||||
}
|
||||
}
|
||||
|
||||
if (++this.f == this.e.length) {
|
||||
this.f = 0;
|
||||
if (++this.e == this.d.length) {
|
||||
this.e = 0;
|
||||
}
|
||||
|
||||
this.e[this.f][0] = (double) this.yaw;
|
||||
this.e[this.f][1] = this.locY;
|
||||
this.d[this.e][0] = (double) this.yaw;
|
||||
this.d[this.e][1] = this.locY;
|
||||
double d0;
|
||||
double d1;
|
||||
double d2;
|
||||
@ -120,27 +130,27 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
float f3;
|
||||
|
||||
if (this.world.isStatic) {
|
||||
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;
|
||||
if (this.bu > 0) {
|
||||
d0 = this.locX + (this.bv - this.locX) / (double) this.bu;
|
||||
d1 = this.locY + (this.bw - this.locY) / (double) this.bu;
|
||||
d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu;
|
||||
d3 = MathHelper.g(this.by - (double) this.yaw);
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bu);
|
||||
this.pitch = (float) ((double) this.pitch + (this.bz - (double) this.pitch) / (double) this.bu);
|
||||
--this.bu;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
}
|
||||
} else {
|
||||
d0 = this.b - this.locX;
|
||||
d1 = this.c - this.locY;
|
||||
d2 = this.d - this.locZ;
|
||||
d0 = this.a - this.locX;
|
||||
d1 = this.b - this.locY;
|
||||
d2 = this.c - this.locZ;
|
||||
d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
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;
|
||||
if (this.bT != null) {
|
||||
this.a = this.bT.locX;
|
||||
this.c = this.bT.locZ;
|
||||
double d4 = this.a - this.locX;
|
||||
double d5 = this.c - this.locZ;
|
||||
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
|
||||
double d7 = 0.4000000059604645D + d6 / 80.0D - 1.0D;
|
||||
|
||||
@ -148,14 +158,14 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
d7 = 10.0D;
|
||||
}
|
||||
|
||||
this.c = this.bI.boundingBox.b + d7;
|
||||
this.b = this.bT.boundingBox.b + d7;
|
||||
} else {
|
||||
this.b += this.random.nextGaussian() * 2.0D;
|
||||
this.d += this.random.nextGaussian() * 2.0D;
|
||||
this.a += this.random.nextGaussian() * 2.0D;
|
||||
this.c += this.random.nextGaussian() * 2.0D;
|
||||
}
|
||||
|
||||
if (this.bE || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
|
||||
this.k();
|
||||
if (this.bP || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
|
||||
this.i();
|
||||
}
|
||||
|
||||
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
|
||||
@ -181,15 +191,15 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
d9 = -50.0D;
|
||||
}
|
||||
|
||||
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();
|
||||
Vec3D vec3d = this.world.getVec3DPool().create(this.a - this.locX, this.b - this.locY, this.c - this.locZ).a();
|
||||
Vec3D vec3d1 = this.world.getVec3DPool().create((double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F), this.motY, (double) (-MathHelper.cos(this.yaw * 3.1415927F / 180.0F))).a();
|
||||
float f4 = (float) (vec3d1.b(vec3d) + 0.5D) / 1.5F;
|
||||
|
||||
if (f4 < 0.0F) {
|
||||
f4 = 0.0F;
|
||||
}
|
||||
|
||||
this.bt *= 0.8F;
|
||||
this.bF *= 0.8F;
|
||||
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
|
||||
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
|
||||
|
||||
@ -197,19 +207,19 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
d10 = 40.0D;
|
||||
}
|
||||
|
||||
this.bt = (float) ((double) this.bt + d9 * (0.699999988079071D / d10 / (double) f5));
|
||||
this.yaw += this.bt * 0.1F;
|
||||
this.bF = (float) ((double) this.bF + d9 * (0.699999988079071D / d10 / (double) f5));
|
||||
this.yaw += this.bF * 0.1F;
|
||||
float f6 = (float) (2.0D / (d10 + 1.0D));
|
||||
float f7 = 0.06F;
|
||||
|
||||
this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6)));
|
||||
if (this.bF) {
|
||||
if (this.bQ) {
|
||||
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
|
||||
} else {
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
Vec3D vec3d2 = Vec3D.a().create(this.motX, this.motY, this.motZ).b();
|
||||
Vec3D vec3d2 = this.world.getVec3DPool().create(this.motX, this.motY, this.motZ).a();
|
||||
float f8 = (float) (vec3d2.b(vec3d1) + 1.0D) / 2.0F;
|
||||
|
||||
f8 = 0.8F + 0.15F * f8;
|
||||
@ -218,58 +228,58 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
this.motY *= 0.9100000262260437D;
|
||||
}
|
||||
|
||||
this.aq = this.yaw;
|
||||
this.h.width = this.h.length = 3.0F;
|
||||
this.aw = this.yaw;
|
||||
this.g.width = this.g.length = 3.0F;
|
||||
this.i.width = this.i.length = 2.0F;
|
||||
this.j.width = this.j.length = 2.0F;
|
||||
this.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);
|
||||
this.bK.width = this.bK.length = 2.0F;
|
||||
this.h.length = 3.0F;
|
||||
this.h.width = 5.0F;
|
||||
this.bL.length = 2.0F;
|
||||
this.bL.width = 4.0F;
|
||||
this.bM.length = 3.0F;
|
||||
this.bM.width = 4.0F;
|
||||
f1 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
|
||||
f2 = MathHelper.cos(f1);
|
||||
float f9 = -MathHelper.sin(f1);
|
||||
float f10 = this.yaw * 3.1415927F / 180.0F;
|
||||
float f11 = MathHelper.sin(f10);
|
||||
float f12 = MathHelper.cos(f10);
|
||||
|
||||
this.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);
|
||||
this.h.j_();
|
||||
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
|
||||
this.bL.j_();
|
||||
this.bL.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
this.bM.j_();
|
||||
this.bM.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||
if (!this.world.isStatic && this.hurtTicks == 0) {
|
||||
this.a(this.world.getEntities(this, this.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)));
|
||||
this.a(this.world.getEntities(this, this.bL.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.a(this.world.getEntities(this, this.bM.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
|
||||
this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D)));
|
||||
}
|
||||
|
||||
double[] adouble = this.a(5, 1.0F);
|
||||
double[] adouble1 = this.a(0, 1.0F);
|
||||
|
||||
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);
|
||||
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
|
||||
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
|
||||
|
||||
this.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);
|
||||
this.g.j_();
|
||||
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F);
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
EntityComplexPart entitycomplexpart = null;
|
||||
|
||||
if (j == 0) {
|
||||
entitycomplexpart = this.j;
|
||||
entitycomplexpart = this.i;
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
entitycomplexpart = this.by;
|
||||
entitycomplexpart = this.j;
|
||||
}
|
||||
|
||||
if (j == 2) {
|
||||
entitycomplexpart = this.bz;
|
||||
entitycomplexpart = this.bK;
|
||||
}
|
||||
|
||||
double[] adouble2 = this.a(12 + j * 2, 1.0F);
|
||||
@ -279,25 +289,25 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
float f17 = 1.5F;
|
||||
float f18 = (float) (j + 1) * 2.0F;
|
||||
|
||||
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);
|
||||
entitycomplexpart.j_();
|
||||
entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f2), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f2), 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
this.bF = this.a(this.h.boundingBox) | this.a(this.i.boundingBox);
|
||||
this.bQ = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void j() {
|
||||
if (this.bH != null) {
|
||||
if (this.bH.dead) {
|
||||
private void h() {
|
||||
if (this.bS != null) {
|
||||
if (this.bS.dead) {
|
||||
if (!this.world.isStatic) {
|
||||
this.a(this.h, DamageSource.EXPLOSION, 10);
|
||||
this.a(this.g, DamageSource.EXPLOSION, 10);
|
||||
}
|
||||
|
||||
this.bH = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.health < this.a) {
|
||||
this.bS = null;
|
||||
} else if (this.ticksLived % 10 == 0 && this.health < this.getMaxHealth()) {
|
||||
// CraftBukkit start
|
||||
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
@ -326,13 +336,13 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
}
|
||||
|
||||
this.bH = entityendercrystal;
|
||||
this.bS = entityendercrystal;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(List list) {
|
||||
double d0 = (this.i.boundingBox.a + this.i.boundingBox.d) / 2.0D;
|
||||
double d1 = (this.i.boundingBox.c + this.i.boundingBox.f) / 2.0D;
|
||||
double d0 = (this.h.boundingBox.a + this.h.boundingBox.d) / 2.0D;
|
||||
double d1 = (this.h.boundingBox.c + this.h.boundingBox.f) / 2.0D;
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -373,27 +383,27 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
}
|
||||
}
|
||||
|
||||
private void k() {
|
||||
this.bE = false;
|
||||
private void i() {
|
||||
this.bP = 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()));
|
||||
this.bT = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
} else {
|
||||
boolean flag = false;
|
||||
|
||||
do {
|
||||
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;
|
||||
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;
|
||||
|
||||
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
|
||||
} while (!flag);
|
||||
|
||||
this.bI = null;
|
||||
this.bT = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,14 +466,14 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat();
|
||||
double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat();
|
||||
|
||||
this.world.a("largeexplode", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
this.world.addParticle("largeexplode", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, int i) {
|
||||
if (entitycomplexpart != this.h) {
|
||||
if (entitycomplexpart != this.g) {
|
||||
i = i / 4 + 1;
|
||||
}
|
||||
|
||||
@ -471,10 +481,10 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
float f1 = MathHelper.sin(f);
|
||||
float f2 = MathHelper.cos(f);
|
||||
|
||||
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;
|
||||
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.bT = null;
|
||||
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
|
||||
this.dealDamage(damagesource, i);
|
||||
}
|
||||
@ -482,32 +492,46 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void aI() {
|
||||
++this.bG;
|
||||
if (this.bG >= 180 && this.bG <= 200) {
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean dealDamage(DamageSource damagesource, int i) { // CraftBukkit - protected -> public
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
|
||||
protected void aO() {
|
||||
++this.bR;
|
||||
if (this.bR >= 180 && this.bR <= 200) {
|
||||
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
|
||||
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
|
||||
|
||||
this.world.a("hugeexplosion", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
|
||||
this.world.addParticle("hugeexplosion", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
int i;
|
||||
int j;
|
||||
|
||||
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()
|
||||
if (!this.world.isStatic) {
|
||||
if (this.bR > 150 && this.bR % 5 == 0) {
|
||||
i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
|
||||
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
i -= j;
|
||||
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
|
||||
while (i > 0) {
|
||||
j = EntityExperienceOrb.getOrbValue(i);
|
||||
i -= j;
|
||||
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bR == 1) {
|
||||
this.world.e(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
}
|
||||
}
|
||||
|
||||
this.move(0.0D, 0.10000000149011612D, 0.0D);
|
||||
this.aq = this.yaw += 20.0F;
|
||||
if (this.bG == 200 && !this.world.isStatic) {
|
||||
this.aw = this.yaw += 20.0F;
|
||||
if (this.bR == 200 && !this.world.isStatic) {
|
||||
i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
|
||||
|
||||
while (i > 0) {
|
||||
@ -516,12 +540,12 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
|
||||
}
|
||||
|
||||
this.a(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
|
||||
this.c(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
private void a(int i, int j) {
|
||||
private void c(int i, int j) {
|
||||
byte b0 = 64;
|
||||
|
||||
BlockEnderPortal.a = true;
|
||||
@ -587,9 +611,9 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
BlockEnderPortal.a = false;
|
||||
}
|
||||
|
||||
protected void bb() {}
|
||||
protected void bh() {}
|
||||
|
||||
public Entity[] al() {
|
||||
public Entity[] ao() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
@ -597,6 +621,22 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
return false;
|
||||
}
|
||||
|
||||
public World d() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
protected String aW() {
|
||||
return "mob.enderdragon.growl";
|
||||
}
|
||||
|
||||
protected String aX() {
|
||||
return "mob.enderdragon.hit";
|
||||
}
|
||||
|
||||
protected float aV() {
|
||||
return 5.0F;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public int getExpReward() {
|
||||
// This value is equal to the amount of experience dropped while falling from the sky (10 * 1000)
|
||||
|
@ -22,7 +22,7 @@ public class EntityEnderPearl extends EntityProjectile {
|
||||
}
|
||||
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
this.world.a("portal", this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian());
|
||||
this.world.addParticle("portal", this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian());
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
|
@ -10,15 +10,14 @@ public class EntityEnderman extends EntityMonster {
|
||||
|
||||
private static boolean[] d = new boolean[256];
|
||||
private int e = 0;
|
||||
private int g = 0;
|
||||
private int f = 0;
|
||||
|
||||
public EntityEnderman(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/enderman.png";
|
||||
this.bw = 0.2F;
|
||||
this.damage = 7;
|
||||
this.bI = 0.2F;
|
||||
this.a(0.6F, 2.9F);
|
||||
this.W = 1.0F;
|
||||
this.X = 1.0F;
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
@ -49,13 +48,17 @@ public class EntityEnderman extends EntityMonster {
|
||||
|
||||
if (entityhuman != null) {
|
||||
if (this.d(entityhuman)) {
|
||||
if (this.g++ == 5) {
|
||||
this.g = 0;
|
||||
this.e(true);
|
||||
if (this.f == 0) {
|
||||
this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
if (this.f++ == 5) {
|
||||
this.f = 0;
|
||||
this.f(true);
|
||||
return entityhuman;
|
||||
}
|
||||
} else {
|
||||
this.g = 0;
|
||||
this.f = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,26 +71,26 @@ public class EntityEnderman extends EntityMonster {
|
||||
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
|
||||
return false;
|
||||
} else {
|
||||
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();
|
||||
Vec3D vec3d = entityhuman.i(1.0F).a();
|
||||
Vec3D vec3d1 = this.world.getVec3DPool().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.b();
|
||||
|
||||
vec3d1 = vec3d1.b();
|
||||
vec3d1 = vec3d1.a();
|
||||
double d1 = vec3d.b(vec3d1);
|
||||
|
||||
return d1 > 1.0D - 0.025D / d0 ? entityhuman.l(this) : false;
|
||||
return d1 > 1.0D - 0.025D / d0 ? entityhuman.m(this) : false;
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
public void c() {
|
||||
if (this.G()) {
|
||||
this.damageEntity(DamageSource.DROWN, 1);
|
||||
}
|
||||
|
||||
this.bw = this.target != null ? 6.5F : 0.3F;
|
||||
this.bI = this.target != null ? 6.5F : 0.3F;
|
||||
int i;
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
int j;
|
||||
int k;
|
||||
int l;
|
||||
@ -115,7 +118,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].c()) {
|
||||
if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
|
||||
// CraftBukkit start - place event
|
||||
org.bukkit.block.Block bblock = this.world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
@ -129,26 +132,26 @@ public class EntityEnderman extends EntityMonster {
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
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);
|
||||
this.world.addParticle("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.s() && !this.world.isStatic) {
|
||||
if (this.world.t() && !this.world.isStatic) {
|
||||
float f = this.c(1.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.e(false);
|
||||
this.n();
|
||||
this.f(false);
|
||||
this.m();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.G()) {
|
||||
this.target = null;
|
||||
this.e(false);
|
||||
this.n();
|
||||
this.f(false);
|
||||
this.m();
|
||||
}
|
||||
|
||||
this.bu = false;
|
||||
this.bG = false;
|
||||
if (this.target != null) {
|
||||
this.a(this.target, 100.0F, 100.0F);
|
||||
}
|
||||
@ -156,26 +159,26 @@ public class EntityEnderman extends EntityMonster {
|
||||
if (!this.world.isStatic && this.isAlive()) {
|
||||
if (this.target != null) {
|
||||
if (this.target instanceof EntityHuman && this.d((EntityHuman) this.target)) {
|
||||
this.br = this.bs = 0.0F;
|
||||
this.bw = 0.0F;
|
||||
this.bD = this.bE = 0.0F;
|
||||
this.bI = 0.0F;
|
||||
if (this.target.e((Entity) this) < 16.0D) {
|
||||
this.n();
|
||||
this.m();
|
||||
}
|
||||
|
||||
this.e = 0;
|
||||
} else if (this.target.e((Entity) this) > 256.0D && this.e++ >= 30 && this.c(this.target)) {
|
||||
} else if (this.target.e((Entity) this) > 256.0D && this.e++ >= 30 && this.o(this.target)) {
|
||||
this.e = 0;
|
||||
}
|
||||
} else {
|
||||
this.e(false);
|
||||
this.f(false);
|
||||
this.e = 0;
|
||||
}
|
||||
}
|
||||
|
||||
super.d();
|
||||
super.c();
|
||||
}
|
||||
|
||||
protected boolean n() {
|
||||
protected boolean m() {
|
||||
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;
|
||||
@ -183,14 +186,14 @@ public class EntityEnderman extends EntityMonster {
|
||||
return this.j(d0, d1, d2);
|
||||
}
|
||||
|
||||
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);
|
||||
protected boolean o(Entity entity) {
|
||||
Vec3D vec3d = this.world.getVec3DPool().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();
|
||||
vec3d = vec3d.a();
|
||||
double d0 = 16.0D;
|
||||
double d1 = this.locX + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.a * d0;
|
||||
double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.b * d0;
|
||||
double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0;
|
||||
double d1 = this.locX + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.c * d0;
|
||||
double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.d * d0;
|
||||
double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.e * d0;
|
||||
|
||||
return this.j(d1, d2, d3);
|
||||
}
|
||||
@ -255,7 +258,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
double d8 = d4 + (this.locY - d4) * d6 + this.random.nextDouble() * (double) this.length;
|
||||
double d9 = d5 + (this.locZ - d5) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D;
|
||||
|
||||
this.world.a("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
|
||||
this.world.addParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
|
||||
}
|
||||
|
||||
this.world.makeSound(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
@ -264,15 +267,15 @@ public class EntityEnderman extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
protected String aQ() {
|
||||
return "mob.endermen.idle";
|
||||
protected String aW() {
|
||||
return this.q() ? "mob.endermen.scream" : "mob.endermen.idle";
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
protected String aX() {
|
||||
return "mob.endermen.hit";
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
protected String aY() {
|
||||
return "mob.endermen.death";
|
||||
}
|
||||
|
||||
@ -316,7 +319,7 @@ 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.n()) {
|
||||
if (this.m()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -324,17 +327,25 @@ public class EntityEnderman extends EntityMonster {
|
||||
return false;
|
||||
} else {
|
||||
if (damagesource.getEntity() instanceof EntityHuman) {
|
||||
this.e(true);
|
||||
this.f(true);
|
||||
}
|
||||
|
||||
return super.damageEntity(damagesource, i);
|
||||
}
|
||||
}
|
||||
|
||||
public void e(boolean flag) {
|
||||
public boolean q() {
|
||||
return this.datawatcher.getByte(18) > 0;
|
||||
}
|
||||
|
||||
public void f(boolean flag) {
|
||||
this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
|
||||
}
|
||||
|
||||
public int c(Entity entity) {
|
||||
return 7;
|
||||
}
|
||||
|
||||
static {
|
||||
d[Block.GRASS.id] = true;
|
||||
d[Block.DIRT.id] = true;
|
||||
|
@ -27,7 +27,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
this.value = i;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean f_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -39,8 +39,8 @@ public class EntityExperienceOrb extends Entity {
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public void h_() {
|
||||
super.h_();
|
||||
public void j_() {
|
||||
super.j_();
|
||||
if (this.c > 0) {
|
||||
--this.c;
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
}
|
||||
|
||||
public boolean I() {
|
||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||
return this.world.a(this.boundingBox, Material.WATER, (Entity) this);
|
||||
}
|
||||
|
||||
protected void burn(int i) {
|
||||
@ -146,8 +146,8 @@ public class EntityExperienceOrb extends Entity {
|
||||
|
||||
public void b_(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic) {
|
||||
if (this.c == 0 && entityhuman.bL == 0) {
|
||||
entityhuman.bL = 2;
|
||||
if (this.c == 0 && entityhuman.bU == 0) {
|
||||
entityhuman.bU = 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()
|
||||
@ -156,7 +156,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int c() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@ -183,7 +183,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 an() {
|
||||
public boolean aq() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3,12 +3,9 @@ package net.minecraft.server;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit
|
||||
|
||||
public class EntityFireball extends Entity {
|
||||
public abstract class EntityFireball extends Entity {
|
||||
|
||||
private int e = -1;
|
||||
private int f = -1;
|
||||
@ -17,7 +14,7 @@ public class EntityFireball extends Entity {
|
||||
private boolean i = false;
|
||||
public EntityLiving shooter;
|
||||
private int j;
|
||||
private int an = 0;
|
||||
private int as = 0;
|
||||
public double dirX;
|
||||
public double dirY;
|
||||
public double dirZ;
|
||||
@ -67,11 +64,11 @@ public class EntityFireball extends Entity {
|
||||
this.dirZ = d2 / d3 * 0.1D;
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
public void j_() {
|
||||
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.h_();
|
||||
super.j_();
|
||||
this.setOnFire(1);
|
||||
if (this.i) {
|
||||
int i = this.world.getTypeId(this.e, this.f, this.g);
|
||||
@ -90,19 +87,19 @@ 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.an = 0;
|
||||
this.as = 0;
|
||||
} else {
|
||||
++this.an;
|
||||
++this.as;
|
||||
}
|
||||
|
||||
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);
|
||||
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
|
||||
|
||||
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);
|
||||
vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
vec3d1 = this.world.getVec3DPool().create(movingobjectposition.pos.c, movingobjectposition.pos.d, movingobjectposition.pos.e);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
@ -113,7 +110,7 @@ public class EntityFireball extends Entity {
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (entity1.L() && (!entity1.i(this.shooter) || this.an >= 25)) {
|
||||
if (entity1.L() && (!entity1.i(this.shooter) || this.as >= 25)) {
|
||||
float f = 0.3F;
|
||||
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
@ -149,9 +146,9 @@ public class EntityFireball extends Entity {
|
||||
this.locZ += this.motZ;
|
||||
float f1 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
|
||||
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
|
||||
this.yaw = (float) (Math.atan2(this.motZ, this.motX) * 180.0D / 3.1415927410125732D) + 90.0F;
|
||||
|
||||
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
|
||||
for (this.pitch = (float) (Math.atan2((double) f1, this.motY) * 180.0D / 3.1415927410125732D) - 90.0F; this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
|
||||
;
|
||||
}
|
||||
|
||||
@ -169,13 +166,13 @@ public class EntityFireball 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.95F;
|
||||
float f2 = this.c();
|
||||
|
||||
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);
|
||||
this.world.addParticle("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
|
||||
f2 = 0.8F;
|
||||
@ -187,30 +184,17 @@ public class EntityFireball extends Entity {
|
||||
this.motX *= (double) f2;
|
||||
this.motY *= (double) f2;
|
||||
this.motZ *= (double) f2;
|
||||
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
this.world.addParticle("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
if (!this.world.isStatic) {
|
||||
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);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
// give 'this' instead of (Entity) null so we know what causes the damage
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.die();
|
||||
}
|
||||
protected float c() {
|
||||
return 0.95F;
|
||||
}
|
||||
|
||||
protected abstract void a(MovingObjectPosition movingobjectposition);
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("xTile", (short) this.e);
|
||||
nbttagcompound.setShort("yTile", (short) this.f);
|
||||
@ -251,9 +235,9 @@ public class EntityFireball extends Entity {
|
||||
Vec3D vec3d = damagesource.getEntity().Z();
|
||||
|
||||
if (vec3d != null) {
|
||||
this.motX = vec3d.a;
|
||||
this.motY = vec3d.b;
|
||||
this.motZ = vec3d.c;
|
||||
this.motX = vec3d.c;
|
||||
this.motY = vec3d.d;
|
||||
this.motZ = vec3d.e;
|
||||
this.dirX = this.motX * 0.1D;
|
||||
this.dirY = this.motY * 0.1D;
|
||||
this.dirZ = this.motZ * 0.1D;
|
||||
|
@ -19,24 +19,24 @@ public class EntityFishingHook extends Entity {
|
||||
public EntityHuman owner;
|
||||
private int i;
|
||||
private int j = 0;
|
||||
private int an = 0;
|
||||
private int as = 0;
|
||||
public Entity hooked = null;
|
||||
private int ao;
|
||||
private double ap;
|
||||
private double aq;
|
||||
private double ar;
|
||||
private double as;
|
||||
private double at;
|
||||
private int at;
|
||||
private double au;
|
||||
private double av;
|
||||
private double aw;
|
||||
private double ax;
|
||||
private double ay;
|
||||
|
||||
public EntityFishingHook(World world) {
|
||||
super(world);
|
||||
this.a(0.25F, 0.25F);
|
||||
this.ak = true;
|
||||
this.al = true;
|
||||
}
|
||||
|
||||
public EntityFishingHook(World world, EntityHuman entityhuman) {
|
||||
super(world);
|
||||
this.ak = true;
|
||||
this.al = true;
|
||||
this.owner = entityhuman;
|
||||
this.owner.hookedFish = this;
|
||||
this.a(0.25F, 0.25F);
|
||||
@ -78,22 +78,22 @@ public class EntityFishingHook extends Entity {
|
||||
this.i = 0;
|
||||
}
|
||||
|
||||
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);
|
||||
public void j_() {
|
||||
super.j_();
|
||||
if (this.at > 0) {
|
||||
double d0 = this.locX + (this.au - this.locX) / (double) this.at;
|
||||
double d1 = this.locY + (this.av - this.locY) / (double) this.at;
|
||||
double d2 = this.locZ + (this.aw - this.locZ) / (double) this.at;
|
||||
double d3 = MathHelper.g(this.ax - (double) this.yaw);
|
||||
|
||||
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.yaw = (float) ((double) this.yaw + d3 / (double) this.at);
|
||||
this.pitch = (float) ((double) this.pitch + (this.ay - (double) this.pitch) / (double) this.at);
|
||||
--this.at;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
} else {
|
||||
if (!this.world.isStatic) {
|
||||
ItemStack itemstack = this.owner.bC();
|
||||
ItemStack itemstack = this.owner.bP();
|
||||
|
||||
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
|
||||
this.die();
|
||||
@ -139,14 +139,14 @@ public class EntityFishingHook extends Entity {
|
||||
++this.j;
|
||||
}
|
||||
|
||||
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);
|
||||
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
|
||||
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
|
||||
|
||||
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);
|
||||
vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
if (movingobjectposition != null) {
|
||||
vec3d1 = Vec3D.a().create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
|
||||
vec3d1 = this.world.getVec3DPool().create(movingobjectposition.pos.c, movingobjectposition.pos.d, movingobjectposition.pos.e);
|
||||
}
|
||||
|
||||
Entity entity = null;
|
||||
@ -232,8 +232,8 @@ public class EntityFishingHook extends Entity {
|
||||
}
|
||||
|
||||
if (d6 > 0.0D) {
|
||||
if (this.an > 0) {
|
||||
--this.an;
|
||||
if (this.as > 0) {
|
||||
--this.as;
|
||||
} else {
|
||||
short short1 = 500;
|
||||
|
||||
@ -242,7 +242,7 @@ public class EntityFishingHook extends Entity {
|
||||
}
|
||||
|
||||
if (this.random.nextInt(short1) == 0) {
|
||||
this.an = this.random.nextInt(30) + 10;
|
||||
this.as = 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);
|
||||
@ -254,19 +254,19 @@ public class EntityFishingHook extends Entity {
|
||||
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);
|
||||
this.world.addParticle("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 (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);
|
||||
this.world.addParticle("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.an > 0) {
|
||||
if (this.as > 0) {
|
||||
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ public class EntityFishingHook extends Entity {
|
||||
this.h = nbttagcompound.getByte("inGround") == 1;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
public int c() {
|
||||
if (this.world.isStatic) {
|
||||
return 0;
|
||||
} else {
|
||||
@ -331,7 +331,7 @@ public class EntityFishingHook extends Entity {
|
||||
this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
|
||||
this.hooked.motZ += d2 * d4;
|
||||
b0 = 3;
|
||||
} else if (this.an > 0) {
|
||||
} else if (this.as > 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);
|
||||
@ -355,6 +355,7 @@ public class EntityFishingHook extends Entity {
|
||||
entityitem.motZ = d7 * d9;
|
||||
this.world.addEntity(entityitem);
|
||||
this.owner.a(StatisticList.B, 1);
|
||||
this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(3) + 1));
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
|
@ -8,21 +8,21 @@ import org.bukkit.event.entity.EntityTargetEvent;
|
||||
|
||||
public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
public int a = 0;
|
||||
public double b;
|
||||
public int b = 0;
|
||||
public double c;
|
||||
public double d;
|
||||
public double e;
|
||||
private Entity target = null;
|
||||
private int h = 0;
|
||||
public int e = 0;
|
||||
private int i = 0;
|
||||
public int f = 0;
|
||||
public int g = 0;
|
||||
|
||||
public EntityGhast(World world) {
|
||||
super(world);
|
||||
this.texture = "/mob/ghast.png";
|
||||
this.a(4.0F, 4.0F);
|
||||
this.fireProof = true;
|
||||
this.aV = 5;
|
||||
this.bc = 5;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
@ -44,42 +44,42 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
super.h_();
|
||||
public void j_() {
|
||||
super.j_();
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
|
||||
}
|
||||
|
||||
protected void be() {
|
||||
protected void bk() {
|
||||
if (!this.world.isStatic && this.world.difficulty == 0) {
|
||||
this.die();
|
||||
}
|
||||
|
||||
this.bb();
|
||||
this.e = this.f;
|
||||
double d0 = this.b - this.locX;
|
||||
double d1 = this.c - this.locY;
|
||||
double d2 = this.d - this.locZ;
|
||||
this.bh();
|
||||
this.f = this.g;
|
||||
double d0 = this.c - this.locX;
|
||||
double d1 = this.d - this.locY;
|
||||
double d2 = this.e - this.locZ;
|
||||
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
|
||||
|
||||
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);
|
||||
this.c = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.d = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
this.e = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
|
||||
}
|
||||
|
||||
if (this.a-- <= 0) {
|
||||
this.a += this.random.nextInt(5) + 2;
|
||||
if (this.b-- <= 0) {
|
||||
this.b += this.random.nextInt(5) + 2;
|
||||
d3 = (double) MathHelper.sqrt(d3);
|
||||
if (this.a(this.b, this.c, this.d, d3)) {
|
||||
if (this.a(this.c, this.d, this.e, d3)) {
|
||||
this.motX += d0 / d3 * 0.1D;
|
||||
this.motY += d1 / d3 * 0.1D;
|
||||
this.motZ += d2 / d3 * 0.1D;
|
||||
} else {
|
||||
this.b = this.locX;
|
||||
this.c = this.locY;
|
||||
this.d = this.locZ;
|
||||
this.c = this.locX;
|
||||
this.d = this.locY;
|
||||
this.e = this.locZ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.target == null || this.h-- <= 0) {
|
||||
if (this.target == null || this.i-- <= 0) {
|
||||
// CraftBukkit start
|
||||
Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D);
|
||||
if (target != null) {
|
||||
@ -116,7 +116,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.target != null) {
|
||||
this.h = 20;
|
||||
this.i = 20;
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,38 +127,38 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
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.aq = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.l(this.target)) {
|
||||
if (this.f == 10) {
|
||||
this.aw = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.m(this.target)) {
|
||||
if (this.g == 10) {
|
||||
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
|
||||
}
|
||||
|
||||
++this.f;
|
||||
if (this.f == 20) {
|
||||
++this.g;
|
||||
if (this.g == 20) {
|
||||
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);
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7);
|
||||
double d8 = 4.0D;
|
||||
Vec3D vec3d = this.i(1.0F);
|
||||
|
||||
entityfireball.locX = this.locX + vec3d.a * d8;
|
||||
entityfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
|
||||
entityfireball.locZ = this.locZ + vec3d.c * d8;
|
||||
this.world.addEntity(entityfireball);
|
||||
this.f = -40;
|
||||
entitylargefireball.locX = this.locX + vec3d.c * d8;
|
||||
entitylargefireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
|
||||
entitylargefireball.locZ = this.locZ + vec3d.e * d8;
|
||||
this.world.addEntity(entitylargefireball);
|
||||
this.g = -40;
|
||||
}
|
||||
} else if (this.f > 0) {
|
||||
--this.f;
|
||||
} else if (this.g > 0) {
|
||||
--this.g;
|
||||
}
|
||||
} else {
|
||||
this.aq = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
|
||||
if (this.f > 0) {
|
||||
--this.f;
|
||||
this.aw = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
|
||||
if (this.g > 0) {
|
||||
--this.g;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
byte b1 = (byte) (this.f > 10 ? 1 : 0);
|
||||
byte b1 = (byte) (this.g > 10 ? 1 : 0);
|
||||
|
||||
if (b0 != b1) {
|
||||
this.datawatcher.watch(16, Byte.valueOf(b1));
|
||||
@ -167,9 +167,9 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
}
|
||||
|
||||
private boolean a(double d0, double d1, double d2, double d3) {
|
||||
double d4 = (this.b - this.locX) / d3;
|
||||
double d5 = (this.c - this.locY) / d3;
|
||||
double d6 = (this.d - this.locZ) / d3;
|
||||
double d4 = (this.c - this.locX) / d3;
|
||||
double d5 = (this.d - this.locY) / d3;
|
||||
double d6 = (this.e - this.locZ) / d3;
|
||||
AxisAlignedBB axisalignedbb = this.boundingBox.clone();
|
||||
|
||||
for (int i = 1; (double) i < d3; ++i) {
|
||||
@ -182,15 +182,15 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String aQ() {
|
||||
protected String aW() {
|
||||
return "mob.ghast.moan";
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
protected String aX() {
|
||||
return "mob.ghast.scream";
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
protected String aY() {
|
||||
return "mob.ghast.death";
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected float aP() {
|
||||
protected float aV() {
|
||||
return 10.0F;
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
|
||||
}
|
||||
|
||||
public int bl() {
|
||||
public int bs() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
318
src/main/java/net/minecraft/server/EntityHanging.java
Normale Datei
318
src/main/java/net/minecraft/server/EntityHanging.java
Normale Datei
@ -0,0 +1,318 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.event.painting.PaintingBreakEvent.RemoveCause;
|
||||
import org.bukkit.event.painting.PaintingBreakEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class EntityHanging extends Entity {
|
||||
|
||||
private int e;
|
||||
public int direction;
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public EntityHanging(World world) {
|
||||
super(world);
|
||||
this.e = 0;
|
||||
this.direction = 0;
|
||||
this.height = 0.0F;
|
||||
this.a(0.5F, 0.5F);
|
||||
}
|
||||
|
||||
public EntityHanging(World world, int i, int j, int k, int l) {
|
||||
this(world);
|
||||
this.x = i;
|
||||
this.y = j;
|
||||
this.z = k;
|
||||
}
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public void setDirection(int i) {
|
||||
this.direction = i;
|
||||
this.lastYaw = this.yaw = (float) (i * 90);
|
||||
float f = (float) this.d();
|
||||
float f1 = (float) this.g();
|
||||
float f2 = (float) this.d();
|
||||
|
||||
if (i != 2 && i != 0) {
|
||||
f = 0.5F;
|
||||
} else {
|
||||
f2 = 0.5F;
|
||||
this.yaw = this.lastYaw = (float) (Direction.f[i] * 90);
|
||||
}
|
||||
|
||||
f /= 32.0F;
|
||||
f1 /= 32.0F;
|
||||
f2 /= 32.0F;
|
||||
float f3 = (float) this.x + 0.5F;
|
||||
float f4 = (float) this.y + 0.5F;
|
||||
float f5 = (float) this.z + 0.5F;
|
||||
float f6 = 0.5625F;
|
||||
|
||||
if (i == 2) {
|
||||
f5 -= f6;
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
f3 -= f6;
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
f5 += f6;
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
f3 += f6;
|
||||
}
|
||||
|
||||
if (i == 2) {
|
||||
f3 -= this.g(this.d());
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
f5 += this.g(this.d());
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
f3 += this.g(this.d());
|
||||
}
|
||||
|
||||
if (i == 3) {
|
||||
f5 -= this.g(this.d());
|
||||
}
|
||||
|
||||
f4 += this.g(this.g());
|
||||
this.setPosition((double) f3, (double) f4, (double) f5);
|
||||
float f7 = -0.03125F;
|
||||
|
||||
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 g(int i) {
|
||||
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
|
||||
}
|
||||
|
||||
public void j_() {
|
||||
if (this.e++ == 100 && !this.world.isStatic) {
|
||||
this.e = 0;
|
||||
if (!this.dead && !this.survives()) {
|
||||
// CraftBukkit start
|
||||
if (this instanceof EntityPainting) {
|
||||
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)) {
|
||||
// TODO: This feels insufficient to catch 100% of suffocation cases
|
||||
cause = RemoveCause.OBSTRUCTION;
|
||||
} else {
|
||||
cause = RemoveCause.PHYSICS;
|
||||
}
|
||||
|
||||
PaintingBreakEvent event = new PaintingBreakEvent((Painting) this.getBukkitEntity(), cause);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || dead) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.die();
|
||||
this.h();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean survives() {
|
||||
if (!this.world.getCubes(this, this.boundingBox).isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
int i = Math.max(1, this.d() / 16);
|
||||
int j = Math.max(1, this.g() / 16);
|
||||
int k = this.x;
|
||||
int l = this.y;
|
||||
int i1 = this.z;
|
||||
|
||||
if (this.direction == 2) {
|
||||
k = MathHelper.floor(this.locX - (double) ((float) this.d() / 32.0F));
|
||||
}
|
||||
|
||||
if (this.direction == 1) {
|
||||
i1 = MathHelper.floor(this.locZ - (double) ((float) this.d() / 32.0F));
|
||||
}
|
||||
|
||||
if (this.direction == 0) {
|
||||
k = MathHelper.floor(this.locX - (double) ((float) this.d() / 32.0F));
|
||||
}
|
||||
|
||||
if (this.direction == 3) {
|
||||
i1 = MathHelper.floor(this.locZ - (double) ((float) this.d() / 32.0F));
|
||||
}
|
||||
|
||||
l = MathHelper.floor(this.locY - (double) ((float) this.g() / 32.0F));
|
||||
|
||||
for (int j1 = 0; j1 < i; ++j1) {
|
||||
for (int k1 = 0; k1 < j; ++k1) {
|
||||
Material material;
|
||||
|
||||
if (this.direction != 2 && this.direction != 0) {
|
||||
material = this.world.getMaterial(this.x, l + k1, i1 + j1);
|
||||
} else {
|
||||
material = this.world.getMaterial(k + j1, l + k1, this.z);
|
||||
}
|
||||
|
||||
if (!material.isBuildable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List list = this.world.getEntities(this, this.boundingBox);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
Entity entity;
|
||||
|
||||
do {
|
||||
if (!iterator.hasNext()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
entity = (Entity) iterator.next();
|
||||
} while (!(entity instanceof EntityHanging));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean L() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||
if (!this.dead && !this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
if (this instanceof EntityPainting) {
|
||||
PaintingBreakEvent event = null;
|
||||
if (damagesource.getEntity() != null) {
|
||||
event = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
||||
} else {
|
||||
if (damagesource == DamageSource.FIRE) {
|
||||
event = new PaintingBreakEvent((Painting) this.getBukkitEntity(), RemoveCause.FIRE);
|
||||
}
|
||||
// TODO: Could put other stuff here?
|
||||
}
|
||||
|
||||
if (event != null) {
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.dead) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.die();
|
||||
this.K();
|
||||
EntityHuman entityhuman = null;
|
||||
|
||||
if (damagesource.getEntity() instanceof EntityHuman) {
|
||||
entityhuman = (EntityHuman) damagesource.getEntity();
|
||||
}
|
||||
|
||||
if (entityhuman != null && entityhuman.abilities.canInstantlyBuild) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.h();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void move(double d0, double d1, double d2) {
|
||||
if (!this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
if (dead) return; // CraftBukkit
|
||||
|
||||
this.die();
|
||||
this.h();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
this.die();
|
||||
this.h();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setByte("Direction", (byte) this.direction);
|
||||
nbttagcompound.setInt("TileX", this.x);
|
||||
nbttagcompound.setInt("TileY", this.y);
|
||||
nbttagcompound.setInt("TileZ", this.z);
|
||||
switch (this.direction) {
|
||||
case 0:
|
||||
nbttagcompound.setByte("Dir", (byte) 2);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
nbttagcompound.setByte("Dir", (byte) 1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
nbttagcompound.setByte("Dir", (byte) 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
nbttagcompound.setByte("Dir", (byte) 3);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound.hasKey("Direction")) {
|
||||
this.direction = nbttagcompound.getByte("Direction");
|
||||
} else {
|
||||
switch (nbttagcompound.getByte("Dir")) {
|
||||
case 0:
|
||||
this.direction = 2;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
this.direction = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.direction = 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this.direction = 3;
|
||||
}
|
||||
}
|
||||
|
||||
this.x = nbttagcompound.getInt("TileX");
|
||||
this.y = nbttagcompound.getInt("TileY");
|
||||
this.z = nbttagcompound.getInt("TileZ");
|
||||
this.setDirection(this.direction);
|
||||
}
|
||||
|
||||
public abstract int d();
|
||||
|
||||
public abstract int g();
|
||||
|
||||
public abstract void h();
|
||||
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -24,7 +24,7 @@ public class EntityIronGolem extends EntityGolem {
|
||||
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
||||
this.targetSelector.a(1, new PathfinderGoalDefendVillage(this));
|
||||
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityMonster.class, 16.0F, 0, false, true));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 16.0F, 0, false, true, IMonster.a));
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
@ -32,36 +32,44 @@ public class EntityIronGolem extends EntityGolem {
|
||||
this.datawatcher.a(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
public boolean aV() {
|
||||
public boolean bb() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void bd() {
|
||||
protected void bj() {
|
||||
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();
|
||||
this.aK();
|
||||
} else {
|
||||
ChunkCoordinates chunkcoordinates = this.d.getCenter();
|
||||
|
||||
this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, this.d.getSize());
|
||||
this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, (int) ((float) this.d.getSize() * 0.6F));
|
||||
}
|
||||
}
|
||||
|
||||
super.bd();
|
||||
super.bj();
|
||||
}
|
||||
|
||||
public int getMaxHealth() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
protected int h(int i) {
|
||||
protected int g(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public void d() {
|
||||
super.d();
|
||||
protected void n(Entity entity) {
|
||||
if (entity instanceof IMonster && this.aA().nextInt(20) == 0) {
|
||||
this.b((EntityLiving) entity);
|
||||
}
|
||||
|
||||
super.n(entity);
|
||||
}
|
||||
|
||||
public void c() {
|
||||
super.c();
|
||||
if (this.f > 0) {
|
||||
--this.f;
|
||||
}
|
||||
@ -77,16 +85,26 @@ public class EntityIronGolem extends EntityGolem {
|
||||
int l = this.world.getTypeId(i, j, k);
|
||||
|
||||
if (l > 0) {
|
||||
this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D);
|
||||
this.world.addParticle("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(Class oclass) {
|
||||
return this.q() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
|
||||
return this.p() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
|
||||
}
|
||||
|
||||
public boolean k(Entity entity) {
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setBoolean("PlayerCreated", this.p());
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.setPlayerCreated(nbttagcompound.getBoolean("PlayerCreated"));
|
||||
}
|
||||
|
||||
public boolean l(Entity entity) {
|
||||
this.f = 10;
|
||||
this.world.broadcastEntityEffect(this, (byte) 4);
|
||||
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), 7 + this.random.nextInt(15));
|
||||
@ -99,24 +117,24 @@ public class EntityIronGolem extends EntityGolem {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public Village n() {
|
||||
public Village m() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public void e(boolean flag) {
|
||||
public void f(boolean flag) {
|
||||
this.g = flag ? 400 : 0;
|
||||
this.world.broadcastEntityEffect(this, (byte) 11);
|
||||
}
|
||||
|
||||
protected String aQ() {
|
||||
protected String aW() {
|
||||
return "none";
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
protected String aX() {
|
||||
return "mob.irongolem.hit";
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
protected String aY() {
|
||||
return "mob.irongolem.death";
|
||||
}
|
||||
|
||||
@ -145,15 +163,15 @@ public class EntityIronGolem extends EntityGolem {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public int p() {
|
||||
public int o() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public boolean q() {
|
||||
public boolean p() {
|
||||
return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void f(boolean flag) {
|
||||
public void setPlayerCreated(boolean flag) {
|
||||
byte b0 = this.datawatcher.getByte(16);
|
||||
|
||||
if (flag) {
|
||||
@ -162,4 +180,12 @@ public class EntityIronGolem extends EntityGolem {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
|
||||
}
|
||||
}
|
||||
|
||||
public void die(DamageSource damagesource) {
|
||||
if (!this.p() && this.killer != null && this.d != null) {
|
||||
this.d.a(this.killer.getName(), -5);
|
||||
}
|
||||
|
||||
super.die(damagesource);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class EntityItem extends Entity {
|
||||
this.height = this.length / 2.0F;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.itemStack = itemstack;
|
||||
|
||||
// CraftBukkit start - infinite item fix & nullcheck
|
||||
if (this.itemStack == null) {
|
||||
throw new IllegalArgumentException("Can't create an EntityItem for a null item");
|
||||
@ -27,13 +28,14 @@ public class EntityItem extends Entity {
|
||||
this.itemStack.count = 1;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.yaw = (float) (Math.random() * 360.0D);
|
||||
this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean f_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -45,8 +47,8 @@ public class EntityItem extends Entity {
|
||||
|
||||
protected void a() {}
|
||||
|
||||
public void h_() {
|
||||
super.h_();
|
||||
public void j_() {
|
||||
super.j_();
|
||||
// CraftBukkit start
|
||||
int currentTick = (int) (System.currentTimeMillis() / 50);
|
||||
this.pickupDelay -= (currentTick - this.lastTick);
|
||||
@ -99,7 +101,7 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
|
||||
++this.age;
|
||||
if (this.age >= 6000) {
|
||||
if (!this.world.isStatic && this.age >= 6000) {
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||
this.age = 0;
|
||||
@ -116,34 +118,38 @@ public class EntityItem extends Entity {
|
||||
} 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;
|
||||
// CraftBukkit start - don't merge items with enchantments
|
||||
} else if (entityitem.itemStack.hasEnchantments() || this.itemStack.hasEnchantments()) {
|
||||
return false;
|
||||
// CraftBukkit end
|
||||
} else if (!entityitem.itemStack.hasTag() && !this.itemStack.hasTag()) {
|
||||
if (entityitem.itemStack.getItem().l() && 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;
|
||||
// CraftBukkit start - don't merge items with enchantments
|
||||
} else if (entityitem.itemStack.hasEnchantments() || this.itemStack.hasEnchantments()) {
|
||||
return false;
|
||||
// CraftBukkit end
|
||||
} 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 {
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
public void c() {
|
||||
this.age = 4800;
|
||||
}
|
||||
|
||||
public boolean I() {
|
||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||
return this.world.a(this.boundingBox, Material.WATER, (Entity) this);
|
||||
}
|
||||
|
||||
protected void burn(int i) {
|
||||
@ -233,7 +239,7 @@ public class EntityItem extends Entity {
|
||||
return LocaleI18n.get("item." + this.itemStack.a());
|
||||
}
|
||||
|
||||
public boolean an() {
|
||||
public boolean aq() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
34
src/main/java/net/minecraft/server/EntityLargeFireball.java
Normale Datei
34
src/main/java/net/minecraft/server/EntityLargeFireball.java
Normale Datei
@ -0,0 +1,34 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
|
||||
public class EntityLargeFireball extends EntityFireball {
|
||||
|
||||
public EntityLargeFireball(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(world, entityliving, d0, d1, d2);
|
||||
}
|
||||
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
if (!this.world.isStatic) {
|
||||
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);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
// give 'this' instead of (Entity) null so we know what causes the damage
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing"));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
}
|
@ -70,8 +70,8 @@ public class EntityLightning extends EntityWeather {
|
||||
}
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
super.h_();
|
||||
public void j_() {
|
||||
super.j_();
|
||||
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);
|
||||
@ -118,7 +118,7 @@ public class EntityLightning extends EntityWeather {
|
||||
entity.a(this);
|
||||
}
|
||||
|
||||
this.world.s = 2;
|
||||
this.world.r = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -6,14 +6,14 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
super(world);
|
||||
this.texture = "/mob/lava.png";
|
||||
this.fireProof = true;
|
||||
this.aG = 0.2F;
|
||||
this.aM = 0.2F;
|
||||
}
|
||||
|
||||
public boolean canSpawn() {
|
||||
return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
|
||||
}
|
||||
|
||||
public int aO() {
|
||||
public int aU() {
|
||||
return this.getSize() * 3;
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
protected String i() {
|
||||
protected String h() {
|
||||
return "flame";
|
||||
}
|
||||
|
||||
protected EntitySlime j() {
|
||||
protected EntitySlime i() {
|
||||
return new EntityMagmaCube(this.world);
|
||||
}
|
||||
|
||||
@ -58,38 +58,38 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected int k() {
|
||||
return super.k() * 4;
|
||||
protected int j() {
|
||||
return super.j() * 4;
|
||||
}
|
||||
|
||||
protected void l() {
|
||||
this.a *= 0.9F;
|
||||
protected void k() {
|
||||
this.b *= 0.9F;
|
||||
}
|
||||
|
||||
protected void aZ() {
|
||||
protected void bf() {
|
||||
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
|
||||
this.al = true;
|
||||
this.am = true;
|
||||
}
|
||||
|
||||
protected void a(float f) {}
|
||||
|
||||
protected boolean m() {
|
||||
protected boolean l() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected int n() {
|
||||
return super.n() + 2;
|
||||
protected int m() {
|
||||
return super.m() + 2;
|
||||
}
|
||||
|
||||
protected String aR() {
|
||||
return "mob.slime";
|
||||
protected String aX() {
|
||||
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
|
||||
}
|
||||
|
||||
protected String aS() {
|
||||
return "mob.slime";
|
||||
protected String aY() {
|
||||
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
|
||||
}
|
||||
|
||||
protected String o() {
|
||||
protected String n() {
|
||||
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean p() {
|
||||
protected boolean o() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,15 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
public int type;
|
||||
public double b;
|
||||
public double c;
|
||||
private final IUpdatePlayerListBox g;
|
||||
private boolean h;
|
||||
private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
|
||||
private int h;
|
||||
private double i;
|
||||
private double j;
|
||||
private double an;
|
||||
private double ao;
|
||||
private double ap;
|
||||
private int j;
|
||||
private double as;
|
||||
private double at;
|
||||
private double au;
|
||||
private double av;
|
||||
private double aw;
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean slowWhenEmpty = true;
|
||||
@ -74,12 +76,14 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.items = new ItemStack[27]; // CraftBukkit
|
||||
this.e = 0;
|
||||
this.f = false;
|
||||
this.h = true;
|
||||
this.m = true;
|
||||
this.a(0.98F, 0.7F);
|
||||
this.height = this.length / 2.0F;
|
||||
this.g = world != null ? world.a(this) : null;
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
protected boolean f_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -209,42 +213,52 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
public void die() {
|
||||
for (int i = 0; i < this.getSize(); ++i) {
|
||||
ItemStack itemstack = this.getItem(i);
|
||||
if (this.h) {
|
||||
for (int i = 0; i < this.getSize(); ++i) {
|
||||
ItemStack itemstack = this.getItem(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
if (itemstack != null) {
|
||||
float f = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.count > 0) {
|
||||
int j = this.random.nextInt(21) + 10;
|
||||
while (itemstack.count > 0) {
|
||||
int j = this.random.nextInt(21) + 10;
|
||||
|
||||
if (j > itemstack.count) {
|
||||
j = itemstack.count;
|
||||
if (j > itemstack.count) {
|
||||
j = itemstack.count;
|
||||
}
|
||||
|
||||
itemstack.count -= j;
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
|
||||
|
||||
if (itemstack.hasTag()) {
|
||||
entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
|
||||
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
|
||||
entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
|
||||
this.world.addEntity(entityitem);
|
||||
}
|
||||
|
||||
itemstack.count -= j;
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
|
||||
|
||||
if (itemstack.hasTag()) {
|
||||
entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
|
||||
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
|
||||
entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
|
||||
this.world.addEntity(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.die();
|
||||
if (this.g != null) {
|
||||
this.g.a();
|
||||
}
|
||||
}
|
||||
|
||||
public void h_() {
|
||||
public void b(int i) {
|
||||
this.h = false;
|
||||
super.b(i);
|
||||
}
|
||||
|
||||
public void j_() {
|
||||
// CraftBukkit start
|
||||
double prevX = this.locX;
|
||||
double prevY = this.locY;
|
||||
@ -253,6 +267,10 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
float prevPitch = this.pitch;
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.g != null) {
|
||||
this.g.a();
|
||||
}
|
||||
|
||||
if (this.j() > 0) {
|
||||
this.h(this.j() - 1);
|
||||
}
|
||||
@ -266,19 +284,19 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
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);
|
||||
this.world.addParticle("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (this.world.isStatic) {
|
||||
if (this.h > 0) {
|
||||
double d0 = this.locX + (this.i - this.locX) / (double) this.h;
|
||||
double d1 = this.locY + (this.j - this.locY) / (double) this.h;
|
||||
double d2 = this.locZ + (this.an - this.locZ) / (double) this.h;
|
||||
double d3 = MathHelper.g(this.ao - (double) this.yaw);
|
||||
if (this.j > 0) {
|
||||
double d0 = this.locX + (this.as - this.locX) / (double) this.j;
|
||||
double d1 = this.locY + (this.at - this.locY) / (double) this.j;
|
||||
double d2 = this.locZ + (this.au - this.locZ) / (double) this.j;
|
||||
double d3 = MathHelper.g(this.av - (double) this.yaw);
|
||||
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.h);
|
||||
this.pitch = (float) ((double) this.pitch + (this.ap - (double) this.pitch) / (double) this.h);
|
||||
--this.h;
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.j);
|
||||
this.pitch = (float) ((double) this.pitch + (this.aw - (double) this.pitch) / (double) this.j);
|
||||
--this.j;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
} else {
|
||||
@ -294,7 +312,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
int j = MathHelper.floor(this.locY);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (BlockMinecartTrack.d_(this.world, i, j - 1, k)) {
|
||||
if (BlockMinecartTrack.e_(this.world, i, j - 1, k)) {
|
||||
--j;
|
||||
}
|
||||
|
||||
@ -316,7 +334,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
flag1 = !flag;
|
||||
}
|
||||
|
||||
if (((BlockMinecartTrack) Block.byId[l]).n()) {
|
||||
if (((BlockMinecartTrack) Block.byId[l]).p()) {
|
||||
i1 &= 7;
|
||||
}
|
||||
|
||||
@ -472,7 +490,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
Vec3D vec3d1 = this.a(this.locX, this.locY, this.locZ);
|
||||
|
||||
if (vec3d1 != null && vec3d != null) {
|
||||
double d20 = (vec3d.b - vec3d1.b) * 0.05D;
|
||||
double d20 = (vec3d.d - vec3d1.d) * 0.05D;
|
||||
|
||||
d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
if (d10 > 0.0D) {
|
||||
@ -480,7 +498,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.motZ = this.motZ / d10 * (d10 + d20);
|
||||
}
|
||||
|
||||
this.setPosition(this.locX, vec3d1.b, this.locZ);
|
||||
this.setPosition(this.locX, vec3d1.d, this.locZ);
|
||||
}
|
||||
|
||||
int j1 = MathHelper.floor(this.locX);
|
||||
@ -531,8 +549,6 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.D();
|
||||
} else {
|
||||
if (this.motX < -d4) {
|
||||
this.motX = -d4;
|
||||
@ -568,6 +584,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
this.D();
|
||||
this.pitch = 0.0F;
|
||||
double d23 = this.lastX - this.locX;
|
||||
double d24 = this.lastZ - this.locZ;
|
||||
@ -629,7 +646,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.b = this.c = 0.0D;
|
||||
}
|
||||
|
||||
this.d(this.e > 0);
|
||||
this.e(this.e > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -638,7 +655,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
int j = MathHelper.floor(d1);
|
||||
int k = MathHelper.floor(d2);
|
||||
|
||||
if (BlockMinecartTrack.d_(this.world, i, j - 1, k)) {
|
||||
if (BlockMinecartTrack.e_(this.world, i, j - 1, k)) {
|
||||
--j;
|
||||
}
|
||||
|
||||
@ -648,7 +665,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
int i1 = this.world.getData(i, j, k);
|
||||
|
||||
d1 = (double) j;
|
||||
if (((BlockMinecartTrack) Block.byId[l]).n()) {
|
||||
if (((BlockMinecartTrack) Block.byId[l]).p()) {
|
||||
i1 &= 7;
|
||||
}
|
||||
|
||||
@ -692,7 +709,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d1 += 0.5D;
|
||||
}
|
||||
|
||||
return Vec3D.a().create(d0, d1, d2);
|
||||
return this.world.getVec3DPool().create(d0, d1, d2);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -781,15 +798,15 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
d1 *= d3;
|
||||
d0 *= 0.10000000149011612D;
|
||||
d1 *= 0.10000000149011612D;
|
||||
d0 *= (double) (1.0F - this.Y);
|
||||
d1 *= (double) (1.0F - this.Y);
|
||||
d0 *= (double) (1.0F - this.Z);
|
||||
d1 *= (double) (1.0F - this.Z);
|
||||
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.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();
|
||||
Vec3D vec3d = this.world.getVec3DPool().create(d4, 0.0D, d5).a();
|
||||
Vec3D vec3d1 = this.world.getVec3DPool().create((double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F), 0.0D, (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F)).a();
|
||||
double d6 = Math.abs(vec3d.b(vec3d1));
|
||||
|
||||
if (d6 < 0.800000011920929D) {
|
||||
@ -926,7 +943,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
}
|
||||
|
||||
protected void d(boolean flag) {
|
||||
protected void e(boolean flag) {
|
||||
if (flag) {
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) | 1)));
|
||||
} else {
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
In neuem Issue referenzieren
Einen Benutzer sperren