Archiviert
13
0

Update for Minecraft 1.8

Dieser Commit ist enthalten in:
Dinnerbone 2011-09-15 01:23:52 +01:00
Ursprung 54bcd1c1f3
Commit 5b2c774edc
107 geänderte Dateien mit 4415 neuen und 3504 gelöschten Zeilen

Datei anzeigen

@ -39,7 +39,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId> <artifactId>minecraft-server</artifactId>
<version>1.7.3</version> <version>1.8</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

Datei anzeigen

@ -39,7 +39,7 @@ public class Block {
public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).a("oreIron"); public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).a("oreIron");
public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).a("oreCoal"); public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).a("oreCoal");
public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).a("log").g(); public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).a("log").g();
public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).f(1).a(g).a("leaves").n().g(); public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).f(1).a(g).a("leaves").g();
public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).a("sponge"); public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).a("sponge");
public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).a("glass"); public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).a("glass");
public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).a("oreLapis"); public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).a("oreLapis");
@ -72,7 +72,7 @@ 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 MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).a("stoneMoss");
public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(10.0F).b(2000.0F).a(h).a("obsidian"); public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(10.0F).b(2000.0F).a(h).a("obsidian");
public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).a("torch").g(); public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).a("torch").g();
public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").n().g(); public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).a("fire").n();
public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").n(); public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).a("mobSpawner").n();
public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").g(); public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD)).a("stairsWood").g();
public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").g(); public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).a("chest").g();
@ -81,7 +81,7 @@ public class Block {
public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond"); public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).a("blockDiamond");
public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench"); public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).a("workbench");
public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").n().g(); public static final Block CROPS = (new BlockCrops(59, 88)).c(0.0F).a(g).a("crops").n().g();
public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland"); public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).a("farmland").g();
public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").g(); public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).a("furnace").g();
public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).a("furnace").g(); public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).a("furnace").g();
public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").n().g(); public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).a("sign").n().g();
@ -106,7 +106,7 @@ public class Block {
public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).a("clay"); public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).a("clay");
public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").n(); public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).a("reeds").n();
public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").g(); public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).a("jukebox").g();
public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).a("fence").g(); public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).a("fence");
public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).a("pumpkin").g(); public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).a("pumpkin").g();
public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).a("hellrock"); public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).a("hellrock");
public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).a("hellsand"); public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).a("hellsand");
@ -118,12 +118,25 @@ public class Block {
public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").n().g(); public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).a("diode").n().g();
public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).a("lockedchest").a(true).g(); public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).a("lockedchest").a(true).g();
public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").n().g(); public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).a("trapdoor").n().g();
public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F);
public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).a("stonebricksmooth");
public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).a("mushroom").g();
public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).a("mushroom").g();
public static final Block IRON_FENCE = (new BlockThin(101, 85, 85, Material.ORE)).c(5.0F).b(10.0F).a(i).a("fenceIron");
public static final Block THIN_GLASS = (new BlockThin(102, 49, 148, Material.SHATTERABLE)).c(0.3F).a(j).a("thinGlass");
public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).a("melon");
public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).a("pumpkinStem").g();
public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).a("pumpkinStem").g();
public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).a("vine").g();
public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).a("fenceGate").g();
public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK)).a("stairsBrick").g();
public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK)).a("stairsStoneBrickSmooth").g();
public int textureId; public int textureId;
public final int id; public final int id;
protected float strength; protected float strength;
protected float durability; protected float durability;
protected boolean bq; protected boolean bD;
protected boolean br; protected boolean bE;
public double minX; public double minX;
public double minY; public double minY;
public double minZ; public double minZ;
@ -131,16 +144,16 @@ public class Block {
public double maxY; public double maxY;
public double maxZ; public double maxZ;
public StepSound stepSound; public StepSound stepSound;
public float bz; public float bM;
public final Material material; public final Material material;
public float frictionFactor; public float frictionFactor;
private String name; private String name;
protected Block(int i, Material material) { protected Block(int i, Material material) {
this.bq = true; this.bD = true;
this.br = true; this.bE = true;
this.stepSound = d; this.stepSound = d;
this.bz = 1.0F; this.bM = 1.0F;
this.frictionFactor = 0.6F; this.frictionFactor = 0.6F;
if (byId[i] != null) { if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this); throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
@ -253,10 +266,10 @@ public class Block {
} }
public boolean a(int i, boolean flag) { public boolean a(int i, boolean flag) {
return this.k_(); return this.q_();
} }
public boolean k_() { public boolean q_() {
return true; return true;
} }
@ -270,7 +283,7 @@ public class Block {
return 10; return 10;
} }
public void c(World world, int i, int j, int k) {} public void a(World world, int i, int j, int k) {}
public void remove(World world, int i, int j, int k) {} public void remove(World world, int i, int j, int k) {}
@ -329,7 +342,7 @@ public class Block {
} }
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
this.a(world, i, j, k); this.a((IBlockAccess) world, i, j, k);
vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k)); vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k));
vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k)); vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k));
Vec3D vec3d2 = vec3d.a(vec3d1, this.minX); Vec3D vec3d2 = vec3d.a(vec3d1, this.minX);
@ -365,27 +378,27 @@ public class Block {
Vec3D vec3d8 = null; Vec3D vec3d8 = null;
if (vec3d2 != null && (vec3d8 == null || vec3d.a(vec3d2) < vec3d.a(vec3d8))) { if (vec3d2 != null && (vec3d8 == null || vec3d.b(vec3d2) < vec3d.b(vec3d8))) {
vec3d8 = vec3d2; vec3d8 = vec3d2;
} }
if (vec3d3 != null && (vec3d8 == null || vec3d.a(vec3d3) < vec3d.a(vec3d8))) { if (vec3d3 != null && (vec3d8 == null || vec3d.b(vec3d3) < vec3d.b(vec3d8))) {
vec3d8 = vec3d3; vec3d8 = vec3d3;
} }
if (vec3d4 != null && (vec3d8 == null || vec3d.a(vec3d4) < vec3d.a(vec3d8))) { if (vec3d4 != null && (vec3d8 == null || vec3d.b(vec3d4) < vec3d.b(vec3d8))) {
vec3d8 = vec3d4; vec3d8 = vec3d4;
} }
if (vec3d5 != null && (vec3d8 == null || vec3d.a(vec3d5) < vec3d.a(vec3d8))) { if (vec3d5 != null && (vec3d8 == null || vec3d.b(vec3d5) < vec3d.b(vec3d8))) {
vec3d8 = vec3d5; vec3d8 = vec3d5;
} }
if (vec3d6 != null && (vec3d8 == null || vec3d.a(vec3d6) < vec3d.a(vec3d8))) { if (vec3d6 != null && (vec3d8 == null || vec3d.b(vec3d6) < vec3d.b(vec3d8))) {
vec3d8 = vec3d6; vec3d8 = vec3d6;
} }
if (vec3d7 != null && (vec3d8 == null || vec3d.a(vec3d7) < vec3d.a(vec3d8))) { if (vec3d7 != null && (vec3d8 == null || vec3d.b(vec3d7) < vec3d.b(vec3d8))) {
vec3d8 = vec3d7; vec3d8 = vec3d7;
} }
@ -434,7 +447,7 @@ public class Block {
return vec3d == null ? false : vec3d.a >= this.minX && vec3d.a <= this.maxX && vec3d.b >= this.minY && vec3d.b <= this.maxY; return vec3d == null ? false : vec3d.a >= this.minX && vec3d.a <= this.maxX && vec3d.b >= this.minY && vec3d.b <= this.maxY;
} }
public void d(World world, int i, int j, int k) {} public void a_(World world, int i, int j, int k) {}
public boolean canPlace(World world, int i, int j, int k, int l) { public boolean canPlace(World world, int i, int j, int k, int l) {
return this.canPlace(world, i, j, k); return this.canPlace(world, i, j, k);
@ -476,6 +489,7 @@ public class Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1); entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.b(0.025F);
this.g(world, i, j, k, l); this.g(world, i, j, k, l);
} }
@ -501,24 +515,27 @@ public class Block {
public void a(World world, int i, int j, int k, int l, int i1) {} public void a(World world, int i, int j, int k, int l, int i1) {}
public boolean m() { public boolean m() {
return this.br; return this.bE;
} }
protected Block n() { protected Block n() {
this.br = false; this.bE = false;
return this; return this;
} }
public int e() { public int e() {
return this.material.j(); return this.material.l();
} }
static { static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth"); Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth");
Item.byId[LOG.id] = (new ItemLog(LOG.id - 256)).a("log"); Item.byId[LOG.id] = (new ItemLog(LOG.id - 256, LOG)).a("log");
Item.byId[SMOOTH_BRICK.id] = (new ItemLog(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).a("stonebricksmooth");
Item.byId[STEP.id] = (new ItemStep(STEP.id - 256)).a("stoneSlab"); Item.byId[STEP.id] = (new ItemStep(STEP.id - 256)).a("stoneSlab");
Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling"); Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling");
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves"); Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves");
Item.byId[VINE.id] = new ItemColoredBlock(VINE.id - 256, false);
Item.byId[LONG_GRASS.id] = new ItemColoredBlock(LONG_GRASS.id - 256, true);
Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256); Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256);
Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256); Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256);

Datei anzeigen

@ -90,12 +90,12 @@ public class BlockCactus extends Block {
world.getServer().getPluginManager().callEvent(event); world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
entity.damageEntity((Entity) null, event.getDamage()); entity.damageEntity(DamageSource.g, event.getDamage());
} }
return; return;
} }
// CraftBukkit end // CraftBukkit end
entity.damageEntity((Entity) null, 1); entity.damageEntity(DamageSource.g, 1);
} }
} }

Datei anzeigen

@ -25,8 +25,8 @@ public class BlockDispenser extends BlockContainer {
return Block.DISPENSER.id; return Block.DISPENSER.id;
} }
public void c(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
super.c(world, i, j, k); super.a(world, i, j, k);
this.g(world, i, j, k); this.g(world, i, j, k);
} }
@ -68,12 +68,15 @@ public class BlockDispenser extends BlockContainer {
} else { } else {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k); TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
entityhuman.a(tileentitydispenser); if (tileentitydispenser != null) {
entityhuman.a(tileentitydispenser);
}
return true; return true;
} }
} }
// CraftBukkit - private -> public // CraftBukkit - priv to public
public void dispense(World world, int i, int j, int k, Random random) { public void dispense(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
byte b0 = 0; byte b0 = 0;
@ -90,85 +93,88 @@ public class BlockDispenser extends BlockContainer {
} }
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k); TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
// CraftBukkit start
int dispenseSlot = tileentitydispenser.findDispenseSlot();
ItemStack itemstack = null;
if (dispenseSlot > -1) {
itemstack = tileentitydispenser.getContents()[dispenseSlot];
// Copy item stack, because we want it to have 1 item if (tileentitydispenser != null) {
itemstack = new ItemStack(itemstack.id, 1, itemstack.damage);
}
// CraftBukkit end
double d0 = (double) i + (double) b0 * 0.6D + 0.5D;
double d1 = (double) j + 0.5D;
double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
if (itemstack == null) {
world.e(1001, i, j, k, 0);
} else {
// CraftBukkit start // CraftBukkit start
double d3 = random.nextDouble() * 0.1D + 0.2D; int dispenseSlot = tileentitydispenser.findDispenseSlot();
double motX = (double) b0 * d3; ItemStack itemstack = null;
double motY = 0.20000000298023224D; if (dispenseSlot > -1) {
double motZ = (double) b1 * d3; itemstack = tileentitydispenser.getContents()[dispenseSlot];
motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k); // Copy item stack, because we want it to have 1 item
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone(); itemstack = new ItemStack(itemstack.id, 1, itemstack.damage);
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
} }
// Actually remove the item
tileentitydispenser.splitStack(dispenseSlot, 1);
motX = event.getVelocity().getX();
motY = event.getVelocity().getY();
motZ = event.getVelocity().getZ();
itemstack = new ItemStack(event.getItem().getTypeId(), event.getItem().getAmount(), event.getItem().getDurability());
// CraftBukkit end // CraftBukkit end
if (itemstack.id == Item.ARROW.id) { double d0 = (double) i + (double) b0 * 0.6D + 0.5D;
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2); double d1 = (double) j + 0.5D;
double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
entityarrow.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F); if (itemstack == null) {
entityarrow.fromPlayer = true; world.e(1001, i, j, k, 0);
world.addEntity(entityarrow);
world.e(1002, i, j, k, 0);
} else if (itemstack.id == Item.EGG.id) {
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entityegg);
world.e(1002, i, j, k, 0);
} else if (itemstack.id == Item.SNOW_BALL.id) {
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entitysnowball);
world.e(1002, i, j, k, 0);
} else { } else {
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
// CraftBukkit start // CraftBukkit start
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up double d3 = random.nextDouble() * 0.1D + 0.2D;
entityitem.motX = motX; double motX = (double) b0 * d3;
entityitem.motY = motY; double motY = 0.20000000298023224D;
entityitem.motZ = motZ; double motZ = (double) b1 * d3;
// CraftBukkit end motX += random.nextGaussian() * 0.007499999832361937D * 6.0D;
world.addEntity(entityitem); motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
world.e(1000, i, j, k, 0); motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
}
world.e(2000, i, j, k, b0 + 1 + (b1 + 1) * 3); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
// Actually remove the item
tileentitydispenser.splitStack(dispenseSlot, 1);
motX = event.getVelocity().getX();
motY = event.getVelocity().getY();
motZ = event.getVelocity().getZ();
itemstack = new ItemStack(event.getItem().getTypeId(), event.getItem().getAmount(), event.getItem().getDurability());
// CraftBukkit end
if (itemstack.id == Item.ARROW.id) {
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
entityarrow.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
entityarrow.fromPlayer = true;
world.addEntity(entityarrow);
world.e(1002, i, j, k, 0);
} else if (itemstack.id == Item.EGG.id) {
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entityegg);
world.e(1002, i, j, k, 0);
} else if (itemstack.id == Item.SNOW_BALL.id) {
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entitysnowball);
world.e(1002, i, j, k, 0);
} else {
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
// CraftBukkit start
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
entityitem.motX = motX;
entityitem.motY = motY;
entityitem.motZ = motZ;
// CraftBukkit end
world.addEntity(entityitem);
world.e(1000, i, j, k, 0);
}
world.e(2000, i, j, k, b0 + 1 + (b1 + 1) * 3);
}
} }
} }
@ -188,7 +194,7 @@ public class BlockDispenser extends BlockContainer {
} }
} }
protected TileEntity a_() { public TileEntity a_() {
return new TileEntityDispenser(); return new TileEntityDispenser();
} }
@ -215,29 +221,31 @@ public class BlockDispenser extends BlockContainer {
public void remove(World world, int i, int j, int k) { public void remove(World world, int i, int j, int k) {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k); TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
for (int l = 0; l < tileentitydispenser.getSize(); ++l) { if (tileentitydispenser != null) {
ItemStack itemstack = tileentitydispenser.getItem(l); for (int l = 0; l < tileentitydispenser.getSize(); ++l) {
ItemStack itemstack = tileentitydispenser.getItem(l);
if (itemstack != null) { if (itemstack != null) {
float f = this.a.nextFloat() * 0.8F + 0.1F; float f = this.a.nextFloat() * 0.8F + 0.1F;
float f1 = this.a.nextFloat() * 0.8F + 0.1F; float f1 = this.a.nextFloat() * 0.8F + 0.1F;
float f2 = this.a.nextFloat() * 0.8F + 0.1F; float f2 = this.a.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) { while (itemstack.count > 0) {
int i1 = this.a.nextInt(21) + 10; int i1 = this.a.nextInt(21) + 10;
if (i1 > itemstack.count) { if (i1 > itemstack.count) {
i1 = itemstack.count; i1 = itemstack.count;
}
itemstack.count -= i1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData()));
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
world.addEntity(entityitem);
} }
itemstack.count -= i1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData()));
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
world.addEntity(entityitem);
} }
} }
} }

Datei anzeigen

@ -198,7 +198,8 @@ public class BlockDoor extends Block {
} }
public boolean canPlace(World world, int i, int j, int k) { public boolean canPlace(World world, int i, int j, int k) {
return j >= 127 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k); world.getClass();
return j >= 128 - 1 ? false : world.e(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
} }
public static boolean e(int i) { public static boolean e(int i) {

Datei anzeigen

@ -30,6 +30,7 @@ public class BlockFire extends Block {
this.a(Block.TNT.id, 15, 100); this.a(Block.TNT.id, 15, 100);
this.a(Block.LONG_GRASS.id, 60, 100); this.a(Block.LONG_GRASS.id, 60, 100);
this.a(Block.WOOL.id, 30, 60); this.a(Block.WOOL.id, 30, 60);
this.a(Block.VINE.id, 15, 100);
} }
private void a(int i, int j, int k) { private void a(int i, int j, int k) {
@ -64,7 +65,7 @@ public class BlockFire extends Block {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} }
if (!flag && world.v() && (world.s(i, j, k) || world.s(i - 1, j, k) || world.s(i + 1, j, k) || world.s(i, j, k - 1) || world.s(i, j, k + 1))) { if (!flag && world.u() && (world.s(i, j, k) || world.s(i - 1, j, k) || world.s(i + 1, j, k) || world.s(i, j, k - 1) || world.s(i, j, k + 1))) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } else {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
@ -111,7 +112,7 @@ public class BlockFire extends Block {
if (i2 > 0) { if (i2 > 0) {
int j2 = (i2 + 40) / (l + 30); int j2 = (i2 + 40) / (l + 30);
if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.v() || !world.s(i1, k1, j1)) && !world.s(i1 - 1, k1, k) && !world.s(i1 + 1, k1, j1) && !world.s(i1, k1, j1 - 1) && !world.s(i1, k1, j1 + 1)) { if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.u() || !world.s(i1, k1, j1)) && !world.s(i1 - 1, k1, k) && !world.s(i1 + 1, k1, j1) && !world.s(i1, k1, j1 - 1) && !world.s(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4; int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) { if (k2 > 15) {
@ -205,7 +206,7 @@ public class BlockFire extends Block {
} }
} }
public boolean k_() { public boolean q_() {
return false; return false;
} }
@ -229,8 +230,8 @@ public class BlockFire extends Block {
} }
} }
public void c(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.a_(world, i, j, k)) { if (world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.b_(world, i, j, k)) {
if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) { if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } else {

Datei anzeigen

@ -292,8 +292,8 @@ public class BlockFlowing extends BlockFluids {
return material == this.material ? false : (material == Material.LAVA ? false : !this.k(world, i, j, k)); return material == this.material ? false : (material == Material.LAVA ? false : !this.k(world, i, j, k));
} }
public void c(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
super.c(world, i, j, k); super.a(world, i, j, k);
if (world.getTypeId(i, j, k) == this.id) { if (world.getTypeId(i, j, k) == this.id) {
world.c(i, j, k, this.id, this.c()); world.c(i, j, k, this.id, this.c());
} }

Datei anzeigen

@ -1,146 +0,0 @@
package net.minecraft.server;
import java.util.Random;
public class BlockFurnace extends BlockContainer {
private Random a = new Random();
private final boolean b;
private static boolean c = false;
protected BlockFurnace(int i, boolean flag) {
super(i, Material.STONE);
this.b = flag;
this.textureId = 45;
}
public int a(int i, Random random) {
return Block.FURNACE.id;
}
public void c(World world, int i, int j, int k) {
super.c(world, i, j, k);
this.g(world, i, j, k);
}
private void g(World world, int i, int j, int k) {
if (!world.isStatic) {
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
int j1 = world.getTypeId(i - 1, j, k);
int k1 = world.getTypeId(i + 1, j, k);
byte b0 = 3;
if (Block.o[l] && !Block.o[i1]) {
b0 = 3;
}
if (Block.o[i1] && !Block.o[l]) {
b0 = 2;
}
if (Block.o[j1] && !Block.o[k1]) {
b0 = 5;
}
if (Block.o[k1] && !Block.o[j1]) {
b0 = 4;
}
world.setData(i, j, k, b0);
}
}
public int a(int i) {
return i == 1 ? this.textureId + 17 : (i == 0 ? this.textureId + 17 : (i == 3 ? this.textureId - 1 : this.textureId));
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.isStatic) {
return true;
} else {
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.getTileEntity(i, j, k);
entityhuman.a(tileentityfurnace);
return true;
}
}
public static void a(boolean flag, World world, int i, int j, int k) {
int l = world.getData(i, j, k);
TileEntity tileentity = world.getTileEntity(i, j, k);
if (tileentity == null) return; // CraftBukkit
c = true;
if (flag) {
world.setTypeId(i, j, k, Block.BURNING_FURNACE.id);
} else {
world.setTypeId(i, j, k, Block.FURNACE.id);
}
c = false;
world.setData(i, j, k, l);
tileentity.j();
world.setTileEntity(i, j, k, tileentity);
}
protected TileEntity a_() {
return new TileEntityFurnace();
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
if (l == 0) {
world.setData(i, j, k, 2);
}
if (l == 1) {
world.setData(i, j, k, 5);
}
if (l == 2) {
world.setData(i, j, k, 3);
}
if (l == 3) {
world.setData(i, j, k, 4);
}
}
public void remove(World world, int i, int j, int k) {
if (!c) {
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.getTileEntity(i, j, k);
if (tileentityfurnace == null) return; // CraftBukkit
for (int l = 0; l < tileentityfurnace.getSize(); ++l) {
ItemStack itemstack = tileentityfurnace.getItem(l);
if (itemstack != null) {
float f = this.a.nextFloat() * 0.8F + 0.1F;
float f1 = this.a.nextFloat() * 0.8F + 0.1F;
float f2 = this.a.nextFloat() * 0.8F + 0.1F;
while (itemstack.count > 0) {
int i1 = this.a.nextInt(21) + 10;
if (i1 > itemstack.count) {
i1 = itemstack.count;
}
itemstack.count -= i1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData()));
float f3 = 0.05F;
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F);
entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3);
world.addEntity(entityitem);
}
}
}
}
super.remove(world, i, j, k);
}
}

Datei anzeigen

@ -1,70 +0,0 @@
package net.minecraft.server;
public class BlockJukeBox extends BlockContainer {
protected BlockJukeBox(int i, int j) {
super(i, j, Material.WOOD);
}
public int a(int i) {
return this.textureId + (i == 1 ? 1 : 0);
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.getData(i, j, k) == 0) {
return false;
} else {
this.b_(world, i, j, k);
return true;
}
}
public void f(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
tileentityrecordplayer.a = l;
tileentityrecordplayer.update();
world.setData(i, j, k, 1);
}
}
public void b_(World world, int i, int j, int k) {
if (!world.isStatic) {
TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
if (tileentityrecordplayer == null) return; // CraftBukkit
int l = tileentityrecordplayer.a;
if (l != 0) {
world.e(1005, i, j, k, 0);
world.a((String) null, i, j, k);
tileentityrecordplayer.a = 0;
tileentityrecordplayer.update();
world.setData(i, j, k, 0);
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, new ItemStack(l, 1, 0));
entityitem.pickupDelay = 10;
world.addEntity(entityitem);
}
}
}
public void remove(World world, int i, int j, int k) {
this.b_(world, i, j, k);
super.remove(world, i, j, k);
}
public void dropNaturally(World world, int i, int j, int k, int l, float f) {
if (!world.isStatic) {
super.dropNaturally(world, i, j, k, l, f);
}
}
protected TileEntity a_() {
return new TileEntityRecordPlayer();
}
}

Datei anzeigen

@ -40,7 +40,7 @@ public class BlockLeaves extends BlockLeavesBase {
if (!world.isStatic) { if (!world.isStatic) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if ((l & 8) != 0) { if ((l & 8) != 0 && (l & 4) == 0) {
byte b0 = 4; byte b0 = 4;
int i1 = b0 + 1; int i1 = b0 + 1;
byte b1 = 32; byte b1 = 32;
@ -139,7 +139,7 @@ public class BlockLeaves extends BlockLeavesBase {
} }
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.G() != null && entityhuman.G().id == Item.SHEARS.id) { if (!world.isStatic && entityhuman.K() != null && entityhuman.K().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1); entityhuman.a(StatisticList.C[this.id], 1);
this.a(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3)); this.a(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
} else { } else {

Datei anzeigen

@ -1,8 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.BlockSpreadEvent; // CraftBukkit
public class BlockMushroom extends BlockFlower { public class BlockMushroom extends BlockFlower {
@ -16,29 +15,54 @@ public class BlockMushroom extends BlockFlower {
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
if (random.nextInt(100) == 0) { if (random.nextInt(100) == 0) {
int l = i + random.nextInt(3) - 1; byte b0 = 4;
int i1 = j + random.nextInt(2) - random.nextInt(2); int l = 5;
int j1 = k + random.nextInt(3) - 1;
if (world.isEmpty(l, i1, j1) && this.f(world, l, i1, j1)) { int i1;
int k1 = i + (random.nextInt(3) - 1); int j1;
int k1;
k1 = k + (random.nextInt(3) - 1); for (i1 = i - b0; i1 <= i + b0; ++i1) {
if (world.isEmpty(l, i1, j1) && this.f(world, l, i1, j1)) { for (j1 = k - b0; j1 <= k + b0; ++j1) {
// CraftBukkit start for (k1 = j - 1; k1 <= j + 1; ++k1) {
org.bukkit.World bworld = world.getWorld(); if (world.getTypeId(i1, k1, j1) == this.id) {
org.bukkit.block.BlockState blockState = bworld.getBlockAt(l, i1, j1).getState(); --l;
blockState.setTypeId(this.id); if (l <= 0) {
return;
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState); }
world.getServer().getPluginManager().callEvent(event); }
if (!event.isCancelled()) {
blockState.update(true);
} }
// CraftBukkit end
} }
} }
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
}
i1 = i + random.nextInt(3) - 1;
j1 = j + random.nextInt(2) - random.nextInt(2);
k1 = k + random.nextInt(3) - 1;
}
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
blockState.setTypeId(this.id);
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
} }
} }
@ -47,6 +71,39 @@ public class BlockMushroom extends BlockFlower {
} }
public boolean f(World world, int i, int j, int k) { public boolean f(World world, int i, int j, int k) {
return j >= 0 && j < 128 ? world.k(i, j, k) < 13 && this.c(world.getTypeId(i, j - 1, k)) : false; if (j >= 0) {
world.getClass();
if (j < 128) {
return world.k(i, j, k) < 13 && this.c(world.getTypeId(i, j - 1, k));
}
}
return false;
}
public boolean b(World world, int i, int j, int k, Random random) {
int l = world.getTypeId(i, j - 1, k);
if (l != Block.DIRT.id && l != Block.GRASS.id) {
return false;
} else {
int i1 = world.getData(i, j, k);
world.setRawTypeId(i, j, k, 0);
WorldGenHugeMushroom worldgenhugemushroom = null;
if (this.id == Block.BROWN_MUSHROOM.id) {
worldgenhugemushroom = new WorldGenHugeMushroom(0);
} else if (this.id == Block.RED_MUSHROOM.id) {
worldgenhugemushroom = new WorldGenHugeMushroom(1);
}
if (worldgenhugemushroom != null && worldgenhugemushroom.a(world, random, i, j, k)) {
return true;
} else {
world.setRawTypeIdAndData(i, j, k, this.id, i1);
return false;
}
}
} }
} }

Datei anzeigen

@ -48,7 +48,7 @@ public class BlockPiston extends Block {
} }
} }
public void c(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
if (!world.isStatic && world.getTileEntity(i, j, k) == null) { if (!world.isStatic && world.getTileEntity(i, j, k) == null) {
this.g(world, i, j, k); this.g(world, i, j, k);
} }
@ -110,7 +110,7 @@ public class BlockPiston extends Block {
TileEntity tileentity = world.getTileEntity(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1]); TileEntity tileentity = world.getTileEntity(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1]);
if (tileentity != null && tileentity instanceof TileEntityPiston) { if (tileentity != null && tileentity instanceof TileEntityPiston) {
((TileEntityPiston) tileentity).k(); ((TileEntityPiston) tileentity).e();
} }
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1); world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
@ -130,9 +130,9 @@ public class BlockPiston extends Block {
TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1; TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1;
if (tileentitypiston.d() == i1 && tileentitypiston.c()) { if (tileentitypiston.d() == i1 && tileentitypiston.c()) {
tileentitypiston.k(); tileentitypiston.e();
i2 = tileentitypiston.a(); i2 = tileentitypiston.a();
j2 = tileentitypiston.e(); j2 = tileentitypiston.j();
flag = true; flag = true;
} }
} }
@ -296,6 +296,48 @@ public class BlockPiston extends Block {
} }
} }
private static int H(World world, int i, int j, int k, int l) {
int i1 = i + PistonBlockTextures.b[l];
int j1 = j + PistonBlockTextures.c[l];
int k1 = k + PistonBlockTextures.d[l];
int l1 = 0;
while (true) {
if (l1 < 13) {
if (j1 > 0) {
world.getClass();
if (j1 < 128 - 1) {
int i2 = world.getTypeId(i1, j1, k1);
if (i2 != 0) {
if (!a(i2, world, i1, j1, k1, true)) {
return -1; // CraftBukkit
}
if (Block.byId[i2].e() != 1) {
if (l1 == 12) {
return -1; // CraftBukkit
}
i1 += PistonBlockTextures.b[l];
j1 += PistonBlockTextures.c[l];
k1 += PistonBlockTextures.d[l];
++l1;
continue;
}
}
return l1; // CraftBukkit
}
}
return -1; // CraftBukkit
}
return l1; // CraftBukkit
}
}
private boolean i(World world, int i, int j, int k, int l) { private boolean i(World world, int i, int j, int k, int l) {
int i1 = i + PistonBlockTextures.b[l]; int i1 = i + PistonBlockTextures.b[l];
int j1 = j + PistonBlockTextures.c[l]; int j1 = j + PistonBlockTextures.c[l];

Datei anzeigen

@ -40,7 +40,7 @@ public class BlockPortal extends BlockBreakable {
return false; return false;
} }
public boolean a_(World world, int i, int j, int k) { public boolean b_(World world, int i, int j, int k) {
byte b0 = 0; byte b0 = 0;
byte b1 = 0; byte b1 = 0;
@ -166,7 +166,7 @@ public class BlockPortal extends BlockBreakable {
world.getServer().getPluginManager().callEvent(event); world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end // CraftBukkit end
entity.P(); entity.T();
} }
} }
} }

Datei anzeigen

@ -39,15 +39,15 @@ public class BlockPressurePlate extends Block {
} }
public boolean canPlace(World world, int i, int j, int k) { public boolean canPlace(World world, int i, int j, int k) {
return world.e(i, j - 1, k); return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.FENCE.id;
} }
public void c(World world, int i, int j, int k) {} public void a(World world, int i, int j, int k) {}
public void doPhysics(World world, int i, int j, int k, int l) { public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false; boolean flag = false;
if (!world.e(i, j - 1, k)) { if (!world.e(i, j - 1, k) && world.getTypeId(i, j - 1, k) != Block.FENCE.id) {
flag = true; flag = true;
} }

Datei anzeigen

@ -33,8 +33,8 @@ public class BlockPumpkin extends Block {
return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16)); return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16));
} }
public void c(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
super.c(world, i, j, k); super.a(world, i, j, k);
} }
public boolean canPlace(World world, int i, int j, int k) { public boolean canPlace(World world, int i, int j, int k) {

Datei anzeigen

@ -46,9 +46,9 @@ public class BlockRedstoneTorch extends BlockTorch {
return 2; return 2;
} }
public void c(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
if (world.getData(i, j, k) == 0) { if (world.getData(i, j, k) == 0) {
super.c(world, i, j, k); super.a(world, i, j, k);
} }
if (this.isOn) { if (this.isOn) {

Datei anzeigen

@ -191,8 +191,8 @@ public class BlockRedstoneWire extends Block {
} }
} }
public void c(World world, int i, int j, int k) { public void a(World world, int i, int j, int k) {
super.c(world, i, j, k); super.a(world, i, j, k);
if (!world.isStatic) { if (!world.isStatic) {
this.g(world, i, j, k); this.g(world, i, j, k);
world.applyPhysics(i, j + 1, k, this.id); world.applyPhysics(i, j + 1, k, this.id);
@ -351,7 +351,7 @@ public class BlockRedstoneWire extends Block {
} else { } else {
int j1 = iblockaccess.getData(i, j, k); int j1 = iblockaccess.getData(i, j, k);
return l == BedBlockTextures.b[j1 & 3]; return l == Direction.e[j1 & 3];
} }
} }
} }

Datei anzeigen

@ -60,7 +60,7 @@ public class BlockSign extends BlockContainer {
return false; return false;
} }
protected TileEntity a_() { public TileEntity a_() {
try { try {
return (TileEntity) this.a.newInstance(); return (TileEntity) this.a.newInstance();
} catch (Exception exception) { } catch (Exception exception) {

Datei anzeigen

@ -74,7 +74,9 @@ public class BlockSoil extends Block {
for (int l = i - b0; l <= i + b0; ++l) { for (int l = i - b0; l <= i + b0; ++l) {
for (int i1 = k - b0; i1 <= k + b0; ++i1) { for (int i1 = k - b0; i1 <= k + b0; ++i1) {
if (world.getTypeId(l, j + 1, i1) == Block.CROPS.id) { int j1 = world.getTypeId(l, j + 1, i1);
if (j1 == Block.CROPS.id || j1 == Block.MELON_STEM.id || j1 == Block.PUMPKIN_STEM.id) {
return true; return true;
} }
} }

Datei anzeigen

@ -1,6 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -11,30 +12,37 @@ public class Chunk {
public static boolean a; public static boolean a;
public byte[] b; public byte[] b;
public boolean c; public int[] c;
public boolean[] d;
public boolean e;
public World world; public World world;
public NibbleArray e;
public NibbleArray f;
public NibbleArray g; public NibbleArray g;
public NibbleArray h;
public NibbleArray i;
public byte[] heightMap; public byte[] heightMap;
public int i; public int k;
public final int x; public final int x;
public final int z; public final int z;
public Map tileEntities; public Map tileEntities;
public List[] entitySlices; public List[] entitySlices;
public boolean done; public boolean done;
public boolean o;
public boolean p;
public boolean q; public boolean q;
public long r; public boolean r;
public boolean s;
public long t;
boolean u;
public Chunk(World world, int i, int j) { public Chunk(World world, int i, int j) {
this.c = new int[256];
this.d = new boolean[256];
this.tileEntities = new HashMap(); this.tileEntities = new HashMap();
this.entitySlices = new List[8];
this.done = false; this.done = false;
this.o = false;
this.q = false; this.q = false;
this.r = 0L; this.s = false;
this.t = 0L;
this.u = false;
world.getClass();
this.entitySlices = new List[128 / 16];
this.world = world; this.world = world;
this.x = i; this.x = i;
this.z = j; this.z = j;
@ -44,6 +52,8 @@ public class Chunk {
this.entitySlices[k] = new ArrayList(); this.entitySlices[k] = new ArrayList();
} }
Arrays.fill(this.c, -999);
// CraftBukkit start // CraftBukkit start
org.bukkit.craftbukkit.CraftWorld cworld = this.world.getWorld(); org.bukkit.craftbukkit.CraftWorld cworld = this.world.getWorld();
this.bukkitChunk = (cworld == null) ? null : cworld.popPreservedChunk(i, j); this.bukkitChunk = (cworld == null) ? null : cworld.popPreservedChunk(i, j);
@ -58,9 +68,14 @@ public class Chunk {
public Chunk(World world, byte[] abyte, int i, int j) { public Chunk(World world, byte[] abyte, int i, int j) {
this(world, i, j); this(world, i, j);
this.b = abyte; this.b = abyte;
this.e = new NibbleArray(abyte.length);
this.f = new NibbleArray(abyte.length); int k = abyte.length;
this.g = new NibbleArray(abyte.length);
// Craftbukkit start - FIX THE DECOMPILER!
this.g = new NibbleArray(k, 7);
this.h = new NibbleArray(k, 7);
this.i = new NibbleArray(k, 7);
// Craftbukkit end
} }
public boolean a(int i, int j) { public boolean a(int i, int j) {
@ -74,18 +89,25 @@ public class Chunk {
public void a() {} public void a() {}
public void initLighting() { public void initLighting() {
int i = 127; this.world.getClass();
int i = 128 - 1;
int j; int j;
int k; int k;
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
for (k = 0; k < 16; ++k) { for (k = 0; k < 16; ++k) {
int l = 127; this.world.getClass();
int l = 128 - 1;
int i1; this.world.getClass();
int i1 = j << 11;
for (i1 = j << 11 | k << 7; l > 0 && Block.q[this.b[i1 + l - 1] & 255] == 0; --l) { this.world.getClass();
int j1;
for (j1 = i1 | k << 7; l > 0 && Block.q[this.b[j1 + l - 1] & 255] == 0; --l) {
; ;
} }
@ -95,54 +117,105 @@ public class Chunk {
} }
if (!this.world.worldProvider.e) { if (!this.world.worldProvider.e) {
int j1 = 15; int k1 = 15;
int k1 = 127;
this.world.getClass();
int l1 = 128 - 1;
do { do {
j1 -= Block.q[this.b[i1 + k1] & 255]; k1 -= Block.q[this.b[j1 + l1] & 255];
if (j1 > 0) { if (k1 > 0) {
this.f.a(j, k1, k, j1); this.h.a(j, l1, k, k1);
} }
--k1; --l1;
} while (k1 > 0 && j1 > 0); } while (l1 > 0 && k1 > 0);
} }
} }
} }
this.i = i; this.k = i;
for (j = 0; j < 16; ++j) { for (j = 0; j < 16; ++j) {
for (k = 0; k < 16; ++k) { for (k = 0; k < 16; ++k) {
this.c(j, k); this.d(j, k);
} }
} }
this.o = true; this.q = true;
} }
public void loadNOP() {} public void loadNOP() {}
private void c(int i, int j) { private void d(int i, int j) {
int k = this.b(i, j); this.d[i + j * 16] = true;
int l = this.x * 16 + i; }
int i1 = this.z * 16 + j;
this.f(l - 1, i1, k); private void i() {
this.f(l + 1, i1, k); World j0000 = this.world;
this.f(l, i1 - 1, k); int j0001 = this.x * 16 + 8;
this.f(l, i1 + 1, k);
this.world.getClass();
if (j0000.areChunksLoaded(j0001, 128 / 2, this.z * 16 + 8, 16)) {
for (int j = 0; j < 16; ++j) {
for (int k = 0; k < 16; ++k) {
if (this.d[j + k * 16]) {
this.d[j + k * 16] = false;
int l = this.b(j, k);
int i1 = this.x * 16 + j;
int j1 = this.z * 16 + k;
int k1 = this.world.getHighestBlockYAt(i1 - 1, j1);
int l1 = this.world.getHighestBlockYAt(i1 + 1, j1);
int i2 = this.world.getHighestBlockYAt(i1, j1 - 1);
int j2 = this.world.getHighestBlockYAt(i1, j1 + 1);
if (l1 < k1) {
k1 = l1;
}
if (i2 < k1) {
k1 = i2;
}
if (j2 < k1) {
k1 = j2;
}
this.u = true;
this.f(i1, j1, k1);
this.u = true;
this.f(i1 - 1, j1, l);
this.f(i1 + 1, j1, l);
this.f(i1, j1 - 1, l);
this.f(i1, j1 + 1, l);
}
}
}
}
} }
private void f(int i, int j, int k) { private void f(int i, int j, int k) {
int l = this.world.getHighestBlockYAt(i, j); int l = this.world.getHighestBlockYAt(i, j);
if (l > k) { if (l > k) {
this.world.a(EnumSkyBlock.SKY, i, k, j, i, l, j); this.d(i, j, k, l + 1);
this.o = true;
} else if (l < k) { } else if (l < k) {
this.world.a(EnumSkyBlock.SKY, i, l, j, i, k, j); this.d(i, j, l, k + 1);
this.o = true; }
}
private void d(int i, int j, int k, int l) {
if (l > k) {
World world = this.world;
this.world.getClass();
if (world.areChunksLoaded(i, 128 / 2, j, 16)) {
for (int i1 = k; i1 < l; ++i1) {
this.world.b(EnumSkyBlock.SKY, i, i1, j);
}
this.q = true;
}
} }
} }
@ -154,52 +227,52 @@ public class Chunk {
i1 = j; i1 = j;
} }
for (int j1 = i << 11 | k << 7; i1 > 0 && Block.q[this.b[j1 + i1 - 1] & 255] == 0; --i1) { this.world.getClass();
int j1 = i << 11;
this.world.getClass();
for (int k1 = j1 | k << 7; i1 > 0 && Block.q[this.b[k1 + i1 - 1] & 255] == 0; --i1) {
; ;
} }
if (i1 != l) { if (i1 != l) {
this.world.g(i, k, i1, l); this.world.g(i, k, i1, l);
this.heightMap[k << 4 | i] = (byte) i1; this.heightMap[k << 4 | i] = (byte) i1;
int k1;
int l1; int l1;
int i2; int i2;
int j2;
if (i1 < this.i) { if (i1 < this.k) {
this.i = i1; this.k = i1;
} else { } else {
k1 = 127; this.world.getClass();
l1 = 128 - 1;
for (l1 = 0; l1 < 16; ++l1) { for (i2 = 0; i2 < 16; ++i2) {
for (i2 = 0; i2 < 16; ++i2) { for (j2 = 0; j2 < 16; ++j2) {
if ((this.heightMap[i2 << 4 | l1] & 255) < k1) { if ((this.heightMap[j2 << 4 | i2] & 255) < l1) {
k1 = this.heightMap[i2 << 4 | l1] & 255; l1 = this.heightMap[j2 << 4 | i2] & 255;
} }
} }
} }
this.i = k1; this.k = l1;
} }
k1 = this.x * 16 + i; l1 = this.x * 16 + i;
l1 = this.z * 16 + k; i2 = this.z * 16 + k;
if (i1 < l) { if (i1 < l) {
for (i2 = i1; i2 < l; ++i2) { for (j2 = i1; j2 < l; ++j2) {
this.f.a(i, i2, k, 15); this.h.a(i, j2, k, 15);
} }
} else { } else {
this.world.a(EnumSkyBlock.SKY, k1, l, l1, k1, i1, l1); for (j2 = l; j2 < i1; ++j2) {
this.h.a(i, j2, k, 0);
for (i2 = l; i2 < i1; ++i2) {
this.f.a(i, i2, k, 0);
} }
} }
i2 = 15; for (j2 = 15; i1 > 0 && j2 > 0; this.h.a(i, i1, k, j2)) {
int j2;
for (j2 = i1; i1 > 0 && i2 > 0; this.f.a(i, i1, k, i2)) {
--i1; --i1;
int k2 = Block.q[this.getTypeId(i, i1, k)]; int k2 = Block.q[this.getTypeId(i, i1, k)];
@ -207,141 +280,237 @@ public class Chunk {
k2 = 1; k2 = 1;
} }
i2 -= k2; j2 -= k2;
if (i2 < 0) { if (j2 < 0) {
i2 = 0; j2 = 0;
} }
} }
while (i1 > 0 && Block.q[this.getTypeId(i, i1 - 1, k)] == 0) { byte b0 = this.heightMap[k << 4 | i];
--i1; int l2 = l;
int i3 = b0;
if (b0 < l) {
l2 = b0;
i3 = l;
} }
if (i1 != j2) { this.d(l1 - 1, i2, l2, i3);
this.world.a(EnumSkyBlock.SKY, k1 - 1, i1, l1 - 1, k1 + 1, j2, l1 + 1); this.d(l1 + 1, i2, l2, i3);
} this.d(l1, i2 - 1, l2, i3);
this.d(l1, i2 + 1, l2, i3);
this.o = true; this.d(l1, i2, l2, i3);
this.q = true;
} }
} }
public int getTypeId(int i, int j, int k) { public int getTypeId(int i, int j, int k) {
return this.b[i << 11 | k << 7 | j] & 255; byte[] abyte = this.b;
this.world.getClass();
int l = i << 11;
this.world.getClass();
return abyte[l | k << 7 | j] & 255;
} }
public boolean a(int i, int j, int k, int l, int i1) { public boolean a(int i, int j, int k, int l, int i1) {
byte b0 = (byte) l; byte b0 = (byte) l;
int j1 = this.heightMap[k << 4 | i] & 255; int j1 = k << 4 | i;
int k1 = this.b[i << 11 | k << 7 | j] & 255;
if (k1 == l && this.e.a(i, j, k) == i1) { if (j >= this.c[j1] - 1) {
this.c[j1] = -999;
}
int k1 = this.heightMap[k << 4 | i] & 255;
byte[] j2000 = this.b;
this.world.getClass();
int j2001 = i << 11;
this.world.getClass();
int i2 = j2000[j2001 | k << 7 | j] & 255;
if (i2 == l && this.g.a(i, j, k) == i1) {
return false; return false;
} else { } else {
int l1 = this.x * 16 + i; int j2 = this.x * 16 + i;
int i2 = this.z * 16 + k; int k2 = this.z * 16 + k;
this.b[i << 11 | k << 7 | j] = (byte) (b0 & 255); j2000 = this.b;
if (k1 != 0 && !this.world.isStatic) { this.world.getClass();
Block.byId[k1].remove(this.world, l1, j, i2); j2001 = i << 11;
this.world.getClass();
j2000[j2001 | k << 7 | j] = (byte) (b0 & 255);
if (i2 != 0 && !this.world.isStatic) {
Block.byId[i2].remove(this.world, j2, j, k2);
} }
this.e.a(i, j, k, i1); this.g.a(i, j, k, i1);
if (!this.world.worldProvider.e) { if (!this.world.worldProvider.e) {
if (Block.q[b0 & 255] != 0) { if (Block.q[b0 & 255] != 0) {
if (j >= j1) { if (j >= k1) {
this.g(i, j + 1, k); this.g(i, j + 1, k);
} }
} else if (j == j1 - 1) { } else if (j == k1 - 1) {
this.g(i, j, k); this.g(i, j, k);
} }
this.world.a(EnumSkyBlock.SKY, l1, j, i2, l1, j, i2); this.world.a(EnumSkyBlock.SKY, j2, j, k2, j2, j, k2);
} }
this.world.a(EnumSkyBlock.BLOCK, l1, j, i2, l1, j, i2); this.world.a(EnumSkyBlock.BLOCK, j2, j, k2, j2, j, k2);
this.c(i, k); this.d(i, k);
this.e.a(i, j, k, i1); this.g.a(i, j, k, i1);
TileEntity tileentity;
if (l != 0) { if (l != 0) {
Block.byId[l].c(this.world, l1, j, i2); if (!this.world.isStatic) {
Block.byId[l].a(this.world, j2, j, k2);
}
if (Block.byId[l] instanceof BlockContainer) {
tileentity = this.d(i, j, k);
if (tileentity == null) {
tileentity = ((BlockContainer) Block.byId[l]).a_();
this.world.setTileEntity(i, j, k, tileentity);
}
if (tileentity != null) {
tileentity.g();
}
}
} else if (i2 > 0 && Block.byId[i2] instanceof BlockContainer) {
tileentity = this.d(i, j, k);
if (tileentity != null) {
tileentity.g();
}
} }
this.o = true; this.q = true;
return true; return true;
} }
} }
public boolean a(int i, int j, int k, int l) { public boolean a(int i, int j, int k, int l) {
byte b0 = (byte) l; byte b0 = (byte) l;
int i1 = this.heightMap[k << 4 | i] & 255; int i1 = k << 4 | i;
int j1 = this.b[i << 11 | k << 7 | j] & 255;
if (j1 == l) { if (j >= this.c[i1] - 1) {
this.c[i1] = -999;
}
int j1 = this.heightMap[i1] & 255;
byte[] j2000 = this.b;
this.world.getClass();
int j2001 = i << 11;
this.world.getClass();
int l1 = j2000[j2001 | k << 7 | j] & 255;
if (l1 == l) {
return false; return false;
} else { } else {
int k1 = this.x * 16 + i; int i2 = this.x * 16 + i;
int l1 = this.z * 16 + k; int j2 = this.z * 16 + k;
this.b[i << 11 | k << 7 | j] = (byte) (b0 & 255); j2000 = this.b;
if (j1 != 0) { this.world.getClass();
Block.byId[j1].remove(this.world, k1, j, l1); j2001 = i << 11;
this.world.getClass();
j2000[j2001 | k << 7 | j] = (byte) (b0 & 255);
if (l1 != 0) {
Block.byId[l1].remove(this.world, i2, j, j2);
} }
this.e.a(i, j, k, 0); this.g.a(i, j, k, 0);
if (Block.q[b0 & 255] != 0) { if (Block.q[b0 & 255] != 0) {
if (j >= i1) { if (j >= j1) {
this.g(i, j + 1, k); this.g(i, j + 1, k);
} }
} else if (j == i1 - 1) { } else if (j == j1 - 1) {
this.g(i, j, k); this.g(i, j, k);
} }
this.world.a(EnumSkyBlock.SKY, k1, j, l1, k1, j, l1); this.world.a(EnumSkyBlock.SKY, i2, j, j2, i2, j, j2);
this.world.a(EnumSkyBlock.BLOCK, k1, j, l1, k1, j, l1); this.world.a(EnumSkyBlock.BLOCK, i2, j, j2, i2, j, j2);
this.c(i, k); this.d(i, k);
if (l != 0 && !this.world.isStatic) { TileEntity tileentity;
Block.byId[l].c(this.world, k1, j, l1);
if (l != 0) {
if (!this.world.isStatic) {
Block.byId[l].a(this.world, i2, j, j2);
}
if (l > 0 && Block.byId[l] instanceof BlockContainer) {
tileentity = this.d(i, j, k);
if (tileentity == null) {
tileentity = ((BlockContainer) Block.byId[l]).a_();
this.world.setTileEntity(i, j, k, tileentity);
}
if (tileentity != null) {
tileentity.g();
}
}
} else if (l1 > 0 && Block.byId[l1] instanceof BlockContainer) {
tileentity = this.d(i, j, k);
if (tileentity != null) {
tileentity.g();
}
} }
this.o = true; this.q = true;
return true; return true;
} }
} }
public int getData(int i, int j, int k) { public int getData(int i, int j, int k) {
return this.e.a(i, j, k); return this.g.a(i, j, k);
} }
public void b(int i, int j, int k, int l) { public void b(int i, int j, int k, int l) {
this.o = true; this.q = true;
this.e.a(i, j, k, l); this.g.a(i, j, k, l);
int i1 = this.getTypeId(i, j, k);
if (i1 > 0 && Block.byId[i1] instanceof BlockContainer) {
TileEntity tileentity = this.d(i, j, k);
if (tileentity != null) {
tileentity.g();
tileentity.n = l;
}
}
} }
public int a(EnumSkyBlock enumskyblock, int i, int j, int k) { public int a(EnumSkyBlock enumskyblock, int i, int j, int k) {
return enumskyblock == EnumSkyBlock.SKY ? this.f.a(i, j, k) : (enumskyblock == EnumSkyBlock.BLOCK ? this.g.a(i, j, k) : 0); return enumskyblock == EnumSkyBlock.SKY ? this.h.a(i, j, k) : (enumskyblock == EnumSkyBlock.BLOCK ? this.i.a(i, j, k) : 0);
} }
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) { public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
this.o = true; this.q = true;
if (enumskyblock == EnumSkyBlock.SKY) { if (enumskyblock == EnumSkyBlock.SKY) {
this.f.a(i, j, k, l); this.h.a(i, j, k, l);
} else { } else {
if (enumskyblock != EnumSkyBlock.BLOCK) { if (enumskyblock != EnumSkyBlock.BLOCK) {
return; return;
} }
this.g.a(i, j, k, l); this.i.a(i, j, k, l);
} }
} }
public int c(int i, int j, int k, int l) { public int c(int i, int j, int k, int l) {
int i1 = this.f.a(i, j, k); int i1 = this.h.a(i, j, k);
if (i1 > 0) { if (i1 > 0) {
a = true; a = true;
} }
i1 -= l; i1 -= l;
int j1 = this.g.a(i, j, k); int j1 = this.i.a(i, j, k);
if (j1 > i1) { if (j1 > i1) {
i1 = j1; i1 = j1;
@ -351,7 +520,7 @@ public class Chunk {
} }
public void a(Entity entity) { public void a(Entity entity) {
this.q = true; this.s = true;
int i = MathHelper.floor(entity.locX / 16.0D); int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D);
@ -372,15 +541,15 @@ public class Chunk {
k = this.entitySlices.length - 1; k = this.entitySlices.length - 1;
} }
entity.bG = true; entity.bV = true;
entity.bH = this.x; entity.bW = this.x;
entity.bI = k; entity.bX = k;
entity.bJ = this.z; entity.bY = this.z;
this.entitySlices[k].add(entity); this.entitySlices[k].add(entity);
} }
public void b(Entity entity) { public void b(Entity entity) {
this.a(entity, entity.bI); this.a(entity, entity.bX);
} }
public void a(Entity entity, int i) { public void a(Entity entity, int i) {
@ -410,13 +579,15 @@ public class Chunk {
return null; return null;
} }
BlockContainer blockcontainer = (BlockContainer) Block.byId[l]; if (tileentity == null) {
tileentity = ((BlockContainer) Block.byId[l]).a_();
this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity);
}
blockcontainer.c(this.world, this.x * 16 + i, j, this.z * 16 + k);
tileentity = (TileEntity) this.tileEntities.get(chunkposition); tileentity = (TileEntity) this.tileEntities.get(chunkposition);
} }
if (tileentity != null && tileentity.g()) { if (tileentity != null && tileentity.m()) {
this.tileEntities.remove(chunkposition); this.tileEntities.remove(chunkposition);
return null; return null;
} else { } else {
@ -430,8 +601,8 @@ public class Chunk {
int k = tileentity.z - this.z * 16; int k = tileentity.z - this.z * 16;
this.a(i, j, k, tileentity); this.a(i, j, k, tileentity);
if (this.c) { if (this.e) {
this.world.c.add(tileentity); this.world.h.add(tileentity);
} }
} }
@ -443,7 +614,7 @@ public class Chunk {
tileentity.y = j; tileentity.y = j;
tileentity.z = this.z * 16 + k; tileentity.z = this.z * 16 + k;
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) { if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
tileentity.j(); tileentity.n();
this.tileEntities.put(chunkposition, tileentity); this.tileEntities.put(chunkposition, tileentity);
} else { } else {
System.out.println("Attempted to place a tile entity where there was no entity tile!"); System.out.println("Attempted to place a tile entity where there was no entity tile!");
@ -453,17 +624,17 @@ public class Chunk {
public void e(int i, int j, int k) { public void e(int i, int j, int k) {
ChunkPosition chunkposition = new ChunkPosition(i, j, k); ChunkPosition chunkposition = new ChunkPosition(i, j, k);
if (this.c) { if (this.e) {
TileEntity tileentity = (TileEntity) this.tileEntities.remove(chunkposition); TileEntity tileentity = (TileEntity) this.tileEntities.remove(chunkposition);
if (tileentity != null) { if (tileentity != null) {
tileentity.h(); tileentity.i();
} }
} }
} }
public void addEntities() { public void addEntities() {
this.c = true; this.e = true;
this.world.a(this.tileEntities.values()); this.world.a(this.tileEntities.values());
for (int i = 0; i < this.entitySlices.length; ++i) { for (int i = 0; i < this.entitySlices.length; ++i) {
@ -472,13 +643,13 @@ public class Chunk {
} }
public void removeEntities() { public void removeEntities() {
this.c = false; this.e = false;
Iterator iterator = this.tileEntities.values().iterator(); Iterator iterator = this.tileEntities.values().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next(); TileEntity tileentity = (TileEntity) iterator.next();
world.markForRemoval(tileentity); // Craftbukkit this.world.a(tileentity);
} }
for (int i = 0; i < this.entitySlices.length; ++i) { for (int i = 0; i < this.entitySlices.length; ++i) {
@ -502,7 +673,7 @@ public class Chunk {
} }
public void f() { public void f() {
this.o = true; this.q = true;
} }
public void a(Entity entity, AxisAlignedBB axisalignedbb, List list) { public void a(Entity entity, AxisAlignedBB axisalignedbb, List list) {
@ -556,18 +727,18 @@ public class Chunk {
} }
public boolean a(boolean flag) { public boolean a(boolean flag) {
if (this.p) { if (this.r) {
return false; return false;
} else { } else {
if (flag) { if (flag) {
if (this.q && this.world.getTime() != this.r) { if (this.s && this.world.getTime() != this.t) {
return true; return true;
} }
} else if (this.q && this.world.getTime() >= this.r + 600L) { } else if (this.s && this.world.getTime() >= this.t + 600L) {
return true; return true;
} }
return this.o; return this.q;
} }
} }
@ -579,52 +750,65 @@ public class Chunk {
if (l1 * i2 * j2 == this.b.length) { if (l1 * i2 * j2 == this.b.length) {
System.arraycopy(this.b, 0, abyte, k1, this.b.length); System.arraycopy(this.b, 0, abyte, k1, this.b.length);
k1 += this.b.length; k1 += this.b.length;
System.arraycopy(this.e.a, 0, abyte, k1, this.e.a.length);
k1 += this.e.a.length;
System.arraycopy(this.g.a, 0, abyte, k1, this.g.a.length); System.arraycopy(this.g.a, 0, abyte, k1, this.g.a.length);
k1 += this.g.a.length; k1 += this.g.a.length;
System.arraycopy(this.f.a, 0, abyte, k1, this.f.a.length); System.arraycopy(this.i.a, 0, abyte, k1, this.i.a.length);
k1 += this.f.a.length; k1 += this.i.a.length;
System.arraycopy(this.h.a, 0, abyte, k1, this.h.a.length);
k1 += this.h.a.length;
return k1; return k1;
} else { } else {
int k2; int k2;
int l2; int l2;
int i3; int i3;
int j3; int j3;
int k3;
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (l2 = k; l2 < j1; ++l2) { for (i3 = k; i3 < j1; ++i3) {
i3 = k2 << 11 | l2 << 7 | j; this.world.getClass();
j3 = i1 - j; l2 = k2 << 11;
System.arraycopy(this.b, i3, abyte, k1, j3); this.world.getClass();
k1 += j3; j3 = l2 | i3 << 7 | j;
k3 = i1 - j;
System.arraycopy(this.b, j3, abyte, k1, k3);
k1 += k3;
} }
} }
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (l2 = k; l2 < j1; ++l2) { for (i3 = k; i3 < j1; ++i3) {
i3 = (k2 << 11 | l2 << 7 | j) >> 1; this.world.getClass();
j3 = (i1 - j) / 2; l2 = k2 << 11;
System.arraycopy(this.e.a, i3, abyte, k1, j3); this.world.getClass();
k1 += j3; j3 = (l2 | i3 << 7 | j) >> 1;
k3 = (i1 - j) / 2;
System.arraycopy(this.g.a, j3, abyte, k1, k3);
k1 += k3;
} }
} }
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (l2 = k; l2 < j1; ++l2) { for (i3 = k; i3 < j1; ++i3) {
i3 = (k2 << 11 | l2 << 7 | j) >> 1; this.world.getClass();
j3 = (i1 - j) / 2; l2 = k2 << 11;
System.arraycopy(this.g.a, i3, abyte, k1, j3); this.world.getClass();
k1 += j3; j3 = (l2 | i3 << 7 | j) >> 1;
k3 = (i1 - j) / 2;
System.arraycopy(this.i.a, j3, abyte, k1, k3);
k1 += k3;
} }
} }
for (k2 = i; k2 < l; ++k2) { for (k2 = i; k2 < l; ++k2) {
for (l2 = k; l2 < j1; ++l2) { for (i3 = k; i3 < j1; ++i3) {
i3 = (k2 << 11 | l2 << 7 | j) >> 1; this.world.getClass();
j3 = (i1 - j) / 2; l2 = k2 << 11;
System.arraycopy(this.f.a, i3, abyte, k1, j3); this.world.getClass();
k1 += j3; j3 = (l2 | i3 << 7 | j) >> 1;
k3 = (i1 - j) / 2;
System.arraycopy(this.h.a, j3, abyte, k1, k3);
k1 += k3;
} }
} }
@ -636,11 +820,56 @@ public class Chunk {
return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i); return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i);
} }
public boolean isEmpty() { public void g() {
return false; BlockRegister.a(this.b);
}
public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) {
ichunkprovider.getChunkAt(ichunkprovider1, i, j);
}
if (ichunkprovider.isChunkLoaded(i - 1, j) && !ichunkprovider.getOrCreateChunk(i - 1, j).done && ichunkprovider.isChunkLoaded(i - 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i - 1, j + 1)) {
ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j);
}
if (ichunkprovider.isChunkLoaded(i, j - 1) && !ichunkprovider.getOrCreateChunk(i, j - 1).done && ichunkprovider.isChunkLoaded(i + 1, j - 1) && ichunkprovider.isChunkLoaded(i + 1, j - 1) && ichunkprovider.isChunkLoaded(i + 1, j)) {
ichunkprovider.getChunkAt(ichunkprovider1, i, j - 1);
}
if (ichunkprovider.isChunkLoaded(i - 1, j - 1) && !ichunkprovider.getOrCreateChunk(i - 1, j - 1).done && ichunkprovider.isChunkLoaded(i, j - 1) && ichunkprovider.isChunkLoaded(i - 1, j)) {
ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1);
}
}
public int c(int i, int j) {
int k = i | j << 4;
int l = this.c[k];
if (l == -999) {
this.world.getClass();
int i1 = 128 - 1;
l = -1;
while (i1 > 0 && l == -1) {
int j1 = this.getTypeId(i, i1, j);
Material material = j1 == 0 ? Material.AIR : Block.byId[j1].material;
if (!material.isSolid() && !material.isLiquid()) {
--i1;
} else {
l = i1 + 1;
}
}
this.c[k] = l;
}
return l;
} }
public void h() { public void h() {
BlockRegister.a(this.b); this.i();
} }
} }

Datei anzeigen

@ -2,10 +2,8 @@ package net.minecraft.server;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
// CraftBukkit start // CraftBukkit start
@ -91,21 +89,7 @@ public class ChunkProviderServer implements IChunkProvider {
} }
// CraftBukkit end // CraftBukkit end
if (!chunk.done && this.isChunkLoaded(i + 1, j + 1) && this.isChunkLoaded(i, j + 1) && this.isChunkLoaded(i + 1, j)) { chunk.a(this, this, i, j);
this.getChunkAt(this, i, j);
}
if (this.isChunkLoaded(i - 1, j) && !this.getOrCreateChunk(i - 1, j).done && this.isChunkLoaded(i - 1, j + 1) && this.isChunkLoaded(i, j + 1) && this.isChunkLoaded(i - 1, j)) {
this.getChunkAt(this, i - 1, j);
}
if (this.isChunkLoaded(i, j - 1) && !this.getOrCreateChunk(i, j - 1).done && this.isChunkLoaded(i + 1, j - 1) && this.isChunkLoaded(i, j - 1) && this.isChunkLoaded(i + 1, j)) {
this.getChunkAt(this, i, j - 1);
}
if (this.isChunkLoaded(i - 1, j - 1) && !this.getOrCreateChunk(i - 1, j - 1).done && this.isChunkLoaded(i - 1, j - 1) && this.isChunkLoaded(i, j - 1) && this.isChunkLoaded(i - 1, j)) {
this.getChunkAt(this, i - 1, j - 1);
}
} }
return chunk; return chunk;
@ -136,7 +120,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = this.e.a(this.world, i, j); Chunk chunk = this.e.a(this.world, i, j);
if (chunk != null) { if (chunk != null) {
chunk.r = this.world.getTime(); chunk.t = this.world.getTime();
} }
return chunk; return chunk;
@ -160,7 +144,7 @@ public class ChunkProviderServer implements IChunkProvider {
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
if (this.e != null) { if (this.e != null) {
try { try {
chunk.r = this.world.getTime(); chunk.t = this.world.getTime();
this.e.a(this.world, chunk); this.e.a(this.world, chunk);
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
ioexception.printStackTrace(); ioexception.printStackTrace();
@ -205,13 +189,13 @@ public class ChunkProviderServer implements IChunkProvider {
for (int j = 0; j < this.chunkList.size(); ++j) { for (int j = 0; j < this.chunkList.size(); ++j) {
Chunk chunk = (Chunk) this.chunkList.get(j); Chunk chunk = (Chunk) this.chunkList.get(j);
if (flag && !chunk.p) { if (flag && !chunk.r) {
this.saveChunkNOP(chunk); this.saveChunkNOP(chunk);
} }
if (chunk.a(flag)) { if (chunk.a(flag)) {
this.saveChunk(chunk); this.saveChunk(chunk);
chunk.o = false; chunk.q = false;
++i; ++i;
if (i == 24 && !flag) { if (i == 24 && !flag) {
return false; return false;

Datei anzeigen

@ -1,417 +0,0 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
// CraftBukkit start
import org.bukkit.craftbukkit.command.ServerCommandListener;
import org.bukkit.craftbukkit.entity.CraftPlayer;
// CraftBukkit end
public class ConsoleCommandHandler {
private static Logger a = Logger.getLogger("Minecraft");
private MinecraftServer server;
private ICommandListener listener; // CraftBukkit
public ConsoleCommandHandler(MinecraftServer minecraftserver) {
this.server = minecraftserver;
}
// Craftbukkit start
private boolean hasPermission(ICommandListener listener, String perm) {
if (listener instanceof ServerCommandListener) {
ServerCommandListener serv = (ServerCommandListener)listener;
return serv.getSender().hasPermission(perm);
} else if (listener instanceof NetServerHandler) {
NetServerHandler net = (NetServerHandler)listener;
return net.getPlayer().hasPermission(perm);
} else if ((listener instanceof ServerGUI) || (listener instanceof MinecraftServer)) {
return server.console.hasPermission(perm);
}
return false;
}
private boolean checkPermission(ICommandListener listener, String command) {
if (hasPermission(listener, "bukkit.command." + command)) {
return true;
} else {
listener.sendMessage("I'm sorry, Dave, but I cannot let you do that.");
return false;
}
}
// Craftbukkit end
public boolean handle(ServerCommand servercommand) { // CraftBukkit - returns boolean
String s = servercommand.command;
ICommandListener icommandlistener = servercommand.b;
String s1 = icommandlistener.getName();
this.listener = icommandlistener; // CraftBukkit
ServerConfigurationManager serverconfigurationmanager = this.server.serverConfigurationManager;
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
if (s.toLowerCase().startsWith("list")) {
if (!checkPermission(listener, "list")) return true; // Craftbukkit
icommandlistener.sendMessage("Connected players: " + serverconfigurationmanager.c());
} else if (s.toLowerCase().startsWith("stop")) {
if (!checkPermission(listener, "stop")) return true; // Craftbukkit
this.print(s1, "Stopping the server..");
this.server.a();
} else {
int i;
WorldServer worldserver;
if (s.toLowerCase().startsWith("save-all")) {
if (!checkPermission(listener, "save.perform")) return true; // Craftbukkit
this.print(s1, "Forcing save..");
if (serverconfigurationmanager != null) {
serverconfigurationmanager.savePlayers();
}
// CraftBukkit start
for (i = 0; i < this.server.worlds.size(); ++i) {
worldserver = this.server.worlds.get(i);
boolean save = worldserver.canSave;
worldserver.canSave = false;
worldserver.save(true, (IProgressUpdate) null);
worldserver.canSave = save;
}
// CraftBukkit end
this.print(s1, "Save complete.");
} else if (s.toLowerCase().startsWith("save-off")) {
if (!checkPermission(listener, "save.disable")) return true; // Craftbukkit
this.print(s1, "Disabling level saving..");
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
worldserver = this.server.worlds.get(i); // CraftBukkit
worldserver.canSave = true;
}
} else if (s.toLowerCase().startsWith("save-on")) {
if (!checkPermission(listener, "save.enable")) return true; // Craftbukkit
this.print(s1, "Enabling level saving..");
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
worldserver = this.server.worlds.get(i); // CraftBukkit
worldserver.canSave = false;
}
} else {
String s2;
if (s.toLowerCase().startsWith("op ")) {
if (!checkPermission(listener, "op.give")) return true; // Craftbukkit
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.e(s2);
this.print(s1, "Opping " + s2);
serverconfigurationmanager.a(s2, "\u00A7eYou are now op!");
} else if (s.toLowerCase().startsWith("deop ")) {
if (!checkPermission(listener, "op.take")) return true; // Craftbukkit
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.f(s2);
serverconfigurationmanager.a(s2, "\u00A7eYou are no longer op!");
this.print(s1, "De-opping " + s2);
} else if (s.toLowerCase().startsWith("ban-ip ")) {
if (!checkPermission(listener, "ban.ip")) return true; // Craftbukkit
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.c(s2);
this.print(s1, "Banning ip " + s2);
} else if (s.toLowerCase().startsWith("pardon-ip ")) {
if (!checkPermission(listener, "unban.ip")) return true; // Craftbukkit
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.d(s2);
this.print(s1, "Pardoning ip " + s2);
} else {
EntityPlayer entityplayer;
if (s.toLowerCase().startsWith("ban ")) {
if (!checkPermission(listener, "ban.player")) return true; // Craftbukkit
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.a(s2);
this.print(s1, "Banning " + s2);
entityplayer = serverconfigurationmanager.i(s2);
if (entityplayer != null) {
entityplayer.netServerHandler.disconnect("Banned by admin");
}
} else if (s.toLowerCase().startsWith("pardon ")) {
if (!checkPermission(listener, "unban.player")) return true; // Craftbukkit
s2 = s.substring(s.indexOf(" ")).trim();
serverconfigurationmanager.b(s2);
this.print(s1, "Pardoning " + s2);
} else {
int j;
if (s.toLowerCase().startsWith("kick ")) {
if (!checkPermission(listener, "kick")) return true; // Craftbukkit
// CraftBukkit start - Add kick message compatibility
String[] parts = s.split(" ");
s2 = parts.length >= 2 ? parts[1] : "";
// CraftBukkit end
entityplayer = null;
for (j = 0; j < serverconfigurationmanager.players.size(); ++j) {
EntityPlayer entityplayer1 = (EntityPlayer) serverconfigurationmanager.players.get(j);
if (entityplayer1.name.equalsIgnoreCase(s2)) {
entityplayer = entityplayer1;
}
}
if (entityplayer != null) {
entityplayer.netServerHandler.disconnect("Kicked by admin");
this.print(s1, "Kicking " + entityplayer.name);
} else {
icommandlistener.sendMessage("Can\'t find user " + s2 + ". No kick.");
}
} else {
EntityPlayer entityplayer2;
String[] astring;
if (s.toLowerCase().startsWith("tp ")) {
if (!checkPermission(listener, "teleport")) return true; // Craftbukkit
astring = s.split(" ");
if (astring.length == 3) {
entityplayer = serverconfigurationmanager.i(astring[1]);
entityplayer2 = serverconfigurationmanager.i(astring[2]);
if (entityplayer == null) {
icommandlistener.sendMessage("Can\'t find user " + astring[1] + ". No tp.");
} else if (entityplayer2 == null) {
icommandlistener.sendMessage("Can\'t find user " + astring[2] + ". No tp.");
} else if (entityplayer.dimension != entityplayer2.dimension) {
icommandlistener.sendMessage("User " + astring[1] + " and " + astring[2] + " are in different dimensions. No tp.");
} else {
entityplayer.netServerHandler.a(entityplayer2.locX, entityplayer2.locY, entityplayer2.locZ, entityplayer2.yaw, entityplayer2.pitch);
this.print(s1, "Teleporting " + astring[1] + " to " + astring[2] + ".");
}
} else {
icommandlistener.sendMessage("Syntax error, please provice a source and a target.");
}
} else {
String s3;
int k;
if (s.toLowerCase().startsWith("give ")) {
if (!checkPermission(listener, "give")) return true; // Craftbukkit
astring = s.split(" ");
if (astring.length != 3 && astring.length != 4) {
return true; // CraftBukkit
}
s3 = astring[1];
entityplayer2 = serverconfigurationmanager.i(s3);
if (entityplayer2 != null) {
try {
k = Integer.parseInt(astring[2]);
if (Item.byId[k] != null) {
this.print(s1, "Giving " + entityplayer2.name + " some " + k);
int l = 1;
if (astring.length > 3) {
l = this.a(astring[3], 1);
}
if (l < 1) {
l = 1;
}
if (l > 64) {
l = 64;
}
entityplayer2.b(new ItemStack(k, l, 0));
} else {
icommandlistener.sendMessage("There\'s no item with id " + k);
}
} catch (NumberFormatException numberformatexception) {
icommandlistener.sendMessage("There\'s no item with id " + astring[2]);
}
} else {
icommandlistener.sendMessage("Can\'t find user " + s3);
}
} else if (s.toLowerCase().startsWith("time ")) {
astring = s.split(" ");
if (astring.length != 3) {
return true; // CraftBukkit
}
s3 = astring[1];
try {
j = Integer.parseInt(astring[2]);
WorldServer worldserver1;
if ("add".equalsIgnoreCase(s3)) {
if (!checkPermission(listener, "time.add")) return true; // Craftbukkit
for (k = 0; k < this.server.worlds.size(); ++k) { // CraftBukkit
worldserver1 = this.server.worlds.get(k); // CraftBukkit
worldserver1.setTimeAndFixTicklists(worldserver1.getTime() + (long) j);
}
this.print(s1, "Added " + j + " to time");
} else if ("set".equalsIgnoreCase(s3)) {
if (!checkPermission(listener, "time.set")) return true; // Craftbukkit
for (k = 0; k < this.server.worlds.size(); ++k) { // CraftBukkit
worldserver1 = this.server.worlds.get(k); // CraftBukkit
worldserver1.setTimeAndFixTicklists((long) j);
}
this.print(s1, "Set time to " + j);
} else {
icommandlistener.sendMessage("Unknown method, use either \"add\" or \"set\"");
}
} catch (NumberFormatException numberformatexception1) {
icommandlistener.sendMessage("Unable to convert time value, " + astring[2]);
}
} else if (s.toLowerCase().startsWith("say ")) {
if (!checkPermission(listener, "say")) return true; // Craftbukkit
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "] " + s);
serverconfigurationmanager.sendAll(new Packet3Chat("\u00A7d[Server] " + s));
} else if (s.toLowerCase().startsWith("tell ")) {
if (!checkPermission(listener, "tell")) return true; // Craftbukkit
astring = s.split(" ");
if (astring.length >= 3) {
s = s.substring(s.indexOf(" ")).trim();
s = s.substring(s.indexOf(" ")).trim();
a.info("[" + s1 + "->" + astring[1] + "] " + s);
s = "\u00A77" + s1 + " whispers " + s;
a.info(s);
if (!serverconfigurationmanager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
icommandlistener.sendMessage("There\'s no player by that name online.");
}
}
} else if (s.toLowerCase().startsWith("whitelist ")) {
this.a(s1, s, icommandlistener);
} else {
icommandlistener.sendMessage("Unknown console command. Type \"help\" for help."); // CraftBukkit
return false; // CraftBukkit
}
}
}
}
}
}
}
} else {
if (!checkPermission(listener, "help")) return true; // Craftbukkit
this.a(icommandlistener);
}
return true; // CraftBukkit
}
private void a(String s, String s1, ICommandListener icommandlistener) {
String[] astring = s1.split(" ");
this.listener = icommandlistener; // CraftBukkit
if (astring.length >= 2) {
String s2 = astring[1].toLowerCase();
if ("on".equals(s2)) {
if (!checkPermission(listener, "whitelist.enable")) return; // Craftbukkit
this.print(s, "Turned on white-listing");
this.server.propertyManager.b("white-list", true);
} else if ("off".equals(s2)) {
if (!checkPermission(listener, "whitelist.disable")) return; // Craftbukkit
this.print(s, "Turned off white-listing");
this.server.propertyManager.b("white-list", false);
} else if ("list".equals(s2)) {
if (!checkPermission(listener, "whitelist.list")) return; // Craftbukkit
Set set = this.server.serverConfigurationManager.e();
String s3 = "";
String s4;
for (Iterator iterator = set.iterator(); iterator.hasNext(); s3 = s3 + s4 + " ") {
s4 = (String) iterator.next();
}
icommandlistener.sendMessage("White-listed players: " + s3);
} else {
String s5;
if ("add".equals(s2) && astring.length == 3) {
if (!checkPermission(listener, "whitelist.add")) return; // Craftbukkit
s5 = astring[2].toLowerCase();
this.server.serverConfigurationManager.k(s5);
this.print(s, "Added " + s5 + " to white-list");
} else if ("remove".equals(s2) && astring.length == 3) {
if (!checkPermission(listener, "whitelist.remove")) return; // Craftbukkit
s5 = astring[2].toLowerCase();
this.server.serverConfigurationManager.l(s5);
this.print(s, "Removed " + s5 + " from white-list");
} else if ("reload".equals(s2)) {
if (!checkPermission(listener, "whitelist.reload")) return; // Craftbukkit
this.server.serverConfigurationManager.f();
this.print(s, "Reloaded white-list from file");
}
}
}
}
private void a(ICommandListener icommandlistener) {
icommandlistener.sendMessage("To run the server without a gui, start it like this:");
icommandlistener.sendMessage(" java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui");
icommandlistener.sendMessage("Console commands:");
icommandlistener.sendMessage(" help or ? shows this message");
icommandlistener.sendMessage(" kick <player> removes a player from the server");
icommandlistener.sendMessage(" ban <player> bans a player from the server");
icommandlistener.sendMessage(" pardon <player> pardons a banned player so that they can connect again");
icommandlistener.sendMessage(" ban-ip <ip> bans an IP address from the server");
icommandlistener.sendMessage(" pardon-ip <ip> pardons a banned IP address so that they can connect again");
icommandlistener.sendMessage(" op <player> turns a player into an op");
icommandlistener.sendMessage(" deop <player> removes op status from a player");
icommandlistener.sendMessage(" tp <player1> <player2> moves one player to the same location as another player");
icommandlistener.sendMessage(" give <player> <id> [num] gives a player a resource");
icommandlistener.sendMessage(" tell <player> <message> sends a private message to a player");
icommandlistener.sendMessage(" stop gracefully stops the server");
icommandlistener.sendMessage(" save-all forces a server-wide level save");
icommandlistener.sendMessage(" save-off disables terrain saving (useful for backup scripts)");
icommandlistener.sendMessage(" save-on re-enables terrain saving");
icommandlistener.sendMessage(" list lists all currently connected players");
icommandlistener.sendMessage(" say <message> broadcasts a message to all players");
icommandlistener.sendMessage(" time <add|set> <amount> adds to or sets the world time (0-24000)");
}
private void print(String s, String s1) {
String s2 = s + ": " + s1;
// CraftBukkit start
this.listener.sendMessage(s1);
this.informOps("\u00A77(" + s2 + ")");
if (this.listener instanceof MinecraftServer) {
return; // Already logged so don't call a.info()
}
// CraftBukkit end
a.info(s2);
}
// CraftBukkit start
private void informOps(String msg) {
Packet3Chat packet3chat = new Packet3Chat(msg);
EntityPlayer sender = null;
if (this.listener instanceof ServerCommandListener) {
org.bukkit.command.CommandSender commandSender = ((ServerCommandListener) this.listener).getSender();
if (commandSender instanceof CraftPlayer) {
sender = ((CraftPlayer) commandSender).getHandle();
}
}
java.util.List<EntityPlayer> players = this.server.serverConfigurationManager.players;
for (int i = 0; i < players.size(); ++i) {
EntityPlayer entityPlayer = (EntityPlayer) players.get(i);
if (sender != entityPlayer && this.server.serverConfigurationManager.isOp(entityPlayer.name)) {
entityPlayer.netServerHandler.sendPacket(packet3chat);
}
}
}
// CraftBukkit end
private int a(String s, int i) {
try {
return Integer.parseInt(s);
} catch (NumberFormatException numberformatexception) {
return i;
}
}
}

Datei anzeigen

@ -25,6 +25,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE}); this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
this.registerShapedRecipe(new ItemStack(Item.BOOK, 1), new Object[] { "#", "#", "#", Character.valueOf('#'), Item.PAPER}); this.registerShapedRecipe(new ItemStack(Item.BOOK, 1), new Object[] { "#", "#", "#", Character.valueOf('#'), Item.PAPER});
this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK}); this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Item.STICK, Character.valueOf('W'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND}); this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
this.registerShapedRecipe(new ItemStack(Block.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE}); this.registerShapedRecipe(new ItemStack(Block.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Block.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.BOOK}); this.registerShapedRecipe(new ItemStack(Block.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.BOOK});
@ -38,6 +39,8 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE}); 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, 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, 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.LADDER, 2), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Item.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Block.WOOD}); 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(Block.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Block.WOOD});
@ -64,6 +67,8 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.WOOD}); this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING}); this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE}); this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL}); this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE}); this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK}); this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});

Datei anzeigen

@ -8,7 +8,6 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.event.vehicle.VehicleExitEvent;
@ -17,15 +16,14 @@ import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
// CraftBukkit end // CraftBukkit end
public abstract class Entity { public abstract class Entity {
private static int entityCount = 0; private static int entityCount = 0;
public int id; public int id;
public double aH; public double aX;
public boolean aI; public boolean aY;
public Entity passenger; public Entity passenger;
public Entity vehicle; public Entity vehicle;
public World world; public World world;
@ -45,81 +43,80 @@ public abstract class Entity {
public final AxisAlignedBB boundingBox; public final AxisAlignedBB boundingBox;
public boolean onGround; public boolean onGround;
public boolean positionChanged; public boolean positionChanged;
public boolean bc; public boolean bs;
public boolean bd; public boolean bt;
public boolean velocityChanged; public boolean velocityChanged;
public boolean bf; protected boolean bv;
public boolean bg; public boolean bw;
public boolean dead; public boolean dead;
public float height; public float height;
public float length; public float length;
public float width; public float width;
public float bl; public float bB;
public float bm; public float bC;
public float fallDistance; // CraftBukkit - private -> public public float fallDistance; // CraftBukkit - private -> public
private int b; private int b;
public double bo; public double bE;
public double bp; public double bF;
public double bq; public double bG;
public float br; public float bH;
public float bs; public float bI;
public boolean bt; public boolean bJ;
public float bu; public float bK;
protected Random random; protected Random random;
public int ticksLived; public int ticksLived;
public int maxFireTicks; public int maxFireTicks;
public int fireTicks; public int fireTicks;
public int maxAirTicks; // CraftBukkit - protected - >public public int maxAirTicks; // CraftBukkit - protected - >public
protected boolean bA; protected boolean bQ;
public int noDamageTicks; public int noDamageTicks;
public int airTicks; public int airTicks;
private boolean justCreated; private boolean justCreated;
protected boolean fireProof; protected boolean fireProof;
protected DataWatcher datawatcher; protected DataWatcher datawatcher;
public float bF;
private double d; private double d;
private double e; private double e;
public boolean bG; public boolean bV;
public int bH; public int bW;
public int bI; public int bX;
public int bJ; public int bY;
public boolean bK; public boolean bZ;
public boolean ca;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public Entity(World world) { public Entity(World world) {
this.id = entityCount++; this.id = entityCount++;
this.aH = 1.0D; this.aX = 1.0D;
this.aI = false; this.aY = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false; this.onGround = false;
this.bd = false; this.bt = false;
this.velocityChanged = false; this.velocityChanged = false;
this.bg = true; this.bw = true;
this.dead = false; this.dead = false;
this.height = 0.0F; this.height = 0.0F;
this.length = 0.6F; this.length = 0.6F;
this.width = 1.8F; this.width = 1.8F;
this.bl = 0.0F; this.bB = 0.0F;
this.bm = 0.0F; this.bC = 0.0F;
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
this.b = 1; this.b = 1;
this.br = 0.0F; this.bH = 0.0F;
this.bs = 0.0F; this.bI = 0.0F;
this.bt = false; this.bJ = false;
this.bu = 0.0F; this.bK = 0.0F;
this.random = new Random(); this.random = new Random();
this.ticksLived = 0; this.ticksLived = 0;
this.maxFireTicks = 1; this.maxFireTicks = 1;
this.fireTicks = 0; this.fireTicks = 0;
this.maxAirTicks = 300; this.maxAirTicks = 300;
this.bA = false; this.bQ = false;
this.noDamageTicks = 0; this.noDamageTicks = 0;
this.airTicks = 300; this.airTicks = 300;
this.justCreated = true; this.justCreated = true;
this.fireProof = false; this.fireProof = false;
this.datawatcher = new DataWatcher(); this.datawatcher = new DataWatcher();
this.bF = 0.0F; this.bV = false;
this.bG = false;
this.world = world; this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D); this.setPosition(0.0D, 0.0D, 0.0D);
this.datawatcher.a(0, Byte.valueOf((byte) 0)); this.datawatcher.a(0, Byte.valueOf((byte) 0));
@ -128,7 +125,7 @@ public abstract class Entity {
protected abstract void b(); protected abstract void b();
public DataWatcher aa() { public DataWatcher al() {
return this.datawatcher; return this.datawatcher;
} }
@ -188,27 +185,41 @@ public abstract class Entity {
float f = this.length / 2.0F; float f = this.length / 2.0F;
float f1 = this.width; float f1 = this.width;
this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.br, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.br + (double) f1, d2 + (double) f); this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bH, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bH + (double) f1, d2 + (double) f);
} }
public void m_() { public void s_() {
this.R(); this.aa();
} }
public void R() { public void aa() {
if (this.vehicle != null && this.vehicle.dead) { if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} }
++this.ticksLived; ++this.ticksLived;
this.bl = this.bm; this.bB = this.bC;
this.lastX = this.locX; this.lastX = this.locX;
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;
this.lastPitch = this.pitch; this.lastPitch = this.pitch;
this.lastYaw = this.yaw; this.lastYaw = this.yaw;
int i;
if (this.at()) {
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
i = MathHelper.floor(this.locZ);
int l = this.world.getTypeId(j, k, i);
if (l > 0) {
this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.length, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.length, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
}
}
if (this.f_()) { if (this.f_()) {
if (!this.bA && !this.justCreated) { if (!this.bQ && !this.justCreated) {
float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F; float f = MathHelper.a(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F) { if (f > 1.0F) {
@ -218,28 +229,27 @@ public abstract class Entity {
this.world.makeSound(this, "random.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); this.world.makeSound(this, "random.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
float f1 = (float) MathHelper.floor(this.boundingBox.b); float f1 = (float) MathHelper.floor(this.boundingBox.b);
int i;
float f2; float f2;
float f3; float f3;
for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) { for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) {
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
this.world.a("bubble", this.locX + (double) f2, (double) (f1 + 1.0F), this.locZ + (double) f3, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
this.world.a("bubble", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ);
} }
for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) { for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) {
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
this.world.a("splash", this.locX + (double) f2, (double) (f1 + 1.0F), this.locZ + (double) f3, this.motX, this.motY, this.motZ); f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length;
this.world.a("splash", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY, this.motZ);
} }
} }
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
this.bA = true; this.bQ = true;
this.fireTicks = 0; this.fireTicks = 0;
} else { } else {
this.bA = false; this.bQ = false;
} }
if (this.world.isStatic) { if (this.world.isStatic) {
@ -258,10 +268,10 @@ public abstract class Entity {
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.damageEntity((Entity) null, event.getDamage()); this.damageEntity(DamageSource.b, event.getDamage());
} }
} else { } else {
this.damageEntity((Entity) null, 1); this.damageEntity(DamageSource.b, 1);
} }
// CraftBukkit end // CraftBukkit end
} }
@ -270,12 +280,12 @@ public abstract class Entity {
} }
} }
if (this.ae()) { if (this.ap()) {
this.ab(); this.am();
} }
if (this.locY < -64.0D) { if (this.locY < -64.0D) {
this.Y(); this.ah();
} }
if (!this.world.isStatic) { if (!this.world.isStatic) {
@ -286,7 +296,7 @@ public abstract class Entity {
this.justCreated = false; this.justCreated = false;
} }
protected void ab() { protected void am() {
if (!this.fireProof) { if (!this.fireProof) {
// CraftBukkit start - TODO: this event spams! // CraftBukkit start - TODO: this event spams!
if (this instanceof EntityLiving) { if (this instanceof EntityLiving) {
@ -300,7 +310,7 @@ public abstract class Entity {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.damageEntity((Entity) null, event.getDamage()); this.damageEntity(DamageSource.c, event.getDamage());
} }
if (this.fireTicks <= 0) { if (this.fireTicks <= 0) {
@ -319,12 +329,12 @@ public abstract class Entity {
} }
// CraftBukkit end // CraftBukkit end
this.damageEntity((Entity) null, 4); this.damageEntity(DamageSource.c, 4);
this.fireTicks = 600; this.fireTicks = 600;
} }
} }
protected void Y() { protected void ah() {
this.die(); this.die();
} }
@ -336,18 +346,18 @@ public abstract class Entity {
} }
public void move(double d0, double d1, double d2) { public void move(double d0, double d1, double d2) {
if (this.bt) { if (this.bJ) {
this.boundingBox.d(d0, d1, d2); this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.br; this.locY = this.boundingBox.b + (double) this.height - (double) this.bH;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else { } else {
this.br *= 0.4F; this.bH *= 0.4F;
double d3 = this.locX; double d3 = this.locX;
double d4 = this.locZ; double d4 = this.locZ;
if (this.bf) { if (this.bv) {
this.bf = false; this.bv = false;
d0 *= 0.25D; d0 *= 0.25D;
d1 *= 0.05000000074505806D; d1 *= 0.05000000074505806D;
d2 *= 0.25D; d2 *= 0.25D;
@ -393,7 +403,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, d1, 0.0D); this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bg && d6 != d1) { if (!this.bw && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -408,7 +418,7 @@ public abstract class Entity {
} }
this.boundingBox.d(d0, 0.0D, 0.0D); this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bg && d5 != d0) { if (!this.bw && d5 != d0) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -419,7 +429,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, 0.0D, d2); this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bg && d7 != d2) { if (!this.bw && d7 != d2) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -429,13 +439,13 @@ public abstract class Entity {
double d10; double d10;
int k; int k;
if (this.bs > 0.0F && flag1 && (flag || this.br < 0.05F) && (d5 != d0 || d7 != d2)) { if (this.bI > 0.0F && flag1 && (flag || this.bH < 0.05F) && (d5 != d0 || d7 != d2)) {
d9 = d0; d9 = d0;
d10 = d1; d10 = d1;
double d11 = d2; double d11 = d2;
d0 = d5; d0 = d5;
d1 = (double) this.bs; d1 = (double) this.bI;
d2 = d7; d2 = d7;
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone(); AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
@ -447,7 +457,7 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, d1, 0.0D); this.boundingBox.d(0.0D, d1, 0.0D);
if (!this.bg && d6 != d1) { if (!this.bw && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -458,7 +468,7 @@ public abstract class Entity {
} }
this.boundingBox.d(d0, 0.0D, 0.0D); this.boundingBox.d(d0, 0.0D, 0.0D);
if (!this.bg && d5 != d0) { if (!this.bw && d5 != d0) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
@ -469,18 +479,18 @@ public abstract class Entity {
} }
this.boundingBox.d(0.0D, 0.0D, d2); this.boundingBox.d(0.0D, 0.0D, d2);
if (!this.bg && d7 != d2) { if (!this.bw && d7 != d2) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
} }
if (!this.bg && d6 != d1) { if (!this.bw && d6 != d1) {
d2 = 0.0D; d2 = 0.0D;
d1 = 0.0D; d1 = 0.0D;
d0 = 0.0D; d0 = 0.0D;
} else { } else {
d1 = (double) (-this.bs); d1 = (double) (-this.bI);
for (k = 0; k < list.size(); ++k) { for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1); d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@ -498,18 +508,18 @@ public abstract class Entity {
double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b); double d12 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
if (d12 > 0.0D) { if (d12 > 0.0D) {
this.br = (float) ((double) this.br + d12 + 0.01D); this.bH = (float) ((double) this.bH + d12 + 0.01D);
} }
} }
} }
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
this.locY = this.boundingBox.b + (double) this.height - (double) this.br; this.locY = this.boundingBox.b + (double) this.height - (double) this.bH;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.positionChanged = d5 != d0 || d7 != d2; this.positionChanged = d5 != d0 || d7 != d2;
this.bc = d6 != d1; this.bs = d6 != d1;
this.onGround = d6 != d1 && d6 < 0.0D; this.onGround = d6 != d1 && d6 < 0.0D;
this.bd = this.positionChanged || this.bc; this.bt = this.positionChanged || this.bs;
this.a(d1, this.onGround); this.a(d1, this.onGround);
if (d5 != d0) { if (d5 != d0) {
this.motX = 0.0D; this.motX = 0.0D;
@ -549,8 +559,8 @@ public abstract class Entity {
} }
// CraftBukkit end // CraftBukkit end
if (this.n() && !flag && this.vehicle == null) { if (this.e_() && !flag && this.vehicle == null) {
this.bm = (float) ((double) this.bm + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); this.bC = (float) ((double) this.bC + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
l = MathHelper.floor(this.locX); l = MathHelper.floor(this.locX);
i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
j1 = MathHelper.floor(this.locZ); j1 = MathHelper.floor(this.locZ);
@ -559,8 +569,8 @@ public abstract class Entity {
k = this.world.getTypeId(l, i1 - 1, j1); k = this.world.getTypeId(l, i1 - 1, j1);
} }
if (this.bm > (float) this.b && k > 0) { if (this.bC > (float) this.b && k > 0) {
++this.b; this.b = (int) this.bC + 1;
StepSound stepsound = Block.byId[k].stepSound; StepSound stepsound = Block.byId[k].stepSound;
if (this.world.getTypeId(l, i1 + 1, j1) == Block.SNOW.id) { if (this.world.getTypeId(l, i1 + 1, j1) == Block.SNOW.id) {
@ -595,7 +605,7 @@ public abstract class Entity {
} }
} }
boolean flag2 = this.ac(); boolean flag2 = this.an();
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) { if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
this.burn(1); this.burn(1);
@ -625,7 +635,7 @@ public abstract class Entity {
} }
} }
protected boolean n() { protected boolean e_() {
return true; return true;
} }
@ -640,7 +650,7 @@ public abstract class Entity {
} }
} }
public AxisAlignedBB e_() { public AxisAlignedBB f() {
return null; return null;
} }
@ -658,7 +668,7 @@ public abstract class Entity {
i = event.getDamage(); i = event.getDamage();
} }
// CraftBukkit end // CraftBukkit end
this.damageEntity((Entity) null, i); this.damageEntity(DamageSource.a, i);
} }
} }
@ -668,12 +678,12 @@ public abstract class Entity {
} }
} }
public boolean ac() { public boolean an() {
return this.bA || this.world.s(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); return this.bQ || this.world.s(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
} }
public boolean ad() { public boolean ao() {
return this.bA; return this.bQ;
} }
public boolean f_() { public boolean f_() {
@ -701,7 +711,7 @@ public abstract class Entity {
return 0.0F; return 0.0F;
} }
public boolean ae() { public boolean ap() {
return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); return this.world.a(this.boundingBox.b(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
} }
@ -724,22 +734,19 @@ public abstract class Entity {
} }
} }
public float c(float f) { public float a_(float f) {
int i = MathHelper.floor(this.locX); int i = MathHelper.floor(this.locX);
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D; int j = MathHelper.floor(this.locZ);
int j = MathHelper.floor(this.locY - (double) this.height + d0); World world = this.world;
int k = MathHelper.floor(this.locZ);
if (this.world.a(MathHelper.floor(this.boundingBox.a), MathHelper.floor(this.boundingBox.b), MathHelper.floor(this.boundingBox.c), MathHelper.floor(this.boundingBox.d), MathHelper.floor(this.boundingBox.e), MathHelper.floor(this.boundingBox.f))) { this.world.getClass();
float f1 = this.world.n(i, j, k); if (world.isLoaded(i, 128 / 2, j)) {
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
int k = MathHelper.floor(this.locY - (double) this.height + d0);
if (f1 < this.bF) { return this.world.m(i, k, j);
f1 = this.bF;
}
return f1;
} else { } else {
return this.bF; return 0.0F;
} }
} }
@ -760,7 +767,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2; this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f; this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1; this.lastPitch = this.pitch = f1;
this.br = 0.0F; this.bH = 0.0F;
double d3 = (double) (this.lastYaw - f); double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) { if (d3 < -180.0D) {
@ -776,15 +783,15 @@ public abstract class Entity {
} }
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) { public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
this.bo = this.lastX = this.locX = d0; this.bE = this.lastX = this.locX = d0;
this.bp = this.lastY = this.locY = d1 + (double) this.height; this.bF = this.lastY = this.locY = d1 + (double) this.height;
this.bq = this.lastZ = this.locZ = d2; this.bG = this.lastZ = this.locZ = d2;
this.yaw = f; this.yaw = f;
this.pitch = f1; this.pitch = f1;
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
} }
public float f(Entity entity) { public float g(Entity entity) {
float f = (float) (this.locX - entity.locX); float f = (float) (this.locX - entity.locX);
float f1 = (float) (this.locY - entity.locY); float f1 = (float) (this.locY - entity.locY);
float f2 = (float) (this.locZ - entity.locZ); float f2 = (float) (this.locZ - entity.locZ);
@ -808,7 +815,7 @@ public abstract class Entity {
return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5); return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
} }
public double g(Entity entity) { public double h(Entity entity) {
double d0 = this.locX - entity.locX; double d0 = this.locX - entity.locX;
double d1 = this.locY - entity.locY; double d1 = this.locY - entity.locY;
double d2 = this.locZ - entity.locZ; double d2 = this.locZ - entity.locZ;
@ -816,7 +823,7 @@ public abstract class Entity {
return d0 * d0 + d1 * d1 + d2 * d2; return d0 * d0 + d1 * d1 + d2 * d2;
} }
public void b(EntityHuman entityhuman) {} public void a_(EntityHuman entityhuman) {}
public void collide(Entity entity) { public void collide(Entity entity) {
if (entity.passenger != this && entity.vehicle != this) { if (entity.passenger != this && entity.vehicle != this) {
@ -838,8 +845,8 @@ public abstract class Entity {
d1 *= d3; d1 *= d3;
d0 *= 0.05000000074505806D; d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D; d1 *= 0.05000000074505806D;
d0 *= (double) (1.0F - this.bu); d0 *= (double) (1.0F - this.bK);
d1 *= (double) (1.0F - this.bu); d1 *= (double) (1.0F - this.bK);
this.b(-d0, 0.0D, -d1); this.b(-d0, 0.0D, -d1);
entity.b(d0, 0.0D, d1); entity.b(d0, 0.0D, d1);
} }
@ -850,29 +857,30 @@ public abstract class Entity {
this.motX += d0; this.motX += d0;
this.motY += d1; this.motY += d1;
this.motZ += d2; this.motZ += d2;
this.ca = true;
} }
protected void af() { protected void aq() {
this.velocityChanged = true; this.velocityChanged = true;
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
this.af(); this.aq();
return false; return false;
} }
public boolean l_() { public boolean r_() {
return false; return false;
} }
public boolean d_() { public boolean g() {
return false; return false;
} }
public void c(Entity entity, int i) {} public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) { public boolean c(NBTTagCompound nbttagcompound) {
String s = this.ag(); String s = this.ar();
if (!this.dead && s != null) { if (!this.dead && s != null) {
nbttagcompound.setString("id", s); nbttagcompound.setString("id", s);
@ -884,7 +892,7 @@ public abstract class Entity {
} }
public void d(NBTTagCompound nbttagcompound) { public void d(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Pos", (NBTBase) this.a(new double[] { this.locX, this.locY + (double) this.br, this.locZ})); nbttagcompound.a("Pos", (NBTBase) this.a(new double[] { this.locX, this.locY + (double) this.bH, this.locZ}));
nbttagcompound.a("Motion", (NBTBase) this.a(new double[] { this.motX, this.motY, this.motZ})); nbttagcompound.a("Motion", (NBTBase) this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero // CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
@ -934,9 +942,9 @@ public abstract class Entity {
} }
// CraftBukkit end */ // CraftBukkit end */
this.lastX = this.bo = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; this.lastX = this.bE = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
this.lastY = this.bp = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; this.lastY = this.bF = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
this.lastZ = this.bq = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; this.lastZ = this.bG = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a; this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a; this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a;
this.fallDistance = nbttagcompound.g("FallDistance"); this.fallDistance = nbttagcompound.g("FallDistance");
@ -997,7 +1005,7 @@ public abstract class Entity {
// CraftBukkit end // CraftBukkit end
} }
protected final String ag() { protected final String ar() {
return EntityTypes.b(this); return EntityTypes.b(this);
} }
@ -1049,11 +1057,11 @@ public abstract class Entity {
return entityitem; return entityitem;
} }
public boolean T() { public boolean ac() {
return !this.dead; return !this.dead;
} }
public boolean K() { public boolean O() {
for (int i = 0; i < 8; ++i) { for (int i = 0; i < 8; ++i) {
float f = ((float) ((i >> 0) % 2) - 0.5F) * this.length * 0.9F; float f = ((float) ((i >> 0) % 2) - 0.5F) * this.length * 0.9F;
float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F; float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F;
@ -1070,24 +1078,24 @@ public abstract class Entity {
return false; return false;
} }
public boolean a(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
return false; return false;
} }
public AxisAlignedBB a_(Entity entity) { public AxisAlignedBB b(Entity entity) {
return null; return null;
} }
public void E() { public void I() {
if (this.vehicle.dead) { if (this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} else { } else {
this.motX = 0.0D; this.motX = 0.0D;
this.motY = 0.0D; this.motY = 0.0D;
this.motZ = 0.0D; this.motZ = 0.0D;
this.m_(); this.s_();
if (this.vehicle != null) { if (this.vehicle != null) {
this.vehicle.f(); this.vehicle.g_();
this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw); this.e += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) { for (this.d += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.e >= 180.0D; this.e -= 360.0D) {
@ -1134,15 +1142,15 @@ public abstract class Entity {
} }
} }
public void f() { public void g_() {
this.passenger.setPosition(this.locX, this.locY + this.m() + this.passenger.I(), this.locZ); this.passenger.setPosition(this.locX, this.locY + this.n() + this.passenger.M(), this.locZ);
} }
public double I() { public double M() {
return (double) this.height; return (double) this.height;
} }
public double m() { public double n() {
return (double) this.width * 0.75D; return (double) this.width * 0.75D;
} }
@ -1206,25 +1214,37 @@ public abstract class Entity {
} }
} }
public Vec3D Z() { public Vec3D ai() {
return null; return null;
} }
public void P() {} public void T() {}
public ItemStack[] getEquipment() { public ItemStack[] getEquipment() {
return null; return null;
} }
public boolean isSneaking() { public boolean isSneaking() {
return this.d(1); return this.e(1);
} }
public void setSneak(boolean flag) { public void setSneak(boolean flag) {
this.a(1, flag); this.a(1, flag);
} }
protected boolean d(int i) { public boolean at() {
return this.e(3);
}
public void g(boolean flag) {
this.a(3, flag);
}
public void h(boolean flag) {
this.a(4, flag);
}
protected boolean e(int i) {
return (this.datawatcher.a(0) & 1 << i) != 0; return (this.datawatcher.a(0) & 1 << i) != 0;
} }
@ -1335,4 +1355,18 @@ public abstract class Entity {
return false; return false;
} }
public void q() {
this.bv = true;
}
public String Y() {
String s = EntityTypes.b(this);
if (s == null) {
s = "generic";
}
return StatisticCollector.a("entity." + s + ".name");
}
} }

Datei anzeigen

@ -13,17 +13,18 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
public class EntityArrow extends Entity { public class EntityArrow extends Entity {
private int d = -1;
private int e = -1; private int e = -1;
private int f = -1; private int f = -1;
private int g = 0; private int g = -1;
private int h = 0; private int h = 0;
private int i = 0;
private boolean inGround = false; private boolean inGround = false;
public boolean fromPlayer = false; public boolean fromPlayer = false;
public int shake = 0; public int shake = 0;
public EntityLiving shooter; public Entity shooter;
private int j; private int k;
private int k = 0; private int l = 0;
public boolean d = false;
public EntityArrow(World world) { public EntityArrow(World world) {
super(world); super(world);
@ -37,7 +38,7 @@ public class EntityArrow extends Entity {
this.height = 0.0F; this.height = 0.0F;
} }
public EntityArrow(World world, EntityLiving entityliving) { public EntityArrow(World world, EntityLiving entityliving, float f) {
super(world); super(world);
this.shooter = entityliving; this.shooter = entityliving;
this.fromPlayer = entityliving instanceof EntityHuman; this.fromPlayer = entityliving instanceof EntityHuman;
@ -51,7 +52,7 @@ public class EntityArrow extends Entity {
this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F)); this.motX = (double) (-MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F)); this.motZ = (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * MathHelper.cos(this.pitch / 180.0F * 3.1415927F));
this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F)); this.motY = (double) (-MathHelper.sin(this.pitch / 180.0F * 3.1415927F));
this.a(this.motX, this.motY, this.motZ, 1.5F, 1.0F); this.a(this.motX, this.motY, this.motZ, f * 1.5F, 1.0F);
} }
protected void b() {} protected void b() {}
@ -75,11 +76,11 @@ public class EntityArrow extends Entity {
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D); this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
this.j = 0; this.k = 0;
} }
public void m_() { public void s_() {
super.m_(); super.s_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) { if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
@ -87,11 +88,11 @@ public class EntityArrow extends Entity {
this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D); this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
} }
int i = this.world.getTypeId(this.d, this.e, this.f); int i = this.world.getTypeId(this.e, this.f, this.g);
if (i > 0) { if (i > 0) {
Block.byId[i].a(this.world, this.d, this.e, this.f); Block.byId[i].a((IBlockAccess) this.world, this.e, this.f, this.g);
AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.d, this.e, this.f); AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.e, this.f, this.g);
if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) { if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) {
this.inGround = true; this.inGround = true;
@ -103,12 +104,12 @@ public class EntityArrow extends Entity {
} }
if (this.inGround) { if (this.inGround) {
i = this.world.getTypeId(this.d, this.e, this.f); i = this.world.getTypeId(this.e, this.f, this.g);
int j = this.world.getData(this.d, this.e, this.f); int j = this.world.getData(this.e, this.f, this.g);
if (i == this.g && j == this.h) { if (i == this.h && j == this.i) {
++this.j; ++this.k;
if (this.j == 1200) { if (this.k == 1200) {
this.die(); this.die();
} }
} else { } else {
@ -116,11 +117,11 @@ public class EntityArrow extends Entity {
this.motX *= (double) (this.random.nextFloat() * 0.2F); this.motX *= (double) (this.random.nextFloat() * 0.2F);
this.motY *= (double) (this.random.nextFloat() * 0.2F); this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F); this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
this.k = 0; this.k = 0;
this.l = 0;
} }
} else { } else {
++this.k; ++this.l;
Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ); Vec3D vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); Vec3D vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true); MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
@ -135,18 +136,19 @@ public class EntityArrow extends Entity {
List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D)); List list = this.world.b((Entity) this, this.boundingBox.a(this.motX, this.motY, this.motZ).b(1.0D, 1.0D, 1.0D));
double d0 = 0.0D; double d0 = 0.0D;
int k;
float f1; float f1;
for (int k = 0; k < list.size(); ++k) { for (k = 0; k < list.size(); ++k) {
Entity entity1 = (Entity) list.get(k); Entity entity1 = (Entity) list.get(k);
if (entity1.l_() && (entity1 != this.shooter || this.k >= 5)) { if (entity1.r_() && (entity1 != this.shooter || this.l >= 5)) {
f1 = 0.3F; f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.b((double) f1, (double) f1, (double) f1); AxisAlignedBB axisalignedbb1 = entity1.boundingBox.b((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.a(movingobjectposition1.f); double d1 = vec3d.b(movingobjectposition1.f);
if (d1 < d0 || d0 == 0.0D) { if (d1 < d0 || d0 == 0.0D) {
entity = entity1; entity = entity1;
@ -168,6 +170,13 @@ public class EntityArrow extends Entity {
this.world.getServer().getPluginManager().callEvent(phe); this.world.getServer().getPluginManager().callEvent(phe);
// CraftBukkit end // CraftBukkit end
if (movingobjectposition.entity != null) { if (movingobjectposition.entity != null) {
f2 = MathHelper.a(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int l = (int) Math.ceil((double) f2 * 2.0D);
if (this.d) {
l = l * 3 / 2 + 1;
}
// CraftBukkit start // CraftBukkit start
boolean stick; boolean stick;
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
@ -187,10 +196,10 @@ public class EntityArrow extends Entity {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the arrow should stick in or not, i.e. !bounce // this function returns if the arrow should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(this, event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this), event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(this.shooter, 4); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this.shooter), 4);
} }
if (stick) { if (stick) {
// CraftBukkit end // CraftBukkit end
@ -202,14 +211,14 @@ public class EntityArrow extends Entity {
this.motZ *= -0.10000000149011612D; this.motZ *= -0.10000000149011612D;
this.yaw += 180.0F; this.yaw += 180.0F;
this.lastYaw += 180.0F; this.lastYaw += 180.0F;
this.k = 0; this.l = 0;
} }
} else { } else {
this.d = movingobjectposition.b; this.e = movingobjectposition.b;
this.e = movingobjectposition.c; this.f = movingobjectposition.c;
this.f = movingobjectposition.d; this.g = movingobjectposition.d;
this.g = this.world.getTypeId(this.d, this.e, this.f); this.h = this.world.getTypeId(this.e, this.f, this.g);
this.h = this.world.getData(this.d, this.e, this.f); this.i = this.world.getData(this.e, this.f, this.g);
this.motX = (double) ((float) (movingobjectposition.f.a - this.locX)); this.motX = (double) ((float) (movingobjectposition.f.a - this.locX));
this.motY = (double) ((float) (movingobjectposition.f.b - this.locY)); this.motY = (double) ((float) (movingobjectposition.f.b - this.locY));
this.motZ = (double) ((float) (movingobjectposition.f.c - this.locZ)); this.motZ = (double) ((float) (movingobjectposition.f.c - this.locZ));
@ -220,6 +229,13 @@ public class EntityArrow extends Entity {
this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F)); this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.inGround = true; this.inGround = true;
this.shake = 7; this.shake = 7;
this.d = false;
}
}
if (this.d) {
for (k = 0; k < 4; ++k) {
this.world.a("crit", this.locX + this.motX * (double) k / 4.0D, this.locY + this.motY * (double) k / 4.0D, this.locZ + this.motZ * (double) k / 4.0D, -this.motX, -this.motY + 0.2D, -this.motZ);
} }
} }
@ -249,9 +265,9 @@ public class EntityArrow extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f3 = 0.99F; float f3 = 0.99F;
f1 = 0.03F; f1 = 0.05F;
if (this.ad()) { if (this.ao()) {
for (int l = 0; l < 4; ++l) { for (int i1 = 0; i1 < 4; ++i1) {
float f4 = 0.25F; float f4 = 0.25F;
this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ); this.world.a("bubble", this.locX - this.motX * (double) f4, this.locY - this.motY * (double) f4, this.locZ - this.motZ * (double) f4, this.motX, this.motY, this.motZ);
@ -269,28 +285,28 @@ public class EntityArrow extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.d); nbttagcompound.a("xTile", (short) this.e);
nbttagcompound.a("yTile", (short) this.e); nbttagcompound.a("yTile", (short) this.f);
nbttagcompound.a("zTile", (short) this.f); nbttagcompound.a("zTile", (short) this.g);
nbttagcompound.a("inTile", (byte) this.g); nbttagcompound.a("inTile", (byte) this.h);
nbttagcompound.a("inData", (byte) this.h); nbttagcompound.a("inData", (byte) this.i);
nbttagcompound.a("shake", (byte) this.shake); nbttagcompound.a("shake", (byte) this.shake);
nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0)); nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0));
nbttagcompound.a("player", this.fromPlayer); nbttagcompound.a("player", this.fromPlayer);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.d("xTile"); this.e = nbttagcompound.d("xTile");
this.e = nbttagcompound.d("yTile"); this.f = nbttagcompound.d("yTile");
this.f = nbttagcompound.d("zTile"); this.g = nbttagcompound.d("zTile");
this.g = nbttagcompound.c("inTile") & 255; this.h = nbttagcompound.c("inTile") & 255;
this.h = nbttagcompound.c("inData") & 255; this.i = nbttagcompound.c("inData") & 255;
this.shake = nbttagcompound.c("shake") & 255; this.shake = nbttagcompound.c("shake") & 255;
this.inGround = nbttagcompound.c("inGround") == 1; this.inGround = nbttagcompound.c("inGround") == 1;
this.fromPlayer = nbttagcompound.m("player"); this.fromPlayer = nbttagcompound.m("player");
} }
public void b(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
// CraftBukkit start // CraftBukkit start
ItemStack itemstack = new ItemStack(Item.ARROW, 1); ItemStack itemstack = new ItemStack(Item.ARROW, 1);

Datei anzeigen

@ -49,26 +49,26 @@ public class EntityBoat extends Entity {
this.damage = 0; this.damage = 0;
this.b = 0; this.b = 0;
this.c = 1; this.c = 1;
this.aI = true; this.aY = true;
this.b(1.5F, 0.6F); this.b(1.5F, 0.6F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
} }
protected boolean n() { protected boolean e_() {
return false; return false;
} }
protected void b() {} protected void b() {}
public AxisAlignedBB a_(Entity entity) { public AxisAlignedBB b(Entity entity) {
return entity.boundingBox; return entity.boundingBox;
} }
public AxisAlignedBB e_() { public AxisAlignedBB f() {
return this.boundingBox; return this.boundingBox;
} }
public boolean d_() { public boolean g() {
return true; return true;
} }
@ -85,15 +85,15 @@ public class EntityBoat extends Entity {
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
} }
public double m() { public double n() {
return (double) this.width * 0.0D - 0.30000001192092896D; return (double) this.width * 0.0D - 0.30000001192092896D;
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
if (!this.world.isStatic && !this.dead) { if (!this.world.isStatic && !this.dead) {
// CraftBukkit start // CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity(); Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (entity == null) ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity attacker = (damagesource.a() == null) ? null : damagesource.a().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, i); VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, i);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -107,7 +107,7 @@ public class EntityBoat extends Entity {
this.c = -this.c; this.c = -this.c;
this.b = 10; this.b = 10;
this.damage += i * 10; this.damage += i * 10;
this.af(); this.aq();
if (this.damage > 40) { if (this.damage > 40) {
// CraftBukkit start // CraftBukkit start
@ -143,11 +143,11 @@ public class EntityBoat extends Entity {
} }
} }
public boolean l_() { public boolean r_() {
return !this.dead; return !this.dead;
} }
public void m_() { public void s_() {
// CraftBukkit start // CraftBukkit start
double prevX = this.locX; double prevX = this.locX;
double prevY = this.locY; double prevY = this.locY;
@ -156,7 +156,7 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch; float prevPitch = this.pitch;
// CraftBukkit end // CraftBukkit end
super.m_(); super.s_();
if (this.b > 0) { if (this.b > 0) {
--this.b; --this.b;
} }
@ -358,7 +358,7 @@ public class EntityBoat extends Entity {
for (l = 0; l < list.size(); ++l) { for (l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l); Entity entity = (Entity) list.get(l);
if (entity != this.passenger && entity.d_() && entity instanceof EntityBoat) { if (entity != this.passenger && entity.g() && entity instanceof EntityBoat) {
entity.collide(this); entity.collide(this);
} }
} }
@ -381,12 +381,12 @@ public class EntityBoat extends Entity {
} }
} }
public void f() { public void g_() {
if (this.passenger != null) { if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D; double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
this.passenger.setPosition(this.locX + d0, this.locY + this.m() + this.passenger.I(), this.locZ + d1); this.passenger.setPosition(this.locX + d0, this.locY + this.n() + this.passenger.M(), this.locZ + d1);
} }
} }
@ -394,7 +394,7 @@ public class EntityBoat extends Entity {
protected void a(NBTTagCompound nbttagcompound) {} protected void a(NBTTagCompound nbttagcompound) {}
public boolean a(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) { if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true; return true;
} else { } else {

Datei anzeigen

@ -23,27 +23,47 @@ public class EntityCow extends EntityAnimal {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected String g() {
return "mob.cow";
}
protected String h() { protected String h() {
return "mob.cowhurt"; return "mob.cow";
} }
protected String i() { protected String i() {
return "mob.cowhurt"; return "mob.cowhurt";
} }
protected float k() { protected String j() {
return "mob.cowhurt";
}
protected float l() {
return 0.4F; return 0.4F;
} }
protected int j() { protected int k() {
return Item.LEATHER.id; return Item.LEATHER.id;
} }
public boolean a(EntityHuman entityhuman) { protected void a(boolean flag) {
int i = this.random.nextInt(3);
int j;
for (j = 0; j < i; ++j) {
this.b(Item.LEATHER.id, 1);
}
i = this.random.nextInt(3) + 1;
for (j = 0; j < i; ++j) {
if (this.fireTicks > 0) {
this.b(Item.COOKED_BEEF.id, 1);
} else {
this.b(Item.RAW_BEEF.id, 1);
}
}
}
public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand(); ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) { if (itemstack != null && itemstack.id == Item.BUCKET.id) {

Datei anzeigen

@ -6,22 +6,27 @@ import org.bukkit.craftbukkit.TrigMath;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
// CraftBukkit end // CraftBukkit end
public class EntityCreature extends EntityLiving { public abstract class EntityCreature extends EntityLiving {
public PathEntity pathEntity; // CraftBukkit - public public PathEntity pathEntity; // CraftBukkit - public
public Entity target; // CraftBukkit - public public Entity target; // CraftBukkit - public
protected boolean e = false; protected boolean e = false;
protected int f = 0;
public EntityCreature(World world) { public EntityCreature(World world) {
super(world); super(world);
} }
protected boolean w() { protected boolean v() {
return false; return false;
} }
protected void c_() { protected void c_() {
this.e = this.w(); if (this.f > 0) {
--this.f;
}
this.e = this.v();
float f = 16.0F; float f = 16.0F;
if (this.target == null) { if (this.target == null) {
@ -44,7 +49,7 @@ public class EntityCreature extends EntityLiving {
if (this.target != null) { if (this.target != null) {
this.pathEntity = this.world.findPath(this, this.target, f); this.pathEntity = this.world.findPath(this, this.target, f);
} }
} else if (!this.target.T()) { } else if (!this.target.ac()) {
// CraftBukkit start // CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -58,9 +63,9 @@ public class EntityCreature extends EntityLiving {
} }
// CraftBukkit end // CraftBukkit end
} else { } else {
float f1 = this.target.f(this); float f1 = this.target.g(this);
if (this.e(this.target)) { if (this.f(this.target)) {
this.a(this.target, f1); this.a(this.target, f1);
} else { } else {
this.b(this.target, f1); this.b(this.target, f1);
@ -69,13 +74,13 @@ public class EntityCreature extends EntityLiving {
if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) { if (!this.e && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f); this.pathEntity = this.world.findPath(this, this.target, f);
} else if (!this.e && (this.pathEntity == null && this.random.nextInt(80) == 0 || this.random.nextInt(80) == 0)) { } else if (!this.e && (this.pathEntity == null && this.random.nextInt(80) == 0 || this.f > 0 || this.random.nextInt(80) == 0)) {
this.B(); this.A();
} }
int i = MathHelper.floor(this.boundingBox.b + 0.5D); int i = MathHelper.floor(this.boundingBox.b + 0.5D);
boolean flag = this.ad(); boolean flag = this.ao();
boolean flag1 = this.ae(); boolean flag1 = this.ap();
this.pitch = 0.0F; this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) { if (this.pathEntity != null && this.random.nextInt(100) != 0) {
@ -92,7 +97,7 @@ public class EntityCreature extends EntityLiving {
} }
} }
this.aC = false; this.aS = false;
if (vec3d != null) { if (vec3d != null) {
double d1 = vec3d.a - this.locX; double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ; double d2 = vec3d.c - this.locZ;
@ -101,7 +106,7 @@ public class EntityCreature extends EntityLiving {
float f2 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; float f2 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = f2 - this.yaw; float f3 = f2 - this.yaw;
for (this.aA = this.aE; f3 < -180.0F; f3 += 360.0F) { for (this.aQ = this.aU; f3 < -180.0F; f3 += 360.0F) {
; ;
} }
@ -125,12 +130,12 @@ public class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F; this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F; f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
this.az = -MathHelper.sin(f3) * this.aA * 1.0F; this.aP = -MathHelper.sin(f3) * this.aQ * 1.0F;
this.aA = MathHelper.cos(f3) * this.aA * 1.0F; this.aQ = MathHelper.cos(f3) * this.aQ * 1.0F;
} }
if (d3 > 0.0D) { if (d3 > 0.0D) {
this.aC = true; this.aS = true;
} }
} }
@ -138,12 +143,12 @@ public class EntityCreature extends EntityLiving {
this.a(this.target, 30.0F, 30.0F); this.a(this.target, 30.0F, 30.0F);
} }
if (this.positionChanged && !this.C()) { if (this.positionChanged && !this.B()) {
this.aC = true; this.aS = true;
} }
if (this.random.nextFloat() < 0.8F && (flag || flag1)) { if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
this.aC = true; this.aS = true;
} }
} else { } else {
super.c_(); super.c_();
@ -151,7 +156,7 @@ public class EntityCreature extends EntityLiving {
} }
} }
protected void B() { protected void A() {
boolean flag = false; boolean flag = false;
int i = -1; int i = -1;
int j = -1; int j = -1;
@ -198,7 +203,7 @@ public class EntityCreature extends EntityLiving {
return super.d() && this.a(i, j, k) >= 0.0F; return super.d() && this.a(i, j, k) >= 0.0F;
} }
public boolean C() { public boolean B() {
return this.pathEntity != null; return this.pathEntity != null;
} }
@ -206,11 +211,21 @@ public class EntityCreature extends EntityLiving {
this.pathEntity = pathentity; this.pathEntity = pathentity;
} }
public Entity F() { public Entity C() {
return this.target; return this.target;
} }
public void setTarget(Entity entity) { public void setTarget(Entity entity) {
this.target = entity; this.target = entity;
} }
protected float D() {
float f = super.D();
if (this.f > 0) {
f *= 2.0F;
}
return f;
}
} }

Datei anzeigen

@ -37,7 +37,7 @@ public class EntityCreeper extends EntityMonster {
protected void b(Entity entity, float f) { protected void b(Entity entity, float f) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
if (this.fuseTicks > 0) { if (this.fuseTicks > 0) {
this.e(-1); this.b(-1);
--this.fuseTicks; --this.fuseTicks;
if (this.fuseTicks < 0) { if (this.fuseTicks < 0) {
this.fuseTicks = 0; this.fuseTicks = 0;
@ -46,10 +46,10 @@ public class EntityCreeper extends EntityMonster {
} }
} }
public void m_() { public void s_() {
this.b = this.fuseTicks; this.b = this.fuseTicks;
if (this.world.isStatic) { if (this.world.isStatic) {
int i = this.x(); int i = this.w();
if (i > 0 && this.fuseTicks == 0) { if (i > 0 && this.fuseTicks == 0) {
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F); this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
@ -65,9 +65,9 @@ public class EntityCreeper extends EntityMonster {
} }
} }
super.m_(); super.s_();
if (this.target == null && this.fuseTicks > 0) { if (this.target == null && this.fuseTicks > 0) {
this.e(-1); this.b(-1);
--this.fuseTicks; --this.fuseTicks;
if (this.fuseTicks < 0) { if (this.fuseTicks < 0) {
this.fuseTicks = 0; this.fuseTicks = 0;
@ -75,27 +75,27 @@ public class EntityCreeper extends EntityMonster {
} }
} }
protected String h() { protected String i() {
return "mob.creeper"; return "mob.creeper";
} }
protected String i() { protected String j() {
return "mob.creeperdeath"; return "mob.creeperdeath";
} }
public void die(Entity entity) { public void die(DamageSource damagesource) {
super.die(entity); super.die(damagesource);
if (entity instanceof EntitySkeleton) { if (damagesource.a() instanceof EntitySkeleton) {
this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1); this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
} }
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
int i = this.x(); int i = this.w();
if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) { if ((i > 0 || f >= 3.0F) && (i <= 0 || f >= 7.0F)) {
this.e(-1); this.b(-1);
--this.fuseTicks; --this.fuseTicks;
if (this.fuseTicks < 0) { if (this.fuseTicks < 0) {
this.fuseTicks = 0; this.fuseTicks = 0;
@ -105,7 +105,7 @@ public class EntityCreeper extends EntityMonster {
this.world.makeSound(this, "random.fuse", 1.0F, 0.5F); this.world.makeSound(this, "random.fuse", 1.0F, 0.5F);
} }
this.e(1); this.b(1);
++this.fuseTicks; ++this.fuseTicks;
if (this.fuseTicks >= 30) { if (this.fuseTicks >= 30) {
// CraftBukkit start // CraftBukkit start
@ -132,15 +132,15 @@ public class EntityCreeper extends EntityMonster {
return this.datawatcher.a(17) == 1; return this.datawatcher.a(17) == 1;
} }
protected int j() { protected int k() {
return Item.SULPHUR.id; return Item.SULPHUR.id;
} }
private int x() { private int w() {
return this.datawatcher.a(16); return this.datawatcher.a(16);
} }
private void e(int i) { private void b(int i) {
this.datawatcher.watch(16, Byte.valueOf((byte) i)); this.datawatcher.watch(16, Byte.valueOf((byte) i));
} }

Datei anzeigen

@ -79,11 +79,11 @@ public class EntityEgg extends Entity {
this.h = 0; this.h = 0;
} }
public void m_() { public void s_() {
this.bo = this.locX; this.bE = this.locX;
this.bp = this.locY; this.bF = this.locY;
this.bq = this.locZ; this.bG = this.locZ;
super.m_(); super.s_();
if (this.a > 0) { if (this.a > 0) {
--this.a; --this.a;
} }
@ -128,13 +128,13 @@ public class EntityEgg extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.l_() && (entity1 != this.thrower || this.i >= 5)) { if (entity1.r_() && (entity1 != this.thrower || this.i >= 5)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.a(movingobjectposition1.f); double d1 = vec3d.b(movingobjectposition1.f);
if (d1 < d0 || d0 == 0.0D) { if (d1 < d0 || d0 == 0.0D) {
entity = entity1; entity = entity1;
@ -168,10 +168,10 @@ public class EntityEgg extends Entity {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the egg should stick in or not, i.e. !bounce // this function returns if the egg should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(this, event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this), event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(this.thrower, 0); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this.thrower), 0);
} }
if (stick) { if (stick) {
@ -244,9 +244,6 @@ public class EntityEgg extends Entity {
case WOLF: case WOLF:
entity = new EntityWolf(this.world); entity = new EntityWolf(this.world);
break; break;
case MONSTER:
entity = new EntityMonster(this.world);
break;
default: default:
entity = new EntityChicken(this.world); entity = new EntityChicken(this.world);
break; break;
@ -297,7 +294,7 @@ public class EntityEgg extends Entity {
float f2 = 0.99F; float f2 = 0.99F;
float f3 = 0.03F; float f3 = 0.03F;
if (this.ad()) { if (this.ao()) {
for (int i1 = 0; i1 < 4; ++i1) { for (int i1 = 0; i1 < 4; ++i1) {
float f4 = 0.25F; float f4 = 0.25F;
@ -332,7 +329,7 @@ public class EntityEgg extends Entity {
this.f = nbttagcompound.c("inGround") == 1; this.f = nbttagcompound.c("inGround") == 1;
} }
public void b(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {
if (this.f && this.thrower == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) { if (this.f && this.thrower == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, 1); entityhuman.receive(this, 1);

Datei anzeigen

@ -61,8 +61,8 @@ public class EntityFireball extends Entity {
this.e = d2 / d3 * 0.1D; this.e = d2 / d3 * 0.1D;
} }
public void m_() { public void s_() {
super.m_(); super.s_();
this.fireTicks = 10; this.fireTicks = 10;
if (this.a > 0) { if (this.a > 0) {
--this.a; --this.a;
@ -107,13 +107,13 @@ public class EntityFireball extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.l_() && (entity1 != this.shooter || this.l >= 25)) { if (entity1.r_() && (entity1 != this.shooter || this.l >= 25)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.a(movingobjectposition1.f); double d1 = vec3d.b(movingobjectposition1.f);
if (d1 < d0 || d0 == 0.0D) { if (d1 < d0 || d0 == 0.0D) {
entity = entity1; entity = entity1;
@ -150,10 +150,10 @@ public class EntityFireball extends Entity {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the fireball should stick in or not, i.e. !bounce // this function returns if the fireball should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(this, event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this), event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(this.shooter, 0); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this.shooter), 0);
} }
if (stick) { if (stick) {
; ;
@ -200,7 +200,7 @@ public class EntityFireball extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F; this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.95F; float f2 = 0.95F;
if (this.ad()) { if (this.ao()) {
for (int k = 0; k < 4; ++k) { for (int k = 0; k < 4; ++k) {
float f3 = 0.25F; float f3 = 0.25F;
@ -238,14 +238,14 @@ public class EntityFireball extends Entity {
this.j = nbttagcompound.c("inGround") == 1; this.j = nbttagcompound.c("inGround") == 1;
} }
public boolean l_() { public boolean r_() {
return true; return true;
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
this.af(); this.aq();
if (entity != null) { if (damagesource.a() != null) {
Vec3D vec3d = entity.Z(); Vec3D vec3d = damagesource.a().ai();
if (vec3d != null) { if (vec3d != null) {
this.motX = vec3d.a; this.motX = vec3d.a;

Datei anzeigen

@ -32,12 +32,12 @@ public class EntityFish extends Entity {
public EntityFish(World world) { public EntityFish(World world) {
super(world); super(world);
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
this.bK = true; this.bZ = true;
} }
public EntityFish(World world, EntityHuman entityhuman) { public EntityFish(World world, EntityHuman entityhuman) {
super(world); super(world);
this.bK = true; this.bZ = true;
this.owner = entityhuman; this.owner = entityhuman;
this.owner.hookedFish = this; this.owner.hookedFish = this;
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
@ -79,8 +79,8 @@ public class EntityFish extends Entity {
this.i = 0; this.i = 0;
} }
public void m_() { public void s_() {
super.m_(); super.s_();
if (this.l > 0) { if (this.l > 0) {
double d0 = this.locX + (this.m - this.locX) / (double) this.l; double d0 = this.locX + (this.m - this.locX) / (double) this.l;
double d1 = this.locY + (this.n - this.locY) / (double) this.l; double d1 = this.locY + (this.n - this.locY) / (double) this.l;
@ -103,9 +103,9 @@ public class EntityFish extends Entity {
this.c(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
} else { } else {
if (!this.world.isStatic) { if (!this.world.isStatic) {
ItemStack itemstack = this.owner.G(); ItemStack itemstack = this.owner.K();
if (this.owner.dead || !this.owner.T() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.g(this.owner) > 1024.0D) { if (this.owner.dead || !this.owner.ac() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.h(this.owner) > 1024.0D) {
this.die(); this.die();
this.owner.hookedFish = null; this.owner.hookedFish = null;
return; return;
@ -168,13 +168,13 @@ public class EntityFish extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.l_() && (entity1 != this.owner || this.j >= 5)) { if (entity1.r_() && (entity1 != this.owner || this.j >= 5)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
d5 = vec3d.a(movingobjectposition1.f); d5 = vec3d.b(movingobjectposition1.f);
if (d5 < d4 || d4 == 0.0D) { if (d5 < d4 || d4 == 0.0D) {
entity = entity1; entity = entity1;
d4 = d5; d4 = d5;
@ -204,10 +204,10 @@ public class EntityFish extends Entity {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the fish should stick in or not, i.e. !bounce // this function returns if the fish should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(this, event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.a((Entity) this, this), event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(this.owner, 0); stick = movingobjectposition.entity.damageEntity(DamageSource.a((Entity) this, this.owner), 0);
} }
if (!stick) { if (!stick) {
// CraftBukkit end // CraftBukkit end
@ -333,7 +333,7 @@ public class EntityFish extends Entity {
this.h = nbttagcompound.c("inGround") == 1; this.h = nbttagcompound.c("inGround") == 1;
} }
public int h() { public int i() {
byte b0 = 0; byte b0 = 0;
if (this.c != null) { if (this.c != null) {

Datei anzeigen

@ -21,6 +21,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.texture = "/mob/ghast.png"; this.texture = "/mob/ghast.png";
this.b(4.0F, 4.0F); this.b(4.0F, 4.0F);
this.fireProof = true; this.fireProof = true;
this.ax = 5;
} }
protected void b() { protected void b() {
@ -28,8 +29,8 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.datawatcher.a(16, Byte.valueOf((byte) 0)); this.datawatcher.a(16, Byte.valueOf((byte) 0));
} }
public void m_() { public void s_() {
super.m_(); super.s_();
byte b0 = this.datawatcher.a(16); byte b0 = this.datawatcher.a(16);
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png"; this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
@ -40,7 +41,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.die(); this.die();
} }
this.U(); this.ad();
this.e = this.f; this.e = this.f;
double d0 = this.b - this.locX; double d0 = this.b - this.locX;
double d1 = this.c - this.locY; double d1 = this.c - this.locY;
@ -104,23 +105,23 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d4 = 64.0D; double d4 = 64.0D;
if (this.target != null && this.target.g(this) < d4 * d4) { if (this.target != null && this.target.h(this) < d4 * d4) {
double d5 = this.target.locX - this.locX; double d5 = this.target.locX - this.locX;
double d6 = this.target.boundingBox.b + (double) (this.target.width / 2.0F) - (this.locY + (double) (this.width / 2.0F)); double d6 = this.target.boundingBox.b + (double) (this.target.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
double d7 = this.target.locZ - this.locZ; double d7 = this.target.locZ - this.locZ;
this.K = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; this.U = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
if (this.e(this.target)) { if (this.f(this.target)) {
if (this.f == 10) { if (this.f == 10) {
this.world.makeSound(this, "mob.ghast.charge", this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.makeSound(this, "mob.ghast.charge", this.l(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
++this.f; ++this.f;
if (this.f == 20) { if (this.f == 20) {
this.world.makeSound(this, "mob.ghast.fireball", this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.world.makeSound(this, "mob.ghast.fireball", this.l(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7); EntityFireball entityfireball = new EntityFireball(this.world, this, d5, d6, d7);
double d8 = 4.0D; double d8 = 4.0D;
Vec3D vec3d = this.b(1.0F); Vec3D vec3d = this.c(1.0F);
entityfireball.locX = this.locX + vec3d.a * d8; entityfireball.locX = this.locX + vec3d.a * d8;
entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D; entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D;
@ -132,7 +133,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
--this.f; --this.f;
} }
} else { } else {
this.K = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F; this.U = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
if (this.f > 0) { if (this.f > 0) {
--this.f; --this.f;
} }
@ -164,23 +165,23 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true; return true;
} }
protected String g() { protected String h() {
return "mob.ghast.moan"; return "mob.ghast.moan";
} }
protected String h() { protected String i() {
return "mob.ghast.scream"; return "mob.ghast.scream";
} }
protected String i() { protected String j() {
return "mob.ghast.death"; return "mob.ghast.death";
} }
protected int j() { protected int k() {
return Item.SULPHUR.id; return Item.SULPHUR.id;
} }
protected float k() { protected float l() {
return 10.0F; return 10.0F;
} }
@ -188,7 +189,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
return this.random.nextInt(20) == 0 && super.d() && this.world.spawnMonsters > 0; return this.random.nextInt(20) == 0 && super.d() && this.world.spawnMonsters > 0;
} }
public int l() { public int m() {
return 1; return 1;
} }
} }

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

Datei anzeigen

@ -29,7 +29,7 @@ public class EntityItem extends Entity {
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D)); this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
} }
protected boolean n() { protected boolean e_() {
return false; return false;
} }
@ -41,8 +41,8 @@ public class EntityItem extends Entity {
protected void b() {} protected void b() {}
public void m_() { public void s_() {
super.m_(); super.s_();
// CraftBukkit start // CraftBukkit start
int currentTick = (int) (System.currentTimeMillis() / 50); int currentTick = (int) (System.currentTimeMillis() / 50);
this.pickupDelay -= (currentTick - this.lastTick); this.pickupDelay -= (currentTick - this.lastTick);
@ -92,11 +92,11 @@ public class EntityItem extends Entity {
} }
protected void burn(int i) { protected void burn(int i) {
this.damageEntity((Entity) null, i); this.damageEntity(DamageSource.a, i);
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
this.af(); this.aq();
this.f -= i; this.f -= i;
if (this.f <= 0) { if (this.f <= 0) {
this.die(); this.die();
@ -108,7 +108,7 @@ public class EntityItem extends Entity {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Health", (short) ((byte) this.f)); nbttagcompound.a("Health", (short) ((byte) this.f));
nbttagcompound.a("Age", (short) this.b); nbttagcompound.a("Age", (short) this.b);
nbttagcompound.a("Item", this.itemStack.a(new NBTTagCompound())); nbttagcompound.a("Item", this.itemStack.b(new NBTTagCompound()));
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
@ -116,10 +116,13 @@ public class EntityItem extends Entity {
this.b = nbttagcompound.d("Age"); this.b = nbttagcompound.d("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item"); NBTTagCompound nbttagcompound1 = nbttagcompound.k("Item");
this.itemStack = new ItemStack(nbttagcompound1); this.itemStack = ItemStack.a(nbttagcompound1);
if (this.itemStack == null) {
this.die();
}
} }
public void b(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
int i = this.itemStack.count; int i = this.itemStack.count;
@ -158,4 +161,8 @@ public class EntityItem extends Entity {
} }
} }
} }
public String Y() {
return StatisticCollector.a("item." + this.itemStack.k());
}
} }

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

Datei anzeigen

@ -55,26 +55,26 @@ public class EntityMinecart extends Entity implements IInventory {
this.b = 0; this.b = 0;
this.c = 1; this.c = 1;
this.i = false; this.i = false;
this.aI = true; this.aY = true;
this.b(0.98F, 0.7F); this.b(0.98F, 0.7F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
} }
protected boolean n() { protected boolean e_() {
return false; return false;
} }
protected void b() {} protected void b() {}
public AxisAlignedBB a_(Entity entity) { public AxisAlignedBB b(Entity entity) {
return entity.boundingBox; return entity.boundingBox;
} }
public AxisAlignedBB e_() { public AxisAlignedBB f() {
return null; return null;
} }
public boolean d_() { public boolean g() {
return true; return true;
} }
@ -92,15 +92,15 @@ public class EntityMinecart extends Entity implements IInventory {
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
} }
public double m() { public double n() {
return (double) this.width * 0.0D - 0.30000001192092896D; return (double) this.width * 0.0D - 0.30000001192092896D;
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
if (!this.world.isStatic && !this.dead) { if (!this.world.isStatic && !this.dead) {
// CraftBukkit start // CraftBukkit start
Vehicle vehicle = (Vehicle) this.getBukkitEntity(); Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity passenger = (entity == null) ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity passenger = (damagesource.a() == null) ? null : damagesource.a().getBukkitEntity();
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i); VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -114,7 +114,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.c = -this.c; this.c = -this.c;
this.b = 10; this.b = 10;
this.af(); this.aq();
this.damage += i * 10; this.damage += i * 10;
if (this.damage > 40) { if (this.damage > 40) {
if (this.passenger != null) { if (this.passenger != null) {
@ -175,7 +175,7 @@ public class EntityMinecart extends Entity implements IInventory {
} }
} }
public boolean l_() { public boolean r_() {
return !this.dead; return !this.dead;
} }
@ -571,7 +571,7 @@ public class EntityMinecart extends Entity implements IInventory {
for (int l1 = 0; l1 < list.size(); ++l1) { for (int l1 = 0; l1 < list.size(); ++l1) {
Entity entity = (Entity) list.get(l1); Entity entity = (Entity) list.get(l1);
if (entity != this.passenger && entity.d_() && entity instanceof EntityMinecart) { if (entity != this.passenger && entity.g() && entity instanceof EntityMinecart) {
entity.collide(this); entity.collide(this);
} }
} }
@ -673,7 +673,7 @@ public class EntityMinecart extends Entity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
this.items[i].a(nbttagcompound1); this.items[i].b(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1);
} }
} }
@ -698,7 +698,7 @@ public class EntityMinecart extends Entity implements IInventory {
int j = nbttagcompound1.c("Slot") & 255; int j = nbttagcompound1.c("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = new ItemStack(nbttagcompound1); this.items[j] = ItemStack.a(nbttagcompound1);
} }
} }
} }
@ -749,8 +749,8 @@ public class EntityMinecart extends Entity implements IInventory {
d1 *= d3; d1 *= d3;
d0 *= 0.10000000149011612D; d0 *= 0.10000000149011612D;
d1 *= 0.10000000149011612D; d1 *= 0.10000000149011612D;
d0 *= (double) (1.0F - this.bu); d0 *= (double) (1.0F - this.bK);
d1 *= (double) (1.0F - this.bu); d1 *= (double) (1.0F - this.bK);
d0 *= 0.5D; d0 *= 0.5D;
d1 *= 0.5D; d1 *= 0.5D;
if (entity instanceof EntityMinecart) { if (entity instanceof EntityMinecart) {
@ -843,7 +843,7 @@ public class EntityMinecart extends Entity implements IInventory {
public void update() {} public void update() {}
public boolean a(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (this.type == 0) { if (this.type == 0) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) { if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true; return true;
@ -885,7 +885,11 @@ public class EntityMinecart extends Entity implements IInventory {
return true; return true;
} }
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.dead ? false : entityhuman.g(this) <= 64.0D; return this.dead ? false : entityhuman.h(this) <= 64.0D;
} }
public void e() {}
public void t_() {}
} }

Datei anzeigen

@ -7,27 +7,28 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
// CraftBukkit end // CraftBukkit end
public class EntityMonster extends EntityCreature implements IMonster { public abstract class EntityMonster extends EntityCreature implements IMonster {
protected int damage = 2; protected int damage = 2;
public EntityMonster(World world) { public EntityMonster(World world) {
super(world); super(world);
this.health = 20; this.health = 20;
this.ax = 5;
} }
public void v() { public void s() {
float f = this.c(1.0F); float f = this.a_(1.0F);
if (f > 0.5F) { if (f > 0.5F) {
this.ay += 2; this.aO += 2;
} }
super.v(); super.s();
} }
public void m_() { public void s_() {
super.m_(); super.s_();
if (!this.world.isStatic && this.world.spawnMonsters == 0) { if (!this.world.isStatic && this.world.spawnMonsters == 0) {
this.die(); this.die();
} }
@ -36,11 +37,13 @@ public class EntityMonster extends EntityCreature implements IMonster {
protected Entity findTarget() { protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D); EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D);
return entityhuman != null && this.e(entityhuman) ? entityhuman : null; return entityhuman != null && this.f(entityhuman) ? entityhuman : null;
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
if (super.damageEntity(entity, i)) { if (super.damageEntity(damagesource, i)) {
Entity entity = damagesource.a();
if (this.passenger != entity && this.vehicle != entity) { if (this.passenger != entity && this.vehicle != entity) {
if (entity != this) { if (entity != this) {
// CraftBukkit start // CraftBukkit start
@ -68,31 +71,36 @@ public class EntityMonster extends EntityCreature implements IMonster {
} }
} }
protected boolean c(Entity entity) {
// CraftBukkit start - this is still duplicated here and EntityHuman because it's possible for lastDamage EntityMonster
// to damage another EntityMonster, and we want to catch those events.
// This does not fire events for slime attacks, av they're not lastDamage EntityMonster.
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
return entity.damageEntity(DamageSource.a(this), event.getDamage());
}
return false;
}
// CraftBukkit end
return entity.damageEntity(DamageSource.a((EntityLiving) this), this.damage);
}
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) { if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20; this.attackTicks = 20;
// CraftBukkit start - this is still duplicated here and EntityHuman because it's possible for lastDamage EntityMonster this.c(entity);
// to damage another EntityMonster, and we want to catch those events.
// This does not fire events for slime attacks, av they're not lastDamage EntityMonster.
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entity.damageEntity(this, event.getDamage());
}
return;
}
// CraftBukkit end
entity.damageEntity(this, this.damage);
} }
} }
protected float a(int i, int j, int k) { protected float a(int i, int j, int k) {
return 0.5F - this.world.n(i, j, k); return 0.5F - this.world.m(i, j, k);
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
@ -113,12 +121,12 @@ public class EntityMonster extends EntityCreature implements IMonster {
} else { } else {
int l = this.world.getLightLevel(i, j, k); int l = this.world.getLightLevel(i, j, k);
if (this.world.u()) { if (this.world.t()) {
int i1 = this.world.f; int i1 = this.world.k;
this.world.f = 10; this.world.k = 10;
l = this.world.getLightLevel(i, j, k); l = this.world.getLightLevel(i, j, k);
this.world.f = i1; this.world.k = i1;
} }
return l <= this.random.nextInt(8) && super.d(); return l <= this.random.nextInt(8) && super.d();

Datei anzeigen

@ -39,7 +39,7 @@ public class EntityPainting extends Entity {
this.e = enumart; this.e = enumart;
this.b(l); this.b(l);
if (this.h()) { if (this.i()) {
arraylist.add(enumart); arraylist.add(enumart);
} }
} }
@ -117,10 +117,10 @@ public class EntityPainting extends Entity {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F); return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
} }
public void m_() { public void s_() {
if (this.f++ == 100 && !this.world.isStatic) { if (this.f++ == 100 && !this.world.isStatic) {
this.f = 0; this.f = 0;
if (!this.h()) { if (!this.i()) {
// CraftBukkit start // CraftBukkit start
PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent((org.bukkit.entity.Painting) this.getBukkitEntity()); PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent((org.bukkit.entity.Painting) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -136,7 +136,7 @@ public class EntityPainting extends Entity {
} }
} }
public boolean h() { public boolean i() {
if (this.world.getEntities(this, this.boundingBox).size() > 0) { if (this.world.getEntities(this, this.boundingBox).size() > 0) {
return false; return false;
} else { } else {
@ -194,14 +194,14 @@ public class EntityPainting extends Entity {
} }
} }
public boolean l_() { public boolean r_() {
return true; return true;
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
if (!this.dead && !this.world.isStatic) { if (!this.dead && !this.world.isStatic) {
// CraftBukkit start // CraftBukkit start
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent((org.bukkit.entity.Painting) this.getBukkitEntity(), entity == null ? null : entity.getBukkitEntity()); PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent((org.bukkit.entity.Painting) this.getBukkitEntity(), damagesource.a() == null ? null : damagesource.a().getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -210,7 +210,7 @@ public class EntityPainting extends Entity {
// CraftBukkit end // CraftBukkit end
this.die(); this.die();
this.af(); this.aq();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING))); this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
} }
@ -249,7 +249,7 @@ public class EntityPainting extends Entity {
this.b(this.a); this.b(this.a);
} }
public void a(double d0, double d1, double d2) { public void a_(double d0, double d1, double d2) {
if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
this.die(); this.die();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING))); this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));

Datei anzeigen

@ -27,19 +27,19 @@ public class EntityPig extends EntityAnimal {
this.setSaddle(nbttagcompound.m("Saddle")); this.setSaddle(nbttagcompound.m("Saddle"));
} }
protected String g() {
return "mob.pig";
}
protected String h() { protected String h() {
return "mob.pig"; return "mob.pig";
} }
protected String i() { protected String i() {
return "mob.pig";
}
protected String j() {
return "mob.pigdeath"; return "mob.pigdeath";
} }
public boolean a(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) { if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
entityhuman.mount(this); entityhuman.mount(this);
return true; return true;
@ -48,7 +48,7 @@ public class EntityPig extends EntityAnimal {
} }
} }
protected int j() { protected int k() {
return this.fireTicks > 0 ? Item.GRILLED_PORK.id : Item.PORK.id; return this.fireTicks > 0 ? Item.GRILLED_PORK.id : Item.PORK.id;
} }

Datei anzeigen

@ -11,23 +11,23 @@ public class EntityPigZombie extends EntityZombie {
public int angerLevel = 0; // CraftBukkit - private -> public public int angerLevel = 0; // CraftBukkit - private -> public
private int soundDelay = 0; private int soundDelay = 0;
private static final ItemStack f = new ItemStack(Item.GOLD_SWORD, 1); private static final ItemStack g = new ItemStack(Item.GOLD_SWORD, 1);
public EntityPigZombie(World world) { public EntityPigZombie(World world) {
super(world); super(world);
this.texture = "/mob/pigzombie.png"; this.texture = "/mob/pigzombie.png";
this.aE = 0.5F; this.aU = 0.5F;
this.damage = 5; this.damage = 5;
this.fireProof = true; this.fireProof = true;
} }
public void m_() { public void s_() {
this.aE = this.target != null ? 0.95F : 0.5F; this.aU = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) { if (this.soundDelay > 0 && --this.soundDelay == 0) {
this.world.makeSound(this, "mob.zombiepig.zpigangry", this.k() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F); this.world.makeSound(this, "mob.zombiepig.zpigangry", this.l() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
} }
super.m_(); super.s_();
} }
public boolean d() { public boolean d() {
@ -48,11 +48,13 @@ public class EntityPigZombie extends EntityZombie {
return this.angerLevel == 0 ? null : super.findTarget(); return this.angerLevel == 0 ? null : super.findTarget();
} }
public void v() { public void s() {
super.v(); super.s();
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
Entity entity = damagesource.a();
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
List list = this.world.b((Entity) this, this.boundingBox.b(32.0D, 32.0D, 32.0D)); List list = this.world.b((Entity) this, this.boundingBox.b(32.0D, 32.0D, 32.0D));
@ -62,17 +64,17 @@ public class EntityPigZombie extends EntityZombie {
if (entity1 instanceof EntityPigZombie) { if (entity1 instanceof EntityPigZombie) {
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1; EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
entitypigzombie.d(entity); entitypigzombie.e(entity);
} }
} }
this.d(entity); this.e(entity);
} }
return super.damageEntity(entity, i); return super.damageEntity(damagesource, i);
} }
private void d(Entity entity) { private void e(Entity entity) {
// CraftBukkit start // CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
@ -95,19 +97,19 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40); this.soundDelay = this.random.nextInt(40);
} }
protected String g() { protected String h() {
return "mob.zombiepig.zpig"; return "mob.zombiepig.zpig";
} }
protected String h() { protected String i() {
return "mob.zombiepig.zpighurt"; return "mob.zombiepig.zpighurt";
} }
protected String i() { protected String j() {
return "mob.zombiepig.zpigdeath"; return "mob.zombiepig.zpigdeath";
} }
protected int j() { protected int k() {
return Item.GRILLED_PORK.id; return Item.GRILLED_PORK.id;
} }
} }

Datei anzeigen

@ -23,11 +23,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double e; public double e;
public List chunkCoordIntPairQueue = new LinkedList(); public List chunkCoordIntPairQueue = new LinkedList();
public Set playerChunkCoordIntPairs = new HashSet(); public Set playerChunkCoordIntPairs = new HashSet();
private int bL = -99999999; private int cb = -99999999;
private int bM = 60; private int cc = -99999999;
private ItemStack[] bN = new ItemStack[] { null, null, null, null, null}; private boolean cd = true;
private int bO = 0; private int ce = -99999999;
private int cf = 60;
private ItemStack[] cg = new ItemStack[] { null, null, null, null, null};
private int ch = 0;
public boolean h; public boolean h;
public int i;
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world); super(world);
@ -46,7 +50,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F); this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.b = minecraftserver; this.b = minecraftserver;
this.bs = 0.0F; this.bI = 0.0F;
this.name = s; this.name = s;
this.height = 0.0F; this.height = 0.0F;
@ -58,6 +62,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public org.bukkit.Location compassTarget; public org.bukkit.Location compassTarget;
// CraftBukkit end // CraftBukkit end
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
if (nbttagcompound.hasKey("playerGameType")) {
this.itemInWorldManager.a(nbttagcompound.e("playerGameType"));
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.a("playerGameType", this.itemInWorldManager.a());
}
public void spawnIn(World world) { public void spawnIn(World world) {
super.spawnIn(world); super.spawnIn(world);
// CraftBukkit - world fallback code, either respawn location or global spawn // CraftBukkit - world fallback code, either respawn location or global spawn
@ -89,10 +105,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public ItemStack[] getEquipment() { public ItemStack[] getEquipment() {
return this.bN; return this.cg;
} }
protected void s() { protected void m_() {
this.height = 0.0F; this.height = 0.0F;
} }
@ -100,26 +116,27 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return 1.62F; return 1.62F;
} }
public void m_() { public void s_() {
this.itemInWorldManager.a(); this.itemInWorldManager.c();
--this.bM; --this.cf;
this.activeContainer.a(); this.activeContainer.a();
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
ItemStack itemstack = this.c_(i); ItemStack itemstack = this.b(i);
if (itemstack != this.bN[i]) { if (itemstack != this.cg[i]) {
this.b.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack)); this.b.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
this.bN[i] = itemstack; this.cg[i] = itemstack;
} }
} }
} }
public ItemStack c_(int i) { public ItemStack b(int i) {
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1]; return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
} }
public void die(Entity entity) { public void die(DamageSource damagesource) {
this.b.serverConfigurationManager.sendAll(new Packet3Chat(damagesource.a((EntityHuman) this)));
// CraftBukkit start // CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
@ -158,12 +175,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end // CraftBukkit end
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
if (this.bM > 0) { if (this.cf > 0) {
return false; return false;
} else { } else {
// CraftBukkit - this.b.pvpMode -> this.world.pvpMode // CraftBukkit - this.b.pvpMode -> this.world.pvpMode
if (!this.world.pvpMode) { if (!this.world.pvpMode && damagesource instanceof EntityDamageSource) {
Entity entity = damagesource.a();
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
return false; return false;
} }
@ -177,26 +196,26 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
return super.damageEntity(entity, i); return super.damageEntity(damagesource, i);
} }
} }
protected boolean j_() { protected boolean n_() {
return this.b.pvpMode; return this.b.pvpMode;
} }
public void b(int i) { public void c(int i) {
super.b(i, RegainReason.EATING); super.c(i, RegainReason.EATING);
} }
public void a(boolean flag) { public void b(boolean flag) {
super.m_(); super.s_();
for (int i = 0; i < this.inventory.getSize(); ++i) { for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i); ItemStack itemstack = this.inventory.getItem(i);
if (itemstack != null && Item.byId[itemstack.id].b() && this.netServerHandler.b() <= 2) { if (itemstack != null && Item.byId[itemstack.id].i_() && this.netServerHandler.b() <= 2) {
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).b(itemstack, this.world, this); Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
if (packet != null) { if (packet != null) {
this.netServerHandler.sendPacket(packet); this.netServerHandler.sendPacket(packet);
@ -218,58 +237,82 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
WorldServer worldserver = this.b.getWorldServer(this.dimension); WorldServer worldserver = this.b.getWorldServer(this.dimension);
this.chunkCoordIntPairQueue.remove(chunkcoordintpair); this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
this.netServerHandler.sendPacket(new Packet51MapChunk(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, 16, 128, 16, worldserver)); NetServerHandler netserverhandler = this.netServerHandler;
List list = worldserver.getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 128, chunkcoordintpair.z * 16 + 16);
for (int j = 0; j < list.size(); ++j) { int j = chunkcoordintpair.x * 16;
this.a((TileEntity) list.get(j)); int k = chunkcoordintpair.z * 16;
worldserver.getClass();
Packet51MapChunk packet51mapchunk = new Packet51MapChunk(j, 0, k, 16, 128, 16, worldserver);
netserverhandler.sendPacket(packet51mapchunk);
int l = chunkcoordintpair.x * 16;
j = chunkcoordintpair.z * 16;
int i1 = chunkcoordintpair.x * 16 + 16;
worldserver.getClass();
List list = worldserver.getTileEntities(l, 0, j, i1, 128, chunkcoordintpair.z * 16 + 16);
for (int j1 = 0; j1 < list.size(); ++j1) {
this.a((TileEntity) list.get(j1));
} }
} }
} }
} }
if (this.E) { if (this.I) {
//if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit //if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
if (this.activeContainer != this.defaultContainer) { if (this.activeContainer != this.defaultContainer) {
this.y(); this.x();
} }
if (this.vehicle != null) { if (this.vehicle != null) {
this.mount(this.vehicle); this.mount(this.vehicle);
} else { } else {
this.F += 0.0125F; this.J += 0.0125F;
if (this.F >= 1.0F) { if (this.J >= 1.0F) {
this.F = 1.0F; this.J = 1.0F;
this.D = 10; this.H = 10;
this.b.serverConfigurationManager.f(this); this.b.serverConfigurationManager.f(this);
this.ce = -1;
this.cb = -1;
this.cc = -1;
} }
} }
this.E = false; this.I = false;
//} // CraftBukkit //} // CraftBukkit
} else { } else {
if (this.F > 0.0F) { if (this.J > 0.0F) {
this.F -= 0.05F; this.J -= 0.05F;
} }
if (this.F < 0.0F) { if (this.J < 0.0F) {
this.F = 0.0F; this.J = 0.0F;
} }
} }
if (this.D > 0) { if (this.H > 0) {
--this.D; --this.H;
} }
if (this.health != this.bL) { if (this.health != this.cb || this.cc != this.m.a() || this.m.c() == 0.0F != this.cd) {
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health)); this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.health, this.m.a(), this.m.c()));
this.bL = this.health; this.cb = this.health;
this.cc = this.m.a();
this.cd = this.m.c() == 0.0F;
}
if (this.expTotal != this.ce) {
this.ce = this.expTotal;
this.netServerHandler.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
} }
} }
private void a(TileEntity tileentity) { private void a(TileEntity tileentity) {
if (tileentity != null) { if (tileentity != null) {
Packet packet = tileentity.f(); Packet packet = tileentity.l();
if (packet != null) { if (packet != null) {
this.netServerHandler.sendPacket(packet); this.netServerHandler.sendPacket(packet);
@ -277,10 +320,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void v() {
super.v();
}
public void receive(Entity entity, int i) { public void receive(Entity entity, int i) {
if (!entity.dead) { if (!entity.dead) {
EntityTracker entitytracker = this.b.getTracker(this.dimension); EntityTracker entitytracker = this.b.getTracker(this.dimension);
@ -292,23 +331,27 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (entity instanceof EntityArrow) { if (entity instanceof EntityArrow) {
entitytracker.a(entity, new Packet22Collect(entity.id, this.id)); entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
} }
if (entity instanceof EntityExperienceOrb) {
entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
}
} }
super.receive(entity, i); super.receive(entity, i);
this.activeContainer.a(); this.activeContainer.a();
} }
public void w() { public void v() {
if (!this.p) { if (!this.s) {
this.q = -1; this.t = -1;
this.p = true; this.s = true;
EntityTracker entitytracker = this.b.getTracker(this.dimension); EntityTracker entitytracker = this.b.getTracker(this.dimension);
entitytracker.a(this, new Packet18ArmAnimation(this, 1)); entitytracker.a(this, new Packet18ArmAnimation(this, 1));
} }
} }
public void x() {} public void w() {}
public EnumBedError a(int i, int j, int k) { public EnumBedError a(int i, int j, int k) {
EnumBedError enumbederror = super.a(i, j, k); EnumBedError enumbederror = super.a(i, j, k);
@ -360,39 +403,39 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.a(d0, flag); super.a(d0, flag);
} }
private void ai() { private void au() {
this.bO = this.bO % 100 + 1; this.ch = this.ch % 100 + 1;
} }
public void b(int i, int j, int k) { public void b(int i, int j, int k) {
this.ai(); this.au();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bO, 1, "Crafting", 9)); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 1, "Crafting", 9));
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k); this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
this.activeContainer.windowId = this.bO; this.activeContainer.windowId = this.ch;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(IInventory iinventory) { public void a(IInventory iinventory) {
this.ai(); this.au();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bO, 0, iinventory.getName(), iinventory.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 0, iinventory.getName(), iinventory.getSize()));
this.activeContainer = new ContainerChest(this.inventory, iinventory); this.activeContainer = new ContainerChest(this.inventory, iinventory);
this.activeContainer.windowId = this.bO; this.activeContainer.windowId = this.ch;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(TileEntityFurnace tileentityfurnace) { public void a(TileEntityFurnace tileentityfurnace) {
this.ai(); this.au();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bO, 2, tileentityfurnace.getName(), tileentityfurnace.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace); this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
this.activeContainer.windowId = this.bO; this.activeContainer.windowId = this.ch;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
public void a(TileEntityDispenser tileentitydispenser) { public void a(TileEntityDispenser tileentitydispenser) {
this.ai(); this.au();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bO, 3, tileentitydispenser.getName(), tileentitydispenser.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.ch, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser); this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
this.activeContainer.windowId = this.bO; this.activeContainer.windowId = this.ch;
this.activeContainer.a((ICrafting) this); this.activeContainer.a((ICrafting) this);
} }
@ -410,7 +453,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Container container, List list) { public void a(Container container, List list) {
this.netServerHandler.sendPacket(new Packet104WindowItems(container.windowId, list)); this.netServerHandler.sendPacket(new Packet104WindowItems(container.windowId, list));
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.j())); this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l()));
} }
public void a(Container container, int i, int j) { public void a(Container container, int i, int j) {
@ -419,26 +462,26 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(ItemStack itemstack) {} public void a(ItemStack itemstack) {}
public void y() { public void x() {
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId)); this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
this.A(); this.z();
} }
public void z() { public void y() {
if (!this.h) { if (!this.h) {
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.j())); this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l()));
} }
} }
public void A() { public void z() {
this.activeContainer.a((EntityHuman) this); this.activeContainer.a((EntityHuman) this);
this.activeContainer = this.defaultContainer; this.activeContainer = this.defaultContainer;
} }
public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) { public void a(float f, float f1, boolean flag, boolean flag1, float f2, float f3) {
this.az = f; this.aP = f;
this.aA = f1; this.aQ = f1;
this.aC = flag; this.aS = flag;
this.setSneak(flag1); this.setSneak(flag1);
this.pitch = f2; this.pitch = f2;
this.yaw = f3; this.yaw = f3;
@ -457,7 +500,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void B() { public void A() {
if (this.vehicle != null) { if (this.vehicle != null) {
this.mount(this.vehicle); this.mount(this.vehicle);
} }
@ -471,8 +514,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
public void C() { public void B() {
this.bL = -99999999; this.cb = -99999999;
} }
public void a(String s) { public void a(String s) {
@ -482,6 +525,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.netServerHandler.sendPacket(new Packet3Chat(s1)); this.netServerHandler.sendPacket(new Packet3Chat(s1));
} }
protected void C() {
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
super.C();
}
public void a(ItemStack itemstack, int i) {
super.a(itemstack, i);
if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().b(itemstack) == EnumAnimation.b) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
}
}
protected void a(MobEffect mobeffect) {
super.a(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
}
protected void b(MobEffect mobeffect) {
super.b(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
}
protected void c(MobEffect mobeffect) {
super.c(mobeffect);
this.netServerHandler.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
}
// CraftBukkit start // CraftBukkit start
public long timeOffset = 0; public long timeOffset = 0;
public boolean relativeTime = true; public boolean relativeTime = true;

Datei anzeigen

@ -17,11 +17,7 @@ public class EntitySheep extends EntityAnimal {
this.datawatcher.a(16, new Byte((byte) 0)); this.datawatcher.a(16, new Byte((byte) 0));
} }
public boolean damageEntity(Entity entity, int i) { protected void a(boolean flag) {
return super.damageEntity(entity, i);
}
protected void q() {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
@ -41,11 +37,11 @@ public class EntitySheep extends EntityAnimal {
// CraftBukkit end // CraftBukkit end
} }
protected int j() { protected int k() {
return Block.WOOL.id; return Block.WOOL.id;
} }
public boolean a(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand(); ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared()) { if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared()) {
@ -80,10 +76,6 @@ public class EntitySheep extends EntityAnimal {
this.setColor(nbttagcompound.c("Color")); this.setColor(nbttagcompound.c("Color"));
} }
protected String g() {
return "mob.sheep";
}
protected String h() { protected String h() {
return "mob.sheep"; return "mob.sheep";
} }
@ -92,6 +84,10 @@ public class EntitySheep extends EntityAnimal {
return "mob.sheep"; return "mob.sheep";
} }
protected String j() {
return "mob.sheep";
}
public int getColor() { public int getColor() {
return this.datawatcher.a(16) & 15; return this.datawatcher.a(16) & 15;
} }

Datei anzeigen

@ -14,21 +14,38 @@ public class EntitySkeleton extends EntityMonster {
this.texture = "/mob/skeleton.png"; this.texture = "/mob/skeleton.png";
} }
protected String g() {
return "mob.skeleton";
}
protected String h() { protected String h() {
return "mob.skeletonhurt"; return "mob.skeleton";
} }
protected String i() { protected String i() {
return "mob.skeletonhurt"; return "mob.skeletonhurt";
} }
public void v() { protected String j() {
if (this.world.d()) { return "mob.skeletonhurt";
float f = this.c(1.0F); }
public boolean a(DamageSource damagesource, int i) {
return super.damageEntity(damagesource, i);
}
public void a(DamageSource damagesource) {
super.die(damagesource);
if (damagesource.e() instanceof EntityArrow && damagesource.a() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.a();
double d0 = entityhuman.locX - this.locX;
double d1 = entityhuman.locZ - this.locZ;
if (d0 * d0 + d1 * d1 >= 2500.0D) {
entityhuman.a((Statistic) AchievementList.v);
}
}
}
public void s() {
if (this.world.d() && !this.world.isStatic) {
float f = this.a_(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start // CraftBukkit start
@ -42,7 +59,7 @@ public class EntitySkeleton extends EntityMonster {
} }
} }
super.v(); super.s();
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
@ -51,16 +68,14 @@ public class EntitySkeleton extends EntityMonster {
double d1 = entity.locZ - this.locZ; double d1 = entity.locZ - this.locZ;
if (this.attackTicks == 0) { if (this.attackTicks == 0) {
EntityArrow entityarrow = new EntityArrow(this.world, this); EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F);
double d2 = entity.locY + (double) entity.t() - 0.699999988079071D - entityarrow.locY;
++entityarrow.locY;
double d2 = entity.locY + (double) entity.t() - 0.20000000298023224D - entityarrow.locY;
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F; float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F)); this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entityarrow); this.world.addEntity(entityarrow);
entityarrow.a(d0, d2 + (double) f1, d1, 0.6F, 12.0F); entityarrow.a(d0, d2 + (double) f1, d1, 1.6F, 12.0F);
this.attackTicks = 30; this.attackTicks = 60;
} }
this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
@ -76,11 +91,11 @@ public class EntitySkeleton extends EntityMonster {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected int j() { protected int k() {
return Item.ARROW.id; return Item.ARROW.id;
} }
protected void q() { protected void a(boolean flag) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();

Datei anzeigen

@ -77,11 +77,11 @@ public class EntitySnowball extends Entity {
this.h = 0; this.h = 0;
} }
public void m_() { public void s_() {
this.bo = this.locX; this.bE = this.locX;
this.bp = this.locY; this.bF = this.locY;
this.bq = this.locZ; this.bG = this.locZ;
super.m_(); super.s_();
if (this.a > 0) { if (this.a > 0) {
--this.a; --this.a;
} }
@ -126,13 +126,13 @@ public class EntitySnowball extends Entity {
for (int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j); Entity entity1 = (Entity) list.get(j);
if (entity1.l_() && (entity1 != this.shooter || this.i >= 5)) { if (entity1.r_() && (entity1 != this.shooter || this.i >= 5)) {
float f = 0.3F; float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f); AxisAlignedBB axisalignedbb = entity1.boundingBox.b((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.a(movingobjectposition1.f); double d1 = vec3d.b(movingobjectposition1.f);
if (d1 < d0 || d0 == 0.0D) { if (d1 < d0 || d0 == 0.0D) {
entity = entity1; entity = entity1;
@ -167,10 +167,10 @@ public class EntitySnowball extends Entity {
stick = !projectile.doesBounce(); stick = !projectile.doesBounce();
} else { } else {
// this function returns if the snowball should stick in or not, i.e. !bounce // this function returns if the snowball should stick in or not, i.e. !bounce
stick = movingobjectposition.entity.damageEntity(this, event.getDamage()); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this), event.getDamage());
} }
} else { } else {
stick = movingobjectposition.entity.damageEntity(this.shooter, 0); stick = movingobjectposition.entity.damageEntity(DamageSource.a(this, this.shooter), 0);
} }
if (stick) { if (stick) {
; ;
@ -213,7 +213,7 @@ public class EntitySnowball extends Entity {
float f2 = 0.99F; float f2 = 0.99F;
float f3 = 0.03F; float f3 = 0.03F;
if (this.ad()) { if (this.ao()) {
for (int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
float f4 = 0.25F; float f4 = 0.25F;
@ -248,7 +248,7 @@ public class EntitySnowball extends Entity {
this.f = nbttagcompound.c("inGround") == 1; this.f = nbttagcompound.c("inGround") == 1;
} }
public void b(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {
if (this.f && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) { if (this.f && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F); this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, 1); entityhuman.receive(this, 1);

Datei anzeigen

@ -11,19 +11,19 @@ public class EntitySpider extends EntityMonster {
super(world); super(world);
this.texture = "/mob/spider.png"; this.texture = "/mob/spider.png";
this.b(1.4F, 0.9F); this.b(1.4F, 0.9F);
this.aE = 0.8F; this.aU = 0.8F;
} }
public double m() { public double n() {
return (double) this.width * 0.75D - 0.5D; return (double) this.width * 0.75D - 0.5D;
} }
protected boolean n() { protected boolean e_() {
return false; return false;
} }
protected Entity findTarget() { protected Entity findTarget() {
float f = this.c(1.0F); float f = this.a_(1.0F);
if (f < 0.5F) { if (f < 0.5F) {
double d0 = 16.0D; double d0 = 16.0D;
@ -34,20 +34,20 @@ public class EntitySpider extends EntityMonster {
} }
} }
protected String g() {
return "mob.spider";
}
protected String h() { protected String h() {
return "mob.spider"; return "mob.spider";
} }
protected String i() { protected String i() {
return "mob.spider";
}
protected String j() {
return "mob.spiderdeath"; return "mob.spiderdeath";
} }
protected void a(Entity entity, float f) { protected void a(Entity entity, float f) {
float f1 = this.c(1.0F); float f1 = this.a_(1.0F);
if (f1 > 0.5F && this.random.nextInt(100) == 0) { if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start // CraftBukkit start
@ -88,11 +88,13 @@ public class EntitySpider extends EntityMonster {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected int j() { protected int k() {
return Item.STRING.id; return Item.STRING.id;
} }
public boolean p() { public boolean p() {
return this.positionChanged; return this.positionChanged;
} }
public void q() {}
} }

Datei anzeigen

@ -7,23 +7,23 @@ public class EntitySquid extends EntityWaterAnimal {
public float a = 0.0F; public float a = 0.0F;
public float b = 0.0F; public float b = 0.0F;
public float c = 0.0F; public float c = 0.0F;
public float f = 0.0F;
public float g = 0.0F; public float g = 0.0F;
public float h = 0.0F; public float h = 0.0F;
public float i = 0.0F; public float i = 0.0F;
public float j = 0.0F; public float j = 0.0F;
private float k = 0.0F; public float k = 0.0F;
private float l = 0.0F; private float l = 0.0F;
private float m = 0.0F; private float m = 0.0F;
private float n = 0.0F; private float n = 0.0F;
private float o = 0.0F; private float o = 0.0F;
private float p = 0.0F; private float p = 0.0F;
private float q = 0.0F;
public EntitySquid(World world) { public EntitySquid(World world) {
super(world); super(world);
this.texture = "/mob/squid.png"; this.texture = "/mob/squid.png";
this.b(0.95F, 0.95F); this.b(0.95F, 0.95F);
this.l = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
@ -34,10 +34,6 @@ public class EntitySquid extends EntityWaterAnimal {
super.a(nbttagcompound); super.a(nbttagcompound);
} }
protected String g() {
return null;
}
protected String h() { protected String h() {
return null; return null;
} }
@ -46,15 +42,19 @@ public class EntitySquid extends EntityWaterAnimal {
return null; return null;
} }
protected float k() { protected String j() {
return null;
}
protected float l() {
return 0.4F; return 0.4F;
} }
protected int j() { protected int k() {
return 0; return 0;
} }
protected void q() { protected void a(boolean flag) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
@ -75,60 +75,60 @@ public class EntitySquid extends EntityWaterAnimal {
// CraftBukkit end // CraftBukkit end
} }
public boolean a(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
return false; return false;
} }
public boolean ad() { public boolean ao() {
return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this); return this.world.a(this.boundingBox.b(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, this);
} }
public void v() { public void s() {
super.v(); super.s();
this.b = this.a; this.b = this.a;
this.f = this.c; this.g = this.c;
this.h = this.g; this.i = this.h;
this.j = this.i; this.k = this.j;
this.g += this.l; this.h += this.m;
if (this.g > 6.2831855F) { if (this.h > 6.2831855F) {
this.g -= 6.2831855F; this.h -= 6.2831855F;
if (this.random.nextInt(10) == 0) { if (this.random.nextInt(10) == 0) {
this.l = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; this.m = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
} }
} }
if (this.ad()) { if (this.ao()) {
float f; float f;
if (this.g < 3.1415927F) { if (this.h < 3.1415927F) {
f = this.g / 3.1415927F; f = this.h / 3.1415927F;
this.i = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F; this.j = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
if ((double) f > 0.75D) { if ((double) f > 0.75D) {
this.k = 1.0F; this.l = 1.0F;
this.m = 1.0F; this.n = 1.0F;
} else { } else {
this.m *= 0.8F; this.n *= 0.8F;
} }
} else { } else {
this.i = 0.0F; this.j = 0.0F;
this.k *= 0.9F; this.l *= 0.9F;
this.m *= 0.99F; this.n *= 0.99F;
} }
if (!this.Y) { if (!this.ai) {
this.motX = (double) (this.n * this.k); this.motX = (double) (this.o * this.l);
this.motY = (double) (this.o * this.k); this.motY = (double) (this.p * this.l);
this.motZ = (double) (this.p * this.k); this.motZ = (double) (this.q * this.l);
} }
f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
this.K += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.K) * 0.1F; this.U += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.U) * 0.1F;
this.yaw = this.K; this.yaw = this.U;
this.c += 3.1415927F * this.m * 1.5F; this.c += 3.1415927F * this.n * 1.5F;
this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F; this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F;
} else { } else {
this.i = MathHelper.abs(MathHelper.sin(this.g)) * 3.1415927F * 0.25F; this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
if (!this.Y) { if (!this.ai) {
this.motX = 0.0D; this.motX = 0.0D;
this.motY -= 0.08D; this.motY -= 0.08D;
this.motY *= 0.9800000190734863D; this.motY *= 0.9800000190734863D;
@ -144,14 +144,14 @@ public class EntitySquid extends EntityWaterAnimal {
} }
protected void c_() { protected void c_() {
if (this.random.nextInt(50) == 0 || !this.bA || this.n == 0.0F && this.o == 0.0F && this.p == 0.0F) { if (this.random.nextInt(50) == 0 || !this.bQ || this.o == 0.0F && this.p == 0.0F && this.q == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F; float f = this.random.nextFloat() * 3.1415927F * 2.0F;
this.n = MathHelper.cos(f) * 0.2F; this.o = MathHelper.cos(f) * 0.2F;
this.o = -0.1F + this.random.nextFloat() * 0.2F; this.p = -0.1F + this.random.nextFloat() * 0.2F;
this.p = MathHelper.sin(f) * 0.2F; this.q = MathHelper.sin(f) * 0.2F;
} }
this.U(); this.ad();
} }
} }

Datei anzeigen

@ -16,7 +16,7 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world) { public EntityTNTPrimed(World world) {
super(world); super(world);
this.fuseTicks = 0; this.fuseTicks = 0;
this.aI = true; this.aY = true;
this.b(0.98F, 0.98F); this.b(0.98F, 0.98F);
this.height = this.width / 2.0F; this.height = this.width / 2.0F;
} }
@ -37,15 +37,15 @@ public class EntityTNTPrimed extends Entity {
protected void b() {} protected void b() {}
protected boolean n() { protected boolean e_() {
return false; return false;
} }
public boolean l_() { public boolean r_() {
return !this.dead; return !this.dead;
} }
public void m_() { public void s_() {
this.lastX = this.locX; this.lastX = this.locX;
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;

Datei anzeigen

@ -52,13 +52,15 @@ public class EntityTracker {
} else if (entity instanceof EntitySquid) { } else if (entity instanceof EntitySquid) {
this.a(entity, 160, 3, true); this.a(entity, 160, 3, true);
} else if (entity instanceof IAnimal) { } else if (entity instanceof IAnimal) {
this.a(entity, 160, 3); this.a(entity, 160, 3, true);
} else if (entity instanceof EntityTNTPrimed) { } else if (entity instanceof EntityTNTPrimed) {
this.a(entity, 160, 10, true); this.a(entity, 160, 10, true);
} else if (entity instanceof EntityFallingSand) { } else if (entity instanceof EntityFallingSand) {
this.a(entity, 160, 20, true); this.a(entity, 160, 20, true);
} else if (entity instanceof EntityPainting) { } else if (entity instanceof EntityPainting) {
this.a(entity, 160, Integer.MAX_VALUE, false); this.a(entity, 160, Integer.MAX_VALUE, false);
} else if (entity instanceof EntityExperienceOrb) {
this.a(entity, 160, 20, true);
} }
} }

Datei anzeigen

@ -60,7 +60,7 @@ public class EntityTrackerEntry {
} }
++this.t; ++this.t;
if (++this.l % this.c == 0) { if (++this.l % this.c == 0 || this.tracker.ca) {
int i = MathHelper.floor(this.tracker.locX * 32.0D); int i = MathHelper.floor(this.tracker.locX * 32.0D);
int j = MathHelper.floor(this.tracker.locY * 32.0D); int j = MathHelper.floor(this.tracker.locY * 32.0D);
int k = MathHelper.floor(this.tracker.locZ * 32.0D); int k = MathHelper.floor(this.tracker.locZ * 32.0D);
@ -108,7 +108,7 @@ public class EntityTrackerEntry {
this.a((Packet) object); this.a((Packet) object);
} }
DataWatcher datawatcher = this.tracker.aa(); DataWatcher datawatcher = this.tracker.al();
if (datawatcher.a()) { if (datawatcher.a()) {
this.b((Packet) (new Packet40EntityMetadata(this.tracker.id, datawatcher))); this.b((Packet) (new Packet40EntityMetadata(this.tracker.id, datawatcher)));
@ -126,6 +126,7 @@ public class EntityTrackerEntry {
} }
} }
this.tracker.ca = false;
if (this.tracker.velocityChanged) { if (this.tracker.velocityChanged) {
// CraftBukkit start - create PlayerVelocity event // CraftBukkit start - create PlayerVelocity event
boolean cancelled = false; boolean cancelled = false;
@ -208,6 +209,17 @@ public class EntityTrackerEntry {
entityplayer.netServerHandler.sendPacket(new Packet17(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ))); entityplayer.netServerHandler.sendPacket(new Packet17(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
} }
} }
if (this.tracker instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) this.tracker;
Iterator iterator = entityliving.ak().iterator();
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
entityplayer.netServerHandler.sendPacket(new Packet41MobEffect(this.tracker.id, mobeffect));
}
}
} }
} else if (this.trackedPlayers.contains(entityplayer)) { } else if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer); this.trackedPlayers.remove(entityplayer);
@ -262,9 +274,9 @@ public class EntityTrackerEntry {
} else if (this.tracker instanceof EntityFish) { } else if (this.tracker instanceof EntityFish) {
return new Packet23VehicleSpawn(this.tracker, 90); return new Packet23VehicleSpawn(this.tracker, 90);
} else if (this.tracker instanceof EntityArrow) { } else if (this.tracker instanceof EntityArrow) {
EntityLiving entityliving = ((EntityArrow) this.tracker).shooter; Entity entity = ((EntityArrow) this.tracker).shooter;
return new Packet23VehicleSpawn(this.tracker, 60, entityliving != null ? entityliving.id : this.tracker.id); return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
} else if (this.tracker instanceof EntitySnowball) { } else if (this.tracker instanceof EntitySnowball) {
return new Packet23VehicleSpawn(this.tracker, 61); return new Packet23VehicleSpawn(this.tracker, 61);
} else if (this.tracker instanceof EntityFireball) { } else if (this.tracker instanceof EntityFireball) {
@ -297,6 +309,8 @@ public class EntityTrackerEntry {
if (this.tracker instanceof EntityPainting) { if (this.tracker instanceof EntityPainting) {
return new Packet25EntityPainting((EntityPainting) this.tracker); return new Packet25EntityPainting((EntityPainting) this.tracker);
} else if (this.tracker instanceof EntityExperienceOrb) {
return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
} else { } else {
throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!"); throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
} }

Datei anzeigen

@ -72,8 +72,8 @@ public class EntityWeatherStorm extends EntityWeather {
} }
} }
public void m_() { public void s_() {
super.m_(); super.s_();
if (this.lifeTicks == 2) { if (this.lifeTicks == 2) {
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F); this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);

Datei anzeigen

@ -17,16 +17,16 @@ public class EntityWolf extends EntityAnimal {
private boolean a = false; private boolean a = false;
private float b; private float b;
private float c; private float c;
private boolean f;
private boolean g; private boolean g;
private float h; private boolean h;
private float i; private float i;
private float j;
public EntityWolf(World world) { public EntityWolf(World world) {
super(world); super(world);
this.texture = "/mob/wolf.png"; this.texture = "/mob/wolf.png";
this.b(0.8F, 0.8F); this.b(0.8F, 0.8F);
this.aE = 1.1F; this.aU = 1.1F;
this.health = 8; this.health = 8;
} }
@ -37,7 +37,7 @@ public class EntityWolf extends EntityAnimal {
this.datawatcher.a(18, new Integer(this.health)); this.datawatcher.a(18, new Integer(this.health));
} }
protected boolean n() { protected boolean e_() {
return false; return false;
} }
@ -64,45 +64,45 @@ public class EntityWolf extends EntityAnimal {
} }
} }
protected boolean h_() { protected boolean d_() {
return !this.isTamed(); return !this.isTamed();
} }
protected String g() { protected String h() {
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.b(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.b(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
} }
protected String h() { protected String i() {
return "mob.wolf.hurt"; return "mob.wolf.hurt";
} }
protected String i() { protected String j() {
return "mob.wolf.death"; return "mob.wolf.death";
} }
protected float k() { protected float l() {
return 0.4F; return 0.4F;
} }
protected int j() { protected int k() {
return -1; return -1;
} }
protected void c_() { protected void c_() {
super.c_(); super.c_();
if (!this.e && !this.C() && this.isTamed() && this.vehicle == null) { if (!this.e && !this.B() && this.isTamed() && this.vehicle == null) {
EntityHuman entityhuman = this.world.a(this.getOwnerName()); EntityHuman entityhuman = this.world.a(this.getOwnerName());
if (entityhuman != null) { if (entityhuman != null) {
float f = entityhuman.f(this); float f = entityhuman.g(this);
if (f > 5.0F) { if (f > 5.0F) {
this.c(entityhuman, f); this.c(entityhuman, f);
} }
} else if (!this.ad()) { } else if (!this.ao()) {
this.setSitting(true); this.setSitting(true);
} }
} else if (this.target == null && !this.C() && !this.isTamed() && this.world.random.nextInt(100) == 0) { } else if (this.target == null && !this.B() && !this.isTamed() && this.world.random.nextInt(100) == 0) {
List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D)); List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D));
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -120,7 +120,7 @@ public class EntityWolf extends EntityAnimal {
} }
} }
if (this.ad()) { if (this.ao()) {
this.setSitting(false); this.setSitting(false);
} }
@ -129,11 +129,11 @@ public class EntityWolf extends EntityAnimal {
} }
} }
public void v() { public void s() {
super.v(); super.s();
this.a = false; this.a = false;
if (this.V() && !this.C() && !this.isAngry()) { if (this.ae() && !this.B() && !this.isAngry()) {
Entity entity = this.W(); Entity entity = this.af();
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity; EntityHuman entityhuman = (EntityHuman) entity;
@ -143,22 +143,22 @@ public class EntityWolf extends EntityAnimal {
if (!this.isTamed() && itemstack.id == Item.BONE.id) { if (!this.isTamed() && itemstack.id == Item.BONE.id) {
this.a = true; this.a = true;
} else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) { } else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) {
this.a = ((ItemFood) Item.byId[itemstack.id]).l(); this.a = ((ItemFood) Item.byId[itemstack.id]).m();
} }
} }
} }
} }
if (!this.Y && this.f && !this.g && !this.C() && this.onGround) { if (!this.ai && this.g && !this.h && !this.B() && this.onGround) {
this.g = true; this.h = true;
this.h = 0.0F;
this.i = 0.0F; this.i = 0.0F;
this.j = 0.0F;
this.world.a(this, (byte) 8); this.world.a(this, (byte) 8);
} }
} }
public void m_() { public void s_() {
super.m_(); super.s_();
this.c = this.b; this.c = this.b;
if (this.a) { if (this.a) {
this.b += (1.0F - this.b) * 0.4F; this.b += (1.0F - this.b) * 0.4F;
@ -167,31 +167,31 @@ public class EntityWolf extends EntityAnimal {
} }
if (this.a) { if (this.a) {
this.aF = 10; this.aV = 10;
} }
if (this.ac()) { if (this.an()) {
this.f = true; this.g = true;
this.g = false; this.h = false;
this.h = 0.0F;
this.i = 0.0F; this.i = 0.0F;
} else if ((this.f || this.g) && this.g) { this.j = 0.0F;
if (this.h == 0.0F) { } else if ((this.g || this.h) && this.h) {
this.world.makeSound(this, "mob.wolf.shake", this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); if (this.i == 0.0F) {
this.world.makeSound(this, "mob.wolf.shake", this.l(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
this.i = this.h; this.j = this.i;
this.h += 0.05F; this.i += 0.05F;
if (this.i >= 2.0F) { if (this.j >= 2.0F) {
this.f = false;
this.g = false; this.g = false;
this.h = false;
this.j = 0.0F;
this.i = 0.0F; this.i = 0.0F;
this.h = 0.0F;
} }
if (this.h > 0.4F) { if (this.i > 0.4F) {
float f = (float) this.boundingBox.b; float f = (float) this.boundingBox.b;
int i = (int) (MathHelper.sin((this.h - 0.4F) * 3.1415927F) * 7.0F); int i = (int) (MathHelper.sin((this.i - 0.4F) * 3.1415927F) * 7.0F);
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length * 0.5F; float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length * 0.5F;
@ -232,17 +232,19 @@ public class EntityWolf extends EntityAnimal {
} }
} }
protected boolean w() { protected boolean v() {
return this.isSitting() || this.g; return this.isSitting() || this.h;
} }
public boolean damageEntity(Entity entity, int i) { public boolean damageEntity(DamageSource damagesource, int i) {
Entity entity = damagesource.a();
this.setSitting(false); this.setSitting(false);
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
i = (i + 1) / 2; i = (i + 1) / 2;
} }
if (!super.damageEntity((Entity) entity, i)) { if (!super.damageEntity(damagesource, i)) {
return false; return false;
} else { } else {
if (!this.isTamed() && !this.isAngry()) { if (!this.isTamed() && !this.isAngry()) {
@ -302,7 +304,7 @@ public class EntityWolf extends EntityAnimal {
return true; return true;
} }
this.target = (Entity) entity; this.target = entity;
} }
return true; return true;
@ -343,11 +345,11 @@ public class EntityWolf extends EntityAnimal {
} }
// CraftBukkit end // CraftBukkit end
entity.damageEntity(this, b0); entity.damageEntity(DamageSource.a((EntityLiving) this), b0);
} }
} }
public boolean a(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand(); ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (!this.isTamed()) { if (!this.isTamed()) {
@ -366,10 +368,10 @@ public class EntityWolf extends EntityAnimal {
this.setSitting(true); this.setSitting(true);
this.health = 20; this.health = 20;
this.setOwnerName(entityhuman.name); this.setOwnerName(entityhuman.name);
this.a(true); this.b(true);
this.world.a(this, (byte) 7); this.world.a(this, (byte) 7);
} else { } else {
this.a(false); this.b(false);
this.world.a(this, (byte) 6); this.world.a(this, (byte) 6);
} }
} }
@ -380,13 +382,14 @@ public class EntityWolf extends EntityAnimal {
if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) { if (itemstack != null && Item.byId[itemstack.id] instanceof ItemFood) {
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id]; ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
if (itemfood.l() && this.datawatcher.b(18) < 20) { if (itemfood.m() && this.datawatcher.b(18) < 20) {
--itemstack.count; --itemstack.count;
this.c(((ItemFood) Item.PORK).k(), RegainReason.EATING); // Craftbukkit
if (itemstack.count <= 0) { if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
} }
this.b(((ItemFood) Item.PORK).k(), RegainReason.EATING);
return true; return true;
} }
} }
@ -394,7 +397,7 @@ public class EntityWolf extends EntityAnimal {
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) { if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.setSitting(!this.isSitting()); this.setSitting(!this.isSitting());
this.aC = false; this.aS = false;
this.setPathEntity((PathEntity) null); this.setPathEntity((PathEntity) null);
} }
@ -405,7 +408,7 @@ public class EntityWolf extends EntityAnimal {
return false; return false;
} }
void a(boolean flag) { void b(boolean flag) {
String s = "heart"; String s = "heart";
if (!flag) { if (!flag) {
@ -421,7 +424,7 @@ public class EntityWolf extends EntityAnimal {
} }
} }
public int l() { public int m() {
return 8; return 8;
} }

Datei anzeigen

@ -7,13 +7,13 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) { public EntityZombie(World world) {
super(world); super(world);
this.texture = "/mob/zombie.png"; this.texture = "/mob/zombie.png";
this.aE = 0.5F; this.aU = 0.5F;
this.damage = 5; this.damage = 5;
} }
public void v() { public void s() {
if (this.world.d()) { if (this.world.d() && !this.world.isStatic) {
float f = this.c(1.0F); float f = this.a_(1.0F);
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
// CraftBukkit start // CraftBukkit start
@ -27,22 +27,22 @@ public class EntityZombie extends EntityMonster {
} }
} }
super.v(); super.s();
}
protected String g() {
return "mob.zombie";
} }
protected String h() { protected String h() {
return "mob.zombiehurt"; return "mob.zombie";
} }
protected String i() { protected String i() {
return "mob.zombiehurt";
}
protected String j() {
return "mob.zombiedeath"; return "mob.zombiedeath";
} }
protected int j() { protected int k() {
return Item.FEATHER.id; return Item.ROTTEN_FLESH.id;
} }
} }

Datei anzeigen

@ -130,7 +130,7 @@ public class Explosion {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
entity.damageEntity(this.source, event.getDamage()); entity.damageEntity(DamageSource.k, event.getDamage());
entity.motX += d0 * d10; entity.motX += d0 * d10;
entity.motY += d1 * d10; entity.motY += d1 * d10;
entity.motZ += d2 * d10; entity.motZ += d2 * d10;
@ -140,7 +140,7 @@ public class Explosion {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
entity.damageEntity(this.source, event.getDamage()); entity.damageEntity(DamageSource.k, event.getDamage());
entity.motX += d0 * d10; entity.motX += d0 * d10;
entity.motY += d1 * d10; entity.motY += d1 * d10;
@ -173,6 +173,7 @@ public class Explosion {
public void a(boolean flag) { public void a(boolean flag) {
this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F); this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
this.world.a("hugeexplosion", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
arraylist.addAll(this.blocks); arraylist.addAll(this.blocks);
@ -234,7 +235,7 @@ public class Explosion {
// CraftBukkit // CraftBukkit
Block.byId[i1].dropNaturally(this.world, j, k, l, this.world.getData(j, k, l), event.getYield()); Block.byId[i1].dropNaturally(this.world, j, k, l, this.world.getData(j, k, l), event.getYield());
this.world.setTypeId(j, k, l, 0); this.world.setTypeId(j, k, l, 0);
Block.byId[i1].d(this.world, j, k, l); Block.byId[i1].a_(this.world, j, k, l);
} }
} }
} }

Datei anzeigen

@ -16,7 +16,11 @@ public interface IInventory {
void update(); void update();
boolean a_(EntityHuman entityhuman); boolean a(EntityHuman entityhuman);
void e();
void t_();
public abstract ItemStack[] getContents(); // CraftBukkit public abstract ItemStack[] getContents(); // CraftBukkit
} }

Datei anzeigen

@ -45,7 +45,11 @@ public class InventoryCraftResult implements IInventory {
public void update() {} public void update() {}
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return true; return true;
} }
public void e() {}
public void t_() {}
} }

Datei anzeigen

@ -76,7 +76,11 @@ public class InventoryCrafting implements IInventory {
public void update() {} public void update() {}
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return true; return true;
} }
public void e() {}
public void t_() {}
} }

Datei anzeigen

@ -18,6 +18,14 @@ public class InventoryLargeChest implements IInventory {
public InventoryLargeChest(String s, IInventory iinventory, IInventory iinventory1) { public InventoryLargeChest(String s, IInventory iinventory, IInventory iinventory1) {
this.a = s; this.a = s;
if (iinventory == null) {
iinventory = iinventory1;
}
if (iinventory1 == null) {
iinventory1 = iinventory;
}
this.b = iinventory; this.b = iinventory;
this.c = iinventory1; this.c = iinventory1;
} }
@ -55,7 +63,17 @@ public class InventoryLargeChest implements IInventory {
this.c.update(); this.c.update();
} }
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.b.a_(entityhuman) && this.c.a_(entityhuman); return this.b.a(entityhuman) && this.c.a(entityhuman);
}
public void e() {
this.b.e();
this.c.e();
}
public void t_() {
this.b.t_();
this.c.t_();
} }
} }

Datei anzeigen

@ -27,11 +27,11 @@ public class InventoryPlayer implements IInventory {
return this.itemInHandIndex < 9 && this.itemInHandIndex >= 0 ? this.items[this.itemInHandIndex] : null; return this.itemInHandIndex < 9 && this.itemInHandIndex >= 0 ? this.items[this.itemInHandIndex] : null;
} }
public static int e() { public static int g() {
return 9; return 9;
} }
private int d(int i) { private int e(int i) {
for (int j = 0; j < this.items.length; ++j) { for (int j = 0; j < this.items.length; ++j) {
if (this.items[j] != null && this.items[j].id == i) { if (this.items[j] != null && this.items[j].id == i) {
return j; return j;
@ -67,7 +67,7 @@ public class InventoryPlayer implements IInventory {
} }
// CraftBukkit end // CraftBukkit end
private int k() { private int m() {
for (int i = 0; i < this.items.length; ++i) { for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] == null) { if (this.items[i] == null) {
return i; return i;
@ -83,7 +83,7 @@ public class InventoryPlayer implements IInventory {
int k = this.firstPartial(itemstack); int k = this.firstPartial(itemstack);
if (k < 0) { if (k < 0) {
k = this.k(); k = this.m();
} }
if (k < 0) { if (k < 0) {
@ -114,7 +114,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public void f() { public void h() {
for (int i = 0; i < this.items.length; ++i) { for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] != null) { if (this.items[i] != null) {
this.items[i].a(this.d.world, this.d, i, this.itemInHandIndex == i); this.items[i].a(this.d.world, this.d, i, this.itemInHandIndex == i);
@ -123,7 +123,7 @@ public class InventoryPlayer implements IInventory {
} }
public boolean b(int i) { public boolean b(int i) {
int j = this.d(i); int j = this.e(i);
if (j < 0) { if (j < 0) {
return false; return false;
@ -136,11 +136,17 @@ public class InventoryPlayer implements IInventory {
} }
} }
public boolean c(int i) {
int j = this.e(i);
return j >= 0;
}
public boolean pickup(ItemStack itemstack) { public boolean pickup(ItemStack itemstack) {
int i; int i;
if (itemstack.f()) { if (itemstack.f()) {
i = this.k(); i = this.m();
if (i >= 0) { if (i >= 0) {
this.items[i] = ItemStack.b(itemstack); this.items[i] = ItemStack.b(itemstack);
this.items[i].b = 5; this.items[i].b = 5;
@ -216,7 +222,7 @@ public class InventoryPlayer implements IInventory {
if (this.items[i] != null) { if (this.items[i] != null) {
nbttagcompound = new NBTTagCompound(); nbttagcompound = new NBTTagCompound();
nbttagcompound.a("Slot", (byte) i); nbttagcompound.a("Slot", (byte) i);
this.items[i].a(nbttagcompound); this.items[i].b(nbttagcompound);
nbttaglist.a((NBTBase) nbttagcompound); nbttaglist.a((NBTBase) nbttagcompound);
} }
} }
@ -225,7 +231,7 @@ public class InventoryPlayer implements IInventory {
if (this.armor[i] != null) { if (this.armor[i] != null) {
nbttagcompound = new NBTTagCompound(); nbttagcompound = new NBTTagCompound();
nbttagcompound.a("Slot", (byte) (i + 100)); nbttagcompound.a("Slot", (byte) (i + 100));
this.armor[i].a(nbttagcompound); this.armor[i].b(nbttagcompound);
nbttaglist.a((NBTBase) nbttagcompound); nbttaglist.a((NBTBase) nbttagcompound);
} }
} }
@ -240,9 +246,9 @@ public class InventoryPlayer implements IInventory {
for (int i = 0; i < nbttaglist.c(); ++i) { for (int i = 0; i < nbttaglist.c(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i);
int j = nbttagcompound.c("Slot") & 255; int j = nbttagcompound.c("Slot") & 255;
ItemStack itemstack = new ItemStack(nbttagcompound); ItemStack itemstack = ItemStack.a(nbttagcompound);
if (itemstack.getItem() != null) { if (itemstack != null) {
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = itemstack; this.items[j] = itemstack;
} }
@ -284,7 +290,7 @@ public class InventoryPlayer implements IInventory {
} }
public boolean b(Block block) { public boolean b(Block block) {
if (block.material.i()) { if (block.material.k()) {
return true; return true;
} else { } else {
ItemStack itemstack = this.getItem(this.itemInHandIndex); ItemStack itemstack = this.getItem(this.itemInHandIndex);
@ -293,7 +299,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public int g() { public int i() {
int i = 0; int i = 0;
int j = 0; int j = 0;
int k = 0; int k = 0;
@ -306,7 +312,7 @@ public class InventoryPlayer implements IInventory {
j += k1; j += k1;
k += i1; k += i1;
int l1 = ((ItemArmor) this.armor[l].getItem()).bl; int l1 = ((ItemArmor) this.armor[l].getItem()).bu;
i += l1; i += l1;
} }
@ -319,7 +325,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public void c(int i) { public void d(int i) {
for (int j = 0; j < this.armor.length; ++j) { for (int j = 0; j < this.armor.length; ++j) {
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) { if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
this.armor[j].damage(i, this.d); this.armor[j].damage(i, this.d);
@ -331,7 +337,7 @@ public class InventoryPlayer implements IInventory {
} }
} }
public void h() { public void j() {
int i; int i;
for (i = 0; i < this.items.length; ++i) { for (i = 0; i < this.items.length; ++i) {
@ -358,12 +364,12 @@ public class InventoryPlayer implements IInventory {
this.d.a(itemstack); this.d.a(itemstack);
} }
public ItemStack j() { public ItemStack l() {
return this.f; return this.f;
} }
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.d.dead ? false : entityhuman.g(this.d) <= 64.0D; return this.d.dead ? false : entityhuman.h(this.d) <= 64.0D;
} }
public boolean c(ItemStack itemstack) { public boolean c(ItemStack itemstack) {
@ -383,4 +389,8 @@ public class InventoryPlayer implements IInventory {
return false; return false;
} }
public void e() {}
public void t_() {}
} }

Datei anzeigen

@ -40,23 +40,27 @@ public class ItemBed extends Item {
b0 = 1; b0 = 1;
} }
if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.e(i, j - 1, k) && world.e(i + b0, j - 1, k + b1)) { if (entityhuman.c(i, j, k) && entityhuman.c(i + b0, j, k + b1)) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.e(i, j - 1, k) && world.e(i + b0, j - 1, k + b1)) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
world.setTypeIdAndData(i, j, k, blockbed.id, i1); world.setTypeIdAndData(i, j, k, blockbed.id, i1);
// CraftBukkit start - bed // CraftBukkit start - bed
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, blockbed); BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, blockbed);
if (event.isCancelled() || !event.canBuild()) { if (event.isCancelled() || !event.canBuild()) {
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false); event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
return false;
}
// CraftBukkit end
world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8);
--itemstack.count;
return true;
} else {
return false; return false;
} }
// CraftBukkit end
world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8);
--itemstack.count;
return true;
} else { } else {
return false; return false;
} }

Datei anzeigen

@ -16,12 +16,17 @@ public class ItemBlock extends Item {
this.b(Block.byId[i + 256].a(2)); this.b(Block.byId[i + 256].a(2));
} }
public int a() {
return this.id;
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k);
if (world.getTypeId(i, j, k) == Block.SNOW.id) { if (i1 == Block.SNOW.id) {
l = 0; l = 0;
} else { } else if (i1 != Block.VINE.id) {
if (l == 0) { if (l == 0) {
--j; --j;
} }
@ -49,75 +54,84 @@ public class ItemBlock extends Item {
if (itemstack.count == 0) { if (itemstack.count == 0) {
return false; return false;
} else if (j == 127 && Block.byId[this.id].material.isBuildable()) { } else if (!entityhuman.c(i, j, k)) {
return false; return false;
} else if (world.a(this.id, i, j, k, false, l)) {
Block block = Block.byId[this.id];
// CraftBukkit start - This executes the placement of the block
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
// There are like 30 combinations you can mix and match steps and double steps
// of different materials, so there are a lot of different cases of what
// would happen if you place x step onto another y step, so let's just keep
// track of the entire state
CraftBlockState blockStateBelow = null;
// Toggles whether the normal or the block below is used for the place event
boolean eventUseBlockBelow = false;
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id)
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
// Step is placed on step, forms a doublestep replacing the original step, so we need the lower block
eventUseBlockBelow = itemstack.id == Block.STEP.id && blockStateBelow.getTypeId() == Block.STEP.id;
}
/**
* @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
*
* This replaces world.setTypeIdAndData(IIIII), we're doing this because we need to
* hook between the 'placement' and the informing to 'world' so we can
* sanely undo this.
*
* Whenever the call to 'world.setTypeIdAndData' changes we need to figure out again what to
* replace this with.
*/
if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, eventUseBlockBelow ? blockStateBelow : replacedBlockState, clickedX, clickedY, clickedZ, block);
if (event.isCancelled() || !event.canBuild()) {
if (blockStateBelow != null) { // Used for steps
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
world.setTypeIdAndData(i, j - 1, k, blockStateBelow.getTypeId(), blockStateBelow.getRawData());
} else {
if (this.id == Block.ICE.id) {
// Ice will explode if we set straight to 0
world.setTypeId(i, j, k, 20);
}
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
}
return true;
}
world.update(i, j, k, this.id); // <-- world.setTypeIdAndData does this on success (tell the world)
// CraftBukkit end
Block.byId[this.id].postPlace(world, i, j, k, l);
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
return true;
} else { } else {
return false; world.getClass();
if (j == 128 - 1 && Block.byId[this.id].material.isBuildable()) {
return false;
} else if (world.a(this.id, i, j, k, false, l)) {
Block block = Block.byId[this.id];
// CraftBukkit start - This executes the placement of the block
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
// There are like 30 combinations you can mix and match steps and double steps
// of different materials, so there are a lot of different cases of what
// would happen if you place x step onto another y step, so let's just keep
// track of the entire state
CraftBlockState blockStateBelow = null;
// Toggles whether the normal or the block below is used for the place event
boolean eventUseBlockBelow = false;
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id)
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
// Step is placed on step, forms a doublestep replacing the original step, so we need the lower block
eventUseBlockBelow = itemstack.id == Block.STEP.id && blockStateBelow.getTypeId() == Block.STEP.id;
}
/**
* @see net.minecraft.server.World#setTypeIdAndData(int i, int j, int k, int l, int i1)
*
* This replaces world.setTypeIdAndData(IIIII), we're doing this because we need to
* hook between the 'placement' and the informing to 'world' so we can
* sanely undo this.
*
* Whenever the call to 'world.setTypeIdAndData' changes we need to figure out again what to
* replace this with.
*/
if (world.setRawTypeIdAndData(i, j, k, this.id, this.filterData(itemstack.getData()))) { // <-- world.setTypeIdAndData does this to place the block
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, eventUseBlockBelow ? blockStateBelow : replacedBlockState, clickedX, clickedY, clickedZ, block);
if (event.isCancelled() || !event.canBuild()) {
if (blockStateBelow != null) { // Used for steps
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
world.setTypeIdAndData(i, j - 1, k, blockStateBelow.getTypeId(), blockStateBelow.getRawData());
} else {
if (this.id == Block.ICE.id) {
// Ice will explode if we set straight to 0
world.setTypeId(i, j, k, 20);
}
world.setTypeIdAndData(i, j, k, replacedBlockState.getTypeId(), replacedBlockState.getRawData());
}
return true;
}
world.update(i, j, k, this.id); // <-- world.setTypeIdAndData does this on success (tell the world)
// CraftBukkit end
Block.byId[this.id].postPlace(world, i, j, k, l);
Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getName(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
--itemstack.count;
}
return true;
} else {
return false;
}
} }
} }
public String a() { public String a(ItemStack itemstack) {
return Block.byId[this.id].l();
}
public String b() {
return Block.byId[this.id].l(); return Block.byId[this.id].l();
} }
} }

Datei anzeigen

@ -49,6 +49,10 @@ public class ItemBucket extends Item {
} }
if (this.a == 0) { if (this.a == 0) {
if (!entityhuman.c(i, j, k)) {
return itemstack;
}
if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0) { if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0) {
// CraftBukkit start // CraftBukkit start
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, i, j, k, -1, itemstack, Item.WATER_BUCKET); PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, i, j, k, -1, itemstack, Item.WATER_BUCKET);
@ -121,6 +125,10 @@ public class ItemBucket extends Item {
++i; ++i;
} }
if (!entityhuman.c(i, j, k)) {
return itemstack;
}
if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) { if (world.isEmpty(i, j, k) || !world.getMaterial(i, j, k).isBuildable()) {
// CraftBukkit start // CraftBukkit start
PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clickedX, clickedY, clickedZ, movingobjectposition.face, itemstack); PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, clickedX, clickedY, clickedZ, movingobjectposition.face, itemstack);
@ -140,6 +148,10 @@ public class ItemBucket extends Item {
world.setTypeIdAndData(i, j, k, this.a, 0); world.setTypeIdAndData(i, j, k, this.a, 0);
} }
if (entityhuman.K.d) {
return itemstack;
}
// CraftBukkit start // CraftBukkit start
CraftItemStack itemInHand = (CraftItemStack) event.getItemStack(); CraftItemStack itemInHand = (CraftItemStack) event.getItemStack();
byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData(); byte data = itemInHand.getData() == null ? (byte) 0 : itemInHand.getData().getData();

Datei anzeigen

@ -20,8 +20,6 @@ public class ItemDoor extends Item {
if (l != 1) { if (l != 1) {
return false; return false;
} else { } else {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
++j; ++j;
Block block; Block block;
@ -31,70 +29,87 @@ public class ItemDoor extends Item {
block = Block.IRON_DOOR_BLOCK; block = Block.IRON_DOOR_BLOCK;
} }
if (!block.canPlace(world, i, j, k)) { if (entityhuman.c(i, j, k) && entityhuman.c(i, j + 1, k)) {
return false; if (!block.canPlace(world, i, j, k)) {
} else {
int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
byte b0 = 0;
byte b1 = 0;
if (i1 == 0) {
b1 = 1;
}
if (i1 == 1) {
b0 = -1;
}
if (i1 == 2) {
b1 = -1;
}
if (i1 == 3) {
b0 = 1;
}
int j1 = (world.e(i - b0, j, k - b1) ? 1 : 0) + (world.e(i - b0, j + 1, k - b1) ? 1 : 0);
int k1 = (world.e(i + b0, j, k + b1) ? 1 : 0) + (world.e(i + b0, j + 1, k + b1) ? 1 : 0);
boolean flag = world.getTypeId(i - b0, j, k - b1) == block.id || world.getTypeId(i - b0, j + 1, k - b1) == block.id;
boolean flag1 = world.getTypeId(i + b0, j, k + b1) == block.id || world.getTypeId(i + b0, j + 1, k + b1) == block.id;
boolean flag2 = false;
if (flag && !flag1) {
flag2 = true;
} else if (k1 > j1) {
flag2 = true;
}
if (flag2) {
i1 = i1 - 1 & 3;
i1 += 4;
}
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
world.suppressPhysics = true;
world.setTypeIdAndData(i, j, k, block.id, i1);
// CraftBukkit start - bed
world.suppressPhysics = false;
world.applyPhysics(i, j, k, Block.REDSTONE_WIRE.id);
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, block);
if (event.isCancelled() || !event.canBuild()) {
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
return false; return false;
} } else {
int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
world.suppressPhysics = true; // CraftBukkit start
// CraftBukkit end if (a(world, i, j, k, i1, block, entityhuman)) {
world.setTypeIdAndData(i, j + 1, k, block.id, i1 + 8); --itemstack.count;
world.suppressPhysics = false; return true;
// world.applyPhysics(i, j, k, block.id); // CraftBukkit - moved up } else {
world.applyPhysics(i, j + 1, k, Block.REDSTONE_WIRE.id); return false;
--itemstack.count; }
return true; // CraftBukkit end
}
} else {
return false;
} }
} }
} }
// Craftbukkit - void -> boolean + entityhuman argument
public static boolean a(World world, int i, int j, int k, int l, Block block, EntityHuman entityhuman) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
byte b0 = 0;
byte b1 = 0;
if (l == 0) {
b1 = 1;
}
if (l == 1) {
b0 = -1;
}
if (l == 2) {
b1 = -1;
}
if (l == 3) {
b0 = 1;
}
int i1 = (world.e(i - b0, j, k - b1) ? 1 : 0) + (world.e(i - b0, j + 1, k - b1) ? 1 : 0);
int j1 = (world.e(i + b0, j, k + b1) ? 1 : 0) + (world.e(i + b0, j + 1, k + b1) ? 1 : 0);
boolean flag = world.getTypeId(i - b0, j, k - b1) == block.id || world.getTypeId(i - b0, j + 1, k - b1) == block.id;
boolean flag1 = world.getTypeId(i + b0, j, k + b1) == block.id || world.getTypeId(i + b0, j + 1, k + b1) == block.id;
boolean flag2 = false;
if (flag && !flag1) {
flag2 = true;
} else if (j1 > i1) {
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);
// CraftBukkit start - bed
world.suppressPhysics = false;
world.applyPhysics(i, j, k, Block.REDSTONE_WIRE.id);
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, block);
if (event.isCancelled() || !event.canBuild()) {
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
return false;
}
world.suppressPhysics = true;
// CraftBukkit end
world.setTypeIdAndData(i, j + 1, k, block.id, l + 8);
world.suppressPhysics = false;
// world.applyPhysics(i, j, k, block.id); // CraftBukkit - moved up
world.applyPhysics(i, j + 1, k, block.id);
return true; // CraftBukkit
}
} }

Datei anzeigen

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

Datei anzeigen

@ -43,38 +43,42 @@ public class ItemFlintAndSteel extends Item {
++i; ++i;
} }
int i1 = world.getTypeId(i, j, k); if (!entityhuman.c(i, j, k)) {
return false;
} else {
int i1 = world.getTypeId(i, j, k);
if (i1 == 0) { if (i1 == 0) {
// CraftBukkit start - store the clicked block // CraftBukkit start - store the clicked block
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
Player thePlayer = (Player) entityhuman.getBukkitEntity(); Player thePlayer = (Player) entityhuman.getBukkitEntity();
BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, thePlayer); BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, thePlayer);
world.getServer().getPluginManager().callEvent(eventIgnite); world.getServer().getPluginManager().callEvent(eventIgnite);
if (eventIgnite.isCancelled()) { if (eventIgnite.isCancelled()) {
itemstack.damage(1, entityhuman); itemstack.damage(1, entityhuman);
return false; return false;
}
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
// CraftBukkit end
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
world.setTypeId(i, j, k, Block.FIRE.id);
// CraftBukkit start
BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.FIRE.id);
if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);
return false;
}
// CraftBukkit end
} }
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); itemstack.damage(1, entityhuman);
// CraftBukkit end return true;
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
world.setTypeId(i, j, k, Block.FIRE.id);
// CraftBukkit start
BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.FIRE.id);
if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);
return false;
}
// CraftBukkit end
} }
itemstack.damage(1, entityhuman);
return true;
} }
} }

Datei anzeigen

@ -15,33 +15,37 @@ public class ItemHoe extends Item {
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int i1 = world.getTypeId(i, j, k); if (!entityhuman.c(i, j, k)) {
int j1 = world.getTypeId(i, j + 1, k);
if ((l == 0 || j1 != 0 || i1 != Block.GRASS.id) && i1 != Block.DIRT.id) {
return false; return false;
} else { } else {
Block block = Block.SOIL; int i1 = world.getTypeId(i, j, k);
int j1 = world.getTypeId(i, j + 1, k);
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); if ((l == 0 || j1 != 0 || i1 != Block.GRASS.id) && i1 != Block.DIRT.id) {
if (world.isStatic) { return false;
return true;
} else { } else {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit Block block = Block.SOIL;
world.setTypeId(i, j, k, block.id); 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);
if (world.isStatic) {
return true;
} else {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
// CraftBukkit start - Hoes - blockface -1 for 'SELF' world.setTypeId(i, j, k, block.id);
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, block);
if (event.isCancelled() || !event.canBuild()) { // CraftBukkit start - Hoes - blockface -1 for 'SELF'
event.getBlockPlaced().setTypeId(blockState.getTypeId()); BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, block);
return false;
if (event.isCancelled() || !event.canBuild()) {
event.getBlockPlaced().setTypeId(blockState.getTypeId());
return false;
}
// CraftBukkit end
itemstack.damage(1, entityhuman);
return true;
} }
// CraftBukkit end
itemstack.damage(1, entityhuman);
return true;
} }
} }
} }

Datei anzeigen

@ -11,104 +11,139 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class ItemInWorldManager { public class ItemInWorldManager {
private WorldServer world; public World world;
public EntityHuman player; public EntityHuman player;
private float c = 0.0F; private int c = -1;
private float d = 0.0F;
private int lastDigTick; private int lastDigTick;
private int e;
private int f; private int f;
private int g; private int g;
private int h;
private int currentTick; private int currentTick;
private boolean i; private boolean j;
private int j;
private int k; private int k;
private int l; private int l;
private int m; private int m;
private int n;
public ItemInWorldManager(WorldServer worldserver) { public ItemInWorldManager(World world) {
this.world = worldserver; this.world = world;
} }
public void a() { public void a(int i) {
this.c = i;
if (i == 0) {
this.player.K.c = false;
this.player.K.b = false;
this.player.K.d = false;
this.player.K.a = false;
} else {
this.player.K.c = true;
this.player.K.d = true;
this.player.K.a = true;
}
}
public int a() {
return this.c;
}
public boolean b() {
return this.c == 1;
}
public void b(int i) {
if (this.c == -1) {
this.c = i;
}
this.a(this.c);
}
public void c() {
this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
if (this.i) { if (this.j) {
int i = this.currentTick - this.m; int i = this.currentTick - this.n;
int j = this.world.getTypeId(this.j, this.k, this.l); int j = this.world.getTypeId(this.k, this.l, this.m);
if (j != 0) { if (j != 0) {
Block block = Block.byId[j]; Block block = Block.byId[j];
float f = block.getDamage(this.player) * (float) (i + 1); float f = block.getDamage(this.player) * (float) (i + 1);
if (f >= 1.0F) { if (f >= 1.0F) {
this.i = false; this.j = false;
this.c(this.j, this.k, this.l); this.c(this.k, this.l, this.m);
} }
} else { } else {
this.i = false; this.j = false;
} }
} }
} }
public void dig(int i, int j, int k, int l) { public void dig(int i, int j, int k, int l) {
// this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down // this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit if (this.b()) {
int i1 = this.world.getTypeId(i, j, k);
// CraftBukkit start
// Swings at air do *NOT* exist.
if (i1 <= 0) {
return;
}
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
if (event.useInteractedBlock() == Event.Result.DENY) {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (i1 == Block.WOODEN_DOOR.id) {
// For some reason *BOTH* the bottom/top part have to be marked updated.
boolean bottom = (this.world.getData(i, j, k) & 8) == 0;
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
} else if (i1 == Block.TRAP_DOOR.id) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
} else {
Block.byId[i1].b(this.world, i, j, k, this.player);
// Allow fire punching to be blocked
this.world.douseFire((EntityHuman) null, i, j, k, l);
}
// Handle hitting a block
float toolDamage = Block.byId[i1].getDamage(this.player);
if (event.useItemInHand() == Event.Result.DENY) {
// If we 'insta destroyed' then the client needs to be informed.
if (toolDamage > 1.0f) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
return;
}
BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, i, j, k, this.player.inventory.getItemInHand(), toolDamage >= 1.0f);
if (blockEvent.isCancelled()) {
return;
}
if (blockEvent.getInstaBreak()) {
toolDamage = 2.0f;
}
if (toolDamage >= 1.0F) {
// CraftBukkit end
this.c(i, j, k); this.c(i, j, k);
} else { } else {
this.e = i; this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
this.f = j; int i1 = this.world.getTypeId(i, j, k);
this.g = k;
// CraftBukkit start
// Swings at air do *NOT* exist.
if (i1 <= 0) {
return;
}
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
if (event.useInteractedBlock() == Event.Result.DENY) {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (i1 == Block.WOODEN_DOOR.id) {
// For some reason *BOTH* the bottom/top part have to be marked updated.
boolean bottom = (this.world.getData(i, j, k) & 8) == 0;
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
} else if (i1 == Block.TRAP_DOOR.id) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
} else {
Block.byId[i1].b(this.world, i, j, k, this.player);
// Allow fire punching to be blocked
this.world.douseFire((EntityHuman) null, i, j, k, l);
}
// Handle hitting a block
float toolDamage = Block.byId[i1].getDamage(this.player);
if (event.useItemInHand() == Event.Result.DENY) {
// If we 'insta destroyed' then the client needs to be informed.
if (toolDamage > 1.0f) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
return;
}
BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, i, j, k, this.player.inventory.getItemInHand(), toolDamage >= 1.0f);
if (blockEvent.isCancelled()) {
return;
}
if (blockEvent.getInstaBreak()) {
toolDamage = 2.0f;
}
if (toolDamage >= 1.0F) {
// CraftBukkit end
this.c(i, j, k);
} else {
this.f = i;
this.g = j;
this.h = k;
}
} }
} }
public void a(int i, int j, int k) { public void a(int i, int j, int k) {
if (i == this.e && j == this.f && k == this.g) { if (i == this.f && j == this.g && k == this.h) {
this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
int l = this.currentTick - this.lastDigTick; int l = this.currentTick - this.lastDigTick;
int i1 = this.world.getTypeId(i, j, k); int i1 = this.world.getTypeId(i, j, k);
@ -119,12 +154,12 @@ public class ItemInWorldManager {
if (f >= 0.7F) { if (f >= 0.7F) {
this.c(i, j, k); this.c(i, j, k);
} else if (!this.i) { } else if (!this.j) {
this.i = true; this.j = true;
this.j = i; this.k = i;
this.k = j; this.l = j;
this.l = k; this.m = k;
this.m = this.lastDigTick; this.n = this.lastDigTick;
} }
} }
// CraftBukkit start - force blockreset to client // CraftBukkit start - force blockreset to client
@ -133,7 +168,7 @@ public class ItemInWorldManager {
// CraftBukkit end // CraftBukkit end
} }
this.c = 0.0F; this.d = 0.0F;
} }
public boolean b(int i, int j, int k) { public boolean b(int i, int j, int k) {
@ -167,19 +202,23 @@ public class ItemInWorldManager {
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) * 256);
boolean flag = this.b(i, j, k); boolean flag = this.b(i, j, k);
ItemStack itemstack = this.player.G();
if (itemstack != null) { if (this.b()) {
itemstack.a(l, i, j, k, this.player);
if (itemstack.count == 0) {
itemstack.a(this.player);
this.player.H();
}
}
if (flag && this.player.b(Block.byId[l])) {
Block.byId[l].a(this.world, this.player, i, j, k, i1);
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world)); ((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
ItemStack itemstack = this.player.K();
if (itemstack != null) {
itemstack.a(l, i, j, k, this.player);
if (itemstack.count == 0) {
itemstack.a(this.player);
this.player.L();
}
}
if (flag && this.player.b(Block.byId[l])) {
Block.byId[l].a(this.world, this.player, i, j, k, i1);
}
} }
return flag; return flag;
@ -187,12 +226,18 @@ public class ItemInWorldManager {
public boolean useItem(EntityHuman entityhuman, World world, ItemStack itemstack) { public boolean useItem(EntityHuman entityhuman, World world, ItemStack itemstack) {
int i = itemstack.count; int i = itemstack.count;
int j = itemstack.getData();
ItemStack itemstack1 = itemstack.a(world, entityhuman); ItemStack itemstack1 = itemstack.a(world, entityhuman);
if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) { if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i)) {
return false; return false;
} else { } else {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1; entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1;
if (this.b()) {
itemstack1.count = i;
itemstack1.b(j);
}
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null; entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null;
} }
@ -201,6 +246,7 @@ public class ItemInWorldManager {
} }
} }
// TODO: Review this code, it changed in 1.8 but I'm not sure if we need to update or not
public boolean interact(EntityHuman entityhuman, World world, ItemStack itemstack, int i, int j, int k, int l) { public boolean interact(EntityHuman entityhuman, World world, ItemStack itemstack, int i, int j, int k, int l) {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
@ -231,4 +277,8 @@ public class ItemInWorldManager {
return result; return result;
// CraftBukkit end // CraftBukkit end
} }
public void a(WorldServer worldserver) {
this.world = worldserver;
}
} }

Datei anzeigen

@ -32,30 +32,34 @@ public class ItemPainting extends Item {
b0 = 3; b0 = 3;
} }
EntityPainting entitypainting = new EntityPainting(world, i, j, k, b0); if (!entityhuman.c(i, j, k)) {
return false;
} else {
EntityPainting entitypainting = new EntityPainting(world, i, j, k, b0);
if (entitypainting.h()) { if (entitypainting.i()) {
if (!world.isStatic) { if (!world.isStatic) {
// CraftBukkit start // CraftBukkit start
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity(); Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.BlockFace blockFace = CraftBlock.notchToBlockFace(l); org.bukkit.block.BlockFace blockFace = CraftBlock.notchToBlockFace(l);
PaintingPlaceEvent event = new PaintingPlaceEvent((org.bukkit.entity.Painting) entitypainting.getBukkitEntity(), who, blockClicked, blockFace); PaintingPlaceEvent event = new PaintingPlaceEvent((org.bukkit.entity.Painting) entitypainting.getBukkitEntity(), who, blockClicked, blockFace);
world.getServer().getPluginManager().callEvent(event); world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return false; return false;
}
// CraftBukkit end
world.addEntity(entitypainting);
} }
// CraftBukkit end
world.addEntity(entitypainting); --itemstack.count;
} }
--itemstack.count; return true;
} }
return true;
} }
} }
} }

Datei anzeigen

@ -45,25 +45,29 @@ public class ItemRedstone extends Item {
} }
} }
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) { if (!entityhuman.c(i, j, k)) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit return false;
} else {
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
world.setRawTypeId(i, j, k, Block.REDSTONE_WIRE.id); // CraftBukkit - We update after the event world.setRawTypeId(i, j, k, Block.REDSTONE_WIRE.id); // CraftBukkit - We update after the event
// CraftBukkit start - redstone // CraftBukkit start - redstone
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.REDSTONE_WIRE); BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, Block.REDSTONE_WIRE);
if (event.isCancelled() || !event.canBuild()) { if (event.isCancelled() || !event.canBuild()) {
event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false); event.getBlockPlaced().setTypeIdAndData(blockState.getTypeId(), blockState.getRawData(), false);
return false; return false;
}
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
} }
world.update( i, j, k, Block.REDSTONE_WIRE.id); // Must take place after BlockPlaceEvent, we need to update all other blocks. return true;
// CraftBukkit end
--itemstack.count; // CraftBukkit - ORDER MATTERS
} }
return true;
} }
} }

Datei anzeigen

@ -17,10 +17,11 @@ public class ItemReed extends Item {
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k);
if (world.getTypeId(i, j, k) == Block.SNOW.id) { if (i1 == Block.SNOW.id) {
l = 0; l = 0;
} else { } else if (i1 != Block.VINE.id) {
if (l == 0) { if (l == 0) {
--j; --j;
} }
@ -46,7 +47,9 @@ public class ItemReed extends Item {
} }
} }
if (itemstack.count == 0) { if (!entityhuman.c(i, j, k)) {
return false;
} else if (itemstack.count == 0) {
return false; return false;
} else { } else {
if (world.a(this.id, i, j, k, false, l)) { if (world.a(this.id, i, j, k, false, l)) {

Datei anzeigen

@ -18,7 +18,7 @@ public class ItemSeeds extends Item {
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l != 1) { if (l != 1) {
return false; return false;
} else { } else if (entityhuman.c(i, j, k) && entityhuman.c(i, j + 1, k)) {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
if (i1 == Block.SOIL.id && world.isEmpty(i, j + 1, k)) { if (i1 == Block.SOIL.id && world.isEmpty(i, j + 1, k)) {
@ -40,6 +40,8 @@ public class ItemSeeds extends Item {
} else { } else {
return false; return false;
} }
} else {
return false;
} }
} }
} }

Datei anzeigen

@ -41,13 +41,17 @@ public class ItemSign extends Item {
++i; ++i;
} }
if (!Block.SIGN_POST.canPlace(world, i, j, k)) { if (!entityhuman.c(i, j, k)) {
return false;
} else if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
return false; return false;
} else { } else {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
if (l == 1) { if (l == 1) {
world.setTypeIdAndData(i, j, k, Block.SIGN_POST.id, MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15); int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
world.setTypeIdAndData(i, j, k, Block.SIGN_POST.id, i1);
} else { } else {
world.setTypeIdAndData(i, j, k, Block.WALL_SIGN.id, l); world.setTypeIdAndData(i, j, k, Block.WALL_SIGN.id, l);
} }

Datei anzeigen

@ -38,9 +38,15 @@ public final class ItemStack {
this.damage = k; this.damage = k;
} }
public ItemStack(NBTTagCompound nbttagcompound) { public static ItemStack a(NBTTagCompound nbttagcompound) {
ItemStack itemstack = new ItemStack();
itemstack.c(nbttagcompound);
return itemstack.getItem() != null ? itemstack : null;
}
private ItemStack() {
this.count = 0; this.count = 0;
this.b(nbttagcompound);
} }
public ItemStack a(int i) { public ItemStack a(int i) {
@ -70,14 +76,18 @@ public final class ItemStack {
return this.getItem().a(this, world, entityhuman); return this.getItem().a(this, world, entityhuman);
} }
public NBTTagCompound a(NBTTagCompound nbttagcompound) { public ItemStack b(World world, EntityHuman entityhuman) {
return this.getItem().b(this, world, entityhuman);
}
public NBTTagCompound b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("id", (short) this.id); nbttagcompound.a("id", (short) this.id);
nbttagcompound.a("Count", (byte) this.count); nbttagcompound.a("Count", (byte) this.count);
nbttagcompound.a("Damage", (short) this.damage); nbttagcompound.a("Damage", (short) this.damage);
return nbttagcompound; return nbttagcompound;
} }
public void b(NBTTagCompound nbttagcompound) { public void c(NBTTagCompound nbttagcompound) {
this.id = nbttagcompound.d("id"); this.id = nbttagcompound.d("id");
this.count = nbttagcompound.c("Count"); this.count = nbttagcompound.c("Count");
this.damage = nbttagcompound.d("Damage"); this.damage = nbttagcompound.d("Damage");
@ -183,12 +193,16 @@ public final class ItemStack {
return this.id == itemstack.id && this.damage == itemstack.damage; return this.id == itemstack.id && this.damage == itemstack.damage;
} }
public String k() {
return Item.byId[this.id].a(this);
}
public static ItemStack b(ItemStack itemstack) { public static ItemStack b(ItemStack itemstack) {
return itemstack == null ? null : itemstack.cloneItemStack(); return itemstack == null ? null : itemstack.cloneItemStack();
} }
public String toString() { public String toString() {
return this.count + "x" + Item.byId[this.id].a() + "@" + this.damage; return this.count + "x" + Item.byId[this.id].b() + "@" + this.damage;
} }
public void a(World world, Entity entity, int i, boolean flag) { public void a(World world, Entity entity, int i, boolean flag) {
@ -199,12 +213,24 @@ public final class ItemStack {
Item.byId[this.id].a(this, world, entity, i, flag); Item.byId[this.id].a(this, world, entity, i, flag);
} }
public void b(World world, EntityHuman entityhuman) { public void c(World world, EntityHuman entityhuman) {
entityhuman.a(StatisticList.D[this.id], this.count); entityhuman.a(StatisticList.D[this.id], this.count);
Item.byId[this.id].c(this, world, entityhuman); Item.byId[this.id].d(this, world, entityhuman);
} }
public boolean c(ItemStack itemstack) { public boolean c(ItemStack itemstack) {
return this.id == itemstack.id && this.count == itemstack.count && this.damage == itemstack.damage; return this.id == itemstack.id && this.count == itemstack.count && this.damage == itemstack.damage;
} }
public int l() {
return this.getItem().c(this);
}
public EnumAnimation m() {
return this.getItem().b(this);
}
public void a(World world, EntityHuman entityhuman, int i) {
this.getItem().a(this, world, entityhuman, i);
}
} }

Datei anzeigen

@ -21,13 +21,13 @@ public class ItemWorldMap extends ItemWorldMapBase {
String s = "map_" + itemstack.getData(); String s = "map_" + itemstack.getData();
worldmap = new WorldMap(s); worldmap = new WorldMap(s);
worldmap.b = world.q().c(); worldmap.b = world.p().c();
worldmap.c = world.q().e(); worldmap.c = world.p().e();
worldmap.e = 3; worldmap.e = 3;
worldmap.map = (byte) world.worldProvider.dimension; worldmap.map = (byte) world.worldProvider.dimension;
worldmap.a(); worldmap.a();
world.a(s, (WorldMapBase) worldmap); world.a(s, (WorldMapBase) worldmap);
// CraftBukkit start // CraftBukkit start
MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView); MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
@ -72,7 +72,6 @@ public class ItemWorldMap extends ItemWorldMapBase {
byte b2 = 0; byte b2 = 0;
int[] aint = new int[256]; int[] aint = new int[256];
Chunk chunk = world.getChunkAtWorldCoords(i3, j3); Chunk chunk = world.getChunkAtWorldCoords(i3, j3);
if (chunk.isEmpty()) continue; // CraftBukkit
int k3 = i3 & 15; int k3 = i3 & 15;
int l3 = j3 & 15; int l3 = j3 & 15;
int i4 = 0; int i4 = 0;
@ -106,7 +105,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3); j5 = chunk.getTypeId(l4 + k3, k4 - 1, j4 + l3);
if (j5 == 0) { if (j5 == 0) {
flag1 = false; flag1 = false;
} else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.C == MaterialMapColor.b) { } else if (k4 > 0 && j5 > 0 && Block.byId[j5].material.D == MaterialMapColor.b) {
flag1 = false; flag1 = false;
} }
@ -164,7 +163,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
i5 = 0; i5 = 0;
if (j4 > 0) { if (j4 > 0) {
MaterialMapColor materialmapcolor = Block.byId[j4].material.C; MaterialMapColor materialmapcolor = Block.byId[j4].material.D;
if (materialmapcolor == MaterialMapColor.n) { if (materialmapcolor == MaterialMapColor.n) {
d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D; d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
@ -225,7 +224,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
} }
} }
public void c(ItemStack itemstack, World world, EntityHuman entityhuman) { public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
itemstack.b(world.b("map")); itemstack.b(world.b("map"));
String s = "map_" + itemstack.getData(); String s = "map_" + itemstack.getData();
WorldMap worldmap = new WorldMap(s); WorldMap worldmap = new WorldMap(s);
@ -234,11 +233,11 @@ public class ItemWorldMap extends ItemWorldMapBase {
worldmap.b = MathHelper.floor(entityhuman.locX); worldmap.b = MathHelper.floor(entityhuman.locX);
worldmap.c = MathHelper.floor(entityhuman.locZ); worldmap.c = MathHelper.floor(entityhuman.locZ);
worldmap.e = 3; worldmap.e = 3;
worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit worldmap.map = (byte) world.worldProvider.dimension;
worldmap.a(); worldmap.a();
} }
public Packet b(ItemStack itemstack, World world, EntityHuman entityhuman) { public Packet c(ItemStack itemstack, World world, EntityHuman entityhuman) {
byte[] abyte = this.a(itemstack, world).a(itemstack, world, entityhuman); byte[] abyte = this.a(itemstack, world).a(itemstack, world, entityhuman);
return abyte == null ? null : new Packet131((short) Item.MAP.id, (short) itemstack.getData(), abyte); return abyte == null ? null : new Packet131((short) Item.MAP.id, (short) itemstack.getData(), abyte);

Datei anzeigen

@ -46,13 +46,14 @@ public class MinecraftServer implements Runnable, ICommandListener {
int ticks = 0; int ticks = 0;
public String i; public String i;
public int j; public int j;
private List r = new ArrayList(); private List s = new ArrayList();
private List s = Collections.synchronizedList(new ArrayList()); private List t = Collections.synchronizedList(new ArrayList());
// public EntityTracker[] tracker = new EntityTracker[2]; // CraftBukkit - removed! // public EntityTracker[] tracker = new EntityTracker[2]; // CraftBukkit - removed!
public boolean onlineMode; public boolean onlineMode;
public boolean spawnAnimals; public boolean spawnAnimals;
public boolean pvpMode; public boolean pvpMode;
public boolean allowFlight; public boolean allowFlight;
public String p;
// CraftBukkit start // CraftBukkit start
public List<WorldServer> worlds = new ArrayList<WorldServer>(); public List<WorldServer> worlds = new ArrayList<WorldServer>();
@ -90,7 +91,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true)); System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end // CraftBukkit end
log.info("Starting minecraft server version Beta 1.7.3"); log.info("Starting minecraft server version Beta 1.8");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("**** NOT ENOUGH RAM!"); log.warning("**** NOT ENOUGH RAM!");
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@ -104,6 +105,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true); this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
this.pvpMode = this.propertyManager.getBoolean("pvp", true); this.pvpMode = this.propertyManager.getBoolean("pvp", true);
this.allowFlight = this.propertyManager.getBoolean("allow-flight", false); this.allowFlight = this.propertyManager.getBoolean("allow-flight", false);
this.p = this.propertyManager.getString("motd", "A Minecraft Server");
this.p.replace('\u00a7', '$');
InetAddress inetaddress = null; InetAddress inetaddress = null;
if (s.length() > 0) { if (s.length() > 0) {
@ -168,17 +171,24 @@ public class MinecraftServer implements Runnable, ICommandListener {
convertable.convert(s, new ConvertProgressUpdater(this)); convertable.convert(s, new ConvertProgressUpdater(this));
} }
// CraftBukkit start // CraftBukkit - removed world array
for (int j = 0; j < (this.propertyManager.getBoolean("allow-nether", true) ? 2 : 1); ++j) { int j = this.propertyManager.getInt("gamemode", 0);
j = WorldSettings.a(j);
log.info("Default game type: " + j);
// CraftBukkit start (+ removed worldsettings and servernbtmanager)
for (int k = 0; k < (this.propertyManager.getBoolean("allow-nether", true) ? 2 : 1); ++k) {
WorldServer world; WorldServer world;
int dimension = j == 0 ? 0 : -1; int dimension = k == 0 ? 0 : -1;
String worldType = Environment.getEnvironment(dimension).toString().toLowerCase(); String worldType = Environment.getEnvironment(dimension).toString().toLowerCase();
String name = (dimension == 0) ? s : s + "_" + worldType; String name = (dimension == 0) ? s : s + "_" + worldType;
ChunkGenerator gen = this.server.getGenerator(name); ChunkGenerator gen = this.server.getGenerator(name);
WorldSettings settings = new WorldSettings(i, j, true);
if (j == 0) { if (k == 0) {
world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, dimension, i, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, dimension, settings, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
} else { } else {
String dim = "DIM-1"; String dim = "DIM-1";
@ -208,7 +218,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
} }
world = new SecondaryWorldServer(this, new ServerNBTManager(new File("."), name, true), name, dimension, i, this.worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit world = new SecondaryWorldServer(this, new ServerNBTManager(new File("."), name, true), name, dimension, settings, this.worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
} }
if (gen != null) { if (gen != null) {
@ -219,8 +229,9 @@ public class MinecraftServer implements Runnable, ICommandListener {
world.tracker = new EntityTracker(this, dimension); world.tracker = new EntityTracker(this, dimension);
world.addIWorldAccess(new WorldManager(this, world)); world.addIWorldAccess(new WorldManager(this, world));
world.spawnMonsters = this.propertyManager.getBoolean("spawn-monsters", true) ? 1 : 0; world.spawnMonsters = this.propertyManager.getInt("difficulty", 1);
world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals); world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
world.p().d(j);
this.worlds.add(world); this.worlds.add(world);
this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0])); this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0]));
} }
@ -256,7 +267,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + i1 >> 4, chunkcoordinates.z + j1 >> 4); worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + i1 >> 4, chunkcoordinates.z + j1 >> 4);
while (worldserver.doLighting() && this.isRunning) { while (worldserver.v() && this.isRunning) {
; ;
} }
} }
@ -442,7 +453,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
worldserver.doTick(); worldserver.doTick();
while (worldserver.doLighting()) { while (worldserver.v()) {
; ;
} }
@ -459,8 +470,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
// CraftBukkit end // CraftBukkit end
for (j = 0; j < this.r.size(); ++j) { for (j = 0; j < this.s.size(); ++j) {
((IUpdatePlayerListBox) this.r.get(j)).a(); ((IUpdatePlayerListBox) this.s.get(j)).a();
} }
try { try {
@ -471,12 +482,12 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
public void issueCommand(String s, ICommandListener icommandlistener) { public void issueCommand(String s, ICommandListener icommandlistener) {
this.s.add(new ServerCommand(s, icommandlistener)); this.t.add(new ServerCommand(s, icommandlistener));
} }
public void b() { public void b() {
while (this.s.size() > 0) { while (this.t.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.s.remove(0); ServerCommand servercommand = (ServerCommand) this.t.remove(0);
// CraftBukkit start - ServerCommand for preprocessing // CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command); ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
@ -490,7 +501,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
public void a(IUpdatePlayerListBox iupdateplayerlistbox) { public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
this.r.add(iupdateplayerlistbox); this.s.add(iupdateplayerlistbox);
} }
public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[]) public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[])

Datei anzeigen

@ -1,6 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import java.net.Socket; import java.net.Socket;
import java.util.Iterator;
import java.util.Random; import java.util.Random;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -63,8 +64,8 @@ public class NetLoginHandler extends NetHandler {
public void a(Packet1Login packet1login) { public void a(Packet1Login packet1login) {
this.g = packet1login.name; this.g = packet1login.name;
if (packet1login.a != 14) { if (packet1login.a != 17) {
if (packet1login.a > 14) { if (packet1login.a > 17) {
this.disconnect("Outdated server!"); this.disconnect("Outdated server!");
} else { } else {
this.disconnect("Outdated client!"); this.disconnect("Outdated client!");
@ -85,12 +86,24 @@ public class NetLoginHandler extends NetHandler {
this.server.serverConfigurationManager.b(entityplayer); this.server.serverConfigurationManager.b(entityplayer);
// entityplayer.a((World) this.server.a(entityplayer.dimension)); // CraftBukkit - set by Entity // entityplayer.a((World) this.server.a(entityplayer.dimension)); // CraftBukkit - set by Entity
// CraftBukkit - add world and location to 'logged in' message. // CraftBukkit - add world and location to 'logged in' message.
entityplayer.itemInWorldManager.a((WorldServer) entityplayer.world);
a.info(this.b() + " logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.name + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); a.info(this.b() + " logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.name + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit
ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
entityplayer.itemInWorldManager.b(worldserver.p().n());
NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer); NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer);
netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, worldserver.getSeed(), (byte) worldserver.worldProvider.dimension)); int i = entityplayer.id;
long j = worldserver.getSeed();
int k = entityplayer.itemInWorldManager.a();
byte b0 = (byte) worldserver.worldProvider.dimension;
byte b1 = (byte) worldserver.spawnMonsters;
worldserver.getClass();
Packet1Login packet1login1 = new Packet1Login("", i, j, k, b0, b1, (byte) -128, (byte) this.server.serverConfigurationManager.h());
netserverhandler.sendPacket(packet1login1);
netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z)); netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
this.server.serverConfigurationManager.a(entityplayer, worldserver); this.server.serverConfigurationManager.a(entityplayer, worldserver);
// this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event // this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
@ -98,6 +111,14 @@ public class NetLoginHandler extends NetHandler {
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.server.networkListenThread.a(netserverhandler); this.server.networkListenThread.a(netserverhandler);
netserverhandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // CraftBukkit - add support for player specific time netserverhandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // CraftBukkit - add support for player specific time
Iterator iterator = entityplayer.ak().iterator();
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
netserverhandler.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect));
}
entityplayer.syncInventory(); entityplayer.syncInventory();
} }
@ -109,6 +130,19 @@ public class NetLoginHandler extends NetHandler {
this.c = true; this.c = true;
} }
public void a(Packet254GetInfo packet254getinfo) {
try {
String s = this.server.p + "\u00A7" + this.server.serverConfigurationManager.g() + "\u00A7" + this.server.serverConfigurationManager.h();
this.networkManager.queue(new Packet255KickDisconnect(s));
this.networkManager.d();
this.server.networkListenThread.a(this.networkManager.f());
this.c = true;
} catch (Exception exception) {
exception.printStackTrace();
}
}
public void a(Packet packet) { public void a(Packet packet) {
this.disconnect("Protocol error"); this.disconnect("Protocol error");
} }

Datei anzeigen

@ -1,8 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.Random;
import java.util.Map;
import java.util.logging.Logger; import java.util.logging.Logger;
// CraftBukkit start // CraftBukkit start
@ -41,13 +40,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public EntityPlayer player; // CraftBukkit - private -> public public EntityPlayer player; // CraftBukkit - private -> public
private int f; private int f;
private int g; private int g;
private int h; private boolean h;
private boolean i; private int i;
private long j;
private static Random k = new Random();
private long l;
private double x; private double x;
private double y; private double y;
private double z; private double z;
private boolean checkMovement = true; private boolean checkMovement = true;
private Map n = new HashMap(); private EntityList q = new EntityList();
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver; this.minecraftServer = minecraftserver;
@ -85,10 +87,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end // CraftBukkit end
public void a() { public void a() {
this.i = false; this.h = false;
++this.f;
this.networkManager.b(); this.networkManager.b();
if (this.f - this.g > 20) { if ((long) this.f - this.l > 20L) {
this.sendPacket(new Packet0KeepAlive()); this.l = (long) this.f;
this.j = System.nanoTime() / 1000000L;
this.i = k.nextInt();
this.sendPacket(new Packet0KeepAlive(this.i));
} }
} }
@ -107,7 +113,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
s = event.getReason(); s = event.getReason();
// CraftBukkit end // CraftBukkit end
this.player.B(); this.player.A();
this.sendPacket(new Packet255KickDisconnect(s)); this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d(); this.networkManager.d();
@ -129,7 +135,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet10Flying packet10flying) { public void a(Packet10Flying packet10flying) {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
this.i = true; this.h = true;
double d0; double d0;
if (!this.checkMovement) { if (!this.checkMovement) {
@ -214,7 +220,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
float f = this.player.yaw; float f = this.player.yaw;
float f1 = this.player.pitch; float f1 = this.player.pitch;
this.player.vehicle.f(); this.player.vehicle.g_();
d1 = this.player.locX; d1 = this.player.locX;
d2 = this.player.locY; d2 = this.player.locY;
d3 = this.player.locZ; d3 = this.player.locZ;
@ -232,7 +238,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
this.player.onGround = packet10flying.g; this.player.onGround = packet10flying.g;
this.player.a(true); this.player.b(true);
this.player.move(d5, 0.0D, d4); this.player.move(d5, 0.0D, d4);
this.player.setLocation(d1, d2, d3, f, f1); this.player.setLocation(d1, d2, d3, f, f1);
this.player.motX = d5; this.player.motX = d5;
@ -242,7 +248,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
if (this.player.vehicle != null) { if (this.player.vehicle != null) {
this.player.vehicle.f(); this.player.vehicle.g_();
} }
this.minecraftServer.serverConfigurationManager.d(this.player); this.minecraftServer.serverConfigurationManager.d(this.player);
@ -254,7 +260,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
if (this.player.isSleeping()) { if (this.player.isSleeping()) {
this.player.a(true); this.player.b(true);
this.player.setLocation(this.x, this.y, this.z, this.player.yaw, this.player.pitch); this.player.setLocation(this.x, this.y, this.z, this.player.yaw, this.player.pitch);
worldserver.playerJoinedWorld(this.player); worldserver.playerJoinedWorld(this.player);
return; return;
@ -296,8 +302,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
f3 = packet10flying.pitch; f3 = packet10flying.pitch;
} }
this.player.a(true); this.player.b(true);
this.player.br = 0.0F; this.player.bH = 0.0F;
this.player.setLocation(this.x, this.y, this.z, f2, f3); this.player.setLocation(this.x, this.y, this.z, f2, f3);
if (!this.checkMovement) { if (!this.checkMovement) {
return; return;
@ -308,7 +314,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d7 = d3 - this.player.locZ; double d7 = d3 - this.player.locZ;
double d8 = d4 * d4 + d6 * d6 + d7 * d7; double d8 = d4 * d4 + d6 * d6 + d7 * d7;
if (d8 > 200.0D && this.checkMovement) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports if (d8 > 100.0D && this.checkMovement) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
a.warning(this.player.name + " moved too quickly!"); a.warning(this.player.name + " moved too quickly!");
this.disconnect("You moved too quickly :( (Hacking?)"); this.disconnect("You moved too quickly :( (Hacking?)");
return; return;
@ -317,7 +323,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
float f4 = 0.0625F; float f4 = 0.0625F;
boolean flag = worldserver.getEntities(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0; boolean flag = worldserver.getEntities(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
if (this.player.onGround && !packet10flying.g && d6 > 0.0D) {
this.player.b(0.2F);
}
this.player.move(d4, d6, d7); this.player.move(d4, d6, d7);
this.player.onGround = packet10flying.g;
this.player.a(d4, d6, d7);
d4 = d1 - this.player.locX; d4 = d1 - this.player.locX;
d6 = d2 - this.player.locY; d6 = d2 - this.player.locY;
if (d6 > -0.5D || d6 < 0.5D) { if (d6 > -0.5D || d6 < 0.5D) {
@ -328,7 +340,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
d8 = d4 * d4 + d6 * d6 + d7 * d7; d8 = d4 * d4 + d6 * d6 + d7 * d7;
boolean flag1 = false; boolean flag1 = false;
if (d8 > 0.0625D && !this.player.isSleeping()) { if (d8 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.b()) {
flag1 = true; flag1 = true;
a.warning(this.player.name + " moved wrongly!"); a.warning(this.player.name + " moved wrongly!");
System.out.println("Got position " + d1 + ", " + d2 + ", " + d3); System.out.println("Got position " + d1 + ", " + d2 + ", " + d3);
@ -345,17 +357,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().b((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D); AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().b((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D);
if (!this.minecraftServer.allowFlight && !worldserver.b(axisalignedbb)) { if (!this.minecraftServer.allowFlight && !this.player.itemInWorldManager.b() && !worldserver.b(axisalignedbb)) {
if (d6 >= -0.03125D) { if (d6 >= -0.03125D) {
++this.h; ++this.g;
if (this.h > 80) { if (this.g > 80) {
a.warning(this.player.name + " was kicked for floating too long!"); a.warning(this.player.name + " was kicked for floating too long!");
this.disconnect("Flying is not enabled on this server"); this.disconnect("Flying is not enabled on this server");
return; return;
} }
} }
} else { } else {
this.h = 0; this.g = 0;
} }
this.player.onGround = packet10flying.g; this.player.onGround = packet10flying.g;
@ -419,6 +431,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
if (packet14blockdig.e == 4) { if (packet14blockdig.e == 4) {
this.player.J();
} else if (packet14blockdig.e == 5) {
// CraftBukkit start // CraftBukkit start
// If the ticks aren't the same then the count starts from 0 and we update the lastDropTick. // If the ticks aren't the same then the count starts from 0 and we update the lastDropTick.
if (this.lastDropTick != MinecraftServer.currentTick) { if (this.lastDropTick != MinecraftServer.currentTick) {
@ -433,7 +447,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
} }
// CraftBukkit end // CraftBukkit end
this.player.F(); this.player.E();
} else { } else {
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
boolean flag1 = false; boolean flag1 = false;
@ -446,6 +460,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
flag1 = true; flag1 = true;
} }
if (this.player.itemInWorldManager.b()) {
flag1 = false;
}
int i = packet14blockdig.a; int i = packet14blockdig.a;
int j = packet14blockdig.b; int j = packet14blockdig.b;
int k = packet14blockdig.c; int k = packet14blockdig.c;
@ -462,8 +480,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
int l = (int) MathHelper.abs((float) (i - chunkcoordinates.x)); int l = MathHelper.a(i - chunkcoordinates.x);
int i1 = (int) MathHelper.abs((float) (k - chunkcoordinates.z)); int i1 = MathHelper.a(k - chunkcoordinates.z);
if (l > i1) { if (l > i1) {
i1 = l; i1 = l;
@ -474,7 +492,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (i1 < this.server.getSpawnRadius() && !flag) { if (i1 < this.server.getSpawnRadius() && !flag) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
} else { } else {
// CraftBukkit - add face argument
this.player.itemInWorldManager.dig(i, j, k, packet14blockdig.face); this.player.itemInWorldManager.dig(i, j, k, packet14blockdig.face);
} }
} else if (packet14blockdig.e == 2) { } else if (packet14blockdig.e == 2) {
@ -554,8 +571,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int k = packet15place.c; int k = packet15place.c;
int l = packet15place.face; int l = packet15place.face;
ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
int i1 = (int) MathHelper.abs((float) (i - chunkcoordinates.x)); int i1 = MathHelper.a(i - chunkcoordinates.x);
int j1 = (int) MathHelper.abs((float) (k - chunkcoordinates.z)); int j1 = MathHelper.a(k - chunkcoordinates.z);
if (i1 > j1) { if (i1 > j1) {
j1 = i1; j1 = i1;
@ -604,17 +621,20 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
itemstack = this.player.inventory.getItemInHand(); itemstack = this.player.inventory.getItemInHand();
if (itemstack != null && itemstack.count == 0) { if (itemstack != null && itemstack.count == 0) {
this.player.inventory.items[this.player.inventory.itemInHandIndex] = null; this.player.inventory.items[this.player.inventory.itemInHandIndex] = null;
itemstack = null;
} }
this.player.h = true; if (itemstack == null || itemstack.l() == 0) {
this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]); this.player.h = true;
Slot slot = this.player.activeContainer.a(this.player.inventory, this.player.inventory.itemInHandIndex); this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]);
Slot slot = this.player.activeContainer.a(this.player.inventory, this.player.inventory.itemInHandIndex);
this.player.activeContainer.a(); this.player.activeContainer.a();
this.player.h = false; this.player.h = false;
// CraftBukkit // CraftBukkit | TODO CHECK IF NEEDED -- new if structure might not need 'always'. Kept it in for now, but may be able to remove in future
if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) { if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.a, this.player.inventory.getItemInHand())); this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.b, this.player.inventory.getItemInHand()));
}
} }
worldserver.weirdIsOpCache = false; worldserver.weirdIsOpCache = false;
@ -663,7 +683,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet16BlockItemSwitch packet16blockitemswitch) { public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex <= InventoryPlayer.e()) { if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex <= InventoryPlayer.g()) {
// CraftBukkit start // CraftBukkit start
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex); PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
@ -749,7 +769,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
a.info(s); a.info(s);
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s)); this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s));
} else if (s.toLowerCase().startsWith("/kill")) { } else if (s.toLowerCase().startsWith("/kill")) {
this.player.damageEntity(this.player, 1000); // CraftBukkit - replace null entity with player entity; TODO: decide if we want damage with a null source to fire an event. this.player.damageEntity(DamageSource.j, 1000);
} else if (s.toLowerCase().startsWith("/tell ")) { } else if (s.toLowerCase().startsWith("/tell ")) {
String[] astring = s.split(" "); String[] astring = s.split(" ");
@ -811,7 +831,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (event.isCancelled()) return; if (event.isCancelled()) return;
// CraftBukkit end // CraftBukkit end
this.player.w(); this.player.v();
} }
} }
@ -833,6 +853,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.player.setSneak(true); this.player.setSneak(true);
} else if (packet19entityaction.animation == 2) { } else if (packet19entityaction.animation == 2) {
this.player.setSneak(false); this.player.setSneak(false);
} else if (packet19entityaction.animation == 4) {
this.player.g(true);
} else if (packet19entityaction.animation == 5) {
this.player.g(false);
} else if (packet19entityaction.animation == 3) { } else if (packet19entityaction.animation == 3) {
this.player.a(false, true, true); this.player.a(false, true, true);
this.checkMovement = false; this.checkMovement = false;
@ -860,9 +884,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = worldserver.getEntity(packet7useentity.target); Entity entity = worldserver.getEntity(packet7useentity.target);
ItemStack itemInHand = this.player.inventory.getItemInHand();
if (entity != null && this.player.e(entity) && this.player.g(entity) < 36.0D) { if (entity != null && this.player.f(entity) && this.player.h(entity) < 36.0D) {
ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit
if (packet7useentity.c == 0) { if (packet7useentity.c == 0) {
// CraftBukkit start // CraftBukkit start
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity()); PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity());
@ -900,7 +924,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet101CloseWindow packet101closewindow) { public void a(Packet101CloseWindow packet101closewindow) {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
this.player.A(); this.player.z();
} }
public void a(Packet102WindowClick packet102windowclick) { public void a(Packet102WindowClick packet102windowclick) {
@ -913,10 +937,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)); this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
this.player.h = true; this.player.h = true;
this.player.activeContainer.a(); this.player.activeContainer.a();
this.player.z(); this.player.y();
this.player.h = false; this.player.h = false;
} else { } else {
this.n.put(Integer.valueOf(this.player.activeContainer.windowId), Short.valueOf(packet102windowclick.d)); this.q.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false)); this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
this.player.activeContainer.a(this.player, false); this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
@ -930,10 +954,29 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
} }
public void a(Packet107SetCreativeSlot packet107setcreativeslot) {
if (this.player.itemInWorldManager.b()) {
boolean flag = packet107setcreativeslot.a >= 36 && packet107setcreativeslot.a < 36 + InventoryPlayer.g();
boolean flag1 = packet107setcreativeslot.b >= -1 && packet107setcreativeslot.b < Item.byId.length && (packet107setcreativeslot.b < 0 || Item.byId[packet107setcreativeslot.b] != null);
boolean flag2 = packet107setcreativeslot.d >= 0 && packet107setcreativeslot.c >= 0 && packet107setcreativeslot.c <= 64;
if (flag && flag1 && flag2) {
if (packet107setcreativeslot.b <= 0) {
this.player.defaultContainer.a(packet107setcreativeslot.a, (ItemStack) null);
} else {
this.player.defaultContainer.a(packet107setcreativeslot.a, new ItemStack(packet107setcreativeslot.b, packet107setcreativeslot.c, packet107setcreativeslot.d));
}
this.player.defaultContainer.a(this.player, true);
} else if (!flag && flag1 && flag2 && packet107setcreativeslot.a == -1 && packet107setcreativeslot.b > 0) {
this.player.b(new ItemStack(packet107setcreativeslot.b, packet107setcreativeslot.c, packet107setcreativeslot.d));
}
}
}
public void a(Packet106Transaction packet106transaction) { public void a(Packet106Transaction packet106transaction) {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
Short oshort = (Short) this.q.a(this.player.activeContainer.windowId);
Short oshort = (Short) this.n.get(Integer.valueOf(this.player.activeContainer.windowId));
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) { if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a(this.player, true); this.player.activeContainer.a(this.player, true);
@ -996,7 +1039,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
for (int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
tileentitysign1.lines[l] = event.getLine(l); tileentitysign1.lines[l] = event.getLine(l);
} }
tileentitysign1.a(false); tileentitysign1.isEditable = true;
} }
// CraftBukkit end // CraftBukkit end
@ -1006,6 +1049,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
} }
public void a(Packet0KeepAlive packet0keepalive) {
if (packet0keepalive.a == this.i) {
int i = (int) (System.nanoTime() / 1000000L - this.x);
this.player.i = (this.player.i * 3 + i) / 4;
}
}
public boolean c() { public boolean c() {
return true; return true;
} }

Datei anzeigen

@ -88,7 +88,7 @@ public class NetworkManager {
} }
} }
private boolean f() { private boolean g() {
boolean flag = false; boolean flag = false;
try { try {
@ -142,7 +142,7 @@ public class NetworkManager {
this.r.interrupt(); this.r.interrupt();
} }
private boolean g() { private boolean h() {
boolean flag = false; boolean flag = false;
try { try {
@ -218,7 +218,7 @@ public class NetworkManager {
this.w = 0; this.w = 0;
} }
int i = 100; int i = 1000;
while (!this.m.isEmpty() && i-- >= 0) { while (!this.m.isEmpty() && i-- >= 0) {
Packet packet = (Packet) this.m.remove(0); Packet packet = (Packet) this.m.remove(0);
@ -247,6 +247,10 @@ public class NetworkManager {
return this.lowPriorityQueue.size(); return this.lowPriorityQueue.size();
} }
public Socket f() {
return this.socket;
}
static boolean a(NetworkManager networkmanager) { static boolean a(NetworkManager networkmanager) {
return networkmanager.l; return networkmanager.l;
} }
@ -256,11 +260,11 @@ public class NetworkManager {
} }
static boolean c(NetworkManager networkmanager) { static boolean c(NetworkManager networkmanager) {
return networkmanager.g(); return networkmanager.h();
} }
static boolean d(NetworkManager networkmanager) { static boolean d(NetworkManager networkmanager) {
return networkmanager.f(); return networkmanager.g();
} }
static DataOutputStream e(NetworkManager networkmanager) { static DataOutputStream e(NetworkManager networkmanager) {

Datei anzeigen

@ -11,24 +11,24 @@ import java.util.Set;
public abstract class Packet { public abstract class Packet {
private static Map a = new HashMap(); private static EntityList a = new EntityList();
private static Map b = new HashMap(); private static Map b = new HashMap();
private static Set c = new HashSet(); private static Set c = new HashSet();
private static Set d = new HashSet(); private static Set d = new HashSet();
public final long timestamp = System.currentTimeMillis(); public final long timestamp = System.currentTimeMillis();
public boolean k = false; public boolean k = false;
private static HashMap e; private static EntityList e;
private static int f; private static int f;
public Packet() {} public Packet() {}
static void a(int i, boolean flag, boolean flag1, Class oclass) { static void a(int i, boolean flag, boolean flag1, Class oclass) {
if (a.containsKey(Integer.valueOf(i))) { if (a.b(i)) {
throw new IllegalArgumentException("Duplicate packet id:" + i); throw new IllegalArgumentException("Duplicate packet id:" + i);
} else if (b.containsKey(oclass)) { } else if (b.containsKey(oclass)) {
throw new IllegalArgumentException("Duplicate packet class:" + oclass); throw new IllegalArgumentException("Duplicate packet class:" + oclass);
} else { } else {
a.put(Integer.valueOf(i), oclass); a.a(i, oclass);
b.put(oclass, Integer.valueOf(i)); b.put(oclass, Integer.valueOf(i));
if (flag) { if (flag) {
c.add(Integer.valueOf(i)); c.add(Integer.valueOf(i));
@ -42,7 +42,7 @@ public abstract class Packet {
public static Packet a(int i) { public static Packet a(int i) {
try { try {
Class oclass = (Class) a.get(Integer.valueOf(i)); Class oclass = (Class) a.a(i);
return oclass == null ? null : (Packet) oclass.newInstance(); return oclass == null ? null : (Packet) oclass.newInstance();
} catch (Exception exception) { } catch (Exception exception) {
@ -94,11 +94,11 @@ public abstract class Packet {
} }
// CraftBukkit end // CraftBukkit end
PacketCounter packetcounter = (PacketCounter) e.get(Integer.valueOf(i)); PacketCounter packetcounter = (PacketCounter) e.a(i);
if (packetcounter == null) { if (packetcounter == null) {
packetcounter = new PacketCounter((EmptyClass1) null); packetcounter = new PacketCounter((EmptyClass1) null);
e.put(Integer.valueOf(i), packetcounter); e.a(i, packetcounter);
} }
packetcounter.a(packet.a()); packetcounter.a(packet.a());
@ -180,6 +180,7 @@ public abstract class Packet {
a(23, true, false, Packet23VehicleSpawn.class); a(23, true, false, Packet23VehicleSpawn.class);
a(24, true, false, Packet24MobSpawn.class); a(24, true, false, Packet24MobSpawn.class);
a(25, true, false, Packet25EntityPainting.class); a(25, true, false, Packet25EntityPainting.class);
a(26, true, false, Packet26AddExpOrb.class);
a(27, false, false, Packet27.class); // CraftBukkit - true -> false; disabled unused packet. TODO -- check if needed a(27, false, false, Packet27.class); // CraftBukkit - true -> false; disabled unused packet. TODO -- check if needed
a(28, true, false, Packet28EntityVelocity.class); a(28, true, false, Packet28EntityVelocity.class);
a(29, true, false, Packet29DestroyEntity.class); a(29, true, false, Packet29DestroyEntity.class);
@ -191,6 +192,9 @@ public abstract class Packet {
a(38, true, false, Packet38EntityStatus.class); a(38, true, false, Packet38EntityStatus.class);
a(39, true, false, Packet39AttachEntity.class); a(39, true, false, Packet39AttachEntity.class);
a(40, true, false, Packet40EntityMetadata.class); a(40, true, false, Packet40EntityMetadata.class);
a(41, true, false, Packet41MobEffect.class);
a(42, true, false, Packet42RemoveMobEffect.class);
a(43, true, false, Packet43SetExperience.class);
a(50, true, false, Packet50PreChunk.class); a(50, true, false, Packet50PreChunk.class);
a(51, true, false, Packet51MapChunk.class); a(51, true, false, Packet51MapChunk.class);
a(52, true, false, Packet52MultiBlockChange.class); a(52, true, false, Packet52MultiBlockChange.class);
@ -207,11 +211,14 @@ public abstract class Packet {
a(104, true, false, Packet104WindowItems.class); a(104, true, false, Packet104WindowItems.class);
a(105, true, false, Packet105CraftProgressBar.class); a(105, true, false, Packet105CraftProgressBar.class);
a(106, true, true, Packet106Transaction.class); a(106, true, true, Packet106Transaction.class);
a(107, true, true, Packet107SetCreativeSlot.class);
a(130, true, true, Packet130UpdateSign.class); a(130, true, true, Packet130UpdateSign.class);
a(131, true, false, Packet131.class); a(131, true, false, Packet131.class);
a(200, true, false, Packet200Statistic.class); a(200, true, false, Packet200Statistic.class);
a(201, true, false, Packet201PlayerInfo.class);
a(254, false, true, Packet254GetInfo.class);
a(255, true, true, Packet255KickDisconnect.class); a(255, true, true, Packet255KickDisconnect.class);
e = new HashMap(); e = new EntityList();
f = 0; f = 0;
} }
} }

Datei anzeigen

@ -52,7 +52,7 @@ class PlayerInstance {
if (this.b.size() == 0) { if (this.b.size() == 0) {
long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32; long i = (long) this.chunkX + 2147483647L | (long) this.chunkZ + 2147483647L << 32;
PlayerManager.a(this.playerManager).b(i); PlayerManager.a(this.playerManager).d(i);
if (this.dirtyCount > 0) { if (this.dirtyCount > 0) {
PlayerManager.b(this.playerManager).remove(this); PlayerManager.b(this.playerManager).remove(this);
} }
@ -182,7 +182,7 @@ class PlayerInstance {
private void sendTileEntity(TileEntity tileentity) { private void sendTileEntity(TileEntity tileentity) {
if (tileentity != null) { if (tileentity != null) {
Packet packet = tileentity.f(); Packet packet = tileentity.l();
if (packet != null) { if (packet != null) {
this.sendAll(packet); this.sendAll(packet);

Datei anzeigen

@ -37,7 +37,9 @@ public class PortalTravelAgent {
for (int k1 = i1 - short1; k1 <= i1 + short1; ++k1) { for (int k1 = i1 - short1; k1 <= i1 + short1; ++k1) {
double d3 = (double) k1 + 0.5D - entity.locZ; double d3 = (double) k1 + 0.5D - entity.locZ;
for (int l1 = 127; l1 >= 0; --l1) { world.getClass();
for (int l1 = 128 - 1; l1 >= 0; --l1) {
if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) { if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) {
while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) { while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) {
--l1; --l1;
@ -119,9 +121,10 @@ public class PortalTravelAgent {
for (j2 = k - b0; j2 <= k + b0; ++j2) { for (j2 = k - b0; j2 <= k + b0; ++j2) {
d2 = (double) j2 + 0.5D - entity.locZ; d2 = (double) j2 + 0.5D - entity.locZ;
world.getClass();
label271: label274:
for (l2 = 127; l2 >= 0; --l2) { for (l2 = 128 - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) { if (world.isEmpty(i2, l2, j2)) {
while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2; --l2;
@ -143,7 +146,7 @@ public class PortalTravelAgent {
int l4 = j2 + (k3 - 1) * i3 - l3 * j3; int l4 = j2 + (k3 - 1) * i3 - l3 * j3;
if (j4 < 0 && !world.getMaterial(i4, k4, l4).isBuildable() || j4 >= 0 && !world.isEmpty(i4, k4, l4)) { if (j4 < 0 && !world.getMaterial(i4, k4, l4).isBuildable() || j4 >= 0 && !world.isEmpty(i4, k4, l4)) {
continue label271; continue label274;
} }
} }
} }
@ -170,11 +173,12 @@ public class PortalTravelAgent {
for (j2 = k - b0; j2 <= k + b0; ++j2) { for (j2 = k - b0; j2 <= k + b0; ++j2) {
d2 = (double) j2 + 0.5D - entity.locZ; d2 = (double) j2 + 0.5D - entity.locZ;
world.getClass();
label219: label222:
for (l2 = 127; l2 >= 0; --l2) { for (l2 = 128 - 1; l2 >= 0; --l2) {
if (world.isEmpty(i2, l2, j2)) { if (world.isEmpty(i2, l2, j2)) {
while (world.isEmpty(i2, l2 - 1, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) {
--l2; --l2;
} }
@ -188,7 +192,7 @@ public class PortalTravelAgent {
i4 = l2 + k3; i4 = l2 + k3;
k4 = j2 + (l3 - 1) * i3; k4 = j2 + (l3 - 1) * i3;
if (k3 < 0 && !world.getMaterial(j4, i4, k4).isBuildable() || k3 >= 0 && !world.isEmpty(j4, i4, k4)) { if (k3 < 0 && !world.getMaterial(j4, i4, k4).isBuildable() || k3 >= 0 && !world.isEmpty(j4, i4, k4)) {
continue label219; continue label222;
} }
} }
} }
@ -275,8 +279,10 @@ public class PortalTravelAgent {
i1 = 70; i1 = 70;
} }
if (i1 > 118) { world.getClass();
i1 = 118; if (i1 > 128 - 10) {
world.getClass();
i1 = 128 - 10;
} }
j5 = i1; j5 = i1;

Datei anzeigen

@ -4,8 +4,8 @@ import org.bukkit.generator.ChunkGenerator; // CraftBukkit
public class SecondaryWorldServer extends WorldServer { public class SecondaryWorldServer extends WorldServer {
// CraftBukkit start // CraftBukkit start
public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, long j, WorldServer worldserver, org.bukkit.World.Environment env, ChunkGenerator gen) { public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, WorldServer worldserver, org.bukkit.World.Environment env, ChunkGenerator gen) {
super(minecraftserver, idatamanager, s, i, j, env, gen); super(minecraftserver, idatamanager, s, i, worldsettings, env, gen);
// CraftBukkit end // CraftBukkit end
this.worldMaps = worldserver.worldMaps; this.worldMaps = worldserver.worldMaps;
} }

Datei anzeigen

@ -43,6 +43,7 @@ public class ServerConfigurationManager {
private File m; private File m;
public PlayerFileData playerFileData; // CraftBukkit - private - >public public PlayerFileData playerFileData; // CraftBukkit - private - >public
public boolean o; // Craftbukkit - private -> public public boolean o; // Craftbukkit - private -> public
private int p = 0;
// CraftBukkit start // CraftBukkit start
private CraftServer cserver; private CraftServer cserver;
@ -63,19 +64,19 @@ public class ServerConfigurationManager {
// CraftBukkit - removed playermanagers // CraftBukkit - removed playermanagers
this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20); this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
this.o = minecraftserver.propertyManager.getBoolean("white-list", false); this.o = minecraftserver.propertyManager.getBoolean("white-list", false);
this.g();
this.i(); this.i();
this.k(); this.k();
this.m(); this.m();
this.h(); this.o();
this.j(); this.j();
this.l(); this.l();
this.n(); this.n();
this.p();
} }
public void setPlayerFileData(WorldServer[] aworldserver) { public void setPlayerFileData(WorldServer[] aworldserver) {
if (this.playerFileData != null) return; // CraftBukkit if (this.playerFileData != null) return; // CraftBukkit
this.playerFileData = aworldserver[0].p().d(); this.playerFileData = aworldserver[0].o().d();
} }
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
@ -110,6 +111,7 @@ public class ServerConfigurationManager {
} }
public void c(EntityPlayer entityplayer) { public void c(EntityPlayer entityplayer) {
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, 1000));
this.players.add(entityplayer); this.players.add(entityplayer);
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
@ -132,6 +134,12 @@ public class ServerConfigurationManager {
worldserver.addEntity(entityplayer); worldserver.addEntity(entityplayer);
this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer); this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
entityplayer.netServerHandler.sendPacket(new Packet201PlayerInfo(entityplayer1.name, true, entityplayer1.i));
}
} }
public void d(EntityPlayer entityplayer) { public void d(EntityPlayer entityplayer) {
@ -150,6 +158,7 @@ public class ServerConfigurationManager {
this.server.getWorldServer(entityplayer.dimension).kill(entityplayer); this.server.getWorldServer(entityplayer.dimension).kill(entityplayer);
this.players.remove(entityplayer); this.players.remove(entityplayer);
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer); this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
this.sendAll(new Packet201PlayerInfo(entityplayer.name, false, 9999));
return playerQuitEvent.getQuitMessage(); // CraftBukkit return playerQuitEvent.getQuitMessage(); // CraftBukkit
} }
@ -224,7 +233,7 @@ public class ServerConfigurationManager {
isBedSpawn = true; isBedSpawn = true;
location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5); location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
} else { } else {
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0)); entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0, 0));
} }
} }
@ -257,8 +266,7 @@ public class ServerConfigurationManager {
// CraftBukkit start // CraftBukkit start
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId()); byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0))); entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte)entityplayer1.world.spawnMonsters, entityplayer1.world.getSeed(), 128, entityplayer1.itemInWorldManager.a()));
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension));
entityplayer1.spawnIn(worldserver); entityplayer1.spawnIn(worldserver);
entityplayer1.dead = false; entityplayer1.dead = false;
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch)); entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
@ -268,7 +276,7 @@ public class ServerConfigurationManager {
worldserver.addEntity(entityplayer1); worldserver.addEntity(entityplayer1);
this.players.add(entityplayer1); this.players.add(entityplayer1);
this.updateClient(entityplayer1); // CraftBukkit this.updateClient(entityplayer1); // CraftBukkit
entityplayer1.x(); entityplayer1.w();
return entityplayer1; return entityplayer1;
} }
@ -307,8 +315,18 @@ public class ServerConfigurationManager {
} }
public void b() { public void b() {
int i;
if (this.p-- <= 0) {
for (i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.i));
}
}
// CraftBukkit start // CraftBukkit start
for (int i = 0; i < this.server.worlds.size(); ++i) { for (i = 0; i < this.server.worlds.size(); ++i) {
this.server.worlds.get(i).manager.flush(); this.server.worlds.get(i).manager.flush();
} }
// CraftBukkit end // CraftBukkit end
@ -352,15 +370,15 @@ public class ServerConfigurationManager {
public void a(String s) { public void a(String s) {
this.banByName.add(s.toLowerCase()); this.banByName.add(s.toLowerCase());
this.h(); this.j();
} }
public void b(String s) { public void b(String s) {
this.banByName.remove(s.toLowerCase()); this.banByName.remove(s.toLowerCase());
this.h(); this.j();
} }
private void g() { private void i() {
try { try {
this.banByName.clear(); this.banByName.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j)); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.j));
@ -376,7 +394,7 @@ public class ServerConfigurationManager {
} }
} }
private void h() { private void j() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.j, false));
Iterator iterator = this.banByName.iterator(); Iterator iterator = this.banByName.iterator();
@ -395,15 +413,15 @@ public class ServerConfigurationManager {
public void c(String s) { public void c(String s) {
this.banByIP.add(s.toLowerCase()); this.banByIP.add(s.toLowerCase());
this.j(); this.l();
} }
public void d(String s) { public void d(String s) {
this.banByIP.remove(s.toLowerCase()); this.banByIP.remove(s.toLowerCase());
this.j(); this.l();
} }
private void i() { private void k() {
try { try {
this.banByIP.clear(); this.banByIP.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k)); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.k));
@ -419,7 +437,7 @@ public class ServerConfigurationManager {
} }
} }
private void j() { private void l() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.k, false));
Iterator iterator = this.banByIP.iterator(); Iterator iterator = this.banByIP.iterator();
@ -438,7 +456,7 @@ public class ServerConfigurationManager {
public void e(String s) { public void e(String s) {
this.h.add(s.toLowerCase()); this.h.add(s.toLowerCase());
this.l(); this.n();
// Craftbukkit start // Craftbukkit start
Player player = server.server.getPlayer(s); Player player = server.server.getPlayer(s);
@ -450,7 +468,7 @@ public class ServerConfigurationManager {
public void f(String s) { public void f(String s) {
this.h.remove(s.toLowerCase()); this.h.remove(s.toLowerCase());
this.l(); this.n();
// Craftbukkit start // Craftbukkit start
Player player = server.server.getPlayer(s); Player player = server.server.getPlayer(s);
@ -460,7 +478,7 @@ public class ServerConfigurationManager {
// Craftbukkit end // Craftbukkit end
} }
private void k() { private void m() {
try { try {
this.h.clear(); this.h.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l)); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.l));
@ -477,7 +495,7 @@ public class ServerConfigurationManager {
} }
} }
private void l() { private void n() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.l, false));
Iterator iterator = this.h.iterator(); Iterator iterator = this.h.iterator();
@ -495,7 +513,7 @@ public class ServerConfigurationManager {
} }
} }
private void m() { private void o() {
try { try {
this.i.clear(); this.i.clear();
BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m)); BufferedReader bufferedreader = new BufferedReader(new FileReader(this.m));
@ -511,7 +529,7 @@ public class ServerConfigurationManager {
} }
} }
private void n() { private void p() {
try { try {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.m, false));
Iterator iterator = this.i.iterator(); Iterator iterator = this.i.iterator();
@ -610,12 +628,12 @@ public class ServerConfigurationManager {
public void k(String s) { public void k(String s) {
this.i.add(s); this.i.add(s);
this.n(); this.p();
} }
public void l(String s) { public void l(String s) {
this.i.remove(s); this.i.remove(s);
this.n(); this.p();
} }
public Set e() { public Set e() {
@ -623,18 +641,26 @@ public class ServerConfigurationManager {
} }
public void f() { public void f() {
this.m(); this.o();
} }
public void a(EntityPlayer entityplayer, WorldServer worldserver) { public void a(EntityPlayer entityplayer, WorldServer worldserver) {
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime())); entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime()));
if (worldserver.v()) { if (worldserver.u()) {
entityplayer.netServerHandler.sendPacket(new Packet70Bed(1)); entityplayer.netServerHandler.sendPacket(new Packet70Bed(1, 0));
} }
} }
public void updateClient(EntityPlayer entityplayer) { public void updateClient(EntityPlayer entityplayer) {
entityplayer.updateInventory(entityplayer.defaultContainer); entityplayer.updateInventory(entityplayer.defaultContainer);
entityplayer.C(); entityplayer.B();
}
public int g() {
return this.players.size();
}
public int h() {
return this.maxPlayers;
} }
} }

Datei anzeigen

@ -3,16 +3,16 @@ package net.minecraft.server;
public class Slot { public class Slot {
public final int index; // CraftBukkit - private -> public public final int index; // CraftBukkit - private -> public
public final IInventory inventory; // CraftBukkit - private -> public public final IInventory inventory;
public int a;
public int b; public int b;
public int c; public int c;
public int d;
public Slot(IInventory iinventory, int i, int j, int k) { public Slot(IInventory iinventory, int i, int j, int k) {
this.inventory = iinventory; this.inventory = iinventory;
this.index = i; this.index = i;
this.b = j; this.c = j;
this.c = k; this.d = k;
} }
public void a(ItemStack itemstack) { public void a(ItemStack itemstack) {

Datei anzeigen

@ -1,8 +1,10 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Random;
import java.util.Set; import java.util.Set;
// CraftBukkit // CraftBukkit
@ -17,7 +19,10 @@ public final class SpawnerCreature {
protected static ChunkPosition a(World world, int i, int j) { protected static ChunkPosition a(World world, int i, int j) {
int k = i + world.random.nextInt(16); int k = i + world.random.nextInt(16);
int l = world.random.nextInt(128); Random random = world.random;
world.getClass();
int l = random.nextInt(128);
int i1 = j + world.random.nextInt(16); int i1 = j + world.random.nextInt(16);
return new ChunkPosition(k, l, i1); return new ChunkPosition(k, l, i1);
@ -58,58 +63,36 @@ public final class SpawnerCreature {
if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && world.a(enumcreaturetype.a()) <= enumcreaturetype.b() * b.size() / 256) { if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && world.a(enumcreaturetype.a()) <= enumcreaturetype.b() * b.size() / 256) {
Iterator iterator = b.iterator(); Iterator iterator = b.iterator();
label113: label91:
while (iterator.hasNext()) { while (iterator.hasNext()) {
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next(); ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
BiomeBase biomebase = world.getWorldChunkManager().a(chunkcoordintpair); BiomeBase biomebase = world.getWorldChunkManager().a(chunkcoordintpair);
List list = biomebase.a(enumcreaturetype); List list = biomebase.a(enumcreaturetype);
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
int k1 = 0; BiomeMeta biomemeta = (BiomeMeta) WeightedRandom.a(world.random, (Collection) list);
BiomeMeta biomemeta;
for (Iterator iterator1 = list.iterator(); iterator1.hasNext(); k1 += biomemeta.b) {
biomemeta = (BiomeMeta) iterator1.next();
}
int l1 = world.random.nextInt(k1);
biomemeta = (BiomeMeta) list.get(0);
Iterator iterator2 = list.iterator();
while (iterator2.hasNext()) {
BiomeMeta biomemeta1 = (BiomeMeta) iterator2.next();
l1 -= biomemeta1.b;
if (l1 < 0) {
biomemeta = biomemeta1;
break;
}
}
ChunkPosition chunkposition = a(world, chunkcoordintpair.x * 16, chunkcoordintpair.z * 16); ChunkPosition chunkposition = a(world, chunkcoordintpair.x * 16, chunkcoordintpair.z * 16);
int i2 = chunkposition.x; int k1 = chunkposition.x;
int j2 = chunkposition.y; int l1 = chunkposition.y;
int k2 = chunkposition.z; int i2 = chunkposition.z;
if (!world.e(i2, j2, k2) && world.getMaterial(i2, j2, k2) == enumcreaturetype.c()) { if (!world.e(k1, l1, i2) && world.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
int l2 = 0; int j2 = 0;
for (int i3 = 0; i3 < 3; ++i3) { for (int k2 = 0; k2 < 3; ++k2) {
int l2 = k1;
int i3 = l1;
int j3 = i2; int j3 = i2;
int k3 = j2;
int l3 = k2;
byte b1 = 6; byte b1 = 6;
for (int i4 = 0; i4 < 4; ++i4) { for (int k3 = 0; k3 < 4; ++k3) {
l2 += world.random.nextInt(b1) - world.random.nextInt(b1);
i3 += world.random.nextInt(1) - world.random.nextInt(1);
j3 += world.random.nextInt(b1) - world.random.nextInt(b1); j3 += world.random.nextInt(b1) - world.random.nextInt(b1);
k3 += world.random.nextInt(1) - world.random.nextInt(1); if (a(enumcreaturetype, world, l2, i3, j3)) {
l3 += world.random.nextInt(b1) - world.random.nextInt(b1); float f = (float) l2 + 0.5F;
if (a(enumcreaturetype, world, j3, k3, l3)) { float f1 = (float) i3;
float f = (float) j3 + 0.5F; float f2 = (float) j3 + 0.5F;
float f1 = (float) k3;
float f2 = (float) l3 + 0.5F;
if (world.a((double) f, (double) f1, (double) f2, 24.0D) == null) { if (world.a((double) f, (double) f1, (double) f2, 24.0D) == null) {
float f3 = f - (float) chunkcoordinates.x; float f3 = f - (float) chunkcoordinates.x;
@ -129,16 +112,16 @@ public final class SpawnerCreature {
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, world.random.nextFloat() * 360.0F, 0.0F); entityliving.setPositionRotation((double) f, (double) f1, (double) f2, world.random.nextFloat() * 360.0F, 0.0F);
if (entityliving.d()) { if (entityliving.d()) {
++l2; ++j2;
// CraftBukkit - added a reason for spawning this creature // CraftBukkit - added a reason for spawning this creature
world.addEntity(entityliving, SpawnReason.NATURAL); world.addEntity(entityliving, SpawnReason.NATURAL);
a(entityliving, world, f, f1, f2); a(entityliving, world, f, f1, f2);
if (l2 >= entityliving.l()) { if (j2 >= entityliving.m()) {
continue label113; continue label91;
} }
} }
i += l2; i += j2;
} }
} }
} }
@ -190,8 +173,12 @@ public final class SpawnerCreature {
if (l < 1) { if (l < 1) {
l = 1; l = 1;
} else if (l > 128) { } else {
l = 128; world.getClass();
if (l > 128) {
world.getClass();
l = 128;
}
} }
int i1 = world.random.nextInt(aclass.length); int i1 = world.random.nextInt(aclass.length);
@ -202,46 +189,54 @@ public final class SpawnerCreature {
; ;
} }
while (!a(EnumCreatureType.MONSTER, world, j, j1, k) && j1 < l + 16 && j1 < 128) { while (!a(EnumCreatureType.MONSTER, world, j, j1, k) && j1 < l + 16) {
world.getClass();
if (j1 >= 128) {
break;
}
++j1; ++j1;
} }
if (j1 < l + 16 && j1 < 128) { if (j1 < l + 16) {
float f = (float) j + 0.5F; world.getClass();
float f1 = (float) j1; if (j1 < 128) {
float f2 = (float) k + 0.5F; float f = (float) j + 0.5F;
float f1 = (float) j1;
float f2 = (float) k + 0.5F;
EntityLiving entityliving; EntityLiving entityliving;
try { try {
entityliving = (EntityLiving) aclass[i1].getConstructor(new Class[] { World.class}).newInstance(new Object[] { world}); entityliving = (EntityLiving) aclass[i1].getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
return flag; return flag;
} }
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, world.random.nextFloat() * 360.0F, 0.0F); entityliving.setPositionRotation((double) f, (double) f1, (double) f2, world.random.nextFloat() * 360.0F, 0.0F);
if (entityliving.d()) { if (entityliving.d()) {
PathEntity pathentity = pathfinder.a(entityliving, entityhuman, 32.0F); PathEntity pathentity = pathfinder.a(entityliving, entityhuman, 32.0F);
if (pathentity != null && pathentity.a > 1) { if (pathentity != null && pathentity.a > 1) {
PathPoint pathpoint = pathentity.c(); PathPoint pathpoint = pathentity.c();
if (Math.abs((double) pathpoint.a - entityhuman.locX) < 1.5D && Math.abs((double) pathpoint.c - entityhuman.locZ) < 1.5D && Math.abs((double) pathpoint.b - entityhuman.locY) < 1.5D) { if (Math.abs((double) pathpoint.a - entityhuman.locX) < 1.5D && Math.abs((double) pathpoint.c - entityhuman.locZ) < 1.5D && Math.abs((double) pathpoint.b - entityhuman.locY) < 1.5D) {
ChunkCoordinates chunkcoordinates = BlockBed.f(world, MathHelper.floor(entityhuman.locX), MathHelper.floor(entityhuman.locY), MathHelper.floor(entityhuman.locZ), 1); ChunkCoordinates chunkcoordinates = BlockBed.f(world, MathHelper.floor(entityhuman.locX), MathHelper.floor(entityhuman.locY), MathHelper.floor(entityhuman.locZ), 1);
if (chunkcoordinates == null) { if (chunkcoordinates == null) {
chunkcoordinates = new ChunkCoordinates(j, j1 + 1, k); chunkcoordinates = new ChunkCoordinates(j, j1 + 1, k);
}
entityliving.setPositionRotation((double) ((float) chunkcoordinates.x + 0.5F), (double) chunkcoordinates.y, (double) ((float) chunkcoordinates.z + 0.5F), 0.0F, 0.0F);
// CraftBukkit - added a reason for spawning this creature
world.addEntity(entityliving, SpawnReason.BED);
a(entityliving, world, (float) chunkcoordinates.x + 0.5F, (float) chunkcoordinates.y, (float) chunkcoordinates.z + 0.5F);
entityhuman.a(true, false, false);
entityliving.Z();
flag = true;
flag1 = true;
} }
entityliving.setPositionRotation((double) ((float) chunkcoordinates.x + 0.5F), (double) chunkcoordinates.y, (double) ((float) chunkcoordinates.z + 0.5F), 0.0F, 0.0F);
// CraftBukkit - added a reason for spawning this creature
world.addEntity(entityliving, SpawnReason.BED);
a(entityliving, world, (float) chunkcoordinates.x + 0.5F, (float) chunkcoordinates.y, (float) chunkcoordinates.z + 0.5F);
entityhuman.a(true, false, false);
entityliving.Q();
flag = true;
flag1 = true;
} }
} }
} }
@ -252,4 +247,55 @@ public final class SpawnerCreature {
return flag; return flag;
} }
}
public static void a(World world, BiomeBase biomebase, int i, int j, int k, int l, Random random) {
List list = biomebase.a(EnumCreatureType.CREATURE);
if (!list.isEmpty()) {
while (random.nextFloat() < biomebase.d()) {
BiomeMeta biomemeta = (BiomeMeta) WeightedRandom.a(world.random, (Collection) list);
int i1 = biomemeta.b + random.nextInt(1 + biomemeta.c - biomemeta.b);
int j1 = i + random.nextInt(k);
int k1 = j + random.nextInt(l);
int l1 = j1;
int i2 = k1;
for (int j2 = 0; j2 < i1; ++j2) {
boolean flag = false;
for (int k2 = 0; !flag && k2 < 4; ++k2) {
int l2 = world.f(j1, k1);
if (a(EnumCreatureType.CREATURE, world, j1, l2, k1)) {
float f = (float) j1 + 0.5F;
float f1 = (float) l2;
float f2 = (float) k1 + 0.5F;
EntityLiving entityliving;
try {
entityliving = (EntityLiving) biomemeta.a.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
} catch (Exception exception) {
exception.printStackTrace();
continue;
}
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F);
// CraftBukkit - added a reason for spawning this creature
world.addEntity(entityliving, SpawnReason.NATURAL);
world.addEntity(entityliving);
a(entityliving, world, f, f1, f2);
flag = true;
}
j1 += random.nextInt(5) - random.nextInt(5);
for (k1 += random.nextInt(5) - random.nextInt(5); j1 < i || j1 >= i + k || k1 < j || k1 >= j + k; k1 = i2 + random.nextInt(5) - random.nextInt(5)) {
j1 = l1 + random.nextInt(5) - random.nextInt(5);
}
}
}
}
}
}
}

Datei anzeigen

@ -30,7 +30,7 @@ class ThreadLoginVerifier extends Thread {
public void run() { public void run() {
try { try {
String s = NetLoginHandler.a(this.netLoginHandler); String s = NetLoginHandler.a(this.netLoginHandler);
URL url = new URL("http://www.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(this.loginPacket.name, "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8")); URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(this.loginPacket.name, "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream())); BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
String s1 = bufferedreader.readLine(); String s1 = bufferedreader.readLine();

Datei anzeigen

@ -3,6 +3,15 @@ package net.minecraft.server;
public class TileEntityChest extends TileEntity implements IInventory { public class TileEntityChest extends TileEntity implements IInventory {
private ItemStack[] items = new ItemStack[27]; // CraftBukkit private ItemStack[] items = new ItemStack[27]; // CraftBukkit
public boolean a = false;
public TileEntityChest b;
public TileEntityChest c;
public TileEntityChest d;
public TileEntityChest e;
public float f;
public float g;
public int h;
private int q;
// CraftBukkit start // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {
@ -67,7 +76,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
int j = nbttagcompound1.c("Slot") & 255; int j = nbttagcompound1.c("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = new ItemStack(nbttagcompound1); this.items[j] = ItemStack.a(nbttagcompound1);
} }
} }
} }
@ -81,7 +90,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
this.items[i].a(nbttagcompound1); this.items[i].b(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1);
} }
} }
@ -93,7 +102,131 @@ public class TileEntityChest extends TileEntity implements IInventory {
return 64; return 64;
} }
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D; return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
} }
public void g() {
super.g();
this.a = false;
}
public void h() {
if (!this.a) {
this.a = true;
this.b = null;
this.c = null;
this.d = null;
this.e = null;
if (this.world.getTypeId(this.x - 1, this.y, this.z) == Block.CHEST.id) {
this.d = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z);
}
if (this.world.getTypeId(this.x + 1, this.y, this.z) == Block.CHEST.id) {
this.c = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z);
}
if (this.world.getTypeId(this.x, this.y, this.z - 1) == Block.CHEST.id) {
this.b = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1);
}
if (this.world.getTypeId(this.x, this.y, this.z + 1) == Block.CHEST.id) {
this.e = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1);
}
if (this.b != null) {
this.b.g();
}
if (this.e != null) {
this.e.g();
}
if (this.c != null) {
this.c.g();
}
if (this.d != null) {
this.d.g();
}
}
}
public void h_() {
super.h_();
this.h();
if (++this.q % 20 * 4 == 0) {
this.world.playNote(this.x, this.y, this.z, 1, this.h);
}
this.g = this.f;
float f = 0.1F;
double d0;
double d1;
if (this.h > 0 && this.f == 0.0F && this.b == null && this.d == null) {
d0 = (double) this.x + 0.5D;
d1 = (double) this.z + 0.5D;
if (this.e != null) {
d1 += 0.5D;
}
if (this.c != null) {
d0 += 0.5D;
}
this.world.makeSound(d0, (double) this.y + 0.5D, d1, "random.door_open", 1.0F, this.world.random.nextFloat() * 0.1F + 0.9F);
}
if (this.h == 0 && this.f > 0.0F || this.h > 0 && this.f < 1.0F) {
if (this.h > 0) {
this.f += f;
} else {
this.f -= f;
}
if (this.f > 1.0F) {
this.f = 1.0F;
}
if (this.f < 0.0F) {
this.f = 0.0F;
if (this.b == null && this.d == null) {
d0 = (double) this.x + 0.5D;
d1 = (double) this.z + 0.5D;
if (this.e != null) {
d1 += 0.5D;
}
if (this.c != null) {
d0 += 0.5D;
}
this.world.makeSound(d0, (double) this.y + 0.5D, d1, "random.door_close", 1.0F, this.world.random.nextFloat() * 0.1F + 0.9F);
}
}
}
}
public void b(int i, int j) {
if (i == 1) {
this.h = j;
}
}
public void e() {
++this.h;
this.world.playNote(this.x, this.y, this.z, 1, this.h);
}
public void t_() {
--this.h;
this.world.playNote(this.x, this.y, this.z, 1, this.h);
}
public void i() {
this.g();
this.h();
super.i();
}
} }

Datei anzeigen

@ -97,7 +97,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
int j = nbttagcompound1.c("Slot") & 255; int j = nbttagcompound1.c("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = new ItemStack(nbttagcompound1); this.items[j] = ItemStack.a(nbttagcompound1);
} }
} }
} }
@ -111,7 +111,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
this.items[i].a(nbttagcompound1); this.items[i].b(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1);
} }
} }
@ -123,7 +123,11 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
return 64; return 64;
} }
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D; return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
} }
public void e() {}
public void t_() {}
} }

Datei anzeigen

@ -73,7 +73,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
byte b0 = nbttagcompound1.c("Slot"); byte b0 = nbttagcompound1.c("Slot");
if (b0 >= 0 && b0 < this.items.length) { if (b0 >= 0 && b0 < this.items.length) {
this.items[b0] = new ItemStack(nbttagcompound1); this.items[b0] = ItemStack.a(nbttagcompound1);
} }
} }
@ -93,7 +93,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.a("Slot", (byte) i);
this.items[i].a(nbttagcompound1); this.items[i].b(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.a((NBTBase) nbttagcompound1);
} }
} }
@ -109,7 +109,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
return this.burnTime > 0; return this.burnTime > 0;
} }
public void g_() { public void h_() {
boolean flag = this.burnTime > 0; boolean flag = this.burnTime > 0;
boolean flag1 = false; boolean flag1 = false;
@ -242,7 +242,11 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
} }
} }
public boolean a_(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D; return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
} }
public void e() {}
public void t_() {}
} }

Datei anzeigen

@ -21,7 +21,7 @@ public class TileEntityMobSpawner extends TileEntity {
return this.world.a((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, 16.0D) != null; return this.world.a((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, 16.0D) != null;
} }
public void g_() { public void h_() {
this.c = this.b; this.c = this.b;
if (this.a()) { if (this.a()) {
double d0 = (double) ((float) this.x + this.world.random.nextFloat()); double d0 = (double) ((float) this.x + this.world.random.nextFloat());
@ -86,14 +86,14 @@ public class TileEntityMobSpawner extends TileEntity {
this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D); this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
} }
entityliving.S(); entityliving.ab();
this.c(); this.c();
} }
} }
} }
} }
super.g_(); super.h_();
} }
} }

Datei anzeigen

@ -9,11 +9,11 @@ public class TileEntityPiston extends TileEntity {
private int a; private int a;
private int b; private int b;
private int c; private int c;
private boolean i; private boolean d;
private boolean j; private boolean e;
private float k; private float f;
private float l; private float g;
private static List m = new ArrayList(); private static List h = new ArrayList();
public TileEntityPiston() {} public TileEntityPiston() {}
@ -21,20 +21,20 @@ public class TileEntityPiston extends TileEntity {
this.a = i; this.a = i;
this.b = j; this.b = j;
this.c = k; this.c = k;
this.i = flag; this.d = flag;
this.j = flag1; this.e = flag1;
} }
public int a() { public int a() {
return this.a; return this.a;
} }
public int e() { public int j() {
return this.b; return this.b;
} }
public boolean c() { public boolean c() {
return this.i; return this.d;
} }
public int d() { public int d() {
@ -46,11 +46,11 @@ public class TileEntityPiston extends TileEntity {
f = 1.0F; f = 1.0F;
} }
return this.l + (this.k - this.l) * f; return this.g + (this.f - this.g) * f;
} }
private void a(float f, float f1) { private void a(float f, float f1) {
if (!this.i) { if (!this.d) {
--f; --f;
} else { } else {
f = 1.0F - f; f = 1.0F - f;
@ -62,8 +62,8 @@ public class TileEntityPiston extends TileEntity {
List list = this.world.b((Entity) null, axisalignedbb); List list = this.world.b((Entity) null, axisalignedbb);
if (!list.isEmpty()) { if (!list.isEmpty()) {
m.addAll(list); h.addAll(list);
Iterator iterator = m.iterator(); Iterator iterator = h.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -71,41 +71,41 @@ public class TileEntityPiston extends TileEntity {
entity.move((double) (f1 * (float) PistonBlockTextures.b[this.c]), (double) (f1 * (float) PistonBlockTextures.c[this.c]), (double) (f1 * (float) PistonBlockTextures.d[this.c])); entity.move((double) (f1 * (float) PistonBlockTextures.b[this.c]), (double) (f1 * (float) PistonBlockTextures.c[this.c]), (double) (f1 * (float) PistonBlockTextures.d[this.c]));
} }
m.clear(); h.clear();
} }
} }
} }
public void k() { public void e() {
if (this.l < 1.0F) { if (this.g < 1.0F) {
this.l = this.k = 1.0F; this.g = this.f = 1.0F;
this.world.o(this.x, this.y, this.z); this.world.n(this.x, this.y, this.z);
this.h(); this.i();
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) { if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b); this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
} }
} }
} }
public void g_() { public void h_() {
// CraftBukkit if (this.world == null) return; // CraftBukkit
if (this.world == null) return;
this.l = this.k; this.g = this.f;
if (this.l >= 1.0F) { if (this.g >= 1.0F) {
this.a(1.0F, 0.25F); this.a(1.0F, 0.25F);
this.world.o(this.x, this.y, this.z); this.world.n(this.x, this.y, this.z);
this.h(); this.i();
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) { if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b); this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
} }
} else { } else {
this.k += 0.5F; this.f += 0.5F;
if (this.k >= 1.0F) { if (this.f >= 1.0F) {
this.k = 1.0F; this.f = 1.0F;
} }
if (this.i) { if (this.d) {
this.a(this.k, this.k - this.l + 0.0625F); this.a(this.f, this.f - this.g + 0.0625F);
} }
} }
} }
@ -115,8 +115,8 @@ public class TileEntityPiston extends TileEntity {
this.a = nbttagcompound.e("blockId"); this.a = nbttagcompound.e("blockId");
this.b = nbttagcompound.e("blockData"); this.b = nbttagcompound.e("blockData");
this.c = nbttagcompound.e("facing"); this.c = nbttagcompound.e("facing");
this.l = this.k = nbttagcompound.g("progress"); this.g = this.f = nbttagcompound.g("progress");
this.i = nbttagcompound.m("extending"); this.d = nbttagcompound.m("extending");
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
@ -124,7 +124,7 @@ public class TileEntityPiston extends TileEntity {
nbttagcompound.a("blockId", this.a); nbttagcompound.a("blockId", this.a);
nbttagcompound.a("blockData", this.b); nbttagcompound.a("blockData", this.b);
nbttagcompound.a("facing", this.c); nbttagcompound.a("facing", this.c);
nbttagcompound.a("progress", this.l); nbttagcompound.a("progress", this.g);
nbttagcompound.a("extending", this.i); nbttagcompound.a("extending", this.d);
} }
} }

Datei anzeigen

@ -4,7 +4,7 @@ public class TileEntitySign extends TileEntity {
public String[] lines = new String[] { "", "", "", ""}; public String[] lines = new String[] { "", "", "", ""};
public int b = -1; public int b = -1;
private boolean isEditable = true; public boolean isEditable = true; // CraftBukkit - priv to public
public TileEntitySign() {} public TileEntitySign() {}
@ -28,7 +28,7 @@ public class TileEntitySign extends TileEntity {
} }
} }
public Packet f() { public Packet l() {
String[] astring = new String[4]; String[] astring = new String[4];
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
@ -47,8 +47,4 @@ public class TileEntitySign extends TileEntity {
public boolean a() { public boolean a() {
return this.isEditable; return this.isEditable;
} }
public void a(boolean flag) {
this.isEditable = flag;
}
} }

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

Datei anzeigen

@ -1,121 +0,0 @@
package net.minecraft.server;
import java.util.Random;
public class WorldChunkManager {
private NoiseGeneratorOctaves2 e;
private NoiseGeneratorOctaves2 f;
private NoiseGeneratorOctaves2 g;
public double[] temperature;
public double[] rain;
public double[] c;
public BiomeBase[] d;
protected WorldChunkManager() {}
public WorldChunkManager(World world) {
this.e = new NoiseGeneratorOctaves2(new Random(world.getSeed() * 9871L), 4);
this.f = new NoiseGeneratorOctaves2(new Random(world.getSeed() * 39811L), 4);
this.g = new NoiseGeneratorOctaves2(new Random(world.getSeed() * 543321L), 2);
}
public BiomeBase a(ChunkCoordIntPair chunkcoordintpair) {
return this.getBiome(chunkcoordintpair.x << 4, chunkcoordintpair.z << 4);
}
public BiomeBase getBiome(int i, int j) {
return this.getBiomeData(i, j, 1, 1)[0];
}
public BiomeBase[] getBiomeData(int i, int j, int k, int l) {
this.d = this.a(this.d, i, j, k, l);
return this.d;
}
public double[] a(double[] adouble, int i, int j, int k, int l) {
if (adouble == null || adouble.length < k * l) {
adouble = new double[k * l];
}
adouble = this.e.a(adouble, (double) i, (double) j, k, l, 0.02500000037252903D, 0.02500000037252903D, 0.25D);
this.c = this.g.a(this.c, (double) i, (double) j, k, l, 0.25D, 0.25D, 0.5882352941176471D);
int i1 = 0;
for (int j1 = 0; j1 < k; ++j1) {
for (int k1 = 0; k1 < l; ++k1) {
double d0 = this.c[i1] * 1.1D + 0.5D;
double d1 = 0.01D;
double d2 = 1.0D - d1;
double d3 = (adouble[i1] * 0.15D + 0.7D) * d2 + d0 * d1;
d3 = 1.0D - (1.0D - d3) * (1.0D - d3);
if (d3 < 0.0D) {
d3 = 0.0D;
}
if (d3 > 1.0D) {
d3 = 1.0D;
}
adouble[i1] = d3;
++i1;
}
}
return adouble;
}
public BiomeBase[] a(BiomeBase[] abiomebase, int i, int j, int k, int l) {
if (abiomebase == null || abiomebase.length < k * l) {
abiomebase = new BiomeBase[k * l];
}
this.temperature = this.e.a(this.temperature, (double) i, (double) j, k, k, 0.02500000037252903D, 0.02500000037252903D, 0.25D);
this.rain = this.f.a(this.rain, (double) i, (double) j, k, k, 0.05000000074505806D, 0.05000000074505806D, 0.3333333333333333D);
this.c = this.g.a(this.c, (double) i, (double) j, k, k, 0.25D, 0.25D, 0.5882352941176471D);
int i1 = 0;
for (int j1 = 0; j1 < k; ++j1) {
for (int k1 = 0; k1 < l; ++k1) {
double d0 = this.c[i1] * 1.1D + 0.5D;
double d1 = 0.01D;
double d2 = 1.0D - d1;
double d3 = (this.temperature[i1] * 0.15D + 0.7D) * d2 + d0 * d1;
d1 = 0.0020D;
d2 = 1.0D - d1;
double d4 = (this.rain[i1] * 0.15D + 0.5D) * d2 + d0 * d1;
d3 = 1.0D - (1.0D - d3) * (1.0D - d3);
if (d3 < 0.0D) {
d3 = 0.0D;
}
if (d4 < 0.0D) {
d4 = 0.0D;
}
if (d3 > 1.0D) {
d3 = 1.0D;
}
if (d4 > 1.0D) {
d4 = 1.0D;
}
this.temperature[i1] = d3;
this.rain[i1] = d4;
abiomebase[i1++] = BiomeBase.a(d3, d4);
}
}
return abiomebase;
}
// CraftBukkit start
public double getHumidity(int x, int z) {
return this.f.a(this.rain, (double)x, (double)z, 1, 1, 0.05000000074505806D, 0.05000000074505806D, 0.3333333333333333D)[0];
}
// CraftBukkit end
}

Datei anzeigen

@ -19,9 +19,18 @@ public class WorldData {
private int m; private int m;
private boolean n; private boolean n;
private int o; private int o;
private int p;
private boolean q;
public WorldData(NBTTagCompound nbttagcompound) { public WorldData(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.getLong("RandomSeed"); this.a = nbttagcompound.getLong("RandomSeed");
this.p = nbttagcompound.e("GameType");
if (nbttagcompound.hasKey("MapFeatures")) {
this.q = nbttagcompound.m("MapFeatures");
} else {
this.q = true;
}
this.b = nbttagcompound.e("SpawnX"); this.b = nbttagcompound.e("SpawnX");
this.c = nbttagcompound.e("SpawnY"); this.c = nbttagcompound.e("SpawnY");
this.d = nbttagcompound.e("SpawnZ"); this.d = nbttagcompound.e("SpawnZ");
@ -40,13 +49,17 @@ public class WorldData {
} }
} }
public WorldData(long i, String s) { public WorldData(WorldSettings worldsettings, String s) {
this.a = i; this.a = worldsettings.a();
this.p = worldsettings.b();
this.q = worldsettings.c();
this.name = s; this.name = s;
} }
public WorldData(WorldData worlddata) { public WorldData(WorldData worlddata) {
this.a = worlddata.a; this.a = worlddata.a;
this.p = worlddata.p;
this.q = worlddata.q;
this.b = worlddata.b; this.b = worlddata.b;
this.c = worlddata.c; this.c = worlddata.c;
this.d = worlddata.d; this.d = worlddata.d;
@ -90,6 +103,8 @@ public class WorldData {
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) { private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
nbttagcompound.setLong("RandomSeed", this.a); nbttagcompound.setLong("RandomSeed", this.a);
nbttagcompound.a("GameType", this.p);
nbttagcompound.a("MapFeatures", this.q);
nbttagcompound.a("SpawnX", this.b); nbttagcompound.a("SpawnX", this.b);
nbttagcompound.a("SpawnY", this.c); nbttagcompound.a("SpawnY", this.c);
nbttagcompound.a("SpawnZ", this.d); nbttagcompound.a("SpawnZ", this.d);
@ -192,4 +207,16 @@ public class WorldData {
public void setWeatherDuration(int i) { public void setWeatherDuration(int i) {
this.m = i; this.m = i;
} }
public int n() {
return this.p;
}
public boolean o() {
return this.q;
}
public void d(int i) {
this.p = i;
}
} }

Datei anzeigen

@ -1,63 +0,0 @@
package net.minecraft.server;
import java.util.Random;
public class WorldGenClay extends WorldGenerator {
private int a;
private int b;
public WorldGenClay(int i) {
this.a = Block.CLAY.id;
this.b = i;
}
public boolean a(World world, Random random, int i, int j, int k) {
if (world.getMaterial(i, j, k) != Material.WATER) {
return false;
} else {
float f = random.nextFloat() * 3.1415927F;
double d0 = (double) ((float) (i + 8) + MathHelper.sin(f) * (float) this.b / 8.0F);
double d1 = (double) ((float) (i + 8) - MathHelper.sin(f) * (float) this.b / 8.0F);
double d2 = (double) ((float) (k + 8) + MathHelper.cos(f) * (float) this.b / 8.0F);
double d3 = (double) ((float) (k + 8) - MathHelper.cos(f) * (float) this.b / 8.0F);
double d4 = (double) (j + random.nextInt(3) + 2);
double d5 = (double) (j + random.nextInt(3) + 2);
for (int l = 0; l <= this.b; ++l) {
double d6 = d0 + (d1 - d0) * (double) l / (double) this.b;
double d7 = d4 + (d5 - d4) * (double) l / (double) this.b;
double d8 = d2 + (d3 - d2) * (double) l / (double) this.b;
double d9 = random.nextDouble() * (double) this.b / 16.0D;
double d10 = (double) (MathHelper.sin((float) l * 3.1415927F / (float) this.b) + 1.0F) * d9 + 1.0D;
double d11 = (double) (MathHelper.sin((float) l * 3.1415927F / (float) this.b) + 1.0F) * d9 + 1.0D;
int i1 = MathHelper.floor(d6 - d10 / 2.0D);
int j1 = MathHelper.floor(d6 + d10 / 2.0D);
int k1 = MathHelper.floor(d7 - d11 / 2.0D);
int l1 = MathHelper.floor(d7 + d11 / 2.0D);
int i2 = MathHelper.floor(d8 - d10 / 2.0D); // CraftBukkit - d6 -> d8
int j2 = MathHelper.floor(d8 + d10 / 2.0D); // CraftBukkit - d6 -> d8
for (int k2 = i1; k2 <= j1; ++k2) {
for (int l2 = k1; l2 <= l1; ++l2) {
for (int i3 = i2; i3 <= j2; ++i3) {
double d12 = ((double) k2 + 0.5D - d6) / (d10 / 2.0D);
double d13 = ((double) l2 + 0.5D - d7) / (d11 / 2.0D);
double d14 = ((double) i3 + 0.5D - d8) / (d10 / 2.0D);
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) {
int j3 = world.getTypeId(k2, l2, i3);
if (j3 == Block.SAND.id) {
world.setRawTypeId(k2, l2, i3, this.a);
}
}
}
}
}
}
return true;
}
}
}

Datei anzeigen

@ -22,77 +22,89 @@ public class WorldGenForest extends WorldGenerator {
int l = random.nextInt(3) + 5; int l = random.nextInt(3) + 5;
boolean flag = true; boolean flag = true;
if (j >= 1 && j + l + 1 <= 128) { if (j >= 1) {
int i1; int k1000 = j + l + 1;
int j1;
int k1;
int l1;
for (i1 = j; i1 <= j + 1 + l; ++i1) { world.getClass();
byte b0 = 1; if (k1000 <= 128) {
int j1;
int k1;
int l1;
int i2;
if (i1 == j) { for (j1 = j; j1 <= j + 1 + l; ++j1) {
b0 = 0; byte b0 = 1;
}
if (i1 >= j + 1 + l - 2) { if (j1 == j) {
b0 = 2; b0 = 0;
} }
for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) { if (j1 >= j + 1 + l - 2) {
for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) { b0 = 2;
if (i1 >= 0 && i1 < 128) { }
l1 = world.getTypeId(j1, i1, k1);
if (l1 != 0 && l1 != Block.LEAVES.id) { for (k1 = i - b0; k1 <= i + b0 && flag; ++k1) {
flag = false; for (l1 = k - b0; l1 <= k + b0 && flag; ++l1) {
if (j1 >= 0) {
world.getClass();
if (j1 < 128) {
i2 = world.getTypeId(k1, j1, l1);
if (i2 != 0 && i2 != Block.LEAVES.id) {
flag = false;
}
continue;
}
} }
} else {
flag = false; flag = false;
} }
} }
} }
}
if (!flag) { if (!flag) {
return false; return false;
} else { }
i1 = world.getTypeId(i, j - 1, k);
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
int i2; j1 = world.getTypeId(i, j - 1, k);
if (j1 == Block.GRASS.id || j1 == Block.DIRT.id) {
world.getClass();
if (j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
for (i2 = j - 3 + l; i2 <= j + l; ++i2) { int j2;
j1 = i2 - (j + l);
k1 = 1 - j1 / 2;
for (l1 = i - k1; l1 <= i + k1; ++l1) { for (j2 = j - 3 + l; j2 <= j + l; ++j2) {
int j2 = l1 - i; k1 = j2 - (j + l);
l1 = 1 - k1 / 2;
for (int k2 = k - k1; k2 <= k + k1; ++k2) { for (i2 = i - l1; i2 <= i + l1; ++i2) {
int l2 = k2 - k; int k2 = i2 - i;
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) { for (int l2 = k - l1; l2 <= k + l1; ++l2) {
world.setRawTypeIdAndData(l1, i2, k2, Block.LEAVES.id, 2); int i3 = l2 - k;
if ((Math.abs(k2) != l1 || Math.abs(i3) != l1 || random.nextInt(2) != 0 && k1 != 0) && !Block.o[world.getTypeId(i2, j2, l2)]) {
world.setRawTypeIdAndData(i2, j2, l2, Block.LEAVES.id, 2);
}
} }
} }
} }
}
for (i2 = 0; i2 < l; ++i2) { for (j2 = 0; j2 < l; ++j2) {
j1 = world.getTypeId(i, j + i2, k); k1 = world.getTypeId(i, j + j2, k);
if (j1 == 0 || j1 == Block.LEAVES.id) { if (k1 == 0 || k1 == Block.LEAVES.id) {
world.setRawTypeIdAndData(i, j + i2, k, Block.LOG.id, 2); world.setRawTypeIdAndData(i, j + j2, k, Block.LOG.id, 2);
}
} }
}
return true; return true;
} else { }
return false;
} }
return false;
} }
} else {
return false;
} }
return false;
} }
} }

Datei anzeigen

@ -25,78 +25,90 @@ public class WorldGenTaiga1 extends WorldGenerator {
int k1 = 1 + random.nextInt(j1 + 1); int k1 = 1 + random.nextInt(j1 + 1);
boolean flag = true; boolean flag = true;
if (j >= 1 && j + l + 1 <= 128) { if (j >= 1) {
int l1; int l1 = j + l + 1;
int i2;
int j2;
int k2;
int l2;
for (l1 = j; l1 <= j + 1 + l && flag; ++l1) { world.getClass();
boolean flag1 = true; if (l1 <= 128) {
int i2;
int j2;
int k2;
int l2;
int i3;
if (l1 - j < i1) { for (i2 = j; i2 <= j + 1 + l && flag; ++i2) {
l2 = 0; boolean flag1 = true;
} else {
l2 = k1;
}
for (i2 = i - l2; i2 <= i + l2 && flag; ++i2) { if (i2 - j < i1) {
for (j2 = k - l2; j2 <= k + l2 && flag; ++j2) { i3 = 0;
if (l1 >= 0 && l1 < 128) { } else {
k2 = world.getTypeId(i2, l1, j2); i3 = k1;
if (k2 != 0 && k2 != Block.LEAVES.id) { }
flag = false;
for (j2 = i - i3; j2 <= i + i3 && flag; ++j2) {
for (k2 = k - i3; k2 <= k + i3 && flag; ++k2) {
if (i2 >= 0) {
world.getClass();
if (i2 < 128) {
l2 = world.getTypeId(j2, i2, k2);
if (l2 != 0 && l2 != Block.LEAVES.id) {
flag = false;
}
continue;
}
} }
} else {
flag = false; flag = false;
} }
} }
} }
}
if (!flag) { if (!flag) {
return false; return false;
} else { }
l1 = world.getTypeId(i, j - 1, k);
if ((l1 == Block.GRASS.id || l1 == Block.DIRT.id) && j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
l2 = 0;
for (i2 = j + l; i2 >= j + i1; --i2) { i2 = world.getTypeId(i, j - 1, k);
for (j2 = i - l2; j2 <= i + l2; ++j2) { if (i2 == Block.GRASS.id || i2 == Block.DIRT.id) {
k2 = j2 - i; world.getClass();
if (j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
i3 = 0;
for (int i3 = k - l2; i3 <= k + l2; ++i3) { for (j2 = j + l; j2 >= j + i1; --j2) {
int j3 = i3 - k; for (k2 = i - i3; k2 <= i + i3; ++k2) {
l2 = k2 - i;
if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.o[world.getTypeId(j2, i2, i3)]) { for (int j3 = k - i3; j3 <= k + i3; ++j3) {
world.setRawTypeIdAndData(j2, i2, i3, Block.LEAVES.id, 1); int k3 = j3 - k;
if ((Math.abs(l2) != i3 || Math.abs(k3) != i3 || i3 <= 0) && !Block.o[world.getTypeId(k2, j2, j3)]) {
world.setRawTypeIdAndData(k2, j2, j3, Block.LEAVES.id, 1);
}
} }
} }
if (i3 >= 1 && j2 == j + i1 + 1) {
--i3;
} else if (i3 < k1) {
++i3;
}
} }
if (l2 >= 1 && i2 == j + i1 + 1) { for (j2 = 0; j2 < l - 1; ++j2) {
--l2; k2 = world.getTypeId(i, j + j2, k);
} else if (l2 < k1) { if (k2 == 0 || k2 == Block.LEAVES.id) {
++l2; world.setRawTypeIdAndData(i, j + j2, k, Block.LOG.id, 1);
}
} }
}
for (i2 = 0; i2 < l - 1; ++i2) { return true;
j2 = world.getTypeId(i, j + i2, k);
if (j2 == 0 || j2 == Block.LEAVES.id) {
world.setRawTypeIdAndData(i, j + i2, k, Block.LOG.id, 1);
}
} }
return true;
} else {
return false;
} }
return false;
} }
} else {
return false;
} }
return false;
} }
} }

Datei anzeigen

@ -25,91 +25,103 @@ public class WorldGenTaiga2 extends WorldGenerator {
int k1 = 2 + random.nextInt(2); int k1 = 2 + random.nextInt(2);
boolean flag = true; boolean flag = true;
if (j >= 1 && j + l + 1 <= 128) { if (j >= 1) {
int l1; int l1 = j + l + 1;
int i2;
int j2;
int k2;
for (l1 = j; l1 <= j + 1 + l && flag; ++l1) { world.getClass();
boolean flag1 = true; if (l1 <= 128) {
int i2;
int j2;
int k2;
int l2;
if (l1 - j < i1) { for (i2 = j; i2 <= j + 1 + l && flag; ++i2) {
k2 = 0; boolean flag1 = true;
} else {
k2 = k1;
}
for (i2 = i - k2; i2 <= i + k2 && flag; ++i2) { if (i2 - j < i1) {
for (int l2 = k - k2; l2 <= k + k2 && flag; ++l2) { l2 = 0;
if (l1 >= 0 && l1 < 128) { } else {
j2 = world.getTypeId(i2, l1, l2); l2 = k1;
if (j2 != 0 && j2 != Block.LEAVES.id) { }
flag = false;
for (j2 = i - l2; j2 <= i + l2 && flag; ++j2) {
for (int i3 = k - l2; i3 <= k + l2 && flag; ++i3) {
if (i2 >= 0) {
world.getClass();
if (i2 < 128) {
k2 = world.getTypeId(j2, i2, i3);
if (k2 != 0 && k2 != Block.LEAVES.id) {
flag = false;
}
continue;
}
} }
} else {
flag = false; flag = false;
} }
} }
} }
}
if (!flag) { if (!flag) {
return false;
} else {
l1 = world.getTypeId(i, j - 1, k);
if ((l1 == Block.GRASS.id || l1 == Block.DIRT.id) && j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
k2 = random.nextInt(2);
i2 = 1;
byte b0 = 0;
int i3;
int j3;
for (j2 = 0; j2 <= j1; ++j2) {
j3 = j + l - j2;
for (i3 = i - k2; i3 <= i + k2; ++i3) {
int k3 = i3 - i;
for (int l3 = k - k2; l3 <= k + k2; ++l3) {
int i4 = l3 - k;
if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.o[world.getTypeId(i3, j3, l3)]) {
world.setRawTypeIdAndData(i3, j3, l3, Block.LEAVES.id, 1);
}
}
}
if (k2 >= i2) {
k2 = b0;
b0 = 1;
++i2;
if (i2 > k1) {
i2 = k1;
}
} else {
++k2;
}
}
j2 = random.nextInt(3);
for (j3 = 0; j3 < l - j2; ++j3) {
i3 = world.getTypeId(i, j + j3, k);
if (i3 == 0 || i3 == Block.LEAVES.id) {
world.setRawTypeIdAndData(i, j + j3, k, Block.LOG.id, 1);
}
}
return true;
} else {
return false; return false;
} }
i2 = world.getTypeId(i, j - 1, k);
if (i2 == Block.GRASS.id || i2 == Block.DIRT.id) {
world.getClass();
if (j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
l2 = random.nextInt(2);
j2 = 1;
byte b0 = 0;
int j3;
int k3;
for (k2 = 0; k2 <= j1; ++k2) {
k3 = j + l - k2;
for (j3 = i - l2; j3 <= i + l2; ++j3) {
int l3 = j3 - i;
for (int i4 = k - l2; i4 <= k + l2; ++i4) {
int j4 = i4 - k;
if ((Math.abs(l3) != l2 || Math.abs(j4) != l2 || l2 <= 0) && !Block.o[world.getTypeId(j3, k3, i4)]) {
world.setRawTypeIdAndData(j3, k3, i4, Block.LEAVES.id, 1);
}
}
}
if (l2 >= j2) {
l2 = b0;
b0 = 1;
++j2;
if (j2 > k1) {
j2 = k1;
}
} else {
++l2;
}
}
k2 = random.nextInt(3);
for (k3 = 0; k3 < l - k2; ++k3) {
j3 = world.getTypeId(i, j + k3, k);
if (j3 == 0 || j3 == Block.LEAVES.id) {
world.setRawTypeIdAndData(i, j + k3, k, Block.LOG.id, 1);
}
}
return true;
}
}
return false;
} }
} else {
return false;
} }
return false;
} }
} }

Datei anzeigen

@ -22,77 +22,89 @@ public class WorldGenTrees extends WorldGenerator {
int l = random.nextInt(3) + 4; int l = random.nextInt(3) + 4;
boolean flag = true; boolean flag = true;
if (j >= 1 && j + l + 1 <= 128) { if (j >= 1) {
int i1; int k1000 = j + l + 1;
int j1;
int k1;
int l1;
for (i1 = j; i1 <= j + 1 + l; ++i1) { world.getClass();
byte b0 = 1; if (k1000 <= 128) {
int j1;
int k1;
int l1;
int i2;
if (i1 == j) { for (j1 = j; j1 <= j + 1 + l; ++j1) {
b0 = 0; byte b0 = 1;
}
if (i1 >= j + 1 + l - 2) { if (j1 == j) {
b0 = 2; b0 = 0;
} }
for (j1 = i - b0; j1 <= i + b0 && flag; ++j1) { if (j1 >= j + 1 + l - 2) {
for (k1 = k - b0; k1 <= k + b0 && flag; ++k1) { b0 = 2;
if (i1 >= 0 && i1 < 128) { }
l1 = world.getTypeId(j1, i1, k1);
if (l1 != 0 && l1 != Block.LEAVES.id) { for (k1 = i - b0; k1 <= i + b0 && flag; ++k1) {
flag = false; for (l1 = k - b0; l1 <= k + b0 && flag; ++l1) {
if (j1 >= 0) {
world.getClass();
if (j1 < 128) {
i2 = world.getTypeId(k1, j1, l1);
if (i2 != 0 && i2 != Block.LEAVES.id) {
flag = false;
}
continue;
}
} }
} else {
flag = false; flag = false;
} }
} }
} }
}
if (!flag) { if (!flag) {
return false; return false;
} else { }
i1 = world.getTypeId(i, j - 1, k);
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
int i2; j1 = world.getTypeId(i, j - 1, k);
if (j1 == Block.GRASS.id || j1 == Block.DIRT.id) {
world.getClass();
if (j < 128 - l - 1) {
world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
for (i2 = j - 3 + l; i2 <= j + l; ++i2) { int j2;
j1 = i2 - (j + l);
k1 = 1 - j1 / 2;
for (l1 = i - k1; l1 <= i + k1; ++l1) { for (j2 = j - 3 + l; j2 <= j + l; ++j2) {
int j2 = l1 - i; k1 = j2 - (j + l);
l1 = 1 - k1 / 2;
for (int k2 = k - k1; k2 <= k + k1; ++k2) { for (i2 = i - l1; i2 <= i + l1; ++i2) {
int l2 = k2 - k; int k2 = i2 - i;
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) { for (int l2 = k - l1; l2 <= k + l1; ++l2) {
world.setRawTypeId(l1, i2, k2, Block.LEAVES.id); int i3 = l2 - k;
if ((Math.abs(k2) != l1 || Math.abs(i3) != l1 || random.nextInt(2) != 0 && k1 != 0) && !Block.o[world.getTypeId(i2, j2, l2)]) {
world.setRawTypeId(i2, j2, l2, Block.LEAVES.id);
}
} }
} }
} }
}
for (i2 = 0; i2 < l; ++i2) { for (j2 = 0; j2 < l; ++j2) {
j1 = world.getTypeId(i, j + i2, k); k1 = world.getTypeId(i, j + j2, k);
if (j1 == 0 || j1 == Block.LEAVES.id) { if (k1 == 0 || k1 == Block.LEAVES.id) {
world.setRawTypeId(i, j + i2, k, Block.LOG.id); world.setRawTypeId(i, j + j2, k, Block.LOG.id);
}
} }
}
return true; return true;
} else { }
return false;
} }
return false;
} }
} else {
return false;
} }
return false;
} }
} }

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