Updated CraftBukkit to 1.2

This commit is contained in:
Nathan Adams 2012-03-01 10:49:23 +00:00
parent e9ca87000c
commit 543c4879fe
143 changed files with 3710 additions and 4433 deletions

View file

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.1-R6-SNAPSHOT</version>
<version>1.2.2-R0-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.1-R6</version>
<version>1.2.2-R0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.1_02</version>
<version>1.2.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

View file

@ -14,33 +14,31 @@ public class Block {
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 Block[] byId = new Block[256];
public static final boolean[] n = new boolean[256];
public static final boolean[] o = new boolean[256];
public static final boolean[] isTileEntity = new boolean[256];
public static final int[] lightBlock = new int[256];
public static final boolean[] r = new boolean[256];
public static final int[] lightEmission = new int[256];
public static final boolean[] t = new boolean[256];
public static boolean[] u = new boolean[256];
public static final Block[] byId = new Block[4096];
public static final boolean[] n = new boolean[4096];
public static final int[] lightBlock = new int[4096];
public static final boolean[] p = 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 Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).a("stone");
public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).a("grass");
public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).a("dirt");
public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stonebrick");
public static final Block WOOD = (new Block(5, 4, Material.WOOD)).c(2.0F).b(5.0F).a(e).a("wood").i();
public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).a("sapling").i();
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).k().b(6000000.0F).a(h).a("bedrock").p();
public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).g(3).a("water").p().i();
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).g(3).a("water").p().i();
public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).g(255).a("lava").p().i();
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).g(255).a("lava").p().i();
public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).k().b(6000000.0F).a(h).a("bedrock").r();
public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).f(3).a("water").r().i();
public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).f(3).a("water").r().i();
public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).f(255).a("lava").r().i();
public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).f(255).a("lava").r().i();
public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).a("sand");
public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).a("gravel");
public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).a("oreGold");
public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).a("oreIron");
public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).a("oreCoal");
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).a("log").i();
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).g(1).a(g).a("leaves").i();
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).f(1).a(g).a("leaves").i();
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).a("sponge");
public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).a("glass");
public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).a("oreLapis");
@ -48,11 +46,11 @@ public class Block {
public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).a("dispenser").i();
public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).a("sandStone");
public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).a("musicBlock").i();
public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed").p().i();
public static final Block BED = (new BlockBed(26)).c(0.2F).a("bed").r().i();
public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).a("goldenRail").i();
public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).a("detectorRail").i();
public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).a("pistonStickyBase").i();
public static final Block WEB = (new BlockWeb(30, 11)).g(1).c(4.0F).a("web");
public static final Block WEB = (new BlockWeb(30, 11)).f(1).c(4.0F).a("web");
public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).a("tallgrass");
public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).a("deadbush");
public static final Block PISTON = (new BlockPiston(33, 107, false)).a("pistonBase").i();
@ -73,39 +71,39 @@ public class Block {
public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stoneMoss");
public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(50.0F).b(2000.0F).a(h).a("obsidian");
public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).a("torch").i();
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").p();
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").p();
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").r();
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").r();
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").i();
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").i();
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust").p().i();
public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).a("redstoneDust").r().i();
public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).a("oreDiamond");
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond");
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench");
public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").p().i();
public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").r().i();
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland").i();
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").i();
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).a("furnace").i();
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").p().i();
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).a("doorWood").p().i();
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").r().i();
public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).a("doorWood").r().i();
public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(e).a("ladder").i();
public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).a("rail").i();
public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE)).a("stairsStone").i();
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).a("sign").p().i();
public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).a("sign").r().i();
public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).a("lever").i();
public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).a("pressurePlate").i();
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).a("doorIron").p().i();
public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).a("doorIron").r().i();
public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).a("pressurePlate").i();
public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).a("oreRedstone").i();
public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).a("oreRedstone").i();
public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).a("notGate").i();
public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).a("notGate").i();
public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId)).c(0.5F).a(h).a("button").i();
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).a("snow").g(0);
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).g(3).a(j).a("ice");
public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(k).a("snow").f(0);
public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).f(3).a(j).a("ice");
public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(k).a("snow");
public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).a("cactus");
public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).a("clay");
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").p();
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").r();
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").i();
public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).a("fence");
public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).a("pumpkin").i();
@ -114,11 +112,11 @@ public class Block {
public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).a("lightgem");
public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).a("portal");
public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).a("litpumpkin").i();
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake").p().i();
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).a("diode").p().i();
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").p().i();
public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).a("cake").r().i();
public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).a("diode").r().i();
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").r().i();
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).a("lockedchest").a(true).i();
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").p().i();
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").r().i();
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F);
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).a("stonebricksmooth");
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).a("mushroom").i();
@ -145,12 +143,16 @@ public class Block {
public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).a("endPortalFrame").i().b(6000000.0F);
public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).a("whiteStone");
public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).a("dragonEgg");
public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).a("redstoneLight");
public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).a("redstoneLight");
public int textureId;
public final int id;
protected float strength;
protected float durability;
protected boolean bR;
protected boolean bS;
protected boolean bT;
protected boolean isTileEntity;
public double minX;
public double minY;
public double minZ;
@ -158,7 +160,7 @@ public class Block {
public double maxY;
public double maxZ;
public StepSound stepSound;
public float ca;
public float cc;
public final Material material;
public float frictionFactor;
private String name;
@ -167,7 +169,7 @@ public class Block {
this.bR = true;
this.bS = true;
this.stepSound = d;
this.ca = 1.0F;
this.cc = 1.0F;
this.frictionFactor = 0.6F;
if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
@ -176,15 +178,14 @@ public class Block {
byId[i] = this;
this.id = i;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
o[i] = this.a();
n[i] = this.a();
lightBlock[i] = this.a() ? 255 : 0;
r[i] = !material.blocksLight();
isTileEntity[i] = false;
p[i] = !material.blocksLight();
}
}
protected Block i() {
t[this.id] = true;
r[this.id] = true;
return this;
}
@ -200,7 +201,7 @@ public class Block {
return this;
}
protected Block g(int i) {
protected Block f(int i) {
lightBlock[this.id] = i;
return this;
}
@ -215,10 +216,20 @@ public class Block {
return this;
}
public static boolean g(int i) {
Block block = byId[i];
return block == null ? false : block.material.j() && block.b();
}
public boolean b() {
return true;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return !this.material.isSolid();
}
public int c() {
return 0;
}
@ -242,10 +253,18 @@ public class Block {
}
protected Block a(boolean flag) {
n[this.id] = flag;
this.bT = flag;
return this;
}
public boolean m() {
return this.bT;
}
public boolean n() {
return this.isTileEntity;
}
public void a(float f, float f1, float f2, float f3, float f4, float f5) {
this.minX = (double) f;
this.minY = (double) f1;
@ -284,10 +303,10 @@ public class Block {
}
public boolean a(int i, boolean flag) {
return this.x_();
return this.F_();
}
public boolean x_() {
public boolean F_() {
return true;
}
@ -510,7 +529,7 @@ public class Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.c(0.025F);
if (this.b() && !isTileEntity[this.id] && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
if (this.b() && !this.isTileEntity && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) {
ItemStack itemstack = this.a_(l);
if (itemstack != null) {
@ -549,20 +568,20 @@ public class Block {
}
public String getName() {
return LocaleI18n.get(this.n() + ".name");
return LocaleI18n.get(this.p() + ".name");
}
public String n() {
public String p() {
return this.name;
}
public void a(World world, int i, int j, int k, int l, int i1) {}
public boolean o() {
public boolean q() {
return this.bS;
}
protected Block p() {
protected Block r() {
this.bS = false;
return this;
}
@ -609,11 +628,15 @@ public class Block {
flag = true;
}
u[i] = flag;
if (p[i]) {
flag = true;
}
s[i] = flag;
}
}
r[0] = true;
p[0] = true;
StatisticList.b();
}

View file

@ -38,19 +38,19 @@ public class BlockDispenser extends BlockContainer {
int k1 = world.getTypeId(i + 1, j, k);
byte b0 = 3;
if (Block.o[l] && !Block.o[i1]) {
if (Block.n[l] && !Block.n[i1]) {
b0 = 3;
}
if (Block.o[i1] && !Block.o[l]) {
if (Block.n[i1] && !Block.n[l]) {
b0 = 2;
}
if (Block.o[j1] && !Block.o[k1]) {
if (Block.n[j1] && !Block.n[k1]) {
b0 = 5;
}
if (Block.o[k1] && !Block.o[j1]) {
if (Block.n[k1] && !Block.n[j1]) {
b0 = 4;
}
@ -167,6 +167,20 @@ public class BlockDispenser extends BlockContainer {
entitypotion.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
world.addEntity(entitypotion);
world.triggerEffect(1002, i, j, k, 0);
} else if (itemstack.id == Item.EXP_BOTTLE.id) {
EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, d0, d1, d2);
entitythrownexpbottle.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
world.addEntity(entitythrownexpbottle);
world.triggerEffect(1002, i, j, k, 0);
} else if (itemstack.id == Item.MONSTER_EGG.id) {
ItemMonsterEgg.a(world, itemstack.getData(), d0 + (double) b0 * 0.3D, d1 - 0.3D, d2 + (double) b1 * 0.3D);
world.triggerEffect(1002, i, j, k, 0);
} else if (itemstack.id == Item.FIREBALL.id) {
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0 + (double) b0 * 0.3D, d1, d2 + (double) b1 * 0.3D, (double) b0 + random.nextGaussian() * 0.05D, random.nextGaussian() * 0.05D, (double) b1 + random.nextGaussian() * 0.05D);
world.addEntity(entitysmallfireball);
world.triggerEffect(1009, i, j, k, 0);
} else {
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
// CraftBukkit start

View file

@ -19,33 +19,16 @@ public class BlockDoor extends Block {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
public int a(int i, int j) {
if (i != 0 && i != 1) {
int k = this.e(j);
if ((k == 0 || k == 2) ^ i <= 3) {
return this.textureId;
} else {
int l = k / 2 + (i & 1 ^ k);
l += (j & 4) / 4;
int i1 = this.textureId - (j & 8) * 2;
if ((l & 1) != 0) {
i1 = -i1;
}
return i1;
}
} else {
return this.textureId;
}
}
public boolean a() {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
int l = this.e(iblockaccess, i, j, k);
return (l & 4) != 0;
}
public boolean b() {
return false;
}
@ -60,27 +43,57 @@ public class BlockDoor extends Block {
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
this.d(this.e(iblockaccess.getData(i, j, k)));
this.d(this.e(iblockaccess, i, j, k));
}
public void d(int i) {
public int c(IBlockAccess iblockaccess, int i, int j, int k) {
return this.e(iblockaccess, i, j, k) & 3;
}
public boolean d(IBlockAccess iblockaccess, int i, int j, int k) {
return (this.e(iblockaccess, i, j, k) & 4) != 0;
}
private void d(int i) {
float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
if (i == 0) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
}
int j = i & 3;
boolean flag = (i & 4) != 0;
boolean flag1 = (i & 16) != 0;
if (i == 1) {
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
if (i == 2) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
if (i == 3) {
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
if (j == 0) {
if (!flag) {
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
} else if (!flag1) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
} else {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
} else if (j == 1) {
if (!flag) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
} else if (!flag1) {
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
} else {
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
} else if (j == 2) {
if (!flag) {
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
} else if (!flag1) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
} else {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
}
} else if (j == 3) {
if (!flag) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
} else if (!flag1) {
this.a(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
} else {
this.a(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
}
}
@ -92,46 +105,40 @@ public class BlockDoor extends Block {
if (this.material == Material.ORE) {
return true;
} else {
int l = world.getData(i, j, k);
int l = this.e((IBlockAccess) world, i, j, k);
int i1 = l & 7;
i1 ^= 4;
if ((l & 8) != 0) {
if (world.getTypeId(i, j - 1, k) == this.id) {
this.interact(world, i, j - 1, k, entityhuman);
}
return true;
} else {
if (world.getTypeId(i, j + 1, k) == this.id) {
world.setData(i, j + 1, k, (l ^ 4) + 8);
}
world.setData(i, j, k, l ^ 4);
world.setData(i, j - 1, k, i1);
world.b(i, j - 1, k, i, j, k);
world.a(entityhuman, 1003, i, j, k, 0);
return true;
} else {
world.setData(i, j, k, i1);
world.b(i, j, k, i, j, k);
}
world.a(entityhuman, 1003, i, j, k, 0);
return true;
}
}
public void setDoor(World world, int i, int j, int k, boolean flag) {
int l = world.getData(i, j, k);
int l = this.e((IBlockAccess) world, i, j, k);
boolean flag1 = (l & 4) != 0;
if ((l & 8) != 0) {
if (world.getTypeId(i, j - 1, k) == this.id) {
this.setDoor(world, i, j - 1, k, flag);
}
} else {
boolean flag1 = (world.getData(i, j, k) & 4) > 0;
if (flag1 != flag) {
int i1 = l & 7;
if (flag1 != flag) {
if (world.getTypeId(i, j + 1, k) == this.id) {
world.setData(i, j + 1, k, (l ^ 4) + 8);
}
world.setData(i, j, k, l ^ 4);
i1 ^= 4;
if ((l & 8) != 0) {
world.setData(i, j - 1, k, i1);
world.b(i, j - 1, k, i, j, k);
world.a((EntityHuman) null, 1003, i, j, k, 0);
} else {
world.setData(i, j, k, i1);
world.b(i, j, k, i, j, k);
}
world.a((EntityHuman) null, 1003, i, j, k, 0);
}
}
@ -196,19 +203,31 @@ public class BlockDoor extends Block {
return super.a(world, i, j, k, vec3d, vec3d1);
}
public int e(int i) {
return (i & 4) == 0 ? i - 1 & 3 : i & 3;
}
public boolean canPlace(World world, int i, int j, int k) {
return j >= world.height - 1 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
public static boolean f(int i) {
return (i & 4) != 0;
return j >= 255 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
public int g() {
return 1;
}
public int e(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
boolean flag = (l & 8) != 0;
int i1;
int j1;
if (flag) {
i1 = iblockaccess.getData(i, j - 1, k);
j1 = l;
} else {
i1 = l;
j1 = iblockaccess.getData(i, j + 1, k);
}
boolean flag1 = (j1 & 1) != 0;
int k1 = i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0);
return k1;
}
}

View file

@ -60,7 +60,7 @@ public class BlockFire extends Block {
}
public int d() {
return 40;
return 30;
}
public void a(World world, int i, int j, int k, Random random) {
@ -74,7 +74,7 @@ public class BlockFire extends Block {
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
if (!flag && world.w() && (world.v(i, j, k) || world.v(i - 1, j, k) || world.v(i + 1, j, k) || world.v(i, j, k - 1) || world.v(i, j, k + 1))) {
if (!flag && world.x() && (world.y(i, j, k) || world.y(i - 1, j, k) || world.y(i + 1, j, k) || world.y(i, j, k - 1) || world.y(i, j, k + 1))) {
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
} else {
int l = world.getData(i, j, k);
@ -83,20 +83,27 @@ public class BlockFire extends Block {
world.setRawData(i, j, k, l + random.nextInt(3) / 2);
}
world.c(i, j, k, this.id, this.d());
world.c(i, j, k, this.id, this.d() + random.nextInt(10));
if (!flag && !this.g(world, i, j, k)) {
if (!world.e(i, j - 1, k) || l > 3) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
}
} else if (!flag && !this.b(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
} else if (!flag && !this.c(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
} else {
this.a(world, i + 1, j, k, 300, random, l);
this.a(world, i - 1, j, k, 300, random, l);
this.a(world, i, j - 1, k, 250, random, l);
this.a(world, i, j + 1, k, 250, random, l);
this.a(world, i, j, k - 1, 300, random, l);
this.a(world, i, j, k + 1, 300, random, l);
boolean flag1 = world.z(i, j, k);
byte b0 = 0;
if (flag1) {
b0 = -50;
}
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);
// CraftBukkit start - Call to stop spread of fire.
org.bukkit.Server server = world.getServer();
@ -121,7 +128,11 @@ public class BlockFire extends Block {
if (i2 > 0) {
int j2 = (i2 + 40) / (l + 30);
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.w() || !world.v(i1, k1, j1)) && !world.v(i1 - 1, k1, k) && !world.v(i1 + 1, k1, j1) && !world.v(i1, k1, j1 - 1) && !world.v(i1, k1, j1 + 1)) {
if (flag1) {
j2 /= 2;
}
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.x() || !world.y(i1, k1, j1)) && !world.y(i1 - 1, k1, k) && !world.y(i1 + 1, k1, j1) && !world.y(i1, k1, j1 - 1) && !world.y(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) {
@ -176,7 +187,7 @@ public class BlockFire extends Block {
}
// CraftBukkit end
if (random.nextInt(i1 + 10) < 5 && !world.v(i, j, k)) {
if (random.nextInt(i1 + 10) < 5 && !world.y(i, j, k)) {
int k1 = i1 + random.nextInt(5) / 4;
if (k1 > 15) {
@ -195,7 +206,7 @@ public class BlockFire extends Block {
}
private boolean g(World world, int i, int j, int k) {
return this.b(world, i + 1, j, k) ? true : (this.b(world, i - 1, j, k) ? true : (this.b(world, i, j - 1, k) ? true : (this.b(world, i, j + 1, k) ? true : (this.b(world, i, j, k - 1) ? true : this.b(world, i, j, k + 1)))));
return this.c(world, i + 1, j, k) ? true : (this.c(world, i - 1, j, k) ? true : (this.c(world, i, j - 1, k) ? true : (this.c(world, i, j + 1, k) ? true : (this.c(world, i, j, k - 1) ? true : this.c(world, i, j, k + 1)))));
}
private int h(World world, int i, int j, int k) {
@ -215,11 +226,11 @@ public class BlockFire extends Block {
}
}
public boolean x_() {
public boolean F_() {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
return this.a[iblockaccess.getTypeId(i, j, k)] > 0;
}
@ -244,7 +255,7 @@ public class BlockFire extends Block {
if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
} else {
world.c(i, j, k, this.id, this.d());
world.c(i, j, k, this.id, this.d() + world.random.nextInt(10));
}
}
}

View file

@ -25,6 +25,10 @@ public class BlockFlowing extends BlockFluids {
world.notify(i, j, k);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
public void a(World world, int i, int j, int k, Random random) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
@ -35,7 +39,7 @@ public class BlockFlowing extends BlockFluids {
int l = this.g(world, i, j, k);
byte b0 = 1;
if (this.material == Material.LAVA && !world.worldProvider.e) {
if (this.material == Material.LAVA && !world.worldProvider.d) {
b0 = 2;
}

View file

@ -31,19 +31,19 @@ public class BlockFurnace extends BlockContainer {
int k1 = world.getTypeId(i + 1, j, k);
byte b0 = 3;
if (Block.o[l] && !Block.o[i1]) {
if (Block.n[l] && !Block.n[i1]) {
b0 = 3;
}
if (Block.o[i1] && !Block.o[l]) {
if (Block.n[i1] && !Block.n[l]) {
b0 = 2;
}
if (Block.o[j1] && !Block.o[k1]) {
if (Block.n[j1] && !Block.n[k1]) {
b0 = 5;
}
if (Block.o[k1] && !Block.o[j1]) {
if (Block.n[k1] && !Block.n[j1]) {
b0 = 4;
}

View file

@ -139,14 +139,27 @@ public class BlockLeaves extends BlockTransparant {
}
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
super.dropNaturally(world, i, j, k, l, f, i1);
if (!world.isStatic && (l & 3) == 0 && world.random.nextInt(200) == 0) {
this.a(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
if (!world.isStatic) {
byte b0 = 20;
if ((l & 3) == 3) {
b0 = 40;
}
if (world.random.nextInt(b0) == 0) {
int j1 = this.getDropType(l, world.random, i1);
this.a(world, i, j, k, new ItemStack(j1, 1, this.getDropData(l)));
}
if ((l & 3) == 0 && world.random.nextInt(200) == 0) {
this.a(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
}
}
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.Q() != null && entityhuman.Q().id == Item.SHEARS.id) {
if (!world.isStatic && entityhuman.T() != null && entityhuman.T().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 {
@ -163,7 +176,7 @@ public class BlockLeaves extends BlockTransparant {
}
public int a(int i, int j) {
return (j & 3) == 1 ? this.textureId + 80 : this.textureId;
return (j & 3) == 1 ? this.textureId + 80 : ((j & 3) == 3 ? this.textureId + 144 : this.textureId);
}
public void b(World world, int i, int j, int k, Entity entity) {

View file

@ -1,265 +0,0 @@
package net.minecraft.server;
import java.util.Random;
public class BlockMinecartTrack extends Block {
private final boolean a;
public static final boolean g(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
return l == Block.RAILS.id || l == Block.GOLDEN_RAIL.id || l == Block.DETECTOR_RAIL.id;
}
public static final boolean d(int i) {
return i == Block.RAILS.id || i == Block.GOLDEN_RAIL.id || i == Block.DETECTOR_RAIL.id;
}
protected BlockMinecartTrack(int i, int j, boolean flag) {
super(i, j, Material.ORIENTABLE);
this.a = flag;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
public boolean h() {
return this.a;
}
public AxisAlignedBB e(World world, int i, int j, int k) {
return null;
}
public boolean a() {
return false;
}
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
this.updateShape(world, i, j, k);
return super.a(world, i, j, k, vec3d, vec3d1);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
if (l >= 2 && l <= 5) {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
} else {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
}
public int a(int i, int j) {
if (this.a) {
if (this.id == Block.GOLDEN_RAIL.id && (j & 8) == 0) {
return this.textureId - 16;
}
} else if (j >= 6) {
return this.textureId - 16;
}
return this.textureId;
}
public boolean b() {
return false;
}
public int c() {
return 9;
}
public int a(Random random) {
return 1;
}
public boolean canPlace(World world, int i, int j, int k) {
return world.e(i, j - 1, k);
}
public void onPlace(World world, int i, int j, int k) {
if (!world.isStatic) {
this.a(world, i, j, k, true);
if (this.id == Block.GOLDEN_RAIL.id) {
//this.doPhysics(world, i, j, k, this.id); // CraftBukkit - Fix dupe with pistons
}
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
int i1 = world.getData(i, j, k);
int j1 = i1;
if (this.a) {
j1 = i1 & 7;
}
boolean flag = false;
if (!world.e(i, j - 1, k)) {
flag = true;
}
if (j1 == 2 && !world.e(i + 1, j, k)) {
flag = true;
}
if (j1 == 3 && !world.e(i - 1, j, k)) {
flag = true;
}
if (j1 == 4 && !world.e(i, j, k - 1)) {
flag = true;
}
if (j1 == 5 && !world.e(i, j, k + 1)) {
flag = true;
}
if (flag) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeId(i, j, k, 0);
} else if (this.id == Block.GOLDEN_RAIL.id) {
boolean flag1 = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
flag1 = flag1 || this.a(world, i, j, k, i1, true, 0) || this.a(world, i, j, k, i1, false, 0);
boolean flag2 = false;
if (flag1 && (i1 & 8) == 0) {
world.setData(i, j, k, j1 | 8);
flag2 = true;
} else if (!flag1 && (i1 & 8) != 0) {
world.setData(i, j, k, j1);
flag2 = true;
}
if (flag2) {
world.applyPhysics(i, j - 1, k, this.id);
if (j1 == 2 || j1 == 3 || j1 == 4 || j1 == 5) {
world.applyPhysics(i, j + 1, k, this.id);
}
}
} else if (l > 0 && Block.byId[l].isPowerSource() && !this.a && MinecartTrackLogic.a(new MinecartTrackLogic(this, world, i, j, k)) == 3) {
this.a(world, i, j, k, false);
}
}
}
private void a(World world, int i, int j, int k, boolean flag) {
if (!world.isStatic) {
(new MinecartTrackLogic(this, world, i, j, k)).a(world.isBlockIndirectlyPowered(i, j, k), flag);
}
}
private boolean a(World world, int i, int j, int k, int l, boolean flag, int i1) {
if (i1 >= 8) {
return false;
} else {
int j1 = l & 7;
boolean flag1 = true;
switch (j1) {
case 0:
if (flag) {
++k;
} else {
--k;
}
break;
case 1:
if (flag) {
--i;
} else {
++i;
}
break;
case 2:
if (flag) {
--i;
} else {
++i;
++j;
flag1 = false;
}
j1 = 1;
break;
case 3:
if (flag) {
--i;
++j;
flag1 = false;
} else {
++i;
}
j1 = 1;
break;
case 4:
if (flag) {
++k;
} else {
--k;
++j;
flag1 = false;
}
j1 = 0;
break;
case 5:
if (flag) {
++k;
++j;
flag1 = false;
} else {
--k;
}
j1 = 0;
}
return this.a(world, i, j, k, flag, i1, j1) ? true : flag1 && this.a(world, i, j - 1, k, flag, i1, j1);
}
}
private boolean a(World world, int i, int j, int k, boolean flag, int l, int i1) {
int j1 = world.getTypeId(i, j, k);
if (j1 == Block.GOLDEN_RAIL.id) {
int k1 = world.getData(i, j, k);
int l1 = k1 & 7;
if (i1 == 1 && (l1 == 0 || l1 == 4 || l1 == 5)) {
return false;
}
if (i1 == 0 && (l1 == 1 || l1 == 2 || l1 == 3)) {
return false;
}
if ((k1 & 8) != 0) {
if (!world.isBlockIndirectlyPowered(i, j, k) && !world.isBlockIndirectlyPowered(i, j + 1, k)) {
return this.a(world, i, j, k, k1, flag, l + 1);
}
return true;
}
}
return false;
}
public int g() {
return 0;
}
static boolean a(BlockMinecartTrack blockminecarttrack) {
return blockminecarttrack.a;
}
}

View file

@ -77,14 +77,14 @@ public class BlockMushroom extends BlockFlower {
}
protected boolean d(int i) {
return Block.o[i];
return Block.n[i];
}
public boolean f(World world, int i, int j, int k) {
if (j >= 0 && j < world.height) {
if (j >= 0 && j < 256) {
int l = world.getTypeId(i, j - 1, k);
return l == Block.MYCEL.id || world.k(i, j, k) < 13 && this.d(l);
return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.d(l);
} else {
return false;
}

View file

@ -16,18 +16,18 @@ public class BlockNetherWart extends BlockFlower {
return i == Block.SOUL_SAND.id;
}
public boolean f(World world, int i, int j, int k) {
return this.d(world.getTypeId(i, j - 1, k));
}
public void a(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
if (l < 3) {
WorldChunkManager worldchunkmanager = world.getWorldChunkManager();
BiomeBase biomebase = world.getBiome(i, k);
if (worldchunkmanager != null) {
BiomeBase biomebase = worldchunkmanager.getBiome(i, k);
if (biomebase instanceof BiomeHell && random.nextInt(15) == 0) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
}
if (biomebase instanceof BiomeHell && random.nextInt(10) == 0) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
}
}

View file

@ -139,7 +139,7 @@ public class BlockPiston extends Block {
if (tileentitypiston.f() == i1 && tileentitypiston.e()) {
tileentitypiston.g();
i2 = tileentitypiston.c();
j2 = tileentitypiston.j();
j2 = tileentitypiston.k();
flag = true;
}
}
@ -213,6 +213,11 @@ public class BlockPiston extends Block {
super.a(world, i, j, k, axisalignedbb, arraylist);
}
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 boolean b() {
return false;
}
@ -277,7 +282,7 @@ public class BlockPiston extends Block {
while (true) {
if (l1 < 13) {
if (j1 <= 0 || j1 >= world.height - 1) {
if (j1 <= 0 || j1 >= 255) {
return -1; // CraftBukkit
}
@ -316,7 +321,7 @@ public class BlockPiston extends Block {
int i2;
if (l1 < 13) {
if (j1 <= 0 || j1 >= world.height - 1) {
if (j1 <= 0 || j1 >= 255) {
return false;
}

View file

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

View file

@ -38,6 +38,10 @@ public class BlockPressurePlate extends Block {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
public boolean canPlace(World world, int i, int j, int k) {
return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.FENCE.id;
}
@ -80,7 +84,7 @@ public class BlockPressurePlate extends Block {
List list = null;
if (this.a == EnumMobType.EVERYTHING) {
list = world.getEntities(null, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
list = world.getEntities((Entity) null, AxisAlignedBB.b((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
}
if (this.a == EnumMobType.MOBS) {

View file

@ -2,7 +2,7 @@ package net.minecraft.server;
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockPumpkin extends Block {
public class BlockPumpkin extends BlockDirectional {
private boolean a;
@ -38,18 +38,58 @@ public class BlockPumpkin extends Block {
if (world.suppressPhysics) return; // CraftBukkit
if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
if (!world.isStatic && world.getServer().getServer().spawnAnimals) { // CraftBukkit - make snowmen obey spawning rules
world.setTypeId(i, j, k, 0);
world.setTypeId(i, j - 1, k, 0);
world.setTypeId(i, j - 2, k, 0);
world.setRawTypeId(i, j, k, 0);
world.setRawTypeId(i, j - 1, k, 0);
world.setRawTypeId(i, j - 2, k, 0);
EntitySnowman entitysnowman = new EntitySnowman(world);
entitysnowman.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
world.addEntity(entitysnowman, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BUILD_SNOWMAN); // CraftBukkit
world.update(i, j, k, 0);
world.update(i, j - 1, k, 0);
world.update(i, j - 2, k, 0);
}
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);
}
} else if (world.getTypeId(i, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.IRON_BLOCK.id) {
boolean flag = world.getTypeId(i - 1, j - 1, k) == Block.IRON_BLOCK.id && world.getTypeId(i + 1, j - 1, k) == Block.IRON_BLOCK.id;
boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id;
if (flag || flag1) {
world.setRawTypeId(i, j, k, 0);
world.setRawTypeId(i, j - 1, k, 0);
world.setRawTypeId(i, j - 2, k, 0);
if (flag) {
world.setRawTypeId(i - 1, j - 1, k, 0);
world.setRawTypeId(i + 1, j - 1, k, 0);
} else {
world.setRawTypeId(i, j - 1, k - 1, 0);
world.setRawTypeId(i, j - 1, k + 1, 0);
}
EntityIronGolem entityirongolem = new EntityIronGolem(world);
entityirongolem.b(true);
entityirongolem.setPositionRotation((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
world.addEntity(entityirongolem);
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.update(i, j, k, 0);
world.update(i, j - 1, k, 0);
world.update(i, j - 2, k, 0);
if (flag) {
world.update(i - 1, j - 1, k, 0);
world.update(i + 1, j - 1, k, 0);
} else {
world.update(i, j - 1, k - 1, 0);
world.update(i, j - 1, k + 1, 0);
}
}
}
}

View file

@ -91,7 +91,7 @@ public class BlockRedstoneTorch extends BlockTorch {
public void a(World world, int i, int j, int k, Random random) {
boolean flag = this.g(world, i, j, k);
while (b.size() > 0 && world.getTime() - ((RedstoneUpdateInfo) b.get(0)).d > 100L) {
while (b.size() > 0 && world.getTime() - ((RedstoneUpdateInfo) b.get(0)).d > 60L) {
b.remove(0);
}

View file

@ -38,7 +38,7 @@ public class BlockRedstoneWire extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
return world.e(i, j - 1, k);
return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
}
private void g(World world, int i, int j, int k) {

View file

@ -37,7 +37,7 @@ public class BlockSapling extends BlockFlower {
public int a(int i, int j) {
j &= 3;
return j == 1 ? 63 : (j == 2 ? 79 : super.a(i, j));
return j == 1 ? 63 : (j == 2 ? 79 : (j == 3 ? 30 : super.a(i, j)));
}
// CraftBukkit - added bonemeal, player and itemstack

View file

@ -60,6 +60,10 @@ public class BlockSign extends BlockContainer {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
public boolean a() {
return false;
}

View file

@ -14,7 +14,7 @@ public class BlockSoil extends Block {
this.textureId = 87;
this.a(true);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
this.g(255);
this.f(255);
}
public AxisAlignedBB e(World world, int i, int j, int k) {
@ -34,7 +34,7 @@ public class BlockSoil extends Block {
}
public void a(World world, int i, int j, int k, Random random) {
if (!this.h(world, i, j, k) && !world.v(i, j + 1, k)) {
if (!this.h(world, i, j, k) && !world.y(i, j + 1, k)) {
int l = world.getData(i, j, k);
if (l > 0) {

View file

@ -14,6 +14,10 @@ public class BlockStationary extends BlockFluids {
}
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l);
if (world.getTypeId(i, j, k) == this.id) {
@ -35,17 +39,19 @@ public class BlockStationary extends BlockFluids {
if (this.material == Material.LAVA) {
int l = random.nextInt(3);
int i1;
int j1;
// CraftBukkit start - prevent lava putting something on fire.
org.bukkit.World bworld = world.getWorld();
BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
// CraftBukkit end
for (int i1 = 0; i1 < l; ++i1) {
for (i1 = 0; i1 < l; ++i1) {
i += random.nextInt(3) - 1;
++j;
k += random.nextInt(3) - 1;
int j1 = world.getTypeId(i, j, k);
j1 = world.getTypeId(i, j, k);
if (j1 == 0) {
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
// CraftBukkit start - prevent lava putting something on fire.
@ -68,6 +74,19 @@ public class BlockStationary extends BlockFluids {
return;
}
}
if (l == 0) {
i1 = i;
j1 = k;
for (int k1 = 0; k1 < 3; ++k1) {
i = i1 + random.nextInt(3) - 1;
k = j1 + random.nextInt(3) - 1;
if (world.isEmpty(i, j + 1, k) && this.j(world, i, j, k)) {
world.setTypeId(i, j + 1, k, Block.FIRE.id);
}
}
}
}
}

View file

@ -52,7 +52,7 @@ public class BlockTNT extends Block {
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
if (entityhuman.Q() != null && entityhuman.Q().id == Item.FLINT_AND_STEEL.id) {
if (entityhuman.T() != null && entityhuman.T().id == Item.FLINT_AND_STEEL.id) {
world.setRawData(i, j, k, 1);
}

View file

@ -25,6 +25,10 @@ public class BlockTrapdoor extends Block {
return false;
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return !e(iblockaccess.getData(i, j, k));
}
public int c() {
return 0;
}
@ -115,7 +119,7 @@ public class BlockTrapdoor extends Block {
--j1;
}
if (!f(world.getTypeId(j1, j, k1))) {
if (!h(world.getTypeId(j1, j, k1))) {
world.setTypeId(i, j, k, 0);
this.b(world, i, j, k, i1, 0);
}
@ -189,7 +193,7 @@ public class BlockTrapdoor extends Block {
--i;
}
return f(world.getTypeId(i, j, k));
return h(world.getTypeId(i, j, k));
}
}
@ -197,7 +201,7 @@ public class BlockTrapdoor extends Block {
return (i & 4) != 0;
}
private static boolean f(int i) {
private static boolean h(int i) {
if (i <= 0) {
return false;
} else {

File diff suppressed because it is too large Load diff

View file

@ -1,259 +0,0 @@
package net.minecraft.server;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
public class ChunkLoader implements IChunkLoader {
private File a;
private boolean b;
public ChunkLoader(File file1, boolean flag) {
this.a = file1;
this.b = flag;
}
private File a(int i, int j) {
String s = "c." + Integer.toString(i, 36) + "." + Integer.toString(j, 36) + ".dat";
String s1 = Integer.toString(i & 63, 36);
String s2 = Integer.toString(j & 63, 36);
File file1 = new File(this.a, s1);
if (!file1.exists()) {
if (!this.b) {
return null;
}
file1.mkdir();
}
file1 = new File(file1, s2);
if (!file1.exists()) {
if (!this.b) {
return null;
}
file1.mkdir();
}
file1 = new File(file1, s);
return !file1.exists() && !this.b ? null : file1;
}
public Chunk a(World world, int i, int j) {
File file1 = this.a(i, j);
if (file1 != null && file1.exists()) {
try {
FileInputStream fileinputstream = new FileInputStream(file1);
NBTTagCompound nbttagcompound = NBTCompressedStreamTools.a((InputStream) fileinputstream);
if (!nbttagcompound.hasKey("Level")) {
System.out.println("Chunk file at " + i + "," + j + " is missing level data, skipping");
return null;
}
if (!nbttagcompound.getCompound("Level").hasKey("Blocks")) {
System.out.println("Chunk file at " + i + "," + j + " is missing block data, skipping");
return null;
}
Chunk chunk = a(world, nbttagcompound.getCompound("Level"));
if (!chunk.a(i, j)) {
System.out.println("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
chunk = a(world, nbttagcompound.getCompound("Level"));
}
chunk.h();
return chunk;
} catch (Exception exception) {
exception.printStackTrace();
}
}
return null;
}
public void a(World world, Chunk chunk) {
world.l();
File file1 = this.a(chunk.x, chunk.z);
if (file1.exists()) {
WorldData worlddata = world.getWorldData();
worlddata.b(worlddata.g() - file1.length());
}
try {
File file2 = new File(this.a, "tmp_chunk.dat");
FileOutputStream fileoutputstream = new FileOutputStream(file2);
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound.set("Level", nbttagcompound1);
a(chunk, world, nbttagcompound1);
NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) fileoutputstream);
fileoutputstream.close();
if (file1.exists()) {
file1.delete();
}
file2.renameTo(file1);
WorldData worlddata1 = world.getWorldData();
worlddata1.b(worlddata1.g() + file1.length());
} catch (Exception exception) {
exception.printStackTrace();
}
}
public static void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) {
world.l();
nbttagcompound.setInt("xPos", chunk.x);
nbttagcompound.setInt("zPos", chunk.z);
nbttagcompound.setLong("LastUpdate", world.getTime());
nbttagcompound.setByteArray("Blocks", chunk.blocks);
nbttagcompound.setByteArray("Data", chunk.g.a);
nbttagcompound.setByteArray("SkyLight", chunk.h.a);
nbttagcompound.setByteArray("BlockLight", chunk.i.a);
nbttagcompound.setByteArray("HeightMap", chunk.heightMap);
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
chunk.s = false;
NBTTagList nbttaglist = new NBTTagList();
Iterator iterator;
NBTTagCompound nbttagcompound1;
for (int i = 0; i < chunk.entitySlices.length; ++i) {
iterator = chunk.entitySlices[i].iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
chunk.s = true;
nbttagcompound1 = new NBTTagCompound();
if (entity.c(nbttagcompound1)) {
nbttaglist.add(nbttagcompound1);
}
}
}
nbttagcompound.set("Entities", nbttaglist);
NBTTagList nbttaglist1 = new NBTTagList();
iterator = chunk.tileEntities.values().iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
nbttagcompound1 = new NBTTagCompound();
tileentity.b(nbttagcompound1);
nbttaglist1.add(nbttagcompound1);
}
nbttagcompound.set("TileEntities", nbttaglist1);
List list = world.a(chunk, false);
if (list != null) {
long j = world.getTime();
NBTTagList nbttaglist2 = new NBTTagList();
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
NextTickListEntry nextticklistentry = (NextTickListEntry) iterator1.next();
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.setInt("i", nextticklistentry.d);
nbttagcompound2.setInt("x", nextticklistentry.a);
nbttagcompound2.setInt("y", nextticklistentry.b);
nbttagcompound2.setInt("z", nextticklistentry.c);
nbttagcompound2.setInt("t", (int) (nextticklistentry.e - j));
nbttaglist2.add(nbttagcompound2);
}
nbttagcompound.set("TileTicks", nbttaglist2);
}
}
public static Chunk a(World world, NBTTagCompound nbttagcompound) {
int i = nbttagcompound.getInt("xPos");
int j = nbttagcompound.getInt("zPos");
Chunk chunk = new Chunk(world, i, j);
chunk.blocks = nbttagcompound.getByteArray("Blocks");
chunk.g = new NibbleArray(nbttagcompound.getByteArray("Data"), world.heightBits);
chunk.h = new NibbleArray(nbttagcompound.getByteArray("SkyLight"), world.heightBits);
chunk.i = new NibbleArray(nbttagcompound.getByteArray("BlockLight"), world.heightBits);
chunk.heightMap = nbttagcompound.getByteArray("HeightMap");
chunk.done = nbttagcompound.getBoolean("TerrainPopulated");
if (!chunk.g.a()) {
chunk.g = new NibbleArray(chunk.blocks.length, world.heightBits);
}
if (chunk.heightMap == null || !chunk.h.a()) {
chunk.heightMap = new byte[256];
chunk.h = new NibbleArray(chunk.blocks.length, world.heightBits);
chunk.initLighting();
}
if (!chunk.i.a()) {
chunk.i = new NibbleArray(chunk.blocks.length, world.heightBits);
chunk.a();
}
NBTTagList nbttaglist = nbttagcompound.getList("Entities");
if (nbttaglist != null) {
for (int k = 0; k < nbttaglist.size(); ++k) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(k);
Entity entity = EntityTypes.a(nbttagcompound1, world);
chunk.s = true;
if (entity != null) {
chunk.a(entity);
}
}
}
NBTTagList nbttaglist1 = nbttagcompound.getList("TileEntities");
if (nbttaglist1 != null) {
for (int l = 0; l < nbttaglist1.size(); ++l) {
NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.get(l);
TileEntity tileentity = TileEntity.c(nbttagcompound2);
if (tileentity != null) {
chunk.a(tileentity);
}
}
}
if (nbttagcompound.hasKey("TileTicks")) {
NBTTagList nbttaglist2 = nbttagcompound.getList("TileTicks");
if (nbttaglist2 != null) {
for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) {
NBTTagCompound nbttagcompound3 = (NBTTagCompound) nbttaglist2.get(i1);
world.d(nbttagcompound3.getInt("x"), nbttagcompound3.getInt("y"), nbttagcompound3.getInt("z"), nbttagcompound3.getInt("i"), nbttagcompound3.getInt("t"));
}
}
}
return chunk;
}
public void a() {}
public void b() {}
public void b(World world, Chunk chunk) {}
}

View file

@ -32,7 +32,7 @@ public class ChunkProviderServer implements IChunkProvider {
// CraftBukkit end
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
this.emptyChunk = new EmptyChunk(worldserver, new byte[256 * worldserver.height], 0, 0);
this.emptyChunk = new EmptyChunk(worldserver, 0, 0);
this.world = worldserver;
this.e = ichunkloader;
this.chunkProvider = ichunkprovider;
@ -135,7 +135,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = this.e.a(this.world, i, j);
if (chunk != null) {
chunk.t = this.world.getTime();
chunk.n = this.world.getTime();
}
return chunk;
@ -159,7 +159,7 @@ public class ChunkProviderServer implements IChunkProvider {
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
if (this.e != null) {
try {
chunk.t = this.world.getTime();
chunk.n = this.world.getTime();
this.e.a(this.world, chunk);
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
ioexception.printStackTrace();
@ -193,7 +193,7 @@ public class ChunkProviderServer implements IChunkProvider {
this.world.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
// CraftBukkit end
chunk.f();
chunk.e();
}
}
}
@ -204,13 +204,13 @@ public class ChunkProviderServer implements IChunkProvider {
for (int j = 0; j < this.chunkList.size(); ++j) {
Chunk chunk = (Chunk) this.chunkList.get(j);
if (flag && !chunk.r) {
if (flag) {
this.saveChunkNOP(chunk);
}
if (chunk.a(flag)) {
this.saveChunk(chunk);
chunk.q = false;
chunk.l = false;
++i;
if (i == 24 && !flag) {
return false;
@ -266,7 +266,7 @@ public class ChunkProviderServer implements IChunkProvider {
}
public String d() {
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size();
return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit
}
public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) {

View file

@ -1,8 +1,14 @@
package net.minecraft.server;
import java.io.*;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException; // CraftBukkit
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@ -43,43 +49,47 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
nbttagcompound = NBTCompressedStreamTools.a((DataInput) datainputstream);
}
return this.a(world, i, j, nbttagcompound);
}
protected Chunk a(World world, int i, int j, NBTTagCompound nbttagcompound) {
if (!nbttagcompound.hasKey("Level")) {
System.out.println("Chunk file at " + i + "," + j + " is missing level data, skipping");
return null;
} else if (!nbttagcompound.getCompound("Level").hasKey("Blocks")) {
} else if (!nbttagcompound.getCompound("Level").hasKey("Sections")) {
System.out.println("Chunk file at " + i + "," + j + " is missing block data, skipping");
return null;
} else {
Chunk chunk = ChunkLoader.a(world, nbttagcompound.getCompound("Level"));
Chunk chunk = this.a(world, nbttagcompound.getCompound("Level"));
if (!chunk.a(i, j)) {
System.out.println("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
chunk = ChunkLoader.a(world, nbttagcompound.getCompound("Level"));
chunk = this.a(world, nbttagcompound.getCompound("Level"));
}
chunk.h();
chunk.i();
return chunk;
}
}
public void a(World world, Chunk chunk) {
world.l();
world.m();
try {
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound.set("Level", nbttagcompound1);
ChunkLoader.a(chunk, world, nbttagcompound1);
this.a(chunk.j(), nbttagcompound);
this.a(chunk, world, nbttagcompound1);
this.a(chunk.k(), nbttagcompound);
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) {
protected void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) {
Object object = this.c;
synchronized (this.c) {
@ -134,4 +144,169 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
public void a() {}
public void b() {}
private void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) {
world.m();
nbttagcompound.setInt("xPos", chunk.x);
nbttagcompound.setInt("zPos", chunk.z);
nbttagcompound.setLong("LastUpdate", world.getTime());
nbttagcompound.setIntArray("HeightMap", chunk.heightMap);
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
ChunkSection[] achunksection = chunk.h();
NBTTagList nbttaglist = new NBTTagList("Sections");
ChunkSection[] achunksection1 = achunksection;
int i = achunksection.length;
NBTTagCompound nbttagcompound1;
for (int j = 0; j < i; ++j) {
ChunkSection chunksection = achunksection1[j];
if (chunksection != null && chunksection.f() != 0) {
nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Y", (byte) (chunksection.c() >> 4 & 255));
nbttagcompound1.setByteArray("Blocks", chunksection.g());
if (chunksection.h() != null) {
nbttagcompound1.setByteArray("Add", chunksection.h().a);
}
nbttagcompound1.setByteArray("Data", chunksection.i().a);
nbttagcompound1.setByteArray("SkyLight", chunksection.k().a);
nbttagcompound1.setByteArray("BlockLight", chunksection.j().a);
nbttaglist.add(nbttagcompound1);
}
}
nbttagcompound.set("Sections", nbttaglist);
nbttagcompound.setByteArray("Biomes", chunk.l());
chunk.m = false;
NBTTagList nbttaglist1 = new NBTTagList();
Iterator iterator;
for (i = 0; i < chunk.entitySlices.length; ++i) {
iterator = chunk.entitySlices[i].iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
chunk.m = true;
nbttagcompound1 = new NBTTagCompound();
if (entity.c(nbttagcompound1)) {
nbttaglist1.add(nbttagcompound1);
}
}
}
nbttagcompound.set("Entities", nbttaglist1);
NBTTagList nbttaglist2 = new NBTTagList();
iterator = chunk.tileEntities.values().iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
nbttagcompound1 = new NBTTagCompound();
tileentity.b(nbttagcompound1);
nbttaglist2.add(nbttagcompound1);
}
nbttagcompound.set("TileEntities", nbttaglist2);
List list = world.a(chunk, false);
if (list != null) {
long k = world.getTime();
NBTTagList nbttaglist3 = new NBTTagList();
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
NextTickListEntry nextticklistentry = (NextTickListEntry) iterator1.next();
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.setInt("i", nextticklistentry.d);
nbttagcompound2.setInt("x", nextticklistentry.a);
nbttagcompound2.setInt("y", nextticklistentry.b);
nbttagcompound2.setInt("z", nextticklistentry.c);
nbttagcompound2.setInt("t", (int) (nextticklistentry.e - k));
nbttaglist3.add(nbttagcompound2);
}
nbttagcompound.set("TileTicks", nbttaglist3);
}
}
private Chunk a(World world, NBTTagCompound nbttagcompound) {
int i = nbttagcompound.getInt("xPos");
int j = nbttagcompound.getInt("zPos");
Chunk chunk = new Chunk(world, i, j);
chunk.heightMap = nbttagcompound.getIntArray("HeightMap");
chunk.done = nbttagcompound.getBoolean("TerrainPopulated");
NBTTagList nbttaglist = nbttagcompound.getList("Sections");
byte b0 = 16;
ChunkSection[] achunksection = new ChunkSection[b0];
for (int k = 0; k < nbttaglist.size(); ++k) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(k);
byte b1 = nbttagcompound1.getByte("Y");
ChunkSection chunksection = new ChunkSection(b1 << 4);
chunksection.a(nbttagcompound1.getByteArray("Blocks"));
if (nbttagcompound1.hasKey("Add")) {
chunksection.a(new NibbleArray(nbttagcompound1.getByteArray("Add"), 4));
}
chunksection.b(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4));
chunksection.d(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4));
chunksection.c(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4));
chunksection.d();
achunksection[b1] = chunksection;
}
chunk.a(achunksection);
if (nbttagcompound.hasKey("Biomes")) {
chunk.a(nbttagcompound.getByteArray("Biomes"));
}
NBTTagList nbttaglist1 = nbttagcompound.getList("Entities");
if (nbttaglist1 != null) {
for (int l = 0; l < nbttaglist1.size(); ++l) {
NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.get(l);
Entity entity = EntityTypes.a(nbttagcompound2, world);
chunk.m = true;
if (entity != null) {
chunk.a(entity);
}
}
}
NBTTagList nbttaglist2 = nbttagcompound.getList("TileEntities");
if (nbttaglist2 != null) {
for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) {
NBTTagCompound nbttagcompound3 = (NBTTagCompound) nbttaglist2.get(i1);
TileEntity tileentity = TileEntity.c(nbttagcompound3);
if (tileentity != null) {
chunk.a(tileentity);
}
}
}
if (nbttagcompound.hasKey("TileTicks")) {
NBTTagList nbttaglist3 = nbttagcompound.getList("TileTicks");
if (nbttaglist3 != null) {
for (int j1 = 0; j1 < nbttaglist3.size(); ++j1) {
NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist3.get(j1);
world.d(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z"), nbttagcompound4.getInt("i"), nbttagcompound4.getInt("t"));
}
}
}
return chunk;
}
}

View file

@ -177,7 +177,7 @@ public abstract class Container {
slot1.set((ItemStack) null);
}
slot1.b(playerinventory.getCarried());
slot1.c(playerinventory.getCarried());
} else if (slot1.isAllowed(itemstack3)) {
if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
l = j == 0 ? itemstack3.count : 1;
@ -203,12 +203,12 @@ public abstract class Container {
l = itemstack2.count;
if (l > 0 && l + itemstack3.count <= itemstack3.getMaxStackSize()) {
itemstack3.count += l;
itemstack2.a(l);
itemstack2 = slot1.a(l);
if (itemstack2.count == 0) {
slot1.set((ItemStack) null);
}
slot1.b(playerinventory.getCarried());
slot1.c(playerinventory.getCarried());
}
}
}

View file

@ -37,7 +37,7 @@ public class ContainerBrewingStand extends Container {
public void addSlotListener(ICrafting icrafting) {
super.addSlotListener(icrafting);
icrafting.setContainerData(this, 0, this.brewingStand.h());
icrafting.setContainerData(this, 0, this.brewingStand.i());
}
public void a() {
@ -46,12 +46,12 @@ public class ContainerBrewingStand extends Container {
for (int i = 0; i < this.listeners.size(); ++i) {
ICrafting icrafting = (ICrafting) this.listeners.get(i);
if (this.b != this.brewingStand.h()) {
icrafting.setContainerData(this, 0, this.brewingStand.h());
if (this.b != this.brewingStand.i()) {
icrafting.setContainerData(this, 0, this.brewingStand.i());
}
}
this.b = this.brewingStand.h();
this.b = this.brewingStand.i();
}
public boolean b(EntityHuman entityhuman) {
@ -79,8 +79,12 @@ public class ContainerBrewingStand extends Container {
} else if (!this.a(itemstack1, 4, 40, false)) {
return null;
}
} else if (!this.a(itemstack1, 4, 40, true)) {
return null;
} else {
if (!this.a(itemstack1, 4, 40, true)) {
return null;
}
slot.a(itemstack1, itemstack);
}
if (itemstack1.count == 0) {
@ -93,7 +97,7 @@ public class ContainerBrewingStand extends Container {
return null;
}
slot.b(itemstack1);
slot.c(itemstack1);
}
return itemstack;

View file

@ -71,7 +71,7 @@ public class ContainerDispenser extends Container {
return null;
}
slot.b(itemstack1);
slot.c(itemstack1);
}
return itemstack;

View file

@ -146,9 +146,9 @@ public class ContainerEnchantTable extends Container {
public boolean a(EntityHuman entityhuman, int i) {
ItemStack itemstack = this.enchantSlots.getItem(0);
if (this.costs[i] > 0 && itemstack != null && entityhuman.expLevel >= this.costs[i]) {
if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) {
if (!this.world.isStatic) {
List list = EnchantmentManager.a(this.l, itemstack, this.costs[i]);
List list = EnchantmentManager.b(this.l, itemstack, this.costs[i]);
// CraftBukkit start
Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new HashMap<org.bukkit.enchantments.Enchantment, Integer>();
@ -189,7 +189,7 @@ public class ContainerEnchantTable extends Container {
public void a(EntityHuman entityhuman) {
super.a(entityhuman);
if (!this.world.isStatic) {
ItemStack itemstack = this.enchantSlots.getItem(0);
ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(0);
if (itemstack != null) {
entityhuman.drop(itemstack);
@ -228,7 +228,7 @@ public class ContainerEnchantTable extends Container {
return null;
}
slot.b(itemstack1);
slot.c(itemstack1);
}
return itemstack;

View file

@ -73,6 +73,17 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
}
}
public ItemStack splitWithoutUpdate(int i) {
if (this.items[i] != null) {
ItemStack itemstack = this.items[i];
this.items[i] = null;
return itemstack;
} else {
return null;
}
}
public void setItem(int i, ItemStack itemstack) {
this.items[i] = itemstack;
if (itemstack != null && itemstack.count > this.getMaxStackSize()) {

View file

@ -94,6 +94,8 @@ public class ContainerFurnace extends Container {
if (!this.a(itemstack1, 3, 39, true)) {
return null;
}
slot.a(itemstack1, itemstack);
} else if (i >= 3 && i < 30) {
if (!this.a(itemstack1, 30, 39, false)) {
return null;
@ -116,7 +118,7 @@ public class ContainerFurnace extends Container {
return null;
}
slot.b(itemstack1);
slot.c(itemstack1);
}
return itemstack;

View file

@ -72,13 +72,14 @@ public class ContainerPlayer extends Container {
super.a(entityhuman);
for (int i = 0; i < 4; ++i) {
ItemStack itemstack = this.craftInventory.getItem(i);
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
if (itemstack != null) {
entityhuman.drop(itemstack);
this.craftInventory.setItem(i, (ItemStack) null);
}
}
this.resultInventory.setItem(0, (ItemStack) null);
}
public boolean b(EntityHuman entityhuman) {
@ -97,6 +98,8 @@ public class ContainerPlayer extends Container {
if (!this.a(itemstack1, 9, 45, true)) {
return null;
}
slot.a(itemstack1, itemstack);
} else if (i >= 9 && i < 36) {
if (!this.a(itemstack1, 36, 45, false)) {
return null;
@ -119,7 +122,7 @@ public class ContainerPlayer extends Container {
return null;
}
slot.b(itemstack1);
slot.c(itemstack1);
}
return itemstack;

View file

@ -71,7 +71,7 @@ public class ContainerWorkbench extends Container {
super.a(entityhuman);
if (!this.c.isStatic) {
for (int i = 0; i < 9; ++i) {
ItemStack itemstack = this.craftInventory.getItem(i);
ItemStack itemstack = this.craftInventory.splitWithoutUpdate(i);
if (itemstack != null) {
entityhuman.drop(itemstack);
@ -97,6 +97,8 @@ public class ContainerWorkbench extends Container {
if (!this.a(itemstack1, 10, 46, true)) {
return null;
}
slot.a(itemstack1, itemstack);
} else if (i >= 10 && i < 37) {
if (!this.a(itemstack1, 37, 46, false)) {
return null;
@ -119,7 +121,7 @@ public class ContainerWorkbench extends Container {
return null;
}
slot.b(itemstack1);
slot.c(itemstack1);
}
return itemstack;

View file

@ -44,13 +44,13 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.GLOWSTONE_DUST});
this.registerShapedRecipe(new ItemStack(Block.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.STRING});
this.registerShapedRecipe(new ItemStack(Block.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Item.SULPHUR, Character.valueOf('#'), Block.SAND});
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 2), new Object[] { "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 4), new Object[] { "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 5), new Object[] { "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.LADDER, 2), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.LADDER, 3), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Item.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Item.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Item.IRON_INGOT});
@ -99,6 +99,8 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.ENCHANTMENT_TABLE, 1), new Object[] { " B ", "D#D", "###", Character.valueOf('#'), Block.OBSIDIAN, Character.valueOf('B'), Item.BOOK, Character.valueOf('D'), Item.DIAMOND});
this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
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
System.out.println(this.recipies.size() + " recipes");

View file

@ -191,11 +191,11 @@ public abstract class Entity {
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bO, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bO + (double) f1, d2 + (double) f);
}
public void y_() {
this.am();
public void G_() {
this.az();
}
public void am() {
public void az() {
// MethodProfiler.a("entityBaseTick"); // CraftBukkit - not in production code
if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null;
@ -210,7 +210,7 @@ public abstract class Entity {
this.lastYaw = this.yaw;
int i;
if (this.isSprinting()) {
if (this.isSprinting() && !this.aT()) {
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
@ -222,7 +222,7 @@ public abstract class Entity {
}
}
if (this.i_()) {
if (this.h_()) {
if (!this.bV && !this.justCreated) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
@ -284,13 +284,13 @@ public abstract class Entity {
}
}
if (this.aL()) {
this.aG();
if (this.aU()) {
this.aP();
this.fallDistance *= 0.5F;
}
if (this.locY < -64.0D) {
this.az();
this.aH();
}
if (!this.world.isStatic) {
@ -302,7 +302,7 @@ public abstract class Entity {
// MethodProfiler.a(); // CraftBukkit - not in production code
}
protected void aG() {
protected void aP() {
if (!this.fireProof) {
// CraftBukkit start - fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) {
@ -352,7 +352,7 @@ public abstract class Entity {
this.fireTicks = 0;
}
protected void az() {
protected void aH() {
this.die();
}
@ -389,7 +389,7 @@ public abstract class Entity {
double d6 = d1;
double d7 = d2;
AxisAlignedBB axisalignedbb = this.boundingBox.clone();
boolean flag = this.onGround && this.isSneaking();
boolean flag = this.onGround && this.isSneaking() && this instanceof EntityHuman;
if (flag) {
double d8;
@ -618,7 +618,7 @@ public abstract class Entity {
}
}
boolean flag2 = this.aJ();
boolean flag2 = this.aS();
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
this.burn(1);
@ -683,7 +683,7 @@ public abstract class Entity {
}
}
this.b(this.fallDistance);
this.a(this.fallDistance);
this.fallDistance = 0.0F;
}
} else if (d0 < 0.0D) {
@ -691,7 +691,7 @@ public abstract class Entity {
}
}
public AxisAlignedBB h_() {
public AxisAlignedBB h() {
return null;
}
@ -717,21 +717,21 @@ public abstract class Entity {
return this.fireProof;
}
protected void b(float f) {
protected void a(float f) {
if (this.passenger != null) {
this.passenger.b(f);
this.passenger.a(f);
}
}
public boolean aJ() {
return this.bV || this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
public boolean aS() {
return this.bV || this.world.y(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
public boolean aK() {
public boolean aT() {
return this.bV;
}
public boolean i_() {
public boolean h_() {
return this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.0010D, 0.0010D, 0.0010D), Material.WATER, this);
}
@ -756,7 +756,7 @@ public abstract class Entity {
return 0.0F;
}
public boolean aL() {
public boolean aU() {
return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
}
@ -779,15 +779,15 @@ public abstract class Entity {
}
}
public float a(float f) {
public float b(float f) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
if (this.world.isLoaded(i, this.world.height / 2, j)) {
if (this.world.isLoaded(i, 0, j)) {
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
int k = MathHelper.floor(this.locY - (double) this.height + d0);
return this.world.m(i, k, j);
return this.world.p(i, k, j);
} else {
return 0.0F;
}
@ -834,7 +834,7 @@ public abstract class Entity {
this.setPosition(this.locX, this.locY, this.locZ);
}
public float h(Entity entity) {
public float i(Entity entity) {
float f = (float) (this.locX - entity.locX);
float f1 = (float) (this.locY - entity.locY);
float f2 = (float) (this.locZ - entity.locZ);
@ -858,7 +858,7 @@ public abstract class Entity {
return (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
}
public double i(Entity entity) {
public double j(Entity entity) {
double d0 = this.locX - entity.locX;
double d1 = this.locY - entity.locY;
double d2 = this.locZ - entity.locZ;
@ -903,12 +903,16 @@ public abstract class Entity {
this.ce = true;
}
protected void aM() {
protected void aV() {
this.velocityChanged = true;
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aM();
this.aV();
return false;
}
public boolean o_() {
return false;
}
@ -916,14 +920,10 @@ public abstract class Entity {
return false;
}
public boolean f_() {
return false;
}
public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) {
String s = this.aN();
String s = this.aW();
if (!this.dead && s != null) {
nbttagcompound.setString("id", s);
@ -1048,7 +1048,7 @@ public abstract class Entity {
// CraftBukkit end
}
protected final String aN() {
protected final String aW() {
return EntityTypes.b(this);
}
@ -1125,20 +1125,20 @@ public abstract class Entity {
return false;
}
public AxisAlignedBB a_(Entity entity) {
public AxisAlignedBB b_(Entity entity) {
return null;
}
public void N() {
public void Q() {
if (this.vehicle.dead) {
this.vehicle = null;
} else {
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
this.y_();
this.G_();
if (this.vehicle != null) {
this.vehicle.i();
this.vehicle.i_();
this.f += (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) {
@ -1185,15 +1185,15 @@ public abstract class Entity {
}
}
public void i() {
this.passenger.setPosition(this.locX, this.locY + this.q() + this.passenger.S(), this.locZ);
public void i_() {
this.passenger.setPosition(this.locX, this.locY + this.x_() + this.passenger.V(), this.locZ);
}
public double S() {
public double V() {
return (double) this.height;
}
public double q() {
public double x_() {
return (double) this.length * 0.75D;
}
@ -1274,22 +1274,22 @@ public abstract class Entity {
return 0.1F;
}
public Vec3D aA() {
public Vec3D aI() {
return null;
}
public void Y() {}
public void ac() {}
public ItemStack[] getEquipment() {
return null;
}
public boolean isBurning() {
return this.fireTicks > 0 || this.k(0);
return this.fireTicks > 0 || this.j(0);
}
public boolean isSneaking() {
return this.k(1);
return this.j(1);
}
public void setSneak(boolean flag) {
@ -1297,18 +1297,18 @@ public abstract class Entity {
}
public boolean isSprinting() {
return this.k(3);
return this.j(3);
}
public void setSprinting(boolean flag) {
this.a(3, flag);
}
public void h(boolean flag) {
public void i(boolean flag) {
this.a(4, flag);
}
protected boolean k(int i) {
protected boolean j(int i) {
return (this.datawatcher.getByte(0) & 1 << i) != 0;
}
@ -1367,7 +1367,7 @@ public abstract class Entity {
}
}
public void a(EntityLiving entityliving) {}
public void c(EntityLiving entityliving) {}
protected boolean g(double d0, double d1, double d2) {
int i = MathHelper.floor(d0);
@ -1449,7 +1449,7 @@ public abstract class Entity {
}
}
public void s() {
public void u() {
this.bC = true;
this.fallDistance = 0.0F;
}
@ -1464,11 +1464,19 @@ public abstract class Entity {
return LocaleI18n.get("entity." + s + ".name");
}
public Entity[] aR() {
public Entity[] ba() {
return null;
}
public boolean a(Entity entity) {
public boolean a_(Entity entity) {
return this == entity;
}
public float aq() {
return 0.0F;
}
public boolean k_() {
return true;
}
}

View file

@ -0,0 +1,52 @@
package net.minecraft.server;
public abstract class EntityAgeable extends EntityCreature {
public boolean ageLocked = false; // CraftBukkit
public EntityAgeable(World world) {
super(world);
}
protected void b() {
super.b();
this.datawatcher.a(12, new Integer(0));
}
public int getAge() {
return this.datawatcher.getInt(12);
}
public void setAge(int i) {
this.datawatcher.watch(12, Integer.valueOf(i));
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setInt("Age", this.getAge());
nbttagcompound.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.setAge(nbttagcompound.getInt("Age"));
this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
}
public void e() {
super.e();
int i = this.getAge();
if (ageLocked) return; // CraftBukkit
if (i < 0) {
++i;
this.setAge(i);
} else if (i > 0) {
--i;
this.setAge(i);
}
}
public boolean isBaby() {
return this.getAge() < 0;
}
}

View file

@ -1,258 +0,0 @@
package net.minecraft.server;
import java.util.List;
public abstract class EntityAnimal extends EntityCreature implements IAnimal {
private int love;
private int b = 0;
public boolean ageLocked = false; // CraftBukkit
public EntityAnimal(World world) {
super(world);
}
protected void b() {
super.b();
this.datawatcher.a(12, new Integer(0));
}
public int getAge() {
return this.datawatcher.getInt(12);
}
public void setAge(int i) {
this.datawatcher.watch(12, Integer.valueOf(i));
}
public void d() {
super.d();
int i = this.getAge();
if (!ageLocked) { // CraftBukkit
if (i < 0) {
++i;
this.setAge(i);
} else if (i > 0) {
--i;
this.setAge(i);
}
} // CraftBukkit
if (this.love > 0) {
--this.love;
String s = "heart";
if (this.love % 10 == 0) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D;
this.world.a(s, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2);
}
} else {
this.b = 0;
}
}
protected void a(Entity entity, float f) {
if (entity instanceof EntityHuman) {
if (f < 3.0F) {
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.e = true;
}
EntityHuman entityhuman = (EntityHuman) entity;
if (entityhuman.Q() == null || !this.a(entityhuman.Q())) {
this.target = null;
}
} else if (entity instanceof EntityAnimal) {
EntityAnimal entityanimal = (EntityAnimal) entity;
if (this.getAge() > 0 && entityanimal.getAge() < 0) {
if ((double) f < 2.5D) {
this.e = true;
}
} else if (this.love > 0 && entityanimal.love > 0) {
if (entityanimal.target == null) {
entityanimal.target = this;
}
if (entityanimal.target == this && (double) f < 3.5D) {
++entityanimal.love;
++this.love;
++this.b;
if (this.b % 4 == 0) {
this.world.a("heart", this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, 0.0D, 0.0D, 0.0D);
}
if (this.b == 60) {
this.b((EntityAnimal) entity);
}
} else {
this.b = 0;
}
} else {
this.b = 0;
this.target = null;
}
}
}
private void b(EntityAnimal entityanimal) {
EntityAnimal entityanimal1 = this.createChild(entityanimal);
if (entityanimal1 != null) {
this.setAge(6000);
entityanimal.setAge(6000);
this.love = 0;
this.b = 0;
this.target = null;
entityanimal.target = null;
entityanimal.b = 0;
entityanimal.love = 0;
entityanimal1.setAge(-24000);
entityanimal1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
for (int i = 0; i < 7; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D;
this.world.a("heart", this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2);
}
this.world.addEntity(entityanimal1);
}
}
protected abstract EntityAnimal createChild(EntityAnimal entityanimal);
protected void b(Entity entity, float f) {}
public boolean damageEntity(DamageSource damagesource, int i) {
this.f = 60;
this.target = null;
this.love = 0;
return super.damageEntity(damagesource, i);
}
public float a(int i, int j, int k) {
return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id ? 10.0F : this.world.m(i, j, k) - 0.5F;
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setInt("Age", this.getAge());
nbttagcompound.setInt("InLove", this.love);
nbttagcompound.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.setAge(nbttagcompound.getInt("Age"));
this.love = nbttagcompound.getInt("InLove");
this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
}
protected Entity findTarget() {
if (this.f > 0) {
return null;
} else {
float f = 8.0F;
List list;
int i;
EntityAnimal entityanimal;
if (this.love > 0) {
list = this.world.a(this.getClass(), this.boundingBox.grow((double) f, (double) f, (double) f));
for (i = 0; i < list.size(); ++i) {
entityanimal = (EntityAnimal) list.get(i);
if (entityanimal != this && entityanimal.love > 0) {
return entityanimal;
}
}
} else if (this.getAge() == 0) {
list = this.world.a(EntityHuman.class, this.boundingBox.grow((double) f, (double) f, (double) f));
for (i = 0; i < list.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) list.get(i);
if (entityhuman.Q() != null && this.a(entityhuman.Q())) {
return entityhuman;
}
}
} else if (this.getAge() > 0) {
list = this.world.a(this.getClass(), this.boundingBox.grow((double) f, (double) f, (double) f));
for (i = 0; i < list.size(); ++i) {
entityanimal = (EntityAnimal) list.get(i);
if (entityanimal != this && entityanimal.getAge() < 0) {
return entityanimal;
}
}
}
return null;
}
}
public boolean canSpawn() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id && this.world.k(i, j, k) > 8 && super.canSpawn();
}
public int h() {
return 120;
}
protected boolean d_() {
return false;
}
protected int getExpValue(EntityHuman entityhuman) {
return 1 + this.world.random.nextInt(3);
}
protected boolean a(ItemStack itemstack) {
return itemstack.id == Item.WHEAT.id;
}
public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && this.a(itemstack) && this.getAge() == 0) {
--itemstack.count;
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
this.love = 600;
this.target = null;
for (int i = 0; i < 7; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D;
this.world.a("heart", this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2);
}
return true;
} else {
return super.b(entityhuman);
}
}
public boolean isBaby() {
return this.getAge() < 0;
}
}

View file

@ -39,6 +39,30 @@ public class EntityArrow extends Entity {
this.height = 0.0F;
}
public EntityArrow(World world, EntityLiving entityliving, EntityLiving entityliving1, float f, float f1) {
super(world);
this.shooter = entityliving;
this.fromPlayer = entityliving instanceof EntityHuman;
this.locY = entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D;
double d0 = entityliving1.locX - entityliving.locX;
double d1 = entityliving1.locY + (double) entityliving1.getHeadHeight() - 0.699999988079071D - this.locY;
double d2 = entityliving1.locZ - entityliving.locZ;
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D) {
float f2 = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / 3.1415927410125732D));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setPositionRotation(entityliving.locX + d4, this.locY, entityliving.locZ + d5, f2, f3);
this.height = 0.0F;
float f4 = (float) d3 * 0.2F;
this.shoot(d0, d1 + (double) f4, d2, f, f1);
}
}
public EntityArrow(World world, EntityLiving entityliving, float f) {
super(world);
this.shooter = entityliving;
@ -80,8 +104,8 @@ public class EntityArrow extends Entity {
this.k = 0;
}
public void y_() {
super.y_();
public void G_() {
super.G_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@ -143,7 +167,7 @@ public class EntityArrow extends Entity {
for (k = 0; k < list.size(); ++k) {
Entity entity1 = (Entity) list.get(k);
if (entity1.e_() && (entity1 != this.shooter || this.l >= 5)) {
if (entity1.o_() && (entity1 != this.shooter || this.l >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
@ -200,7 +224,7 @@ public class EntityArrow extends Entity {
// CraftBukkit - entity.damageEntity -> event function
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleProjectileEvent(projectile, entity, damagesource, l)) {
if (movingobjectposition.entity instanceof EntityLiving) {
++((EntityLiving) movingobjectposition.entity).aJ;
++((EntityLiving) movingobjectposition.entity).aI;
if (this.n > 0) {
float f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@ -273,7 +297,7 @@ public class EntityArrow extends Entity {
float f4 = 0.99F;
f1 = 0.05F;
if (this.aK()) {
if (this.aT()) {
for (int i1 = 0; i1 < 4; ++i1) {
float f5 = 0.25F;
@ -345,11 +369,15 @@ public class EntityArrow extends Entity {
this.damage = d0;
}
public double j() {
public double k() {
return this.damage;
}
public void b(int i) {
this.n = i;
}
public boolean k_() {
return false;
}
}

View file

@ -26,15 +26,15 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.a(16, new Byte((byte) 0));
}
protected String c_() {
protected String i() {
return "mob.blaze.breathe";
}
protected String m() {
protected String j() {
return "mob.blaze.hit";
}
protected String n() {
protected String k() {
return "mob.blaze.death";
}
@ -46,13 +46,13 @@ public class EntityBlaze extends EntityMonster {
super.die(damagesource);
}
public float a(float f) {
public float b(float f) {
return 1.0F;
}
public void d() {
public void e() {
if (!this.world.isStatic) {
if (this.aJ()) {
if (this.aS()) {
this.damageEntity(DamageSource.DROWN, 1);
}
@ -62,7 +62,7 @@ public class EntityBlaze extends EntityMonster {
this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F;
}
if (this.F() != null && this.F().locY + (double) this.F().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) {
if (this.H() != null && this.H().locY + (double) this.H().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
}
}
@ -79,13 +79,13 @@ public class EntityBlaze extends EntityMonster {
this.world.a("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
}
super.d();
super.e();
}
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.d(entity);
this.a(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));
@ -123,7 +123,7 @@ public class EntityBlaze extends EntityMonster {
}
}
protected void b(float f) {}
protected void a(float f) {}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
@ -138,7 +138,7 @@ public class EntityBlaze extends EntityMonster {
}
public boolean isBurning() {
return this.B();
return this.A();
}
protected void dropDeathLoot(boolean flag, int i) {
@ -156,7 +156,7 @@ public class EntityBlaze extends EntityMonster {
}
}
public boolean B() {
public boolean A() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@ -172,7 +172,7 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
protected boolean z() {
protected boolean D() {
return true;
}
}

View file

@ -61,15 +61,15 @@ public class EntityBoat extends Entity {
this.datawatcher.a(19, new Integer(0));
}
public AxisAlignedBB a_(Entity entity) {
public AxisAlignedBB b_(Entity entity) {
return entity.boundingBox;
}
public AxisAlignedBB h_() {
public AxisAlignedBB h() {
return this.boundingBox;
}
public boolean f_() {
public boolean e_() {
return true;
}
@ -86,7 +86,7 @@ public class EntityBoat extends Entity {
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
public double q() {
public double x_() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@ -105,10 +105,10 @@ public class EntityBoat extends Entity {
// i = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
this.d(-this.l());
this.d(-this.m());
this.c(10);
this.setDamage(this.getDamage() + i * 10);
this.aM();
this.aV();
if (this.getDamage() > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
@ -143,11 +143,11 @@ public class EntityBoat extends Entity {
}
}
public boolean e_() {
public boolean o_() {
return !this.dead;
}
public void y_() {
public void G_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@ -156,9 +156,9 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
super.y_();
if (this.k() > 0) {
this.c(this.k() - 1);
super.G_();
if (this.l() > 0) {
this.c(this.l() - 1);
}
if (this.getDamage() > 0) {
@ -379,7 +379,7 @@ public class EntityBoat extends Entity {
for (l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l);
if (entity != this.passenger && entity.f_() && entity instanceof EntityBoat) {
if (entity != this.passenger && entity.e_() && entity instanceof EntityBoat) {
entity.collide(this);
}
}
@ -402,12 +402,12 @@ public class EntityBoat extends Entity {
}
}
public void i() {
public void i_() {
if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
this.passenger.setPosition(this.locX + d0, this.locY + this.q() + this.passenger.S(), this.locZ + d1);
this.passenger.setPosition(this.locX + d0, this.locY + this.x_() + this.passenger.V(), this.locZ + d1);
}
}
@ -439,7 +439,7 @@ public class EntityBoat extends Entity {
this.datawatcher.watch(17, Integer.valueOf(i));
}
public int k() {
public int l() {
return this.datawatcher.getInt(17);
}
@ -447,7 +447,7 @@ public class EntityBoat extends Entity {
this.datawatcher.watch(18, Integer.valueOf(i));
}
public int l() {
public int m() {
return this.datawatcher.getInt(18);
}
}

View file

@ -20,14 +20,28 @@ public class EntityChicken extends EntityAnimal {
this.texture = "/mob/chicken.png";
this.b(0.3F, 0.7F);
this.j = this.random.nextInt(6000) + 6000;
float f = 0.25F;
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.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 c_() {
return true;
}
public int getMaxHealth() {
return 4;
}
public void d() {
super.d();
public void e() {
super.e();
this.h = this.b;
this.g = this.c;
this.c = (float) ((double) this.c + (double) (this.onGround ? -1 : 4) * 0.3D);
@ -56,7 +70,7 @@ public class EntityChicken extends EntityAnimal {
}
}
protected void b(float f) {}
protected void a(float f) {}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
@ -66,15 +80,15 @@ public class EntityChicken extends EntityAnimal {
super.a(nbttagcompound);
}
protected String c_() {
protected String i() {
return "mob.chicken";
}
protected String m() {
protected String j() {
return "mob.chickenhurt";
}
protected String n() {
protected String k() {
return "mob.chickenhurt";
}
@ -101,7 +115,7 @@ public class EntityChicken extends EntityAnimal {
// CraftBukkit end
}
protected EntityAnimal createChild(EntityAnimal entityanimal) {
public EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityChicken(this.world);
}
}

View file

@ -15,6 +15,19 @@ public class EntityCow extends EntityAnimal {
super(world);
this.texture = "/mob/cow.png";
this.b(0.9F, 1.3F);
this.ak().a(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
this.goalSelector.a(2, new PathfinderGoalBreed(this, 0.2F));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.25F));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 0.2F));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
public boolean c_() {
return true;
}
public int getMaxHealth() {
@ -29,19 +42,19 @@ public class EntityCow extends EntityAnimal {
super.a(nbttagcompound);
}
protected String c_() {
protected String i() {
return "mob.cow";
}
protected String m() {
protected String j() {
return "mob.cowhurt";
}
protected String n() {
protected String k() {
return "mob.cowhurt";
}
protected float o() {
protected float p() {
return 0.4F;
}
@ -89,7 +102,7 @@ public class EntityCow extends EntityAnimal {
}
}
protected EntityAnimal createChild(EntityAnimal entityanimal) {
public EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityCow(this.world);
}
}

View file

@ -17,17 +17,17 @@ public abstract class EntityCreature extends EntityLiving {
super(world);
}
protected boolean v() {
protected boolean E() {
return false;
}
protected void m_() {
protected void d_() {
// MethodProfiler.a("ai"); // CraftBukkit - not in production code
if (this.f > 0) {
--this.f;
}
this.e = this.v();
this.e = this.E();
float f = 16.0F;
if (this.target == null) {
@ -48,7 +48,7 @@ public abstract class EntityCreature extends EntityLiving {
// CraftBukkit end
if (this.target != null) {
this.pathEntity = this.world.findPath(this, this.target, f);
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
}
} else if (!this.target.isAlive()) {
// CraftBukkit start
@ -64,9 +64,9 @@ public abstract class EntityCreature extends EntityLiving {
}
// CraftBukkit end
} else {
float f1 = this.target.h(this);
float f1 = this.target.i(this);
if (this.g(this.target)) {
if (this.h(this.target)) {
this.a(this.target, f1);
} else {
this.b(this.target, f1);
@ -75,19 +75,19 @@ public abstract class EntityCreature extends EntityLiving {
// MethodProfiler.a(); // CraftBukkit - not in production code
if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f);
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.f > 0) && this.aV < 100) {
this.D();
this.F();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
boolean flag = this.aK();
boolean flag1 = this.aL();
boolean flag = this.aT();
boolean flag1 = this.aU();
this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
// MethodProfiler.a("followpath"); // CraftBukkit - not in production code
Vec3D vec3d = this.pathEntity.a(this);
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) {
@ -96,7 +96,7 @@ public abstract class EntityCreature extends EntityLiving {
vec3d = null;
this.pathEntity = null;
} else {
vec3d = this.pathEntity.a(this);
vec3d = this.pathEntity.a((Entity) this);
}
}
@ -146,7 +146,7 @@ public abstract class EntityCreature extends EntityLiving {
this.a(this.target, 30.0F, 30.0F);
}
if (this.positionChanged && !this.E()) {
if (this.positionChanged && !this.G()) {
this.aZ = true;
}
@ -156,12 +156,12 @@ public abstract class EntityCreature extends EntityLiving {
// MethodProfiler.a(); // CraftBukkit - not in production code
} else {
super.m_();
super.d_();
this.pathEntity = null;
}
}
protected void D() {
protected void F() {
// MethodProfiler.a("stroll"); // CraftBukkit - not in production code
boolean flag = false;
int i = -1;
@ -185,7 +185,7 @@ public abstract class EntityCreature extends EntityLiving {
}
if (flag) {
this.pathEntity = this.world.a(this, i, j, k, 10.0F);
this.pathEntity = this.world.a(this, i, j, k, 10.0F, true, false, false, true);
}
// MethodProfiler.a(); // CraftBukkit - not in production code
@ -211,7 +211,7 @@ public abstract class EntityCreature extends EntityLiving {
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
}
public boolean E() {
public boolean G() {
return this.pathEntity != null;
}
@ -219,7 +219,7 @@ public abstract class EntityCreature extends EntityLiving {
this.pathEntity = pathentity;
}
public Entity F() {
public Entity H() {
return this.target;
}
@ -227,13 +227,17 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity;
}
protected float G() {
float f = super.G();
protected float D_() {
if (this.c_()) {
return 1.0F;
} else {
float f = super.D_();
if (this.f > 0) {
f *= 2.0F;
if (this.f > 0) {
f *= 2.0F;
}
return f;
}
return f;
}
}

View file

@ -10,6 +10,19 @@ public class EntityCreeper extends EntityMonster {
public EntityCreeper(World world) {
super(world);
this.texture = "/mob/creeper.png";
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalSwell(this));
this.goalSelector.a(3, new PathfinderGoalAvoidPlayer(this, EntityOcelot.class, 6.0F, 0.25F, 0.3F));
this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, 0.25F, false));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 0.2F));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, false));
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
public boolean c_() {
return true;
}
public int getMaxHealth() {
@ -34,22 +47,10 @@ public class EntityCreeper extends EntityMonster {
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0)));
}
protected void b(Entity entity, float f) {
if (!this.world.isStatic) {
if (this.fuseTicks > 0) {
this.b(-1);
--this.fuseTicks;
if (this.fuseTicks < 0) {
this.fuseTicks = 0;
}
}
}
}
public void y_() {
this.b = this.fuseTicks;
if (this.world.isStatic) {
int i = this.B();
public void G_() {
if (this.isAlive()) {
this.b = this.fuseTicks;
int i = this.A();
if (i > 0 && this.fuseTicks == 0) {
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
@ -62,24 +63,30 @@ public class EntityCreeper extends EntityMonster {
if (this.fuseTicks >= 30) {
this.fuseTicks = 30;
// CraftBukkit start
float radius = this.isPowered() ? 6.0F : 3.0F;
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.die();
} else {
this.fuseTicks = 0;
}
// CraftBukkit end
}
}
super.y_();
if (this.target == null && this.fuseTicks > 0) {
this.b(-1);
--this.fuseTicks;
if (this.fuseTicks < 0) {
this.fuseTicks = 0;
}
}
super.G_();
}
protected String m() {
protected String j() {
return "mob.creeper";
}
protected String n() {
protected String k() {
return "mob.creeperdeath";
}
@ -90,42 +97,8 @@ public class EntityCreeper extends EntityMonster {
}
}
protected void a(Entity entity, float f) {
if (!this.world.isStatic) {
int i = this.B();
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
this.b(-1);
--this.fuseTicks;
if (this.fuseTicks < 0) {
this.fuseTicks = 0;
}
} else {
if (this.fuseTicks == 0) {
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
}
this.b(1);
++this.fuseTicks;
if (this.fuseTicks >= 30) {
// CraftBukkit start
float radius = this.isPowered() ? 6.0F : 3.0F;
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.die();
} else {
this.fuseTicks = 0;
}
// CraftBukkit end
}
this.e = true;
}
}
public boolean a(Entity entity) {
return true;
}
public boolean isPowered() {
@ -136,11 +109,11 @@ public class EntityCreeper extends EntityMonster {
return Item.SULPHUR.id;
}
private int B() {
public int A() {
return this.datawatcher.getByte(16);
}
private void b(int i) {
public void c(int i) {
this.datawatcher.watch(16, Byte.valueOf((byte) i));
}

View file

@ -22,7 +22,7 @@ public class EntityEnderCrystal extends Entity {
this.datawatcher.a(8, Integer.valueOf(this.b));
}
public void y_() {
public void G_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@ -41,7 +41,7 @@ public class EntityEnderCrystal extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
public boolean e_() {
public boolean o_() {
return true;
}

View file

@ -88,7 +88,7 @@ public class EntityEnderDragon extends EntityComplex {
return adouble;
}
public void d() {
public void e() {
this.n = this.o;
if (!this.world.isStatic) {
this.datawatcher.watch(16, Integer.valueOf(this.health));
@ -104,7 +104,7 @@ public class EntityEnderDragon extends EntityComplex {
f1 = (this.random.nextFloat() - 0.5F) * 8.0F;
this.world.a("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) d05, this.locZ + (double) f1, 0.0D, 0.0D, 0.0D);
} else {
this.v();
this.A();
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motY);
if (this.q) {
@ -184,7 +184,7 @@ public class EntityEnderDragon extends EntityComplex {
}
if (this.p || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.bz) {
this.B();
this.E();
}
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
@ -280,14 +280,14 @@ public class EntityEnderDragon extends EntityComplex {
float f11 = MathHelper.sin(f10);
float f12 = MathHelper.cos(f10);
this.h.y_();
this.h.G_();
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
this.l.y_();
this.l.G_();
this.l.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
this.m.y_();
this.m.G_();
this.m.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
if (!this.world.isStatic) {
this.z();
this.D();
}
if (!this.world.isStatic && this.at == 0) {
@ -302,7 +302,7 @@ public class EntityEnderDragon extends EntityComplex {
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.aY * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.aY * 0.01F);
this.g.y_();
this.g.G_();
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f1), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f1), 0.0F, 0.0F);
for (int j = 0; j < 3; ++j) {
@ -327,7 +327,7 @@ public class EntityEnderDragon extends EntityComplex {
float f17 = 1.5F;
float f18 = (float) (j + 1) * 2.0F;
entitycomplexpart.y_();
entitycomplexpart.G_();
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);
}
@ -337,7 +337,7 @@ public class EntityEnderDragon extends EntityComplex {
}
}
private void v() {
private void A() {
if (this.s != null) {
if (this.s.dead) {
if (!this.world.isStatic) {
@ -366,7 +366,7 @@ public class EntityEnderDragon extends EntityComplex {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
double d1 = entity.i(this);
double d1 = entity.j(this);
if (d1 < d0) {
d0 = d1;
@ -378,14 +378,7 @@ public class EntityEnderDragon extends EntityComplex {
}
}
private void z() {
if (this.ticksLived % 20 == 0) {
Vec3D vec3d = this.e(1.0F);
double d0 = 0.0D;
double d1 = -1.0D;
double d2 = 0.0D;
}
}
private void D() {}
private void a(List list) {
double d0 = (this.h.boundingBox.a + this.h.boundingBox.d) / 2.0D;
@ -427,7 +420,7 @@ public class EntityEnderDragon extends EntityComplex {
}
}
private void B() {
private void E() {
this.p = false;
if (this.random.nextInt(2) == 0 && this.world.players.size() > 0) {
this.u = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
@ -542,7 +535,7 @@ public class EntityEnderDragon extends EntityComplex {
return true;
}
protected void an() {
protected void aA() {
++this.r;
if (this.r >= 180 && this.r <= 200) {
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
@ -586,54 +579,54 @@ public class EntityEnderDragon extends EntityComplex {
}
this.a(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
this.ay();
this.aG();
this.die();
}
}
private void a(int i, int j) {
int k = this.world.height / 2;
byte b0 = 64;
BlockEnderPortal.a = true;
byte b0 = 4;
byte b1 = 4;
// CraftBukkit start - Replace any "this.world" in the following with just "world"!
EntityCreatePortalEvent event = new EntityCreatePortalEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), new ArrayList<BlockState>(), PortalType.ENDER);
BlockStateListPopulator world = new BlockStateListPopulator(this.world.getWorld(), event.getBlocks());
for (int l = k - 1; l <= k + 32; ++l) {
for (int i1 = i - b0; i1 <= i + b0; ++i1) {
for (int j1 = j - b0; j1 <= j + b0; ++j1) {
double d0 = (double) (i1 - i);
double d1 = (double) (j1 - j);
for (int k = b0 - 1; k <= b0 + 32; ++k) {
for (int l = i - b1; l <= i + b1; ++l) {
for (int i1 = j - b1; i1 <= j + b1; ++i1) {
double d0 = (double) (l - i);
double d1 = (double) (i1 - j);
double d2 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
if (d2 <= (double) b0 - 0.5D) {
if (l < k) {
if (d2 <= (double) (b0 - 1) - 0.5D) {
world.setTypeId(i1, l, j1, Block.BEDROCK.id);
if (d2 <= (double) b1 - 0.5D) {
if (k < b0) {
if (d2 <= (double) (b1 - 1) - 0.5D) {
this.world.setTypeId(l, k, i1, Block.BEDROCK.id);
}
} else if (l > k) {
world.setTypeId(i1, l, j1, 0);
} else if (d2 > (double) (b0 - 1) - 0.5D) {
world.setTypeId(i1, l, j1, Block.BEDROCK.id);
} else if (k > b0) {
this.world.setTypeId(l, k, i1, 0);
} else if (d2 > (double) (b1 - 1) - 0.5D) {
this.world.setTypeId(l, k, i1, Block.BEDROCK.id);
} else {
world.setTypeId(i1, l, j1, Block.ENDER_PORTAL.id);
this.world.setTypeId(l, k, i1, Block.ENDER_PORTAL.id);
}
}
}
}
}
world.setTypeId(i, k + 0, j, Block.BEDROCK.id);
world.setTypeId(i, k + 1, j, Block.BEDROCK.id);
world.setTypeId(i, k + 2, j, Block.BEDROCK.id);
world.setTypeId(i - 1, k + 2, j, Block.TORCH.id);
world.setTypeId(i + 1, k + 2, j, Block.TORCH.id);
world.setTypeId(i, k + 2, j - 1, Block.TORCH.id);
world.setTypeId(i, k + 2, j + 1, Block.TORCH.id);
world.setTypeId(i, k + 3, j, Block.BEDROCK.id);
world.setTypeId(i, k + 4, j, Block.DRAGON_EGG.id);
this.world.setTypeId(i, b0 + 0, j, Block.BEDROCK.id);
this.world.setTypeId(i, b0 + 1, j, Block.BEDROCK.id);
this.world.setTypeId(i, b0 + 2, j, Block.BEDROCK.id);
this.world.setTypeId(i - 1, b0 + 2, j, Block.TORCH.id);
this.world.setTypeId(i + 1, b0 + 2, j, Block.TORCH.id);
this.world.setTypeId(i, b0 + 2, j - 1, Block.TORCH.id);
this.world.setTypeId(i, b0 + 2, j + 1, Block.TORCH.id);
this.world.setTypeId(i, b0 + 3, j, Block.BEDROCK.id);
this.world.setTypeId(i, b0 + 4, j, Block.DRAGON_EGG.id);
this.world.getServer().getPluginManager().callEvent(event);
@ -647,13 +640,13 @@ public class EntityEnderDragon extends EntityComplex {
BlockEnderPortal.a = false;
}
protected void au() {}
protected void aF() {}
public Entity[] aR() {
public Entity[] ba() {
return this.children;
}
public boolean e_() {
public boolean o_() {
return false;
}

View file

@ -63,8 +63,8 @@ public class EntityEnderman extends EntityMonster {
return null;
}
public float a(float f) {
return super.a(f);
public float b(float f) {
return super.b(f);
}
private boolean c(EntityHuman entityhuman) {
@ -73,19 +73,19 @@ public class EntityEnderman extends EntityMonster {
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
return false;
} else {
Vec3D vec3d = entityhuman.e(1.0F).b();
Vec3D vec3d = entityhuman.f(1.0F).b();
Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
double d0 = vec3d1.c();
vec3d1 = vec3d1.b();
double d1 = vec3d.a(vec3d1);
return d1 > 1.0D - 0.025D / d0 ? entityhuman.g(this) : false;
return d1 > 1.0D - 0.025D / d0 ? entityhuman.h(this) : false;
}
}
public void d() {
if (this.aJ()) {
public void e() {
if (this.aS()) {
this.damageEntity(DamageSource.DROWN, 1);
}
@ -139,17 +139,17 @@ public class EntityEnderman extends EntityMonster {
}
if (this.world.e() && !this.world.isStatic) {
float f = this.a(1.0F);
float f = this.b(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
this.target = null;
this.w_();
this.x();
}
}
if (this.aJ()) {
if (this.aS()) {
this.target = null;
this.w_();
this.x();
}
this.aZ = false;
@ -162,12 +162,12 @@ public class EntityEnderman extends EntityMonster {
if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) {
this.aW = this.aX = 0.0F;
this.bb = 0.0F;
if (this.target.i(this) < 16.0D) {
this.w_();
if (this.target.j(this) < 16.0D) {
this.x();
}
this.g = 0;
} else if (this.target.i(this) > 256.0D && this.g++ >= 30 && this.f(this.target)) {
} else if (this.target.j(this) > 256.0D && this.g++ >= 30 && this.e(this.target)) {
this.g = 0;
}
} else {
@ -175,10 +175,10 @@ public class EntityEnderman extends EntityMonster {
}
}
super.d();
super.e();
}
protected boolean w_() {
protected boolean x() {
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;
@ -186,7 +186,7 @@ public class EntityEnderman extends EntityMonster {
return this.b(d0, d1, d2);
}
protected boolean f(Entity entity) {
protected boolean e(Entity entity) {
Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
vec3d = vec3d.b();
@ -267,15 +267,15 @@ public class EntityEnderman extends EntityMonster {
}
}
protected String c_() {
protected String i() {
return "mob.endermen.idle";
}
protected String m() {
protected String j() {
return "mob.endermen.hit";
}
protected String n() {
protected String k() {
return "mob.endermen.death";
}
@ -319,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.w_()) {
if (this.x()) {
return true;
}
}

View file

@ -34,8 +34,8 @@ public class EntityExperienceOrb extends Entity {
protected void b() {}
public void y_() {
super.y_();
public void G_() {
super.G_();
if (this.c > 0) {
--this.c;
}
@ -102,7 +102,7 @@ public class EntityExperienceOrb extends Entity {
}
}
public boolean i_() {
public boolean h_() {
return this.world.a(this.boundingBox, Material.WATER, this);
}
@ -111,7 +111,7 @@ public class EntityExperienceOrb extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aM();
this.aV();
this.d -= i;
if (this.d <= 0) {
this.die();
@ -144,7 +144,7 @@ public class EntityExperienceOrb extends Entity {
}
}
public int g() {
public int y_() {
return this.value;
}
@ -170,4 +170,8 @@ public class EntityExperienceOrb extends Entity {
return i >= 2477 ? 2477 : (i >= 1237 ? 1237 : (i >= 617 ? 617 : (i >= 307 ? 307 : (i >= 149 ? 149 : (i >= 73 ? 73 : (i >= 37 ? 37 : (i >= 17 ? 17 : (i >= 7 ? 7 : (i >= 3 ? 3 : 1)))))))));
}
public boolean k_() {
return false;
}
}

View file

@ -33,11 +33,11 @@ public class EntityFallingBlock extends Entity {
protected void b() {}
public boolean e_() {
public boolean o_() {
return !this.dead;
}
public void y_() {
public void G_() {
if (this.id == 0) {
this.die();
} else {
@ -71,7 +71,7 @@ public class EntityFallingBlock extends Entity {
this.b(this.id, 1);
}
}
} else if (this.b > 100 && !this.world.isStatic) {
} else if (this.b > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.b > 600) {
this.b(this.id, 1);
this.die();
}

View file

@ -34,6 +34,18 @@ public class EntityFireball extends Entity {
protected void b() {}
public EntityFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
super(world);
this.b(1.0F, 1.0F);
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
this.setPosition(d0, d1, d2);
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
this.dirX = d3 / d6 * 0.1D;
this.dirY = d4 / d6 * 0.1D;
this.dirZ = d5 / d6 * 0.1D;
}
public EntityFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
super(world);
this.shooter = entityliving;
@ -58,121 +70,121 @@ public class EntityFireball extends Entity {
this.dirZ = d2 / d3 * 0.1D;
}
public void y_() {
super.y_();
this.setOnFire(1);
if (!this.world.isStatic && (this.shooter == null || this.shooter.dead)) {
public void G_() {
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.G_();
this.setOnFire(1);
if (this.i) {
int i = this.world.getTypeId(this.e, this.f, this.g);
if (this.i) {
int i = this.world.getTypeId(this.e, this.f, this.g);
if (i == this.h) {
++this.j;
if (this.j == 600) {
this.die();
}
if (i == this.h) {
++this.j;
if (this.j == 1200) {
this.die();
return;
}
return;
this.i = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
this.k = 0;
} else {
++this.k;
}
this.i = false;
this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
this.k = 0;
} else {
++this.k;
}
Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.a(vec3d, vec3d1);
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
}
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
}
Entity entity = null;
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
Entity entity = null;
List list = this.world.getEntities(this, this.boundingBox.a(this.motX, this.motY, this.motZ).grow(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.o_() && (!entity1.a_((Entity) this.shooter) || this.k >= 25)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (entity1.e_() && (!entity1.a((Entity) this.shooter) || this.k >= 25)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) {
double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
if (movingobjectposition1 != null) {
double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
if (d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
}
}
}
}
}
if (entity != null) {
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null) {
this.a(movingobjectposition);
}
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
;
}
while (this.pitch - this.lastPitch >= 180.0F) {
this.lastPitch += 360.0F;
}
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
while (this.yaw - this.lastYaw >= 180.0F) {
this.lastYaw += 360.0F;
}
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F;
if (this.aK()) {
for (int k = 0; k < 4; ++k) {
float f3 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
if (entity != null) {
movingobjectposition = new MovingObjectPosition(entity);
}
f2 = 0.8F;
}
if (movingobjectposition != null) {
this.a(movingobjectposition);
}
this.motX += this.dirX;
this.motY += this.dirY;
this.motZ += this.dirZ;
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
this.setPosition(this.locX, this.locY, this.locZ);
this.locX += this.motX;
this.locY += this.motY;
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);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f1) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {
;
}
while (this.pitch - this.lastPitch >= 180.0F) {
this.lastPitch += 360.0F;
}
while (this.yaw - this.lastYaw < -180.0F) {
this.lastYaw -= 360.0F;
}
while (this.yaw - this.lastYaw >= 180.0F) {
this.lastYaw += 360.0F;
}
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F;
if (this.aT()) {
for (int k = 0; k < 4; ++k) {
float f3 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
}
f2 = 0.8F;
}
this.motX += this.dirX;
this.motY += this.dirY;
this.motZ += this.dirZ;
this.motX *= (double) f2;
this.motY *= (double) f2;
this.motZ *= (double) f2;
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
this.setPosition(this.locX, this.locY, this.locZ);
}
}
protected void a(MovingObjectPosition movingobjectposition) {
@ -221,7 +233,7 @@ public class EntityFireball extends Entity {
this.i = nbttagcompound.getByte("inGround") == 1;
}
public boolean e_() {
public boolean o_() {
return true;
}
@ -230,9 +242,9 @@ public class EntityFireball extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aM();
this.aV();
if (damagesource.getEntity() != null) {
Vec3D vec3d = damagesource.getEntity().aA();
Vec3D vec3d = damagesource.getEntity().aI();
if (vec3d != null) {
this.motX = vec3d.a;
@ -253,7 +265,7 @@ public class EntityFireball extends Entity {
}
}
public float a(float f) {
public float b(float f) {
return 1.0F;
}
}

View file

@ -74,8 +74,8 @@ public class EntityFishingHook extends Entity {
this.i = 0;
}
public void y_() {
super.y_();
public void G_() {
super.G_();
if (this.l > 0) {
double d0 = this.locX + (this.m - this.locX) / (double) this.l;
double d1 = this.locY + (this.n - this.locY) / (double) this.l;
@ -98,9 +98,9 @@ public class EntityFishingHook extends Entity {
this.c(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
ItemStack itemstack = this.owner.Q();
ItemStack itemstack = this.owner.T();
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.i(this.owner) > 1024.0D) {
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.j(this.owner) > 1024.0D) {
this.die();
this.owner.hookedFish = null;
return;
@ -163,7 +163,7 @@ public class EntityFishingHook extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.e_() && (entity1 != this.owner || this.j >= 5)) {
if (entity1.o_() && (entity1 != this.owner || this.j >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -242,7 +242,7 @@ public class EntityFishingHook extends Entity {
} else {
short short1 = 500;
if (this.world.v(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
if (this.world.y(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
short1 = 300;
}
@ -308,7 +308,7 @@ public class EntityFishingHook extends Entity {
this.h = nbttagcompound.getByte("inGround") == 1;
}
public int j() {
public int k() {
byte b0 = 0;
if (this.hooked != null) {

View file

@ -46,19 +46,19 @@ public class EntityGhast extends EntityFlying implements IMonster {
return 10;
}
public void y_() {
super.y_();
public void G_() {
super.G_();
byte b0 = this.datawatcher.getByte(16);
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
}
protected void m_() {
protected void d_() {
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
this.au();
this.aF();
this.e = this.f;
double d0 = this.b - this.locX;
double d1 = this.c - this.locY;
@ -122,13 +122,13 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d4 = 64.0D;
if (this.target != null && this.target.i(this) < d4 * d4) {
if (this.target != null && this.target.j(this) < d4 * d4) {
double d5 = this.target.locX - this.locX;
double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
double d7 = this.target.locZ - this.locZ;
this.V = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
if (this.g(this.target)) {
if (this.h(this.target)) {
if (this.f == 10) {
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
@ -138,7 +138,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7);
double d8 = 4.0D;
Vec3D vec3d = this.e(1.0F);
Vec3D vec3d = this.f(1.0F);
entityfireball.locX = this.locX + vec3d.a * d8;
entityfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
@ -182,15 +182,15 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true;
}
protected String c_() {
protected String i() {
return "mob.ghast.moan";
}
protected String m() {
protected String j() {
return "mob.ghast.scream";
}
protected String n() {
protected String k() {
return "mob.ghast.death";
}
@ -219,7 +219,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
// CraftBukkit end
}
protected float o() {
protected float p() {
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 p() {
public int q() {
return 1;
}
}

View file

@ -96,43 +96,43 @@ public abstract class EntityHuman extends EntityLiving {
this.datawatcher.a(17, Byte.valueOf((byte) 0));
}
public boolean I() {
public boolean L() {
return this.d != null;
}
public void J() {
public void M() {
if (this.d != null) {
this.d.a(this.world, this, this.e);
this.d.b(this.world, this, this.e);
}
this.K();
this.N();
}
public void K() {
public void N() {
this.d = null;
this.e = 0;
if (!this.world.isStatic) {
this.h(false);
this.i(false);
}
}
public boolean L() {
return this.I() && Item.byId[this.d.id].d(this.d) == EnumAnimation.d;
public boolean O() {
return this.L() && Item.byId[this.d.id].d(this.d) == EnumAnimation.d;
}
public void y_() {
public void G_() {
if (this.d != null) {
ItemStack itemstack = this.inventory.getItemInHand();
if (itemstack != this.d) {
this.K();
this.N();
} else {
if (this.e <= 25 && this.e % 4 == 0) {
this.b(itemstack, 5);
}
if (--this.e == 0 && !this.world.isStatic) {
this.H();
this.K();
}
}
}
@ -148,7 +148,7 @@ public abstract class EntityHuman extends EntityLiving {
}
if (!this.world.isStatic) {
if (!this.B()) {
if (!this.G()) {
this.a(true, true, false);
} else if (this.world.e()) {
this.a(false, true, true);
@ -161,7 +161,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
super.y_();
super.G_();
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.b(this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
@ -245,7 +245,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
protected void H() {
protected void K() {
if (this.d != null) {
this.b(this.d, 16);
int i = this.d.count;
@ -258,11 +258,11 @@ public abstract class EntityHuman extends EntityLiving {
}
}
this.K();
this.N();
}
}
protected boolean M() {
protected boolean P() {
return this.getHealth() <= 0 || this.isSleeping();
}
@ -271,23 +271,23 @@ public abstract class EntityHuman extends EntityLiving {
this.activeContainer = this.defaultContainer;
}
public void N() {
public void Q() {
double d0 = this.locX;
double d1 = this.locY;
double d2 = this.locZ;
super.N();
super.Q();
this.r = this.s;
this.s = 0.0F;
this.h(this.locX - d0, this.locY - d1, this.locZ - d2);
}
private int v() {
private int E() {
return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6);
}
protected void m_() {
int i = this.v();
protected void d_() {
int i = this.E();
if (this.t) {
++this.u;
@ -302,7 +302,7 @@ public abstract class EntityHuman extends EntityLiving {
this.ao = (float) this.u / (float) i;
}
public void d() {
public void e() {
if (this.o > 0) {
--this.o;
}
@ -314,7 +314,7 @@ public abstract class EntityHuman extends EntityLiving {
this.inventory.i();
this.r = this.s;
super.d();
super.e();
this.al = this.P;
this.am = this.Q;
if (this.isSprinting()) {
@ -348,14 +348,14 @@ public abstract class EntityHuman extends EntityLiving {
Entity entity = (Entity) list.get(i);
if (!entity.dead) {
this.k(entity);
this.l(entity);
}
}
}
}
}
private void k(Entity entity) {
private void l(Entity entity) {
entity.a_(this);
}
@ -389,22 +389,24 @@ public abstract class EntityHuman extends EntityLiving {
}
}
protected int f(int i) {
protected int b_(int i) {
int j = EnchantmentManager.getOxygenEnchantmentLevel(this.inventory);
return j > 0 && this.random.nextInt(j + 1) > 0 ? i : super.f(i);
return j > 0 && this.random.nextInt(j + 1) > 0 ? i : super.b_(i);
}
public void O() {
this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
public EntityItem R() {
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
}
public void drop(ItemStack itemstack) {
this.a(itemstack, false);
public EntityItem drop(ItemStack itemstack) {
return this.a(itemstack, false);
}
public void a(ItemStack itemstack, boolean flag) {
if (itemstack != null) {
public EntityItem a(ItemStack itemstack, boolean flag) {
if (itemstack == null) {
return null;
} else {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.getHeadHeight(), this.locZ, itemstack);
entityitem.pickupDelay = 40;
@ -440,12 +442,13 @@ public abstract class EntityHuman extends EntityLiving {
if (event.isCancelled()) {
player.getInventory().addItem(drop.getItemStack());
return;
return null;
}
// CraftBukkit end
this.a(entityitem);
this.a(StatisticList.v, 1);
return entityitem;
}
}
@ -548,7 +551,7 @@ public abstract class EntityHuman extends EntityLiving {
return 0.12F;
}
protected void r_() {
protected void A() {
this.height = 1.62F;
}
@ -645,7 +648,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
protected boolean z() {
protected boolean C_() {
return false;
}
@ -659,7 +662,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
if (!(entityliving instanceof EntityHuman) || this.z()) {
if (!(entityliving instanceof EntityHuman) || this.C_()) {
List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
Iterator iterator = list.iterator();
@ -667,7 +670,7 @@ public abstract class EntityHuman extends EntityLiving {
Entity entity = (Entity) iterator.next();
EntityWolf entitywolf1 = (EntityWolf) entity;
if (entitywolf1.isTamed() && entitywolf1.F() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
if (entitywolf1.isTamed() && entitywolf1.H() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entityliving.getBukkitEntity();
@ -692,16 +695,16 @@ public abstract class EntityHuman extends EntityLiving {
}
}
protected void g(int i) {
this.inventory.d(i);
protected void f(int i) {
this.inventory.e(i);
}
public int P() {
public int S() {
return this.inventory.j();
}
protected void c(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor() && this.L()) {
if (!damagesource.ignoresArmor() && this.O()) {
i = 1 + i >> 1;
}
@ -721,146 +724,150 @@ public abstract class EntityHuman extends EntityLiving {
public void e(Entity entity) {
if (!entity.b(this)) {
ItemStack itemstack = this.Q();
ItemStack itemstack = this.T();
if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
itemstack.a(this);
this.R();
this.U();
}
}
}
}
public ItemStack Q() {
public ItemStack T() {
return this.inventory.getItemInHand();
}
public void R() {
public void U() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
public double S() {
public double V() {
return (double) (this.height - 0.5F);
}
public void s_() {
if (!this.t || this.u >= this.v() / 2 || this.u < 0) {
public void D() {
if (!this.t || this.u >= this.E() / 2 || this.u < 0) {
this.u = -1;
this.t = true;
}
}
public void attack(Entity entity) {
int i = this.inventory.a(entity);
if (entity.k_()) {
int i = this.inventory.a(entity);
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
}
if (this.hasEffect(MobEffectList.WEAKNESS)) {
i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
}
int j = 0;
int k = 0;
if (entity instanceof EntityLiving) {
k = EnchantmentManager.a(this.inventory, (EntityLiving) entity);
j += EnchantmentManager.getKnockbackEnchantmentLevel(this.inventory, (EntityLiving) entity);
}
if (this.isSprinting()) {
++j;
}
if (i > 0 || k > 0) {
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.r() && !this.aK() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag) {
i += this.random.nextInt(i / 2 + 2);
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
}
// CraftBukkit start - Don't call the event when the entity is human since it will be called with damageEntity
if ((entity instanceof EntityLiving || entity instanceof EntityComplexPart || entity instanceof EntityEnderCrystal) && !(entity instanceof EntityHuman)) {
org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, i);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled() || event.getDamage() == 0) {
return;
}
i = event.getDamage();
}
// CraftBukkit end
i += k;
boolean flag1 = entity.damageEntity(DamageSource.playerAttack(this), i);
// CraftBukkit start - Return when the damage fails so that the item will not lose durability
if (!flag1) {
return;
}
// CraftBukkit end
if (flag1) {
if (j > 0) {
entity.b_((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
this.motX *= 0.6D;
this.motZ *= 0.6D;
this.setSprinting(false);
}
if (flag) {
this.c(entity);
}
if (k > 0) {
this.d(entity);
}
if (i >= 18) {
this.a((Statistic) AchievementList.E);
}
if (this.hasEffect(MobEffectList.WEAKNESS)) {
i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
}
ItemStack itemstack = this.Q();
if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
itemstack.a(this);
this.R();
}
}
int j = 0;
int k = 0;
if (entity instanceof EntityLiving) {
if (entity.isAlive()) {
this.a((EntityLiving) entity, true);
}
this.a(StatisticList.w, i);
int l = EnchantmentManager.getFireAspectEnchantmentLevel(this.inventory, (EntityLiving) entity);
if (l > 0) {
// CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4);
Bukkit.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) {
entity.setOnFire(combustEvent.getDuration());
}
// CraftBukkit end
}
k = EnchantmentManager.a(this.inventory, (EntityLiving) entity);
j += EnchantmentManager.getKnockbackEnchantmentLevel(this.inventory, (EntityLiving) entity);
}
this.c(0.3F);
if (this.isSprinting()) {
++j;
}
if (i > 0 || k > 0) {
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.t() && !this.aT() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag) {
i += this.random.nextInt(i / 2 + 2);
}
// CraftBukkit start - Don't call the event when the entity is human since it will be called with damageEntity
if ((entity instanceof EntityLiving || entity instanceof EntityComplexPart || entity instanceof EntityEnderCrystal) && !(entity instanceof EntityHuman)) {
org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, i);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled() || event.getDamage() == 0) {
return;
}
i = event.getDamage();
}
// CraftBukkit end
i += k;
boolean flag1 = entity.damageEntity(DamageSource.playerAttack(this), i);
// CraftBukkit start - Return when the damage fails so that the item will not lose durability
if (!flag1) {
return;
}
// CraftBukkit end
if (flag1) {
if (j > 0) {
entity.b_((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
this.motX *= 0.6D;
this.motZ *= 0.6D;
this.setSprinting(false);
}
if (flag) {
this.c(entity);
}
if (k > 0) {
this.d(entity);
}
if (i >= 18) {
this.a((Statistic) AchievementList.E);
}
this.g(entity);
}
ItemStack itemstack = this.T();
if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
itemstack.a(this);
this.U();
}
}
if (entity instanceof EntityLiving) {
if (entity.isAlive()) {
this.a((EntityLiving) entity, true);
}
this.a(StatisticList.w, i);
int l = EnchantmentManager.getFireAspectEnchantmentLevel(this.inventory, (EntityLiving) entity);
if (l > 0) {
// CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4);
Bukkit.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) {
entity.setOnFire(combustEvent.getDuration());
}
// CraftBukkit end
}
}
this.c(0.3F);
}
}
}
@ -888,7 +895,7 @@ public abstract class EntityHuman extends EntityLiving {
return EnumBedResult.OTHER_PROBLEM;
}
if (this.world.worldProvider.d) {
if (!this.world.worldProvider.d()) {
return EnumBedResult.NOT_POSSIBLE_HERE;
}
@ -927,7 +934,7 @@ public abstract class EntityHuman extends EntityLiving {
this.height = 0.2F;
if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
int i1 = BlockBed.d(l);
int i1 = BlockBed.b(l);
float f = 0.5F;
float f1 = 0.5F;
@ -990,7 +997,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
this.b(0.6F, 1.8F);
this.r_();
this.A();
ChunkCoordinates chunkcoordinates = this.F;
ChunkCoordinates chunkcoordinates1 = this.F;
@ -1036,12 +1043,12 @@ public abstract class EntityHuman extends EntityLiving {
}
}
private boolean B() {
private boolean G() {
return this.world.getTypeId(this.F.x, this.F.y, this.F.z) == Block.BED.id;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates) {
IChunkProvider ichunkprovider = world.p();
IChunkProvider ichunkprovider = world.q();
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
@ -1085,8 +1092,8 @@ public abstract class EntityHuman extends EntityLiving {
public void a(Statistic statistic, int i) {}
protected void o_() {
super.o_();
protected void ab() {
super.ab();
this.a(StatisticList.u, 1);
if (this.isSprinting()) {
this.c(0.8F);
@ -1125,13 +1132,13 @@ public abstract class EntityHuman extends EntityLiving {
this.a(StatisticList.q, i);
this.c(0.015F * (float) i * 0.01F);
}
} else if (this.aK()) {
} else if (this.aT()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
this.c(0.015F * (float) i * 0.01F);
}
} else if (this.r()) {
} else if (this.t()) {
if (d1 > 0.0D) {
this.a(StatisticList.o, (int) Math.round(d1 * 100.0D));
}
@ -1163,7 +1170,7 @@ public abstract class EntityHuman extends EntityLiving {
this.a(StatisticList.r, i);
if (this.c == null) {
this.c = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
} else if (this.c.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000.0D) {
} else if (this.c.b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000.0D) {
this.a((Statistic) AchievementList.q, 1);
}
} else if (this.vehicle instanceof EntityBoat) {
@ -1175,23 +1182,23 @@ public abstract class EntityHuman extends EntityLiving {
}
}
protected void b(float f) {
protected void a(float f) {
if (!this.abilities.canFly) {
if (f >= 2.0F) {
this.a(StatisticList.n, (int) Math.round((double) f * 100.0D));
}
super.b(f);
super.a(f);
}
}
public void a(EntityLiving entityliving) {
public void c(EntityLiving entityliving) {
if (entityliving instanceof EntityMonster) {
this.a((Statistic) AchievementList.s);
}
}
public void Y() {
public void ac() {
if (this.I > 0) {
this.I = 10;
} else {
@ -1246,7 +1253,7 @@ public abstract class EntityHuman extends EntityLiving {
return (flag || this.foodData.b()) && !this.abilities.isInvulnerable;
}
public boolean ab() {
public boolean af() {
return this.getHealth() > 0 && this.getHealth() < this.getMaxHealth();
}
@ -1255,7 +1262,7 @@ public abstract class EntityHuman extends EntityLiving {
this.d = itemstack;
this.e = i;
if (!this.world.isStatic) {
this.h(true);
this.i(true);
}
}
}
@ -1289,4 +1296,8 @@ public abstract class EntityHuman extends EntityLiving {
this.exp = entityhuman.exp;
this.q = entityhuman.q;
}
protected boolean g_() {
return !this.abilities.isFlying;
}
}

View file

@ -8,10 +8,9 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
public class EntityItem extends Entity {
public ItemStack itemStack;
private int e;
public int age = 0;
public int pickupDelay;
private int f = 5;
private int e = 5;
public float d = (float) (Math.random() * 3.141592653589793D * 2.0D);
private int lastTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
@ -47,8 +46,8 @@ public class EntityItem extends Entity {
protected void b() {}
public void y_() {
super.y_();
public void G_() {
super.G_();
// CraftBukkit start
int currentTick = (int) (System.currentTimeMillis() / 50);
this.pickupDelay -= (currentTick - this.lastTick);
@ -86,7 +85,6 @@ public class EntityItem extends Entity {
this.motY *= -0.5D;
}
++this.e;
++this.age;
if (this.age >= 6000) {
// CraftBukkit start
@ -99,7 +97,11 @@ public class EntityItem extends Entity {
}
}
public boolean i_() {
public void k() {
this.age = 4800;
}
public boolean h_() {
return this.world.a(this.boundingBox, Material.WATER, this);
}
@ -108,9 +110,9 @@ public class EntityItem extends Entity {
}
public boolean damageEntity(DamageSource damagesource, int i) {
this.aM();
this.f -= i;
if (this.f <= 0) {
this.aV();
this.e -= i;
if (this.e <= 0) {
this.die();
}
@ -118,14 +120,14 @@ public class EntityItem extends Entity {
}
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Health", (short) ((byte) this.f));
nbttagcompound.setShort("Health", (short) ((byte) this.e));
nbttagcompound.setShort("Age", (short) this.age);
if (this.itemStack != null) // CraftBukkit - Nullchex!
nbttagcompound.setCompound("Item", this.itemStack.save(new NBTTagCompound()));
}
public void a(NBTTagCompound nbttagcompound) {
this.f = nbttagcompound.getShort("Health") & 255;
this.e = nbttagcompound.getShort("Health") & 255;
this.age = nbttagcompound.getShort("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
@ -187,4 +189,8 @@ public class EntityItem extends Entity {
if (this.itemStack == null) return LocaleI18n.get("item.unknown"); // CraftBukkit - nullcheck
return LocaleI18n.get("item." + this.itemStack.k());
}
public boolean k_() {
return false;
}
}

View file

@ -60,17 +60,26 @@ public abstract class EntityLiving extends Entity {
public float aF;
public EntityHuman killer = null; // CraftBukkit - prot to pub
protected int lastDamageByPlayerTime = 0;
protected EntityLiving lastDamager = null;
public EntityLiving lastDamager = null; // CraftBukkit - priv to pub
private int c = 0;
private EntityLiving d = null;
public int aI = 0;
public int aJ = 0;
public int aK = 0;
public HashMap effects = new HashMap(); // CraftBukkit - protected -> public
private boolean b = true;
private int c;
private boolean e = true;
private int f;
private ControllerLook lookController;
private ControllerMove moveController;
private ControllerJump jumpController;
private EntityAIBodyControl senses;
private Navigation navigation;
protected PathfinderGoalSelector goalSelector = new PathfinderGoalSelector();
protected PathfinderGoalSelector targetSelector = new PathfinderGoalSelector();
private EntityLiving l;
private EntitySenses m;
private float n;
private ChunkCoordinates o = new ChunkCoordinates(0, 0, 0);
private float p = -1.0F;
protected int aN;
protected double aO;
protected double aP;
@ -86,8 +95,8 @@ public abstract class EntityLiving extends Entity {
protected boolean aZ = false;
protected float ba = 0.0F;
protected float bb = 0.7F;
private int h = 0;
private Entity i;
private int q = 0;
private Entity r;
protected int bc = 0;
public int expToDrop = 0; // CraftBukkit
public int maxAirTicks = 300; // CraftBukkit
@ -96,9 +105,11 @@ public abstract class EntityLiving extends Entity {
super(world);
this.bf = true;
this.lookController = new ControllerLook(this);
this.moveController = new ControllerMove(this, this.bb);
this.moveController = new ControllerMove(this);
this.jumpController = new ControllerJump(this);
this.navigation = new PathfinderNavigation(this, world);
this.senses = new EntityAIBodyControl(this);
this.navigation = new Navigation(this, world, 16.0F);
this.m = new EntitySenses(this);
this.U = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
this.T = (float) Math.random() * 12398.0F;
@ -119,35 +130,115 @@ public abstract class EntityLiving extends Entity {
return this.jumpController;
}
public Navigation ah() {
public Navigation ak() {
return this.navigation;
}
public Random ai() {
public EntitySenses al() {
return this.m;
}
public Random am() {
return this.random;
}
public EntityLiving aj() {
public EntityLiving an() {
return this.lastDamager;
}
public int ak() {
public EntityLiving ao() {
return this.d;
}
public void g(Entity entity) {
if (entity instanceof EntityLiving) {
this.d = (EntityLiving) entity;
}
}
public int ap() {
return this.aV;
}
protected void b() {
this.datawatcher.a(8, Integer.valueOf(this.c));
public float aq() {
return this.X;
}
public boolean g(Entity entity) {
public float ar() {
return this.n;
}
public void d(float f) {
this.n = f;
this.e(f);
}
public boolean a(Entity entity) {
this.g(entity);
return false;
}
public EntityLiving as() {
return this.l;
}
public void b(EntityLiving entityliving) {
this.l = entityliving;
}
public boolean a(Class oclass) {
return EntityCreeper.class != oclass && EntityGhast.class != oclass;
}
public void z() {}
public boolean at() {
return this.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
public boolean e(int i, int j, int k) {
return this.p == -1.0F ? true : this.o.c(i, j, k) < this.p * this.p;
}
public void b(int i, int j, int k, int l) {
this.o.a(i, j, k);
this.p = (float) l;
}
public ChunkCoordinates au() {
return this.o;
}
public float av() {
return this.p;
}
public void aw() {
this.p = -1.0F;
}
public boolean ax() {
return this.p != -1.0F;
}
public void a(EntityLiving entityliving) {
this.lastDamager = entityliving;
this.c = this.lastDamager != null ? 60 : 0;
}
protected void b() {
this.datawatcher.a(8, Integer.valueOf(this.f));
}
public boolean h(Entity entity) {
return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
}
public boolean e_() {
public boolean o_() {
return !this.dead;
}
public boolean f_() {
public boolean e_() {
return !this.dead;
}
@ -155,25 +246,25 @@ public abstract class EntityLiving extends Entity {
return this.length * 0.85F;
}
public int h() {
public int m() {
return 80;
}
public void al() {
String s = this.c_();
public void ay() {
String s = this.i();
if (s != null) {
this.world.makeSound(this, s, this.o(), this.v());
this.world.makeSound(this, s, this.p(), this.A());
}
}
public void am() {
public void az() {
this.an = this.ao;
super.am();
super.az();
// MethodProfiler.a("mobBaseTick"); // CraftBukkit - not in production code
if (this.random.nextInt(1000) < this.a++) {
this.a = -this.h();
this.al();
this.a = -this.m();
this.ay();
}
// CraftBukkit start - don't inline the damage, perform it with an event
@ -191,8 +282,8 @@ public abstract class EntityLiving extends Entity {
this.extinguish();
}
if (this.isAlive() && this.a(Material.WATER) && !this.f() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) {
this.setAirTicks(this.f(this.getAirTicks()));
if (this.isAlive() && this.a(Material.WATER) && !this.f_() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) {
this.setAirTicks(this.b_(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
@ -237,7 +328,7 @@ public abstract class EntityLiving extends Entity {
}
if (this.health <= 0) {
this.an();
this.aA();
}
if (this.lastDamageByPlayerTime > 0) {
@ -246,7 +337,21 @@ public abstract class EntityLiving extends Entity {
this.killer = null;
}
this.aB();
if (this.d != null && !this.d.isAlive()) {
this.d = null;
}
if (this.lastDamager != null) {
if (!this.lastDamager.isAlive()) {
this.a((EntityLiving) null);
} else if (this.c > 0) {
--this.c;
} else {
this.a((EntityLiving) null);
}
}
this.aJ();
this.ac = this.ab;
this.W = this.V;
this.Y = this.X;
@ -267,7 +372,7 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
protected void an() {
protected void aA() {
++this.deathTicks;
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead).
int i;
@ -282,7 +387,7 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
this.ay();
this.aG();
this.die();
for (i = 0; i < 20; ++i) {
@ -295,7 +400,7 @@ public abstract class EntityLiving extends Entity {
}
}
protected int f(int i) {
protected int b_(int i) {
return i - 1;
}
@ -307,7 +412,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
public void ao() {
public void aB() {
for (int i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
@ -318,27 +423,27 @@ public abstract class EntityLiving extends Entity {
}
}
public void N() {
super.N();
public void Q() {
super.Q();
this.Z = this.aa;
this.aa = 0.0F;
this.fallDistance = 0.0F;
}
public void y_() {
super.y_();
if (this.aJ > 0) {
if (this.aK <= 0) {
this.aK = 60;
public void G_() {
super.G_();
if (this.aI > 0) {
if (this.aJ <= 0) {
this.aJ = 60;
}
--this.aK;
if (this.aK <= 0) {
--this.aJ;
--this.aJ;
if (this.aJ <= 0) {
--this.aI;
}
}
this.d();
this.e();
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f = MathHelper.sqrt(d0 * d0 + d1 * d1);
@ -364,46 +469,49 @@ public abstract class EntityLiving extends Entity {
}
this.aa += (f3 - this.aa) * 0.3F;
if (this.c_()) {
this.senses.a();
} else {
float f4;
float f4;
for (f4 = f1 - this.V; f4 < -180.0F; f4 += 360.0F) {
;
}
for (f4 = f1 - this.V; f4 < -180.0F; f4 += 360.0F) {
;
}
while (f4 >= 180.0F) {
f4 -= 360.0F;
}
while (f4 >= 180.0F) {
f4 -= 360.0F;
}
this.V += f4 * 0.3F;
this.V += f4 * 0.3F;
float f5;
float f5;
for (f5 = this.yaw - this.V; f5 < -180.0F; f5 += 360.0F) {
;
}
for (f5 = this.yaw - this.V; f5 < -180.0F; f5 += 360.0F) {
;
}
while (f5 >= 180.0F) {
f5 -= 360.0F;
}
while (f5 >= 180.0F) {
f5 -= 360.0F;
}
boolean flag = f5 < -90.0F || f5 >= 90.0F;
boolean flag = f5 < -90.0F || f5 >= 90.0F;
if (f5 < -75.0F) {
f5 = -75.0F;
}
if (f5 < -75.0F) {
f5 = -75.0F;
}
if (f5 >= 75.0F) {
f5 = 75.0F;
}
if (f5 >= 75.0F) {
f5 = 75.0F;
}
this.V = this.yaw - f5;
if (f5 * f5 > 2500.0F) {
this.V += f5 * 0.2F;
}
this.V = this.yaw - f5;
if (f5 * f5 > 2500.0F) {
this.V += f5 * 0.2F;
}
if (flag) {
f2 *= -1.0F;
if (flag) {
f2 *= -1.0F;
}
}
while (this.yaw - this.lastYaw < -180.0F) {
@ -430,6 +538,14 @@ public abstract class EntityLiving extends Entity {
this.lastPitch += 360.0F;
}
while (this.X - this.Y < -180.0F) {
this.Y -= 360.0F;
}
while (this.X - this.Y >= 180.0F) {
this.Y += 360.0F;
}
this.ab += f2;
}
@ -506,6 +622,10 @@ public abstract class EntityLiving extends Entity {
Entity entity = damagesource.getEntity();
if (entity != null) {
if (entity instanceof EntityLiving) {
this.a((EntityLiving) entity);
}
if (entity instanceof EntityHuman) {
this.lastDamageByPlayerTime = 60;
this.killer = (EntityHuman) entity;
@ -521,7 +641,7 @@ public abstract class EntityLiving extends Entity {
if (flag) {
this.world.broadcastEntityEffect(this, (byte) 2);
this.aM();
this.aV();
if (entity != null) {
double d0 = entity.locX - this.locX;
@ -540,12 +660,12 @@ public abstract class EntityLiving extends Entity {
if (this.health <= 0) {
if (flag) {
this.world.makeSound(this, this.n(), this.o(), this.v());
this.world.makeSound(this, this.k(), this.p(), this.A());
}
this.die(damagesource);
} else if (flag) {
this.world.makeSound(this, this.m(), this.o(), this.v());
this.world.makeSound(this, this.j(), this.p(), this.A());
}
return true;
@ -553,22 +673,22 @@ public abstract class EntityLiving extends Entity {
}
}
private float v() {
private float A() {
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
public int P() {
public int S() {
return 0;
}
protected void g(int i) {}
protected void f(int i) {}
protected int d(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor()) {
int j = 25 - this.P();
int j = 25 - this.S();
int k = i * j + this.ar;
this.g(i);
this.f(i);
i = k / 25;
this.ar = k % 25;
}
@ -595,19 +715,19 @@ public abstract class EntityLiving extends Entity {
this.health -= i;
}
protected float o() {
protected float p() {
return 1.0F;
}
protected String c_() {
protected String i() {
return null;
}
protected String m() {
protected String j() {
return "damage.hurtflesh";
}
protected String n() {
protected String k() {
return "damage.hurtflesh";
}
@ -635,7 +755,7 @@ public abstract class EntityLiving extends Entity {
}
if (entity != null) {
entity.a(this);
entity.c(this);
}
this.az = true;
@ -648,12 +768,21 @@ public abstract class EntityLiving extends Entity {
if (!this.isBaby()) {
this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
if (this.lastDamageByPlayerTime > 0) {
int j = this.random.nextInt(200) - i;
if (j < 5) {
this.b(j <= 0 ? 1 : 0);
}
}
}
}
this.world.broadcastEntityEffect(this, (byte) 3);
}
protected void b(int i) {}
protected void dropDeathLoot(boolean flag, int i) {
int j = this.getLootId();
@ -680,8 +809,8 @@ public abstract class EntityLiving extends Entity {
return 0;
}
protected void b(float f) {
super.b(f);
protected void a(float f) {
super.a(f);
int i = (int) Math.ceil((double) (f - 3.0F));
if (i > 0) {
@ -715,9 +844,9 @@ public abstract class EntityLiving extends Entity {
public void a(float f, float f1) {
double d0;
if (this.aK()) {
if (this.aT()) {
d0 = this.locY;
this.a(f, f1, 0.02F);
this.a(f, f1, this.c_() ? 0.04F : 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
@ -726,7 +855,7 @@ public abstract class EntityLiving extends Entity {
if (this.positionChanged && this.d(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
} else if (this.aL()) {
} else if (this.aU()) {
d0 = this.locY;
this.a(f, f1, 0.02F);
this.move(this.motX, this.motY, this.motZ);
@ -750,7 +879,19 @@ public abstract class EntityLiving extends Entity {
}
float f3 = 0.16277136F / (f2 * f2 * f2);
float f4 = this.onGround ? this.al * f3 : this.am;
float f4;
if (this.onGround) {
if (this.c_()) {
f4 = this.ar();
} else {
f4 = this.al;
}
f4 *= f3;
} else {
f4 = this.am;
}
this.a(f, f1, f4);
f2 = 0.91F;
@ -763,7 +904,7 @@ public abstract class EntityLiving extends Entity {
}
}
if (this.r()) {
if (this.t()) {
float f5 = 0.15F;
if (this.motX < (double) (-f5)) {
@ -787,13 +928,15 @@ public abstract class EntityLiving extends Entity {
this.motY = -0.15D;
}
if (this.isSneaking() && this.motY < 0.0D) {
boolean flag = this.isSneaking() && this instanceof EntityHuman;
if (flag && this.motY < 0.0D) {
this.motY = 0.0D;
}
}
this.move(this.motX, this.motY, this.motZ);
if (this.positionChanged && this.r()) {
if (this.positionChanged && this.t()) {
this.motY = 0.2D;
}
@ -816,12 +959,13 @@ public abstract class EntityLiving extends Entity {
this.aF += this.aE;
}
public boolean r() {
public boolean t() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
int l = this.world.getTypeId(i, j, k);
return this.world.getTypeId(i, j, k) == Block.LADDER.id;
return l == Block.LADDER.id || l == Block.VINE.id;
}
public void b(NBTTagCompound nbttagcompound) {
@ -875,25 +1019,21 @@ public abstract class EntityLiving extends Entity {
return !this.dead && this.health > 0;
}
public boolean f() {
public boolean f_() {
return false;
}
public void d(float f) {
public void e(float f) {
this.aX = f;
}
public void e(boolean flag) {
public void f(boolean flag) {
this.aZ = flag;
}
public float ar() {
return this.bb;
}
public void d() {
if (this.h > 0) {
--this.h;
public void e() {
if (this.q > 0) {
--this.q;
}
if (this.aN > 0) {
@ -935,35 +1075,39 @@ public abstract class EntityLiving extends Entity {
}
// MethodProfiler.a("ai"); // CraftBukkit - not in production code
if (this.M()) {
if (this.P()) {
this.aZ = false;
this.aW = 0.0F;
this.aX = 0.0F;
this.aY = 0.0F;
} else if (this.at()) {
if (this.as()) {
this.av();
} else if (this.aE()) {
if (this.c_()) {
MethodProfiler.a("newAi");
this.z_();
MethodProfiler.a();
} else {
this.m_();
MethodProfiler.a("oldAi");
this.d_();
MethodProfiler.a();
this.X = this.yaw;
}
}
// MethodProfiler.a(); // CraftBukkit - not in production code
boolean flag = this.aK();
boolean flag1 = this.aL();
boolean flag = this.aT();
boolean flag1 = this.aU();
if (this.aZ) {
if (flag) {
this.motY += 0.03999999910593033D;
} else if (flag1) {
this.motY += 0.03999999910593033D;
} else if (this.onGround && this.h == 0) {
this.o_();
this.h = 10;
} else if (this.onGround && this.q == 0) {
this.ab();
this.q = 10;
}
} else {
this.h = 0;
this.q = 0;
}
this.aW *= 0.98F;
@ -971,7 +1115,7 @@ public abstract class EntityLiving extends Entity {
this.aY *= 0.9F;
float f = this.al;
this.al *= this.G();
this.al *= this.D_();
this.a(this.aW, this.aX);
this.al = f;
// MethodProfiler.a("push"); // CraftBukkit - not in production code
@ -981,7 +1125,7 @@ public abstract class EntityLiving extends Entity {
for (int j = 0; j < list1.size(); ++j) {
Entity entity = (Entity) list1.get(j);
if (entity.f_()) {
if (entity.e_()) {
entity.collide(this);
}
}
@ -990,23 +1134,23 @@ public abstract class EntityLiving extends Entity {
// MethodProfiler.a(); // CraftBukkit - not in production code
}
protected boolean as() {
protected boolean c_() {
return false;
}
protected boolean at() {
protected boolean aE() {
return !this.world.isStatic;
}
protected boolean M() {
protected boolean P() {
return this.health <= 0;
}
public boolean L() {
public boolean O() {
return false;
}
protected void o_() {
protected void ab() {
this.motY = 0.41999998688697815D;
if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
@ -1022,11 +1166,11 @@ public abstract class EntityLiving extends Entity {
this.ce = true;
}
protected boolean d_() {
protected boolean n() {
return true;
}
protected void au() {
protected void aF() {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
if (entityhuman != null) {
@ -1035,11 +1179,11 @@ public abstract class EntityLiving extends Entity {
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (this.d_() && d3 > 16384.0D) {
if (this.n() && d3 > 16384.0D) {
this.die();
}
if (this.aV > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.d_()) {
if (this.aV > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.n()) {
this.die();
} else if (d3 < 1024.0D) {
this.aV = 0;
@ -1047,25 +1191,40 @@ public abstract class EntityLiving extends Entity {
}
}
protected void av() {
protected void z_() {
++this.aV;
this.au();
if (this.lastDamager != null && !this.lastDamager.isAlive()) {
this.lastDamager = null;
}
//MethodProfiler.a("checkDespawn"); // CraftBukkit - not in production code
this.aF();
//MethodProfiler.a(); // CraftBukkit - not in production code
//MethodProfiler.a("sensing"); // CraftBukkit - not in production code
this.m.a();
//MethodProfiler.a(); // CraftBukkit - not in production code
//MethodProfiler.a("targetSelector"); // CraftBukkit - not in production code
this.targetSelector.a();
//MethodProfiler.a(); // CraftBukkit - not in production code
//MethodProfiler.a("goalSelector"); // CraftBukkit - not in production code
this.goalSelector.a();
this.navigation.a();
this.moveController.a();
//MethodProfiler.a(); // CraftBukkit - not in production code
//MethodProfiler.a("navigation"); // CraftBukkit - not in production code
this.navigation.d();
//MethodProfiler.a(); // CraftBukkit - not in production code
//MethodProfiler.a("mob tick"); // CraftBukkit - not in production code
this.g();
//MethodProfiler.a(); // CraftBukkit - not in production code
//MethodProfiler.a("controls"); // CraftBukkit - not in production code
this.moveController.c();
this.lookController.a();
this.jumpController.b();
//MethodProfiler.a(); // CraftBukkit - not in production code
}
protected void m_() {
protected void g() {}
protected void d_() {
++this.aV;
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
this.au();
this.aF();
this.aW = 0.0F;
this.aX = 0.0F;
float f = 8.0F;
@ -1073,17 +1232,17 @@ public abstract class EntityLiving extends Entity {
if (this.random.nextFloat() < 0.02F) {
entityhuman = this.world.findNearbyPlayer(this, (double) f);
if (entityhuman != null) {
this.i = entityhuman;
this.r = entityhuman;
this.bc = 10 + this.random.nextInt(20);
} else {
this.aY = (this.random.nextFloat() - 0.5F) * 20.0F;
}
}
if (this.i != null) {
this.a(this.i, 10.0F, (float) this.x());
if (this.bc-- <= 0 || this.i.dead || this.i.i(this) > (double) (f * f)) {
this.i = null;
if (this.r != null) {
this.a(this.r, 10.0F, (float) this.C());
if (this.bc-- <= 0 || this.r.dead || this.r.j(this) > (double) (f * f)) {
this.r = null;
}
} else {
if (this.random.nextFloat() < 0.05F) {
@ -1094,15 +1253,15 @@ public abstract class EntityLiving extends Entity {
this.pitch = this.ba;
}
boolean flag = this.aK();
boolean flag1 = this.aL();
boolean flag = this.aT();
boolean flag1 = this.aU();
if (flag || flag1) {
this.aZ = this.random.nextFloat() < 0.8F;
}
}
public int x() {
public int C() {
return 40;
}
@ -1127,14 +1286,6 @@ public abstract class EntityLiving extends Entity {
this.yaw = this.b(this.yaw, f2, f);
}
public boolean aw() {
return this.i != null;
}
public Entity ax() {
return this.i;
}
private float b(float f, float f1, float f2) {
float f3;
@ -1157,13 +1308,13 @@ public abstract class EntityLiving extends Entity {
return f + f3;
}
public void ay() {}
public void aG() {}
public boolean canSpawn() {
return this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
}
protected void az() {
protected void aH() {
// CraftBukkit start
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.VOID, 4);
this.world.getServer().getPluginManager().callEvent(event);
@ -1176,11 +1327,11 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
public Vec3D aA() {
return this.e(1.0F);
public Vec3D aI() {
return this.f(1.0F);
}
public Vec3D e(float f) {
public Vec3D f(float f) {
float f1;
float f2;
float f3;
@ -1204,7 +1355,7 @@ public abstract class EntityLiving extends Entity {
}
}
public int p() {
public int q() {
return 4;
}
@ -1212,7 +1363,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
protected void aB() {
protected void aJ() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@ -1227,7 +1378,7 @@ public abstract class EntityLiving extends Entity {
int i;
if (this.b) {
if (this.e) {
if (!this.world.isStatic) {
if (!this.effects.isEmpty()) {
i = PotionBrewer.a(this.effects.values());
@ -1237,7 +1388,7 @@ public abstract class EntityLiving extends Entity {
}
}
this.b = false;
this.e = false;
}
if (this.random.nextBoolean()) {
@ -1252,7 +1403,7 @@ public abstract class EntityLiving extends Entity {
}
}
public void aC() {
public void aK() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@ -1302,23 +1453,23 @@ public abstract class EntityLiving extends Entity {
return true;
}
public boolean aE() {
public boolean aM() {
return this.getMonsterType() == MonsterType.UNDEAD;
}
protected void b(MobEffect mobeffect) {
this.b = true;
this.e = true;
}
protected void c(MobEffect mobeffect) {
this.b = true;
this.e = true;
}
protected void d(MobEffect mobeffect) {
this.b = true;
this.e = true;
}
protected float G() {
protected float D_() {
float f = 1.0F;
if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) {

View file

@ -16,19 +16,19 @@ public class EntityMagmaCube extends EntitySlime {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
}
public int P() {
public int S() {
return this.getSize() * 3;
}
public float a(float f) {
public float b(float f) {
return 1.0F;
}
protected String v() {
protected String A() {
return "flame";
}
protected EntitySlime z() {
protected EntitySlime D() {
return new EntityMagmaCube(this.world);
}
@ -59,46 +59,46 @@ public class EntityMagmaCube extends EntitySlime {
return false;
}
protected int B() {
return super.B() * 4;
protected int E() {
return super.E() * 4;
}
protected void C() {
protected void F() {
this.a *= 0.9F;
}
protected void o_() {
protected void ab() {
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
this.ce = true;
}
protected void b(float f) {}
protected void a(float f) {}
protected boolean D() {
protected boolean G() {
return true;
}
protected int E() {
return super.E() + 2;
protected int H() {
return super.H() + 2;
}
protected String m() {
protected String j() {
return "mob.slime";
}
protected String n() {
protected String k() {
return "mob.slime";
}
protected String F() {
protected String J() {
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
}
public boolean aL() {
public boolean aU() {
return false;
}
protected boolean H() {
protected boolean K() {
return true;
}
}

View file

@ -90,15 +90,15 @@ public class EntityMinecart extends Entity implements IInventory {
this.datawatcher.a(19, new Integer(0));
}
public AxisAlignedBB a_(Entity entity) {
public AxisAlignedBB b_(Entity entity) {
return entity.boundingBox;
}
public AxisAlignedBB h_() {
public AxisAlignedBB h() {
return null;
}
public boolean f_() {
public boolean e_() {
return true;
}
@ -116,7 +116,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
public double q() {
public double x_() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@ -136,9 +136,9 @@ public class EntityMinecart extends Entity implements IInventory {
i = event.getDamage();
// CraftBukkit end
this.d(-this.m());
this.c(10);
this.aM();
this.e(-this.n());
this.d(10);
this.aV();
this.setDamage(this.getDamage() + i * 10);
if (this.getDamage() > 40) {
if (this.passenger != null) {
@ -200,7 +200,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
public boolean e_() {
public boolean o_() {
return !this.dead;
}
@ -236,7 +236,7 @@ public class EntityMinecart extends Entity implements IInventory {
super.die();
}
public void y_() {
public void G_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@ -245,15 +245,15 @@ public class EntityMinecart extends Entity implements IInventory {
float prevPitch = this.pitch;
// CraftBukkit end
if (this.l() > 0) {
this.c(this.l() - 1);
if (this.m() > 0) {
this.d(this.m() - 1);
}
if (this.getDamage() > 0) {
this.setDamage(this.getDamage() - 1);
}
if (this.j() && this.random.nextInt(4) == 0) {
if (this.k() && this.random.nextInt(4) == 0) {
this.world.a("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
}
@ -598,7 +598,7 @@ public class EntityMinecart extends Entity implements IInventory {
for (int l1 = 0; l1 < list.size(); ++l1) {
Entity entity = (Entity) list.get(l1);
if (entity != this.passenger && entity.f_() && entity instanceof EntityMinecart) {
if (entity != this.passenger && entity.e_() && entity instanceof EntityMinecart) {
entity.collide(this);
}
}
@ -851,6 +851,17 @@ public class EntityMinecart extends Entity implements IInventory {
}
}
public ItemStack splitWithoutUpdate(int i) {
if (this.items[i] != null) {
ItemStack itemstack = this.items[i];
this.items[i] = null;
return itemstack;
} else {
return null;
}
}
public void setItem(int i, ItemStack itemstack) {
this.items[i] = itemstack;
if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
@ -859,7 +870,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
public String getName() {
return "Minecart";
return "container.minecart";
}
public int getMaxStackSize() {
@ -900,10 +911,10 @@ public class EntityMinecart extends Entity implements IInventory {
}
public boolean a(EntityHuman entityhuman) {
return this.dead ? false : entityhuman.i(this) <= 64.0D;
return this.dead ? false : entityhuman.j(this) <= 64.0D;
}
protected boolean j() {
protected boolean k() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@ -927,19 +938,19 @@ public class EntityMinecart extends Entity implements IInventory {
return this.datawatcher.getInt(19);
}
public void c(int i) {
public void d(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
public int l() {
public int m() {
return this.datawatcher.getInt(17);
}
public void d(int i) {
public void e(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
public int m() {
public int n() {
return this.datawatcher.getInt(18);
}

View file

@ -17,18 +17,18 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
this.aA = 5;
}
public void d() {
float f = this.a(1.0F);
public void e() {
float f = this.b(1.0F);
if (f > 0.5F) {
this.aV += 2;
}
super.d();
super.e();
}
public void y_() {
super.y_();
public void G_() {
super.G_();
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
@ -37,7 +37,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
return entityhuman != null && this.g(entityhuman) ? entityhuman : null;
return entityhuman != null && this.h(entityhuman) ? entityhuman : null;
}
public boolean damageEntity(DamageSource damagesource, int i) {
@ -73,7 +73,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
public boolean d(Entity entity) {
public boolean a(Entity entity) {
int i = this.damage;
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
@ -108,12 +108,12 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
this.d(entity);
this.a(entity);
}
}
public float a(int i, int j, int k) {
return 0.5F - this.world.m(i, j, k);
return 0.5F - this.world.p(i, j, k);
}
public void b(NBTTagCompound nbttagcompound) {
@ -124,7 +124,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
super.a(nbttagcompound);
}
protected boolean z() {
protected boolean D() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
@ -134,12 +134,12 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} else {
int l = this.world.getLightLevel(i, j, k);
if (this.world.v()) {
int i1 = this.world.k;
if (this.world.w()) {
int i1 = this.world.f;
this.world.k = 10;
this.world.f = 10;
l = this.world.getLightLevel(i, j, k);
this.world.k = i1;
this.world.f = i1;
}
return l <= this.random.nextInt(8);
@ -147,6 +147,6 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public boolean canSpawn() {
return this.z() && super.canSpawn();
return this.D() && super.canSpawn();
}
}

View file

@ -25,16 +25,18 @@ public class EntityMushroomCow extends EntityCow {
// CraftBukkit end
this.die();
EntityCow entitycow = new EntityCow(this.world);
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
entitycow.V = this.V;
this.world.addEntity(entitycow);
this.world.a("largeexplode", this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
if (!this.world.isStatic) {
EntityCow entitycow = new EntityCow(this.world);
for (int i = 0; i < 5; ++i) {
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY + (double) this.length, this.locZ, new ItemStack(Block.RED_MUSHROOM)));
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
entitycow.V = this.V;
this.world.addEntity(entitycow);
for (int i = 0; i < 5; ++i) {
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY + (double) this.length, this.locZ, new ItemStack(Block.RED_MUSHROOM)));
}
}
return true;
@ -43,7 +45,7 @@ public class EntityMushroomCow extends EntityCow {
}
}
protected EntityAnimal createChild(EntityAnimal entityanimal) {
public EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityMushroomCow(this.world);
}
}

View file

@ -120,7 +120,7 @@ public class EntityPainting extends Entity {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
}
public void y_() {
public void G_() {
if (this.f++ == 100 && !this.world.isStatic) {
this.f = 0;
if (!this.survives()) {
@ -207,7 +207,7 @@ public class EntityPainting extends Entity {
}
}
public boolean e_() {
public boolean o_() {
return true;
}
@ -235,7 +235,7 @@ public class EntityPainting extends Entity {
// CraftBukkit end
this.die();
this.aM();
this.aV();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
}

View file

@ -6,6 +6,21 @@ public class EntityPig extends EntityAnimal {
super(world);
this.texture = "/mob/pig.png";
this.b(0.9F, 0.9F);
this.ak().a(true);
float f = 0.25F;
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.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 c_() {
return true;
}
public int getMaxHealth() {
@ -27,15 +42,15 @@ public class EntityPig extends EntityAnimal {
this.setSaddle(nbttagcompound.getBoolean("Saddle"));
}
protected String c_() {
protected String i() {
return "mob.pig";
}
protected String m() {
protected String j() {
return "mob.pig";
}
protected String n() {
protected String k() {
return "mob.pigdeath";
}
@ -83,14 +98,14 @@ public class EntityPig extends EntityAnimal {
}
}
protected void b(float f) {
super.b(f);
protected void a(float f) {
super.a(f);
if (f > 5.0F && this.passenger instanceof EntityHuman) {
((EntityHuman) this.passenger).a((Statistic) AchievementList.u);
}
}
protected EntityAnimal createChild(EntityAnimal entityanimal) {
public EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityPig(this.world);
}
}

View file

@ -23,17 +23,17 @@ public class EntityPigZombie extends EntityZombie {
this.fireProof = true;
}
protected boolean as() {
protected boolean c_() {
return false;
}
public void y_() {
public void G_() {
this.bb = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
this.world.makeSound(this, "mob.zombiepig.zpigangry", this.o() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
this.world.makeSound(this, "mob.zombiepig.zpigangry", this.p() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
super.y_();
super.G_();
}
public boolean canSpawn() {
@ -54,8 +54,8 @@ public class EntityPigZombie extends EntityZombie {
return this.angerLevel == 0 ? null : super.findTarget();
}
public void d() {
super.d();
public void e() {
super.e();
}
public boolean damageEntity(DamageSource damagesource, int i) {
@ -70,17 +70,17 @@ public class EntityPigZombie extends EntityZombie {
if (entity1 instanceof EntityPigZombie) {
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
entitypigzombie.f(entity);
entitypigzombie.e(entity);
}
}
this.f(entity);
this.e(entity);
}
return super.damageEntity(damagesource, i);
}
private void f(Entity entity) {
private void e(Entity entity) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
@ -103,15 +103,15 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40);
}
protected String c_() {
protected String i() {
return "mob.zombiepig.zpig";
}
protected String m() {
protected String j() {
return "mob.zombiepig.zpighurt";
}
protected String n() {
protected String k() {
return "mob.zombiepig.zpigdeath";
}
@ -135,6 +135,25 @@ public class EntityPigZombie extends EntityZombie {
// CraftBukkit end
}
protected void b(int i) {
if (i > 0) {
ItemStack itemstack = new ItemStack(Item.GOLD_SWORD);
EnchantmentManager.a(this.random, itemstack, 5);
this.a(itemstack, 0.0F);
} else {
int j = this.random.nextInt(3);
if (j == 0) {
this.b(Item.GOLD_INGOT.id, 1);
} else if (j == 1) {
this.b(Item.GOLD_SWORD.id, 1);
} else if (j == 2) {
this.b(Item.GOLD_HELMET.id, 1);
}
}
}
protected int getLootId() {
return Item.ROTTEN_FLESH.id;
}

View file

@ -46,9 +46,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
int j = chunkcoordinates.z;
int k = chunkcoordinates.y;
if (!world.worldProvider.f) {
if (!world.worldProvider.e) {
i += this.random.nextInt(20) - 10;
k = world.f(i, j);
k = world.g(i, j);
j += this.random.nextInt(20) - 10;
}
@ -127,7 +127,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return this.ck;
}
protected void r_() {
protected void A() {
this.height = 0.0F;
}
@ -135,7 +135,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return 1.62F;
}
public void y_() {
public void G_() {
this.itemInWorldManager.c();
--this.invulnerableTicks;
this.activeContainer.a();
@ -216,7 +216,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
protected boolean z() {
protected boolean C_() {
return this.server.pvpMode;
}
@ -225,12 +225,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(boolean flag) {
super.y_();
super.G_();
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
if (itemstack != null && Item.byId[itemstack.id].n_() && this.netServerHandler.lowPriorityCount() <= 2) {
if (itemstack != null && Item.byId[itemstack.id].t_() && this.netServerHandler.lowPriorityCount() <= 2) {
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
if (packet != null) {
@ -241,6 +241,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (flag && !this.chunkCoordIntPairQueue.isEmpty()) {
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(0);
double d0 = chunkcoordintpair.a(this);
for (int j = 0; j < this.chunkCoordIntPairQueue.size(); ++j) {
ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(j);
double d1 = chunkcoordintpair1.a(this);
if (d1 < d0) {
chunkcoordintpair = chunkcoordintpair1;
d0 = d1;
}
}
if (chunkcoordintpair != null) {
boolean flag1 = false;
@ -253,12 +264,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (flag1) {
WorldServer worldserver = this.server.getWorldServer(this.dimension);
this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
this.netServerHandler.sendPacket(new Packet51MapChunk(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, 16, worldserver.height, 16, worldserver));
List list = worldserver.getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, worldserver.height, chunkcoordintpair.z * 16 + 16);
if (worldserver.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
Chunk chunk = worldserver.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
for (int j = 0; j < list.size(); ++j) {
this.a((TileEntity) list.get(j));
if (chunk.done) {
this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
this.netServerHandler.sendPacket(new Packet51MapChunk(worldserver.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z), true, 0));
List list = worldserver.getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 256, chunkcoordintpair.z * 16 + 16);
for (int k = 0; k < list.size(); ++k) {
this.a((TileEntity) list.get(k));
}
}
}
}
}
@ -359,7 +376,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private void a(TileEntity tileentity) {
if (tileentity != null) {
Packet packet = tileentity.k();
Packet packet = tileentity.d();
if (packet != null) {
this.netServerHandler.sendPacket(packet);
@ -388,7 +405,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.a();
}
public void s_() {
public void D() {
if (!this.t) {
this.u = -1;
this.t = true;
@ -398,7 +415,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
public void B() {}
public void E() {}
public EnumBedResult a(int i, int j, int k) {
EnumBedResult enumbedresult = super.a(i, j, k);
@ -563,7 +580,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void closeInventory() {
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
this.E();
this.H();
}
public void broadcastCarriedItem() {
@ -572,7 +589,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
public void E() {
public void H() {
this.activeContainer.a((EntityHuman) this);
this.activeContainer = this.defaultContainer;
}
@ -590,7 +607,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
public void F() {
public void I() {
if (this.vehicle != null) {
this.mount(this.vehicle);
}
@ -604,7 +621,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
public void t_() {
public void J() {
this.cf = -99999999;
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@ -616,9 +633,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.netServerHandler.sendPacket(new Packet3Chat(s1));
}
protected void H() {
protected void K() {
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
super.H();
super.K();
}
public void a(ItemStack itemstack, int i) {

View file

@ -63,7 +63,7 @@ public class EntityPotion extends EntityProjectile {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
double d0 = this.i(entity);
double d0 = this.j(entity);
if (d0 < 16.0D) {
double d1 = 1.0D - Math.sqrt(d0) / 4.0D;

View file

@ -82,11 +82,11 @@ public abstract class EntityProjectile extends Entity {
this.h = 0;
}
public void y_() {
public void G_() {
this.bL = this.locX;
this.bM = this.locY;
this.bN = this.locZ;
super.y_();
super.G_();
if (this.shake > 0) {
--this.shake;
}
@ -131,7 +131,7 @@ public abstract class EntityProjectile extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.e_() && (entity1 != this.shooter || this.i >= 5)) {
if (entity1.o_() && (entity1 != this.shooter || this.i >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@ -190,7 +190,7 @@ public abstract class EntityProjectile extends Entity {
float f2 = 0.99F;
float f3 = this.e();
if (this.aK()) {
if (this.aT()) {
for (int k = 0; k < 4; ++k) {
float f4 = 0.25F;

View file

@ -12,11 +12,41 @@ public class EntitySheep extends EntityAnimal {
public static final float[][] a = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.95F, 0.7F, 0.2F}, { 0.9F, 0.5F, 0.85F}, { 0.6F, 0.7F, 0.95F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.7F, 0.8F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.6F, 0.7F}, { 0.7F, 0.4F, 0.9F}, { 0.2F, 0.4F, 0.8F}, { 0.5F, 0.4F, 0.3F}, { 0.4F, 0.5F, 0.2F}, { 0.8F, 0.3F, 0.3F}, { 0.1F, 0.1F, 0.1F}};
private int b;
private PathfinderGoalEatTile c = new PathfinderGoalEatTile(this);
public EntitySheep(World world) {
super(world);
this.texture = "/mob/sheep.png";
this.b(0.9F, 1.3F);
float f = 0.23F;
this.ak().a(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.25F));
this.goalSelector.a(5, this.c);
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, f));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
}
protected boolean c_() {
return true;
}
protected void z_() {
this.b = this.c.f();
super.z_();
}
public void e() {
if (this.world.isStatic) {
this.b = Math.max(0, this.b - 1);
}
super.e();
}
public int getMaxHealth() {
@ -44,86 +74,6 @@ public class EntitySheep extends EntityAnimal {
return Block.WOOL.id;
}
public void d() {
super.d();
if (this.b > 0) {
--this.b;
}
}
protected void o_() {
if (this.b <= 0) {
super.o_();
}
}
protected void m_() {
super.m_();
int i;
int j;
int k;
if (!this.E() && this.b <= 0 && (this.isBaby() && this.random.nextInt(50) == 0 || this.random.nextInt(1000) == 0)) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id && this.world.getData(i, j, k) == 1 || this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
this.b = 40;
this.world.broadcastEntityEffect(this, (byte) 10);
}
} else if (this.b == 4) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
boolean flag = false;
if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id) {
// CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) {
this.world.triggerEffect(2001, i, j, k, Block.LONG_GRASS.id + 256);
this.world.setTypeId(i, j, k, 0);
flag = true;
}
// CraftBukkit end
} else if (this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
// CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) {
this.world.triggerEffect(2001, i, j - 1, k, Block.GRASS.id);
this.world.setTypeId(i, j - 1, k, Block.DIRT.id);
flag = true;
}
// CraftBukkit end
}
if (flag) {
// CraftBukkit start
if (!this.isBaby()) {
org.bukkit.event.entity.SheepRegrowWoolEvent event = new org.bukkit.event.entity.SheepRegrowWoolEvent((Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.setSheared(false);
}
}
// CraftBukkit end
if (this.isBaby()) {
int l = this.getAge() + 1200;
if (l > 0) {
l = 0;
}
this.setAge(l);
}
}
}
}
protected boolean v() {
return this.b > 0;
}
public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
@ -168,15 +118,15 @@ public class EntitySheep extends EntityAnimal {
this.setColor(nbttagcompound.getByte("Color"));
}
protected String c_() {
protected String i() {
return "mob.sheep";
}
protected String m() {
protected String j() {
return "mob.sheep";
}
protected String n() {
protected String k() {
return "mob.sheep";
}
@ -210,7 +160,7 @@ public class EntitySheep extends EntityAnimal {
return i < 5 ? 15 : (i < 10 ? 7 : (i < 15 ? 8 : (i < 18 ? 12 : (random.nextInt(500) == 0 ? 6 : 0))));
}
protected EntityAnimal createChild(EntityAnimal entityanimal) {
public EntityAnimal createChild(EntityAnimal entityanimal) {
EntitySheep entitysheep = (EntitySheep) entityanimal;
EntitySheep entitysheep1 = new EntitySheep(this.world);
@ -222,4 +172,25 @@ public class EntitySheep extends EntityAnimal {
return entitysheep1;
}
public void z() {
// CraftBukkit start
org.bukkit.event.entity.SheepRegrowWoolEvent event = new org.bukkit.event.entity.SheepRegrowWoolEvent((Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.setSheared(false);
}
// CraftBukkit end
if (this.isBaby()) {
int i = this.getAge() + 1200;
if (i > 0) {
i = 0;
}
this.setAge(i);
}
}
}

View file

@ -14,26 +14,52 @@ public class EntitySkeleton extends EntityMonster {
public EntitySkeleton(World world) {
super(world);
this.texture = "/mob/skeleton.png";
this.bb = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalRestrictSun(this));
this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bb));
this.goalSelector.a(4, new PathfinderGoalArrowAttack(this, this.bb, 1, 60));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bb));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, false));
}
public boolean c_() {
return true;
}
public int getMaxHealth() {
return 20;
}
protected String c_() {
protected String i() {
return "mob.skeleton";
}
protected String m() {
protected String j() {
return "mob.skeletonhurt";
}
protected String n() {
protected String k() {
return "mob.skeletonhurt";
}
public boolean damageEntity(DamageSource damagesource, int i) {
return super.damageEntity(damagesource, i);
public MonsterType getMonsterType() {
return MonsterType.UNDEAD;
}
public void e() {
if (this.world.e() && !this.world.isStatic) {
float f = this.b(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
this.setOnFire(8);
}
}
super.e();
}
public void die(DamageSource damagesource) {
@ -49,66 +75,6 @@ public class EntitySkeleton extends EntityMonster {
}
}
public void d() {
if (this.world.e() && !this.world.isStatic) {
float f = this.a(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
this.setOnFire(event.getDuration());
}
// CraftBukkit end
}
}
super.d();
}
protected void a(Entity entity, float f) {
if (f < 10.0F) {
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
if (this.attackTicks == 0) {
EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F);
double d2 = entity.locY + (double) entity.getHeadHeight() - 0.699999988079071D - entityarrow.locY;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F;
// this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down
// this.world.addEntity(entityarrow); // CraftBukkit - moved down
entityarrow.shoot(d0, d2 + (double) f1, d1, 1.6F, 12.0F);
this.attackTicks = 60;
// CraftBukkit start
EntityShootBowEvent event = CraftEventFactory.callEntityShootBowEvent(this, null, entityarrow, 0.5F);
if (event.isCancelled()) {
if (event.getProjectile() != null) {
event.getProjectile().remove();
}
} else if (event.getProjectile() == entityarrow.getBukkitEntity()) {
world.addEntity(entityarrow);
}
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
// CraftBukkit end
}
this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.e = true;
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
}
protected int getLootId() {
return Item.ARROW.id;
}
@ -131,7 +97,14 @@ public class EntitySkeleton extends EntityMonster {
// CraftBukkit end
}
public MonsterType getMonsterType() {
return MonsterType.UNDEAD;
protected void b(int i) {
if (i > 0) {
ItemStack itemstack = new ItemStack(Item.BOW);
EnchantmentManager.a(this.random, itemstack, 5);
this.a(itemstack, 0.0F);
} else {
this.b(Item.BOW.id, 1);
}
}
}

View file

@ -52,15 +52,15 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.setSize(nbttagcompound.getInt("Size") + 1);
}
protected String v() {
protected String A() {
return "slime";
}
protected String F() {
protected String J() {
return "mob.slime";
}
public void y_() {
public void G_() {
if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
this.dead = true;
}
@ -69,7 +69,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.c = this.b;
boolean flag = this.onGround;
super.y_();
super.G_();
if (this.onGround && !flag) {
int i = this.getSize();
@ -79,21 +79,21 @@ public class EntitySlime extends EntityLiving implements IMonster {
float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
this.world.a(this.v(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
this.world.a(this.A(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
}
if (this.H()) {
this.world.makeSound(this, this.F(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
if (this.K()) {
this.world.makeSound(this, this.J(), this.p(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.a = -0.5F;
}
this.C();
this.F();
}
protected void m_() {
this.au();
protected void d_() {
this.aF();
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
if (entityhuman != null) {
@ -101,14 +101,14 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
if (this.onGround && this.jumpDelay-- <= 0) {
this.jumpDelay = this.B();
this.jumpDelay = this.E();
if (entityhuman != null) {
this.jumpDelay /= 3;
}
this.aZ = true;
if (this.J()) {
this.world.makeSound(this, this.F(), this.o(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
if (this.M()) {
this.world.makeSound(this, this.J(), this.p(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.a = 1.0F;
@ -122,15 +122,15 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
}
protected void C() {
protected void F() {
this.a *= 0.6F;
}
protected int B() {
protected int E() {
return this.random.nextInt(20) + 10;
}
protected EntitySlime z() {
protected EntitySlime D() {
return new EntitySlime(this.world);
}
@ -155,7 +155,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
EntitySlime entityslime = this.z();
EntitySlime entityslime = this.D();
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
@ -167,28 +167,28 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
public void a_(EntityHuman entityhuman) {
if (this.D()) {
if (this.G()) {
int i = this.getSize();
if (this.g(entityhuman) && (double) this.h(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.E())) {
if (this.h(entityhuman) && (double) this.i(entityhuman) < 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.H())) {
this.world.makeSound(this, "mob.slimeattack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
}
protected boolean D() {
protected boolean G() {
return this.getSize() > 1;
}
protected int E() {
protected int H() {
return this.getSize();
}
protected String m() {
protected String j() {
return "mob.slime";
}
protected String n() {
protected String k() {
return "mob.slime";
}
@ -202,19 +202,19 @@ public class EntitySlime extends EntityLiving implements IMonster {
return (this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.canSpawn() : false;
}
protected float o() {
protected float p() {
return 0.4F * (float) this.getSize();
}
public int x() {
public int C() {
return 0;
}
protected boolean J() {
protected boolean M() {
return this.getSize() > 1;
}
protected boolean H() {
protected boolean K() {
return this.getSize() > 2;
}
}

View file

@ -20,6 +20,11 @@ public class EntitySmallFireball extends EntityFireball {
this.b(0.3125F, 0.3125F);
}
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
super(world, d0, d1, d2, d3, d4, d5);
this.b(0.3125F, 0.3125F);
}
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
// CraftBukkit start - projectile hit event
@ -84,7 +89,7 @@ public class EntitySmallFireball extends EntityFireball {
}
}
public boolean e_() {
public boolean o_() {
return false;
}

View file

@ -13,36 +13,41 @@ public class EntitySnowman extends EntityGolem {
super(world);
this.texture = "/mob/snowman.png";
this.b(0.4F, 1.8F);
this.ak().a(true);
this.goalSelector.a(1, new PathfinderGoalArrowAttack(this, 0.25F, 2, 20));
this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, 0.2F));
this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(4, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityMonster.class, 16.0F, 0, true));
}
public boolean c_() {
return true;
}
public int getMaxHealth() {
return 4;
}
public void d() {
super.d();
if (this.target == null && !this.E() && this.world.random.nextInt(100) == 0) {
List list = this.world.a(EntityMonster.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
if (!list.isEmpty()) {
this.setTarget((Entity) list.get(this.world.random.nextInt(list.size())));
}
public void e() {
super.e();
if (this.aS()) {
this.damageEntity(DamageSource.DROWN, 1);
}
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
int j = MathHelper.floor(this.locZ);
if (this.world.getWorldChunkManager().a(i, j, k) > 1.0F) {
if (this.world.getBiome(i, j).h() > 1.0F) {
this.damageEntity(DamageSource.BURN, 1);
}
for (i = 0; i < 4; ++i) {
j = MathHelper.floor(this.locX + (double) ((float) (i % 2 * 2 - 1) * 0.25F));
k = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locY);
int l = MathHelper.floor(this.locZ + (double) ((float) (i / 2 % 2 * 2 - 1) * 0.25F));
if (this.world.getTypeId(j, k, l) == 0 && this.world.getWorldChunkManager().a(j, k, l) < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
if (this.world.getTypeId(j, k, l) == 0 && this.world.getBiome(j, l).h() < 0.8F && Block.SNOW.canPlace(this.world, j, k, l)) {
// CraftBukkit start
BlockState blockState = this.world.getWorld().getBlockAt(j, k, l).getState();
blockState.setTypeId(Block.SNOW.id);
@ -58,27 +63,6 @@ public class EntitySnowman extends EntityGolem {
}
}
protected void a(Entity entity, float f) {
if (f < 10.0F) {
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
if (this.attackTicks == 0) {
EntitySnowball entitysnowball = new EntitySnowball(this.world, this);
double d2 = entity.locY + (double) entity.getHeadHeight() - 1.100000023841858D - entitysnowball.locY;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entitysnowball);
entitysnowball.a(d0, d2 + (double) f1, d1, 1.6F, 12.0F);
this.attackTicks = 10;
}
this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.e = true;
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
}

View file

@ -22,12 +22,12 @@ public class EntitySpider extends EntityMonster {
this.datawatcher.a(16, new Byte((byte) 0));
}
public void d() {
super.d();
public void e() {
super.e();
}
public void y_() {
super.y_();
public void G_() {
super.G_();
if (!this.world.isStatic) {
this.a(this.positionChanged);
}
@ -37,7 +37,7 @@ public class EntitySpider extends EntityMonster {
return 16;
}
public double q() {
public double x_() {
return (double) this.length * 0.75D - 0.5D;
}
@ -46,7 +46,7 @@ public class EntitySpider extends EntityMonster {
}
protected Entity findTarget() {
float f = this.a(1.0F);
float f = this.b(1.0F);
if (f < 0.5F) {
double d0 = 16.0D;
@ -57,20 +57,20 @@ public class EntitySpider extends EntityMonster {
}
}
protected String c_() {
protected String i() {
return "mob.spider";
}
protected String m() {
protected String j() {
return "mob.spider";
}
protected String n() {
protected String k() {
return "mob.spiderdeath";
}
protected void a(Entity entity, float f) {
float f1 = this.a(1.0F);
float f1 = this.b(1.0F);
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start
@ -137,11 +137,11 @@ public class EntitySpider extends EntityMonster {
// CraftBukkit end
}
public boolean r() {
return this.u();
public boolean t() {
return this.w();
}
public void s() {}
public void u() {}
public MonsterType getMonsterType() {
return MonsterType.ARTHROPOD;
@ -151,7 +151,7 @@ public class EntitySpider extends EntityMonster {
return mobeffect.getEffectId() == MobEffectList.POISON.id ? false : super.a(mobeffect);
}
public boolean u() {
public boolean w() {
return (this.datawatcher.getByte(16) & 1) != 0;
}

View file

@ -38,19 +38,19 @@ public class EntitySquid extends EntityWaterAnimal {
super.a(nbttagcompound);
}
protected String c_() {
protected String i() {
return null;
}
protected String m() {
protected String j() {
return null;
}
protected String n() {
protected String k() {
return null;
}
protected float o() {
protected float p() {
return 0.4F;
}
@ -75,12 +75,12 @@ public class EntitySquid extends EntityWaterAnimal {
return super.b(entityhuman);
}
public boolean aK() {
public boolean aT() {
return this.world.a(this.boundingBox.grow(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
}
public void d() {
super.d();
public void e() {
super.e();
this.b = this.a;
this.g = this.c;
this.i = this.h;
@ -93,7 +93,7 @@ public class EntitySquid extends EntityWaterAnimal {
}
}
if (this.aK()) {
if (this.aT()) {
float f;
if (this.h < 3.1415927F) {
@ -139,7 +139,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.move(this.motX, this.motY, this.motZ);
}
protected void m_() {
protected void d_() {
++this.aV;
if (this.aV > 100) {
this.o = this.p = this.q = 0.0F;
@ -151,10 +151,10 @@ public class EntitySquid extends EntityWaterAnimal {
this.q = MathHelper.sin(f) * 0.2F;
}
this.au();
this.aF();
}
public boolean canSpawn() {
return this.locY > 45.0D && this.locY < (double) this.world.seaLevel && super.canSpawn();
return this.locY > 45.0D && this.locY < 63.0D && super.canSpawn();
}
}

View file

@ -26,9 +26,9 @@ public class EntityTNTPrimed extends Entity {
this.setPosition(d0, d1, d2);
float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
this.motX = (double) (-MathHelper.sin(f * 3.1415927F / 180.0F) * 0.02F);
this.motX = (double) (-((float) Math.sin((double) f)) * 0.02F);
this.motY = 0.20000000298023224D;
this.motZ = (double) (-MathHelper.cos(f * 3.1415927F / 180.0F) * 0.02F);
this.motZ = (double) (-((float) Math.cos((double) f)) * 0.02F);
this.fuseTicks = 80;
this.lastX = d0;
this.lastY = d1;
@ -41,11 +41,11 @@ public class EntityTNTPrimed extends Entity {
return false;
}
public boolean e_() {
public boolean o_() {
return !this.dead;
}
public void y_() {
public void G_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;

View file

@ -51,6 +51,8 @@ public class EntityTracker {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityPotion) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityThrownExpBottle) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityItem) {
this.addEntity(entity, 64, 20, true);
} else if (entity instanceof EntityMinecart) {
@ -128,7 +130,7 @@ public class EntityTracker {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
entitytrackerentry.track(this.world.players); // CraftBukkit
if (entitytrackerentry.m && entitytrackerentry.tracker instanceof EntityPlayer) {
if (entitytrackerentry.n && entitytrackerentry.tracker instanceof EntityPlayer) {
arraylist.add((EntityPlayer) entitytrackerentry.tracker);
}
}

View file

@ -16,17 +16,18 @@ public class EntityTrackerEntry {
public int zLoc;
public int yRot;
public int xRot;
public double i;
public int i;
public double j;
public double k;
public int l = 0;
private double o;
public double l;
public int m = 0;
private double p;
private double q;
private boolean r = false;
private double r;
private boolean s = false;
private boolean isMoving;
private int t = 0;
public boolean m = false;
private int u = 0;
public boolean n = false;
public Set trackedPlayers = new HashSet();
public EntityTrackerEntry(Entity entity, int i, int j, boolean flag) {
@ -39,6 +40,7 @@ public class EntityTrackerEntry {
this.zLoc = MathHelper.floor(entity.locZ * 32.0D);
this.yRot = MathHelper.d(entity.yaw * 256.0F / 360.0F);
this.xRot = MathHelper.d(entity.pitch * 256.0F / 360.0F);
this.i = MathHelper.d(entity.aq() * 256.0F / 360.0F);
}
public boolean equals(Object object) {
@ -50,18 +52,18 @@ public class EntityTrackerEntry {
}
public void track(List list) {
this.m = false;
if (!this.r || this.tracker.e(this.o, this.p, this.q) > 16.0D) {
this.o = this.tracker.locX;
this.p = this.tracker.locY;
this.q = this.tracker.locZ;
this.r = true;
this.m = true;
this.n = false;
if (!this.s || this.tracker.e(this.p, this.q, this.r) > 16.0D) {
this.p = this.tracker.locX;
this.q = this.tracker.locY;
this.r = this.tracker.locZ;
this.s = true;
this.n = true;
this.scanPlayers(list);
}
++this.t;
if (++this.l % this.c == 0 || this.tracker.ce) {
++this.u;
if (this.m++ % this.c == 0 || this.tracker.ce) {
int i = MathHelper.floor(this.tracker.locX * 32.0D);
int j = MathHelper.floor(this.tracker.locY * 32.0D);
int k = MathHelper.floor(this.tracker.locZ * 32.0D);
@ -87,7 +89,7 @@ public class EntityTrackerEntry {
}
// CraftBukkit end
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.t <= 400) {
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.u <= 400) {
if (flag && flag1) {
object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
} else if (flag) {
@ -96,7 +98,7 @@ public class EntityTrackerEntry {
object = new Packet32EntityLook(this.tracker.id, (byte) l, (byte) i1);
}
} else {
this.t = 0;
this.u = 0;
this.tracker.locX = (double) i / 32.0D;
this.tracker.locY = (double) j / 32.0D;
this.tracker.locZ = (double) k / 32.0D;
@ -109,17 +111,17 @@ public class EntityTrackerEntry {
}
if (this.isMoving) {
double d0 = this.tracker.motX - this.i;
double d1 = this.tracker.motY - this.j;
double d2 = this.tracker.motZ - this.k;
double d0 = this.tracker.motX - this.j;
double d1 = this.tracker.motY - this.k;
double d2 = this.tracker.motZ - this.l;
double d3 = 0.02D;
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
if (d4 > d3 * d3 || d4 > 0.0D && this.tracker.motX == 0.0D && this.tracker.motY == 0.0D && this.tracker.motZ == 0.0D) {
this.i = this.tracker.motX;
this.j = this.tracker.motY;
this.k = this.tracker.motZ;
this.broadcast(new Packet28EntityVelocity(this.tracker.id, this.i, this.j, this.k));
this.j = this.tracker.motX;
this.k = this.tracker.motY;
this.l = this.tracker.motZ;
this.broadcast(new Packet28EntityVelocity(this.tracker.id, this.j, this.k, this.l));
}
}
@ -132,6 +134,14 @@ public class EntityTrackerEntry {
if (datawatcher.a()) {
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
}
int i2 = MathHelper.d(this.tracker.aq() * 256.0F / 360.0F);
if (Math.abs(i2 - this.i) >= 4) {
this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i2));
this.i = i2;
}
/* CraftBukkit start - code moved up
if (flag) {
this.xLoc = i;
@ -310,6 +320,8 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.tracker, 61);
} else if (this.tracker instanceof EntityPotion) {
return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
} else if (this.tracker instanceof EntityThrownExpBottle) {
return new Packet23VehicleSpawn(this.tracker, 75);
} else if (this.tracker instanceof EntityEnderPearl) {
return new Packet23VehicleSpawn(this.tracker, 65);
} else if (this.tracker instanceof EntityEnderSignal) {

View file

@ -73,8 +73,8 @@ public class EntityWeatherLighting extends EntityWeather {
}
}
public void y_() {
super.y_();
public void G_() {
super.G_();
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 EntityWeatherLighting extends EntityWeather {
entity.a(this);
}
this.world.s = 2;
this.world.n = 2;
}
}

View file

@ -1,487 +0,0 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
// CraftBukkit start
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.EntityTargetEvent;
// CraftBukkit end
public class EntityWolf extends EntityAnimal {
private boolean a = false;
private float b;
private float c;
private boolean g;
private boolean h;
private float i;
private float j;
public EntityWolf(World world) {
super(world);
this.texture = "/mob/wolf.png";
this.b(0.8F, 0.8F);
this.bb = 1.1F;
}
public int getMaxHealth() {
return this.isTamed() ? 20 : 8;
}
protected void b() {
super.b();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
this.datawatcher.a(17, "");
this.datawatcher.a(18, new Integer(this.getHealth()));
}
protected boolean g_() {
return false;
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setBoolean("Angry", this.isAngry());
nbttagcompound.setBoolean("Sitting", this.isSitting());
if (this.getOwnerName() == null) {
nbttagcompound.setString("Owner", "");
} else {
nbttagcompound.setString("Owner", this.getOwnerName());
}
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
this.setAngry(nbttagcompound.getBoolean("Angry"));
this.setSitting(nbttagcompound.getBoolean("Sitting"));
String s = nbttagcompound.getString("Owner");
if (s.length() > 0) {
this.setOwnerName(s);
this.setTamed(true);
}
}
protected boolean d_() {
return this.isAngry();
}
protected String c_() {
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getInt(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
}
protected String m() {
return "mob.wolf.hurt";
}
protected String n() {
return "mob.wolf.death";
}
protected float o() {
return 0.4F;
}
protected int getLootId() {
return -1;
}
protected void m_() {
super.m_();
if (!this.e && !this.E() && this.isTamed() && this.vehicle == null) {
EntityHuman entityhuman = this.world.a(this.getOwnerName());
if (entityhuman != null) {
float f = entityhuman.h(this);
if (f > 5.0F) {
this.c(entityhuman, f);
}
} else if (!this.aK()) {
this.setSitting(true);
}
} else if (this.target == null && !this.E() && !this.isTamed() && this.world.random.nextInt(100) == 0) {
List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
if (!list.isEmpty()) {
// CraftBukkit start
Entity entity = (Entity) list.get(this.world.random.nextInt(list.size()));
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.RANDOM_TARGET);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() || event.getTarget() != null) {
this.setTarget(entity);
}
// CraftBukkit end
}
}
if (this.aK()) {
this.setSitting(false);
}
if (!this.world.isStatic) {
this.datawatcher.watch(18, Integer.valueOf(this.getHealth()));
}
}
public void d() {
super.d();
this.a = false;
if (this.aw() && !this.E() && !this.isAngry()) {
Entity entity = this.ax();
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null) {
if (!this.isTamed() && itemstack.id == Item.BONE.id) {
this.a = true;
} else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) {
this.a = ((ItemFood) Item.byId[itemstack.id]).q();
}
}
}
}
if (!this.world.isStatic && this.g && !this.h && !this.E() && this.onGround) {
this.h = true;
this.i = 0.0F;
this.j = 0.0F;
this.world.broadcastEntityEffect(this, (byte) 8);
}
}
public void y_() {
super.y_();
this.c = this.b;
if (this.a) {
this.b += (1.0F - this.b) * 0.4F;
} else {
this.b += (0.0F - this.b) * 0.4F;
}
if (this.a) {
this.bc = 10;
}
if (this.aJ()) {
this.g = true;
this.h = false;
this.i = 0.0F;
this.j = 0.0F;
} else if ((this.g || this.h) && this.h) {
if (this.i == 0.0F) {
this.world.makeSound(this, "mob.wolf.shake", this.o(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
this.j = this.i;
this.i += 0.05F;
if (this.j >= 2.0F) {
this.g = false;
this.h = false;
this.j = 0.0F;
this.i = 0.0F;
}
if (this.i > 0.4F) {
float f = (float) this.boundingBox.b;
int i = (int) (MathHelper.sin((this.i - 0.4F) * 3.1415927F) * 7.0F);
for (int j = 0; j < i; ++j) {
float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
float f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
this.world.a("splash", this.locX + (double) f1, (double) (f + 0.8F), this.locZ + (double) f2, this.motX, this.motY, this.motZ);
}
}
}
}
public float getHeadHeight() {
return this.length * 0.8F;
}
public int x() {
return this.isSitting() ? 20 : super.x();
}
private void c(Entity entity, float f) {
PathEntity pathentity = this.world.findPath(this, entity, 16.0F);
if (pathentity == null && f > 12.0F) {
int i = MathHelper.floor(entity.locX) - 2;
int j = MathHelper.floor(entity.locZ) - 2;
int k = MathHelper.floor(entity.boundingBox.b);
for (int l = 0; l <= 4; ++l) {
for (int i1 = 0; i1 <= 4; ++i1) {
if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.world.e(i + l, k - 1, j + i1) && !this.world.e(i + l, k, j + i1) && !this.world.e(i + l, k + 1, j + i1)) {
this.setPositionRotation((double) ((float) (i + l) + 0.5F), (double) k, (double) ((float) (j + i1) + 0.5F), this.yaw, this.pitch);
return;
}
}
}
} else {
this.setPathEntity(pathentity);
}
}
protected boolean v() {
return this.isSitting() || this.h;
}
public boolean damageEntity(DamageSource damagesource, int i) {
Entity entity = damagesource.getEntity();
this.setSitting(false);
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
i = (i + 1) / 2;
}
if (!super.damageEntity(damagesource, i)) {
return false;
} else {
if (!this.isTamed() && !this.isAngry()) {
if (entity instanceof EntityHuman) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.target = null;
} else {
this.setAngry(true);
this.target = ((CraftEntity) event.getTarget()).getHandle();
}
}
// CraftBukkit end
}
if (entity instanceof EntityArrow && ((EntityArrow) entity).shooter != null) {
entity = ((EntityArrow) entity).shooter;
}
if (entity instanceof EntityLiving) {
List list = this.world.a(EntityWolf.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
EntityWolf entitywolf = (EntityWolf) entity1;
if (!entitywolf.isTamed() && entitywolf.target == null) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.target = null;
} else {
entitywolf.target = (Entity) entity;
if (entity instanceof EntityHuman) {
entitywolf.setAngry(true);
}
}
}
// CraftBukkit end
}
}
}
} else if (entity != this && entity != null) {
if (this.isTamed() && entity instanceof EntityHuman && ((EntityHuman) entity).name.equalsIgnoreCase(this.getOwnerName())) {
return true;
}
this.target = entity;
}
return true;
}
}
protected Entity findTarget() {
return this.isAngry() ? this.world.findNearbyPlayer(this, 16.0D) : null;
}
protected void a(Entity entity, float f) {
if (f > 2.0F && f < 6.0F && this.random.nextInt(10) == 0) {
if (this.onGround) {
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1);
this.motX = d0 / (double) f1 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D;
this.motZ = d1 / (double) f1 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D;
this.motY = 0.4000000059604645D;
}
} else if ((double) f < 1.5D && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
byte b0 = 2;
if (this.isTamed()) {
b0 = 4;
}
// CraftBukkit start
org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = entity == null ? null : entity.getBukkitEntity();
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, b0);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
entity.damageEntity(DamageSource.mobAttack(this), event.getDamage());
// CraftBukkit end
}
}
public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (!this.isTamed()) {
if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
--itemstack.count;
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
if (!this.world.isStatic) {
// CraftBukkit start - added event call and isCancelled check.
if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
// CraftBukkit end
this.setTamed(true);
this.setPathEntity((PathEntity) null);
this.setSitting(true);
this.setHealth(20);
this.setOwnerName(entityhuman.name);
this.a(true);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {
this.a(false);
this.world.broadcastEntityEffect(this, (byte) 6);
}
}
return true;
}
} else {
if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) {
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
if (itemfood.q() && this.datawatcher.getInt(18) < 20) {
--itemstack.count;
this.heal(itemfood.getNutrition(), RegainReason.EATING); // CraftBukkit
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
return true;
}
}
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) {
if (!this.world.isStatic) {
this.setSitting(!this.isSitting());
this.aZ = false;
this.setPathEntity((PathEntity) null);
}
return true;
}
}
return super.b(entityhuman);
}
void a(boolean flag) {
String s = "heart";
if (!flag) {
s = "smoke";
}
for (int i = 0; i < 7; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D;
this.world.a(s, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2);
}
}
public int p() {
return 8;
}
public String getOwnerName() {
return this.datawatcher.getString(17);
}
public void setOwnerName(String s) {
this.datawatcher.watch(17, s);
}
public boolean isSitting() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
public void setSitting(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
} else {
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
}
}
public boolean isAngry() {
return (this.datawatcher.getByte(16) & 2) != 0;
}
public void setAngry(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 2)));
} else {
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -3)));
}
}
public boolean isTamed() {
return (this.datawatcher.getByte(16) & 4) != 0;
}
public void setTamed(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 4)));
} else {
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -5)));
}
}
protected EntityAnimal createChild(EntityAnimal entityanimal) {
return new EntityWolf(this.world);
}
}

View file

@ -7,30 +7,38 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) {
super(world);
this.texture = "/mob/zombie.png";
this.bb = 0.5F;
this.bb = 0.23F;
this.damage = 4;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, world, 16.0F));
this.goalSelector.a(3, new PathfinderGoalRandomStroll(this));
this.goalSelector.a(4, new PathfinderGoalLookAtPlayer(this, world, 8.0F));
this.goalSelector.a(4, new PathfinderGoalRandomLookaround(this));
this.ak().b(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalBreakDoor(this));
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bb, false));
this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bb, true));
this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bb));
this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bb, false));
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bb));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 16.0F, 0, false));
}
public int getMaxHealth() {
return 20;
}
public int P() {
public int S() {
return 2;
}
protected boolean as() {
return false;
protected boolean c_() {
return true;
}
public void d() {
public void e() {
if (this.world.e() && !this.world.isStatic) {
float f = this.a(1.0F);
float f = this.b(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start
@ -44,18 +52,18 @@ public class EntityZombie extends EntityMonster {
}
}
super.d();
super.e();
}
protected String c_() {
protected String i() {
return "mob.zombie";
}
protected String m() {
protected String j() {
return "mob.zombiehurt";
}
protected String n() {
protected String k() {
return "mob.zombiedeath";
}
@ -66,4 +74,23 @@ public class EntityZombie extends EntityMonster {
public MonsterType getMonsterType() {
return MonsterType.UNDEAD;
}
protected void b(int i) {
switch (this.random.nextInt(4)) {
case 0:
this.b(Item.IRON_SWORD.id, 1);
break;
case 1:
this.b(Item.IRON_HELMET.id, 1);
break;
case 2:
this.b(Item.IRON_INGOT.id, 1);
break;
case 3:
this.b(Item.IRON_SPADE.id, 1);
}
}
}

View file

@ -78,7 +78,7 @@ public class Explosion {
f1 -= (Block.byId[k1].a(this.source) + 0.3F) * f2;
}
if (f1 > 0.0F && i1 < world.height && i1 >= 0) { // CraftBukkit - Don't wrap explosions
if (f1 > 0.0F && i1 < 256 && i1 >= 0) { // CraftBukkit - Don't wrap explosions
this.blocks.add(new ChunkPosition(l, i1, j1));
}
@ -256,7 +256,7 @@ public class Explosion {
i1 = this.world.getTypeId(j, k, l);
int j1 = this.world.getTypeId(j, k - 1, l);
if (i1 == 0 && Block.o[j1] && this.h.nextInt(3) == 0) {
if (i1 == 0 && Block.n[j1] && this.h.nextInt(3) == 0) {
this.world.setTypeId(j, k, l, Block.FIRE.id);
}
}

View file

@ -42,7 +42,7 @@ public class FoodMetaData {
}
}
if (this.foodLevel >= 18 && entityhuman.ab()) {
if (this.foodLevel >= 18 && entityhuman.af()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason.

View file

@ -16,6 +16,8 @@ public interface IInventory {
ItemStack splitStack(int i, int j);
ItemStack splitWithoutUpdate(int i);
void setItem(int i, ItemStack itemstack);
String getName();

View file

@ -54,6 +54,17 @@ public class InventoryCraftResult implements IInventory {
}
}
public ItemStack splitWithoutUpdate(int i) {
if (this.items[i] != null) {
ItemStack itemstack = this.items[i];
this.items[i] = null;
return itemstack;
} else {
return null;
}
}
public void setItem(int i, ItemStack itemstack) {
this.items[i] = itemstack;
}

View file

@ -73,7 +73,18 @@ public class InventoryCrafting implements IInventory {
}
public String getName() {
return "Crafting";
return "container.crafting";
}
public ItemStack splitWithoutUpdate(int i) {
if (this.items[i] != null) {
ItemStack itemstack = this.items[i];
this.items[i] = null;
return itemstack;
} else {
return null;
}
}
public ItemStack splitStack(int i, int j) {

View file

@ -77,6 +77,10 @@ public class InventoryLargeChest implements IInventory {
return i >= this.left.getSize() ? this.right.splitStack(i - this.left.getSize(), j) : this.left.splitStack(i, j);
}
public ItemStack splitWithoutUpdate(int i) {
return i >= this.left.getSize() ? this.right.splitWithoutUpdate(i - this.left.getSize()) : this.left.splitWithoutUpdate(i);
}
public void setItem(int i, ItemStack itemstack) {
if (i >= this.left.getSize()) {
this.right.setItem(i - this.left.getSize(), itemstack);

View file

@ -25,8 +25,8 @@ public class ItemBlock extends Item {
int i1 = world.getTypeId(i, j, k);
if (i1 == Block.SNOW.id) {
l = 0;
} else if (i1 != Block.VINE.id) {
l = 1;
} else if (i1 != Block.VINE.id && i1 != Block.LONG_GRASS.id && i1 != Block.DEAD_BUSH.id) {
if (l == 0) {
--j;
}
@ -56,7 +56,7 @@ public class ItemBlock extends Item {
return false;
} else if (!entityhuman.d(i, j, k)) {
return false;
} else if (j == world.height - 1 && Block.byId[this.id].material.isBuildable()) {
} else if (j == 255 && Block.byId[this.id].material.isBuildable()) {
return false;
}
// CraftBukkit start
@ -82,8 +82,8 @@ public class ItemBlock extends Item {
if (Block.byId[id] != null) {
Block.byId[id].postPlace(world, i, j, k, l);
Block.byId[id].postPlace(world, i, j, k, entityhuman);
// CraftBukkit end
}
// CraftBukkit end
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
@ -96,10 +96,10 @@ public class ItemBlock extends Item {
}
public String a(ItemStack itemstack) {
return Block.byId[this.id].n();
return Block.byId[this.id].p();
}
public String getName() {
return Block.byId[this.id].n();
return Block.byId[this.id].p();
}
}

View file

@ -36,7 +36,7 @@ public class ItemBoat extends Item {
if (movingobjectposition == null) {
return itemstack;
} else {
Vec3D vec3d2 = entityhuman.e(f);
Vec3D vec3d2 = entityhuman.f(f);
boolean flag = false;
float f9 = 1.0F;
List list = world.getEntities(entityhuman, entityhuman.boundingBox.a(vec3d2.a * d3, vec3d2.b * d3, vec3d2.c * d3).grow((double) f9, (double) f9, (double) f9));
@ -44,7 +44,7 @@ public class ItemBoat extends Item {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
if (entity.e_()) {
if (entity.o_()) {
float f10 = entity.j_();
AxisAlignedBB axisalignedbb = entity.boundingBox.grow((double) f10, (double) f10, (double) f10);

View file

@ -16,7 +16,7 @@ public class ItemBow extends Item {
public void a(ItemStack itemstack, World world, EntityHuman entityhuman, int i) {
boolean flag = entityhuman.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0;
if (flag || entityhuman.inventory.c(Item.ARROW.id)) {
if (flag || entityhuman.inventory.d(Item.ARROW.id)) {
int j = this.c(itemstack) - i;
float f = (float) j / 20.0F;
@ -38,7 +38,7 @@ public class ItemBow extends Item {
int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack);
if (k > 0) {
entityarrow.a(entityarrow.j() + (double) k * 0.5D + 0.5D);
entityarrow.a(entityarrow.k() + (double) k * 0.5D + 0.5D);
}
int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack);
@ -66,7 +66,7 @@ public class ItemBow extends Item {
itemstack.damage(1, entityhuman);
world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (c.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (!flag) {
entityhuman.inventory.b(Item.ARROW.id);
entityhuman.inventory.c(Item.ARROW.id);
} else {
entityarrow.fromPlayer = false;
}
@ -86,7 +86,7 @@ public class ItemBow extends Item {
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.c(Item.ARROW.id)) {
if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.d(Item.ARROW.id)) {
entityhuman.a(itemstack, this.c(itemstack));
}

View file

@ -51,7 +51,6 @@ public class ItemBucket extends Item {
return itemstack;
}
world.setTypeId(i, j, k, 0);
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
@ -68,7 +67,6 @@ public class ItemBucket extends Item {
return itemstack;
}
world.setTypeId(i, j, k, 0);
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}

View file

@ -88,11 +88,6 @@ public class ItemDoor extends Item {
flag2 = true;
}
if (flag2) {
l = l - 1 & 3;
l += 4;
}
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
world.suppressPhysics = true;
world.setTypeIdAndData(i, j, k, block.id, l);
@ -106,7 +101,7 @@ public class ItemDoor extends Item {
}
}
// CraftBukkit end
world.setTypeIdAndData(i, j + 1, k, block.id, l + 8);
world.setTypeIdAndData(i, j + 1, k, block.id, 8 | (flag2 ? 1 : 0));
world.suppressPhysics = false;
world.applyPhysics(i, j, k, block.id);
world.applyPhysics(i, j + 1, k, block.id);

View file

@ -12,10 +12,10 @@ public class ItemFishingRod extends Item {
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.hookedFish != null) {
int i = entityhuman.hookedFish.j();
int i = entityhuman.hookedFish.k();
itemstack.damage(i, entityhuman);
entityhuman.s_();
entityhuman.D();
} else {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
@ -31,7 +31,7 @@ public class ItemFishingRod extends Item {
world.addEntity(new EntityFishingHook(world, entityhuman));
}
entityhuman.s_();
entityhuman.D();
}
return itemstack;

View file

@ -4,20 +4,20 @@ public class ItemFood extends Item {
public final int a;
private final int b;
private final float bS;
private final boolean bT;
private boolean bU;
private int bV;
private int bW;
private final float bU;
private final boolean bV;
private boolean bW;
private int bX;
private float bY;
private int bY;
private int bZ;
private float ca;
public ItemFood(int i, int j, float f, boolean flag) {
super(i);
this.a = 32;
this.b = j;
this.bT = flag;
this.bS = f;
this.bV = flag;
this.bU = f;
}
public ItemFood(int i, int j, boolean flag) {
@ -36,8 +36,8 @@ public class ItemFood extends Item {
}
// CraftBukkit end
if (!world.isStatic && this.bV > 0 && world.random.nextFloat() < this.bY) {
entityhuman.addEffect(new MobEffect(this.bV, this.bW * 20, this.bX));
if (!world.isStatic && this.bX > 0 && world.random.nextFloat() < this.ca) {
entityhuman.addEffect(new MobEffect(this.bX, this.bY * 20, this.bZ));
}
return itemstack;
@ -52,7 +52,7 @@ public class ItemFood extends Item {
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.b(this.bU)) {
if (entityhuman.b(this.bW)) {
entityhuman.a(itemstack, this.c(itemstack));
}
@ -64,23 +64,23 @@ public class ItemFood extends Item {
}
public float getSaturationModifier() {
return this.bS;
return this.bU;
}
public boolean q() {
return this.bT;
return this.bV;
}
public ItemFood a(int i, int j, int k, float f) {
this.bV = i;
this.bW = j;
this.bX = k;
this.bY = f;
this.bX = i;
this.bY = j;
this.bZ = k;
this.ca = f;
return this;
}
public ItemFood r() {
this.bU = true;
this.bW = true;
return this;
}

View file

@ -226,20 +226,20 @@ public class ItemInWorldManager {
int l = this.world.getTypeId(i, j, k);
int i1 = this.world.getData(i, j, k);
this.world.a(this.player, 2001, i, j, k, l + this.world.getData(i, j, k) * 256);
this.world.a(this.player, 2001, i, j, k, l + (this.world.getData(i, j, k) << 12));
boolean flag = this.b(i, j, k);
if (this.isCreative()) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
ItemStack itemstack = this.player.Q();
ItemStack itemstack = this.player.T();
boolean flag1 = this.player.b(Block.byId[l]);
if (itemstack != null) {
itemstack.a(l, i, j, k, this.player);
if (itemstack.count == 0) {
itemstack.a(this.player);
this.player.R();
this.player.U();
}
}

View file

@ -4,7 +4,6 @@ public class ItemMonsterEgg extends Item {
public ItemMonsterEgg(int i) {
super(i);
this.e(1);
this.a(true);
}
@ -12,21 +11,38 @@ public class ItemMonsterEgg extends Item {
if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63) { // CraftBukkit
return true;
} else {
int i1 = world.getTypeId(i, j, k);
i += Facing.b[l];
j += Facing.c[l];
k += Facing.d[l];
Entity entity = EntityTypes.a(itemstack.getData(), world);
double d0 = 0.0D;
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
if (l == 1 && i1 == Block.FENCE.id || i1 == Block.NETHER_FENCE.id) {
d0 = 0.5D;
}
entity.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F);
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
if (a(world, itemstack.getData(), (double) i + 0.5D, (double) j + d0, (double) k + 0.5D) && !entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
return true;
}
}
public static boolean a(World world, int i, double d0, double d1, double d2) {
if (!EntityTypes.a.containsKey(Integer.valueOf(i))) {
return false;
} else {
Entity entity = EntityTypes.a(i, world);
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
entity.setPositionRotation(d0, d1, d2, world.random.nextFloat() * 360.0F, 0.0F);
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
((EntityLiving) entity).ay();
}
return entity != null;
}
}
}

View file

@ -58,16 +58,14 @@ public class ItemRedstone extends Item {
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ);
blockState.update(true);
world.suppressPhysics = false;
if (event.isCancelled() || !event.canBuild()) {
return false;
}
world.suppressPhysics = false;
world.setTypeId(i, j, k, Block.REDSTONE_WIRE.id);
world.update(i, j, k, Block.REDSTONE_WIRE.id); // Must take place after BlockPlaceEvent, we need to update all other blocks.
// CraftBukkit end
--itemstack.count; // CraftBukkit - ORDER MATTERS
--itemstack.count;
world.setTypeId(i, j, k, Block.REDSTONE_WIRE.id);
}
return true;

View file

@ -20,8 +20,8 @@ public class ItemReed extends Item {
int i1 = world.getTypeId(i, j, k);
if (i1 == Block.SNOW.id) {
l = 0;
} else if (i1 != Block.VINE.id) {
l = 1;
} else if (i1 != Block.VINE.id && i1 != Block.LONG_GRASS.id && i1 != Block.DEAD_BUSH.id) {
if (l == 0) {
--j;
}

View file

@ -150,7 +150,7 @@ public final class ItemStack {
}
public void setData(int i) {
this.damage = (this.id > 0) && (this.id < 256) ? Item.byId[this.id].filterData(i) : i; // CraftBukkit
this.damage = (this.id > 0) && (this.id < Block.byId.length) ? Item.byId[this.id].filterData(i) : i; // CraftBukkit
}
public int i() {
@ -263,8 +263,8 @@ public final class ItemStack {
Item.byId[this.id].a(this, world, entity, i, flag);
}
public void c(World world, EntityHuman entityhuman) {
entityhuman.a(StatisticList.D[this.id], this.count);
public void a(World world, EntityHuman entityhuman, int i) {
entityhuman.a(StatisticList.D[this.id], i);
Item.byId[this.id].d(this, world, entityhuman);
}
@ -280,7 +280,7 @@ public final class ItemStack {
return this.getItem().d(this);
}
public void a(World world, EntityHuman entityhuman, int i) {
public void b(World world, EntityHuman entityhuman, int i) {
this.getItem().a(this, world, entityhuman, i);
}

View file

@ -23,10 +23,6 @@ public class ItemStep extends ItemBlock {
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l != 1) {
;
}
if (itemstack.count == 0) {
return false;
} else if (!entityhuman.d(i, j, k)) {
@ -34,8 +30,10 @@ public class ItemStep extends ItemBlock {
} else {
int i1 = world.getTypeId(i, j, k);
int j1 = world.getData(i, j, k);
int k1 = j1 & 7;
boolean flag = (j1 & 8) != 0;
if (l == 1 && i1 == Block.STEP.id && j1 == itemstack.getData()) {
if ((l == 1 && !flag || l == 0 && flag) && i1 == Block.STEP.id && k1 == itemstack.getData()) {
/* CraftBukkit start - handle this in super
if (world.setTypeIdAndData(i, j, k, Block.DOUBLE_STEP.id, j1)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), Block.DOUBLE_STEP.stepSound.getName(), (Block.DOUBLE_STEP.stepSound.getVolume1() + 1.0F) / 2.0F, Block.DOUBLE_STEP.stepSound.getVolume2() * 0.8F);

View file

@ -48,7 +48,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2;
int j1 = 128 / i;
if (world.worldProvider.f) {
if (world.worldProvider.e) {
j1 /= 2;
}
@ -82,7 +82,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
int l4;
int i5;
if (world.worldProvider.f) {
if (world.worldProvider.e) {
l4 = i3 + j3 * 231871;
l4 = l4 * l4 * 31287121 + l4 * 11;
if ((l4 >> 20 & 1) == 0) {
@ -106,7 +106,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
if (j5 == 0) {
flag1 = false;
} else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.E == MaterialMapColor.b) {
} else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.F == MaterialMapColor.b) {
flag1 = false;
}
@ -164,7 +164,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
i5 = 0;
if (j4 > 0) {
MaterialMapColor materialmapcolor = Block.byId[j4].material.E;
MaterialMapColor materialmapcolor = Block.byId[j4].material.F;
if (materialmapcolor == MaterialMapColor.n) {
d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;

Some files were not shown because too many files have changed in this diff Show more