Archiviert
13
0

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.
Dieser Commit ist enthalten in:
Erik Broes 2012-01-14 21:03:48 +01:00
Ursprung 6495eee0c9
Commit 61ec751ca1
85 geänderte Dateien mit 466 neuen und 456 gelöschten Zeilen

11
pom.xml
Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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); this.interact(world, i, j, k, entityhuman);
} }

Datei anzeigen

@ -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); this.interact(world, i, j, k, entityhuman);
} }

Datei anzeigen

@ -21,7 +21,7 @@ public class BlockDragonEgg extends Block {
} }
private void g(World world, int i, int j, int k) { 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; byte b0 = 32;
if (!BlockSand.instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) { 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 { } else {
world.setTypeId(i, j, k, 0); 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; --j;
} }
@ -48,7 +48,7 @@ public class BlockDragonEgg extends Block {
return true; 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); this.h(world, i, j, k);
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -1,7 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.Random; import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockIce extends BlockHalfTransparant { 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) { 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 // CraftBukkit start
if (CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) { if (CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
return; return;

Datei anzeigen

@ -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); this.interact(world, i, j, k, entityhuman);
} }

Datei anzeigen

@ -91,7 +91,7 @@ public class BlockMushroom extends BlockFlower {
} }
// CraftBukkit - added bonemeal, player and itemstack // 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); int l = world.getData(i, j, k);
world.setRawTypeId(i, j, k, 0); world.setRawTypeId(i, j, k, 0);

Datei anzeigen

@ -18,7 +18,7 @@ public class BlockMycel extends Block {
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) { 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 // CraftBukkit start
org.bukkit.World bworld = world.getWorld(); org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState(); 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 k1 = k + random.nextInt(3) - 1;
int l1 = world.getTypeId(i1, j1 + 1, k1); 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 // CraftBukkit start
org.bukkit.World bworld = world.getWorld(); org.bukkit.World bworld = world.getWorld();
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState(); org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();

Datei anzeigen

@ -23,7 +23,7 @@ public class BlockSand extends Block {
} }
private void h(World world, int i, int j, int k) { 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; byte b0 = 32;
if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) { 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 { } else {
world.setTypeId(i, j, k, 0); 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; --j;
} }
@ -51,7 +51,7 @@ public class BlockSand extends Block {
return 3; 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); int l = world.getTypeId(i, j, k);
if (l == 0) { if (l == 0) {

Datei anzeigen

@ -29,7 +29,7 @@ public class BlockSapling extends BlockFlower {
if ((l & 8) == 0) { if ((l & 8) == 0) {
world.setData(i, j, k, l | 8); world.setData(i, j, k, l | 8);
} else { } 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 // 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; int l = world.getData(i, j, k) & 3;
world.setRawTypeId(i, j, k, 0); world.setRawTypeId(i, j, k, 0);
// CraftBukkit start - fixes client updates on recently grown trees // CraftBukkit start - fixes client updates on recently grown trees
boolean grownTree; boolean grownTree;
BlockChangeWithNotify delegate = new BlockChangeWithNotify(world); BlockChangeWithNotify delegate = new BlockChangeWithNotify(world);
@ -74,9 +73,9 @@ public class BlockSapling extends BlockFlower {
--itemstack.count; --itemstack.count;
} }
if (!grownTree || event.isCancelled()) { if (!grownTree || event.isCancelled()) {
// CraftBukkit end
world.setRawTypeIdAndData(i, j, k, this.id, l); world.setRawTypeIdAndData(i, j, k, this.id, l);
} }
// CraftBukkit end
} }
protected int getDropData(int i) { protected int getDropData(int i) {

Datei anzeigen

@ -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); 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); int l = world.getData(i, j, k);
boolean flag1 = (l & 4) > 0; boolean flag1 = (l & 4) > 0;
@ -132,7 +132,7 @@ public class BlockTrapdoor extends Block {
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, oldPower, power);
world.getServer().getPluginManager().callEvent(eventRedstone); 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 // CraftBukkit end
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -45,7 +45,7 @@ public class EntityCow extends EntityAnimal {
return 0.4F; return 0.4F;
} }
protected int e() { protected int getLootId() {
return Item.LEATHER.id; return Item.LEATHER.id;
} }
@ -61,7 +61,7 @@ public class EntityCow extends EntityAnimal {
j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i); j = this.random.nextInt(3) + 1 + this.random.nextInt(1 + i);
if (j > 0) { 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); CraftEventFactory.callEntityDeathEvent(this, loot);

Datei anzeigen

@ -203,12 +203,12 @@ public abstract class EntityCreature extends EntityLiving {
return null; return null;
} }
public boolean g() { public boolean canSpawn() {
int i = MathHelper.floor(this.locX); int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.boundingBox.b); int j = MathHelper.floor(this.boundingBox.b);
int k = MathHelper.floor(this.locZ); 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() { public boolean E() {

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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); 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 { } else {
this.v(); 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); f *= (float) Math.pow(2.0D, this.motY);
if (this.q) { if (this.q) {
this.o += f * 0.5F; this.o += f * 0.5F;
@ -182,7 +182,7 @@ public class EntityEnderDragon extends EntityComplex {
this.B(); this.B();
} }
d1 /= (double) MathHelper.a(d0 * d0 + d2 * d2); d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
f3 = 0.6F; f3 = 0.6F;
if (d1 < (double) (-f3)) { if (d1 < (double) (-f3)) {
d1 = (double) (-f3); d1 = (double) (-f3);
@ -229,7 +229,7 @@ public class EntityEnderDragon extends EntityComplex {
} }
this.aY *= 0.8F; 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; double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
if (d10 > 40.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() 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) { while (i > 0) {
j = EntityExperienceOrb.b(i); j = EntityExperienceOrb.getOrbValue(i);
i -= j; i -= j;
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, 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 i = expToDrop - 10 * (expToDrop / 20); // CraftBukkit - drop the remaining experience
while (i > 0) { while (i > 0) {
j = EntityExperienceOrb.b(i); j = EntityExperienceOrb.getOrbValue(i);
i -= j; i -= j;
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, 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) { for (int j1 = j - b0; j1 <= j + b0; ++j1) {
double d0 = (double) (i1 - i); double d0 = (double) (i1 - i);
double d1 = (double) (j1 - j); 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 (d2 <= (double) b0 - 0.5D) {
if (l < k) { if (l < k) {

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -36,7 +36,7 @@ public class EntityPigZombie extends EntityZombie {
super.y_(); 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); 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 // CraftBukkit end
} }
protected int e() { protected int getLootId() {
return Item.ROTTEN_FLESH.id; return Item.ROTTEN_FLESH.id;
} }
} }

Datei anzeigen

@ -18,7 +18,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
public class EntityPlayer extends EntityHuman implements ICrafting { public class EntityPlayer extends EntityHuman implements ICrafting {
public NetServerHandler netServerHandler; public NetServerHandler netServerHandler;
public MinecraftServer b; public MinecraftServer server;
public ItemInWorldManager itemInWorldManager; public ItemInWorldManager itemInWorldManager;
public double d; public double d;
public double e; public double e;
@ -28,12 +28,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private int cg = -99999999; private int cg = -99999999;
private boolean ch = true; private boolean ch = true;
public int lastSentExp = -99999999; // CraftBukkit - priv to pub 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 ItemStack[] ck = new ItemStack[] { null, null, null, null, null};
private int cl = 0; private int cl = 0;
public boolean h; public boolean h;
public int ping; public int ping;
public boolean j = false; public boolean viewingCredits = false;
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world); 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.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.bP = 0.0F;
this.name = s; this.name = s;
this.height = 0.0F; this.height = 0.0F;
@ -135,14 +135,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void y_() { public void y_() {
this.itemInWorldManager.c(); this.itemInWorldManager.c();
--this.cj; --this.invulnerableTicks;
this.activeContainer.a(); this.activeContainer.a();
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
ItemStack itemstack = this.c(i); ItemStack itemstack = this.c(i);
if (itemstack != this.ck[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; 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(); String deathMessage = event.getDeathMessage();
if (deathMessage != null && deathMessage.length() > 0) { 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. // 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) { public boolean damageEntity(DamageSource damagesource, int i) {
if (this.cj > 0) { if (this.invulnerableTicks > 0) {
return false; return false;
} else { } else {
// CraftBukkit - this.b.pvpMode -> this.world.pvpMode // CraftBukkit - this.b.pvpMode -> this.world.pvpMode
@ -215,11 +215,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
protected boolean z() { protected boolean z() {
return this.b.pvpMode; return this.server.pvpMode;
} }
public void d(int i) { public void heal(int i) {
super.d(i); super.heal(i);
} }
public void a(boolean flag) { 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) { for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i); ItemStack itemstack = this.inventory.getItem(i);
if (itemstack != null && Item.byId[itemstack.id].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); Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
if (packet != null) { if (packet != null) {
@ -243,12 +243,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (chunkcoordintpair != null) { if (chunkcoordintpair != null) {
boolean flag1 = false; 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; flag1 = true;
} }
if (flag1) { if (flag1) {
WorldServer worldserver = this.b.getWorldServer(this.dimension); WorldServer worldserver = this.server.getWorldServer(this.dimension);
this.chunkCoordIntPairQueue.remove(chunkcoordintpair); this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
this.netServerHandler.sendPacket(new Packet51MapChunk(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, 16, worldserver.height, 16, worldserver)); 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.J) {
//if (this.b.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit //if (this.server.propertyManager.getBoolean("allow-nether", true)) { // CraftBukkit
if (this.activeContainer != this.defaultContainer) { if (this.activeContainer != this.defaultContainer) {
this.closeInventory(); this.closeInventory();
} }
@ -283,7 +284,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
b0 = -1; b0 = -1;
} }
this.b.serverConfigurationManager.changeDimension(this, b0); this.server.serverConfigurationManager.changeDimension(this, b0);
this.lastSentExp = -1; this.lastSentExp = -1;
this.cf = -1; this.cf = -1;
this.cg = -1; this.cg = -1;
@ -324,7 +325,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.dimension == 1 && i == 1) { if (this.dimension == 1 && i == 1) {
this.a((Statistic) AchievementList.C); this.a((Statistic) AchievementList.C);
this.world.kill(this); this.world.kill(this);
this.j = true; this.viewingCredits = true;
this.netServerHandler.sendPacket(new Packet70Bed(4, 0)); this.netServerHandler.sendPacket(new Packet70Bed(4, 0));
} else { } else {
this.a((Statistic) AchievementList.B); this.a((Statistic) AchievementList.B);
@ -336,7 +337,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// CraftBukkit end */ // CraftBukkit end */
this.b.serverConfigurationManager.changeDimension(this, 1); this.server.serverConfigurationManager.changeDimension(this, 1);
this.lastSentExp = -1; this.lastSentExp = -1;
this.cf = -1; this.cf = -1;
this.cg = -1; this.cg = -1;
@ -355,7 +356,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void receive(Entity entity, int i) { public void receive(Entity entity, int i) {
if (!entity.dead) { if (!entity.dead) {
EntityTracker entitytracker = this.b.getTracker(this.dimension); EntityTracker entitytracker = this.server.getTracker(this.dimension);
if (entity instanceof EntityItem) { if (entity instanceof EntityItem) {
entitytracker.a(entity, new Packet22Collect(entity.id, this.id)); entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
@ -378,7 +379,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (!this.t) { if (!this.t) {
this.u = -1; this.u = -1;
this.t = true; this.t = true;
EntityTracker entitytracker = this.b.getTracker(this.dimension); EntityTracker entitytracker = this.server.getTracker(this.dimension);
entitytracker.a(this, new Packet18ArmAnimation(this, 1)); 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); EnumBedResult enumbedresult = super.a(i, j, k);
if (enumbedresult == EnumBedResult.OK) { 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); Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
entitytracker.a(this, packet17entitylocationaction); entitytracker.a(this, packet17entitylocationaction);
@ -403,7 +404,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(boolean flag, boolean flag1, boolean flag2) { public void a(boolean flag, boolean flag1, boolean flag2) {
if (this.isSleeping()) { if (this.isSleeping()) {
EntityTracker entitytracker = this.b.getTracker(this.dimension); EntityTracker entitytracker = this.server.getTracker(this.dimension);
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 3)); 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) { public void a(ItemStack itemstack, int i) {
super.a(itemstack, i); super.a(itemstack, i);
if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().d(itemstack) == EnumAnimation.b) { 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)); 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)); 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); this.netServerHandler.a(d0, d1, d2, this.yaw, this.pitch);
} }
public void c(Entity entity) { 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)); entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
} }
public void d(Entity entity) { 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)); entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -190,14 +190,14 @@ public class EntitySlime extends EntityLiving implements IMonster {
return "mob.slime"; return "mob.slime";
} }
protected int e() { protected int getLootId() {
return this.getSize() == 1 ? Item.SLIME_BALL.id : 0; 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)); 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() { protected float o() {

Datei anzeigen

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

Datei anzeigen

@ -91,7 +91,7 @@ public class EntitySpider extends EntityMonster {
if (this.onGround) { if (this.onGround) {
double d0 = entity.locX - this.locX; double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ; 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.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; 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); super.a(nbttagcompound);
} }
protected int e() { protected int getLootId() {
return Item.STRING.id; return Item.STRING.id;
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -100,18 +100,18 @@ public class EntityTrackerEntry {
this.i = this.tracker.motX; this.i = this.tracker.motX;
this.j = this.tracker.motY; this.j = this.tracker.motY;
this.k = this.tracker.motZ; 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) { if (object != null) {
this.a((Packet) object); this.broadcast((Packet) object);
} }
DataWatcher datawatcher = this.tracker.getDataWatcher(); DataWatcher datawatcher = this.tracker.getDataWatcher();
if (datawatcher.a()) { if (datawatcher.a()) {
this.b((Packet) (new Packet40EntityMetadata(this.tracker.id, datawatcher))); this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
} }
if (flag) { if (flag) {
@ -146,14 +146,14 @@ public class EntityTrackerEntry {
} }
if (!cancelled) { if (!cancelled) {
this.b((Packet) (new Packet28EntityVelocity(this.tracker))); this.broadcastIncludingSelf((Packet) (new Packet28EntityVelocity(this.tracker)));
} }
// CraftBukkit end // CraftBukkit end
this.tracker.velocityChanged = false; this.tracker.velocityChanged = false;
} }
} }
public void a(Packet packet) { public void broadcast(Packet packet) {
Iterator iterator = this.trackedPlayers.iterator(); Iterator iterator = this.trackedPlayers.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -163,15 +163,15 @@ public class EntityTrackerEntry {
} }
} }
public void b(Packet packet) { public void broadcastIncludingSelf(Packet packet) {
this.a(packet); this.broadcast(packet);
if (this.tracker instanceof EntityPlayer) { if (this.tracker instanceof EntityPlayer) {
((EntityPlayer) this.tracker).netServerHandler.sendPacket(packet); ((EntityPlayer) this.tracker).netServerHandler.sendPacket(packet);
} }
} }
public void a() { public void a() {
this.a((Packet) (new Packet29DestroyEntity(this.tracker.id))); this.broadcast(new Packet29DestroyEntity(this.tracker.id));
} }
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
@ -235,7 +235,8 @@ public class EntityTrackerEntry {
private Packet b() { private Packet b() {
if (this.tracker.dead) { 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) { if (this.tracker instanceof EntityItem) {
@ -331,15 +332,15 @@ public class EntityTrackerEntry {
if (this.tracker instanceof EntityFallingBlock) { if (this.tracker instanceof EntityFallingBlock) {
EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker; EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
if (entityfallingblock.a == Block.SAND.id) { if (entityfallingblock.id == Block.SAND.id) {
return new Packet23VehicleSpawn(this.tracker, 70); return new Packet23VehicleSpawn(this.tracker, 70);
} }
if (entityfallingblock.a == Block.GRAVEL.id) { if (entityfallingblock.id == Block.GRAVEL.id) {
return new Packet23VehicleSpawn(this.tracker, 71); 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); return new Packet23VehicleSpawn(this.tracker, 74);
} }
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -109,7 +109,7 @@ public class Explosion {
d0 = entity.locX - this.posX; d0 = entity.locX - this.posX;
d1 = entity.locY - this.posY; d1 = entity.locY - this.posY;
d2 = entity.locZ - this.posZ; 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; d0 /= d8;
d1 /= d8; d1 /= d8;
@ -223,7 +223,7 @@ public class Explosion {
double d3 = d0 - this.posX; double d3 = d0 - this.posX;
double d4 = d1 - this.posY; double d4 = d1 - this.posY;
double d5 = d2 - this.posZ; 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; d3 /= d6;
d4 /= d6; d4 /= d6;

Datei anzeigen

@ -17,13 +17,13 @@ public class FoodMetaData {
public 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.foodLevel = Math.min(i + this.foodLevel, 20);
this.saturationLevel = Math.min(this.saturationLevel + (float) i * f * 2.0F, (float) this.foodLevel); this.saturationLevel = Math.min(this.saturationLevel + (float) i * f * 2.0F, (float) this.foodLevel);
} }
public void a(ItemFood itemfood) { public void a(ItemFood itemfood) {
this.a(itemfood.o(), itemfood.p()); this.eat(itemfood.getNutrition(), itemfood.getSaturationModifier());
} }
public void a(EntityHuman entityhuman) { public void a(EntityHuman entityhuman) {
@ -50,7 +50,7 @@ public class FoodMetaData {
++this.foodTickTimer; ++this.foodTickTimer;
if (this.foodTickTimer >= 80) { if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason. // 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; this.foodTickTimer = 0;
} }
} else if (this.foodLevel <= 0) { } else if (this.foodLevel <= 0) {

Datei anzeigen

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

Datei anzeigen

@ -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; int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
// CraftBukkit start // CraftBukkit start
if (a(world, i, j, k, i1, block, entityhuman)) { if (place(world, i, j, k, i1, block, entityhuman)) {
--itemstack.count; --itemstack.count;
return true; 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 // 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 // CraftBukkit end
byte b0 = 0; byte b0 = 0;
byte b1 = 0; byte b1 = 0;

Datei anzeigen

@ -10,13 +10,13 @@ public class ItemDye extends Item {
public ItemDye(int i) { public ItemDye(int i) {
super(i); super(i);
this.a(true); this.a(true);
this.f(0); this.setMaxDurability(0);
} }
public String a(ItemStack itemstack) { public String a(ItemStack itemstack) {
int i = MathHelper.a(itemstack.getData(), 0, 15); 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) { 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) { if (!world.isStatic) {
// CraftBukkit start // CraftBukkit start
Player player = (entityhuman instanceof EntityPlayer) ? (Player)entityhuman.getBukkitEntity() : null; 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 //--itemstack.count; - called later if the bonemeal attempt was succesful
// CraftBukkit end // CraftBukkit end
} }
@ -42,7 +42,7 @@ public class ItemDye extends Item {
// CraftBukkit start // CraftBukkit start
if (!world.isStatic) { if (!world.isStatic) {
Player player = (entityhuman instanceof EntityPlayer) ? (Player)entityhuman.getBukkitEntity() : null; 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 //--itemstack.count; - called later if the bonemeal attempt was succesful
// CraftBukkit end // CraftBukkit end
} }

Datei anzeigen

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

Datei anzeigen

@ -13,7 +13,7 @@ public class ItemFlintAndSteel extends Item {
public ItemFlintAndSteel(int i) { public ItemFlintAndSteel(int i) {
super(i); super(i);
this.maxStackSize = 1; 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) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {

Datei anzeigen

@ -31,11 +31,11 @@ public class ItemFood extends Item {
// CraftBukkit start // CraftBukkit start
int oldFoodLevel = entityhuman.getFoodData().foodLevel; 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); entityhuman.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.p()); entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, this.getSaturationModifier());
} }
// CraftBukkit end // CraftBukkit end
@ -62,11 +62,11 @@ public class ItemFood extends Item {
return itemstack; return itemstack;
} }
public int o() { public int getNutrition() {
return this.b; return this.b;
} }
public float p() { public float getSaturationModifier() {
return this.bS; return this.bS;
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -52,7 +52,7 @@ public class ItemReed extends Item {
} else if (itemstack.count == 0) { } else if (itemstack.count == 0) {
return false; return false;
} else { } 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]; Block block = Block.byId[this.id];
// CraftBukkit start - This executes the placement of the block // CraftBukkit start - This executes the placement of the block

Datei anzeigen

@ -90,7 +90,7 @@ public final class ItemStack {
} }
public float a(Block block) { public float a(Block block) {
return this.getItem().a(this, block); return this.getItem().getDestroySpeed(this, block);
} }
public ItemStack a(World world, EntityHuman entityhuman) { public ItemStack a(World world, EntityHuman entityhuman) {
@ -252,7 +252,7 @@ public final class ItemStack {
} }
public String toString() { 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) { public void a(World world, Entity entity, int i, boolean flag) {

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -36,7 +36,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
public class NetServerHandler extends NetHandler implements ICommandListener { 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 NetworkManager networkManager;
public boolean disconnected = false; public boolean disconnected = false;
private MinecraftServer minecraftServer; private MinecraftServer minecraftServer;
@ -142,7 +142,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
this.h = true; this.h = true;
if (!this.player.j) { if (!this.player.viewingCredits) {
double d0; double d0;
if (!this.checkMovement) { 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. 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 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.setX(packet10flying.x);
to.setY(packet10flying.y); to.setY(packet10flying.y);
to.setZ(packet10flying.z); to.setZ(packet10flying.z);
@ -239,7 +239,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
f1 = packet10flying.pitch; 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; d5 = packet10flying.x;
d4 = packet10flying.z; d4 = packet10flying.z;
} }
@ -283,18 +283,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
float f2 = this.player.yaw; float f2 = this.player.yaw;
float f3 = this.player.pitch; float f3 = this.player.pitch;
if (packet10flying.h && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) { if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
packet10flying.h = false; packet10flying.hasPos = false;
} }
if (packet10flying.h) { if (packet10flying.hasPos) {
d1 = packet10flying.x; d1 = packet10flying.x;
d2 = packet10flying.y; d2 = packet10flying.y;
d3 = packet10flying.z; d3 = packet10flying.z;
d4 = packet10flying.stance - packet10flying.y; d4 = packet10flying.stance - packet10flying.y;
if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) { if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) {
this.disconnect("Illegal stance"); 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; return;
} }
@ -322,7 +322,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d8 = d4 * d4 + d6 * d6 + d7 * d7; 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 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?)"); this.disconnect("You moved too quickly :( (Hacking?)");
return; return;
} }
@ -349,9 +349,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
d8 = d4 * d4 + d6 * d6 + d7 * d7; d8 = d4 * d4 + d6 * d6 + d7 * d7;
boolean flag1 = false; boolean flag1 = false;
if (d8 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.b()) { if (d8 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.isCreative()) {
flag1 = true; 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("Got position " + d1 + ", " + d2 + ", " + d3);
System.out.println("Expected " + this.player.locX + ", " + this.player.locY + ", " + this.player.locZ); 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); 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) { if (d9 >= -0.03125D) {
++this.g; ++this.g;
if (this.g > 80) { 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"); this.disconnect("Flying is not enabled on this server");
return; return;
} }
@ -381,7 +381,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.player.onGround = packet10flying.g; this.player.onGround = packet10flying.g;
this.minecraftServer.serverConfigurationManager.d(this.player); 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); 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. // Else we increment the drop count and check the amount.
this.dropCount++; this.dropCount++;
if (this.dropCount >= 20) { 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?)"); this.disconnect("You dropped your items too quickly (Hacking?)");
return; return;
} }
@ -651,7 +651,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(String s, Object[] aobject) { public void a(String s, Object[] aobject) {
if (this.disconnected) return; // CraftBukkit - rarely it would send a disconnect line twice 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 // CraftBukkit start - we need to handle custom quit messages
String quitMessage = this.minecraftServer.serverConfigurationManager.disconnect(this.player); String quitMessage = this.minecraftServer.serverConfigurationManager.disconnect(this.player);
if ((quitMessage != null) && (quitMessage.length() > 0)) { if ((quitMessage != null) && (quitMessage.length() > 0)) {
@ -663,7 +663,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet packet) { public void a(Packet packet) {
if (this.disconnected) return; // CraftBukkit 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"); this.disconnect("Protocol error, unexpected packet");
} }
@ -678,7 +678,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.networkManager.queue(new Packet3Chat(line)); this.networkManager.queue(new Packet3Chat(line));
} }
packet = null; packet = null;
} else if (packet.l == true) { } else if (packet.lowPriority == true) {
// Reroute all low-priority packets through to compression thread. // Reroute all low-priority packets through to compression thread.
ChunkCompressionThread.sendPacket(this.player, packet); ChunkCompressionThread.sendPacket(this.player, packet);
packet = null; packet = null;
@ -691,14 +691,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start // CraftBukkit start
if (this.player.dead) return; 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); PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
// CraftBukkit end // CraftBukkit end
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex; this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
} else { } 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) { public boolean chat(String s) {
if (!this.player.dead) { if (!this.player.dead) {
if (s.length() == 0) { 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; 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. /* CraftBukkit start - No longer neaded as we have already handled it in server.dispatchCommand above.
if (s.toLowerCase().startsWith("/me ")) { if (s.toLowerCase().startsWith("/me ")) {
s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim(); s = "* " + this.player.name + " " + s.substring(s.indexOf(" ")).trim();
a.info(s); logger.info(s);
this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s)); this.minecraftServer.serverConfigurationManager.sendAll(new Packet3Chat(s));
} else if (s.toLowerCase().startsWith("/kill")) { } else if (s.toLowerCase().startsWith("/kill")) {
this.player.damageEntity(DamageSource.GENERIC, 1000); 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 = s.substring(s.indexOf(" ")).trim(); s = s.substring(s.indexOf(" ")).trim();
s = "\u00A77" + this.player.name + " whispers " + s; 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)))) { if (!this.minecraftServer.serverConfigurationManager.a(astring[1], (Packet) (new Packet3Chat(s)))) {
this.sendPacket(new Packet3Chat("\u00A7cThere\'s no player by that name online.")); 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)) { if (this.minecraftServer.serverConfigurationManager.isOp(this.player.name)) {
s1 = s.substring(1); 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); this.minecraftServer.issueCommand(s1, this);
} else { } else {
s1 = s.substring(1); s1 = s.substring(1);
a.info(this.player.name + " tried command: " + s1); logger.info(this.player.name + " tried command: " + s1);
} }
} }
// CraftBukkit end */ // CraftBukkit end */
@ -893,7 +893,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.networkManager.a("disconnect.quitting", new Object[0]); this.networkManager.a("disconnect.quitting", new Object[0]);
} }
public int b() { public int lowPriorityCount() {
return this.networkManager.e(); 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) { if (entity != null && this.player.g(entity) && this.player.i(entity) < 36.0D) {
ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit
if (packet7useentity.c == 0) { if (packet7useentity.action == 0) {
// CraftBukkit start // CraftBukkit start
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity()); PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity());
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
@ -927,15 +927,15 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (itemInHand != null && itemInHand.count <= -1) { if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer); 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)) { if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow)) {
String type = entity.getClass().getSimpleName(); String type = entity.getClass().getSimpleName();
disconnect("Attacking an " + type + " is not permitted"); disconnect("Attacking an " + type + " is not permitted");
System.out.println("Player " + player.name + " tried to attack an " + type + ", so I have disconnected them for exploiting."); System.out.println("Player " + player.name + " tried to attack an " + type + ", so I have disconnected them for exploiting.");
return; return;
} }
this.player.f(entity); this.player.attack(entity);
if (itemInHand != null && itemInHand.count <= -1) { if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer); this.player.updateInventory(this.player.activeContainer);
@ -946,7 +946,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
public void a(Packet9Respawn packet9respawn) { public void a(Packet9Respawn packet9respawn) {
if (this.player.j) { if (this.player.viewingCredits) {
// CraftBukkit start // CraftBukkit start
CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0); CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0);
ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn(); ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn();
@ -962,7 +962,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
// CraftBukkit start // CraftBukkit start
this.getPlayer().setHandle(this.player); 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 // CraftBukkit end
} }
@ -1007,10 +1007,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
public void a(Packet107SetCreativeSlot packet107setcreativeslot) { public void a(Packet107SetCreativeSlot packet107setcreativeslot) {
if (this.player.itemInWorldManager.b()) { if (this.player.itemInWorldManager.isCreative()) {
boolean flag = packet107setcreativeslot.a < 0; boolean flag = packet107setcreativeslot.a < 0;
ItemStack itemstack = packet107setcreativeslot.b; 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 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; boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -15,10 +15,10 @@ public class WorldMapHumanTracker {
private int f; private int f;
private byte[] g; private byte[] g;
final WorldMap d; final WorldMap worldMap;
public WorldMapHumanTracker(WorldMap worldmap, EntityHuman entityhuman) { public WorldMapHumanTracker(WorldMap worldmap, EntityHuman entityhuman) {
this.d = worldmap; this.worldMap = worldmap;
this.b = new int[128]; this.b = new int[128];
this.c = new int[128]; this.c = new int[128];
this.e = 0; this.e = 0;
@ -34,8 +34,8 @@ public class WorldMapHumanTracker {
public byte[] a(ItemStack itemstack) { public byte[] a(ItemStack itemstack) {
int i; int i;
int j; 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) { if (--this.f < 0) {
this.f = 4; this.f = 4;
@ -47,7 +47,7 @@ public class WorldMapHumanTracker {
for (i = 0; i < render.cursors.size(); ++i) { for (i = 0; i < render.cursors.size(); ++i) {
MapCursor cursor = render.cursors.get(i); MapCursor cursor = render.cursors.get(i);
if (!cursor.isVisible()) continue; if (!cursor.isVisible()) continue;
byte value = (byte) (((cursor.getRawType() == 0 || cursor.getDirection() < 8 ? cursor.getDirection() : cursor.getDirection() - 1) & 15) * 16); byte value = (byte) (((cursor.getRawType() == 0 || cursor.getDirection() < 8 ? cursor.getDirection() : cursor.getDirection() - 1) & 15) * 16);
abyte[i * 3 + 1] = (byte) (value | (cursor.getRawType() != 0 && value < 0 ? 16 - cursor.getRawType() : cursor.getRawType())); abyte[i * 3 + 1] = (byte) (value | (cursor.getRawType() != 0 && value < 0 ? 16 - cursor.getRawType() : cursor.getRawType()));
abyte[i * 3 + 2] = (byte) cursor.getX(); abyte[i * 3 + 2] = (byte) cursor.getX();

Datei anzeigen

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