Update for 1.1_01 renames.

We know these updates (can) break plugins bypassing Bukkit. They are needed for
smooth updates however. There will be another one right before before 1.1-R1.
This commit is contained in:
Erik Broes 2012-01-14 21:03:48 +01:00
parent 6495eee0c9
commit 61ec751ca1
85 changed files with 466 additions and 456 deletions

11
pom.xml
View file

@ -7,16 +7,19 @@
<version>1.1-R1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>http://www.bukkit.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version>
<junit.version>4.10</junit.version>
</properties>
<scm>
<connection>scm:git:git://github.com/Bukkit/CraftBukkit.git</connection>
<developerConnection>scm:git:ssh://git@github.com/Bukkit/CraftBukkit.git</developerConnection>
<url>https://github.com/Bukkit/CraftBukkit</url>
</scm>
<distributionManagement>
<repository>
<id>repobo-rel</id>
@ -29,18 +32,21 @@
<url>http://repo.bukkit.org/content/repositories/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/artifactory/repo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>bukkit-plugins</id>
<url>http://repo.bukkit.org/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
@ -51,8 +57,8 @@
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.1</version>
<artifactId>minecraft-server-release</artifactId>
<version>1.1_01</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
@ -111,6 +117,7 @@
<version>${junit.version}</version>
</dependency>
</dependencies>
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
<build>
<defaultGoal>clean install</defaultGoal>

View file

@ -18,9 +18,9 @@ public class Block {
public static final boolean[] n = new boolean[256];
public static final boolean[] o = new boolean[256];
public static final boolean[] isTileEntity = new boolean[256];
public static final int[] q = new int[256];
public static final int[] lightBlock = new int[256];
public static final boolean[] r = new boolean[256];
public static final int[] s = new int[256];
public static final int[] lightEmission = new int[256];
public static final boolean[] t = new boolean[256];
public static boolean[] u = new boolean[256];
public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).a("stone");
@ -177,7 +177,7 @@ public class Block {
this.id = i;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
o[i] = this.a();
q[i] = this.a() ? 255 : 0;
lightBlock[i] = this.a() ? 255 : 0;
r[i] = !material.blocksLight();
isTileEntity[i] = false;
}
@ -201,12 +201,12 @@ public class Block {
}
protected Block g(int i) {
q[this.id] = i;
lightBlock[this.id] = i;
return this;
}
protected Block a(float f) {
s[this.id] = (int) (15.0F * f);
lightEmission[this.id] = (int) (15.0F * f);
return this;
}
@ -485,7 +485,7 @@ public class Block {
public void postPlace(World world, int i, int j, int k, int l) {}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) {}
@ -548,7 +548,7 @@ public class Block {
return this;
}
public String m() {
public String getName() {
return LocaleI18n.a(this.n() + ".name");
}

View file

@ -121,7 +121,7 @@ public class BlockButton extends Block {
}
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.interact(world, i, j, k, entityhuman);
}

View file

@ -84,7 +84,7 @@ public class BlockDoor extends Block {
}
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.interact(world, i, j, k, entityhuman);
}

View file

@ -21,7 +21,7 @@ public class BlockDragonEgg extends Block {
}
private void g(World world, int i, int j, int k) {
if (BlockSand.g(world, i, j - 1, k) && j >= 0) {
if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
if (!BlockSand.instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
@ -32,7 +32,7 @@ public class BlockDragonEgg extends Block {
} else {
world.setTypeId(i, j, k, 0);
while (BlockSand.g(world, i, j - 1, k) && j > 0) {
while (BlockSand.canFall(world, i, j - 1, k) && j > 0) {
--j;
}
@ -48,7 +48,7 @@ public class BlockDragonEgg extends Block {
return true;
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.h(world, i, j, k);
}

View file

@ -105,7 +105,7 @@ public class BlockFlowing extends BlockFluids {
if (!event.isCancelled()) {
if (this.material == Material.LAVA && world.getMaterial(i, j - 1, k) == Material.WATER) {
world.setTypeId(i, j - 1, k, Block.STONE.id);
this.h(world, i, j - 1, k);
this.fizz(world, i, j - 1, k);
return;
}
@ -156,7 +156,7 @@ public class BlockFlowing extends BlockFluids {
if (i1 > 0) {
if (this.material == Material.LAVA) {
this.h(world, i, j, k);
this.fizz(world, i, j, k);
} else {
Block.byId[i1].b(world, i, j, k, world.getData(i, j, k), 0);
}

View file

@ -21,9 +21,8 @@ public class BlockGrass extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
// CraftBukkit start - reuse getLightLevel
int lightLevel = world.getLightLevel(i, j + 1, k);
if (lightLevel < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
// CraftBukkit start - reuse getLightLevel
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState();
blockState.setTypeId(Block.DIRT.id);
@ -34,15 +33,15 @@ public class BlockGrass extends Block {
if (!event.isCancelled()) {
blockState.update(true);
}
} else if (lightLevel >= 9) {
// CraftBukkit end
// CraftBukkit end
} else if (world.getLightLevel(i, j + 1, k) >= 9) {
for (int l = 0; l < 4; ++l) {
int i1 = i + random.nextInt(3) - 1;
int j1 = j + random.nextInt(5) - 3;
int k1 = k + random.nextInt(3) - 1;
int l1 = world.getTypeId(i1, j1 + 1, k1);
if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.q[l1] <= 2) {
if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.lightBlock[l1] <= 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();

View file

@ -1,7 +1,7 @@
package net.minecraft.server;
import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockIce extends BlockHalfTransparant {
@ -25,7 +25,7 @@ public class BlockIce extends BlockHalfTransparant {
}
public void a(World world, int i, int j, int k, Random random) {
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.q[this.id]) {
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
// CraftBukkit start
if (CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
return;

View file

@ -130,7 +130,7 @@ public class BlockLever extends Block {
}
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.interact(world, i, j, k, entityhuman);
}

View file

@ -91,7 +91,7 @@ public class BlockMushroom extends BlockFlower {
}
// CraftBukkit - added bonemeal, player and itemstack
public boolean b(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
public boolean grow(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
int l = world.getData(i, j, k);
world.setRawTypeId(i, j, k, 0);

View file

@ -18,7 +18,7 @@ public class BlockMycel extends Block {
public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState();
@ -38,7 +38,7 @@ public class BlockMycel extends Block {
int k1 = k + random.nextInt(3) - 1;
int l1 = world.getTypeId(i1, j1 + 1, k1);
if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.q[l1] <= 2) {
if (world.getTypeId(i1, j1, k1) == Block.DIRT.id && world.getLightLevel(i1, j1 + 1, k1) >= 4 && Block.lightBlock[l1] <= 2) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();

View file

@ -23,7 +23,7 @@ public class BlockSand extends Block {
}
private void h(World world, int i, int j, int k) {
if (g(world, i, j - 1, k) && j >= 0) {
if (canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
@ -36,7 +36,7 @@ public class BlockSand extends Block {
} else {
world.setTypeId(i, j, k, 0);
while (g(world, i, j - 1, k) && j > 0) {
while (canFall(world, i, j - 1, k) && j > 0) {
--j;
}
@ -51,7 +51,7 @@ public class BlockSand extends Block {
return 3;
}
public static boolean g(World world, int i, int j, int k) {
public static boolean canFall(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
if (l == 0) {

View file

@ -29,7 +29,7 @@ public class BlockSapling extends BlockFlower {
if ((l & 8) == 0) {
world.setData(i, j, k, l | 8);
} else {
this.b(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
}
}
}
@ -41,11 +41,10 @@ public class BlockSapling extends BlockFlower {
}
// CraftBukkit - added bonemeal, player and itemstack
public void b(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
int l = world.getData(i, j, k) & 3;
world.setRawTypeId(i, j, k, 0);
// CraftBukkit start - fixes client updates on recently grown trees
boolean grownTree;
BlockChangeWithNotify delegate = new BlockChangeWithNotify(world);
@ -74,9 +73,9 @@ public class BlockSapling extends BlockFlower {
--itemstack.count;
}
if (!grownTree || event.isCancelled()) {
// CraftBukkit end
world.setRawTypeIdAndData(i, j, k, this.id, l);
}
// CraftBukkit end
}
protected int getDropData(int i) {

View file

@ -67,7 +67,7 @@ public class BlockTrapdoor extends Block {
}
}
public void b(World world, int i, int j, int k, EntityHuman entityhuman) {
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
this.interact(world, i, j, k, entityhuman);
}
@ -83,7 +83,7 @@ public class BlockTrapdoor extends Block {
}
}
public void a(World world, int i, int j, int k, boolean flag) {
public void setOpen(World world, int i, int j, int k, boolean flag) {
int l = world.getData(i, j, k);
boolean flag1 = (l & 4) > 0;
@ -132,7 +132,7 @@ public class BlockTrapdoor extends Block {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power);
world.getServer().getPluginManager().callEvent(eventRedstone);
this.a(world, i, j, k, eventRedstone.getNewCurrent() > 0);
this.setOpen(world, i, j, k, eventRedstone.getNewCurrent() > 0);
}
// CraftBukkit end
}

View file

@ -99,7 +99,7 @@ public class Chunk {
int i1;
for (i1 = j << this.world.heightBitsPlusFour | k << this.world.heightBits; l > 0 && Block.q[this.b[i1 + l - 1] & 255] == 0; --l) {
for (i1 = j << this.world.heightBitsPlusFour | k << this.world.heightBits; l > 0 && Block.lightBlock[this.b[i1 + l - 1] & 255] == 0; --l) {
;
}
@ -113,7 +113,7 @@ public class Chunk {
int k1 = this.world.height - 1;
do {
j1 -= Block.q[this.b[i1 + k1] & 255];
j1 -= Block.lightBlock[this.b[i1 + k1] & 255];
if (j1 > 0) {
this.h.a(j, k1, k, j1);
}
@ -208,7 +208,7 @@ public class Chunk {
i1 = j;
}
for (int j1 = i << this.world.heightBitsPlusFour | k << this.world.heightBits; i1 > 0 && Block.q[this.b[j1 + i1 - 1] & 255] == 0; --i1) {
for (int j1 = i << this.world.heightBitsPlusFour | k << this.world.heightBits; i1 > 0 && Block.lightBlock[this.b[j1 + i1 - 1] & 255] == 0; --i1) {
;
}
@ -252,7 +252,7 @@ public class Chunk {
for (i2 = 15; i1 > 0 && i2 > 0; this.h.a(i, i1, k, i2)) {
--i1;
j2 = Block.q[this.getTypeId(i, i1, k)];
j2 = Block.lightBlock[this.getTypeId(i, i1, k)];
if (j2 == 0) {
j2 = 1;
}
@ -318,7 +318,7 @@ public class Chunk {
this.g.a(i, j, k, i1);
if (!this.world.worldProvider.f) {
if (Block.q[b0 & 255] != 0) {
if (Block.lightBlock[b0 & 255] != 0) {
if (j >= k1) {
this.g(i, j + 1, k);
}
@ -385,7 +385,7 @@ public class Chunk {
}
this.g.a(i, j, k, 0);
if (Block.q[b0 & 255] != 0) {
if (Block.lightBlock[b0 & 255] != 0) {
if (j >= j1) {
this.g(i, j + 1, k);
}
@ -573,7 +573,7 @@ public class Chunk {
this.a(i, j, k, tileentity);
if (this.e) {
this.world.h.add(tileentity);
this.world.tileEntityList.add(tileentity);
}
}

View file

@ -224,7 +224,7 @@ public abstract class Entity {
if (this.i_()) {
if (!this.bV && !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.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F) {
f = 1.0F;
@ -581,7 +581,7 @@ public abstract class Entity {
// CraftBukkit end
if (this.g_() && !flag && this.vehicle == null) {
this.bJ = (float) ((double) this.bJ + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
this.bJ = (float) ((double) this.bJ + (double) MathHelper.sqrt(d9 * d9 + d10 * d10) * 0.6D);
l = MathHelper.floor(this.locX);
i1 = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
j1 = MathHelper.floor(this.locZ);
@ -855,7 +855,7 @@ public abstract class Entity {
double d4 = this.locY - d1;
double d5 = this.locZ - d2;
return (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
return (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
}
public double i(Entity entity) {
@ -875,7 +875,7 @@ public abstract class Entity {
double d2 = MathHelper.a(d0, d1);
if (d2 >= 0.009999999776482582D) {
d2 = (double) MathHelper.a(d2);
d2 = (double) MathHelper.sqrt(d2);
d0 /= d2;
d1 /= d2;
double d3 = 1.0D / d2;
@ -1104,7 +1104,7 @@ public abstract class Entity {
return !this.dead;
}
public boolean U() {
public boolean inBlock() {
for (int i = 0; i < 8; ++i) {
float f = ((float) ((i >> 0) % 2) - 0.5F) * this.width * 0.8F;
float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F;
@ -1284,7 +1284,7 @@ public abstract class Entity {
return null;
}
public boolean A() {
public boolean isBurning() {
return this.fireTicks > 0 || this.k(0);
}
@ -1454,7 +1454,7 @@ public abstract class Entity {
this.fallDistance = 0.0F;
}
public String ad() {
public String getLocalizedName() {
String s = EntityTypes.b(this);
if (s == null) {

View file

@ -60,7 +60,7 @@ public class EntityArrow extends Entity {
protected void b() {}
public void shoot(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= (double) f2;
d1 /= (double) f2;
@ -74,7 +74,7 @@ public class EntityArrow extends Entity {
this.motX = d0;
this.motY = d1;
this.motZ = d2;
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
float f3 = MathHelper.sqrt(d0 * d0 + d2 * d2);
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
@ -84,7 +84,7 @@ public class EntityArrow extends Entity {
public void y_() {
super.y_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.lastYaw = this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(this.motY, (double) f) * 180.0D / 3.1415927410125732D);
@ -172,7 +172,7 @@ public class EntityArrow extends Entity {
this.world.getServer().getPluginManager().callEvent(phe);
// CraftBukkit end
if (movingobjectposition.entity != null) {
f2 = MathHelper.a(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int l = (int) Math.ceil((double) f2 * this.damage);
if (this.d) {
@ -187,7 +187,7 @@ public class EntityArrow extends Entity {
damagesource = DamageSource.arrow(this, this.shooter);
}
if (this.A()) {
if (this.isBurning()) {
movingobjectposition.entity.setOnFire(5);
}
@ -215,7 +215,7 @@ public class EntityArrow extends Entity {
if (movingobjectposition.entity instanceof EntityLiving) {
++((EntityLiving) movingobjectposition.entity).aJ;
if (this.n > 0) {
float f3 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (f3 > 0.0F) {
movingobjectposition.entity.b_(this.motX * (double) this.n * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.n * 0.6000000238418579D / (double) f3);
@ -242,7 +242,7 @@ public class EntityArrow extends Entity {
this.motX = (double) ((float) (movingobjectposition.f.a - this.locX));
this.motY = (double) ((float) (movingobjectposition.f.b - this.locY));
this.motZ = (double) ((float) (movingobjectposition.f.c - this.locZ));
f2 = MathHelper.a(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D;
@ -262,7 +262,7 @@ public class EntityArrow extends Entity {
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
f2 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
f2 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
for (this.pitch = (float) (Math.atan2(this.motY, (double) f2) * 180.0D / 3.1415927410125732D); this.pitch - this.lastPitch < -180.0F; this.lastPitch -= 360.0F) {

View file

@ -133,11 +133,11 @@ public class EntityBlaze extends EntityMonster {
super.a(nbttagcompound);
}
protected int e() {
protected int getLootId() {
return Item.BLAZE_ROD.id;
}
public boolean A() {
public boolean isBurning() {
return this.B();
}

View file

@ -49,7 +49,7 @@ public class EntityChicken extends EntityAnimal {
}
this.b += this.i * 2.0F;
if (!this.l() && !this.world.isStatic && --this.j <= 0) {
if (!this.isBaby() && !this.world.isStatic && --this.j <= 0) {
this.world.makeSound(this, "mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.b(Item.EGG.id, 1);
this.j = this.random.nextInt(6000) + 6000;
@ -78,7 +78,7 @@ public class EntityChicken extends EntityAnimal {
return "mob.chickenhurt";
}
protected int e() {
protected int getLootId() {
return Item.FEATHER.id;
}
@ -91,7 +91,7 @@ public class EntityChicken extends EntityAnimal {
loot.add(new org.bukkit.inventory.ItemStack(Item.FEATHER.id, j));
}
if (this.A()) {
if (this.isBurning()) {
loot.add(new org.bukkit.inventory.ItemStack(Item.COOKED_CHICKEN.id, 1));
} else {
loot.add(new org.bukkit.inventory.ItemStack(Item.RAW_CHICKEN.id, 1));

View file

@ -45,7 +45,7 @@ public class EntityCow extends EntityAnimal {
return 0.4F;
}
protected int e() {
protected int getLootId() {
return Item.LEATHER.id;
}
@ -61,7 +61,7 @@ public class EntityCow extends EntityAnimal {
j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(this.A() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
loot.add(new org.bukkit.inventory.ItemStack(this.isBurning() ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, j));
}
CraftEventFactory.callEntityDeathEvent(this, loot);

View file

@ -203,12 +203,12 @@ public abstract class EntityCreature extends EntityLiving {
return null;
}
public boolean g() {
public boolean canSpawn() {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ);
return super.g() && this.a(i, j, k) >= 0.0F;
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
}
public boolean E() {

View file

@ -136,7 +136,7 @@ public class EntityCreeper extends EntityMonster {
return this.datawatcher.getByte(17) == 1;
}
protected int e() {
protected int getLootId() {
return Item.SULPHUR.id;
}

View file

@ -2,11 +2,11 @@ package net.minecraft.server;
public class EntityDamageSourceIndirect extends EntityDamageSource {
private Entity o;
private Entity owner;
public EntityDamageSourceIndirect(String s, Entity entity, Entity entity1) {
super(s, entity);
this.o = entity1;
this.owner = entity1;
}
public Entity b() {
@ -14,13 +14,13 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
}
public Entity getEntity() {
return this.o;
return this.owner;
}
public String a(EntityHuman entityhuman) {
public String getLocalizedDeathMessage(EntityHuman entityhuman) {
// CraftBukkit start
String source = (this.o == null) ? "Herobrine" : this.o.ad();
return LocaleI18n.a("death." + this.n, new Object[] { entityhuman.name, source});
String source = (this.owner == null) ? "Herobrine" : this.owner.getLocalizedName();
return LocaleI18n.get("death." + this.translationIndex, new Object[] { entityhuman.name, source});
}
public Entity getProximateDamageSource() {

View file

@ -100,7 +100,7 @@ public class EntityEnderDragon extends EntityComplex {
this.world.a("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) d05, this.locZ + (double) f1, 0.0D, 0.0D, 0.0D);
} else {
this.v();
f = 0.2F / (MathHelper.a(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motY);
if (this.q) {
this.o += f * 0.5F;
@ -182,7 +182,7 @@ public class EntityEnderDragon extends EntityComplex {
this.B();
}
d1 /= (double) MathHelper.a(d0 * d0 + d2 * d2);
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
f3 = 0.6F;
if (d1 < (double) (-f3)) {
d1 = (double) (-f3);
@ -229,7 +229,7 @@ public class EntityEnderDragon extends EntityComplex {
}
this.aY *= 0.8F;
float f5 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
if (d10 > 40.0D) {
@ -547,7 +547,7 @@ public class EntityEnderDragon extends EntityComplex {
i = expToDrop / 20; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
while (i > 0) {
j = EntityExperienceOrb.b(i);
j = EntityExperienceOrb.getOrbValue(i);
i -= j;
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
}
@ -559,7 +559,7 @@ public class EntityEnderDragon extends EntityComplex {
i = expToDrop - 10 * (expToDrop / 20); // CraftBukkit - drop the remaining experience
while (i > 0) {
j = EntityExperienceOrb.b(i);
j = EntityExperienceOrb.getOrbValue(i);
i -= j;
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
}
@ -590,7 +590,7 @@ public class EntityEnderDragon extends EntityComplex {
for (int j1 = j - b0; j1 <= j + b0; ++j1) {
double d0 = (double) (i1 - i);
double d1 = (double) (j1 - j);
double d2 = (double) MathHelper.a(d0 * d0 + d1 * d1);
double d2 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
if (d2 <= (double) b0 - 0.5D) {
if (l < k) {

View file

@ -52,7 +52,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (this.shooter instanceof EntityPlayer) {
((EntityPlayer)this.shooter).netServerHandler.teleport(teleEvent.getTo());
} else {
this.shooter.a_(this.locX, this.locY, this.locZ);
this.shooter.enderTeleportTo(this.locX, this.locY, this.locZ);
}
this.shooter.fallDistance = 0.0F;
EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5);
@ -60,7 +60,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (!damageEvent.isCancelled()) {
org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name);
((CraftPlayer) bPlayer).getHandle().cj = -1; // Remove spawning invulnerability.
((CraftPlayer) bPlayer).getHandle().invulnerableTicks = -1; // Remove spawning invulnerability.
((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, 5); // Damage the new player instead of the old
}
}

View file

@ -272,12 +272,12 @@ public class EntityEnderman extends EntityMonster {
return "mob.endermen.death";
}
protected int e() {
protected int getLootId() {
return Item.ENDER_PEARL.id;
}
protected void dropDeathLoot(boolean flag, int i) {
int j = this.e();
int j = this.getLootId();
if (j > 0) {
// CraftBukkit start - whole method

View file

@ -140,7 +140,7 @@ public class EntityExperienceOrb extends Entity {
return this.value;
}
public static int b(int i) {
public static int getOrbValue(int i) {
// CraftBukkit start
if (i > 162670129) return i - 100000;
if (i > 81335063) return 81335063;

View file

@ -2,7 +2,7 @@ package net.minecraft.server;
public class EntityFallingBlock extends Entity {
public int a;
public int id;
public int data; // CraftBukkit
public int b = 0;
@ -13,7 +13,7 @@ public class EntityFallingBlock extends Entity {
// CraftBukkit - changed method signature
public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int data) {
super(world);
this.a = i;
this.id = i;
this.bf = true;
this.data = data; // CraftBukkit
this.b(0.98F, 0.98F);
@ -38,7 +38,7 @@ public class EntityFallingBlock extends Entity {
}
public void y_() {
if (this.a == 0) {
if (this.id == 0) {
this.die();
} else {
this.lastX = this.locX;
@ -54,7 +54,7 @@ public class EntityFallingBlock extends Entity {
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
if (this.b == 1 && this.world.getTypeId(i, j, k) == this.a) {
if (this.b == 1 && this.world.getTypeId(i, j, k) == this.id) {
this.world.setTypeId(i, j, k, 0);
} else if (!this.world.isStatic && this.b == 1) {
this.die();
@ -67,24 +67,24 @@ public class EntityFallingBlock extends Entity {
if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
this.die();
// CraftBukkit - setTypeId => setTypeIdAndData
if ((!this.world.a(this.a, i, j, k, true, 1) || BlockSand.g(this.world, i, j - 1, k) || !this.world.setTypeIdAndData(i, j, k, this.a, this.data)) && !this.world.isStatic) {
this.b(this.a, 1);
if ((!this.world.mayPlace(this.id, i, j, k, true, 1) || BlockSand.canFall(this.world, i, j - 1, k) || !this.world.setTypeIdAndData(i, j, k, this.id, this.data)) && !this.world.isStatic) {
this.b(this.id, 1);
}
}
} else if (this.b > 100 && !this.world.isStatic) {
this.b(this.a, 1);
this.b(this.id, 1);
this.die();
}
}
}
protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setByte("Tile", (byte) this.a);
nbttagcompound.setByte("Tile", (byte) this.id);
nbttagcompound.setByte("Data", (byte) this.data); // CraftBukkit
}
protected void a(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.getByte("Tile") & 255;
this.id = nbttagcompound.getByte("Tile") & 255;
this.data = nbttagcompound.getByte("Data") & 15; // CraftBukkit
}
}

View file

@ -51,16 +51,16 @@ public class EntityFireball extends Entity {
}
public void setDirection(double d0, double d1, double d2) {
// CraftBukkit end
d0 += this.random.nextGaussian() * 0.4D;
d1 += this.random.nextGaussian() * 0.4D;
d2 += this.random.nextGaussian() * 0.4D;
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
this.dirX = d0 / d3 * 0.1D;
this.dirY = d1 / d3 * 0.1D;
this.dirZ = d2 / d3 * 0.1D;
}
// CraftBukkit end
public void y_() {
super.y_();
@ -135,7 +135,7 @@ public class EntityFireball extends Entity {
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f1 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);

View file

@ -22,7 +22,7 @@ public class EntityFishingHook extends Entity {
private int i;
private int j = 0;
private int k = 0;
public Entity c = null;
public Entity hooked = null;
private int l;
private double m;
private double n;
@ -59,7 +59,7 @@ public class EntityFishingHook extends Entity {
protected void b() {}
public void a(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= (double) f2;
d1 /= (double) f2;
@ -73,7 +73,7 @@ public class EntityFishingHook extends Entity {
this.motX = d0;
this.motY = d1;
this.motZ = d2;
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
float f3 = MathHelper.sqrt(d0 * d0 + d2 * d2);
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
@ -112,15 +112,15 @@ public class EntityFishingHook extends Entity {
return;
}
if (this.c != null) {
if (!this.c.dead) {
this.locX = this.c.locX;
this.locY = this.c.boundingBox.b + (double) this.c.length * 0.8D;
this.locZ = this.c.locZ;
if (this.hooked != null) {
if (!this.hooked.dead) {
this.locX = this.hooked.locX;
this.locY = this.hooked.boundingBox.b + (double) this.hooked.length * 0.8D;
this.locZ = this.hooked.locZ;
return;
}
this.c = null;
this.hooked = null;
}
}
@ -210,7 +210,7 @@ public class EntityFishingHook extends Entity {
}
if (!stick) {
// CraftBukkit end
this.c = movingobjectposition.entity;
this.hooked = movingobjectposition.entity;
}
} else {
this.h = true;
@ -219,7 +219,7 @@ public class EntityFishingHook extends Entity {
if (!this.h) {
this.move(this.motX, this.motY, this.motZ);
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f1 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);
@ -335,9 +335,9 @@ public class EntityFishingHook extends Entity {
public int j() {
byte b0 = 0;
if (this.c != null) {
if (this.hooked != null) {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), this.c.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) this.owner.getBukkitEntity(), this.hooked.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_ENTITY);
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) {
@ -350,12 +350,12 @@ public class EntityFishingHook extends Entity {
double d0 = this.owner.locX - this.locX;
double d1 = this.owner.locY - this.locY;
double d2 = this.owner.locZ - this.locZ;
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
double d4 = 0.1D;
this.c.motX += d0 * d4;
this.c.motY += d1 * d4 + (double) MathHelper.a(d3) * 0.08D;
this.c.motZ += d2 * d4;
this.hooked.motX += d0 * d4;
this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
this.hooked.motZ += d2 * d4;
b0 = 3;
} else if (this.k > 0) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
@ -373,11 +373,11 @@ public class EntityFishingHook extends Entity {
double d5 = this.owner.locX - this.locX;
double d6 = this.owner.locY - this.locY;
double d7 = this.owner.locZ - this.locZ;
double d8 = (double) MathHelper.a(d5 * d5 + d6 * d6 + d7 * d7);
double d8 = (double) MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
double d9 = 0.1D;
entityitem.motX = d5 * d9;
entityitem.motY = d6 * d9 + (double) MathHelper.a(d8) * 0.08D;
entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D;
entityitem.motZ = d7 * d9;
this.world.addEntity(entityitem);
this.owner.a(StatisticList.B, 1);

View file

@ -63,7 +63,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d0 = this.b - this.locX;
double d1 = this.c - this.locY;
double d2 = this.d - this.locZ;
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
if (d3 < 1.0D || d3 > 60.0D) {
this.b = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
@ -194,7 +194,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
return "mob.ghast.death";
}
protected int e() {
protected int getLootId() {
return Item.SULPHUR.id;
}
@ -223,8 +223,8 @@ public class EntityGhast extends EntityFlying implements IMonster {
return 10.0F;
}
public boolean g() {
return this.random.nextInt(20) == 0 && super.g() && this.world.difficulty > 0;
public boolean canSpawn() {
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
}
public int p() {

View file

@ -51,7 +51,7 @@ public abstract class EntityHuman extends EntityLiving {
public int sleepTicks; // CraftBukkit - private -> public
public float G;
public float H;
private ChunkCoordinates b;
private ChunkCoordinates server;
private ChunkCoordinates c;
public int I = 20;
protected boolean J = false;
@ -167,7 +167,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
if (this.A() && this.abilities.isInvulnerable) {
if (this.isBurning() && this.abilities.isInvulnerable) {
this.extinguish();
}
@ -302,7 +302,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 * 12 == 0) {
// CraftBukkit - added regain reason of "REGEN" for filtering purposes.
this.d(1, RegainReason.REGEN);
this.heal(1, RegainReason.REGEN);
}
this.inventory.i();
@ -315,7 +315,7 @@ public abstract class EntityHuman extends EntityLiving {
this.am = (float) ((double) this.am + (double) this.Q * 0.3D);
}
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
// CraftBukkit - Math -> TrigMath
float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
@ -502,7 +502,7 @@ public abstract class EntityHuman extends EntityLiving {
// CraftBukkit end
if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
this.b = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.server = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
}
this.foodData.a(nbttagcompound);
@ -518,10 +518,10 @@ public abstract class EntityHuman extends EntityLiving {
nbttagcompound.setFloat("XpP", this.exp);
nbttagcompound.setInt("XpLevel", this.expLevel);
nbttagcompound.setInt("XpTotal", this.expTotal);
if (this.b != null) {
nbttagcompound.setInt("SpawnX", this.b.x);
nbttagcompound.setInt("SpawnY", this.b.y);
nbttagcompound.setInt("SpawnZ", this.b.z);
if (this.server != null) {
nbttagcompound.setInt("SpawnX", this.server.x);
nbttagcompound.setInt("SpawnY", this.server.y);
nbttagcompound.setInt("SpawnZ", this.server.z);
nbttagcompound.setString("SpawnWorld", spawnWorld); // CraftBukkit - fixes bed spawns for multiworld worlds
}
@ -746,7 +746,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
public void f(Entity entity) {
public void attack(Entity entity) {
int i = this.inventory.a(entity);
if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
@ -871,8 +871,8 @@ public abstract class EntityHuman extends EntityLiving {
}
}
public boolean U() {
return !this.sleeping && super.U();
public boolean inBlock() {
return !this.sleeping && super.inBlock();
}
public EnumBedResult a(int i, int j, int k) {
@ -1060,15 +1060,15 @@ public abstract class EntityHuman extends EntityLiving {
public void a(String s) {}
public ChunkCoordinates getBed() {
return this.b;
return this.server;
}
public void a(ChunkCoordinates chunkcoordinates) {
if (chunkcoordinates != null) {
this.b = new ChunkCoordinates(chunkcoordinates);
this.server = new ChunkCoordinates(chunkcoordinates);
this.spawnWorld = this.world.worldData.name; // CraftBukkit
} else {
this.b = null;
this.server = null;
}
}
@ -1113,13 +1113,13 @@ public abstract class EntityHuman extends EntityLiving {
int i;
if (this.a(Material.WATER)) {
i = Math.round(MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.q, i);
this.c(0.015F * (float) i * 0.01F);
}
} else if (this.aK()) {
i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F);
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
this.c(0.015F * (float) i * 0.01F);
@ -1129,7 +1129,7 @@ public abstract class EntityHuman extends EntityLiving {
this.a(StatisticList.o, (int) Math.round(d1 * 100.0D));
}
} else if (this.onGround) {
i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F);
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.l, i);
if (this.isSprinting()) {
@ -1139,7 +1139,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
} else {
i = Math.round(MathHelper.a(d0 * d0 + d2 * d2) * 100.0F);
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 25) {
this.a(StatisticList.p, i);
}
@ -1149,7 +1149,7 @@ public abstract class EntityHuman extends EntityLiving {
private void h(double d0, double d1, double d2) {
if (this.vehicle != null) {
int i = Math.round(MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
int i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
if (this.vehicle instanceof EntityMinecart) {
@ -1257,17 +1257,17 @@ public abstract class EntityHuman extends EntityLiving {
return true;
}
protected int a(EntityHuman entityhuman) {
protected int getExpValue(EntityHuman entityhuman) {
int i = this.expLevel * 7;
return i > 100 ? 100 : i;
}
protected boolean ac() {
protected boolean alwaysGivesExp() {
return true;
}
public String ad() {
public String getLocalizedName() {
return this.name;
}

View file

@ -9,7 +9,7 @@ public class EntityItem extends Entity {
public ItemStack itemStack;
private int e;
public int b = 0;
public int age = 0;
public int pickupDelay;
private int f = 5;
public float d = (float) (Math.random() * 3.141592653589793D * 2.0D);
@ -84,11 +84,11 @@ public class EntityItem extends Entity {
}
++this.e;
++this.b;
if (this.b >= 6000) {
++this.age;
if (this.age >= 6000) {
// CraftBukkit start
if(CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.b = 0;
if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
return;
}
// CraftBukkit end
@ -116,13 +116,13 @@ public class EntityItem extends Entity {
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Health", (short) ((byte) this.f));
nbttagcompound.setShort("Age", (short) this.b);
nbttagcompound.setShort("Age", (short) this.age);
nbttagcompound.setCompound("Item", this.itemStack.b(new NBTTagCompound()));
}
public void a(NBTTagCompound nbttagcompound) {
this.f = nbttagcompound.getShort("Health") & 255;
this.b = nbttagcompound.getShort("Age");
this.age = nbttagcompound.getShort("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
this.itemStack = ItemStack.a(nbttagcompound1);
@ -179,7 +179,7 @@ public class EntityItem extends Entity {
}
}
public String ad() {
public String getLocalizedName() {
return LocaleI18n.a("item." + this.itemStack.k());
}
}

View file

@ -59,8 +59,8 @@ public abstract class EntityLiving extends Entity {
public float aE;
public float aF;
public EntityHuman killer = null; // CraftBukkit - prot to pub
protected int aH = 0;
protected EntityLiving aI = null;
protected int lastDamageByPlayerTime = 0;
protected EntityLiving lastDamager = null;
public int aJ = 0;
public int aK = 0;
protected HashMap effects = new HashMap();
@ -128,7 +128,7 @@ public abstract class EntityLiving extends Entity {
}
public EntityLiving aj() {
return this.aI;
return this.lastDamager;
}
public int ak() {
@ -177,7 +177,7 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit start - don't inline the damage, perform it with an event
if (this.isAlive() && this.U()) {
if (this.isAlive() && this.inBlock()) {
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.SUFFOCATION, 1);
this.world.getServer().getPluginManager().callEvent(event);
@ -238,8 +238,8 @@ public abstract class EntityLiving extends Entity {
this.an();
}
if (this.aH > 0) {
--this.aH;
if (this.lastDamageByPlayerTime > 0) {
--this.lastDamageByPlayerTime;
} else {
this.killer = null;
}
@ -255,9 +255,9 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit start
public int getExpReward() {
int exp = this.a(this.killer);
int exp = this.getExpValue(this.killer);
if (!this.world.isStatic && (this.aH > 0 || this.ac()) && !this.l()) {
if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) {
return exp;
} else {
return 0;
@ -273,7 +273,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit start - update getExpReward() above if the removed if() changes!
i = expToDrop;
while (i > 0) {
int j = EntityExperienceOrb.b(i);
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
@ -297,11 +297,11 @@ public abstract class EntityLiving extends Entity {
return i - 1;
}
protected int a(EntityHuman entityhuman) {
protected int getExpValue(EntityHuman entityhuman) {
return this.aA;
}
protected boolean ac() {
protected boolean alwaysGivesExp() {
return false;
}
@ -339,7 +339,7 @@ public abstract class EntityLiving extends Entity {
this.d();
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f = MathHelper.a(d0 * d0 + d1 * d1);
float f = MathHelper.sqrt(d0 * d0 + d1 * d1);
float f1 = this.V;
float f2 = 0.0F;
@ -436,11 +436,11 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit start - delegate so we can handle providing a reason for health being regained
public void d(int i) {
d(i, RegainReason.CUSTOM);
public void heal(int i) {
heal(i, RegainReason.CUSTOM);
}
public void d(int i, RegainReason regainReason) {
public void heal(int i, RegainReason regainReason) {
if (this.health > 0) {
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), i, regainReason);
this.world.getServer().getPluginManager().callEvent(event);
@ -505,13 +505,13 @@ public abstract class EntityLiving extends Entity {
if (entity != null) {
if (entity instanceof EntityHuman) {
this.aH = 60;
this.lastDamageByPlayerTime = 60;
this.killer = (EntityHuman) entity;
} else if (entity instanceof EntityWolf) {
EntityWolf entitywolf = (EntityWolf) entity;
if (entitywolf.isTamed()) {
this.aH = 60;
this.lastDamageByPlayerTime = 60;
this.killer = null;
}
}
@ -552,7 +552,7 @@ public abstract class EntityLiving extends Entity {
}
private float v() {
return this.l() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
public int P() {
@ -611,7 +611,7 @@ public abstract class EntityLiving extends Entity {
public void a(Entity entity, int i, double d0, double d1) {
this.ce = true;
float f = MathHelper.a(d0 * d0 + d1 * d1);
float f = MathHelper.sqrt(d0 * d0 + d1 * d1);
float f1 = 0.4F;
this.motX /= 2.0D;
@ -644,8 +644,8 @@ public abstract class EntityLiving extends Entity {
i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel(((EntityHuman) entity).inventory);
}
if (!this.l()) {
this.dropDeathLoot(this.aH > 0, i);
if (!this.isBaby()) {
this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
}
}
@ -653,7 +653,7 @@ public abstract class EntityLiving extends Entity {
}
protected void dropDeathLoot(boolean flag, int i) {
int j = this.e();
int j = this.getLootId();
// CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
@ -674,7 +674,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
protected int e() {
protected int getLootId() {
return 0;
}
@ -804,7 +804,7 @@ public abstract class EntityLiving extends Entity {
this.aD = this.aE;
d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f6 = MathHelper.a(d0 * d0 + d1 * d1) * 4.0F;
float f6 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
if (f6 > 1.0F) {
f6 = 1.0F;
@ -1047,8 +1047,8 @@ public abstract class EntityLiving extends Entity {
protected void av() {
++this.aV;
this.au();
if (this.aI != null && !this.aI.isAlive()) {
this.aI = null;
if (this.lastDamager != null && !this.lastDamager.isAlive()) {
this.lastDamager = null;
}
this.goalSelector.a();
@ -1116,7 +1116,7 @@ public abstract class EntityLiving extends Entity {
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.y());
}
double d3 = (double) MathHelper.a(d0 * d0 + d1 * d1);
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
float f2 = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = (float) (-(Math.atan2(d2, d3) * 180.0D / 3.1415927410125732D));
@ -1156,7 +1156,7 @@ public abstract class EntityLiving extends Entity {
public void ay() {}
public boolean g() {
public boolean canSpawn() {
return this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
}
@ -1329,11 +1329,11 @@ public abstract class EntityLiving extends Entity {
return f;
}
public void a_(double d0, double d1, double d2) {
public void enderTeleportTo(double d0, double d1, double d2) {
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
}
public boolean l() {
public boolean isBaby() {
return false;
}

View file

@ -12,7 +12,7 @@ public class EntityMagmaCube extends EntitySlime {
this.al = 0.2F;
}
public boolean g() {
public boolean canSpawn() {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
}
@ -32,14 +32,14 @@ public class EntityMagmaCube extends EntitySlime {
return new EntityMagmaCube(this.world);
}
protected int e() {
protected int getLootId() {
return Item.MAGMA_CREAM.id;
}
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.e();
int j = this.getLootId();
if (j > 0 && this.getSize() > 1) {
int k = this.random.nextInt(4) - 2;
@ -55,7 +55,7 @@ public class EntityMagmaCube extends EntitySlime {
// CraftBukkit end
}
public boolean A() {
public boolean isBurning() {
return false;
}

View file

@ -407,7 +407,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ *= 0.996999979019165D;
} else {
if (this.type == 2) {
d17 = (double) MathHelper.a(this.b * this.b + this.c * this.c);
d17 = (double) MathHelper.sqrt(this.b * this.b + this.c * this.c);
if (d17 > 0.01D) {
this.b /= d17;
this.c /= d17;
@ -456,7 +456,7 @@ public class EntityMinecart extends Entity implements IInventory {
double d21;
if (this.type == 2) {
d21 = (double) MathHelper.a(this.b * this.b + this.c * this.c);
d21 = (double) MathHelper.sqrt(this.b * this.b + this.c * this.c);
if (d21 > 0.01D && this.motX * this.motX + this.motZ * this.motZ > 0.0010D) {
this.b /= d21;
this.c /= d21;
@ -735,7 +735,7 @@ public class EntityMinecart extends Entity implements IInventory {
// CraftBukkit - Collision
if (d2 >= 9.999999747378752E-5D && !collisionEvent.isCollisionCancelled()) {
d2 = (double) MathHelper.a(d2);
d2 = (double) MathHelper.sqrt(d2);
d0 /= d2;
d1 /= d2;
double d3 = 1.0D / d2;

View file

@ -55,10 +55,10 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.target = null;
this.aI = null;
this.lastDamager = null;
} else {
this.target = ((CraftEntity) event.getTarget()).getHandle();
this.aI = this.target instanceof EntityLiving ? (EntityLiving) this.target : null;
this.lastDamager = this.target instanceof EntityLiving ? (EntityLiving) this.target : null;
}
}
// CraftBukkit end
@ -146,7 +146,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
}
public boolean g() {
return this.z() && super.g();
public boolean canSpawn() {
return this.z() && super.canSpawn();
}
}

View file

@ -55,8 +55,8 @@ public class EntityPig extends EntityAnimal {
}
}
protected int e() {
return this.A() ? Item.GRILLED_PORK.id : Item.PORK.id;
protected int getLootId() {
return this.isBurning() ? Item.GRILLED_PORK.id : Item.PORK.id;
}
public boolean hasSaddle() {

View file

@ -36,7 +36,7 @@ public class EntityPigZombie extends EntityZombie {
super.y_();
}
public boolean g() {
public boolean canSpawn() {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox);
}
@ -135,7 +135,7 @@ public class EntityPigZombie extends EntityZombie {
// CraftBukkit end
}
protected int e() {
protected int getLootId() {
return Item.ROTTEN_FLESH.id;
}
}

View file

@ -18,7 +18,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
public class EntityPlayer extends EntityHuman implements ICrafting {
public NetServerHandler netServerHandler;
public MinecraftServer b;
public MinecraftServer server;
public ItemInWorldManager itemInWorldManager;
public double d;
public double e;
@ -28,12 +28,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private int cg = -99999999;
private boolean ch = true;
public int lastSentExp = -99999999; // CraftBukkit - priv to pub
public int cj = 60; // CraftBukkit - private to public; temporary until we get an API out
public int invulnerableTicks = 60; // CraftBukkit - private to public; temporary until we get an API out
private ItemStack[] ck = new ItemStack[] { null, null, null, null, null};
private int cl = 0;
public boolean h;
public int ping;
public boolean j = false;
public boolean viewingCredits = false;
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world);
@ -51,7 +51,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.b = minecraftserver;
this.server = minecraftserver;
this.bP = 0.0F;
this.name = s;
this.height = 0.0F;
@ -135,14 +135,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void y_() {
this.itemInWorldManager.c();
--this.cj;
--this.invulnerableTicks;
this.activeContainer.a();
for (int i = 0; i < 5; ++i) {
ItemStack itemstack = this.c(i);
if (itemstack != this.ck[i]) {
this.b.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
this.server.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
this.ck[i] = itemstack;
}
}
@ -168,12 +168,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, damagesource.a(this));
PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, damagesource.getLocalizedDeathMessage(this));
String deathMessage = event.getDeathMessage();
if (deathMessage != null && deathMessage.length() > 0) {
this.b.serverConfigurationManager.sendAll(new Packet3Chat(event.getDeathMessage()));
this.server.serverConfigurationManager.sendAll(new Packet3Chat(event.getDeathMessage()));
}
// CraftBukkit start - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
@ -190,7 +190,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.cj > 0) {
if (this.invulnerableTicks > 0) {
return false;
} else {
// CraftBukkit - this.b.pvpMode -> this.world.pvpMode
@ -215,11 +215,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
protected boolean z() {
return this.b.pvpMode;
return this.server.pvpMode;
}
public void d(int i) {
super.d(i);
public void heal(int i) {
super.heal(i);
}
public void a(boolean flag) {
@ -228,7 +228,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
if (itemstack != null && Item.byId[itemstack.id].n_() && this.netServerHandler.b() <= 2) {
if (itemstack != null && Item.byId[itemstack.id].n_() && this.netServerHandler.lowPriorityCount() <= 2) {
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
if (packet != null) {
@ -243,12 +243,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (chunkcoordintpair != null) {
boolean flag1 = false;
if (this.netServerHandler.b() + ChunkCompressionThread.getPlayerQueueSize(this) < 4) { // CraftBukkit - Add check against Chunk Packets in the ChunkCompressionThread.
// CraftBukkit - Add check against Chunk Packets in the ChunkCompressionThread.
if (this.netServerHandler.lowPriorityCount() + ChunkCompressionThread.getPlayerQueueSize(this) < 4) {
flag1 = true;
}
if (flag1) {
WorldServer worldserver = this.b.getWorldServer(this.dimension);
WorldServer worldserver = this.server.getWorldServer(this.dimension);
this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
this.netServerHandler.sendPacket(new Packet51MapChunk(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, 16, worldserver.height, 16, worldserver));
@ -262,7 +263,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
if (this.J) {
//if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
//if (this.server.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
if (this.activeContainer != this.defaultContainer) {
this.closeInventory();
}
@ -283,7 +284,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
b0 = -1;
}
this.b.serverConfigurationManager.changeDimension(this, b0);
this.server.serverConfigurationManager.changeDimension(this, b0);
this.lastSentExp = -1;
this.cf = -1;
this.cg = -1;
@ -324,7 +325,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.dimension == 1 && i == 1) {
this.a((Statistic) AchievementList.C);
this.world.kill(this);
this.j = true;
this.viewingCredits = true;
this.netServerHandler.sendPacket(new Packet70Bed(4, 0));
} else {
this.a((Statistic) AchievementList.B);
@ -336,7 +337,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// CraftBukkit end */
this.b.serverConfigurationManager.changeDimension(this, 1);
this.server.serverConfigurationManager.changeDimension(this, 1);
this.lastSentExp = -1;
this.cf = -1;
this.cg = -1;
@ -355,7 +356,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void receive(Entity entity, int i) {
if (!entity.dead) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
EntityTracker entitytracker = this.server.getTracker(this.dimension);
if (entity instanceof EntityItem) {
entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
@ -378,7 +379,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (!this.t) {
this.u = -1;
this.t = true;
EntityTracker entitytracker = this.b.getTracker(this.dimension);
EntityTracker entitytracker = this.server.getTracker(this.dimension);
entitytracker.a(this, new Packet18ArmAnimation(this, 1));
}
@ -390,7 +391,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
EnumBedResult enumbedresult = super.a(i, j, k);
if (enumbedresult == EnumBedResult.OK) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
EntityTracker entitytracker = this.server.getTracker(this.dimension);
Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
entitytracker.a(this, packet17entitylocationaction);
@ -403,7 +404,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(boolean flag, boolean flag1, boolean flag2) {
if (this.isSleeping()) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
EntityTracker entitytracker = this.server.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
}
@ -574,7 +575,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(ItemStack itemstack, int i) {
super.a(itemstack, i);
if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().d(itemstack) == EnumAnimation.b) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
EntityTracker entitytracker = this.server.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
}
@ -595,18 +596,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.netServerHandler.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
}
public void a_(double d0, double d1, double d2) {
public void enderTeleportTo(double d0, double d1, double d2) {
this.netServerHandler.a(d0, d1, d2, this.yaw, this.pitch);
}
public void c(Entity entity) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
EntityTracker entitytracker = this.server.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
}
public void d(Entity entity) {
EntityTracker entitytracker = this.b.getTracker(this.dimension);
EntityTracker entitytracker = this.server.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
}

View file

@ -61,7 +61,7 @@ public abstract class EntityProjectile extends Entity {
}
public void a(double d0, double d1, double d2, float f, float f1) {
float f2 = MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
d0 /= (double) f2;
d1 /= (double) f2;
@ -75,7 +75,7 @@ public abstract class EntityProjectile extends Entity {
this.motX = d0;
this.motY = d1;
this.motZ = d2;
float f3 = MathHelper.a(d0 * d0 + d2 * d2);
float f3 = MathHelper.sqrt(d0 * d0 + d2 * d2);
this.lastYaw = this.yaw = (float) (Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D);
this.lastPitch = this.pitch = (float) (Math.atan2(d1, (double) f3) * 180.0D / 3.1415927410125732D);
@ -165,7 +165,7 @@ public abstract class EntityProjectile extends Entity {
this.locX += this.motX;
this.locY += this.motY;
this.locZ += this.motZ;
float f1 = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
float f1 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.yaw = (float) (Math.atan2(this.motX, this.motZ) * 180.0D / 3.1415927410125732D);

View file

@ -35,7 +35,7 @@ public class EntitySheep extends EntityAnimal {
// CraftBukkit end
}
protected int e() {
protected int getLootId() {
return Block.WOOL.id;
}
@ -58,7 +58,7 @@ public class EntitySheep extends EntityAnimal {
int j;
int k;
if (!this.E() && this.b <= 0 && (this.l() && this.random.nextInt(50) == 0 || this.random.nextInt(1000) == 0)) {
if (!this.E() && this.b <= 0 && (this.isBaby() && this.random.nextInt(50) == 0 || this.random.nextInt(1000) == 0)) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
@ -84,7 +84,7 @@ public class EntitySheep extends EntityAnimal {
if (flag) {
this.setSheared(false);
if (this.l()) {
if (this.isBaby()) {
int l = this.getAge() + 1200;
if (l > 0) {
@ -104,7 +104,7 @@ public class EntitySheep extends EntityAnimal {
public boolean b(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.l()) {
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.isBaby()) {
if (!this.world.isStatic) {
this.setSheared(true);
int i = 1 + this.random.nextInt(3);

View file

@ -74,7 +74,7 @@ public class EntitySkeleton extends EntityMonster {
if (this.attackTicks == 0) {
EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F);
double d2 = entity.locY + (double) entity.y() - 0.699999988079071D - entityarrow.locY;
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entityarrow);
@ -95,7 +95,7 @@ public class EntitySkeleton extends EntityMonster {
super.a(nbttagcompound);
}
protected int e() {
protected int getLootId() {
return Item.ARROW.id;
}

View file

@ -190,14 +190,14 @@ public class EntitySlime extends EntityLiving implements IMonster {
return "mob.slime";
}
protected int e() {
protected int getLootId() {
return this.getSize() == 1 ? Item.SLIME_BALL.id : 0;
}
public boolean g() {
public boolean canSpawn() {
Chunk chunk = this.world.getChunkAtWorldCoords(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
return (this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.g() : false;
return (this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.canSpawn() : false;
}
protected float o() {

View file

@ -66,7 +66,7 @@ public class EntitySnowman extends EntityGolem {
if (this.attackTicks == 0) {
EntitySnowball entitysnowball = new EntitySnowball(this.world, this);
double d2 = entity.locY + (double) entity.y() - 1.100000023841858D - entitysnowball.locY;
float f1 = MathHelper.a(d0 * d0 + d1 * d1) * 0.2F;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entitysnowball);
@ -87,7 +87,7 @@ public class EntitySnowman extends EntityGolem {
super.a(nbttagcompound);
}
protected int e() {
protected int getLootId() {
return Item.SNOW_BALL.id;
}

View file

@ -91,7 +91,7 @@ public class EntitySpider extends EntityMonster {
if (this.onGround) {
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
float f2 = MathHelper.a(d0 * d0 + d1 * d1);
float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1);
this.motX = d0 / (double) f2 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D;
this.motZ = d1 / (double) f2 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D;
@ -111,7 +111,7 @@ public class EntitySpider extends EntityMonster {
super.a(nbttagcompound);
}
protected int e() {
protected int getLootId() {
return Item.STRING.id;
}

View file

@ -54,7 +54,7 @@ public class EntitySquid extends EntityWaterAnimal {
return 0.4F;
}
protected int e() {
protected int getLootId() {
return 0;
}
@ -117,7 +117,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.motZ = (double) (this.q * this.l);
}
f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.V += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.V) * 0.1F;
this.yaw = this.V;
this.c += 3.1415927F * this.n * 1.5F;
@ -154,7 +154,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.au();
}
public boolean g() {
return this.locY > 45.0D && this.locY < (double) this.world.seaLevel && super.g();
public boolean canSpawn() {
return this.locY > 45.0D && this.locY < (double) this.world.seaLevel && super.canSpawn();
}
}

View file

@ -11,11 +11,11 @@ public class EntityTracker {
private IntHashMap trackedEntities = new IntHashMap();
private MinecraftServer c;
private int d;
private World e; // CraftBukkit - change type
private World world; // CraftBukkit - change type
public EntityTracker(MinecraftServer minecraftserver, World i) { // CraftBukkit - change method signature
this.c = minecraftserver;
this.e = i;
this.world = i;
this.d = minecraftserver.serverConfigurationManager.a();
}
@ -94,7 +94,7 @@ public class EntityTracker {
this.a.add(entitytrackerentry);
this.trackedEntities.a(entity.id, entitytrackerentry);
entitytrackerentry.scanPlayers(this.e.players); // CraftBukkit
entitytrackerentry.scanPlayers(this.world.players); // CraftBukkit
}
}
@ -127,7 +127,7 @@ public class EntityTracker {
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
entitytrackerentry.track(this.e.players); // CraftBukkit
entitytrackerentry.track(this.world.players); // CraftBukkit
if (entitytrackerentry.m && entitytrackerentry.tracker instanceof EntityPlayer) {
arraylist.add((EntityPlayer) entitytrackerentry.tracker);
}
@ -152,7 +152,7 @@ public class EntityTracker {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.a(entity.id);
if (entitytrackerentry != null) {
entitytrackerentry.a(packet);
entitytrackerentry.broadcast(packet);
}
}
@ -161,7 +161,7 @@ public class EntityTracker {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.a(entity.id);
if (entitytrackerentry != null) {
entitytrackerentry.b(packet);
entitytrackerentry.broadcastIncludingSelf(packet);
}
}

View file

@ -100,18 +100,18 @@ public class EntityTrackerEntry {
this.i = this.tracker.motX;
this.j = this.tracker.motY;
this.k = this.tracker.motZ;
this.a((Packet) (new Packet28EntityVelocity(this.tracker.id, this.i, this.j, this.k)));
this.broadcast(new Packet28EntityVelocity(this.tracker.id, this.i, this.j, this.k));
}
}
if (object != null) {
this.a((Packet) object);
this.broadcast((Packet) object);
}
DataWatcher datawatcher = this.tracker.getDataWatcher();
if (datawatcher.a()) {
this.b((Packet) (new Packet40EntityMetadata(this.tracker.id, datawatcher)));
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
}
if (flag) {
@ -146,14 +146,14 @@ public class EntityTrackerEntry {
}
if (!cancelled) {
this.b((Packet) (new Packet28EntityVelocity(this.tracker)));
this.broadcastIncludingSelf((Packet) (new Packet28EntityVelocity(this.tracker)));
}
// CraftBukkit end
this.tracker.velocityChanged = false;
}
}
public void a(Packet packet) {
public void broadcast(Packet packet) {
Iterator iterator = this.trackedPlayers.iterator();
while (iterator.hasNext()) {
@ -163,15 +163,15 @@ public class EntityTrackerEntry {
}
}
public void b(Packet packet) {
this.a(packet);
public void broadcastIncludingSelf(Packet packet) {
this.broadcast(packet);
if (this.tracker instanceof EntityPlayer) {
((EntityPlayer) this.tracker).netServerHandler.sendPacket(packet);
}
}
public void a() {
this.a((Packet) (new Packet29DestroyEntity(this.tracker.id)));
this.broadcast(new Packet29DestroyEntity(this.tracker.id));
}
public void a(EntityPlayer entityplayer) {
@ -235,7 +235,8 @@ public class EntityTrackerEntry {
private Packet b() {
if (this.tracker.dead) {
System.out.println("Fetching addPacket for removed entity: " + this.tracker.getBukkitEntity().toString()); // CraftBukkit - add some information
// CraftBukkit - add some information
System.out.println("Fetching addPacket for removed entity: " + this.tracker.getBukkitEntity().toString());
}
if (this.tracker instanceof EntityItem) {
@ -331,15 +332,15 @@ public class EntityTrackerEntry {
if (this.tracker instanceof EntityFallingBlock) {
EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
if (entityfallingblock.a == Block.SAND.id) {
if (entityfallingblock.id == Block.SAND.id) {
return new Packet23VehicleSpawn(this.tracker, 70);
}
if (entityfallingblock.a == Block.GRAVEL.id) {
if (entityfallingblock.id == Block.GRAVEL.id) {
return new Packet23VehicleSpawn(this.tracker, 71);
}
if (entityfallingblock.a == Block.DRAGON_EGG.id) {
if (entityfallingblock.id == Block.DRAGON_EGG.id) {
return new Packet23VehicleSpawn(this.tracker, 74);
}
}

View file

@ -88,7 +88,7 @@ public class EntityWolf extends EntityAnimal {
return 0.4F;
}
protected int e() {
protected int getLootId() {
return -1;
}
@ -324,7 +324,7 @@ public class EntityWolf extends EntityAnimal {
if (this.onGround) {
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
float f1 = MathHelper.a(d0 * d0 + d1 * d1);
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1);
this.motX = d0 / (double) f1 * 0.5D * 0.800000011920929D + this.motX * 0.20000000298023224D;
this.motZ = d1 / (double) f1 * 0.5D * 0.800000011920929D + this.motZ * 0.20000000298023224D;
@ -388,7 +388,7 @@ public class EntityWolf extends EntityAnimal {
if (itemfood.q() && this.datawatcher.getInt(18) < 20) {
--itemstack.count;
this.d(itemfood.o(), RegainReason.EATING); // CraftBukkit
this.heal(itemfood.getNutrition(), RegainReason.EATING); // CraftBukkit
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}

View file

@ -59,7 +59,7 @@ public class EntityZombie extends EntityMonster {
return "mob.zombiedeath";
}
protected int e() {
protected int getLootId() {
return Item.ROTTEN_FLESH.id;
}

View file

@ -109,7 +109,7 @@ public class Explosion {
d0 = entity.locX - this.posX;
d1 = entity.locY - this.posY;
d2 = entity.locZ - this.posZ;
double d8 = (double) MathHelper.a(d0 * d0 + d1 * d1 + d2 * d2);
double d8 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); // CraftBukkit
d0 /= d8;
d1 /= d8;
@ -223,7 +223,7 @@ public class Explosion {
double d3 = d0 - this.posX;
double d4 = d1 - this.posY;
double d5 = d2 - this.posZ;
double d6 = (double) MathHelper.a(d3 * d3 + d4 * d4 + d5 * d5);
double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
d3 /= d6;
d4 /= d6;

View file

@ -17,13 +17,13 @@ public class FoodMetaData {
public FoodMetaData() {}
public void a(int i, float f) {
public void eat(int i, float f) {
this.foodLevel = Math.min(i + this.foodLevel, 20);
this.saturationLevel = Math.min(this.saturationLevel + (float) i * f * 2.0F, (float) this.foodLevel);
}
public void a(ItemFood itemfood) {
this.a(itemfood.o(), itemfood.p());
this.eat(itemfood.getNutrition(), itemfood.getSaturationModifier());
}
public void a(EntityHuman entityhuman) {
@ -50,7 +50,7 @@ public class FoodMetaData {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason.
entityhuman.d(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
entityhuman.heal(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
this.foodTickTimer = 0;
}
} else if (this.foodLevel <= 0) {

View file

@ -58,7 +58,7 @@ public class ItemBlock extends Item {
return false;
} else if (j == world.height - 1 && Block.byId[this.id].material.isBuildable()) {
return false;
} else if (world.a(this.id, i, j, k, false, l)) {
} else if (world.mayPlace(this.id, i, j, k, false, l)) {
Block block = Block.byId[this.id];
// CraftBukkit start - This executes the placement of the block
@ -136,7 +136,7 @@ public class ItemBlock extends Item {
return Block.byId[this.id].n();
}
public String b() {
public String getName() {
return Block.byId[this.id].n();
}
}

View file

@ -36,7 +36,7 @@ public class ItemDoor extends Item {
int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
// CraftBukkit start
if (a(world, i, j, k, i1, block, entityhuman)) {
if (place(world, i, j, k, i1, block, entityhuman)) {
--itemstack.count;
return true;
}
@ -49,12 +49,12 @@ public class ItemDoor extends Item {
}
}
public static void a(World world, int i, int j, int k, int l, Block block) {
public static void place(World world, int i, int j, int k, int l, Block block) {
// CraftBukkit start
a(world, i, j, k, l, block, null);
place(world, i, j, k, l, block, null);
}
public static boolean a(World world, int i, int j, int k, int l, Block block, EntityHuman entityhuman) {
public static boolean place(World world, int i, int j, int k, int l, Block block, EntityHuman entityhuman) {
// CraftBukkit end
byte b0 = 0;
byte b1 = 0;

View file

@ -10,13 +10,13 @@ public class ItemDye extends Item {
public ItemDye(int i) {
super(i);
this.a(true);
this.f(0);
this.setMaxDurability(0);
}
public String a(ItemStack itemstack) {
int i = MathHelper.a(itemstack.getData(), 0, 15);
return super.b() + "." + a[i];
return super.getName() + "." + a[i];
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
@ -30,7 +30,7 @@ public class ItemDye extends Item {
if (!world.isStatic) {
// CraftBukkit start
Player player = (entityhuman instanceof EntityPlayer) ? (Player)entityhuman.getBukkitEntity() : null;
((BlockSapling) Block.SAPLING).b(world, i, j, k, world.random, true, player, itemstack);
((BlockSapling) Block.SAPLING).grow(world, i, j, k, world.random, true, player, itemstack);
//--itemstack.count; - called later if the bonemeal attempt was succesful
// CraftBukkit end
}
@ -42,7 +42,7 @@ public class ItemDye extends Item {
// CraftBukkit start
if (!world.isStatic) {
Player player = (entityhuman instanceof EntityPlayer) ? (Player)entityhuman.getBukkitEntity() : null;
((BlockMushroom) Block.byId[i1]).b(world, i, j, k, world.random, true, player, itemstack);
((BlockMushroom) Block.byId[i1]).grow(world, i, j, k, world.random, true, player, itemstack);
//--itemstack.count; - called later if the bonemeal attempt was succesful
// CraftBukkit end
}

View file

@ -6,7 +6,7 @@ public class ItemFishingRod extends Item {
public ItemFishingRod(int i) {
super(i);
this.f(64);
this.setMaxDurability(64);
this.e(1);
}

View file

@ -13,7 +13,7 @@ public class ItemFlintAndSteel extends Item {
public ItemFlintAndSteel(int i) {
super(i);
this.maxStackSize = 1;
this.f(64);
this.setMaxDurability(64);
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {

View file

@ -31,11 +31,11 @@ public class ItemFood extends Item {
// CraftBukkit start
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.o() + entityhuman.getFoodData().foodLevel, 20));
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.getNutrition() + entityhuman.getFoodData().foodLevel, 20));
entityhuman.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.p());
entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, this.getSaturationModifier());
}
// CraftBukkit end
@ -62,11 +62,11 @@ public class ItemFood extends Item {
return itemstack;
}
public int o() {
public int getNutrition() {
return this.b;
}
public float p() {
public float getSaturationModifier() {
return this.bS;
}

View file

@ -11,7 +11,7 @@ public class ItemHoe extends Item {
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial) {
super(i);
this.maxStackSize = 1;
this.f(enumtoolmaterial.a());
this.setMaxDurability(enumtoolmaterial.a());
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {

View file

@ -54,7 +54,7 @@ public class ItemInWorldManager {
return this.c;
}
public boolean b() {
public boolean isCreative() {
return this.c == 1;
}
@ -78,7 +78,7 @@ public class ItemInWorldManager {
if (f >= 1.0F) {
this.j = false;
this.c(this.k, this.l, this.m);
this.breakBlock(this.k, this.l, this.m);
}
} else {
this.j = false;
@ -88,21 +88,23 @@ public class ItemInWorldManager {
public void dig(int i, int j, int k, int l) {
// this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
// CraftBukkit start
// CraftBukkit
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
if (this.b()) {
if (this.isCreative()) {
// CraftBukkit start
if (event.isCancelled()) {
// Let the client know the block still exists
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
return;
}
this.c(i, j, k);
// CraftBukkit end
this.breakBlock(i, j, k);
} else {
this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
int i1 = this.world.getTypeId(i, j, k);
// Swings at air do *NOT* exist.
// CraftBukkit start - Swings at air do *NOT* exist.
if (i1 <= 0) {
return;
}
@ -118,7 +120,7 @@ public class ItemInWorldManager {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
} else {
Block.byId[i1].b(this.world, i, j, k, this.player);
Block.byId[i1].attack(this.world, i, j, k, this.player);
// Allow fire punching to be blocked
this.world.douseFire((EntityHuman) null, i, j, k, l);
}
@ -146,7 +148,7 @@ public class ItemInWorldManager {
if (toolDamage >= 1.0F) {
// CraftBukkit end
this.c(i, j, k);
this.breakBlock(i, j, k);
} else {
this.f = i;
this.g = j;
@ -166,7 +168,7 @@ public class ItemInWorldManager {
float f = block.getDamage(this.player) * (float) (l + 1);
if (f >= 0.7F) {
this.c(i, j, k);
this.breakBlock(i, j, k);
} else if (!this.j) {
this.j = true;
this.k = i;
@ -196,7 +198,7 @@ public class ItemInWorldManager {
return flag;
}
public boolean c(int i, int j, int k) {
public boolean breakBlock(int i, int j, int k) {
// CraftBukkit start
if (this.player instanceof EntityPlayer) {
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(i, j, k);
@ -218,7 +220,7 @@ public class ItemInWorldManager {
this.world.a(this.player, 2001, i, j, k, l + this.world.getData(i, j, k) * 256);
boolean flag = this.b(i, j, k);
if (this.b()) {
if (this.isCreative()) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
ItemStack itemstack = this.player.Q();
@ -249,7 +251,7 @@ public class ItemInWorldManager {
return false;
} else {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1;
if (this.b()) {
if (this.isCreative()) {
itemstack1.count = i;
itemstack1.setData(j);
}
@ -288,7 +290,7 @@ public class ItemInWorldManager {
result = itemstack.placeItem(entityhuman, world, i, j, k, l);
// The item count should not decrement in Creative mode.
if (this.b()) {
if (this.isCreative()) {
itemstack.setData(j1);
itemstack.count = k1;
}

View file

@ -52,7 +52,7 @@ public class ItemReed extends Item {
} else if (itemstack.count == 0) {
return false;
} else {
if (world.a(this.id, i, j, k, false, l)) {
if (world.mayPlace(this.id, i, j, k, false, l)) {
Block block = Block.byId[this.id];
// CraftBukkit start - This executes the placement of the block

View file

@ -90,7 +90,7 @@ public final class ItemStack {
}
public float a(Block block) {
return this.getItem().a(this, block);
return this.getItem().getDestroySpeed(this, block);
}
public ItemStack a(World world, EntityHuman entityhuman) {
@ -252,7 +252,7 @@ public final class ItemStack {
}
public String toString() {
return this.count + "x" + Item.byId[this.id].b() + "@" + this.damage;
return this.count + "x" + Item.byId[this.id].getName() + "@" + this.damage;
}
public void a(World world, Entity entity, int i, boolean flag) {

View file

@ -63,7 +63,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
public boolean spawnNPCs;
public boolean pvpMode;
public boolean allowFlight;
public String s;
public String motd;
private RemoteStatusListener z;
private RemoteControlListener A;
@ -118,8 +118,8 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
this.spawnNPCs = this.propertyManager.getBoolean("spawn-npcs", true);
this.pvpMode = this.propertyManager.getBoolean("pvp", true);
this.allowFlight = this.propertyManager.getBoolean("allow-flight", false);
this.s = this.propertyManager.getString("motd", "A Minecraft Server");
this.s.replace('\u00a7', '$');
this.motd = this.propertyManager.getString("motd", "A Minecraft Server");
this.motd.replace('\u00a7', '$');
InetAddress inetaddress = null;
if (this.t.length() > 0) {
@ -565,7 +565,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(Event.Type.SERVER_COMMAND, this.console, servercommand.command);
this.server.getPluginManager().callEvent(event);
servercommand = new ServerCommand(event.getCommand(), servercommand.b);
servercommand = new ServerCommand(event.getCommand(), servercommand.source);
// CraftBukkit end
// this.consoleCommandHandler.handle(servercommand); // CraftBukkit - Removed its now called in server.dispatchCommand
@ -654,7 +654,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
}
public String getServerAddress() {
return this.s;
return this.motd;
}
public String getVersion() {

View file

@ -12,15 +12,15 @@ import org.bukkit.event.server.ServerListPingEvent;
public class NetLoginHandler extends NetHandler {
public static Logger a = Logger.getLogger("Minecraft");
private static Random d = new Random();
public static Logger logger = Logger.getLogger("Minecraft");
private static Random random = new Random();
public NetworkManager networkManager;
public boolean c = false;
private MinecraftServer server;
private int f = 0;
private String g = null;
private Packet1Login h = null;
private String i = Long.toString(d.nextLong(), 16); // CraftBukkit - Security fix
private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix
public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) {
this.server = minecraftserver;
@ -49,7 +49,7 @@ public class NetLoginHandler extends NetHandler {
public void disconnect(String s) {
try {
a.info("Disconnecting " + this.b() + ": " + s);
logger.info("Disconnecting " + this.getName() + ": " + s);
this.networkManager.queue(new Packet255KickDisconnect(s));
this.networkManager.d();
this.c = true;
@ -60,8 +60,8 @@ public class NetLoginHandler extends NetHandler {
public void a(Packet2Handshake packet2handshake) {
if (this.server.onlineMode) {
this.i = Long.toString(d.nextLong(), 16);
this.networkManager.queue(new Packet2Handshake(this.i));
this.loginKey = Long.toString(random.nextLong(), 16);
this.networkManager.queue(new Packet2Handshake(this.loginKey));
} else {
this.networkManager.queue(new Packet2Handshake("-"));
}
@ -92,7 +92,7 @@ public class NetLoginHandler extends NetHandler {
// entityplayer.a((World) this.server.a(entityplayer.dimension)); // CraftBukkit - set by Entity
entityplayer.itemInWorldManager.a((WorldServer) entityplayer.world);
// CraftBukkit - add world and location to 'logged in' message.
a.info(this.b() + " logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.name + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
logger.info(this.getName() + " logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.name + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
@ -130,21 +130,21 @@ public class NetLoginHandler extends NetHandler {
}
public void a(String s, Object[] aobject) {
a.info(this.b() + " lost connection");
logger.info(this.getName() + " lost connection");
this.c = true;
}
public void a(Packet254GetInfo packet254getinfo) {
if (this.networkManager.f() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
if (this.networkManager.getSocket() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
try {
// CraftBukkit start
ServerListPingEvent pingEvent = CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.s, this.server.serverConfigurationManager.getPlayerCount(), this.server.serverConfigurationManager.getMaxPlayers());
ServerListPingEvent pingEvent = CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.motd, this.server.serverConfigurationManager.getPlayerCount(), this.server.serverConfigurationManager.getMaxPlayers());
String s = pingEvent.getMotd() + "\u00A7" + this.server.serverConfigurationManager.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
// CraftBukkit end
this.networkManager.queue(new Packet255KickDisconnect(s));
this.networkManager.d();
this.server.networkListenThread.a(this.networkManager.f());
this.server.networkListenThread.a(this.networkManager.getSocket());
this.c = true;
} catch (Exception exception) {
exception.printStackTrace();
@ -155,7 +155,7 @@ public class NetLoginHandler extends NetHandler {
this.disconnect("Protocol error");
}
public String b() {
public String getName() {
return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
}
@ -164,7 +164,7 @@ public class NetLoginHandler extends NetHandler {
}
static String a(NetLoginHandler netloginhandler) {
return netloginhandler.i;
return netloginhandler.loginKey;
}
static Packet1Login a(NetLoginHandler netloginhandler, Packet1Login packet1login) {

View file

@ -36,7 +36,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
public class NetServerHandler extends NetHandler implements ICommandListener {
public static Logger a = Logger.getLogger("Minecraft");
public static Logger logger = Logger.getLogger("Minecraft");
public NetworkManager networkManager;
public boolean disconnected = false;
private MinecraftServer minecraftServer;
@ -142,7 +142,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
this.h = true;
if (!this.player.j) {
if (!this.player.viewingCredits) {
double d0;
if (!this.checkMovement) {
@ -158,7 +158,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
// If the packet contains movement information then we update the To location with the correct XYZ.
if (packet10flying.h && !(packet10flying.h && packet10flying.y == -999.0D && packet10flying.stance == -999.0D)) {
if (packet10flying.hasPos && !(packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D)) {
to.setX(packet10flying.x);
to.setY(packet10flying.y);
to.setZ(packet10flying.z);
@ -239,7 +239,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
f1 = packet10flying.pitch;
}
if (packet10flying.h && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
d5 = packet10flying.x;
d4 = packet10flying.z;
}
@ -283,18 +283,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
float f2 = this.player.yaw;
float f3 = this.player.pitch;
if (packet10flying.h && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
packet10flying.h = false;
if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
packet10flying.hasPos = false;
}
if (packet10flying.h) {
if (packet10flying.hasPos) {
d1 = packet10flying.x;
d2 = packet10flying.y;
d3 = packet10flying.z;
d4 = packet10flying.stance - packet10flying.y;
if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) {
this.disconnect("Illegal stance");
a.warning(this.player.name + " had an illegal stance: " + d4);
logger.warning(this.player.name + " had an illegal stance: " + d4);
return;
}
@ -322,7 +322,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d8 = d4 * d4 + d6 * d6 + d7 * d7;
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!");
logger.warning(this.player.name + " moved too quickly!");
this.disconnect("You moved too quickly :( (Hacking?)");
return;
}
@ -349,9 +349,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
d8 = d4 * d4 + d6 * d6 + d7 * d7;
boolean flag1 = false;
if (d8 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.b()) {
if (d8 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.isCreative()) {
flag1 = true;
a.warning(this.player.name + " moved wrongly!");
logger.warning(this.player.name + " moved wrongly!");
System.out.println("Got position " + d1 + ", " + d2 + ", " + d3);
System.out.println("Expected " + this.player.locX + ", " + this.player.locY + ", " + this.player.locZ);
}
@ -366,11 +366,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().grow((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D);
if (!this.minecraftServer.allowFlight && !this.player.itemInWorldManager.b() && !worldserver.b(axisalignedbb)) {
if (!this.minecraftServer.allowFlight && !this.player.itemInWorldManager.isCreative() && !worldserver.b(axisalignedbb)) {
if (d9 >= -0.03125D) {
++this.g;
if (this.g > 80) {
a.warning(this.player.name + " was kicked for floating too long!");
logger.warning(this.player.name + " was kicked for floating too long!");
this.disconnect("Flying is not enabled on this server");
return;
}
@ -381,7 +381,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.player.onGround = packet10flying.g;
this.minecraftServer.serverConfigurationManager.d(this.player);
if (this.player.itemInWorldManager.b()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
if (this.player.itemInWorldManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
this.player.b(this.player.locY - d0, packet10flying.g);
}
}
@ -451,7 +451,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// Else we increment the drop count and check the amount.
this.dropCount++;
if (this.dropCount >= 20) {
a.warning(this.player.name + " dropped their items too quickly!");
logger.warning(this.player.name + " dropped their items too quickly!");
this.disconnect("You dropped your items too quickly (Hacking?)");
return;
}
@ -651,7 +651,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(String s, Object[] aobject) {
if (this.disconnected) return; // CraftBukkit - rarely it would send a disconnect line twice
a.info(this.player.name + " lost connection: " + s);
logger.info(this.player.name + " lost connection: " + s);
// CraftBukkit start - we need to handle custom quit messages
String quitMessage = this.minecraftServer.serverConfigurationManager.disconnect(this.player);
if ((quitMessage != null) && (quitMessage.length() > 0)) {
@ -663,7 +663,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet packet) {
if (this.disconnected) return; // CraftBukkit
a.warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
logger.warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
this.disconnect("Protocol error, unexpected packet");
}
@ -678,7 +678,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.networkManager.queue(new Packet3Chat(line));
}
packet = null;
} else if (packet.l == true) {
} else if (packet.lowPriority == true) {
// Reroute all low-priority packets through to compression thread.
ChunkCompressionThread.sendPacket(this.player, packet);
packet = null;
@ -691,14 +691,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start
if (this.player.dead) return;
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.h()) {
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) {
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
this.server.getPluginManager().callEvent(event);
// CraftBukkit end
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
} else {
a.warning(this.player.name + " tried to set an invalid carried item");
logger.warning(this.player.name + " tried to set an invalid carried item");
}
}
@ -725,7 +725,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public boolean chat(String s) {
if (!this.player.dead) {
if (s.length() == 0) {
a.warning(this.player.name + " tried to send an empty message");
logger.warning(this.player.name + " tried to send an empty message");
return false;
}
@ -783,7 +783,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
/* CraftBukkit start - No longer neaded as we have already handled it in server.dispatchCommand above.
if (s.toLowerCase().startsWith("/me ")) {
s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim();
a.info(s);
logger.info(s);
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s));
} else if (s.toLowerCase().startsWith("/kill")) {
this.player.damageEntity(DamageSource.GENERIC, 1000);
@ -794,7 +794,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
s = s.substring(s.indexOf(" ")).trim();
s = s.substring(s.indexOf(" ")).trim();
s = "\u00A77" + this.player.name + " whispers " + s;
a.info(s + " to " + astring[1]);
logger.info(s + " to " + astring[1]);
if (!this.minecraftServer.serverConfigurationManager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
this.sendPacket(new Packet3Chat("\u00A7cThere\'s no player by that name online."));
}
@ -804,11 +804,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (this.minecraftServer.serverConfigurationManager.isOp(this.player.name)) {
s1 = s.substring(1);
a.info(this.player.name + " issued server command: " + s1);
logger.info(this.player.name + " issued server command: " + s1);
this.minecraftServer.issueCommand(s1, this);
} else {
s1 = s.substring(1);
a.info(this.player.name + " tried command: " + s1);
logger.info(this.player.name + " tried command: " + s1);
}
}
// CraftBukkit end */
@ -893,7 +893,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.networkManager.a("disconnect.quitting", new Object[0]);
}
public int b() {
public int lowPriorityCount() {
return this.networkManager.e();
}
@ -913,7 +913,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (entity != null && this.player.g(entity) && this.player.i(entity) < 36.0D) {
ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit
if (packet7useentity.c == 0) {
if (packet7useentity.action == 0) {
// CraftBukkit start
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity());
this.server.getPluginManager().callEvent(event);
@ -927,7 +927,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer);
}
} else if (packet7useentity.c == 1) {
} else if (packet7useentity.action == 1) {
if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow)) {
String type = entity.getClass().getSimpleName();
disconnect("Attacking an " + type + " is not permitted");
@ -935,7 +935,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
return;
}
this.player.f(entity);
this.player.attack(entity);
if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer);
@ -946,7 +946,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void a(Packet9Respawn packet9respawn) {
if (this.player.j) {
if (this.player.viewingCredits) {
// CraftBukkit start
CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0);
ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn();
@ -962,7 +962,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
// CraftBukkit start
this.getPlayer().setHandle(this.player);
this.player.j = false; // allow the player to receive movement packets again.
this.player.viewingCredits = false; // allow the player to receive movement packets again.
// CraftBukkit end
}
@ -1007,10 +1007,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void a(Packet107SetCreativeSlot packet107setcreativeslot) {
if (this.player.itemInWorldManager.b()) {
if (this.player.itemInWorldManager.isCreative()) {
boolean flag = packet107setcreativeslot.a < 0;
ItemStack itemstack = packet107setcreativeslot.b;
boolean flag1 = packet107setcreativeslot.a >= 36 && packet107setcreativeslot.a < 36 + PlayerInventory.h();
boolean flag1 = packet107setcreativeslot.a >= 36 && packet107setcreativeslot.a < 36 + PlayerInventory.getHotbarSize();
boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null;
boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;

View file

@ -24,8 +24,8 @@ public class NetworkManager {
private List m = Collections.synchronizedList(new ArrayList());
private List highPriorityQueue = Collections.synchronizedList(new ArrayList());
private List lowPriorityQueue = Collections.synchronizedList(new ArrayList());
private NetHandler p;
private boolean q = false;
private NetHandler packetListener;
private boolean synched = false;
private Thread r;
private Thread s;
private boolean t = false;
@ -41,7 +41,7 @@ public class NetworkManager {
public NetworkManager(Socket socket, String s, NetHandler nethandler) {
this.socket = socket;
this.i = socket.getRemoteSocketAddress();
this.p = nethandler;
this.packetListener = nethandler;
// CraftBukkit start - IPv6 stack in Java on BSD/OSX doesn't support setTrafficClass
try {
@ -70,16 +70,16 @@ public class NetworkManager {
}
public void a(NetHandler nethandler) {
this.p = nethandler;
this.packetListener = nethandler;
}
public void queue(Packet packet) {
if (!this.q) {
if (!this.synched) {
Object object = this.g;
synchronized (this.g) {
this.x += packet.a() + 1;
if (packet.l) {
if (packet.lowPriority) {
this.lowPriorityQueue.add(packet);
} else {
this.highPriorityQueue.add(packet);
@ -146,7 +146,7 @@ public class NetworkManager {
boolean flag = false;
try {
Packet packet = Packet.a(this.input, this.p.c());
Packet packet = Packet.a(this.input, this.packetListener.c());
if (packet != null) {
int[] aint = d;
@ -223,12 +223,12 @@ public class NetworkManager {
while (!this.m.isEmpty() && i-- >= 0) {
Packet packet = (Packet) this.m.remove(0);
if (!this.q) packet.a(this.p); // CraftBukkit
if (!this.synched) packet.handle(this.packetListener); // CraftBukkit
}
this.a();
if (this.t && this.m.isEmpty()) {
this.p.a(this.u, this.v);
this.packetListener.a(this.u, this.v);
}
}
@ -237,9 +237,9 @@ public class NetworkManager {
}
public void d() {
if (!this.q) {
if (!this.synched) {
this.a();
this.q = true;
this.synched = true;
this.s.interrupt();
(new NetworkMonitorThread(this)).start();
}
@ -249,7 +249,7 @@ public class NetworkManager {
return this.lowPriorityQueue.size();
}
public Socket f() {
public Socket getSocket() {
return this.socket;
}
@ -258,7 +258,7 @@ public class NetworkManager {
}
static boolean b(NetworkManager networkmanager) {
return networkmanager.q;
return networkmanager.synched;
}
static boolean c(NetworkManager networkmanager) {

View file

@ -14,9 +14,9 @@ public abstract class Packet {
public static IntHashMap j = new IntHashMap();
private static Map a = new HashMap();
private static Set b = new HashSet();
private static Set c = new HashSet();
private static Set action = new HashSet();
public final long timestamp = System.currentTimeMillis();
public boolean l = false;
public boolean lowPriority = false;
public Packet() {}
@ -33,7 +33,7 @@ public abstract class Packet {
}
if (flag1) {
c.add(Integer.valueOf(i));
action.add(Integer.valueOf(i));
}
}
}
@ -67,7 +67,7 @@ public abstract class Packet {
return null;
}
if (flag && !c.contains(Integer.valueOf(i)) || !flag && !b.contains(Integer.valueOf(i))) {
if (flag && !action.contains(Integer.valueOf(i)) || !flag && !b.contains(Integer.valueOf(i))) {
throw new IOException("Bad packet id " + i);
}
@ -135,7 +135,7 @@ public abstract class Packet {
public abstract void a(DataOutputStream dataoutputstream) throws IOException; // CraftBukkit
public abstract void a(NetHandler nethandler);
public abstract void handle(NetHandler nethandler);
public abstract int a();

View file

@ -66,7 +66,7 @@ public class Packet1Login extends Packet {
dataoutputstream.writeByte(this.i);
}
public void a(NetHandler nethandler) {
public void handle(NetHandler nethandler) {
nethandler.a(this);
}

View file

@ -29,7 +29,7 @@ public class Packet3Chat extends Packet {
a(this.message, dataoutputstream);
}
public void a(NetHandler nethandler) {
public void handle(NetHandler nethandler) {
nethandler.a(this);
}

View file

@ -20,7 +20,7 @@ public class Packet51MapChunk extends Packet {
public byte[] rawData; // CraftBukkit
public Packet51MapChunk() {
this.l = true;
this.lowPriority = true;
}
// CraftBukkit start
@ -30,26 +30,27 @@ public class Packet51MapChunk extends Packet {
public Packet51MapChunk(int i, int j, int k, int l, int i1, int j1, byte[] data) {
// CraftBukkit end
this.l = true;
this.lowPriority = true;
this.a = i;
this.b = j;
this.c = k;
this.d = l;
this.e = i1;
this.f = j1;
/* CraftBukkit - Moved compression into its own method.
/* CraftBukkit start - Moved compression into its own method.
byte[] abyte = data; // CraftBukkit - uses data from above constructor
Deflater deflater = new Deflater(-1);
try {
deflater.setInput(abyte);
deflater.finish();
this.g = new byte[l * i1 * j1 * 5 / 2];
this.h = deflater.deflate(this.g);
this.buffer = new byte[l * i1 * j1 * 5 / 2];
this.size = deflater.deflate(this.buffer);
} finally {
deflater.end();
}*/
this.rawData = data; // CraftBukkit
} */
this.rawData = data;
// CraftBukkit end
}
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOEXception
@ -88,7 +89,7 @@ public class Packet51MapChunk extends Packet {
dataoutputstream.write(this.buffer, 0, this.size);
}
public void a(NetHandler nethandler) {
public void handle(NetHandler nethandler) {
nethandler.a(this);
}

View file

@ -27,7 +27,7 @@ public class PlayerInventory implements IInventory {
return this.itemInHandIndex < 9 && this.itemInHandIndex >= 0 ? this.items[this.itemInHandIndex] : null;
}
public static int h() {
public static int getHotbarSize() {
return 9;
}

View file

@ -289,7 +289,7 @@ public class ServerConfigurationManager {
worldserver.addEntity(entityplayer1);
this.players.add(entityplayer1);
this.updateClient(entityplayer1); // CraftBukkit
entityplayer1.A();
entityplayer1.B();
// CraftBukkit start - don't fire on respawn
if (fromWorld != location.getWorld()) {
org.bukkit.event.player.PlayerChangedWorldEvent event = new org.bukkit.event.player.PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld);
@ -321,7 +321,7 @@ public class ServerConfigurationManager {
toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch);
} else {
ChunkCoordinates coords = toWorld.d();
ChunkCoordinates coords = toWorld.getDimensionSpawn();
if (coords != null) {
toLocation = new Location(toWorld.getWorld(), coords.x, coords.y, coords.z, 90, 0);
}
@ -358,7 +358,7 @@ public class ServerConfigurationManager {
if (this.p < this.players.size()) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.p);
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.i));
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
}
*/

View file

@ -34,7 +34,7 @@ public final class SpawnerCreature {
public SpawnerCreature() {}
protected static ChunkPosition a(World world, int i, int j) {
protected static ChunkPosition getRandomPosition(World world, int i, int j) {
int k = i + world.random.nextInt(16);
int l = world.random.nextInt(world.height);
int i1 = j + world.random.nextInt(16);
@ -92,7 +92,7 @@ public final class SpawnerCreature {
for (EntryBase base : b) {
ChunkEntry entry = (SpawnerCreature.ChunkEntry) base;
if (!entry.spawn) {
ChunkPosition chunkposition = a(world, entry.getX() * 16, entry.getZ() * 16);
ChunkPosition chunkposition = getRandomPosition(world, entry.getX() * 16, entry.getZ() * 16);
// CraftBukkit end
int k1 = chunkposition.x;
int l1 = chunkposition.y;
@ -145,7 +145,7 @@ public final class SpawnerCreature {
}
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, world.random.nextFloat() * 360.0F, 0.0F);
if (entityliving.g()) {
if (entityliving.canSpawn()) {
++j2;
// CraftBukkit - added a reason for spawning this creature
world.addEntity(entityliving, SpawnReason.NATURAL);

View file

@ -11,7 +11,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
public float f;
public float g;
public int h;
private int j;
private int ticks;
// CraftBukkit start
public ItemStack[] getContents() {
@ -175,7 +175,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
super.l_();
if (this.world == null) return; // CraftBukkit
this.h();
if (++this.j % (20 * 4) == 0) { // CraftBukkit
if (++this.ticks % (20 * 4) == 0) { // CraftBukkit
this.world.playNote(this.x, this.y, this.z, 1, this.h);
}

View file

@ -49,7 +49,7 @@ public class TileEntityMobSpawner extends TileEntity {
for (int i = 0; i < b0; ++i) {
// CraftBukkit start - bad entity detection
Entity mob = EntityTypes.a(this.mobName, this.world);
Entity mob = EntityTypes.createEntityByName(this.mobName, this.world);
if (!(mob instanceof EntityLiving)) {
mobName = "Pig";
@ -77,7 +77,7 @@ public class TileEntityMobSpawner extends TileEntity {
entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
// CraftBukkit start
if (entityliving.g()) {
if (entityliving.canSpawn()) {
this.world.addEntity(entityliving, SpawnReason.SPAWNER);
// CraftBukkit end

View file

@ -43,7 +43,7 @@ public class World implements IBlockAccess {
private List J;
private TreeSet K;
private Set L;
public List h;
public List tileEntityList;
private List M;
private List N;
public List players;
@ -76,7 +76,7 @@ public class World implements IBlockAccess {
private boolean S;
public boolean allowMonsters; // CraftBukkit - private -> public
public boolean allowAnimals; // CraftBukkit - private -> public
private LongHashset T; // CraftBukkit
private LongHashset chunkTickList; // CraftBukkit
private int U;
int[] H;
private List V;
@ -127,7 +127,7 @@ public class World implements IBlockAccess {
this.J = new ArrayList();
this.K = new TreeSet();
this.L = new HashSet();
this.h = new ArrayList();
this.tileEntityList = new ArrayList();
this.M = new ArrayList();
this.N = new ArrayList();
this.players = new ArrayList();
@ -147,7 +147,7 @@ public class World implements IBlockAccess {
this.R = new ArrayList();
this.allowMonsters = true;
this.allowAnimals = true;
this.T = new LongHashset(); // CraftBukkit
this.chunkTickList = new LongHashset(); // CraftBukkit
this.U = this.random.nextInt(12000);
this.H = new int['\u8000'];
this.V = new ArrayList();
@ -245,7 +245,7 @@ public class World implements IBlockAccess {
}
}
public ChunkCoordinates d() {
public ChunkCoordinates getDimensionSpawn() {
return this.worldProvider.d();
}
@ -1026,7 +1026,7 @@ public class World implements IBlockAccess {
}
public float b(float f) {
return this.worldProvider.a(this.worldData.f(), f);
return this.worldProvider.a(this.worldData.getTime(), f);
}
public int e(int i, int j) {
@ -1065,7 +1065,7 @@ public class World implements IBlockAccess {
} else {
if (this.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (l > 0) {
nextticklistentry.a((long) i1 + this.worldData.f());
nextticklistentry.a((long) i1 + this.worldData.getTime());
}
if (!this.L.contains(nextticklistentry)) {
@ -1080,7 +1080,7 @@ public class World implements IBlockAccess {
NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
if (l > 0) {
nextticklistentry.a((long) i1 + this.worldData.f());
nextticklistentry.a((long) i1 + this.worldData.getTime());
}
if (!this.L.contains(nextticklistentry)) {
@ -1163,7 +1163,7 @@ public class World implements IBlockAccess {
// MethodProfiler.b("tileEntities"); // CraftBukkit - not in production code
this.S = true;
Iterator iterator = this.h.iterator();
Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
@ -1186,7 +1186,7 @@ public class World implements IBlockAccess {
this.S = false;
if (!this.N.isEmpty()) {
this.h.removeAll(this.N);
this.tileEntityList.removeAll(this.N);
this.N.clear();
}
@ -1209,8 +1209,8 @@ public class World implements IBlockAccess {
if (chunk1 != null) {
chunk1.a(tileentity1.x & 15, tileentity1.y, tileentity1.z & 15, tileentity1);
// CraftBukkit start - moved in from above
if (!this.h.contains(tileentity1)) {
this.h.add(tileentity1);
if (!this.tileEntityList.contains(tileentity1)) {
this.tileEntityList.add(tileentity1);
}
// CraftBukkit end
}
@ -1231,7 +1231,7 @@ public class World implements IBlockAccess {
if (this.S) {
this.M.addAll(collection);
} else {
this.h.addAll(collection);
this.tileEntityList.addAll(collection);
}
}
@ -1625,7 +1625,7 @@ public class World implements IBlockAccess {
if (chunk != null) {
chunk.a(i & 15, j, k & 15, tileentity);
this.h.add(tileentity); // CraftBukkit - moved in from above
this.tileEntityList.add(tileentity); // CraftBukkit - moved in from above
}
}
}
@ -1640,7 +1640,7 @@ public class World implements IBlockAccess {
} else {
if (tileentity != null) {
this.M.remove(tileentity);
this.h.remove(tileentity);
this.tileEntityList.remove(tileentity);
}
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
@ -1713,7 +1713,7 @@ public class World implements IBlockAccess {
}
if (!flag) {
i = this.worldData.f() + 24000L;
i = this.worldData.getTime() + 24000L;
this.worldData.a(i - i % 24000L);
this.t();
}
@ -1722,7 +1722,7 @@ public class World implements IBlockAccess {
// MethodProfiler.a("mobSpawner"); // CraftBukkit - not in production code
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals && this.worldData.f() % 400L == 0L);
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals && this.worldData.getTime() % 400L == 0L);
}
// CraftBukkit end
// MethodProfiler.b("chunkSource"); // CraftBukkit - not in production code
@ -1733,7 +1733,7 @@ public class World implements IBlockAccess {
this.k = j;
}
i = this.worldData.f() + 1L;
i = this.worldData.getTime() + 1L;
if (i % (long) this.u == 0L) {
// MethodProfiler.b("save"); // CraftBukkit - not in production code
this.save(false, (IProgressUpdate) null);
@ -1876,7 +1876,7 @@ public class World implements IBlockAccess {
for (j = -b0; j <= b0; ++j) {
for (int i1 = -b0; i1 <= b0; ++i1) {
this.T.add(LongHash.toLong(j + k, i1 + l)); // CraftBukkit
this.chunkTickList.add(LongHash.toLong(j + k, i1 + l)); // CraftBukkit
}
}
}
@ -1892,7 +1892,7 @@ public class World implements IBlockAccess {
// Iterator iterator = this.T.iterator(); // CraftBukkit - removed
// CraftBukkit start
for (long chunkCoord : this.T.popAll()) {
for (long chunkCoord : this.chunkTickList.popAll()) {
int chunkX = LongHash.msw(chunkCoord);
int chunkZ = LongHash.lsw(chunkCoord);
// ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
@ -2105,7 +2105,7 @@ public class World implements IBlockAccess {
}
private int e(int i, int j, int k, int l, int i1, int j1) {
int k1 = Block.s[i1];
int k1 = Block.lightEmission[i1];
int l1 = this.a(EnumSkyBlock.BLOCK, j - 1, k, l) - j1;
int i2 = this.a(EnumSkyBlock.BLOCK, j + 1, k, l) - j1;
int j2 = this.a(EnumSkyBlock.BLOCK, j, k - 1, l) - j1;
@ -2147,7 +2147,7 @@ public class World implements IBlockAccess {
int j1 = this.a(enumskyblock, i, j, k);
boolean flag = false;
int k1 = this.getTypeId(i, j, k);
int l1 = Block.q[k1];
int l1 = Block.lightBlock[k1];
if (l1 == 0) {
l1 = 1;
@ -2211,7 +2211,7 @@ public class World implements IBlockAccess {
int l4 = i2 + (l3 / 2 + 2) % 3 / 2 * i4;
l2 = this.a(enumskyblock, j4, k4, l4);
int i5 = Block.q[this.getTypeId(j4, k4, l4)];
int i5 = Block.lightBlock[this.getTypeId(j4, k4, l4)];
if (i5 == 0) {
i5 = 1;
@ -2237,7 +2237,7 @@ public class World implements IBlockAccess {
k1 = (j1 >> 12 & 63) - 32 + k;
l1 = this.a(enumskyblock, j5, j2, k1);
i2 = this.getTypeId(j5, j2, k1);
k2 = Block.q[i2];
k2 = Block.lightBlock[i2];
if (k2 == 0) {
k2 = 1;
}
@ -2318,7 +2318,7 @@ public class World implements IBlockAccess {
for (int j = 0; j < i; ++j) {
NextTickListEntry nextticklistentry = (NextTickListEntry) this.K.first();
if (!flag && nextticklistentry.e > this.worldData.f()) {
if (!flag && nextticklistentry.e > this.worldData.getTime()) {
break;
}
@ -2446,7 +2446,7 @@ public class World implements IBlockAccess {
this.J.addAll(list);
}
public boolean a(int i, int j, int k, int l, boolean flag, int i1) {
public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1) {
int j1 = this.getTypeId(j, k, l);
Block block = Block.byId[j1];
Block block1 = Block.byId[i];
@ -2659,7 +2659,7 @@ public class World implements IBlockAccess {
}
public void setTimeAndFixTicklists(long i) {
long j = i - this.worldData.f();
long j = i - this.worldData.getTime();
NextTickListEntry nextticklistentry;
@ -2675,7 +2675,7 @@ public class World implements IBlockAccess {
}
public long getTime() {
return this.worldData.f();
return this.worldData.getTime();
}
public ChunkCoordinates getSpawn() {

View file

@ -162,7 +162,7 @@ public class WorldData {
return this.spawnZ;
}
public long f() {
public long getTime() {
return this.time;
}

View file

@ -15,7 +15,7 @@ public class WorldGenBigTree extends WorldGenerator {
static final byte[] a = new byte[] { (byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1};
Random b = new Random();
// CraftBukkit start
BlockChangeDelegate c;
BlockChangeDelegate world;
StructureGrowEvent event;
CraftWorld bukkitWorld;
// CraftBukkit end
@ -126,14 +126,14 @@ public class WorldGenBigTree extends WorldGenerator {
++k1;
} else {
aint1[b2] = aint[b2] + k1;
int l1 = this.c.getTypeId(aint1[0], aint1[1], aint1[2]);
int l1 = this.world.getTypeId(aint1[0], aint1[1], aint1[2]);
if (l1 != 0 && l1 != 18) {
++k1;
} else {
// CraftBukkit start
if (event == null) {
this.a(this.c, aint1[0], aint1[1], aint1[2], l, 0);
this.setTypeAndData(this.world, aint1[0], aint1[1], aint1[2], l, 0);
} else {
BlockState state = bukkitWorld.getBlockAt(aint1[0], aint1[1], aint1[2]).getState();
state.setTypeId(l);
@ -217,7 +217,7 @@ public class WorldGenBigTree extends WorldGenerator {
aint3[b3] = MathHelper.floor((double) aint[b3] + (double) j * d1 + 0.5D);
// CraftBukkit start
if (event == null) {
this.a(this.c, aint3[0], aint3[1], aint3[2], i, 0);
this.setTypeAndData(this.world, aint3[0], aint3[1], aint3[2], i, 0);
} else {
BlockState state = bukkitWorld.getBlockAt(aint3[0], aint3[1], aint3[2]).getState();
state.setTypeId(i);
@ -320,7 +320,7 @@ public class WorldGenBigTree extends WorldGenerator {
aint3[b1] = aint[b1] + i;
aint3[b2] = MathHelper.floor((double) aint[b2] + (double) i * d0);
aint3[b3] = MathHelper.floor((double) aint[b3] + (double) i * d1);
int k = this.c.getTypeId(aint3[0], aint3[1], aint3[2]);
int k = this.world.getTypeId(aint3[0], aint3[1], aint3[2]);
if (k != 0 && k != 18) {
break;
@ -334,7 +334,7 @@ public class WorldGenBigTree extends WorldGenerator {
boolean e() {
int[] aint = new int[] { this.d[0], this.d[1], this.d[2]};
int[] aint1 = new int[] { this.d[0], this.d[1] + this.e - 1, this.d[2]};
int i = this.c.getTypeId(this.d[0], this.d[1] - 1, this.d[2]);
int i = this.world.getTypeId(this.d[0], this.d[1] - 1, this.d[2]);
if (i != 2 && i != 3) {
return false;
@ -375,7 +375,7 @@ public class WorldGenBigTree extends WorldGenerator {
this.event = event;
this.bukkitWorld = bukkitWorld;
// CraftBukkit end
this.c = world;
this.world = world;
long l = random.nextLong();
this.b.setSeed(l);

View file

@ -91,7 +91,7 @@ public class WorldGenForest extends WorldGenerator {
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) {
// CraftBukkit start
if (event == null) {
this.a(world, l1, i2, k2, Block.LEAVES.id, 2);
this.setTypeAndData(world, l1, i2, k2, Block.LEAVES.id, 2);
} else {
BlockState leavesState = bukkitWorld.getBlockAt(l1, i2, k2).getState();
leavesState.setTypeId(Block.LEAVES.id);
@ -109,7 +109,7 @@ public class WorldGenForest extends WorldGenerator {
if (j1 == 0 || j1 == Block.LEAVES.id) {
// CraftBukkit start
if (event == null) {
this.a(world, i, j + i2, k, Block.LOG.id, 2);
this.setTypeAndData(world, i, j + i2, k, Block.LOG.id, 2);
} else {
BlockState logState = bukkitWorld.getBlockAt(i, j + i2, k).getState();
logState.setTypeId(Block.LOG.id);

View file

@ -96,7 +96,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.o[world.getTypeId(i3, j3, l3)]) {
// CraftBukkit start
if (event == null) {
this.a(world, i3, j3, l3, Block.LEAVES.id, 1);
this.setTypeAndData(world, i3, j3, l3, Block.LEAVES.id, 1);
} else {
BlockState leavesState = bukkitWorld.getBlockAt(i3, j3, l3).getState();
leavesState.setTypeId(Block.LEAVES.id);
@ -127,7 +127,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
if (i3 == 0 || i3 == Block.LEAVES.id) {
// CraftBukkit start
if (event == null) {
this.a(world, i, j + j3, k, Block.LOG.id, 1);
this.setTypeAndData(world, i, j + j3, k, Block.LOG.id, 1);
} else {
BlockState logState = bukkitWorld.getBlockAt(i, j + j3, k).getState();
logState.setTypeId(Block.LOG.id);

View file

@ -91,7 +91,7 @@ public class WorldGenTrees extends WorldGenerator {
if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.o[world.getTypeId(l1, i2, k2)]) {
// CraftBukkit start
if (event == null) {
this.a(world, l1, i2, k2, Block.LEAVES.id, 0);
this.setTypeAndData(world, l1, i2, k2, Block.LEAVES.id, 0);
} else {
BlockState leavesState = bukkitWorld.getBlockAt(l1, i2, k2).getState();
leavesState.setTypeId(Block.LEAVES.id);
@ -108,7 +108,7 @@ public class WorldGenTrees extends WorldGenerator {
if (j1 == 0 || j1 == Block.LEAVES.id) {
// CraftBukkit start
if (event == null) {
this.a(world, i, j + i2, k, Block.LOG.id, 0);
this.setTypeAndData(world, i, j + i2, k, Block.LOG.id, 0);
} else {
BlockState logState = bukkitWorld.getBlockAt(i, j + i2, k).getState();
logState.setTypeId(Block.LOG.id);

View file

@ -21,7 +21,7 @@ public abstract class WorldGenerator {
public void a(double d0, double d1, double d2) {}
// CraftBukkit - change signature
protected void a(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
protected void setTypeAndData(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
if (this.a) {
((World) world).setTypeIdAndData(i, j, k, l, i1); // CraftBukkit - force-cast to world to get it working
} else {

View file

@ -15,10 +15,10 @@ public class WorldMapHumanTracker {
private int f;
private byte[] g;
final WorldMap d;
final WorldMap worldMap;
public WorldMapHumanTracker(WorldMap worldmap, EntityHuman entityhuman) {
this.d = worldmap;
this.worldMap = worldmap;
this.b = new int[128];
this.c = new int[128];
this.e = 0;
@ -35,7 +35,7 @@ public class WorldMapHumanTracker {
int i;
int j;
RenderData render = this.d.mapView.render((CraftPlayer) trackee.getBukkitEntity()); // CraftBukkit
RenderData render = this.worldMap.mapView.render((CraftPlayer) trackee.getBukkitEntity()); // CraftBukkit
if (--this.f < 0) {
this.f = 4;

View file

@ -20,14 +20,14 @@ public class WorldServer extends World implements BlockChangeDelegate {
public boolean weirdIsOpCache = false;
public boolean savingDisabled;
public final MinecraftServer server; // CraftBukkit - private -> public final
private IntHashMap N;
private IntHashMap entitiesById;
// CraftBukkit start - change signature
public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, org.bukkit.World.Environment env, ChunkGenerator gen) {
super(idatamanager, s, worldsettings, WorldProvider.byDimension(env.getId()), gen, env);
this.server = minecraftserver;
if (this.N == null) {
this.N = new IntHashMap();
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
this.dimension = i;
@ -140,8 +140,8 @@ public class WorldServer extends World implements BlockChangeDelegate {
public List getTileEntities(int i, int j, int k, int l, int i1, int j1) {
ArrayList arraylist = new ArrayList();
for (int k1 = 0; k1 < this.h.size(); ++k1) {
TileEntity tileentity = (TileEntity) this.h.get(k1);
for (int k1 = 0; k1 < this.tileEntityList.size(); ++k1) {
TileEntity tileentity = (TileEntity) this.tileEntityList.get(k1);
if (tileentity.x >= i && tileentity.y >= j && tileentity.z >= k && tileentity.x < l && tileentity.y < i1 && tileentity.z < j1) {
arraylist.add(tileentity);
@ -164,8 +164,8 @@ public class WorldServer extends World implements BlockChangeDelegate {
}
protected void c() {
if (this.N == null) {
this.N = new IntHashMap();
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
super.c();
@ -173,30 +173,30 @@ public class WorldServer extends World implements BlockChangeDelegate {
protected void c(Entity entity) {
super.c(entity);
this.N.a(entity.id, entity);
this.entitiesById.a(entity.id, entity);
Entity[] aentity = entity.aR();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
this.N.a(aentity[i].id, aentity[i]);
this.entitiesById.a(aentity[i].id, aentity[i]);
}
}
}
protected void d(Entity entity) {
super.d(entity);
this.N.d(entity.id);
this.entitiesById.d(entity.id);
Entity[] aentity = entity.aR();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
this.N.d(aentity[i].id);
this.entitiesById.d(aentity[i].id);
}
}
}
public Entity getEntity(int i) {
return (Entity) this.N.a(i);
return (Entity) this.entitiesById.a(i);
}
public boolean strikeLightning(Entity entity) {