Update CraftBukkit to Minecraft 1.4.6

This commit is contained in:
feildmaster 2012-12-19 22:03:52 -06:00
parent 9f1bf124ee
commit 23b6764374
115 changed files with 1930 additions and 1426 deletions

View File

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.4.5-R1.1-SNAPSHOT</version>
<version>1.4.6-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>http://www.bukkit.org</url>
@ -12,8 +12,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version>
<junit.version>4.11</junit.version>
<minecraft.version>1.4.5</minecraft.version>
<minecraft_version>1_4_5</minecraft_version>
<minecraft.version>1.4.6</minecraft.version>
<minecraft_version>1_4_6</minecraft_version>
</properties>
<scm>
@ -288,7 +288,7 @@
<version>2.11</version>
<configuration>
<workingDirectory>${basedir}/target/test-server</workingDirectory>
<excludes>
<excludes>
<exclude>org/bukkit/craftbukkit/updater/BukkitDLUpdaterServiceTest.java</exclude>
<exclude>org/bukkit/craftbukkit/inventory/ItemStackBookTest.java</exclude>
<exclude>org/bukkit/craftbukkit/inventory/ItemStackLeatherTest.java</exclude>

View File

@ -5,8 +5,8 @@ import java.util.Random;
public class BlockDispenser extends BlockContainer {
public static final IRegistry a = new RegistryDefault(new DispenseBehaviorItem());
private Random b = new Random();
public static boolean eventFired = false; // CraftBukkit
private Random b = new Random();
protected BlockDispenser(int i) {
super(i, Material.STONE);
@ -160,7 +160,7 @@ public class BlockDispenser extends BlockContainer {
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, k1, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
}
float f3 = 0.05F;
@ -179,9 +179,9 @@ public class BlockDispenser extends BlockContainer {
public static IPosition a(ISourceBlock isourceblock) {
EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
double d0 = isourceblock.getX() + 0.6D * (double) enumfacing.c();
double d0 = isourceblock.getX() + 0.7D * (double) enumfacing.c();
double d1 = isourceblock.getY();
double d2 = isourceblock.getZ() + 0.6D * (double) enumfacing.e();
double d2 = isourceblock.getZ() + 0.7D * (double) enumfacing.e();
return new Position(d0, d1, d2);
}

View File

@ -8,6 +8,7 @@ public class BlockDragonEgg extends Block {
public BlockDragonEgg(int i, int j) {
super(i, j, Material.DRAGON_EGG);
this.a(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
}
public void onPlace(World world, int i, int j, int k) {

View File

@ -163,7 +163,7 @@ public class BlockLeaves extends BlockTransparant {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.bT() != null && entityhuman.bT().id == Item.SHEARS.id) {
if (!world.isStatic && entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
} else {
@ -182,4 +182,8 @@ public class BlockLeaves extends BlockTransparant {
public int a(int i, int j) {
return (j & 3) == 1 ? this.textureId + 80 : ((j & 3) == 3 ? this.textureId + 144 : this.textureId);
}
protected ItemStack f_(int i) {
return new ItemStack(this.id, 1, i & 3);
}
}

View File

@ -65,7 +65,7 @@ public class BlockLever extends Block {
return k1 + j1;
}
public static int d(int i) {
public static int e(int i) {
switch (i) {
case 0:
return 0;

View File

@ -155,7 +155,7 @@ public class BlockSkull extends BlockContainer {
if (!world.isStatic) {
entitywither = new EntityWither(world);
entitywither.setPositionRotation((double) i + 0.5D, (double) j - 1.45D, (double) (k + i1) + 1.5D, 90.0F, 0.0F);
entitywither.aw = 90.0F;
entitywither.ax = 90.0F;
entitywither.m();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {

View File

@ -56,6 +56,10 @@ public class BlockSoil extends Block {
public void a(World world, int i, int j, int k, Entity entity, float f) {
if (!world.isStatic && world.random.nextFloat() < f - 0.5F) {
if (!(entity instanceof EntityHuman) && !world.getGameRules().getBoolean("mobGriefing")) {
return;
}
// CraftBukkit start - interact soil
org.bukkit.event.Cancellable cancellable;
if (entity instanceof EntityHuman) {

View File

@ -53,7 +53,7 @@ public class BlockTNT extends Block {
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (entityhuman.bT() != null && entityhuman.bT().id == Item.FLINT_AND_STEEL.id) {
if (entityhuman.bS() != null && entityhuman.bS().id == Item.FLINT_AND_STEEL.id) {
this.postBreak(world, i, j, k, 1);
world.setTypeId(i, j, k, 0);
return true;

View File

@ -76,7 +76,7 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (!world.isStatic) {
if (entityhuman.bT() != null && entityhuman.bT().id == Item.SHEARS.id) {
if (entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
world.setData(i, j, k, l | 8);
}
}

View File

@ -299,7 +299,7 @@ public class BlockVine extends Block {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
if (!world.isStatic && entityhuman.bT() != null && entityhuman.bT().id == Item.SHEARS.id) {
if (!world.isStatic && entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.VINE, 1, 0));
} else {

View File

@ -88,7 +88,7 @@ public class Chunk {
int k1 = j1 >> 4;
if (this.sections[k1] == null) {
this.sections[k1] = new ChunkSection(k1 << 4);
this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.f);
}
this.sections[k1].a(l, j1 & 15, i1, b0);
@ -387,7 +387,7 @@ public class Chunk {
return false;
}
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4);
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f);
flag = j >= k1;
}
@ -498,14 +498,14 @@ public class Chunk {
public int getBrightness(EnumSkyBlock enumskyblock, int i, int j, int k) {
ChunkSection chunksection = this.sections[j >> 4];
return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? chunksection.c(i, j & 15, k) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.d(i, j & 15, k) : enumskyblock.c));
return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.f ? 0 : chunksection.c(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.d(i, j & 15, k) : enumskyblock.c));
}
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4);
chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f);
this.initLighting();
}

View File

@ -194,6 +194,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
ChunkSection[] achunksection = chunk.i();
NBTTagList nbttaglist = new NBTTagList("Sections");
boolean flag = !world.worldProvider.f;
ChunkSection[] achunksection1 = achunksection;
int i = achunksection.length;
@ -211,8 +212,13 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
nbttagcompound1.setByteArray("Data", chunksection.j().a);
nbttagcompound1.setByteArray("SkyLight", chunksection.l().a);
nbttagcompound1.setByteArray("BlockLight", chunksection.k().a);
if (flag) {
nbttagcompound1.setByteArray("SkyLight", chunksection.l().a);
} else {
nbttagcompound1.setByteArray("SkyLight", new byte[chunksection.k().a.length]);
}
nbttaglist.add(nbttagcompound1);
}
}
@ -285,11 +291,12 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
NBTTagList nbttaglist = nbttagcompound.getList("Sections");
byte b0 = 16;
ChunkSection[] achunksection = new ChunkSection[b0];
boolean flag = !world.worldProvider.f;
for (int k = 0; k < nbttaglist.size(); ++k) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(k);
byte b1 = nbttagcompound1.getByte("Y");
ChunkSection chunksection = new ChunkSection(b1 << 4);
ChunkSection chunksection = new ChunkSection(b1 << 4, flag);
chunksection.a(nbttagcompound1.getByteArray("Blocks"));
if (nbttagcompound1.hasKey("Add")) {
@ -297,8 +304,11 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
}
chunksection.b(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4));
chunksection.d(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4));
chunksection.c(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4));
if (flag) {
chunksection.d(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4));
}
chunksection.recalcBlockCounts();
achunksection[b1] = chunksection;
}

View File

@ -11,16 +11,18 @@ public class ChunkSection {
private NibbleArray blockLight;
private NibbleArray skyLight;
public ChunkSection(int i) {
public ChunkSection(int i, boolean flag) {
this.yPos = i;
this.blockIds = new byte[4096];
this.blockData = new NibbleArray(this.blockIds.length, 4);
this.skyLight = new NibbleArray(this.blockIds.length, 4);
this.blockLight = new NibbleArray(this.blockIds.length, 4);
if (flag) {
this.skyLight = new NibbleArray(this.blockIds.length, 4);
}
}
// CraftBukkit start
public ChunkSection(int y, byte[] blkIds, byte[] extBlkIds) {
public ChunkSection(int y, boolean flag, byte[] blkIds, byte[] extBlkIds) {
this.yPos = y;
this.blockIds = blkIds;
if (extBlkIds != null) {
@ -28,7 +30,9 @@ public class ChunkSection {
}
this.blockData = new NibbleArray(this.blockIds.length, 4);
this.blockLight = new NibbleArray(this.blockIds.length, 4);
this.skyLight = new NibbleArray(this.blockIds.length, 4);
if (flag) {
this.skyLight = new NibbleArray(this.blockIds.length, 4);
}
this.recalcBlockCounts();
}
// CraftBukkit end

View File

@ -186,7 +186,7 @@ public abstract class Container {
slot.a(entityhuman, playerinventory.getCarried());
} else if (slot.isAllowed(itemstack3)) {
if (itemstack1.id == itemstack3.id && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) {
if (itemstack1.id == itemstack3.id && itemstack1.getData() == itemstack3.getData() && ItemStack.equals(itemstack1, itemstack3)) {
l = j == 0 ? itemstack3.count : 1;
if (l > slot.a() - itemstack1.count) {
l = slot.a() - itemstack1.count;
@ -241,10 +241,12 @@ public abstract class Container {
if ((slot.inventory != playerinventory || !slot.isAllowed(itemstack1)) && itemstack1 != null) {
if (l > -1) {
playerinventory.pickup(itemstack1);
slot.a(itemstack2.count);
slot.set((ItemStack) null);
slot.a(entityhuman, itemstack2);
}
} else {
slot.a(itemstack2.count);
slot.set(itemstack1);
slot.a(entityhuman, itemstack2);
}

View File

@ -72,6 +72,7 @@ public class ContainerAnvil extends Container {
ItemStack itemstack1 = itemstack.cloneItemStack();
ItemStack itemstack2 = this.g.getItem(1);
Map map = EnchantmentManager.a(itemstack1);
boolean flag = false;
int k = b0 + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost());
this.l = 0;
@ -79,10 +80,12 @@ public class ContainerAnvil extends Container {
int i1;
int j1;
int k1;
Enchantment enchantment;
int l1;
Iterator iterator;
Enchantment enchantment;
if (itemstack2 != null) {
flag = itemstack2.id == Item.ENCHANTED_BOOK.id && Item.ENCHANTED_BOOK.g(itemstack2).size() > 0;
if (itemstack1.f() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
l = Math.min(itemstack1.i(), itemstack1.k() / 4);
if (l <= 0) {
@ -100,19 +103,19 @@ public class ContainerAnvil extends Container {
this.l = i1;
} else {
if (itemstack1.id != itemstack2.id || !itemstack1.f()) {
if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.f())) {
this.f.setItem(0, (ItemStack) null);
this.a = 0;
return;
}
if (itemstack1.f()) {
if (itemstack1.f() && !flag) {
l = itemstack.k() - itemstack.i();
i1 = itemstack2.k() - itemstack2.i();
j1 = i1 + itemstack1.k() * 12 / 100;
int l1 = l + j1;
int i2 = l + j1;
k1 = itemstack1.k() - l1;
k1 = itemstack1.k() - i2;
if (k1 < 0) {
k1 = 0;
}
@ -131,45 +134,50 @@ public class ContainerAnvil extends Container {
j1 = ((Integer) iterator.next()).intValue();
enchantment = Enchantment.byId[j1];
k1 = map.containsKey(Integer.valueOf(j1)) ? ((Integer) map.get(Integer.valueOf(j1))).intValue() : 0;
int i2 = ((Integer) map1.get(Integer.valueOf(j1))).intValue();
l1 = ((Integer) map1.get(Integer.valueOf(j1))).intValue();
int j2;
if (k1 == i2) {
++i2;
j2 = i2;
if (k1 == l1) {
++l1;
j2 = l1;
} else {
j2 = Math.max(i2, k1);
j2 = Math.max(l1, k1);
}
l1 = j2;
int k2 = l1 - k1;
boolean flag1 = enchantment.canEnchant(itemstack);
if (this.n.abilities.canInstantlyBuild) {
flag1 = true;
}
i2 = j2;
int k2 = i2 - k1;
boolean flag = true;
Iterator iterator1 = map.keySet().iterator();
while (iterator1.hasNext()) {
int l2 = ((Integer) iterator1.next()).intValue();
if (l2 != j1 && !enchantment.a(Enchantment.byId[l2])) {
flag = false;
flag1 = false;
i += k2;
}
}
if (flag) {
if (i2 > enchantment.getMaxLevel()) {
i2 = enchantment.getMaxLevel();
if (flag1) {
if (l1 > enchantment.getMaxLevel()) {
l1 = enchantment.getMaxLevel();
}
map.put(Integer.valueOf(j1), Integer.valueOf(i2));
byte b1 = 0;
map.put(Integer.valueOf(j1), Integer.valueOf(l1));
int i3 = 0;
switch (enchantment.getRandomWeight()) {
case 1:
b1 = 8;
i3 = 8;
break;
case 2:
b1 = 4;
i3 = 4;
case 3:
case 4:
@ -181,14 +189,14 @@ public class ContainerAnvil extends Container {
break;
case 5:
b1 = 2;
i3 = 2;
break;
case 10:
b1 = 1;
i3 = 1;
}
i += b1 * k2;
i += i3 * k2;
}
}
}
@ -206,21 +214,19 @@ public class ContainerAnvil extends Container {
l = 0;
byte b2;
for (iterator = map.keySet().iterator(); iterator.hasNext(); k += l + k1 * b2) {
for (iterator = map.keySet().iterator(); iterator.hasNext(); k += l + k1 * l1) {
j1 = ((Integer) iterator.next()).intValue();
enchantment = Enchantment.byId[j1];
k1 = ((Integer) map.get(Integer.valueOf(j1))).intValue();
b2 = 0;
l1 = 0;
++l;
switch (enchantment.getRandomWeight()) {
case 1:
b2 = 8;
l1 = 8;
break;
case 2:
b2 = 4;
l1 = 4;
case 3:
case 4:
@ -232,12 +238,20 @@ public class ContainerAnvil extends Container {
break;
case 5:
b2 = 2;
l1 = 2;
break;
case 10:
b2 = 1;
l1 = 1;
}
if (flag) {
l1 = Math.max(1, l1 / 2);
}
}
if (flag) {
k = Math.max(1, k / 2);
}
this.a = k + i;

View File

@ -1,6 +1,5 @@
package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
@ -152,6 +151,7 @@ public class ContainerEnchantTable extends Container {
if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) {
if (!this.world.isStatic) {
List list = EnchantmentManager.b(this.l, itemstack, this.costs[i]);
boolean flag = itemstack.id == Item.BOOK.id;
if (list != null) {
// CraftBukkit start
@ -170,6 +170,7 @@ public class ContainerEnchantTable extends Container {
return false;
}
// TODO: Apply Diffs
entityhuman.levelDown(-level);
for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
try {

View File

@ -61,7 +61,7 @@ public class ContainerPlayer extends Container {
}
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
player.netServerHandler.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
player.playerConnection.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
// CraftBukkit end
}

View File

@ -63,7 +63,7 @@ public class ContainerWorkbench extends Container {
}
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
player.netServerHandler.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
player.playerConnection.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
// CraftBukkit end
}

View File

@ -53,20 +53,20 @@ public class ControllerLook {
// CraftBukkit end
this.a.pitch = this.a(this.a.pitch, f1, this.c);
this.a.ay = this.a(this.a.ay, f, this.b);
this.a.az = this.a(this.a.az, f, this.b);
} else {
this.a.ay = this.a(this.a.ay, this.a.aw, 10.0F);
this.a.az = this.a(this.a.az, this.a.ax, 10.0F);
}
float f2 = MathHelper.g(this.a.ay - this.a.aw);
float f2 = MathHelper.g(this.a.az - this.a.ax);
if (!this.a.getNavigation().f()) {
if (f2 < -75.0F) {
this.a.ay = this.a.aw - 75.0F;
this.a.az = this.a.ax - 75.0F;
}
if (f2 > 75.0F) {
this.a.ay = this.a.aw + 75.0F;
this.a.az = this.a.ax + 75.0F;
}
}
}

View File

@ -29,9 +29,10 @@ public class CraftingManager {
(new RecipesCrafting()).a(this);
(new RecipesArmor()).a(this);
(new RecipesDyes()).a(this);
this.recipes.add(new RecipesArmorDye());
this.recipes.add(new RecipesMapClone());
this.recipes.add(new RecipesMapExtend());
this.recipes.add(new RecipeArmorDye());
this.recipes.add(new RecipeMapClone());
this.recipes.add(new RecipeMapExtend());
this.recipes.add(new RecipeFireworks());
this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
this.registerShapelessRecipe(new ItemStack(Item.BOOK, 1), new Object[] { Item.PAPER, Item.PAPER, Item.PAPER, Item.LEATHER});
this.registerShapelessRecipe(new ItemStack(Item.BOOK_AND_QUILL, 1), new Object[] { Item.BOOK, new ItemStack(Item.INK_SACK, 1, 0), Item.FEATHER});
@ -54,6 +55,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 6), new Object[] { "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
@ -93,7 +95,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.SPRUCE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
this.registerShapedRecipe(new ItemStack(Block.JUNGLE_WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 3)});
this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
this.registerShapedRecipe(new ItemStack(Item.CARROT_STICK, 1), new Object[] { "# ", " X", Character.valueOf('#'), Item.FISHING_ROD, Character.valueOf('X'), Item.CARROT});
this.registerShapedRecipe(new ItemStack(Item.CARROT_STICK, 1), new Object[] { "# ", " X", Character.valueOf('#'), Item.FISHING_ROD, Character.valueOf('X'), Item.CARROT}).c();
this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE});
this.registerShapedRecipe(new ItemStack(Block.BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
@ -136,7 +138,7 @@ public class CraftingManager {
// CraftBukkit end
// CraftBukkit - default -> public
public void registerShapedRecipe(ItemStack itemstack, Object... aobject) {
public ShapedRecipes registerShapedRecipe(ItemStack itemstack, Object... aobject) {
String s = "";
int i = 0;
int j = 0;
@ -191,7 +193,10 @@ public class CraftingManager {
}
}
this.recipes.add(new ShapedRecipes(j, k, aitemstack, itemstack));
ShapedRecipes shapedrecipes = new ShapedRecipes(j, k, aitemstack, itemstack);
this.recipes.add(shapedrecipes);
return shapedrecipes;
}
// CraftBukkit - default -> public

View File

@ -47,7 +47,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
// CraftBukkit end
log.info("Starting minecraft server version 1.4.5");
log.info("Starting minecraft server version 1.4.6");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
@ -101,6 +101,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return false;
}
this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
if (!this.getOnlineMode()) {
log.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
log.warning("The server will make no attempt to authenticate usernames. Beware.");
@ -108,7 +110,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
log.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
this.a((ServerConfigurationManagerAbstract) (new ServerConfigurationManager(this)));
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
long j = System.nanoTime();
@ -264,8 +266,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return true;
}
public ServerConfigurationManager am() {
return (ServerConfigurationManager) super.getServerConfigurationManager();
public DedicatedPlayerList am() {
return (DedicatedPlayerList) super.getPlayerList();
}
public ServerConnection ae() {
@ -319,7 +321,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return this.propertyManager.getInt("spawn-protection", super.getSpawnProtection());
}
public ServerConfigurationManagerAbstract getServerConfigurationManager() {
public PlayerList getPlayerList() {
return this.am();
}
}

View File

@ -38,20 +38,20 @@ public class DedicatedServerConnectionThread extends Thread {
synchronized (this.b) {
for (int i = 0; i < this.b.size(); ++i) {
NetLoginHandler netloginhandler = (NetLoginHandler) this.b.get(i);
PendingConnection pendingconnection = (PendingConnection) this.b.get(i);
try {
netloginhandler.c();
pendingconnection.c();
} catch (Exception exception) {
netloginhandler.disconnect("Internal server error");
a.log(Level.WARNING, "Failed to handle packet for " + netloginhandler.getName() + ": " + exception, exception);
pendingconnection.disconnect("Internal server error");
a.log(Level.WARNING, "Failed to handle packet for " + pendingconnection.getName() + ": " + exception, exception);
}
if (netloginhandler.c) {
if (pendingconnection.c) {
this.b.remove(i--);
}
netloginhandler.networkManager.a();
pendingconnection.networkManager.a();
}
}
}
@ -83,9 +83,9 @@ public class DedicatedServerConnectionThread extends Thread {
this.c.put(inetaddress, Long.valueOf(i));
}
NetLoginHandler netloginhandler = new NetLoginHandler(this.f.d(), socket, "Connection #" + this.d++);
PendingConnection pendingconnection = new PendingConnection(this.f.d(), socket, "Connection #" + this.d++);
this.a(netloginhandler);
this.a(pendingconnection);
} catch (IOException ioexception) {
a.warning("DSCT: " + ioexception.getMessage()); // CraftBukkit
}
@ -94,14 +94,14 @@ public class DedicatedServerConnectionThread extends Thread {
System.out.println("Closing listening thread");
}
private void a(NetLoginHandler netloginhandler) {
if (netloginhandler == null) {
private void a(PendingConnection pendingconnection) {
if (pendingconnection == null) {
throw new IllegalArgumentException("Got null pendingconnection!");
} else {
List list = this.b;
synchronized (this.b) {
this.b.add(netloginhandler);
this.b.add(pendingconnection);
}
}
}

View File

@ -61,7 +61,7 @@ public class DispenseBehaviorItem implements IDispenseBehavior {
return false;
}
entityitem.itemStack = CraftItemStack.asNMSCopy(event.getItem());
entityitem.setItemStack(CraftItemStack.asNMSCopy(event.getItem()));
entityitem.motX = event.getVelocity().getX();
entityitem.motY = event.getVelocity().getY();
entityitem.motZ = event.getVelocity().getZ();

View File

@ -28,10 +28,10 @@ public class DispenseBehaviorMinecart extends DispenseBehaviorItem {
int l = world.getTypeId(i, j, k);
double d3;
if (BlockMinecartTrack.d(l)) {
if (BlockMinecartTrack.e(l)) {
d3 = 0.0D;
} else {
if (l != 0 || !BlockMinecartTrack.d(world.getTypeId(i, j - 1, k))) {
if (l != 0 || !BlockMinecartTrack.e(world.getTypeId(i, j - 1, k))) {
return this.c.a(isourceblock, itemstack);
}

View File

@ -52,8 +52,4 @@ public class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
// CraftBukkit end
return itemstack;
}
protected void a(ISourceBlock isourceblock) {
isourceblock.k().triggerEffect(1002, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ(), 0);
}
}

View File

@ -1,9 +1,12 @@
package net.minecraft.server;
import java.util.ArrayList;
public abstract class Enchantment {
// CraftBukkit - update CraftEnchant.getName(i) if this changes
public static final Enchantment[] byId = new Enchantment[256];
public static final Enchantment[] c;
public static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentProtection(0, 10, 0);
public static final Enchantment PROTECTION_FIRE = new EnchantmentProtection(1, 5, 1);
public static final Enchantment PROTECTION_FALL = new EnchantmentProtection(2, 5, 2);
@ -11,6 +14,7 @@ public abstract class Enchantment {
public static final Enchantment PROTECTION_PROJECTILE = new EnchantmentProtection(4, 5, 4);
public static final Enchantment OXYGEN = new EnchantmentOxygen(5, 2);
public static final Enchantment WATER_WORKER = new EnchantmentWaterWorker(6, 2);
public static final Enchantment THORNS = new EnchantmentThorns(7, 1);
public static final Enchantment DAMAGE_ALL = new EnchantmentWeaponDamage(16, 10, 0);
public static final Enchantment DAMAGE_UNDEAD = new EnchantmentWeaponDamage(17, 5, 1);
public static final Enchantment DAMAGE_ARTHROPODS = new EnchantmentWeaponDamage(18, 5, 2);
@ -89,4 +93,25 @@ public abstract class Enchantment {
return s + " " + LocaleI18n.get("enchantment.level." + i);
}
public boolean canEnchant(ItemStack itemstack) {
return this.slot.canEnchant(itemstack.getItem());
}
static {
ArrayList arraylist = new ArrayList();
Enchantment[] aenchantment = byId;
int i = aenchantment.length;
for (int j = 0; j < i; ++j) {
Enchantment enchantment = aenchantment[j];
if (enchantment != null) {
arraylist.add(enchantment);
}
}
c = (Enchantment[]) arraylist.toArray(new Enchantment[0]);
}
}

View File

@ -99,11 +99,11 @@ public abstract class Entity {
public boolean am;
public int portalCooldown;
protected boolean ao;
private int h;
protected int ap;
public int dimension;
protected int aq;
protected int ar;
private boolean invulnerable;
public EnumEntitySize ar;
public EnumEntitySize as;
public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
public boolean valid = false; // CraftBukkit
@ -139,9 +139,9 @@ public abstract class Entity {
this.fireProof = false;
this.datawatcher = new DataWatcher();
this.ah = false;
this.aq = 0;
this.ar = 0;
this.invulnerable = false;
this.ar = EnumEntitySize.SIZE_2;
this.as = EnumEntitySize.SIZE_2;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
if (world != null) {
@ -177,17 +177,17 @@ public abstract class Entity {
float f2 = f % 2.0F;
if ((double) f2 < 0.375D) {
this.ar = EnumEntitySize.SIZE_1;
this.as = EnumEntitySize.SIZE_1;
} else if ((double) f2 < 0.75D) {
this.ar = EnumEntitySize.SIZE_2;
this.as = EnumEntitySize.SIZE_2;
} else if ((double) f2 < 1.0D) {
this.ar = EnumEntitySize.SIZE_3;
this.as = EnumEntitySize.SIZE_3;
} else if ((double) f2 < 1.375D) {
this.ar = EnumEntitySize.SIZE_4;
this.as = EnumEntitySize.SIZE_4;
} else if ((double) f2 < 1.75D) {
this.ar = EnumEntitySize.SIZE_5;
this.as = EnumEntitySize.SIZE_5;
} else {
this.ar = EnumEntitySize.SIZE_6;
this.as = EnumEntitySize.SIZE_6;
}
}
@ -243,7 +243,6 @@ public abstract class Entity {
this.vehicle = null;
}
++this.ticksLived;
this.P = this.Q;
this.lastX = this.locX;
this.lastY = this.locY;
@ -259,8 +258,8 @@ public abstract class Entity {
i = this.z();
if (this.ao) {
if (true || minecraftserver.getAllowNether()) { // CraftBukkit
if (this.vehicle == null && this.h++ >= i) {
this.h = i;
if (this.vehicle == null && this.ap++ >= i) {
this.ap = i;
this.portalCooldown = this.ab();
byte b0;
@ -276,12 +275,12 @@ public abstract class Entity {
this.ao = false;
}
} else {
if (this.h > 0) {
this.h -= 4;
if (this.ap > 0) {
this.ap -= 4;
}
if (this.h < 0) {
this.h = 0;
if (this.ap < 0) {
this.ap = 0;
}
}
@ -398,6 +397,7 @@ public abstract class Entity {
public void setOnFire(int i) {
int j = i * 20;
j = EnchantmentProtection.a(this, j);
if (this.fireTicks < j) {
this.fireTicks = j;
}
@ -760,7 +760,7 @@ public abstract class Entity {
}
}
protected void makeSound(String s, float f, float f1) {
public void makeSound(String s, float f, float f1) {
this.world.makeSound(this, s, f, f1);
}
@ -868,7 +868,7 @@ public abstract class Entity {
int l = this.world.getTypeId(i, j, k);
if (l != 0 && Block.byId[l].material == material) {
float f = BlockFluids.d(this.world.getData(i, j, k)) - 0.11111111F;
float f = BlockFluids.e(this.world.getData(i, j, k)) - 0.11111111F;
float f1 = (float) (j + 1) - f;
return d0 < (double) f1;
@ -1341,7 +1341,7 @@ public abstract class Entity {
}
public void V() {
if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bW()) {
if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bV()) {
this.passenger.T = this.T;
this.passenger.U = this.U + this.X() + this.passenger.W();
this.passenger.V = this.V;
@ -1478,7 +1478,7 @@ public abstract class Entity {
double d1 = this.lastZ - this.locZ;
if (!this.world.isStatic && !this.ao) {
this.aq = Direction.a(d0, d1);
this.ar = Direction.a(d0, d1);
}
this.ao = true;
@ -1722,7 +1722,7 @@ public abstract class Entity {
entity.d(nbttagcompound);
this.e(nbttagcompound);
this.portalCooldown = entity.portalCooldown;
this.aq = entity.aq;
this.ar = entity.ar;
}
public void b(int i) {
@ -1737,7 +1737,7 @@ public abstract class Entity {
this.world.kill(this);
this.dead = false;
this.world.methodProfiler.a("reposition");
minecraftserver.getServerConfigurationManager().a(this, j, worldserver, worldserver1);
minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1);
this.world.methodProfiler.c("reloading");
Entity entity = EntityTypes.createEntityByName(EntityTypes.b(this), worldserver1);
@ -1763,7 +1763,7 @@ public abstract class Entity {
}
public int at() {
return this.aq;
return this.ar;
}
public boolean au() {

View File

@ -22,16 +22,12 @@ public abstract class EntityAgeable extends EntityCreature {
entityageable.setAge(-24000);
entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
// CraftBukkit start
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.count--;
if (itemstack.count == 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, null);
--itemstack.count;
if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinit"
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
}
// CraftBukkit end
}
}
}

View File

@ -21,17 +21,19 @@ public class EntityArrow extends Entity implements IProjectile {
public int shake = 0;
public Entity shooter;
private int j;
private int as = 0;
private int at = 0;
private double damage = 2.0D;
private int au;
private int av;
public EntityArrow(World world) {
super(world);
this.l = 10.0D;
this.a(0.5F, 0.5F);
}
public EntityArrow(World world, double d0, double d1, double d2) {
super(world);
this.l = 10.0D;
this.a(0.5F, 0.5F);
this.setPosition(d0, d1, d2);
this.height = 0.0F;
@ -39,6 +41,7 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world, EntityLiving entityliving, EntityLiving entityliving1, float f, float f1) {
super(world);
this.l = 10.0D;
this.shooter = entityliving;
if (entityliving instanceof EntityHuman) {
this.fromPlayer = 1;
@ -66,6 +69,7 @@ public class EntityArrow extends Entity implements IProjectile {
public EntityArrow(World world, EntityLiving entityliving, float f) {
super(world);
this.l = 10.0D;
this.shooter = entityliving;
if (entityliving instanceof EntityHuman) {
this.fromPlayer = 1;
@ -149,10 +153,10 @@ public class EntityArrow extends Entity implements IProjectile {
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
this.as = 0;
this.at = 0;
}
} else {
++this.as;
++this.at;
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
@ -173,7 +177,7 @@ public class EntityArrow extends Entity implements IProjectile {
for (l = 0; l < list.size(); ++l) {
Entity entity1 = (Entity) list.get(l);
if (entity1.L() && (entity1 != this.shooter || this.as >= 5)) {
if (entity1.L() && (entity1 != this.shooter || this.at >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
@ -194,6 +198,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
float f2;
float f3;
if (movingobjectposition != null) {
// CraftBukkit start
@ -219,7 +224,7 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit start - moved damage call
if (movingobjectposition.entity.damageEntity(damagesource, i1)) {
if (this.isBurning() && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player.
if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player.
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
@ -231,30 +236,37 @@ public class EntityArrow extends Entity implements IProjectile {
// if (movingobjectposition.entity.damageEntity(damagesource, i1)) { // CraftBukkit - moved up
if (movingobjectposition.entity instanceof EntityLiving) {
if (!this.world.isStatic) {
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
if (!this.world.isStatic) {
entityliving.r(entityliving.bJ() + 1);
}
if (this.au > 0) {
float f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (this.av > 0) {
f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
if (f3 > 0.0F) {
movingobjectposition.entity.g(this.motX * (double) this.au * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.au * 0.6000000238418579D / (double) f3);
movingobjectposition.entity.g(this.motX * (double) this.av * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.av * 0.6000000238418579D / (double) f3);
}
}
EnchantmentThorns.a(this.shooter, entityliving, this.random);
if (this.shooter != null && movingobjectposition.entity != this.shooter && movingobjectposition.entity instanceof EntityHuman && this.shooter instanceof EntityPlayer) {
((EntityPlayer) this.shooter).playerConnection.sendPacket(new Packet70Bed(6, 0));
}
}
this.makeSound("random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.die();
if (!(movingobjectposition.entity instanceof EntityEnderman)) {
this.die();
}
} else {
this.motX *= -0.10000000149011612D;
this.motY *= -0.10000000149011612D;
this.motZ *= -0.10000000149011612D;
this.yaw += 180.0F;
this.lastYaw += 180.0F;
this.as = 0;
this.at = 0;
}
} else {
this.d = movingobjectposition.b;
@ -314,9 +326,8 @@ public class EntityArrow extends Entity implements IProjectile {
f1 = 0.05F;
if (this.H()) {
for (int j1 = 0; j1 < 4; ++j1) {
float f5 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f5, this.locY - this.motY * (double) f5, this.locZ - this.motZ * (double) f5, this.motX, this.motY, this.motZ);
f3 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
}
f4 = 0.8F;
@ -406,7 +417,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
public void a(int i) {
this.au = i;
this.av = i;
}
public boolean aq() {

View File

@ -10,7 +10,7 @@ public class EntityBlaze extends EntityMonster {
super(world);
this.texture = "/mob/fire.png";
this.fireProof = true;
this.bc = 10;
this.bd = 10;
}
public int getMaxHealth() {

View File

@ -73,7 +73,7 @@ public abstract class EntityCreature extends EntityLiving {
this.world.methodProfiler.b();
if (!this.b && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
} else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bA < 100) {
} else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bB < 100) {
this.i();
}
@ -97,7 +97,7 @@ public abstract class EntityCreature extends EntityLiving {
}
}
this.bE = false;
this.bF = false;
if (vec3d != null) {
double d1 = vec3d.c - this.locX;
double d2 = vec3d.e - this.locZ;
@ -106,7 +106,7 @@ public abstract class EntityCreature extends EntityLiving {
float f2 = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = MathHelper.g(f2 - this.yaw);
this.bC = this.bG;
this.bD = this.bH;
if (f3 > 30.0F) {
f3 = 30.0F;
}
@ -123,12 +123,12 @@ public abstract class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
this.bB = -MathHelper.sin(f3) * this.bC * 1.0F;
this.bC = MathHelper.cos(f3) * this.bC * 1.0F;
this.bC = -MathHelper.sin(f3) * this.bC * 1.0F;
this.bD = MathHelper.cos(f3) * this.bC * 1.0F;
}
if (d3 > 0.0D) {
this.bE = true;
this.bF = true;
}
}
@ -137,11 +137,11 @@ public abstract class EntityCreature extends EntityLiving {
}
if (this.positionChanged && !this.k()) {
this.bE = true;
this.bF = true;
}
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
this.bE = true;
this.bF = true;
}
this.world.methodProfiler.b();

View File

@ -25,20 +25,20 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
public EntityComplexPart h;
public EntityComplexPart i;
public EntityComplexPart j;
public EntityComplexPart bI;
public EntityComplexPart bJ;
public EntityComplexPart bK;
public float bL = 0.0F;
public EntityComplexPart bL;
public float bM = 0.0F;
public boolean bN = false;
public float bN = 0.0F;
public boolean bO = false;
private Entity bR;
public int bP = 0;
public EntityEnderCrystal bQ = null;
public boolean bP = false;
private Entity bS;
public int bQ = 0;
public EntityEnderCrystal bR = null;
public EntityEnderDragon(World world) {
super(world);
this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bI = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bJ = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bJ = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
this.setHealth(this.getMaxHealth());
this.texture = "/mob/enderdragon/ender.png";
this.a(16.0F, 8.0F);
@ -84,14 +84,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
if (!this.world.isStatic) {
this.datawatcher.watch(16, Integer.valueOf(this.health));
} else {
f = MathHelper.cos(this.bM * 3.1415927F * 2.0F);
f1 = MathHelper.cos(this.bL * 3.1415927F * 2.0F);
f = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
f1 = MathHelper.cos(this.bM * 3.1415927F * 2.0F);
if (f1 <= -0.3F && f >= -0.3F) {
this.world.b(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F);
this.world.a(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F, false);
}
}
this.bL = this.bM;
this.bM = this.bN;
float f2;
if (this.health <= 0) {
@ -103,10 +103,10 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.h();
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motY);
if (this.bO) {
this.bM += f * 0.5F;
if (this.bP) {
this.bN += f * 0.5F;
} else {
this.bM += f;
this.bN += f;
}
this.yaw = MathHelper.g(this.yaw);
@ -130,14 +130,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
float f3;
if (this.world.isStatic) {
if (this.bs > 0) {
d0 = this.locX + (this.bt - this.locX) / (double) this.bs;
d1 = this.locY + (this.bu - this.locY) / (double) this.bs;
d2 = this.locZ + (this.bv - this.locZ) / (double) this.bs;
if (this.bt > 0) {
d0 = this.locX + (this.bt - this.locX) / (double) this.bt;
d1 = this.locY + (this.bu - this.locY) / (double) this.bt;
d2 = this.locZ + (this.bv - this.locZ) / (double) this.bt;
d3 = MathHelper.g(this.bw - (double) this.yaw);
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bs);
this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bs);
--this.bs;
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bt);
this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bt);
--this.bt;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
}
@ -146,9 +146,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d1 = this.b - this.locY;
d2 = this.c - this.locZ;
d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (this.bR != null) {
this.a = this.bR.locX;
this.c = this.bR.locZ;
if (this.bS != null) {
this.a = this.bS.locX;
this.c = this.bS.locZ;
double d4 = this.a - this.locX;
double d5 = this.c - this.locZ;
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
@ -158,13 +158,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d7 = 10.0D;
}
this.b = this.bR.boundingBox.b + d7;
this.b = this.bS.boundingBox.b + d7;
} else {
this.a += this.random.nextGaussian() * 2.0D;
this.c += this.random.nextGaussian() * 2.0D;
}
if (this.bN || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
if (this.bO || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
this.i();
}
@ -199,7 +199,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
f4 = 0.0F;
}
this.bD *= 0.8F;
this.bE *= 0.8F;
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
@ -207,13 +207,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d10 = 40.0D;
}
this.bD = (float) ((double) this.bD + d9 * (0.699999988079071D / d10 / (double) f5));
this.yaw += this.bD * 0.1F;
this.bE = (float) ((double) this.bE + d9 * (0.699999988079071D / d10 / (double) f5));
this.yaw += this.bE * 0.1F;
float f6 = (float) (2.0D / (d10 + 1.0D));
float f7 = 0.06F;
this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6)));
if (this.bO) {
if (this.bP) {
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
} else {
this.move(this.motX, this.motY, this.motZ);
@ -228,17 +228,17 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.motY *= 0.9100000262260437D;
}
this.aw = this.yaw;
this.ax = this.yaw;
this.g.width = this.g.length = 3.0F;
this.i.width = this.i.length = 2.0F;
this.j.width = this.j.length = 2.0F;
this.bI.width = this.bI.length = 2.0F;
this.bJ.width = this.bJ.length = 2.0F;
this.h.length = 3.0F;
this.h.width = 5.0F;
this.bJ.length = 2.0F;
this.bJ.width = 4.0F;
this.bK.length = 3.0F;
this.bK.length = 2.0F;
this.bK.width = 4.0F;
this.bL.length = 3.0F;
this.bL.width = 4.0F;
f1 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
f2 = MathHelper.cos(f1);
float f9 = -MathHelper.sin(f1);
@ -248,21 +248,21 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.h.j_();
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
this.bJ.j_();
this.bJ.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
this.bK.j_();
this.bK.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
this.bK.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
this.bL.j_();
this.bL.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
if (!this.world.isStatic && this.hurtTicks == 0) {
this.a(this.world.getEntities(this, this.bJ.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.a(this.world.getEntities(this, this.bK.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.a(this.world.getEntities(this, this.bL.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D)));
}
double[] adouble = this.a(5, 1.0F);
double[] adouble1 = this.a(0, 1.0F);
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bD * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bD * 0.01F);
f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bE * 0.01F);
float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bE * 0.01F);
this.g.j_();
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F);
@ -279,7 +279,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
if (j == 2) {
entitycomplexpart = this.bI;
entitycomplexpart = this.bJ;
}
double[] adouble2 = this.a(12 + j * 2, 1.0F);
@ -300,13 +300,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
private void h() {
if (this.bQ != null) {
if (this.bQ.dead) {
if (this.bR != null) {
if (this.bR.dead) {
if (!this.world.isStatic) {
this.a(this.g, DamageSource.EXPLOSION, 10);
}
this.bQ = null;
this.bR = null;
} else if (this.ticksLived % 10 == 0 && this.health < this.getMaxHealth()) {
// CraftBukkit start
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
@ -336,7 +336,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
this.bQ = entityendercrystal;
this.bR = entityendercrystal;
}
}
@ -382,9 +382,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
private void i() {
this.bN = false;
this.bO = false;
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
this.bR = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
this.bS = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
} else {
boolean flag = false;
@ -401,7 +401,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
} while (!flag);
this.bR = null;
this.bS = null;
}
}
@ -482,7 +482,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.a = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.b = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.bR = null;
this.bS = null;
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
this.dealDamage(damagesource, i);
}
@ -499,8 +499,8 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
protected void aP() {
++this.bP;
if (this.bP >= 180 && this.bP <= 200) {
++this.bQ;
if (this.bQ >= 180 && this.bQ <= 200) {
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
@ -512,7 +512,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
int j;
if (!this.world.isStatic) {
if (this.bP > 150 && this.bP % 5 == 0) {
if (this.bQ > 150 && this.bQ % 5 == 0) {
i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
while (i > 0) {
@ -522,14 +522,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
if (this.bP == 1) {
if (this.bQ == 1) {
this.world.e(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
}
this.move(0.0D, 0.10000000149011612D, 0.0D);
this.aw = this.yaw += 20.0F;
if (this.bP == 200 && !this.world.isStatic) {
this.ax = this.yaw += 20.0F;
if (this.bQ == 200 && !this.world.isStatic) {
i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
while (i > 0) {
@ -599,7 +599,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
for (Iterator it = this.world.players.iterator(); it.hasNext();) {
EntityHuman entity = (EntityHuman) it.next();
if (entity instanceof EntityPlayer) {
((EntityPlayer) entity).netServerHandler.sendPacket(packet);
((EntityPlayer) entity).playerConnection.sendPacket(packet);
}
}
}

View File

@ -29,7 +29,7 @@ public class EntityEnderPearl extends EntityProjectile {
if (this.getShooter() != null && this.getShooter() instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) this.getShooter();
if (!entityplayer.netServerHandler.disconnected && entityplayer.world == this.world) {
if (!entityplayer.playerConnection.disconnected && entityplayer.world == this.world) {
// CraftBukkit start
org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
org.bukkit.Location location = getBukkitEntity().getLocation();
@ -39,14 +39,14 @@ public class EntityEnderPearl extends EntityProjectile {
PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
Bukkit.getPluginManager().callEvent(teleEvent);
if (!teleEvent.isCancelled() && !entityplayer.netServerHandler.disconnected) {
entityplayer.netServerHandler.teleport(teleEvent.getTo());
if (!teleEvent.isCancelled() && !entityplayer.playerConnection.disconnected) {
entityplayer.playerConnection.teleport(teleEvent.getTo());
this.getShooter().fallDistance = 0.0F;
EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), player, EntityDamageByEntityEvent.DamageCause.FALL, 5);
Bukkit.getPluginManager().callEvent(damageEvent);
if (!damageEvent.isCancelled() && !entityplayer.netServerHandler.disconnected) {
if (!damageEvent.isCancelled() && !entityplayer.playerConnection.disconnected) {
entityplayer.invulnerableTicks = -1; // Remove spawning invulnerability
player.setLastDamageCause(damageEvent);
entityplayer.damageEntity(DamageSource.FALL, damageEvent.getDamage());

View File

@ -15,7 +15,7 @@ public class EntityEnderman extends EntityMonster {
public EntityEnderman(World world) {
super(world);
this.texture = "/mob/enderman.png";
this.bG = 0.2F;
this.bH = 0.2F;
this.a(0.6F, 2.9F);
this.X = 1.0F;
}
@ -87,7 +87,7 @@ public class EntityEnderman extends EntityMonster {
this.damageEntity(DamageSource.DROWN, 1);
}
this.bG = this.target != null ? 6.5F : 0.3F;
this.bH = this.target != null ? 6.5F : 0.3F;
int i;
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
@ -143,13 +143,13 @@ public class EntityEnderman extends EntityMonster {
}
}
if (this.G()) {
if (this.G() || this.isBurning()) {
this.target = null;
this.f(false);
this.m();
}
this.bE = false;
this.bF = false;
if (this.target != null) {
this.a(this.target, 100.0F, 100.0F);
}
@ -157,8 +157,8 @@ public class EntityEnderman extends EntityMonster {
if (!this.world.isStatic && this.isAlive()) {
if (this.target != null) {
if (this.target instanceof EntityHuman && this.d((EntityHuman) this.target)) {
this.bB = this.bC = 0.0F;
this.bG = 0.0F;
this.bC = this.bD = 0.0F;
this.bH = 0.0F;
if (this.target.e((Entity) this) < 16.0D) {
this.m();
}
@ -316,21 +316,20 @@ public class EntityEnderman extends EntityMonster {
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.isInvulnerable()) {
return false;
} else if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
if (this.m()) {
return true;
}
}
return false;
} else {
if (damagesource.getEntity() instanceof EntityHuman) {
this.f(true);
}
this.f(true);
if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
if (this.m()) {
return true;
}
}
return super.damageEntity(damagesource, i);
return false;
} else {
return super.damageEntity(damagesource, i);
}
}
}

View File

@ -150,8 +150,8 @@ public class EntityExperienceOrb extends Entity {
public void c_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
if (this.c == 0 && entityhuman.bR == 0) {
entityhuman.bR = 2;
if (this.c == 0 && entityhuman.bS == 0) {
entityhuman.bS = 2;
this.makeSound("random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
entityhuman.receive(this, 1);
entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value to event.getAmount()

View File

@ -25,7 +25,7 @@ public class EntityFallingBlock extends Entity {
this.dropItem = true;
this.e = false;
this.hurtEntities = false;
this.fallHurtMax = 20;
this.fallHurtMax = 40;
this.fallHurtAmount = 2.0F;
}
@ -39,7 +39,7 @@ public class EntityFallingBlock extends Entity {
this.dropItem = true;
this.e = false;
this.hurtEntities = false;
this.fallHurtMax = 20;
this.fallHurtMax = 40;
this.fallHurtAmount = 2.0F;
this.id = i;
this.data = j;
@ -84,12 +84,13 @@ public class EntityFallingBlock extends Entity {
int k = MathHelper.floor(this.locZ);
if (this.c == 1) {
if (this.c == 1 && this.world.getTypeId(i, j, k) == this.id && this.world.getData(i, j, k) == this.data && !CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, 0, 0).isCancelled()) { // CraftBukkit - compare data and call event
this.world.setTypeId(i, j, k, 0);
} else {
// CraftBukkit - compare data and call event
if (this.c != 1 || this.world.getTypeId(i, j, k) != this.id || this.world.getData(i, j, k) != this.data || CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, 0, 0).isCancelled()) {
this.die();
return; // CraftBukkit
return;
}
this.world.setTypeId(i, j, k, 0);
}
if (this.onGround) {
@ -196,4 +197,10 @@ public class EntityFallingBlock extends Entity {
public void e(boolean flag) {
this.hurtEntities = flag;
}
public void a(CrashReportSystemDetails crashreportsystemdetails) {
super.a(crashreportsystemdetails);
crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(this.id));
crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data));
}
}

View File

@ -13,7 +13,7 @@ public abstract class EntityFireball extends Entity {
private boolean i = false;
public EntityLiving shooter;
private int j;
private int as = 0;
private int at = 0;
public double dirX;
public double dirY;
public double dirZ;
@ -86,9 +86,9 @@ public abstract class EntityFireball extends Entity {
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
this.as = 0;
this.at = 0;
} else {
++this.as;
++this.at;
}
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
@ -108,7 +108,7 @@ public abstract class EntityFireball extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.L() && (!entity1.i(this.shooter) || this.as >= 25)) {
if (entity1.L() && (!entity1.i(this.shooter) || this.at >= 25)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);

View File

@ -18,14 +18,14 @@ public class EntityFishingHook extends Entity {
public EntityHuman owner;
private int i;
private int j = 0;
private int as = 0;
private int at = 0;
public Entity hooked = null;
private int at;
private double au;
private int au;
private double av;
private double aw;
private double ax;
private double ay;
private double az;
public EntityFishingHook(World world) {
super(world);
@ -79,20 +79,20 @@ public class EntityFishingHook extends Entity {
public void j_() {
super.j_();
if (this.at > 0) {
double d0 = this.locX + (this.au - this.locX) / (double) this.at;
double d1 = this.locY + (this.av - this.locY) / (double) this.at;
double d2 = this.locZ + (this.aw - this.locZ) / (double) this.at;
double d3 = MathHelper.g(this.ax - (double) this.yaw);
if (this.au > 0) {
double d0 = this.locX + (this.av - this.locX) / (double) this.au;
double d1 = this.locY + (this.aw - this.locY) / (double) this.au;
double d2 = this.locZ + (this.ax - this.locZ) / (double) this.au;
double d3 = MathHelper.g(this.ay - (double) this.yaw);
this.yaw = (float) ((double) this.yaw + d3 / (double) this.at);
this.pitch = (float) ((double) this.pitch + (this.ay - (double) this.pitch) / (double) this.at);
--this.at;
this.yaw = (float) ((double) this.yaw + d3 / (double) this.au);
this.pitch = (float) ((double) this.pitch + (this.az - (double) this.pitch) / (double) this.au);
--this.au;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
ItemStack itemstack = this.owner.bT();
ItemStack itemstack = this.owner.bS();
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
this.die();
@ -230,8 +230,8 @@ public class EntityFishingHook extends Entity {
}
if (d6 > 0.0D) {
if (this.as > 0) {
--this.as;
if (this.at > 0) {
--this.at;
} else {
short short1 = 500;
@ -240,7 +240,7 @@ public class EntityFishingHook extends Entity {
}
if (this.random.nextInt(short1) == 0) {
this.as = this.random.nextInt(30) + 10;
this.at = this.random.nextInt(30) + 10;
this.motY -= 0.20000000298023224D;
this.makeSound("random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
float f3 = (float) MathHelper.floor(this.boundingBox.b);
@ -264,7 +264,7 @@ public class EntityFishingHook extends Entity {
}
}
if (this.as > 0) {
if (this.at > 0) {
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
}
@ -329,7 +329,7 @@ public class EntityFishingHook extends Entity {
this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
this.hooked.motZ += d2 * d4;
b0 = 3;
} else if (this.as > 0) {
} else if (this.at > 0) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
@ -353,7 +353,7 @@ public class EntityFishingHook extends Entity {
entityitem.motZ = d7 * d9;
this.world.addEntity(entityitem);
this.owner.a(StatisticList.B, 1);
this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(3) + 1));
this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(6) + 1));
b0 = 1;
}

View File

@ -16,13 +16,14 @@ public class EntityGhast extends EntityFlying implements IMonster {
private int i = 0;
public int f = 0;
public int g = 0;
private int explosionPower = 1;
public EntityGhast(World world) {
super(world);
this.texture = "/mob/ghast.png";
this.a(4.0F, 4.0F);
this.fireProof = true;
this.bc = 5;
this.bd = 5;
}
public boolean damageEntity(DamageSource damagesource, int i) {
@ -129,7 +130,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
double d7 = this.target.locZ - this.locZ;
this.aw = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
this.ax = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
if (this.n(this.target)) {
if (this.g == 10) {
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
@ -139,6 +140,8 @@ public class EntityGhast extends EntityFlying implements IMonster {
if (this.g == 20) {
this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7);
entitylargefireball.e = this.explosionPower;
double d8 = 4.0D;
Vec3D vec3d = this.i(1.0F);
@ -152,7 +155,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
--this.g;
}
} else {
this.aw = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
this.ax = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
if (this.g > 0) {
--this.g;
}
@ -232,4 +235,16 @@ public class EntityGhast extends EntityFlying implements IMonster {
public int bv() {
return 1;
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setInt("ExplosionPower", this.explosionPower);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
if (nbttagcompound.hasKey("ExplosionPower")) {
this.explosionPower = nbttagcompound.getInt("ExplosionPower");
}
}
}

View File

@ -20,18 +20,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public Container defaultContainer;
public Container activeContainer;
protected FoodMetaData foodData = new FoodMetaData();
protected int bM = 0;
public byte bN = 0;
public float bO;
protected int bN = 0;
public byte bO = 0;
public float bP;
public float bQ;
public String name;
public int bR = 0;
public double bS;
public int bS = 0;
public double bT;
public double bU;
public double bV;
public double bW;
public double bX;
public double bY;
// CraftBukkit start
public boolean sleeping; // protected -> public
public boolean fauxSleeping;
@ -42,10 +42,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
public ChunkCoordinates bZ;
public ChunkCoordinates ca;
public int sleepTicks; // CraftBukkit - private -> public
public float ca;
public float cb;
public float cc;
private ChunkCoordinates c;
private boolean d;
private ChunkCoordinates e;
@ -56,8 +56,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public float exp;
private ItemStack f;
private int g;
protected float cg = 0.1F;
protected float ch = 0.02F;
protected float ch = 0.1F;
protected float ci = 0.02F;
private int h = 0;
public EntityFishingHook hookedFish = null;
@ -69,8 +69,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
ChunkCoordinates chunkcoordinates = world.getSpawn();
this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F);
this.aI = "humanoid";
this.aH = 180.0F;
this.aJ = "humanoid";
this.aI = 180.0F;
this.maxFireTicks = 20;
this.texture = "/mob/char.png";
}
@ -107,7 +107,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public boolean bh() {
return this.bM() && Item.byId[this.f.id].d_(this.f) == EnumAnimation.d;
return this.bM() && Item.byId[this.f.id].b_(this.f) == EnumAnimation.d;
}
public void j_() {
@ -127,8 +127,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
if (this.bR > 0) {
--this.bR;
if (this.bS > 0) {
--this.bS;
}
if (this.isSleeping()) {
@ -161,41 +161,41 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.extinguish();
}
this.bS = this.bV;
this.bT = this.bW;
this.bU = this.bX;
double d0 = this.locX - this.bV;
double d1 = this.locY - this.bW;
double d2 = this.locZ - this.bX;
this.bV = this.bY;
double d0 = this.locX - this.bW;
double d1 = this.locY - this.bX;
double d2 = this.locZ - this.bY;
double d3 = 10.0D;
if (d0 > d3) {
this.bS = this.bV = this.locX;
this.bT = this.bW = this.locX;
}
if (d2 > d3) {
this.bU = this.bX = this.locZ;
this.bV = this.bY = this.locZ;
}
if (d1 > d3) {
this.bT = this.bW = this.locY;
this.bU = this.bX = this.locY;
}
if (d0 < -d3) {
this.bS = this.bV = this.locX;
this.bT = this.bW = this.locX;
}
if (d2 < -d3) {
this.bU = this.bX = this.locZ;
this.bV = this.bY = this.locZ;
}
if (d1 < -d3) {
this.bT = this.bW = this.locY;
this.bU = this.bX = this.locY;
}
this.bV += d0 * 0.25D;
this.bX += d2 * 0.25D;
this.bW += d1 * 0.25D;
this.bW += d0 * 0.25D;
this.bY += d2 * 0.25D;
this.bX += d1 * 0.25D;
this.a(StatisticList.k, 1);
if (this.vehicle == null) {
this.e = null;
@ -214,7 +214,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return 10;
}
protected void makeSound(String s, float f, float f1) {
public void makeSound(String s, float f, float f1) {
this.world.a(this, s, f, f1);
}
@ -275,13 +275,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
float f1 = this.pitch;
super.U();
this.bO = this.bP;
this.bP = 0.0F;
this.bP = this.bQ;
this.bQ = 0.0F;
this.k(this.locX - d0, this.locY - d1, this.locZ - d2);
if (this.vehicle instanceof EntityPig) {
this.pitch = f1;
this.yaw = f;
this.aw = ((EntityPig) this.vehicle).aw;
this.ax = ((EntityPig) this.vehicle).ax;
}
}
@ -290,8 +290,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public void c() {
if (this.bM > 0) {
--this.bM;
if (this.bN > 0) {
--this.bN;
}
if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 * 12 == 0) {
@ -300,13 +300,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
this.inventory.j();
this.bO = this.bP;
this.bP = this.bQ;
super.c();
this.aM = this.abilities.b();
this.aN = this.ch;
this.aN = this.abilities.b();
this.aO = this.ci;
if (this.isSprinting()) {
this.aM = (float) ((double) this.aM + (double) this.abilities.b() * 0.3D);
this.aN = (float) ((double) this.aN + (double) this.ch * 0.3D);
this.aN = (float) ((double) this.aN + (double) this.abilities.b() * 0.3D);
this.aO = (float) ((double) this.aO + (double) this.ci * 0.3D);
}
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@ -325,8 +325,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f1 = 0.0F;
}
this.bP += (f - this.bP) * 0.4F;
this.ba += (f1 - this.ba) * 0.8F;
this.bQ += (f - this.bQ) * 0.4F;
this.bb += (f1 - this.bb) * 0.8F;
if (this.getHealth() > 0) {
List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.5D, 1.0D));
@ -374,8 +374,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (damagesource != null) {
this.motX = (double) (-MathHelper.cos((this.aW + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
this.motZ = (double) (-MathHelper.sin((this.aW + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
this.motX = (double) (-MathHelper.cos((this.aX + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
this.motZ = (double) (-MathHelper.sin((this.aX + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
} else {
this.motX = this.motZ = 0.0D;
}
@ -393,8 +393,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
public EntityItem bR() {
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
public EntityItem f(boolean flag) {
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false);
}
public EntityItem drop(ItemStack itemstack) {
@ -457,9 +457,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public float a(Block block) {
float f = this.inventory.a(block);
int i = EnchantmentManager.getDigSpeedEnchantmentLevel(this);
ItemStack itemstack = this.inventory.getItemInHand();
if (i > 0 && this.inventory.b(block)) {
f += (float) (i * i + 1);
if (i > 0 && itemstack != null) {
float f1 = (float) (i * i + 1);
if (!itemstack.b(block) && f <= 1.0F) {
f += f1 * 0.08F;
} else {
f += f1;
}
}
if (this.hasEffect(MobEffectList.FASTER_DIG)) {
@ -490,6 +497,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
NBTTagList nbttaglist = nbttagcompound.getList("Inventory");
this.inventory.b(nbttaglist);
this.inventory.itemInHandIndex = nbttagcompound.getInt("SelectedItemSlot");
this.sleeping = nbttagcompound.getBoolean("Sleeping");
this.sleepTicks = nbttagcompound.getShort("SleepTimer");
this.exp = nbttagcompound.getFloat("XpP");
@ -497,7 +505,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = nbttagcompound.getInt("XpTotal");
this.setScore(nbttagcompound.getInt("Score"));
if (this.sleeping) {
this.bZ = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.ca = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
@ -525,6 +533,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList()));
nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex);
nbttagcompound.setBoolean("Sleeping", this.sleeping);
nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks);
nbttagcompound.setFloat("XpP", this.exp);
@ -566,7 +575,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
return false;
} else {
this.bA = 0;
this.bB = 0;
if (this.getHealth() <= 0) {
return false;
} else {
@ -622,10 +631,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (k > 0 && k <= 20) {
int l = 25 - k;
int i1 = j * l + this.aS;
int i1 = j * l + this.aT;
j = i1 / 25;
this.aS = i1 % 25;
this.aT = i1 % 25;
}
return j;
@ -670,7 +679,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.inventory.k();
}
public float bS() {
public float bR() {
int i = 0;
ItemStack[] aitemstack = this.inventory.armor;
int j = aitemstack.length;
@ -717,7 +726,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (entity.a(this)) {
return true;
} else {
ItemStack itemstack = this.bT();
ItemStack itemstack = this.bS();
if (itemstack != null && entity instanceof EntityLiving) {
if (this.abilities.canInstantlyBuild) {
@ -727,7 +736,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (itemstack.a((EntityLiving) entity)) {
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
this.bU();
this.bT();
}
return true;
@ -738,11 +747,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
public ItemStack bT() {
public ItemStack bS() {
return this.inventory.getItemInHand();
}
public void bU() {
public void bT() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
@ -823,15 +832,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
this.l(entity);
if (entity instanceof EntityLiving) {
EnchantmentThorns.a(this, (EntityLiving) entity, this.random);
}
}
ItemStack itemstack = this.bT();
ItemStack itemstack = this.bS();
if (itemstack != null && entity instanceof EntityLiving) {
itemstack.a((EntityLiving) entity, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
this.bU();
this.bT();
}
}
@ -877,7 +889,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return !this.sleeping && super.inBlock();
}
public boolean bW() {
public boolean bV() {
return false;
}
@ -955,7 +967,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.sleeping = true;
this.sleepTicks = 0;
this.bZ = new ChunkCoordinates(i, j, k);
this.ca = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
@ -965,31 +977,31 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
private void x(int i) {
this.ca = 0.0F;
this.cb = 0.0F;
this.cc = 0.0F;
switch (i) {
case 0:
this.cb = -1.8F;
this.cc = -1.8F;
break;
case 1:
this.ca = 1.8F;
break;
case 2:
this.cb = 1.8F;
break;
case 2:
this.cc = 1.8F;
break;
case 3:
this.ca = -1.8F;
this.cb = -1.8F;
}
}
public void a(boolean flag, boolean flag1, boolean flag2) {
this.a(0.6F, 1.8F);
this.e_();
ChunkCoordinates chunkcoordinates = this.bZ;
ChunkCoordinates chunkcoordinates1 = this.bZ;
ChunkCoordinates chunkcoordinates = this.ca;
ChunkCoordinates chunkcoordinates1 = this.ca;
if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false);
@ -1029,12 +1041,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (flag2) {
this.setRespawnPosition(this.bZ, false);
this.setRespawnPosition(this.ca, false);
}
}
private boolean j() {
return this.world.getTypeId(this.bZ.x, this.bZ.y, this.bZ.z) == Block.BED.id;
return this.world.getTypeId(this.ca.x, this.ca.y, this.ca.z) == Block.BED.id;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) {
@ -1121,12 +1133,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this.abilities.isFlying && this.vehicle == null) {
double d3 = this.motY;
float f2 = this.aN;
float f2 = this.aO;
this.aN = this.abilities.a();
this.aO = this.abilities.a();
super.e(f, f1);
this.motY = d3 * 0.6D;
this.aN = f2;
this.aO = f2;
} else {
super.e(f, f1);
}
@ -1244,12 +1256,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expLevel += i;
if (this.expLevel < 0) {
this.expLevel = 0;
this.exp = 0.0F;
this.expTotal = 0;
}
if (i > 0 && this.expLevel % 5 == 0 && (float) this.h < (float) this.ticksLived - 100.0F) {
float f = this.expLevel > 30 ? 1.0F : (float) this.expLevel / 30.0F;
this.makeSound("random.levelup", f * 0.75F, 1.0F);
this.world.makeSound(this, "random.levelup", f * 0.75F, 1.0F);
this.h = this.ticksLived;
}
}
@ -1270,11 +1284,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.foodData;
}
public boolean f(boolean flag) {
public boolean g(boolean flag) {
return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
}
public boolean ce() {
public boolean cd() {
return this.getHealth() > 0 && this.getHealth() < this.getMaxHealth();
}
@ -1301,8 +1315,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return true;
}
if (this.bT() != null) {
ItemStack itemstack = this.bT();
if (this.bS() != null) {
ItemStack itemstack = this.bS();
if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
return true;
@ -1345,7 +1359,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = entityhuman.expTotal;
this.exp = entityhuman.exp;
this.setScore(entityhuman.getScore());
this.aq = entityhuman.aq;
this.ar = entityhuman.ar;
} else if (this.world.getGameRules().getBoolean("keepInventory")) {
this.inventory.b(entityhuman.inventory);
this.expLevel = entityhuman.expLevel;

View File

@ -6,46 +6,47 @@ import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
public class EntityItem extends Entity {
public ItemStack itemStack;
public int age = 0;
public int age;
public int pickupDelay;
private int e = 5;
public float d = (float) (Math.random() * 3.141592653589793D * 2.0D);
private int d;
public float c;
private int lastTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
public EntityItem(World world, double d0, double d1, double d2) {
super(world);
this.age = 0;
this.d = 5;
this.c = (float) (Math.random() * 3.141592653589793D * 2.0D);
this.a(0.25F, 0.25F);
this.height = this.length / 2.0F;
this.setPosition(d0, d1, d2);
this.itemStack = itemstack;
// CraftBukkit start - infinite item fix & nullcheck
if (this.itemStack == null) {
throw new IllegalArgumentException("Can't create an EntityItem for a null item");
}
if (this.itemStack.count <= -1) {
this.itemStack.count = 1;
}
// CraftBukkit end
this.yaw = (float) (Math.random() * 360.0D);
this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
this.motY = 0.20000000298023224D;
this.motZ = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D));
}
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
this(world, d0, d1, d2);
this.setItemStack(itemstack);
}
protected boolean f_() {
return false;
}
public EntityItem(World world) {
super(world);
this.age = 0;
this.d = 5;
this.c = (float) (Math.random() * 3.141592653589793D * 2.0D);
this.a(0.25F, 0.25F);
this.height = this.length / 2.0F;
}
protected void a() {}
protected void a() {
this.getDataWatcher().a(10, 5);
}
public void j_() {
super.j_();
@ -63,7 +64,7 @@ public class EntityItem extends Entity {
this.move(this.motX, this.motY, this.motZ);
boolean flag = (int) this.lastX != (int) this.locX || (int) this.lastY != (int) this.locY || (int) this.lastZ != (int) this.locZ;
if (flag) {
if (flag || this.ticksLived % 25 == 0) {
if (this.world.getMaterial(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) == Material.LAVA) {
this.motY = 0.20000000298023224D;
this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F);
@ -72,7 +73,7 @@ public class EntityItem extends Entity {
}
if (!this.world.isStatic) {
this.d();
this.g();
}
}
@ -106,7 +107,7 @@ public class EntityItem extends Entity {
}
}
private void d() {
private void g() {
Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
while (iterator.hasNext()) {
@ -120,26 +121,26 @@ public class EntityItem extends Entity {
if (entityitem == this) {
return false;
} else if (entityitem.isAlive() && this.isAlive()) {
if (entityitem.itemStack.getItem() != this.itemStack.getItem()) {
ItemStack itemstack = this.getItemStack();
ItemStack itemstack1 = entityitem.getItemStack();
if (itemstack1.getItem() != itemstack.getItem()) {
return false;
} else if (entityitem.itemStack.hasTag() ^ this.itemStack.hasTag()) {
} else if (itemstack1.hasTag() ^ itemstack.hasTag()) {
return false;
} else if (entityitem.itemStack.hasTag() && !entityitem.itemStack.getTag().equals(this.itemStack.getTag())) {
} else if (itemstack1.hasTag() && !itemstack1.getTag().equals(itemstack.getTag())) {
return false;
} else if (entityitem.itemStack.getItem().l() && entityitem.itemStack.getData() != this.itemStack.getData()) {
} else if (itemstack1.getItem().l() && itemstack1.getData() != itemstack.getData()) {
return false;
} else if (entityitem.itemStack.count < this.itemStack.count) {
} else if (itemstack1.count < itemstack.count) {
return entityitem.a(this);
} else if (entityitem.itemStack.count + this.itemStack.count > entityitem.itemStack.getMaxStackSize()) {
} else if (itemstack1.count + itemstack.count > itemstack1.getMaxStackSize()) {
return false;
// CraftBukkit start - don't merge items with enchantments
} else if (entityitem.itemStack.hasEnchantments() || this.itemStack.hasEnchantments()) {
return false;
// CraftBukkit end
} else {
entityitem.itemStack.count += this.itemStack.count;
itemstack1.count += itemstack.count;
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, this.pickupDelay);
entityitem.age = Math.min(entityitem.age, this.age);
entityitem.setItemStack(itemstack1);
this.die();
return true;
}
@ -163,10 +164,12 @@ public class EntityItem extends Entity {
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.isInvulnerable()) {
return false;
} else if (this.getItemStack() != null && this.getItemStack().id == Item.NETHER_STAR.id && damagesource == DamageSource.EXPLOSION) {
return false;
} else {
this.K();
this.e -= i;
if (this.e <= 0) {
this.d -= i;
if (this.d <= 0) {
this.die();
}
@ -175,38 +178,39 @@ public class EntityItem extends Entity {
}
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Health", (short) ((byte) this.e));
nbttagcompound.setShort("Health", (short) ((byte) this.d));
nbttagcompound.setShort("Age", (short) this.age);
if (this.itemStack != null) {
nbttagcompound.setCompound("Item", this.itemStack.save(new NBTTagCompound()));
if (this.getItemStack() != null) {
nbttagcompound.setCompound("Item", this.getItemStack().save(new NBTTagCompound()));
}
}
public void a(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.getShort("Health") & 255;
this.d = nbttagcompound.getShort("Health") & 255;
this.age = nbttagcompound.getShort("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
this.itemStack = ItemStack.a(nbttagcompound1);
if (this.itemStack == null) {
this.setItemStack(ItemStack.a(nbttagcompound1));
if (this.getItemStack() == null) {
this.die();
}
}
public void c_(EntityHuman entityhuman) {
if ((!this.world.isStatic) && (this.itemStack != null)) { // CraftBukkit - nullcheck
int i = this.itemStack.count;
if (!this.world.isStatic) {
ItemStack itemstack = this.getItemStack();
int i = itemstack.count;
// CraftBukkit start
int canHold = entityhuman.inventory.canHold(this.itemStack);
int remaining = this.itemStack.count - canHold;
int canHold = entityhuman.inventory.canHold(itemstack);
int remaining = itemstack.count - canHold;
if (this.pickupDelay <= 0 && canHold > 0) {
this.itemStack.count = canHold;
itemstack.count = canHold;
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
event.setCancelled(!entityhuman.canPickUpLoot);
this.world.getServer().getPluginManager().callEvent(event);
this.itemStack.count = canHold + remaining;
itemstack.count = canHold + remaining;
if (event.isCancelled()) {
return;
@ -217,26 +221,26 @@ public class EntityItem extends Entity {
}
// CraftBukkit end
if (this.pickupDelay == 0 && entityhuman.inventory.pickup(this.itemStack)) {
if (this.itemStack.id == Block.LOG.id) {
if (this.pickupDelay == 0 && entityhuman.inventory.pickup(itemstack)) {
if (itemstack.id == Block.LOG.id) {
entityhuman.a((Statistic) AchievementList.g);
}
if (this.itemStack.id == Item.LEATHER.id) {
if (itemstack.id == Item.LEATHER.id) {
entityhuman.a((Statistic) AchievementList.t);
}
if (this.itemStack.id == Item.DIAMOND.id) {
if (itemstack.id == Item.DIAMOND.id) {
entityhuman.a((Statistic) AchievementList.w);
}
if (this.itemStack.id == Item.BLAZE_ROD.id) {
if (itemstack.id == Item.BLAZE_ROD.id) {
entityhuman.a((Statistic) AchievementList.z);
}
this.makeSound("random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityhuman.receive(this, i);
if (this.itemStack.count <= 0) {
if (itemstack.count <= 0) {
this.die();
}
}
@ -244,8 +248,7 @@ public class EntityItem extends Entity {
}
public String getLocalizedName() {
if (this.itemStack == null) return LocaleI18n.get("item.unknown"); // CraftBukkit - nullcheck
return LocaleI18n.get("item." + this.itemStack.a());
return LocaleI18n.get("item." + this.getItemStack().a());
}
public boolean aq() {
@ -255,7 +258,23 @@ public class EntityItem extends Entity {
public void b(int i) {
super.b(i);
if (!this.world.isStatic) {
this.d();
this.g();
}
}
public ItemStack getItemStack() {
ItemStack itemstack = this.getDataWatcher().f(10);
if (itemstack == null) {
System.out.println("Item entity " + this.id + " has no item?!");
return new ItemStack(Block.STONE);
} else {
return itemstack;
}
}
public void setItemStack(ItemStack itemstack) {
this.getDataWatcher().watch(10, itemstack);
this.getDataWatcher().h(10);
}
}

View File

@ -4,6 +4,8 @@ import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
public class EntityLargeFireball extends EntityFireball {
public int e = 1;
public EntityLargeFireball(World world) {
super(world);
}

View File

@ -104,17 +104,19 @@ public class EntityLightning extends EntityWeather {
}
}
if (!this.world.isStatic && this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit
double d0 = 3.0D;
List list = this.world.getEntities(this, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit - add !this.isEffect
if (this.world.isStatic) {
this.world.q = 2;
} else {
double d0 = 3.0D;
List list = this.world.getEntities(this, AxisAlignedBB.a().a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
for (int l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l);
for (int l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l);
entity.a(this);
entity.a(this);
}
}
this.world.r = 2;
}
}

View File

@ -15,57 +15,57 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
public abstract class EntityLiving extends Entity {
private static final float[] b = new float[] { 0.0F, 0.0F, 0.005F, 0.01F};
private static final float[] c = new float[] { 0.0F, 0.0F, 0.05F, 0.1F};
private static final float[] d = new float[] { 0.0F, 0.0F, 0.005F, 0.02F};
public static final float[] as = new float[] { 0.0F, 0.01F, 0.07F, 0.2F};
private static final float[] b = new float[] { 0.0F, 0.0F, 0.05F, 0.1F};
private static final float[] c = new float[] { 0.0F, 0.0F, 0.05F, 0.2F};
private static final float[] d = new float[] { 0.0F, 0.0F, 0.05F, 0.02F};
public static final float[] at = new float[] { 0.0F, 0.1F, 0.15F, 0.45F};
public int maxNoDamageTicks = 20;
public float au;
public float av;
public float aw = 0.0F;
public float aw;
public float ax = 0.0F;
public float ay = 0.0F;
public float az = 0.0F;
protected float aA;
public float aA = 0.0F;
protected float aB;
protected float aC;
protected float aD;
protected boolean aE = true;
protected float aE;
protected boolean aF = true;
protected String texture = "/mob/char.png";
protected boolean aG = true;
protected float aH = 0.0F;
protected String aI = null;
protected float aJ = 1.0F;
protected int aK = 0;
protected float aL = 0.0F;
public float aM = 0.1F;
public float aN = 0.02F;
public float aO;
protected boolean aH = true;
protected float aI = 0.0F;
protected String aJ = null;
protected float aK = 1.0F;
protected int aL = 0;
protected float aM = 0.0F;
public float aN = 0.1F;
public float aO = 0.02F;
public float aP;
public float aQ;
protected int health = this.getMaxHealth();
public int aR;
protected int aS;
public int aT;
public int aS;
protected int aT;
public int aU;
public int hurtTicks;
public int aV;
public float aW = 0.0F;
public int aW;
public float aX = 0.0F;
public int deathTicks = 0;
public int attackTicks = 0;
public float aZ;
public float ba;
protected boolean bb = false;
protected int bc;
public int bd = -1;
public float be = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
public float bf;
public float bb;
protected boolean bc = false;
protected int bd;
public int be = -1;
public float bf = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
public float bg;
public float bh;
public float bi;
public EntityHuman killer = null; // CraftBukkit - protected -> public
protected int lastDamageByPlayerTime = 0;
public EntityLiving lastDamager = null; // CraftBukkit - private -> public
private int f = 0;
private EntityLiving g = null;
public int bk = 0;
public int bl = 0;
public HashMap effects = new HashMap(); // CraftBukkit - protected -> public
public boolean updateEffects = true; // CraftBukkit - private -> public
private int i;
@ -76,36 +76,36 @@ public abstract class EntityLiving extends Entity {
private Navigation navigation;
protected final PathfinderGoalSelector goalSelector;
protected final PathfinderGoalSelector targetSelector;
private EntityLiving bM;
private EntitySenses bN;
private float bO;
private ChunkCoordinates bP = new ChunkCoordinates(0, 0, 0);
private float bQ = -1.0F;
private EntityLiving bN;
private EntitySenses bO;
private float bP;
private ChunkCoordinates bQ = new ChunkCoordinates(0, 0, 0);
private float bR = -1.0F;
private ItemStack[] equipment = new ItemStack[5];
public float[] dropChances = new float[5]; // CraftBukkit - protected -> public
private ItemStack[] bS = new ItemStack[5];
public boolean bp = false;
public int bq = 0;
private ItemStack[] bT = new ItemStack[5];
public boolean bq = false;
public int br = 0;
public boolean canPickUpLoot = false; // CraftBukkit - protected -> public
public boolean persistent = !this.bj(); // CraftBukkit - private -> public, change value
protected int bs;
protected double bt;
protected int bt;
protected double bu;
protected double bv;
protected double bw;
protected double bx;
float by = 0.0F;
protected double by;
float bz = 0.0F;
public int lastDamage = 0; // CraftBukkit - protected -> public
protected int bA = 0;
protected float bB;
protected int bB = 0;
protected float bC;
protected float bD;
protected boolean bE = false;
protected float bF = 0.0F;
protected float bG = 0.7F;
private int bU = 0;
private Entity bV;
protected int bH = 0;
protected float bE;
protected boolean bF = false;
protected float bG = 0.0F;
protected float bH = 0.7F;
private int bV = 0;
private Entity bW;
protected int bI = 0;
public int expToDrop = 0; // CraftBukkit
public int maxAirTicks = 300; // CraftBukkit
@ -119,12 +119,12 @@ public abstract class EntityLiving extends Entity {
this.jumpController = new ControllerJump(this);
this.senses = new EntityAIBodyControl(this);
this.navigation = new Navigation(this, world, 16.0F);
this.bN = new EntitySenses(this);
this.av = (float) (Math.random() + 1.0D) * 0.01F;
this.bO = new EntitySenses(this);
this.aw = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
this.au = (float) Math.random() * 12398.0F;
this.av = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
this.ay = this.yaw;
this.az = this.yaw;
for (int i = 0; i < this.dropChances.length; ++i) {
this.dropChances[i] = 0.05F;
@ -150,7 +150,7 @@ public abstract class EntityLiving extends Entity {
}
public EntitySenses aA() {
return this.bN;
return this.bO;
}
public Random aB() {
@ -172,19 +172,19 @@ public abstract class EntityLiving extends Entity {
}
public int aE() {
return this.bA;
return this.bB;
}
public float ap() {
return this.ay;
return this.az;
}
public float aF() {
return this.bO;
return this.bP;
}
public void e(float f) {
this.bO = f;
this.bP = f;
this.f(f);
}
@ -194,11 +194,11 @@ public abstract class EntityLiving extends Entity {
}
public EntityLiving aG() {
return this.bM;
return this.bN;
}
public void b(EntityLiving entityliving) {
this.bM = entityliving;
this.bN = entityliving;
}
public boolean a(Class oclass) {
@ -239,28 +239,28 @@ public abstract class EntityLiving extends Entity {
}
public boolean e(int i, int j, int k) {
return this.bQ == -1.0F ? true : this.bP.e(i, j, k) < this.bQ * this.bQ;
return this.bR == -1.0F ? true : this.bQ.e(i, j, k) < this.bR * this.bR;
}
public void b(int i, int j, int k, int l) {
this.bP.b(i, j, k);
this.bQ = (float) l;
this.bQ.b(i, j, k);
this.bR = (float) l;
}
public ChunkCoordinates aJ() {
return this.bP;
}
public float aK() {
return this.bQ;
}
public float aK() {
return this.bR;
}
public void aL() {
this.bQ = -1.0F;
this.bR = -1.0F;
}
public boolean aM() {
return this.bQ != -1.0F;
return this.bR != -1.0F;
}
public void c(EntityLiving entityliving) {
@ -303,11 +303,11 @@ public abstract class EntityLiving extends Entity {
}
public void y() {
this.aO = this.aP;
this.aP = this.aQ;
super.y();
this.world.methodProfiler.a("mobBaseTick");
if (this.isAlive() && this.random.nextInt(1000) < this.aT++) {
this.aT = -this.aN();
if (this.isAlive() && this.random.nextInt(1000) < this.aU++) {
this.aU = -this.aN();
this.aO();
}
@ -327,7 +327,9 @@ public abstract class EntityLiving extends Entity {
this.extinguish();
}
if (this.isAlive() && this.a(Material.WATER) && !this.bc() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) {
boolean flag = this instanceof EntityHuman && ((EntityHuman) this).abilities.isInvulnerable;
if (this.isAlive() && this.a(Material.WATER) && !this.bc() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id)) && !flag) {
this.setAirTicks(this.g(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
@ -360,7 +362,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
this.aZ = this.ba;
this.ba = this.bb;
if (this.attackTicks > 0) {
--this.attackTicks;
}
@ -398,9 +400,9 @@ public abstract class EntityLiving extends Entity {
}
this.bx();
this.aD = this.aC;
this.ax = this.aw;
this.az = this.ay;
this.aE = this.aD;
this.ay = this.ax;
this.aA = this.az;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
this.world.methodProfiler.b();
@ -453,7 +455,20 @@ public abstract class EntityLiving extends Entity {
}
protected int getExpValue(EntityHuman entityhuman) {
return this.bc;
if (this.bd > 0) {
int i = this.bd;
ItemStack[] aitemstack = this.getEquipment();
for (int j = 0; j < aitemstack.length; ++j) {
if (aitemstack[j] != null && this.dropChances[j] <= 1.0F) {
i += 1 + this.random.nextInt(3);
}
}
return i;
} else {
return this.bd;
}
}
protected boolean alwaysGivesExp() {
@ -473,8 +488,8 @@ public abstract class EntityLiving extends Entity {
public void U() {
super.U();
this.aA = this.aB;
this.aB = 0.0F;
this.aB = this.aC;
this.aC = 0.0F;
this.fallDistance = 0.0F;
}
@ -486,20 +501,20 @@ public abstract class EntityLiving extends Entity {
for (i = 0; i < 5; ++i) {
ItemStack itemstack = this.getEquipment(i);
if (!ItemStack.matches(itemstack, this.bS[i])) {
if (!ItemStack.matches(itemstack, this.bT[i])) {
((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, i, itemstack)));
this.bS[i] = itemstack == null ? null : itemstack.cloneItemStack();
this.bT[i] = itemstack == null ? null : itemstack.cloneItemStack();
}
}
i = this.bJ();
if (i > 0) {
if (this.bk <= 0) {
this.bk = 20 * (30 - i);
if (this.bl <= 0) {
this.bl = 20 * (30 - i);
}
--this.bk;
if (this.bk <= 0) {
--this.bl;
if (this.bl <= 0) {
this.r(i - 1);
}
}
@ -509,10 +524,10 @@ public abstract class EntityLiving extends Entity {
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1);
float f1 = this.aw;
float f1 = this.ax;
float f2 = 0.0F;
this.aA = this.aB;
this.aB = this.aC;
float f3 = 0.0F;
if (f > 0.0025000002F) {
@ -522,7 +537,7 @@ public abstract class EntityLiving extends Entity {
f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
}
if (this.aP > 0.0F) {
if (this.aQ > 0.0F) {
f1 = this.yaw;
}
@ -530,15 +545,15 @@ public abstract class EntityLiving extends Entity {
f3 = 0.0F;
}
this.aB += (f3 - this.aB) * 0.3F;
this.aC += (f3 - this.aC) * 0.3F;
this.world.methodProfiler.a("headTurn");
if (this.be()) {
this.senses.a();
} else {
float f4 = MathHelper.g(f1 - this.aw);
float f4 = MathHelper.g(f1 - this.ax);
this.aw += f4 * 0.3F;
float f5 = MathHelper.g(this.yaw - this.aw);
this.ax += f4 * 0.3F;
float f5 = MathHelper.g(this.yaw - this.ax);
boolean flag = f5 < -90.0F || f5 >= 90.0F;
if (f5 < -75.0F) {
@ -549,9 +564,9 @@ public abstract class EntityLiving extends Entity {
f5 = 75.0F;
}
this.aw = this.yaw - f5;
this.ax = this.yaw - f5;
if (f5 * f5 > 2500.0F) {
this.aw += f5 * 0.2F;
this.ax += f5 * 0.2F;
}
if (flag) {
@ -570,12 +585,12 @@ public abstract class EntityLiving extends Entity {
this.lastYaw += 360.0F;
}
while (this.aw - this.ax < -180.0F) {
this.ax -= 360.0F;
while (this.ax - this.ay < -180.0F) {
this.ay -= 360.0F;
}
while (this.aw - this.ax >= 180.0F) {
this.ax += 360.0F;
while (this.ax - this.ay >= 180.0F) {
this.ay += 360.0F;
}
while (this.pitch - this.lastPitch < -180.0F) {
@ -586,16 +601,16 @@ public abstract class EntityLiving extends Entity {
this.lastPitch += 360.0F;
}
while (this.ay - this.az < -180.0F) {
this.az -= 360.0F;
while (this.az - this.aA < -180.0F) {
this.aA -= 360.0F;
}
while (this.ay - this.az >= 180.0F) {
this.az += 360.0F;
while (this.az - this.aA >= 180.0F) {
this.aA += 360.0F;
}
this.world.methodProfiler.b();
this.aC += f2;
this.aD += f2;
}
// CraftBukkit start - delegate so we can handle providing a reason for health being regained
@ -640,17 +655,18 @@ public abstract class EntityLiving extends Entity {
} else if (this.world.isStatic) {
return false;
} else {
this.bA = 0;
this.bB = 0;
if (this.health <= 0) {
return false;
} else if (damagesource.k() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
return false;
} else {
if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) {
i = (int) ((float) i * 0.55F);
this.getEquipment(4).damage(i * 4 + this.random.nextInt(i * 2), this);
i = (int) ((float) i * 0.75F);
}
this.bg = 1.5F;
this.bh = 1.5F;
boolean flag = true;
// CraftBukkit start
@ -673,13 +689,13 @@ public abstract class EntityLiving extends Entity {
flag = false;
} else {
this.lastDamage = i;
this.aR = this.health;
this.aS = this.health;
this.noDamageTicks = this.maxNoDamageTicks;
this.d(damagesource, i);
this.hurtTicks = this.aV = 10;
this.hurtTicks = this.aW = 10;
}
this.aW = 0.0F;
this.aX = 0.0F;
Entity entity = damagesource.getEntity();
if (entity != null) {
@ -715,10 +731,10 @@ public abstract class EntityLiving extends Entity {
d0 = (Math.random() - Math.random()) * 0.01D;
}
this.aW = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
this.aX = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
this.a(entity, i, d0, d1);
} else {
this.aW = (float) ((int) (Math.random() * 2.0D) * 180);
this.aX = (float) ((int) (Math.random() * 2.0D) * 180);
}
}
@ -764,11 +780,11 @@ public abstract class EntityLiving extends Entity {
protected int b(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor()) {
int j = 25 - this.aW();
int k = i * j + this.aS;
int k = i * j + this.aT;
this.k(i);
i = k / 25;
this.aS = k % 25;
this.aT = k % 25;
}
return i;
@ -778,10 +794,10 @@ public abstract class EntityLiving extends Entity {
if (this.hasEffect(MobEffectList.RESISTANCE)) {
int j = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
int k = 25 - j;
int l = i * k + this.aS;
int l = i * k + this.aT;
i = l / 25;
this.aS = l % 25;
this.aT = l % 25;
}
return i;
@ -830,15 +846,15 @@ public abstract class EntityLiving extends Entity {
public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity();
if (this.aK >= 0 && entity != null) {
entity.c(this, this.aK);
if (this.aL >= 0 && entity != null) {
entity.c(this, this.aL);
}
if (entity != null) {
entity.a(this);
}
this.bb = true;
this.bc = true;
if (!this.world.isStatic) {
int i = 0;
@ -984,12 +1000,12 @@ public abstract class EntityLiving extends Entity {
if (this.be()) {
f4 = this.aF();
} else {
f4 = this.aM;
f4 = this.aN;
}
f4 *= f3;
} else {
f4 = this.aN;
f4 = this.aO;
}
this.a(f, f1, f4);
@ -1054,7 +1070,7 @@ public abstract class EntityLiving extends Entity {
this.motZ *= (double) f2;
}
this.bf = this.bg;
this.bg = this.bh;
d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f6 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
@ -1063,8 +1079,8 @@ public abstract class EntityLiving extends Entity {
f6 = 1.0F;
}
this.bg += (f6 - this.bg) * 0.4F;
this.bh += this.bg;
this.bh += (f6 - this.bh) * 0.4F;
this.bi += this.bh;
}
public boolean g_() {
@ -1185,29 +1201,33 @@ public abstract class EntityLiving extends Entity {
}
public void f(float f) {
this.bC = f;
this.bD = f;
}
public void e(boolean flag) {
this.bE = flag;
this.bF = flag;
}
public void c() {
if (this.bU > 0) {
--this.bU;
if (this.bV > 0) {
--this.bV;
}
if (this.bs > 0) {
double d0 = this.locX + (this.bt - this.locX) / (double) this.bs;
double d1 = this.locY + (this.bu - this.locY) / (double) this.bs;
double d2 = this.locZ + (this.bv - this.locZ) / (double) this.bs;
double d3 = MathHelper.g(this.bw - (double) this.yaw);
if (this.bt > 0) {
double d0 = this.locX + (this.bu - this.locX) / (double) this.bt;
double d1 = this.locY + (this.bv - this.locY) / (double) this.bt;
double d2 = this.locZ + (this.bw - this.locZ) / (double) this.bt;
double d3 = MathHelper.g(this.bx - (double) this.yaw);
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bs);
this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bs);
--this.bs;
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bt);
this.pitch = (float) ((double) this.pitch + (this.by - (double) this.pitch) / (double) this.bt);
--this.bt;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
} else if (!this.bf()) {
this.motX *= 0.98D;
this.motY *= 0.98D;
this.motZ *= 0.98D;
}
if (Math.abs(this.motX) < 0.005D) {
@ -1224,10 +1244,10 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.a("ai");
if (this.bg()) {
this.bE = false;
this.bB = 0.0F;
this.bF = false;
this.bC = 0.0F;
this.bD = 0.0F;
this.bE = 0.0F;
} else if (this.bf()) {
if (this.be()) {
this.world.methodProfiler.a("newAi");
@ -1237,35 +1257,35 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.a("oldAi");
this.bn();
this.world.methodProfiler.b();
this.ay = this.yaw;
this.az = this.yaw;
}
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
if (this.bE) {
if (this.bF) {
if (!this.H() && !this.J()) {
if (this.onGround && this.bU == 0) {
if (this.onGround && this.bV == 0) {
this.bi();
this.bU = 10;
this.bV = 10;
}
} else {
this.motY += 0.03999999910593033D;
}
} else {
this.bU = 0;
this.bV = 0;
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("travel");
this.bB *= 0.98F;
this.bC *= 0.98F;
this.bD *= 0.9F;
float f = this.aM;
this.bD *= 0.98F;
this.bE *= 0.9F;
float f = this.aN;
this.aM *= this.bB();
this.e(this.bB, this.bC);
this.aM = f;
this.aN *= this.bB();
this.e(this.bC, this.bD);
this.aN = f;
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
if (!this.world.isStatic) {
@ -1275,15 +1295,15 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
this.world.methodProfiler.a("looting");
// CraftBukkit - Don't run mob pickup code on players
if (!this.world.isStatic && !(this instanceof EntityPlayer) && this.canPickUpLoot && !this.bb && this.world.getGameRules().getBoolean("mobGriefing")) {
if (!this.world.isStatic && !(this instanceof EntityPlayer) && this.canPickUpLoot && !this.bc && this.world.getGameRules().getBoolean("mobGriefing")) {
List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
EntityItem entityitem = (EntityItem) iterator.next();
if (!entityitem.dead && entityitem.itemStack != null) {
ItemStack itemstack = entityitem.itemStack;
if (!entityitem.dead && entityitem.getItemStack() != null) {
ItemStack itemstack = entityitem.getItemStack();
int i = b(itemstack);
if (i > -1) {
@ -1409,26 +1429,26 @@ public abstract class EntityLiving extends Entity {
this.die();
}
if (this.bA > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove this.bj() check
if (this.bB > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove this.bj() check
this.die();
} else if (d3 < 1024.0D) {
this.bA = 0;
this.bB = 0;
}
}
// CraftBukkit start
} else {
this.bA = 0;
this.bB = 0;
}
// CraftBukkit end
}
protected void bl() {
++this.bA;
++this.bB;
this.world.methodProfiler.a("checkDespawn");
this.bk();
this.world.methodProfiler.b();
this.world.methodProfiler.a("sensing");
this.bN.a();
this.bO.a();
this.world.methodProfiler.b();
this.world.methodProfiler.a("targetSelector");
this.targetSelector.a();
@ -1456,59 +1476,59 @@ public abstract class EntityLiving extends Entity {
protected void bm() {}
protected void bn() {
++this.bA;
++this.bB;
this.bk();
this.bB = 0.0F;
this.bC = 0.0F;
this.bD = 0.0F;
float f = 8.0F;
if (this.random.nextFloat() < 0.02F) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, (double) f);
if (entityhuman != null) {
this.bV = entityhuman;
this.bH = 10 + this.random.nextInt(20);
this.bW = entityhuman;
this.bI = 10 + this.random.nextInt(20);
} else {
this.bD = (this.random.nextFloat() - 0.5F) * 20.0F;
this.bE = (this.random.nextFloat() - 0.5F) * 20.0F;
}
}
if (this.bV != null) {
this.a(this.bV, 10.0F, (float) this.bp());
if (this.bH-- <= 0 || this.bV.dead || this.bV.e((Entity) this) > (double) (f * f)) {
this.bV = null;
if (this.bW != null) {
this.a(this.bW, 10.0F, (float) this.bp());
if (this.bI-- <= 0 || this.bW.dead || this.bW.e((Entity) this) > (double) (f * f)) {
this.bW = null;
}
} else {
if (this.random.nextFloat() < 0.05F) {
this.bD = (this.random.nextFloat() - 0.5F) * 20.0F;
this.bE = (this.random.nextFloat() - 0.5F) * 20.0F;
}
this.yaw += this.bD;
this.pitch = this.bF;
this.yaw += this.bE;
this.pitch = this.bG;
}
boolean flag = this.H();
boolean flag1 = this.J();
if (flag || flag1) {
this.bE = this.random.nextFloat() < 0.8F;
this.bF = this.random.nextFloat() < 0.8F;
}
}
protected void bo() {
int i = this.h();
if (this.bp) {
++this.bq;
if (this.bq >= i) {
this.bq = 0;
this.bp = false;
if (this.bq) {
++this.br;
if (this.br >= i) {
this.br = 0;
this.bq = false;
}
} else {
this.bq = 0;
this.br = 0;
}
this.aP = (float) this.bq / (float) i;
this.aQ = (float) this.br / (float) i;
}
public int bp() {
@ -1853,15 +1873,15 @@ public abstract class EntityLiving extends Entity {
int i = this.random.nextInt(2);
float f = this.world.difficulty == 3 ? 0.1F : 0.25F;
if (this.random.nextFloat() < 0.07F) {
if (this.random.nextFloat() < 0.1F) {
++i;
}
if (this.random.nextFloat() < 0.07F) {
if (this.random.nextFloat() < 0.1F) {
++i;
}
if (this.random.nextFloat() < 0.07F) {
if (this.random.nextFloat() < 0.1F) {
++i;
}
@ -1986,14 +2006,14 @@ public abstract class EntityLiving extends Entity {
protected void bF() {
if (this.bD() != null && this.random.nextFloat() < b[this.world.difficulty]) {
EnchantmentManager.a(this.random, this.bD(), 5);
EnchantmentManager.a(this.random, this.bD(), 5 + this.world.difficulty * this.random.nextInt(6));
}
for (int i = 0; i < 4; ++i) {
ItemStack itemstack = this.q(i);
if (itemstack != null && this.random.nextFloat() < c[this.world.difficulty]) {
EnchantmentManager.a(this.random, itemstack, 5);
EnchantmentManager.a(this.random, itemstack, 5 + this.world.difficulty * this.random.nextInt(6));
}
}
}
@ -2005,9 +2025,9 @@ public abstract class EntityLiving extends Entity {
}
public void bH() {
if (!this.bp || this.bq >= this.h() / 2 || this.bq < 0) {
this.bq = -1;
this.bp = true;
if (!this.bq || this.br >= this.h() / 2 || this.br < 0) {
this.br = -1;
this.bq = true;
if (this.world instanceof WorldServer) {
((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet18ArmAnimation(this, 1)));
}

View File

@ -6,7 +6,7 @@ public class EntityMagmaCube extends EntitySlime {
super(world);
this.texture = "/mob/lava.png";
this.fireProof = true;
this.aM = 0.2F;
this.aN = 0.2F;
}
public boolean canSpawn() {

View File

@ -26,11 +26,11 @@ public class EntityMinecart extends Entity implements IInventory {
private boolean h;
private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
private int j;
private double as;
private double at;
private double au;
private double av;
private double aw;
private double ax;
// CraftBukkit start
public boolean slowWhenEmpty = true;
@ -237,7 +237,7 @@ public class EntityMinecart extends Entity implements IInventory {
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
if (itemstack.hasTag()) {
entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone());
entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
}
float f3 = 0.05F;
@ -291,15 +291,57 @@ public class EntityMinecart extends Entity implements IInventory {
this.world.addParticle("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
}
int i;
if (!this.world.isStatic && this.world instanceof WorldServer) {
this.world.methodProfiler.a("portal");
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
i = this.z();
if (this.ao) {
if (minecraftserver.getAllowNether()) {
if (this.vehicle == null && this.ap++ >= i) {
this.ap = i;
this.portalCooldown = this.ab();
byte b0;
if (this.world.worldProvider.dimension == -1) {
b0 = 0;
} else {
b0 = -1;
}
this.b(b0);
}
this.ao = false;
}
} else {
if (this.ap > 0) {
this.ap -= 4;
}
if (this.ap < 0) {
this.ap = 0;
}
}
if (this.portalCooldown > 0) {
--this.portalCooldown;
}
this.world.methodProfiler.b();
}
if (this.world.isStatic) {
if (this.j > 0) {
double d0 = this.locX + (this.as - this.locX) / (double) this.j;
double d1 = this.locY + (this.at - this.locY) / (double) this.j;
double d2 = this.locZ + (this.au - this.locZ) / (double) this.j;
double d3 = MathHelper.g(this.av - (double) this.yaw);
double d0 = this.locX + (this.at - this.locX) / (double) this.j;
double d1 = this.locY + (this.au - this.locY) / (double) this.j;
double d2 = this.locZ + (this.av - this.locZ) / (double) this.j;
double d3 = MathHelper.g(this.aw - (double) this.yaw);
this.yaw = (float) ((double) this.yaw + d3 / (double) this.j);
this.pitch = (float) ((double) this.pitch + (this.aw - (double) this.pitch) / (double) this.j);
this.pitch = (float) ((double) this.pitch + (this.ax - (double) this.pitch) / (double) this.j);
--this.j;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
@ -312,25 +354,25 @@ public class EntityMinecart extends Entity implements IInventory {
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int j = MathHelper.floor(this.locX);
i = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
if (BlockMinecartTrack.e_(this.world, i, j - 1, k)) {
--j;
if (BlockMinecartTrack.e_(this.world, j, i - 1, k)) {
--i;
}
// CraftBukkit
double d4 = this.maxSpeed;
double d5 = 0.0078125D;
int l = this.world.getTypeId(i, j, k);
int l = this.world.getTypeId(j, i, k);
if (BlockMinecartTrack.d(l)) {
if (BlockMinecartTrack.e(l)) {
this.fallDistance = 0.0F;
Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
int i1 = this.world.getData(i, j, k);
int i1 = this.world.getData(j, i, k);
this.locY = (double) j;
this.locY = (double) i;
boolean flag = false;
boolean flag1 = false;
@ -344,7 +386,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
if (i1 >= 2 && i1 <= 5) {
this.locY = (double) (j + 1);
this.locY = (double) (i + 1);
}
if (i1 == 2) {
@ -405,9 +447,9 @@ public class EntityMinecart extends Entity implements IInventory {
}
d12 = 0.0D;
d11 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
d11 = (double) j + 0.5D + (double) aint[0][0] * 0.5D;
double d13 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
double d14 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
double d14 = (double) j + 0.5D + (double) aint[1][0] * 0.5D;
double d15 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
d6 = d14 - d11;
@ -416,11 +458,11 @@ public class EntityMinecart extends Entity implements IInventory {
double d17;
if (d6 == 0.0D) {
this.locX = (double) i + 0.5D;
this.locX = (double) j + 0.5D;
d12 = this.locZ - (double) k;
} else if (d7 == 0.0D) {
this.locZ = (double) k + 0.5D;
d12 = this.locX - (double) i;
d12 = this.locX - (double) j;
} else {
d16 = this.locX - d11;
d17 = this.locZ - d13;
@ -454,9 +496,9 @@ public class EntityMinecart extends Entity implements IInventory {
}
this.move(d16, 0.0D, d17);
if (aint[0][1] != 0 && MathHelper.floor(this.locX) - i == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) {
if (aint[0][1] != 0 && MathHelper.floor(this.locX) - j == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) {
this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ);
} else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - i == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) {
} else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - j == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) {
this.setPosition(this.locX, this.locY + (double) aint[1][1], this.locZ);
}
@ -509,9 +551,9 @@ public class EntityMinecart extends Entity implements IInventory {
int j1 = MathHelper.floor(this.locX);
int k1 = MathHelper.floor(this.locZ);
if (j1 != i || k1 != k) {
if (j1 != j || k1 != k) {
d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
this.motX = d10 * (double) (j1 - i);
this.motX = d10 * (double) (j1 - j);
this.motZ = d10 * (double) (k1 - k);
}
@ -541,15 +583,15 @@ public class EntityMinecart extends Entity implements IInventory {
this.motX += this.motX / d21 * d22;
this.motZ += this.motZ / d21 * d22;
} else if (i1 == 1) {
if (this.world.t(i - 1, j, k)) {
if (this.world.t(j - 1, i, k)) {
this.motX = 0.02D;
} else if (this.world.t(i + 1, j, k)) {
} else if (this.world.t(j + 1, i, k)) {
this.motX = -0.02D;
}
} else if (i1 == 0) {
if (this.world.t(i, j, k - 1)) {
if (this.world.t(j, i, k - 1)) {
this.motZ = 0.02D;
} else if (this.world.t(i, j, k + 1)) {
} else if (this.world.t(j, i, k + 1)) {
this.motZ = -0.02D;
}
}
@ -666,7 +708,7 @@ public class EntityMinecart extends Entity implements IInventory {
int l = this.world.getTypeId(i, j, k);
if (BlockMinecartTrack.d(l)) {
if (BlockMinecartTrack.e(l)) {
int i1 = this.world.getData(i, j, k);
d1 = (double) j;

View File

@ -6,7 +6,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
public EntityMonster(World world) {
super(world);
this.bc = 5;
this.bd = 5;
}
public void c() {
@ -14,7 +14,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
float f = this.c(1.0F);
if (f > 0.5F) {
this.bA += 2;
this.bB += 2;
}
super.c();
@ -99,6 +99,10 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
if (k > 0) {
entity.setOnFire(k * 4);
}
if (entity instanceof EntityLiving) {
EnchantmentThorns.a(this, (EntityLiving) entity, this.random);
}
}
return flag;

View File

@ -42,7 +42,7 @@ public class EntityMushroomCow extends EntityCow {
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
entitycow.aw = this.aw;
entitycow.ax = this.ax;
this.world.addEntity(entitycow);
for (int i = 0; i < 5; ++i) {

View File

@ -15,7 +15,7 @@ public class EntityPigZombie extends EntityZombie {
public EntityPigZombie(World world) {
super(world);
this.texture = "/mob/pigzombie.png";
this.bG = 0.5F;
this.bH = 0.5F;
this.fireProof = true;
}
@ -24,7 +24,7 @@ public class EntityPigZombie extends EntityZombie {
}
public void j_() {
this.bG = this.target != null ? 0.95F : 0.5F;
this.bH = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
this.makeSound("mob.zombiepig.zpigangry", this.aX() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}

View File

@ -20,21 +20,21 @@ import org.bukkit.event.inventory.InventoryType;
public class EntityPlayer extends EntityHuman implements ICrafting {
private LocaleLanguage locale = new LocaleLanguage("en_US");
public NetServerHandler netServerHandler;
public PlayerConnection playerConnection;
public MinecraftServer server;
public ItemInWorldManager itemInWorldManager;
public PlayerInteractManager playerInteractManager;
public double d;
public double e;
public final List chunkCoordIntPairQueue = new LinkedList();
public final List removeQueue = new LinkedList();
private int ck = -99999999;
private int cl = -99999999;
private boolean cm = true;
private int cm = -99999999;
private boolean cn = true;
public int lastSentExp = -99999999; // CraftBukkit - private -> public
public int invulnerableTicks = 60; // CraftBukkit - private -> public
private int cp = 0;
private int cq = 0;
private boolean cr = true;
private int cr = 0;
private boolean cs = true;
private int containerCounter = 0;
public boolean h;
public int ping;
@ -49,11 +49,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public boolean keepLevel = false;
// CraftBukkit end
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) {
super(world);
iteminworldmanager.player = this;
this.itemInWorldManager = iteminworldmanager;
this.cp = minecraftserver.getServerConfigurationManager().o();
playerinteractmanager.player = this;
this.playerInteractManager = playerinteractmanager;
this.cq = minecraftserver.getPlayerList().o();
ChunkCoordinates chunkcoordinates = world.getSpawn();
int i = chunkcoordinates.x;
int j = chunkcoordinates.z;
@ -80,14 +80,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
if (nbttagcompound.hasKey("playerGameType")) {
this.itemInWorldManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType")));
this.playerInteractManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType")));
}
this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setInt("playerGameType", this.itemInWorldManager.getGameMode().a());
nbttagcompound.setInt("playerGameType", this.playerInteractManager.getGameMode().a());
this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
}
@ -112,7 +112,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.setPosition(position.x + 0.5, position.y, position.z + 0.5);
}
this.dimension = ((WorldServer) this.world).dimension;
this.itemInWorldManager.a((WorldServer) world);
this.playerInteractManager.a((WorldServer) world);
}
// CraftBukkit end
@ -134,7 +134,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void j_() {
this.itemInWorldManager.a();
this.playerInteractManager.a();
--this.invulnerableTicks;
this.activeContainer.b();
@ -149,7 +149,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
iterator.remove();
}
this.netServerHandler.sendPacket(new Packet29DestroyEntity(aint));
this.playerConnection.sendPacket(new Packet29DestroyEntity(aint));
}
if (!this.chunkCoordIntPairQueue.isEmpty()) {
@ -168,7 +168,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
if (!arraylist.isEmpty()) {
this.netServerHandler.sendPacket(new Packet56MapChunkBulk(arraylist));
this.playerConnection.sendPacket(new Packet56MapChunkBulk(arraylist));
Iterator iterator2 = arraylist1.iterator();
@ -195,25 +195,25 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack = this.inventory.getItem(i);
if (itemstack != null && Item.byId[itemstack.id].f() && this.netServerHandler.lowPriorityCount() <= 5) {
if (itemstack != null && Item.byId[itemstack.id].f() && this.playerConnection.lowPriorityCount() <= 5) {
Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
if (packet != null) {
this.netServerHandler.sendPacket(packet);
this.playerConnection.sendPacket(packet);
}
}
}
if (this.getHealth() != this.ck || this.cl != this.foodData.a() || this.foodData.e() == 0.0F != this.cm) {
this.netServerHandler.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.e()));
this.ck = this.getHealth();
this.cl = this.foodData.a();
this.cm = this.foodData.e() == 0.0F;
if (this.getHealth() != this.cl || this.cm != this.foodData.a() || this.foodData.e() == 0.0F != this.cn) {
this.playerConnection.sendPacket(new Packet8UpdateHealth(this.getHealth(), this.foodData.a(), this.foodData.e()));
this.cl = this.getHealth();
this.cm = this.foodData.a();
this.cn = this.foodData.e() == 0.0F;
}
if (this.expTotal != this.lastSentExp) {
this.lastSentExp = this.expTotal;
this.netServerHandler.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
this.playerConnection.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
}
// CraftBukkit start
@ -256,7 +256,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
String deathMessage = event.getDeathMessage();
if (deathMessage != null && deathMessage.length() > 0) {
this.server.getServerConfigurationManager().sendAll(new Packet3Chat(event.getDeathMessage()));
this.server.getPlayerList().k(event.getDeathMessage());
}
// CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
@ -284,7 +284,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit - this.server.getPvP() -> this.world.pvpMode
boolean flag = this.server.T() && this.world.pvpMode && "fall".equals(damagesource.translationIndex);
if (!flag && this.invulnerableTicks > 0) {
if (!flag && this.invulnerableTicks > 0 && damagesource != DamageSource.OUT_OF_WORLD) {
return false;
} else {
// CraftBukkit - this.server.getPvP() -> this.world.pvpMode
@ -318,7 +318,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.a((Statistic) AchievementList.C);
this.world.kill(this);
this.viewingCredits = true;
this.netServerHandler.sendPacket(new Packet70Bed(4, 0));
this.playerConnection.sendPacket(new Packet70Bed(4, 0));
} else {
this.a((Statistic) AchievementList.B);
/* CraftBukkit start - removed to fix our handling of The End portals
@ -334,10 +334,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// CraftBukkit end */
this.server.getServerConfigurationManager().changeDimension(this, i);
this.server.getPlayerList().changeDimension(this, i);
this.lastSentExp = -1;
this.ck = -1;
this.cl = -1;
this.cm = -1;
}
}
@ -346,7 +346,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
Packet packet = tileentity.getUpdatePacket();
if (packet != null) {
this.netServerHandler.sendPacket(packet);
this.playerConnection.sendPacket(packet);
}
}
}
@ -363,8 +363,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
this.p().getTracker().a((Entity) this, (Packet) packet17entitylocationaction);
this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.netServerHandler.sendPacket(packet17entitylocationaction);
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.playerConnection.sendPacket(packet17entitylocationaction);
}
return enumbedresult;
@ -378,8 +378,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
super.a(flag, flag1, flag2);
if (this.netServerHandler != null) {
this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
if (this.playerConnection != null) {
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}
}
@ -395,8 +395,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.setPassengerOf(entity);
// CraftBukkit end
this.netServerHandler.sendPacket(new Packet39AttachEntity(this, this.vehicle));
this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.playerConnection.sendPacket(new Packet39AttachEntity(this, this.vehicle));
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}
protected void a(double d0, boolean flag) {}
@ -417,7 +417,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -430,7 +430,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, "Enchanting", 9));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, "Enchanting", 9));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -443,7 +443,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 8, "Repairing", 9));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 8, "Repairing", 9));
this.activeContainer = container; // CraftBukkit - use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -460,7 +460,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize()));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -473,7 +473,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -486,7 +486,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -499,7 +499,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -512,7 +512,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 7, tileentitybeacon.getName(), tileentitybeacon.getSize()));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 7, tileentitybeacon.getName(), tileentitybeacon.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@ -530,7 +530,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, inventorymerchant.getName(), inventorymerchant.getSize()));
this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, inventorymerchant.getName(), inventorymerchant.getSize()));
MerchantRecipeList merchantrecipelist = imerchant.getOffers(this);
if (merchantrecipelist != null) {
@ -540,7 +540,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
dataoutputstream.writeInt(this.containerCounter);
merchantrecipelist.a(dataoutputstream);
this.netServerHandler.sendPacket(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray()));
this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray()));
} catch (IOException ioexception) {
ioexception.printStackTrace();
}
@ -550,7 +550,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Container container, int i, ItemStack itemstack) {
if (!(container.getSlot(i) instanceof SlotResult)) {
if (!this.h) {
this.netServerHandler.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack));
this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack));
}
}
}
@ -560,27 +560,27 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(Container container, List list) {
this.netServerHandler.sendPacket(new Packet104WindowItems(container.windowId, list));
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list));
this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
// CraftBukkit start - send a Set Slot to update the crafting result slot
if (java.util.EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) {
this.netServerHandler.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem()));
this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem()));
}
// CraftBukkit end
}
public void setContainerData(Container container, int i, int j) {
this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j));
this.playerConnection.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j));
}
public void closeInventory() {
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
this.playerConnection.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
this.k();
}
public void broadcastCarriedItem() {
if (!this.h) {
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
}
}
@ -593,11 +593,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (statistic != null) {
if (!statistic.f) {
while (i > 100) {
this.netServerHandler.sendPacket(new Packet200Statistic(statistic.e, 100));
this.playerConnection.sendPacket(new Packet200Statistic(statistic.e, 100));
i -= 100;
}
this.netServerHandler.sendPacket(new Packet200Statistic(statistic.e, i));
this.playerConnection.sendPacket(new Packet200Statistic(statistic.e, i));
}
}
}
@ -617,7 +617,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void m() {
this.ck = -99999999;
this.cl = -99999999;
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@ -625,17 +625,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
LocaleLanguage localelanguage = LocaleLanguage.a();
String s1 = localelanguage.b(s);
this.netServerHandler.sendPacket(new Packet3Chat(s1));
this.playerConnection.sendPacket(new Packet3Chat(s1));
}
protected void n() {
this.netServerHandler.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
this.playerConnection.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
super.n();
}
public void a(ItemStack itemstack, int 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().b_(itemstack) == EnumAnimation.b) {
this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
}
}
@ -643,28 +643,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void copyTo(EntityHuman entityhuman, boolean flag) {
super.copyTo(entityhuman, flag);
this.lastSentExp = -1;
this.ck = -1;
this.cl = -1;
this.cm = -1;
this.removeQueue.addAll(((EntityPlayer) entityhuman).removeQueue);
}
protected void a(MobEffect mobeffect) {
super.a(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect));
}
protected void b(MobEffect mobeffect) {
super.b(mobeffect);
this.netServerHandler.sendPacket(new Packet41MobEffect(this.id, mobeffect));
this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect));
}
protected void c(MobEffect mobeffect) {
super.c(mobeffect);
this.netServerHandler.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
this.playerConnection.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect));
}
public void enderTeleportTo(double d0, double d1, double d2) {
this.netServerHandler.a(d0, d1, d2, this.yaw, this.pitch);
this.playerConnection.a(d0, d1, d2, this.yaw, this.pitch);
}
public void b(Entity entity) {
@ -676,8 +676,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void updateAbilities() {
if (this.netServerHandler != null) {
this.netServerHandler.sendPacket(new Packet202Abilities(this.abilities));
if (this.playerConnection != null) {
this.playerConnection.sendPacket(new Packet202Abilities(this.abilities));
}
}
@ -686,20 +686,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(EnumGamemode enumgamemode) {
this.itemInWorldManager.setGameMode(enumgamemode);
this.netServerHandler.sendPacket(new Packet70Bed(3, enumgamemode.a()));
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new Packet70Bed(3, enumgamemode.a()));
}
public void sendMessage(String s) {
this.netServerHandler.sendPacket(new Packet3Chat(s));
this.playerConnection.sendPacket(new Packet3Chat(s));
}
public boolean a(int i, String s) {
return "seed".equals(s) && !this.server.T() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? this.server.getServerConfigurationManager().isOp(this.name) : true);
return "seed".equals(s) && !this.server.T() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? this.server.getPlayerList().isOp(this.name) : true);
}
public String q() {
String s = this.netServerHandler.networkManager.getSocketAddress().toString();
String s = this.playerConnection.networkManager.getSocketAddress().toString();
s = s.substring(s.indexOf("/") + 1);
s = s.substring(0, s.indexOf(":"));
@ -714,11 +714,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
int i = 256 >> packet204localeandviewdistance.f();
if (i > 3 && i < 15) {
this.cp = i;
this.cq = i;
}
this.cq = packet204localeandviewdistance.g();
this.cr = packet204localeandviewdistance.h();
this.cr = packet204localeandviewdistance.g();
this.cs = packet204localeandviewdistance.h();
if (this.server.I() && this.server.H().equals(this.name)) {
this.server.c(packet204localeandviewdistance.i());
}
@ -731,13 +731,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public int getChatFlags() {
return this.cq;
return this.cr;
}
public void a(String s, int i) {
String s1 = s + "\0" + i; // CraftBukkit - fix decompile error
this.netServerHandler.sendPacket(new Packet250CustomPayload("MC|TPack", s1.getBytes()));
this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", s1.getBytes()));
}
public ChunkCoordinates b() {

View File

@ -62,7 +62,7 @@ public class EntityPotion extends EntityProjectile {
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
List list = Item.POTION.l(this.c);
List list = Item.POTION.g(this.c);
if (list != null && !list.isEmpty()) {
AxisAlignedBB axisalignedbb = this.boundingBox.grow(4.0D, 2.0D, 4.0D);

View File

@ -10,7 +10,7 @@ public class EntitySilverfish extends EntityMonster {
super(world);
this.texture = "/mob/silverfish.png";
this.a(0.3F, 0.7F);
this.bG = 0.6F;
this.bH = 0.6F;
}
public int getMaxHealth() {
@ -54,7 +54,7 @@ public class EntitySilverfish extends EntityMonster {
protected void a(Entity entity, float f) {
if (this.attackTicks <= 0 && f < 1.2F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
entity.damageEntity(DamageSource.mobAttack(this), this.c(entity));
this.m(entity);
}
}
@ -67,7 +67,7 @@ public class EntitySilverfish extends EntityMonster {
}
public void j_() {
this.aw = this.yaw;
this.ax = this.yaw;
super.j_();
}

View File

@ -12,11 +12,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public EntitySkeleton(World world) {
super(world);
this.texture = "/mob/skeleton.png";
this.bG = 0.25F;
this.bH = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalRestrictSun(this));
this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bG));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bH));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bH));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
@ -201,11 +201,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.bF();
}
if (this.random.nextFloat() >= as[this.world.difficulty]) {
;
}
this.canPickUpLoot = true;
this.canPickUpLoot = this.random.nextFloat() < at[this.world.difficulty];
if (this.getEquipment(4) == null) {
Calendar calendar = this.world.T();

View File

@ -30,7 +30,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.a(0.6F * (float) i, 0.6F * (float) i);
this.setPosition(this.locX, this.locY, this.locZ);
this.setHealth(this.getMaxHealth());
this.bc = i;
this.bd = i;
}
public int getMaxHealth() {
@ -115,17 +115,17 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.jumpDelay /= 3;
}
this.bE = true;
this.bF = true;
if (this.q()) {
this.makeSound(this.n(), this.aX(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
this.bB = 1.0F - this.random.nextFloat() * 2.0F;
this.bC = (float) (1 * this.getSize());
this.bC = 1.0F - this.random.nextFloat() * 2.0F;
this.bD = (float) (1 * this.getSize());
} else {
this.bE = false;
this.bF = false;
if (this.onGround) {
this.bB = this.bC = 0.0F;
this.bC = this.bD = 0.0F;
}
}
}

View File

@ -8,7 +8,7 @@ public class EntitySpider extends EntityMonster {
super(world);
this.texture = "/mob/spider.png";
this.a(1.4F, 0.9F);
this.bG = 0.8F;
this.bH = 0.8F;
}
protected void a() {

View File

@ -11,19 +11,19 @@ public class EntitySquid extends EntityWaterAnimal {
public float h = 0.0F;
public float i = 0.0F;
public float j = 0.0F;
public float bI = 0.0F;
private float bJ = 0.0F;
public float bJ = 0.0F;
private float bK = 0.0F;
private float bL = 0.0F;
private float bM = 0.0F;
private float bN = 0.0F;
private float bO = 0.0F;
private float bP = 0.0F;
public EntitySquid(World world) {
super(world);
this.texture = "/mob/squid.png";
this.a(0.95F, 0.95F);
this.bK = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
this.bL = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
public int getMaxHealth() {
@ -72,12 +72,12 @@ public class EntitySquid extends EntityWaterAnimal {
this.e = this.d;
this.g = this.f;
this.i = this.h;
this.bI = this.j;
this.h += this.bK;
this.bJ = this.j;
this.h += this.bL;
if (this.h > 6.2831855F) {
this.h -= 6.2831855F;
if (this.random.nextInt(10) == 0) {
this.bK = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
this.bL = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
}
@ -88,28 +88,28 @@ public class EntitySquid extends EntityWaterAnimal {
f = this.h / 3.1415927F;
this.j = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
if ((double) f > 0.75D) {
this.bJ = 1.0F;
this.bL = 1.0F;
this.bK = 1.0F;
this.bM = 1.0F;
} else {
this.bL *= 0.8F;
this.bM *= 0.8F;
}
} else {
this.j = 0.0F;
this.bJ *= 0.9F;
this.bL *= 0.99F;
this.bK *= 0.9F;
this.bM *= 0.99F;
}
if (!this.world.isStatic) {
this.motX = (double) (this.bM * this.bJ);
this.motY = (double) (this.bN * this.bJ);
this.motZ = (double) (this.bO * this.bJ);
this.motX = (double) (this.bN * this.bK);
this.motY = (double) (this.bO * this.bK);
this.motZ = (double) (this.bP * this.bK);
}
f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
// CraftBukkit - Math -> TrigMath
this.aw += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aw) * 0.1F;
this.yaw = this.aw;
this.f += 3.1415927F * this.bL * 1.5F;
this.ax += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.ax) * 0.1F;
this.yaw = this.ax;
this.f += 3.1415927F * this.bM * 1.5F;
// CraftBukkit - Math -> TrigMath
this.d += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.d) * 0.1F;
} else {
@ -130,15 +130,15 @@ public class EntitySquid extends EntityWaterAnimal {
}
protected void bn() {
++this.bA;
if (this.bA > 100) {
this.bM = this.bN = this.bO = 0.0F;
} else if (this.random.nextInt(50) == 0 || !this.ad || this.bM == 0.0F && this.bN == 0.0F && this.bO == 0.0F) {
++this.bB;
if (this.bB > 100) {
this.bN = this.bO = this.bP = 0.0F;
} else if (this.random.nextInt(50) == 0 || !this.ad || this.bN == 0.0F && this.bO == 0.0F && this.bP == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
this.bM = MathHelper.cos(f) * 0.2F;
this.bN = -0.1F + this.random.nextFloat() * 0.2F;
this.bO = MathHelper.sin(f) * 0.2F;
this.bN = MathHelper.cos(f) * 0.2F;
this.bO = -0.1F + this.random.nextFloat() * 0.2F;
this.bP = MathHelper.sin(f) * 0.2F;
}
this.bk();

View File

@ -14,7 +14,7 @@ public class EntityTracker {
public EntityTracker(WorldServer worldserver) {
this.world = worldserver;
this.d = worldserver.getMinecraftServer().getServerConfigurationManager().a();
this.d = worldserver.getMinecraftServer().getPlayerList().a();
}
// CraftBukkit - synchronized
@ -51,6 +51,8 @@ public class EntityTracker {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityThrownExpBottle) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityFireworks) {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityItem) {
this.addEntity(entity, 64, 20, true);
} else if (entity instanceof EntityMinecart) {

View File

@ -86,11 +86,11 @@ public class EntityTrackerEntry {
EntityPlayer j2 = (EntityPlayer) j1;
i7.a(j2, i5);
if (j2.netServerHandler.lowPriorityCount() <= 5) {
if (j2.playerConnection.lowPriorityCount() <= 5) {
Packet j3 = Item.MAP.c(i5, this.tracker.world, j2);
if (j3 != null) {
j2.netServerHandler.sendPacket(j3);
j2.playerConnection.sendPacket(j3);
}
}
}
@ -107,9 +107,9 @@ public class EntityTrackerEntry {
if (this.tracker.vehicle == null) {
++this.u;
i = this.tracker.ar.a(this.tracker.locX);
i = this.tracker.as.a(this.tracker.locX);
j = MathHelper.floor(this.tracker.locY * 32.0D);
int k = this.tracker.ar.a(this.tracker.locZ);
int k = this.tracker.as.a(this.tracker.locZ);
int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
int j1 = i - this.xLoc;
@ -200,9 +200,9 @@ public class EntityTrackerEntry {
this.xRot = j;
}
this.xLoc = this.tracker.ar.a(this.tracker.locX);
this.xLoc = this.tracker.as.a(this.tracker.locX);
this.yLoc = MathHelper.floor(this.tracker.locY * 32.0D);
this.zLoc = this.tracker.ar.a(this.tracker.locZ);
this.zLoc = this.tracker.as.a(this.tracker.locZ);
DataWatcher datawatcher2 = this.tracker.getDataWatcher();
if (datawatcher2.a()) {
@ -254,14 +254,14 @@ public class EntityTrackerEntry {
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
entityplayer.netServerHandler.sendPacket(packet);
entityplayer.playerConnection.sendPacket(packet);
}
}
public void broadcastIncludingSelf(Packet packet) {
this.broadcast(packet);
if (this.tracker instanceof EntityPlayer) {
((EntityPlayer) this.tracker).netServerHandler.sendPacket(packet);
((EntityPlayer) this.tracker).playerConnection.sendPacket(packet);
}
}
@ -303,20 +303,20 @@ public class EntityTrackerEntry {
this.trackedPlayers.add(entityplayer);
Packet packet = this.b();
entityplayer.netServerHandler.sendPacket(packet);
if (this.tracker instanceof EntityItemFrame) {
entityplayer.netServerHandler.sendPacket(new Packet40EntityMetadata(this.tracker.id, this.tracker.getDataWatcher(), true));
entityplayer.playerConnection.sendPacket(packet);
if (!this.tracker.getDataWatcher().d()) {
entityplayer.playerConnection.sendPacket(new Packet40EntityMetadata(this.tracker.id, this.tracker.getDataWatcher(), true));
}
this.j = this.tracker.motX;
this.k = this.tracker.motY;
this.l = this.tracker.motZ;
if (this.isMoving && !(packet instanceof Packet24MobSpawn)) {
entityplayer.netServerHandler.sendPacket(new Packet28EntityVelocity(this.tracker.id, this.tracker.motX, this.tracker.motY, this.tracker.motZ));
entityplayer.playerConnection.sendPacket(new Packet28EntityVelocity(this.tracker.id, this.tracker.motX, this.tracker.motY, this.tracker.motZ));
}
if (this.tracker.vehicle != null) {
entityplayer.netServerHandler.sendPacket(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
}
if (this.tracker instanceof EntityLiving) {
@ -324,7 +324,7 @@ public class EntityTrackerEntry {
ItemStack itemstack = ((EntityLiving) this.tracker).getEquipment(i);
if (itemstack != null) {
entityplayer.netServerHandler.sendPacket(new Packet5EntityEquipment(this.tracker.id, i, itemstack));
entityplayer.playerConnection.sendPacket(new Packet5EntityEquipment(this.tracker.id, i, itemstack));
}
}
}
@ -333,7 +333,7 @@ public class EntityTrackerEntry {
EntityHuman entityhuman = (EntityHuman) this.tracker;
if (entityhuman.isSleeping()) {
entityplayer.netServerHandler.sendPacket(new Packet17EntityLocationAction(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
entityplayer.playerConnection.sendPacket(new Packet17EntityLocationAction(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
}
}
@ -349,7 +349,7 @@ public class EntityTrackerEntry {
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
entityplayer.netServerHandler.sendPacket(new Packet41MobEffect(this.tracker.id, mobeffect));
entityplayer.playerConnection.sendPacket(new Packet41MobEffect(this.tracker.id, mobeffect));
}
}
}
@ -361,7 +361,7 @@ public class EntityTrackerEntry {
}
private boolean d(EntityPlayer entityplayer) {
return entityplayer.p().getPlayerManager().a(entityplayer, this.tracker.ai, this.tracker.ak);
return entityplayer.p().getPlayerChunkMap().a(entityplayer, this.tracker.ai, this.tracker.ak);
}
public void scanPlayers(List list) {
@ -379,13 +379,7 @@ public class EntityTrackerEntry {
}
if (this.tracker instanceof EntityItem) {
EntityItem entityitem = (EntityItem) this.tracker;
Packet21PickupSpawn entityminecart0 = new Packet21PickupSpawn(entityitem);
entityitem.locX = (double) entityminecart0.b / 32.0D;
entityitem.locY = (double) entityminecart0.c / 32.0D;
entityitem.locZ = (double) entityminecart0.d / 32.0D;
return entityminecart0;
return new Packet23VehicleSpawn(this.tracker, 2, 1);
} else if (this.tracker instanceof EntityPlayer) {
return new Packet20NamedEntitySpawn((EntityHuman) this.tracker);
} else {
@ -426,6 +420,8 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.tracker, 65);
} else if (this.tracker instanceof EntityEnderSignal) {
return new Packet23VehicleSpawn(this.tracker, 72);
} else if (this.tracker instanceof EntityFireworks) {
return new Packet23VehicleSpawn(this.tracker, 76);
} else {
Packet23VehicleSpawn packet23vehiclespawn;

View File

@ -11,10 +11,10 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
public EntityWitch(World world) {
super(world);
this.texture = "/mob/villager/witch.png";
this.bG = 0.25F;
this.bH = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bG, 60, 10.0F));
this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bH, 60, 10.0F));
this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, this.bH));
this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(3, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
@ -63,7 +63,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.setEquipment(0, (ItemStack) null);
if (itemstack != null && itemstack.id == Item.POTION.id) {
List list = Item.POTION.l(itemstack);
List list = Item.POTION.g(itemstack);
if (list != null) {
Iterator iterator = list.iterator();

View File

@ -16,7 +16,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
private int[] h = new int[2];
private int[] i = new int[2];
private int j;
private static final IEntitySelector bI = new EntitySelectorNotUndead();
private static final IEntitySelector bJ = new EntitySelectorNotUndead();
public EntityWither(World world) {
super(world);
@ -24,16 +24,16 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.texture = "/mob/wither.png";
this.a(0.9F, 4.0F);
this.fireProof = true;
this.bG = 0.6F;
this.bH = 0.6F;
this.getNavigation().e(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bG, 40, 20.0F));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bH, 40, 20.0F));
this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bH));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 30.0F, 0, false, false, bI));
this.bc = 50;
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 30.0F, 0, false, false, bJ));
this.bd = 50;
}
protected void a() {
@ -139,7 +139,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.d[i] = this.b(this.d[i], f1, 40.0F);
this.e[i] = this.b(this.e[i], f, 10.0F);
} else {
this.e[i] = this.b(this.e[i], this.aw, 10.0F);
this.e[i] = this.b(this.e[i], this.ax, 10.0F);
}
}
@ -222,7 +222,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.c(i, 0);
}
} else {
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bI);
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bJ);
for (int i1 = 0; i1 < 10 && !list.isEmpty(); ++i1) {
EntityLiving entityliving = (EntityLiving) list.get(this.random.nextInt(list.size()));
@ -311,7 +311,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (i <= 0) {
return this.locX;
} else {
float f = (this.aw + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f = (this.ax + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f1 = MathHelper.cos(f);
return this.locX + (double) f1 * 1.3D;
@ -326,7 +326,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (i <= 0) {
return this.locZ;
} else {
float f = (this.aw + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f = (this.ax + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f1 = MathHelper.sin(f);
return this.locZ + (double) f1 * 1.3D;
@ -418,7 +418,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
protected void bk() {
this.bA = 0;
this.bB = 0;
}
public boolean L() {

View File

@ -13,15 +13,15 @@ public class EntityWolf extends EntityTameableAnimal {
super(world);
this.texture = "/mob/wolf.png";
this.a(0.6F, 0.8F);
this.bG = 0.3F;
this.bH = 0.3F;
this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, this.d);
this.goalSelector.a(3, new PathfinderGoalLeapAtTarget(this, 0.4F));
this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bG, true));
this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bG, 10.0F, 2.0F));
this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bG));
this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bH, true));
this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bH, 10.0F, 2.0F));
this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bH));
this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bH));
this.goalSelector.a(8, new PathfinderGoalBeg(this, 8.0F));
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(9, new PathfinderGoalRandomLookaround(this));
@ -119,7 +119,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
if (this.bM()) {
this.bH = 10;
this.bI = 10;
}
if (this.G()) {
@ -220,7 +220,7 @@ public class EntityWolf extends EntityTameableAnimal {
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
this.d.a(!this.isSitting());
this.bE = false;
this.bF = false;
this.setPathEntity((PathEntity) null);
}
} else if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {

View File

@ -11,15 +11,15 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) {
super(world);
this.texture = "/mob/zombie.png";
this.bG = 0.23F;
this.bH = 0.23F;
this.getNavigation().b(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalBreakDoor(this));
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bG, false));
this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bG, true));
this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bG));
this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bG, false));
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bG));
this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bH, false));
this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bH, true));
this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bH));
this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bH, false));
this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bH));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
@ -235,7 +235,7 @@ public class EntityZombie extends EntityMonster {
}
public void bG() {
this.canPickUpLoot = this.random.nextFloat() < as[this.world.difficulty];
this.canPickUpLoot = this.random.nextFloat() < at[this.world.difficulty];
if (this.world.random.nextFloat() < 0.05F) {
this.setVillager(true);
}
@ -253,7 +253,7 @@ public class EntityZombie extends EntityMonster {
}
public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.bT();
ItemStack itemstack = entityhuman.bS();
if (itemstack != null && itemstack.getItem() == Item.GOLDEN_APPLE && itemstack.getData() == 0 && this.isVillager() && this.hasEffect(MobEffectList.WEAKNESS)) {
if (!entityhuman.abilities.canInstantlyBuild) {

View File

@ -144,10 +144,11 @@ public class Explosion {
if (!event.isCancelled()) {
damagee.setLastDamageCause(event);
entity.damageEntity(DamageSource.EXPLOSION, event.getDamage());
double d11 = EnchantmentProtection.a(entity, d10);
entity.motX += d0 * d10;
entity.motY += d1 * d10;
entity.motZ += d2 * d10;
entity.motX += d0 * d11;
entity.motY += d1 * d11;
entity.motZ += d2 * d11;
if (entity instanceof EntityHuman) {
this.l.put((EntityHuman) entity, this.world.getVec3DPool().create(d0 * d10, d1 * d10, d2 * d10));
}

View File

@ -39,12 +39,12 @@ public class FoodMetaData {
this.foodLevel = event.getFoodLevel();
}
((EntityPlayer) entityhuman).netServerHandler.sendPacket(new Packet8UpdateHealth(entityhuman.getHealth(), this.foodLevel, this.saturationLevel));
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet8UpdateHealth(entityhuman.getHealth(), this.foodLevel, this.saturationLevel));
// CraftBukkit end
}
}
if (this.foodLevel >= 18 && entityhuman.ce()) {
if (this.foodLevel >= 18 && entityhuman.cd()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason

View File

@ -101,7 +101,7 @@ public class ItemBlock extends Item {
}
}
public String c_(ItemStack itemstack) {
public String d(ItemStack itemstack) {
return Block.byId[this.id].a();
}

View File

@ -73,6 +73,7 @@ public class ItemBoat extends Item {
EntityBoat entityboat = new EntityBoat(world, (double) ((float) i + 0.5F), (double) ((float) j + 1.0F), (double) ((float) k + 0.5F));
entityboat.yaw = (float) (((MathHelper.floor((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3) - 1) * 90);
if (!world.getCubes(entityboat, entityboat.boundingBox.grow(-0.1D, -0.1D, -0.1D)).isEmpty()) {
return itemstack;
}

View File

@ -13,7 +13,7 @@ public class ItemBow extends Item {
boolean flag = entityhuman.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0;
if (flag || entityhuman.inventory.e(Item.ARROW.id)) {
int j = this.a(itemstack) - i;
int j = this.c_(itemstack) - i;
float f = (float) j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
@ -74,17 +74,17 @@ public class ItemBow extends Item {
return itemstack;
}
public int a(ItemStack itemstack) {
public int c_(ItemStack itemstack) {
return 72000;
}
public EnumAnimation d_(ItemStack itemstack) {
public EnumAnimation b_(ItemStack itemstack) {
return EnumAnimation.e;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.e(Item.ARROW.id)) {
entityhuman.a(itemstack, this.a(itemstack));
entityhuman.a(itemstack, this.c_(itemstack));
}
return itemstack;

View File

@ -8,7 +8,7 @@ import org.bukkit.event.entity.SheepDyeWoolEvent;
public class ItemDye extends Item {
public static final String[] a = new String[] { "black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"};
public static final int[] b = new int[] { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 2651799, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
public static final int[] b = new int[] { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
public ItemDye(int i) {
super(i);
@ -17,7 +17,7 @@ public class ItemDye extends Item {
this.a(CreativeModeTab.l);
}
public String c_(ItemStack itemstack) {
public String d(ItemStack itemstack) {
int i = MathHelper.a(itemstack.getData(), 0, 15);
return super.getName() + "." + a[i];

View File

@ -5,18 +5,18 @@ public class ItemFood extends Item {
public final int a;
private final int b;
private final float c;
private final boolean cl;
private boolean cm;
private int cn;
private int co;
private int cp;
private float cq;
private final boolean co;
private boolean cp;
private int cq;
private int cr;
private int cs;
private float ct;
public ItemFood(int i, int j, float f, boolean flag) {
super(i);
this.a = 32;
this.b = j;
this.cl = flag;
this.co = flag;
this.c = f;
this.a(CreativeModeTab.h);
}
@ -36,7 +36,7 @@ public class ItemFood extends Item {
entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, this.getSaturationModifier());
}
((EntityPlayer) entityhuman).netServerHandler.sendPacket(new Packet8UpdateHealth(entityhuman.getHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet8UpdateHealth(entityhuman.getHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
// CraftBukkit end
world.makeSound(entityhuman, "random.burp", 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
@ -45,22 +45,22 @@ public class ItemFood extends Item {
}
protected void c(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (!world.isStatic && this.cn > 0 && world.random.nextFloat() < this.cq) {
entityhuman.addEffect(new MobEffect(this.cn, this.co * 20, this.cp));
if (!world.isStatic && this.cq > 0 && world.random.nextFloat() < this.ct) {
entityhuman.addEffect(new MobEffect(this.cq, this.cr * 20, this.cs));
}
}
public int a(ItemStack itemstack) {
public int c_(ItemStack itemstack) {
return 32;
}
public EnumAnimation d_(ItemStack itemstack) {
public EnumAnimation b_(ItemStack itemstack) {
return EnumAnimation.b;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.f(this.cm)) {
entityhuman.a(itemstack, this.a(itemstack));
if (entityhuman.g(this.cp)) {
entityhuman.a(itemstack, this.c_(itemstack));
}
return itemstack;
@ -75,19 +75,19 @@ public class ItemFood extends Item {
}
public boolean i() {
return this.cl;
return this.co;
}
public ItemFood a(int i, int j, int k, float f) {
this.cn = i;
this.co = j;
this.cp = k;
this.cq = f;
this.cq = i;
this.cr = j;
this.cs = k;
this.ct = f;
return this;
}
public ItemFood j() {
this.cm = true;
this.cp = true;
return this;
}
}

View File

@ -14,7 +14,7 @@ public class ItemMinecart extends Item {
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int i1 = world.getTypeId(i, j, k);
if (BlockMinecartTrack.d(i1)) {
if (BlockMinecartTrack.e(i1)) {
if (!world.isStatic) {
// CraftBukkit start - Minecarts
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);

View File

@ -8,7 +8,7 @@ public class ItemMonsterEgg extends Item {
this.a(CreativeModeTab.f);
}
public String j(ItemStack itemstack) {
public String i(ItemStack itemstack) {
String s = ("" + LocaleI18n.get(this.getName() + ".name")).trim();
String s1 = EntityTypes.b(itemstack.getData());
@ -50,11 +50,15 @@ public class ItemMonsterEgg extends Item {
for (int j = 0; j < 1; ++j) {
entity = EntityTypes.a(i, world);
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
entity.setPositionRotation(d0, d1, d2, world.random.nextFloat() * 360.0F, 0.0F);
((EntityLiving) entity).bG();
if (entity != null && entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity;
entity.setPositionRotation(d0, d1, d2, MathHelper.g(world.random.nextFloat() * 360.0F), 0.0F);
entityliving.az = entityliving.yaw;
entityliving.ax = entityliving.yaw;
entityliving.bG();
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
((EntityLiving) entity).aO();
entityliving.aO();
}
}

View File

@ -89,7 +89,7 @@ public class ItemSkull extends Item {
return i;
}
public String c_(ItemStack itemstack) {
public String d(ItemStack itemstack) {
int i = itemstack.getData();
if (i < 0 || i >= a.length) {
@ -99,7 +99,7 @@ public class ItemSkull extends Item {
return super.getName() + "." + a[i];
}
public String j(ItemStack itemstack) {
return itemstack.getData() == 3 && itemstack.hasTag() && itemstack.getTag().hasKey("SkullOwner") ? LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}) : super.j(itemstack);
public String l(ItemStack itemstack) {
return itemstack.getData() == 3 && itemstack.hasTag() && itemstack.getTag().hasKey("SkullOwner") ? LocaleI18n.get("item.skull.player.name", new Object[] { itemstack.getTag().getString("SkullOwner")}) : super.l(itemstack);
}
}

View File

@ -149,9 +149,17 @@ public final class ItemStack {
public void damage(int i, EntityLiving entityliving) {
if (this.f()) {
if (i > 0 && entityliving instanceof EntityHuman) {
int j = EnchantmentManager.getDurabilityEnchantmentLevel(entityliving);
int j = EnchantmentManager.getEnchantmentLevel(Enchantment.DURABILITY.id, this);
int k = 0;
if (j > 0 && entityliving.world.random.nextInt(j + 1) > 0) {
for (int l = 0; j > 0 && l < i; ++l) {
if (EnchantmentDurability.a(this, j, entityliving.world.random)) {
++k;
}
}
i -= k;
if (i <= 0) {
return;
}
}
@ -237,7 +245,7 @@ public final class ItemStack {
}
public String a() {
return Item.byId[this.id].c_(this);
return Item.byId[this.id].d(this);
}
public static ItemStack b(ItemStack itemstack) {
@ -262,11 +270,11 @@ public final class ItemStack {
}
public int m() {
return this.getItem().a(this);
return this.getItem().c_(this);
}
public EnumAnimation n() {
return this.getItem().d_(this);
return this.getItem().b_(this);
}
public void b(World world, EntityHuman entityhuman, int i) {
@ -290,7 +298,7 @@ public final class ItemStack {
}
public String r() {
String s = this.getItem().j(this);
String s = this.getItem().l(this);
if (this.tag != null && this.tag.hasKey("display")) {
NBTTagCompound nbttagcompound = this.tag.getCompound("display");
@ -320,7 +328,7 @@ public final class ItemStack {
}
public boolean v() {
return !this.getItem().k(this) ? false : !this.hasEnchantments();
return !this.getItem().d_(this) ? false : !this.hasEnchantments();
}
public void addEnchantment(Enchantment enchantment, int i) {

View File

@ -19,7 +19,7 @@ public class ItemStep extends ItemBlock {
return i;
}
public String c_(ItemStack itemstack) {
public String d(ItemStack itemstack) {
return this.b.d(itemstack.getData());
}

View File

@ -39,7 +39,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
private String serverIp;
private int s = -1;
// public WorldServer[] worldServer; // CraftBukkit - removed!
private ServerConfigurationManagerAbstract t;
private PlayerList t;
private boolean isRunning = true;
private boolean isStopped = false;
private int ticks = 0;
@ -126,6 +126,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
BlockDispenser.a.a(Item.EXP_BOTTLE, new DispenseBehaviorExpBottle(this));
BlockDispenser.a.a(Item.POTION, new DispenseBehaviorPotion(this));
BlockDispenser.a.a(Item.MONSTER_EGG, new DispenseBehaviorMonsterEgg(this));
BlockDispenser.a.a(Item.FIREWORKS, new DispenseBehaviorFireworks(this));
BlockDispenser.a.a(Item.FIREBALL, new DispenseBehaviorFireball(this));
DispenseBehaviorMinecart dispensebehaviorminecart = new DispenseBehaviorMinecart(this);
@ -537,9 +538,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// Send timeupdates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getServerConfigurationManager().players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.getServerConfigurationManager().players.get(i);
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime())); // Add support for per player time
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime())); // Add support for per player time
}
}
@ -757,7 +758,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public String getVersion() {
return "1.4.5";
return "1.4.6";
}
public int y() {
@ -1085,7 +1086,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public abstract boolean T();
public boolean getOnlineMode() {
return this.onlineMode;
return this.server.getOnlineMode(); // CraftBukkit
}
public void setOnlineMode(boolean flag) {
@ -1146,12 +1147,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return this.isStopped;
}
public ServerConfigurationManagerAbstract getServerConfigurationManager() {
public PlayerList getPlayerList() {
return this.t;
}
public void a(ServerConfigurationManagerAbstract serverconfigurationmanagerabstract) {
this.t = serverconfigurationmanagerabstract;
public void a(PlayerList playerlist) {
this.t = playerlist;
}
public void a(EnumGamemode enumgamemode) {
@ -1186,7 +1187,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return 16;
}
public static ServerConfigurationManagerAbstract a(MinecraftServer minecraftserver) {
public static PlayerList a(MinecraftServer minecraftserver) {
return minecraftserver.t;
}
}

View File

@ -31,7 +31,7 @@ public class NetworkManager implements INetworkManager {
private java.util.Queue inboundQueue = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit - Concurrent linked queue
private List highPriorityQueue = Collections.synchronizedList(new ArrayList());
private List lowPriorityQueue = Collections.synchronizedList(new ArrayList());
private NetHandler packetListener;
private Connection connection;
private boolean s = false;
private Thread t;
private Thread u;
@ -48,11 +48,11 @@ public class NetworkManager implements INetworkManager {
private PrivateKey A = null;
private int lowPriorityQueueDelay = 50;
public NetworkManager(Socket socket, String s, NetHandler nethandler, PrivateKey privatekey) throws IOException { // CraftBukkit - throws IOException
public NetworkManager(Socket socket, String s, Connection connection, PrivateKey privatekey) throws IOException { // CraftBukkit - throws IOException
this.A = privatekey;
this.socket = socket;
this.j = socket.getRemoteSocketAddress();
this.packetListener = nethandler;
this.connection = connection;
try {
socket.setSoTimeout(30000);
@ -69,8 +69,8 @@ public class NetworkManager implements INetworkManager {
this.t.start();
}
public void a(NetHandler nethandler) {
this.packetListener = nethandler;
public void a(Connection connection) {
this.connection = connection;
}
public void queue(Packet packet) {
@ -97,7 +97,7 @@ public class NetworkManager implements INetworkManager {
if (packet != null) {
Packet.a(packet, this.output);
if (packet instanceof Packet252KeyResponse && !this.g) {
if (!this.packetListener.a()) {
if (!this.connection.a()) {
this.z = ((Packet252KeyResponse) packet).d();
}
@ -187,11 +187,11 @@ public class NetworkManager implements INetworkManager {
boolean flag = false;
try {
Packet packet = Packet.a(this.input, this.packetListener.a(), this.socket);
Packet packet = Packet.a(this.input, this.connection.a(), this.socket);
if (packet != null) {
if (packet instanceof Packet252KeyResponse && !this.f) {
if (this.packetListener.a()) {
if (this.connection.a()) {
this.z = ((Packet252KeyResponse) packet).a(this.A);
}
@ -203,9 +203,9 @@ public class NetworkManager implements INetworkManager {
aint[i] += packet.a() + 1;
if (!this.s) {
if (packet.a_() && this.packetListener.b()) {
if (packet.a_() && this.connection.b()) {
this.x = 0;
packet.handle(this.packetListener);
packet.handle(this.connection);
} else {
this.inboundQueue.add(packet);
}
@ -282,17 +282,17 @@ public class NetworkManager implements INetworkManager {
Packet packet = (Packet) this.inboundQueue.poll(); // CraftBukkit - remove -> poll
// CraftBukkit start
if (this.packetListener instanceof NetLoginHandler ? ((NetLoginHandler) this.packetListener).c : ((NetServerHandler) this.packetListener).disconnected) {
if (this.connection instanceof PendingConnection ? ((PendingConnection) this.connection).c : ((PlayerConnection) this.connection).disconnected) {
continue;
}
// CraftBukkit end
packet.handle(this.packetListener);
packet.handle(this.connection);
}
this.a();
if (this.n && this.inboundQueue.isEmpty()) {
this.packetListener.a(this.v, this.w);
this.connection.a(this.v, this.w);
}
}

View File

@ -172,7 +172,7 @@ public abstract class Packet {
public abstract void a(DataOutputStream dataoutputstream) throws IOException; // CraftBukkit - throws IOException
public abstract void handle(NetHandler nethandler);
public abstract void handle(Connection connection);
public abstract int a();
@ -267,12 +267,11 @@ public abstract class Packet {
a(13, true, true, Packet13PlayerLookMove.class);
a(14, false, true, Packet14BlockDig.class);
a(15, false, true, Packet15Place.class);
a(16, false, true, Packet16BlockItemSwitch.class);
a(16, true, true, Packet16BlockItemSwitch.class);
a(17, true, false, Packet17EntityLocationAction.class);
a(18, true, true, Packet18ArmAnimation.class);
a(19, false, true, Packet19EntityAction.class);
a(20, true, false, Packet20NamedEntitySpawn.class);
a(21, true, false, Packet21PickupSpawn.class);
a(22, true, false, Packet22Collect.class);
a(23, true, false, Packet23VehicleSpawn.class);
a(24, true, false, Packet24MobSpawn.class);

View File

@ -67,8 +67,8 @@ public class Packet20NamedEntitySpawn extends Packet {
this.i.a(dataoutputstream);
}
public void handle(NetHandler nethandler) {
nethandler.a(this);
public void handle(Connection connection) {
connection.a(this);
}
public int a() {

View File

@ -28,8 +28,8 @@ public class Packet2Handshake extends Packet {
dataoutputstream.writeInt(this.d);
}
public void handle(NetHandler nethandler) {
nethandler.a(this);
public void handle(Connection connection) {
connection.a(this);
}
public int a() {

View File

@ -40,8 +40,8 @@ public class Packet3Chat extends Packet {
a(this.message, dataoutputstream);
}
public void handle(NetHandler nethandler) {
nethandler.a(this);
public void handle(Connection connection) {
connection.a(this);
}
public int a() {

View File

@ -94,8 +94,8 @@ public class Packet51MapChunk extends Packet {
dataoutputstream.write(this.buffer, 0, this.size);
}
public void handle(NetHandler nethandler) {
nethandler.a(this);
public void handle(Connection connection) {
connection.a(this);
}
public int a() {
@ -152,11 +152,13 @@ public class Packet51MapChunk extends Packet {
}
}
for (l = 0; l < achunksection.length; ++l) {
if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
nibblearray = achunksection[l].l();
System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
j += nibblearray.a.length;
if (!chunk.world.worldProvider.f) {
for (l = 0; l < achunksection.length; ++l) {
if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) {
nibblearray = achunksection[l].l();
System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
j += nibblearray.a.length;
}
}
}

View File

@ -17,6 +17,7 @@ public class Packet56MapChunkBulk extends Packet {
private byte[] buffer;
private byte[][] inflatedBuffers;
private int size;
private boolean h;
private byte[] buildBuffer = new byte[0]; // CraftBukkit - remove static
// CraftBukkit start
static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() {
@ -38,6 +39,7 @@ public class Packet56MapChunkBulk extends Packet {
this.a = new int[i];
this.b = new int[i];
this.inflatedBuffers = new byte[i][];
this.h = !list.isEmpty() && !((Chunk) list.get(0)).world.worldProvider.f;
int j = 0;
for (int k = 0; k < i; ++k) {
@ -94,6 +96,7 @@ public class Packet56MapChunkBulk extends Packet {
short short1 = datainputstream.readShort();
this.size = datainputstream.readInt();
this.h = datainputstream.readBoolean();
this.c = new int[short1];
this.d = new int[short1];
this.a = new int[short1];
@ -125,17 +128,24 @@ public class Packet56MapChunkBulk extends Packet {
this.a[j] = datainputstream.readShort();
this.b[j] = datainputstream.readShort();
int k = 0;
int l = 0;
int l;
int i1;
for (l = 0; l < 16; ++l) {
k += this.a[j] >> l & 1;
for (i1 = 0; i1 < 16; ++i1) {
k += this.a[j] >> i1 & 1;
l += this.b[j] >> i1 & 1;
}
l = 2048 * 5 * k + 256;
this.inflatedBuffers[j] = new byte[l];
System.arraycopy(abyte, i, this.inflatedBuffers[j], 0, l);
i += l;
i1 = 2048 * 4 * k + 256;
i1 += 2048 * l;
if (this.h) {
i1 += 2048 * k;
}
this.inflatedBuffers[j] = new byte[i1];
System.arraycopy(abyte, i, this.inflatedBuffers[j], 0, i1);
i += i1;
}
}
@ -143,6 +153,7 @@ public class Packet56MapChunkBulk extends Packet {
compress(); // CraftBukkit
dataoutputstream.writeShort(this.c.length);
dataoutputstream.writeInt(this.size);
dataoutputstream.writeBoolean(this.h);
dataoutputstream.write(this.buffer, 0, this.size);
for (int i = 0; i < this.c.length; ++i) {
@ -153,8 +164,8 @@ public class Packet56MapChunkBulk extends Packet {
}
}
public void handle(NetHandler nethandler) {
nethandler.a(this);
public void handle(Connection connection) {
connection.a(this);
}
public int a() {

View File

@ -85,7 +85,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
this.a.addParticle("heart", this.d.locX + (double) (random.nextFloat() * this.d.width * 2.0F) - (double) this.d.width, this.d.locY + 0.5D + (double) (random.nextFloat() * this.d.length), this.d.locZ + (double) (random.nextFloat() * this.d.width * 2.0F) - (double) this.d.width, d0, d1, d2);
}
this.a.addEntity(new EntityExperienceOrb(this.a, this.d.locX, this.d.locY, this.d.locZ, random.nextInt(4) + 1));
this.a.addEntity(new EntityExperienceOrb(this.a, this.d.locX, this.d.locY, this.d.locZ, random.nextInt(7) + 1));
}
}
}

View File

@ -12,7 +12,7 @@ import java.util.Random;
import java.util.logging.Logger;
import javax.crypto.SecretKey;
public class NetLoginHandler extends NetHandler {
public class PendingConnection extends Connection {
private byte[] d;
public static Logger logger = Logger.getLogger("Minecraft");
@ -24,11 +24,11 @@ public class NetLoginHandler extends NetHandler {
private String h = null;
private volatile boolean i = false;
private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix
private SecretKey k = null;
private boolean k = false;
private SecretKey l = null;
public String hostname = ""; // CraftBukkit - add field
private boolean login = false; // CraftBukkit
public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException
public PendingConnection(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException
this.server = minecraftserver;
this.networkManager = new NetworkManager(socket, s, this, minecraftserver.F().getPrivate());
this.networkManager.e = 0;
@ -73,8 +73,8 @@ public class NetLoginHandler extends NetHandler {
} else {
PublicKey publickey = this.server.F().getPublic();
if (packet2handshake.d() != 49) {
if (packet2handshake.d() > 49) {
if (packet2handshake.d() != 51) {
if (packet2handshake.d() > 51) {
this.disconnect("Outdated server!");
} else {
this.disconnect("Outdated client!");
@ -91,7 +91,7 @@ public class NetLoginHandler extends NetHandler {
public void a(Packet252KeyResponse packet252keyresponse) {
PrivateKey privatekey = this.server.F().getPrivate();
this.k = packet252keyresponse.a(privatekey);
this.l = packet252keyresponse.a(privatekey);
if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) {
this.disconnect("Invalid client reply");
}
@ -102,13 +102,11 @@ public class NetLoginHandler extends NetHandler {
public void a(Packet205ClientCommand packet205clientcommand) {
if (packet205clientcommand.a == 0) {
if (this.server.getOnlineMode()) {
// CraftBukkit start
if (this.login) {
if (this.k) {
this.disconnect("Duplicate login");
return;
}
this.login = true;
// CraftBukkit end
this.k = true;
(new ThreadLoginVerifier(this, server.server)).start(); // CraftBukkit - add CraftServer
} else {
this.i = true;
@ -120,16 +118,16 @@ public class NetLoginHandler extends NetHandler {
public void d() {
// CraftBukkit start
EntityPlayer s = this.server.getServerConfigurationManager().attemptLogin(this, this.h, this.hostname);
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.h, this.hostname);
if (s == null) {
return;
// CraftBukkit end
} else {
EntityPlayer entityplayer = this.server.getServerConfigurationManager().processLogin(s); // CraftBukkit - this.h -> s
EntityPlayer entityplayer = this.server.getPlayerList().processLogin(s); // CraftBukkit - this.h -> s
if (entityplayer != null) {
this.server.getServerConfigurationManager().a((INetworkManager) this.networkManager, entityplayer);
this.server.getPlayerList().a((INetworkManager) this.networkManager, entityplayer);
}
}
@ -144,14 +142,14 @@ public class NetLoginHandler extends NetHandler {
public void a(Packet254GetInfo packet254getinfo) {
if (this.networkManager.getSocket() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
try {
ServerConfigurationManagerAbstract serverconfigurationmanagerabstract = this.server.getServerConfigurationManager();
PlayerList playerlist = this.server.getPlayerList();
String s = null;
// CraftBukkit
org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), serverconfigurationmanagerabstract.getPlayerCount(), serverconfigurationmanagerabstract.getMaxPlayers());
org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers());
if (packet254getinfo.a == 1) {
// CraftBukkit start - fix decompile issues, don't create a list from an array
Object[] list = new Object[] { 1, 49, this.server.getVersion(), pingEvent.getMotd(), serverconfigurationmanagerabstract.getPlayerCount(), pingEvent.getMaxPlayers() };
Object[] list = new Object[] { 1, 51, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() };
for (Object object : list) {
if (s == null) {
@ -165,7 +163,7 @@ public class NetLoginHandler extends NetHandler {
// CraftBukkit end
} else {
// CraftBukkit
s = pingEvent.getMotd() + "\u00A7" + serverconfigurationmanagerabstract.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
}
InetAddress inetaddress = null;
@ -198,23 +196,23 @@ public class NetLoginHandler extends NetHandler {
return true;
}
static String a(NetLoginHandler netloginhandler) {
return netloginhandler.loginKey;
static String a(PendingConnection pendingconnection) {
return pendingconnection.loginKey;
}
static MinecraftServer b(NetLoginHandler netloginhandler) {
return netloginhandler.server;
static MinecraftServer b(PendingConnection pendingconnection) {
return pendingconnection.server;
}
static SecretKey c(NetLoginHandler netloginhandler) {
return netloginhandler.k;
static SecretKey c(PendingConnection pendingconnection) {
return pendingconnection.l;
}
static String d(NetLoginHandler netloginhandler) {
return netloginhandler.h;
static String d(PendingConnection pendingconnection) {
return pendingconnection.h;
}
static boolean a(NetLoginHandler netloginhandler, boolean flag) {
return netloginhandler.i = flag;
static boolean a(PendingConnection pendingconnection, boolean flag) {
return pendingconnection.i = flag;
}
}

View File

@ -3,7 +3,7 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.List;
class PlayerInstance {
class PlayerChunk {
private final List b;
private final ChunkCoordIntPair location;
@ -12,21 +12,20 @@ class PlayerInstance {
private int f;
private boolean loaded = false; // CraftBukkit
final PlayerManager playerManager;
final PlayerChunkMap playerChunkMap;
public PlayerInstance(PlayerManager playermanager, int i, int j) {
this.playerManager = playermanager;
public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) {
this.playerChunkMap = playerchunkmap;
this.b = new ArrayList();
this.dirtyBlocks = new short[64];
this.dirtyCount = 0;
this.location = new ChunkCoordIntPair(i, j);
// CraftBukkit start
playermanager.a().chunkProviderServer.getChunkAt(i, j, new Runnable() {
playerchunkmap.a().chunkProviderServer.getChunkAt(i, j, new Runnable() {
public void run() {
PlayerInstance.this.loaded = true;
PlayerChunk.this.loaded = true;
}
});
// CraftBukkit end
}
public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument
@ -40,9 +39,9 @@ class PlayerInstance {
entityplayer.chunkCoordIntPairQueue.add(this.location);
} else {
// Abuse getChunkAt to add another callback
this.playerManager.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, new Runnable() {
this.playerChunkMap.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, new Runnable() {
public void run() {
entityplayer.chunkCoordIntPairQueue.add(PlayerInstance.this.location);
entityplayer.chunkCoordIntPairQueue.add(PlayerChunk.this.location);
}
});
}
@ -52,25 +51,25 @@ class PlayerInstance {
public void b(EntityPlayer entityplayer) {
if (this.b.contains(entityplayer)) {
entityplayer.netServerHandler.sendPacket(new Packet51MapChunk(PlayerManager.a(this.playerManager).getChunkAt(this.location.x, this.location.z), true, 0));
entityplayer.playerConnection.sendPacket(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), true, 0));
this.b.remove(entityplayer);
entityplayer.chunkCoordIntPairQueue.remove(this.location);
if (this.b.isEmpty()) {
long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32;
PlayerManager.b(this.playerManager).remove(i);
PlayerChunkMap.b(this.playerChunkMap).remove(i);
if (this.dirtyCount > 0) {
PlayerManager.c(this.playerManager).remove(this);
PlayerChunkMap.c(this.playerChunkMap).remove(this);
}
this.playerManager.a().chunkProviderServer.queueUnload(this.location.x, this.location.z);
this.playerChunkMap.a().chunkProviderServer.queueUnload(this.location.x, this.location.z);
}
}
}
public void a(int i, int j, int k) {
if (this.dirtyCount == 0) {
PlayerManager.c(this.playerManager).add(this);
PlayerChunkMap.c(this.playerChunkMap).add(this);
}
this.f |= 1 << (j >> 4);
@ -92,7 +91,7 @@ class PlayerInstance {
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
if (!entityplayer.chunkCoordIntPairQueue.contains(this.location)) {
entityplayer.netServerHandler.sendPacket(packet);
entityplayer.playerConnection.sendPacket(packet);
}
}
}
@ -107,9 +106,9 @@ class PlayerInstance {
i = this.location.x * 16 + (this.dirtyBlocks[0] >> 12 & 15);
j = this.dirtyBlocks[0] & 255;
k = this.location.z * 16 + (this.dirtyBlocks[0] >> 8 & 15);
this.sendAll(new Packet53BlockChange(i, j, k, PlayerManager.a(this.playerManager)));
if (PlayerManager.a(this.playerManager).isTileEntity(i, j, k)) {
this.sendTileEntity(PlayerManager.a(this.playerManager).getTileEntity(i, j, k));
this.sendAll(new Packet53BlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap)));
if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(i, j, k)) {
this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(i, j, k));
}
} else {
int l;
@ -117,12 +116,12 @@ class PlayerInstance {
if (this.dirtyCount == 64) {
i = this.location.x * 16;
j = this.location.z * 16;
this.sendAll(new Packet51MapChunk(PlayerManager.a(this.playerManager).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
for (k = 0; k < 16; ++k) {
if ((this.f & 1 << k) != 0) {
l = k << 4;
List list = PlayerManager.a(this.playerManager).getTileEntities(i, l, j, i + 16, l + 16, j + 16);
List list = PlayerChunkMap.a(this.playerChunkMap).getTileEntities(i, l, j, i + 16, l + 16, j + 16);
for (int i1 = 0; i1 < list.size(); ++i1) {
this.sendTileEntity((TileEntity) list.get(i1));
@ -130,14 +129,14 @@ class PlayerInstance {
}
}
} else {
this.sendAll(new Packet52MultiBlockChange(this.location.x, this.location.z, this.dirtyBlocks, this.dirtyCount, PlayerManager.a(this.playerManager)));
this.sendAll(new Packet52MultiBlockChange(this.location.x, this.location.z, this.dirtyBlocks, this.dirtyCount, PlayerChunkMap.a(this.playerChunkMap)));
for (i = 0; i < this.dirtyCount; ++i) {
j = this.location.x * 16 + (this.dirtyBlocks[i] >> 12 & 15);
k = this.dirtyBlocks[i] & 255;
l = this.location.z * 16 + (this.dirtyBlocks[i] >> 8 & 15);
if (PlayerManager.a(this.playerManager).isTileEntity(j, k, l)) {
this.sendTileEntity(PlayerManager.a(this.playerManager).getTileEntity(j, k, l));
if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(j, k, l)) {
this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(j, k, l));
}
}
}
@ -158,11 +157,11 @@ class PlayerInstance {
}
}
static ChunkCoordIntPair a(PlayerInstance playerinstance) {
return playerinstance.location;
static ChunkCoordIntPair a(PlayerChunk playerchunk) {
return playerchunk.location;
}
static List b(PlayerInstance playerinstance) {
return playerinstance.b;
static List b(PlayerChunk playerchunk) {
return playerchunk.b;
}
}

View File

@ -10,7 +10,7 @@ import java.util.Iterator;
import java.util.LinkedList;
// CraftBukkit end
public class PlayerManager {
public class PlayerChunkMap {
private final WorldServer world;
private final List managedPlayers = new ArrayList();
@ -20,7 +20,7 @@ public class PlayerManager {
private final int[][] f = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
private boolean wasNotEmpty; // CraftBukkit
public PlayerManager(WorldServer worldserver, int i) {
public PlayerChunkMap(WorldServer worldserver, int i) {
if (i > 15) {
throw new IllegalArgumentException("Too big view radius!");
} else if (i < 3) {
@ -40,7 +40,7 @@ public class PlayerManager {
Iterator iterator = this.d.iterator();
while (iterator.hasNext()) {
PlayerInstance playerinstance = (PlayerInstance) iterator.next();
PlayerChunk playerinstance = (PlayerChunk) iterator.next();
playerinstance.a();
iterator.remove();
}
@ -62,22 +62,22 @@ public class PlayerManager {
// CraftBukkit end
}
private PlayerInstance a(int i, int j, boolean flag) {
private PlayerChunk a(int i, int j, boolean flag) {
long k = (long) i + 2147483647L | (long) j + 2147483647L << 32;
PlayerInstance playerinstance = (PlayerInstance) this.c.getEntry(k);
PlayerChunk playerchunk = (PlayerChunk) this.c.getEntry(k);
if (playerinstance == null && flag) {
playerinstance = new PlayerInstance(this, i, j);
this.c.put(k, playerinstance);
if (playerchunk == null && flag) {
playerchunk = new PlayerChunk(this, i, j);
this.c.put(k, playerchunk);
}
return playerinstance;
return playerchunk;
}
// CraftBukkit start
public final boolean isChunkInUse(int x, int z) {
PlayerInstance pi = a(x, z, false);
PlayerChunk pi = a(x, z, false);
if (pi != null) {
return (PlayerInstance.b(pi).size() > 0);
return (PlayerChunk.b(pi).size() > 0);
}
return false;
}
@ -86,10 +86,10 @@ public class PlayerManager {
public void flagDirty(int i, int j, int k) {
int l = i >> 4;
int i1 = k >> 4;
PlayerInstance playerinstance = this.a(l, i1, false);
PlayerChunk playerchunk = this.a(l, i1, false);
if (playerinstance != null) {
playerinstance.a(i & 15, j, k & 15);
if (playerchunk != null) {
playerchunk.a(i & 15, j, k & 15);
}
}
@ -126,7 +126,7 @@ public class PlayerManager {
int l = (int) entityplayer.locZ >> 4;
int i1 = 0;
int j1 = 0;
ChunkCoordIntPair chunkcoordintpair = PlayerInstance.a(this.a(k, l, true));
ChunkCoordIntPair chunkcoordintpair = PlayerChunk.a(this.a(k, l, true));
entityplayer.chunkCoordIntPairQueue.clear();
if (arraylist.contains(chunkcoordintpair)) {
@ -142,7 +142,7 @@ public class PlayerManager {
for (int i2 = 0; i2 < k1; ++i2) {
i1 += aint[0];
j1 += aint[1];
chunkcoordintpair = PlayerInstance.a(this.a(k + i1, l + j1, true));
chunkcoordintpair = PlayerChunk.a(this.a(k + i1, l + j1, true));
if (arraylist.contains(chunkcoordintpair)) {
entityplayer.chunkCoordIntPairQueue.add(chunkcoordintpair);
}
@ -155,7 +155,7 @@ public class PlayerManager {
for (k1 = 0; k1 < j * 2; ++k1) {
i1 += this.f[i][0];
j1 += this.f[i][1];
chunkcoordintpair = PlayerInstance.a(this.a(k + i1, l + j1, true));
chunkcoordintpair = PlayerChunk.a(this.a(k + i1, l + j1, true));
if (arraylist.contains(chunkcoordintpair)) {
entityplayer.chunkCoordIntPairQueue.add(chunkcoordintpair);
}
@ -168,10 +168,10 @@ public class PlayerManager {
for (int k = i - this.e; k <= i + this.e; ++k) {
for (int l = j - this.e; l <= j + this.e; ++l) {
PlayerInstance playerinstance = this.a(k, l, false);
PlayerChunk playerchunk = this.a(k, l, false);
if (playerinstance != null) {
playerinstance.b(entityplayer);
if (playerchunk != null) {
playerchunk.b(entityplayer);
}
}
}
@ -209,10 +209,10 @@ public class PlayerManager {
}
if (!this.a(l1 - j1, i2 - k1, i, j, i1)) {
PlayerInstance playerinstance = this.a(l1 - j1, i2 - k1, false);
PlayerChunk playerchunk = this.a(l1 - j1, i2 - k1, false);
if (playerinstance != null) {
playerinstance.b(entityplayer);
if (playerchunk != null) {
playerchunk.b(entityplayer);
}
}
}
@ -237,24 +237,24 @@ public class PlayerManager {
}
public boolean a(EntityPlayer entityplayer, int i, int j) {
PlayerInstance playerinstance = this.a(i, j, false);
PlayerChunk playerchunk = this.a(i, j, false);
return playerinstance == null ? false : PlayerInstance.b(playerinstance).contains(entityplayer) && !entityplayer.chunkCoordIntPairQueue.contains(PlayerInstance.a(playerinstance));
return playerchunk == null ? false : PlayerChunk.b(playerchunk).contains(entityplayer) && !entityplayer.chunkCoordIntPairQueue.contains(PlayerChunk.a(playerchunk));
}
public static int getFurthestViewableBlock(int i) {
return i * 16 - 16;
}
static WorldServer a(PlayerManager playermanager) {
return playermanager.world;
static WorldServer a(PlayerChunkMap playerchunkmap) {
return playerchunkmap.world;
}
static LongHashMap b(PlayerManager playermanager) {
return playermanager.c;
static LongHashMap b(PlayerChunkMap playerchunkmap) {
return playerchunkmap.c;
}
static Queue c(PlayerManager playermanager) { // CraftBukkit List -> Queue
static Queue c(PlayerChunkMap playermanager) { // CraftBukkit List -> Queue
return playermanager.d;
}

View File

@ -47,8 +47,7 @@ import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.InventoryView;
// CraftBukkit end
public class NetServerHandler extends NetHandler {
public class PlayerConnection extends Connection {
public static Logger logger = Logger.getLogger("Minecraft");
public INetworkManager networkManager;
public boolean disconnected = false;
@ -61,7 +60,7 @@ public class NetServerHandler extends NetHandler {
private long j;
private static Random k = new Random();
private long l;
private volatile int m = 0; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(NetServerHandler.class, "m"); // CraftBukkit - multithreaded field
private volatile int m = 0; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "m"); // CraftBukkit - multithreaded field
private int x = 0;
private double y;
private double z;
@ -69,12 +68,12 @@ public class NetServerHandler extends NetHandler {
public boolean checkMovement = true; // CraftBukkit - private -> public
private IntHashMap s = new IntHashMap();
public NetServerHandler(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) {
public PlayerConnection(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
this.networkManager = inetworkmanager;
inetworkmanager.a(this);
this.player = entityplayer;
entityplayer.netServerHandler = this;
entityplayer.playerConnection = this;
// CraftBukkit start
this.server = minecraftserver.server;
@ -162,12 +161,12 @@ public class NetServerHandler extends NetHandler {
// CraftBukkit start
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null && leaveMessage.length() > 0) {
this.minecraftServer.getServerConfigurationManager().sendAll(new Packet3Chat(leaveMessage));
this.minecraftServer.getPlayerList().sendAll(new Packet3Chat(leaveMessage));
}
getPlayer().disconnect(s);
// CraftBukkit end
this.minecraftServer.getServerConfigurationManager().disconnect(this.player);
this.minecraftServer.getPlayerList().disconnect(this.player);
this.disconnected = true;
}
}
@ -222,7 +221,7 @@ public class NetServerHandler extends NetHandler {
// If the event is cancelled we move the player back to their old location.
if (event.isCancelled()) {
this.player.netServerHandler.sendPacket(new Packet13PlayerLookMove(from.getX(), from.getY() + 1.6200000047683716D, from.getY(), from.getZ(), from.getYaw(), from.getPitch(), false));
this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(from.getX(), from.getY() + 1.6200000047683716D, from.getY(), from.getZ(), from.getYaw(), from.getPitch(), false));
return;
}
@ -275,8 +274,8 @@ public class NetServerHandler extends NetHandler {
if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
if (Math.abs(packet10flying.x) > 1.0D || Math.abs(packet10flying.z) > 1.0D) {
System.err.println(player.getName() + " was caught trying to crash the server with an invalid position.");
player.kickPlayer("Nope!");
System.err.println(this.player.name + " was caught trying to crash the server with an invalid position.");
this.disconnect("Nope!");
return;
}
@ -298,7 +297,7 @@ public class NetServerHandler extends NetHandler {
this.player.vehicle.V();
}
this.minecraftServer.getServerConfigurationManager().d(this.player);
this.minecraftServer.getPlayerList().d(this.player);
this.y = this.player.locX;
this.z = this.player.locY;
this.q = this.player.locZ;
@ -395,7 +394,7 @@ public class NetServerHandler extends NetHandler {
d11 = d4 * d4 + d6 * d6 + d7 * d7;
boolean flag1 = false;
if (d11 > 0.0625D && !this.player.isSleeping() && !this.player.itemInWorldManager.isCreative()) {
if (d11 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) {
flag1 = true;
logger.warning(this.player.name + " moved wrongly!");
}
@ -424,8 +423,8 @@ public class NetServerHandler extends NetHandler {
}
this.player.onGround = packet10flying.g;
this.minecraftServer.getServerConfigurationManager().d(this.player);
if (this.player.itemInWorldManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
this.minecraftServer.getPlayerList().d(this.player);
if (this.player.playerInteractManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
this.player.b(this.player.locY - d0, packet10flying.g);
}
}
@ -477,7 +476,7 @@ public class NetServerHandler extends NetHandler {
this.z = d1;
this.q = d2;
this.player.setLocation(d0, d1, d2, f, f1);
this.player.netServerHandler.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false));
this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false));
}
public void a(Packet14BlockDig packet14blockdig) {
@ -501,14 +500,21 @@ public class NetServerHandler extends NetHandler {
}
}
// CraftBukkit end
this.player.bR();
this.player.f(false);
} else if (packet14blockdig.e == 3) {
this.player.f(true);
} else if (packet14blockdig.e == 5) {
this.player.bO();
} else {
boolean flag = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getServerConfigurationManager().getOPs().isEmpty() || this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || this.minecraftServer.I();
int i = this.minecraftServer.getSpawnProtection();
boolean flag = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getPlayerList().getOPs().isEmpty() || this.minecraftServer.getPlayerList().isOp(this.player.name) || i <= 0 || this.minecraftServer.I();
boolean flag1 = false;
if (packet14blockdig.e == 0 || packet14blockdig.e == 1) { // CraftBukkit - check cancelled
if (packet14blockdig.e == 0) {
flag1 = true;
}
if (packet14blockdig.e == 1) {
flag1 = true;
}
@ -516,72 +522,57 @@ public class NetServerHandler extends NetHandler {
flag1 = true;
}
int i = packet14blockdig.a;
int j = packet14blockdig.b;
int k = packet14blockdig.c;
int j = packet14blockdig.a;
int k = packet14blockdig.b;
int l = packet14blockdig.c;
if (flag1) {
double d0 = this.player.locX - ((double) i + 0.5D);
double d1 = this.player.locY - ((double) j + 0.5D) + 1.5D;
double d2 = this.player.locZ - ((double) k + 0.5D);
double d0 = this.player.locX - ((double) j + 0.5D);
double d1 = this.player.locY - ((double) k + 0.5D) + 1.5D;
double d2 = this.player.locZ - ((double) l + 0.5D);
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 36.0D) {
return;
}
if (j >= this.minecraftServer.getMaxBuildHeight()) {
if (k >= this.minecraftServer.getMaxBuildHeight()) {
return;
}
}
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
int l = MathHelper.a(i - chunkcoordinates.x);
int i1 = MathHelper.a(k - chunkcoordinates.z);
int i1 = MathHelper.a(j - chunkcoordinates.x);
int j1 = MathHelper.a(l - chunkcoordinates.z);
if (l > i1) {
i1 = l;
if (i1 > j1) {
j1 = i1;
}
if (packet14blockdig.e == 0) {
// CraftBukkit start
if (i1 < this.server.getSpawnRadius() && !flag) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
if (j1 < this.server.getSpawnRadius() && !flag) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, j, k, l, i1, this.player.inventory.getItemInHand());
this.player.playerConnection.sendPacket(new Packet53BlockChange(j, k, l, worldserver));
// Update any tile entity data for this block
TileEntity tileentity = worldserver.getTileEntity(i, j, k);
TileEntity tileentity = worldserver.getTileEntity(j, k, l);
if (tileentity != null) {
this.player.netServerHandler.sendPacket(tileentity.getUpdatePacket());
this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
}
// CraftBukkit end
} else {
this.player.itemInWorldManager.dig(i, j, k, packet14blockdig.face);
this.player.playerInteractManager.dig(j, k, l, packet14blockdig.face);
}
} else if (packet14blockdig.e == 2) {
this.player.itemInWorldManager.a(i, j, k);
if (worldserver.getTypeId(i, j, k) != 0) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
this.player.playerInteractManager.a(j, k, l);
if (worldserver.getTypeId(j, k, l) != 0) {
this.player.playerConnection.sendPacket(new Packet53BlockChange(j, k, l, worldserver));
}
} else if (packet14blockdig.e == 1) {
this.player.itemInWorldManager.c(i, j, k);
if (worldserver.getTypeId(i, j, k) != 0) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
this.player.playerInteractManager.c(j, k, l);
if (worldserver.getTypeId(j, k, l) != 0) {
this.player.playerConnection.sendPacket(new Packet53BlockChange(j, k, l, worldserver));
}
} else if (packet14blockdig.e == 3) {
// CraftBukkit start
logger.warning(this.player.name + " is using a modded client!");
this.disconnect("Nope!");
return;
/*
double d4 = this.player.locX - ((double) i + 0.5D);
double d5 = this.player.locY - ((double) j + 0.5D);
double d6 = this.player.locZ - ((double) k + 0.5D);
double d7 = d4 * d4 + d5 * d5 + d6 * d6;
if (d7 < 256.0D) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
}
// CraftBukkit end */
}
}
}
@ -623,7 +614,8 @@ public class NetServerHandler extends NetHandler {
int j = packet15place.f();
int k = packet15place.g();
int l = packet15place.getFace();
boolean flag1 = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getServerConfigurationManager().getOPs().isEmpty() || this.minecraftServer.getServerConfigurationManager().isOp(this.player.name) || this.minecraftServer.I();
int i1 = this.minecraftServer.getSpawnProtection();
boolean flag1 = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getPlayerList().getOPs().isEmpty() || this.minecraftServer.getPlayerList().isOp(this.player.name) || i1 <= 0 || this.minecraftServer.I();
if (packet15place.getFace() == 255) {
if (itemstack == null) {
@ -634,7 +626,7 @@ public class NetServerHandler extends NetHandler {
int itemstackAmount = itemstack.count;
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack);
if (event.useItemInHand() != Event.Result.DENY) {
this.player.itemInWorldManager.useItem(this.player, this.player.world, itemstack);
this.player.playerInteractManager.useItem(this.player, this.player.world, itemstack);
}
// CraftBukkit - notch decrements the counter by 1 in the above method with food,
@ -643,15 +635,15 @@ public class NetServerHandler extends NetHandler {
always = (itemstack.count != itemstackAmount);
// CraftBukkit end
} else if (packet15place.f() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packet15place.getFace() == 1 || packet15place.f() >= this.minecraftServer.getMaxBuildHeight())) {
this.player.netServerHandler.sendPacket(new Packet3Chat("\u00A77Height limit for building is " + this.minecraftServer.getMaxBuildHeight()));
this.player.playerConnection.sendPacket(new Packet3Chat("\u00A77Height limit for building is " + this.minecraftServer.getMaxBuildHeight()));
flag = true;
} else {
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
int i1 = MathHelper.a(i - chunkcoordinates.x);
int j1 = MathHelper.a(k - chunkcoordinates.z);
int j1 = MathHelper.a(i - chunkcoordinates.x);
int k1 = MathHelper.a(k - chunkcoordinates.z);
if (i1 > j1) {
j1 = i1;
if (j1 > k1) {
k1 = j1;
}
// CraftBukkit start - Check if we can actually do something over this large a distance
@ -660,16 +652,16 @@ public class NetServerHandler extends NetHandler {
return;
}
flag1 = true; // spawn protection moved to ItemBlock!!!
if (j1 > this.minecraftServer.getSpawnProtection() || flag1) {
if (j1 > i1 || flag1) {
// CraftBukkit end
this.player.itemInWorldManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.l(), packet15place.m());
this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.l(), packet15place.m());
}
flag = true;
}
if (flag) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
if (l == 0) {
--j;
}
@ -694,7 +686,7 @@ public class NetServerHandler extends NetHandler {
++i;
}
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
}
itemstack = this.player.inventory.getItemInHand();
@ -722,9 +714,9 @@ public class NetServerHandler extends NetHandler {
logger.info(this.player.name + " lost connection: " + s);
// CraftBukkit start - we need to handle custom quit messages
String quitMessage = this.minecraftServer.getServerConfigurationManager().disconnect(this.player);
String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player);
if ((quitMessage != null) && (quitMessage.length() > 0)) {
this.minecraftServer.getServerConfigurationManager().sendAll(new Packet3Chat(quitMessage));
this.minecraftServer.getPlayerList().sendAll(new Packet3Chat(quitMessage));
}
// CraftBukkit end
this.disconnected = true;
@ -802,7 +794,7 @@ public class NetServerHandler extends NetHandler {
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
NetServerHandler.this.disconnect("Chat message too long");
PlayerConnection.this.disconnect("Chat message too long");
return null;
}
};
@ -830,7 +822,7 @@ public class NetServerHandler extends NetHandler {
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
NetServerHandler.this.disconnect("Illegal characters in chat");
PlayerConnection.this.disconnect("Illegal characters in chat");
return null;
}
};
@ -861,13 +853,13 @@ public class NetServerHandler extends NetHandler {
this.chat(s, packet3chat.a_());
// This section stays because it is only applicable to packets
if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getServerConfigurationManager().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
// CraftBukkit start
if (packet3chat.a_()) {
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
NetServerHandler.this.disconnect("disconnect.spam");
PlayerConnection.this.disconnect("disconnect.spam");
return null;
}
};
@ -924,9 +916,9 @@ public class NetServerHandler extends NetHandler {
}
String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), queueEvent.getMessage());
NetServerHandler.this.minecraftServer.console.sendMessage(message);
PlayerConnection.this.minecraftServer.console.sendMessage(message);
if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) {
for (Object player : NetServerHandler.this.minecraftServer.getServerConfigurationManager().players) {
for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) {
((EntityPlayer) player).sendMessage(message);
}
} else {
@ -956,7 +948,7 @@ public class NetServerHandler extends NetHandler {
s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
minecraftServer.console.sendMessage(s);
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getServerConfigurationManager().players) {
for (Object recipient : minecraftServer.getPlayerList().players) {
((EntityPlayer) recipient).sendMessage(s);
}
} else {
@ -990,7 +982,7 @@ public class NetServerHandler extends NetHandler {
}
} catch (org.bukkit.command.CommandException ex) {
player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, null, ex);
Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, null, ex);
return;
}
// CraftBukkit end
@ -1146,7 +1138,7 @@ public class NetServerHandler extends NetHandler {
CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0);
ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn();
toLocation = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
this.player.netServerHandler.sendPacket(new Packet70Bed(0, 0));
this.player.playerConnection.sendPacket(new Packet70Bed(0, 0));
} else {
toLocation = this.player.getBukkitEntity().getBedSpawnLocation();
toLocation = new Location(toLocation.getWorld(), toLocation.getX() + 0.5, toLocation.getY(), toLocation.getZ() + 0.5);
@ -1156,25 +1148,25 @@ public class NetServerHandler extends NetHandler {
event.useTravelAgent(false);
Bukkit.getServer().getPluginManager().callEvent(event);
this.player = this.minecraftServer.getServerConfigurationManager().moveToWorld(this.player, 0, true, event.getTo());
this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, true, event.getTo());
// CraftBukkit end
} else if (this.player.p().getWorldData().isHardcore()) {
if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) {
this.player.netServerHandler.disconnect("You have died. Game over, man, it\'s game over!");
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
this.minecraftServer.P();
} else {
BanEntry banentry = new BanEntry(this.player.name);
banentry.setReason("Death in Hardcore");
this.minecraftServer.getServerConfigurationManager().getNameBans().add(banentry);
this.player.netServerHandler.disconnect("You have died. Game over, man, it\'s game over!");
this.minecraftServer.getPlayerList().getNameBans().add(banentry);
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
}
} else {
if (this.player.getHealth() > 0) {
return;
}
this.player = this.minecraftServer.getServerConfigurationManager().moveToWorld(this.player, 0, false);
this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, false);
}
}
}
@ -1248,14 +1240,14 @@ public class NetServerHandler extends NetHandler {
// CraftBukkit end
if (ItemStack.matches(packet102windowclick.item, itemstack)) {
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true));
this.player.h = true;
this.player.activeContainer.b();
this.player.broadcastCarriedItem();
this.player.h = false;
} else {
this.s.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList();
@ -1267,7 +1259,7 @@ public class NetServerHandler extends NetHandler {
// CraftBukkit start - send a Set Slot to update the crafting result slot
if(type == SlotType.RESULT && itemstack != null)
this.player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack)));
this.player.playerConnection.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack)));
// CraftBukkit end
}
}
@ -1281,7 +1273,7 @@ public class NetServerHandler extends NetHandler {
}
public void a(Packet107SetCreativeSlot packet107setcreativeslot) {
if (this.player.itemInWorldManager.isCreative()) {
if (this.player.playerInteractManager.isCreative()) {
boolean flag = packet107setcreativeslot.slot < 0;
ItemStack itemstack = packet107setcreativeslot.b;
boolean flag1 = packet107setcreativeslot.slot >= 1 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize();
@ -1316,7 +1308,7 @@ public class NetServerHandler extends NetHandler {
case DENY:
// TODO: Will this actually work?
if (packet107setcreativeslot.slot > -1) {
this.player.netServerHandler.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.slot, CraftItemStack.asNMSCopy(item)));
this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.slot, CraftItemStack.asNMSCopy(item)));
}
return;
case DEFAULT:
@ -1462,7 +1454,7 @@ public class NetServerHandler extends NetHandler {
}
}
this.player.netServerHandler.sendPacket(new Packet203TabComplete(stringbuilder.toString()));
this.player.playerConnection.sendPacket(new Packet203TabComplete(stringbuilder.toString()));
}
public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
@ -1598,7 +1590,7 @@ public class NetServerHandler extends NetHandler {
getPlayer().addChannel(channel);
}
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, "Could not parse REGISTER payload in plugin message packet", ex);
Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, "Could not parse REGISTER payload in plugin message packet", ex);
}
} else if (packet250custompayload.tag.equals("UNREGISTER")) {
try {
@ -1607,7 +1599,7 @@ public class NetServerHandler extends NetHandler {
getPlayer().removeChannel(channel);
}
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, "Could not parse UNREGISTER payload in plugin message packet", ex);
Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, "Could not parse UNREGISTER payload in plugin message packet", ex);
}
} else {
server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data);

View File

@ -8,7 +8,7 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
// CraftBukkit end
public class ItemInWorldManager {
public class PlayerInteractManager {
public World world;
public EntityPlayer player;
@ -26,14 +26,14 @@ public class ItemInWorldManager {
private int n;
private int o;
public ItemInWorldManager(World world) {
public PlayerInteractManager(World world) {
this.gamemode = EnumGamemode.NONE;
this.o = -1;
this.world = world;
}
// CraftBukkit start - keep this for backwards compatibility
public ItemInWorldManager(WorldServer world) {
public PlayerInteractManager(WorldServer world) {
this((World) world);
}
// CraftBukkit end
@ -117,11 +117,11 @@ public class ItemInWorldManager {
// CraftBukkit start
if (event.isCancelled()) {
// Let the client know the block still exists
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(i, j, k);
if (tileentity != null) {
this.player.netServerHandler.sendPacket(tileentity.getUpdatePacket());
this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
}
return;
}
@ -141,10 +141,10 @@ public class ItemInWorldManager {
if (i1 == Block.WOODEN_DOOR.id) {
// For some reason *BOTH* the bottom/top part have to be marked updated.
boolean bottom = (this.world.getData(i, j, k) & 8) == 0;
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, this.world));
} else if (i1 == Block.TRAP_DOOR.id) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
} else if (i1 > 0) {
Block.byId[i1].attack(this.world, i, j, k, this.player);
@ -160,7 +160,7 @@ public class ItemInWorldManager {
if (event.useItemInHand() == Event.Result.DENY) {
// If we 'insta destroyed' then the client needs to be informed.
if (f > 1.0f) {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
}
return;
}
@ -168,7 +168,7 @@ public class ItemInWorldManager {
if (blockEvent.isCancelled()) {
// Let the client know the block still exists
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
return;
}
@ -218,7 +218,7 @@ public class ItemInWorldManager {
}
// CraftBukkit start - force blockreset to client
} else {
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
// CraftBukkit end
}
}
@ -258,7 +258,7 @@ public class ItemInWorldManager {
packet.material = 0;
packet.data = 0;
((EntityPlayer) this.player).netServerHandler.sendPacket(packet);
((EntityPlayer) this.player).playerConnection.sendPacket(packet);
}
event = new BlockBreakEvent(block, this.player.getBukkitEntity());
@ -283,11 +283,11 @@ public class ItemInWorldManager {
if (event.isCancelled()) {
// Let the client know the block still exists
((EntityPlayer) this.player).netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(i, j, k);
if (tileentity != null) {
this.player.netServerHandler.sendPacket(tileentity.getUpdatePacket());
this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
}
return false;
}
@ -312,15 +312,15 @@ public class ItemInWorldManager {
boolean flag = this.d(i, j, k);
if (this.isCreative()) {
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, this.world));
this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
ItemStack itemstack = this.player.bT();
ItemStack itemstack = this.player.bS();
boolean flag1 = this.player.b(Block.byId[l]);
if (itemstack != null) {
itemstack.a(this.world, l, i, j, k, this.player);
if (itemstack.count == 0) {
this.player.bU();
this.player.bT();
}
}
@ -378,10 +378,10 @@ public class ItemInWorldManager {
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (i1 == Block.WOODEN_DOOR.id) {
boolean bottom = (world.getData(i, j, k) & 8) == 0;
((EntityPlayer) entityhuman).netServerHandler.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world));
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet53BlockChange(i, j + (bottom ? 1 : -1), k, world));
}
result = (event.useItemInHand() != Event.Result.ALLOW);
} else {
} else if (!entityhuman.isSneaking() || itemstack == null) {
result = Block.byId[i1].interact(world, i, j, k, entityhuman, l, f, f1, f2);
}

View File

@ -502,5 +502,7 @@ public class PlayerInventory implements IInventory {
for (i = 0; i < this.armor.length; ++i) {
this.armor[i] = ItemStack.b(playerinventory.armor[i]);
}
this.itemInHandIndex = playerinventory.itemInHandIndex;
}
}

View File

@ -27,7 +27,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.Bukkit;
// CraftBukkit end
public abstract class ServerConfigurationManagerAbstract {
public abstract class PlayerList {
private static final SimpleDateFormat e = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
public static final Logger a = Logger.getLogger("Minecraft");
@ -48,7 +48,7 @@ public abstract class ServerConfigurationManagerAbstract {
// CraftBukkit start
private CraftServer cserver;
public ServerConfigurationManagerAbstract(MinecraftServer minecraftserver) {
public PlayerList(MinecraftServer minecraftserver) {
minecraftserver.server = new CraftServer(minecraftserver, this);
minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance();
this.cserver = minecraftserver.server;
@ -63,7 +63,7 @@ public abstract class ServerConfigurationManagerAbstract {
public void a(INetworkManager inetworkmanager, EntityPlayer entityplayer) {
this.a(entityplayer);
entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
entityplayer.itemInWorldManager.a((WorldServer) entityplayer.world);
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
String s = "local";
if (inetworkmanager.getSocketAddress() != null) {
@ -76,25 +76,26 @@ public abstract class ServerConfigurationManagerAbstract {
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
this.a(entityplayer, (EntityPlayer) null, worldserver);
NetServerHandler netserverhandler = new NetServerHandler(this.server, inetworkmanager, entityplayer);
PlayerConnection playerconnection = new PlayerConnection(this.server, inetworkmanager, entityplayer);
// CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly.
int maxPlayers = this.getMaxPlayers();
if (maxPlayers > 60) {
maxPlayers = 60;
}
netserverhandler.sendPacket(new Packet1Login(entityplayer.id, worldserver.getWorldData().getType(), entityplayer.itemInWorldManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, worldserver.getHeight(), maxPlayers));
playerconnection.sendPacket(new Packet1Login(entityplayer.id, worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, worldserver.getHeight(), maxPlayers));
entityplayer.getBukkitEntity().sendSupportedChannels();
// CraftBukkit end
netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
netserverhandler.sendPacket(new Packet202Abilities(entityplayer.abilities));
playerconnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
playerconnection.sendPacket(new Packet202Abilities(entityplayer.abilities));
playerconnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
this.b(entityplayer, worldserver);
// this.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - handled in event
this.c(entityplayer);
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.server.ae().a(netserverhandler);
netserverhandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.server.ae().a(playerconnection);
playerconnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
if (this.server.getTexturePack().length() > 0) {
entityplayer.a(this.server.getTexturePack(), this.server.S());
}
@ -104,7 +105,7 @@ public abstract class ServerConfigurationManagerAbstract {
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
netserverhandler.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect));
playerconnection.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect));
}
entityplayer.syncInventory();
@ -119,15 +120,15 @@ public abstract class ServerConfigurationManagerAbstract {
WorldServer worldserver1 = entityplayer.p();
if (worldserver != null) {
worldserver.getPlayerManager().removePlayer(entityplayer);
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
}
worldserver1.getPlayerManager().addPlayer(entityplayer);
worldserver1.getPlayerChunkMap().addPlayer(entityplayer);
worldserver1.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
}
public int a() {
return PlayerManager.getFurthestViewableBlock(this.o());
return PlayerChunkMap.getFurthestViewableBlock(this.o());
}
public void a(EntityPlayer entityplayer) {
@ -157,7 +158,7 @@ public abstract class ServerConfigurationManagerAbstract {
String joinMessage = playerJoinEvent.getJoinMessage();
if ((joinMessage != null) && (joinMessage.length() > 0)) {
this.server.getServerConfigurationManager().sendAll(new Packet3Chat(joinMessage));
this.server.getPlayerList().sendAll(new Packet3Chat(joinMessage));
}
this.cserver.onPlayerJoin(playerJoinEvent.getPlayer());
@ -177,7 +178,7 @@ public abstract class ServerConfigurationManagerAbstract {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
entityplayer1.netServerHandler.sendPacket(packet);
entityplayer1.playerConnection.sendPacket(packet);
}
}
// CraftBukkit end
@ -187,18 +188,18 @@ public abstract class ServerConfigurationManagerAbstract {
// CraftBukkit start - .name -> .listName
if (entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
entityplayer.netServerHandler.sendPacket(new Packet201PlayerInfo(entityplayer1.listName, true, entityplayer1.ping));
entityplayer.playerConnection.sendPacket(new Packet201PlayerInfo(entityplayer1.listName, true, entityplayer1.ping));
}
// CraftBukkit end
}
}
public void d(EntityPlayer entityplayer) {
entityplayer.p().getPlayerManager().movePlayer(entityplayer);
entityplayer.p().getPlayerChunkMap().movePlayer(entityplayer);
}
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
if (entityplayer.netServerHandler.disconnected) return null; // CraftBukkit - exploitsies fix
if (entityplayer.playerConnection.disconnected) return null; // CraftBukkit - exploitsies fix
// CraftBukkit start - quitting must be before we do final save of data, in case plugins need to modify it
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
@ -209,7 +210,7 @@ public abstract class ServerConfigurationManagerAbstract {
WorldServer worldserver = entityplayer.p();
worldserver.kill(entityplayer);
worldserver.getPlayerManager().removePlayer(entityplayer);
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit
@ -219,7 +220,7 @@ public abstract class ServerConfigurationManagerAbstract {
EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
entityplayer1.netServerHandler.sendPacket(packet);
entityplayer1.playerConnection.sendPacket(packet);
}
}
@ -228,15 +229,15 @@ public abstract class ServerConfigurationManagerAbstract {
}
// CraftBukkit start - Whole method and signature
public EntityPlayer attemptLogin(NetLoginHandler netloginhandler, String s, String hostname) {
public EntityPlayer attemptLogin(PendingConnection pendingconnection, String s, String hostname) {
// Instead of kicking then returning, we need to store the kick reason
// in the event, check with plugins to see if it's ok, and THEN kick
// depending on the outcome.
EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.M() ? new DemoItemInWorldManager(this.server.getWorldServer(0)) : new ItemInWorldManager(this.server.getWorldServer(0)));
EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.M() ? new DemoPlayerInteractManager(this.server.getWorldServer(0)) : new PlayerInteractManager(this.server.getWorldServer(0)));
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, netloginhandler.getSocket().getInetAddress());
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, pendingconnection.getSocket().getInetAddress());
SocketAddress socketaddress = netloginhandler.networkManager.getSocketAddress();
SocketAddress socketaddress = pendingconnection.networkManager.getSocketAddress();
if (this.banByName.isBanned(s)) {
BanEntry banentry = (BanEntry) this.banByName.getEntries().get(s);
@ -272,7 +273,7 @@ public abstract class ServerConfigurationManagerAbstract {
this.cserver.getPluginManager().callEvent(event);
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
netloginhandler.disconnect(event.getKickMessage());
pendingconnection.disconnect(event.getKickMessage());
return null;
}
@ -297,19 +298,19 @@ public abstract class ServerConfigurationManagerAbstract {
while (iterator.hasNext()) {
entityplayer = (EntityPlayer) iterator.next();
entityplayer.netServerHandler.disconnect("You logged in from another location");
entityplayer.playerConnection.disconnect("You logged in from another location");
}
/* CraftBukkit start
Object object;
if (this.server.M()) {
object = new DemoItemInWorldManager(this.server.getWorldServer(0));
object = new DemoPlayerInteractManager(this.server.getWorldServer(0));
} else {
object = new ItemInWorldManager(this.server.getWorldServer(0));
object = new PlayerInteractManager(this.server.getWorldServer(0));
}
return new EntityPlayer(this.server, this.server.getWorldServer(0), s, (ItemInWorldManager) object);
return new EntityPlayer(this.server, this.server.getWorldServer(0), s, (PlayerInteractManager) object);
*/
return player;
// CraftBukkit end
@ -324,7 +325,7 @@ public abstract class ServerConfigurationManagerAbstract {
// CraftBukkit end
entityplayer.p().getTracker().untrackPlayer(entityplayer);
// entityplayer.p().getTracker().untrackEntity(entityplayer); // CraftBukkit
entityplayer.p().getPlayerManager().removePlayer(entityplayer);
entityplayer.p().getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
@ -348,7 +349,7 @@ public abstract class ServerConfigurationManagerAbstract {
location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
} else {
entityplayer1.setRespawnPosition(null, true);
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0, 0));
entityplayer1.playerConnection.sendPacket(new Packet70Bed(0, 0));
}
}
@ -380,18 +381,18 @@ public abstract class ServerConfigurationManagerAbstract {
// CraftBukkit start
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
// Force the client to refresh their chunk cache.
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0), (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.itemInWorldManager.getGameMode()));
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.itemInWorldManager.getGameMode()));
entityplayer1.playerConnection.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0), (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode()));
entityplayer1.playerConnection.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode()));
entityplayer1.spawnIn(worldserver);
entityplayer1.dead = false;
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
entityplayer1.setSneaking(false);
chunkcoordinates1 = worldserver.getSpawn();
// CraftBukkit end
entityplayer1.netServerHandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z));
entityplayer1.netServerHandler.sendPacket(new Packet43SetExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
entityplayer1.playerConnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z));
entityplayer1.playerConnection.sendPacket(new Packet43SetExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
this.b(entityplayer1, worldserver);
worldserver.getPlayerManager().addPlayer(entityplayer1);
worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
worldserver.addEntity(entityplayer1);
this.players.add(entityplayer1);
// CraftBukkit start - added from changeDimension
@ -402,7 +403,7 @@ public abstract class ServerConfigurationManagerAbstract {
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
entityplayer1.netServerHandler.sendPacket(new Packet41MobEffect(entityplayer1.id, mobeffect));
entityplayer1.playerConnection.sendPacket(new Packet41MobEffect(entityplayer1.id, mobeffect));
}
// entityplayer1.syncInventory();
// CraftBukkit end
@ -562,7 +563,7 @@ public abstract class ServerConfigurationManagerAbstract {
public void sendAll(Packet packet) {
for (int i = 0; i < this.players.size(); ++i) {
((EntityPlayer) this.players.get(i)).netServerHandler.sendPacket(packet);
((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(packet);
}
}
@ -571,7 +572,7 @@ public abstract class ServerConfigurationManagerAbstract {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
if (entityplayer.dimension == i) {
entityplayer.netServerHandler.sendPacket(packet);
entityplayer.playerConnection.sendPacket(packet);
}
}
}
@ -678,7 +679,7 @@ public abstract class ServerConfigurationManagerAbstract {
}
}
if ((l == EnumGamemode.NONE.a() || l == entityplayer.itemInWorldManager.getGameMode().a()) && (i1 <= 0 || entityplayer.expLevel >= i1) && entityplayer.expLevel <= j1) {
if ((l == EnumGamemode.NONE.a() || l == entityplayer.playerInteractManager.getGameMode().a()) && (i1 <= 0 || entityplayer.expLevel >= i1) && entityplayer.expLevel <= j1) {
((List) object).add(entityplayer);
}
}
@ -718,7 +719,7 @@ public abstract class ServerConfigurationManagerAbstract {
double d6 = d2 - entityplayer.locZ;
if (d4 * d4 + d5 * d5 + d6 * d6 < d3 * d3) {
entityplayer.netServerHandler.sendPacket(packet);
entityplayer.playerConnection.sendPacket(packet);
}
}
}
@ -749,15 +750,16 @@ public abstract class ServerConfigurationManagerAbstract {
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
if (worldserver.N()) {
entityplayer.netServerHandler.sendPacket(new Packet70Bed(1, 0));
entityplayer.playerConnection.sendPacket(new Packet70Bed(1, 0));
}
}
public void updateClient(EntityPlayer entityplayer) {
entityplayer.updateInventory(entityplayer.defaultContainer);
entityplayer.m();
entityplayer.playerConnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
}
public int getPlayerCount() {
@ -809,17 +811,22 @@ public abstract class ServerConfigurationManagerAbstract {
private void a(EntityPlayer entityplayer, EntityPlayer entityplayer1, World world) {
if (entityplayer1 != null) {
entityplayer.itemInWorldManager.setGameMode(entityplayer1.itemInWorldManager.getGameMode());
entityplayer.playerInteractManager.setGameMode(entityplayer1.playerInteractManager.getGameMode());
} else if (this.m != null) {
entityplayer.itemInWorldManager.setGameMode(this.m);
entityplayer.playerInteractManager.setGameMode(this.m);
}
entityplayer.itemInWorldManager.b(world.getWorldData().getGameType());
entityplayer.playerInteractManager.b(world.getWorldData().getGameType());
}
public void r() {
while (!this.players.isEmpty()) {
((EntityPlayer) this.players.get(0)).netServerHandler.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
}
}
public void k(String s) {
this.server.info(s);
this.sendAll(new Packet3Chat(s));
}
}

View File

@ -91,7 +91,6 @@ public class PropertyManager {
public String getString(String s, String s1) {
if (!this.properties.containsKey(s)) {
s1 = this.getOverride(s, s1); // CraftBukkit
this.properties.setProperty(s, s1);
this.savePropertiesFile();
}
@ -103,7 +102,6 @@ public class PropertyManager {
try {
return this.getOverride(s, Integer.parseInt(this.getString(s, "" + i))); // CraftBukkit
} catch (Exception exception) {
i = this.getOverride(s, i); // CraftBukkit
this.properties.setProperty(s, "" + i);
return i;
}
@ -113,7 +111,6 @@ public class PropertyManager {
try {
return this.getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); // CraftBukkit
} catch (Exception exception) {
flag = this.getOverride(s, flag); // CraftBukkit
this.properties.setProperty(s, "" + flag);
return flag;
}

View File

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.ArrayList;
public class RecipesArmorDye extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
// CraftBukkit start - delegate to new parent class with bogus info
public RecipesArmorDye() {
public RecipeArmorDye() {
super(new ItemStack(Item.LEATHER_HELMET, 0, 0), java.util.Arrays.asList(new ItemStack(Item.INK_SACK, 0, 5)));
}
// CraftBukkit end
@ -63,7 +63,7 @@ public class RecipesArmorDye extends ShapelessRecipes implements IRecipe { // Cr
}
itemstack = itemstack1.cloneItemStack();
if (itemarmor.b_(itemstack1)) {
if (itemarmor.a(itemstack1)) {
l = itemarmor.b(itemstack);
f = (float) (l >> 16 & 255) / 255.0F;
f1 = (float) (l >> 8 & 255) / 255.0F;

View File

@ -0,0 +1,176 @@
package net.minecraft.server;
import java.util.ArrayList;
public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
private ItemStack a;
// CraftBukkit start - delegate to new parent class with bogus info
public RecipeFireworks() {
super(new ItemStack(Item.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Item.SULPHUR, 0, 5)));
}
// CraftBukkit end
public boolean a(InventoryCrafting inventorycrafting, World world) {
this.a = null;
int i = 0;
int j = 0;
int k = 0;
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = 0; k1 < inventorycrafting.getSize(); ++k1) {
ItemStack itemstack = inventorycrafting.getItem(k1);
if (itemstack != null) {
if (itemstack.id == Item.SULPHUR.id) {
++j;
} else if (itemstack.id == Item.FIREWORKS_CHARGE.id) {
++l;
} else if (itemstack.id == Item.INK_SACK.id) {
++k;
} else if (itemstack.id == Item.PAPER.id) {
++i;
} else if (itemstack.id == Item.GLOWSTONE_DUST.id) {
++i1;
} else if (itemstack.id == Item.DIAMOND.id) {
++i1;
} else if (itemstack.id == Item.FIREBALL.id) {
++j1;
} else if (itemstack.id == Item.FEATHER.id) {
++j1;
} else if (itemstack.id == Item.GOLD_NUGGET.id) {
++j1;
} else {
if (itemstack.id != Item.SKULL.id) {
return false;
}
++j1;
}
}
}
i1 += k + j1;
if (j <= 3 && i <= 1) {
NBTTagCompound nbttagcompound;
NBTTagCompound nbttagcompound1;
if (j >= 1 && i == 1 && i1 == 0) {
this.a = new ItemStack(Item.FIREWORKS);
if (l > 0) {
nbttagcompound = new NBTTagCompound();
nbttagcompound1 = new NBTTagCompound("Fireworks");
NBTTagList nbttaglist = new NBTTagList("Explosions");
for (int l1 = 0; l1 < inventorycrafting.getSize(); ++l1) {
ItemStack itemstack1 = inventorycrafting.getItem(l1);
if (itemstack1 != null && itemstack1.id == Item.FIREWORKS_CHARGE.id && itemstack1.hasTag() && itemstack1.getTag().hasKey("Explosion")) {
nbttaglist.add(itemstack1.getTag().getCompound("Explosion"));
}
}
nbttagcompound1.set("Explosions", nbttaglist);
nbttagcompound1.setByte("Flight", (byte) j);
nbttagcompound.set("Fireworks", nbttagcompound1);
this.a.setTag(nbttagcompound);
}
return true;
} else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) {
this.a = new ItemStack(Item.FIREWORKS_CHARGE);
nbttagcompound = new NBTTagCompound();
nbttagcompound1 = new NBTTagCompound("Explosion");
byte b0 = 0;
ArrayList arraylist = new ArrayList();
for (int i2 = 0; i2 < inventorycrafting.getSize(); ++i2) {
ItemStack itemstack2 = inventorycrafting.getItem(i2);
if (itemstack2 != null) {
if (itemstack2.id == Item.INK_SACK.id) {
arraylist.add(Integer.valueOf(ItemDye.b[itemstack2.getData()]));
} else if (itemstack2.id == Item.GLOWSTONE_DUST.id) {
nbttagcompound1.setBoolean("Flicker", true);
} else if (itemstack2.id == Item.DIAMOND.id) {
nbttagcompound1.setBoolean("Trail", true);
} else if (itemstack2.id == Item.FIREBALL.id) {
b0 = 1;
} else if (itemstack2.id == Item.FEATHER.id) {
b0 = 4;
} else if (itemstack2.id == Item.GOLD_NUGGET.id) {
b0 = 2;
} else if (itemstack2.id == Item.SKULL.id) {
b0 = 3;
}
}
}
int[] aint = new int[arraylist.size()];
for (int j2 = 0; j2 < aint.length; ++j2) {
aint[j2] = ((Integer) arraylist.get(j2)).intValue();
}
nbttagcompound1.setIntArray("Colors", aint);
nbttagcompound1.setByte("Type", b0);
nbttagcompound.set("Explosion", nbttagcompound1);
this.a.setTag(nbttagcompound);
return true;
} else if (j == 0 && i == 0 && l == 1 && k > 0 && k == i1) {
ArrayList arraylist1 = new ArrayList();
for (int k2 = 0; k2 < inventorycrafting.getSize(); ++k2) {
ItemStack itemstack3 = inventorycrafting.getItem(k2);
if (itemstack3 != null) {
if (itemstack3.id == Item.INK_SACK.id) {
arraylist1.add(Integer.valueOf(ItemDye.b[itemstack3.getData()]));
} else if (itemstack3.id == Item.FIREWORKS_CHARGE.id) {
this.a = itemstack3.cloneItemStack();
this.a.count = 1;
}
}
}
int[] aint1 = new int[arraylist1.size()];
for (int l2 = 0; l2 < aint1.length; ++l2) {
aint1[l2] = ((Integer) arraylist1.get(l2)).intValue();
}
if (this.a != null && this.a.hasTag()) {
NBTTagCompound nbttagcompound2 = this.a.getTag().getCompound("Explosion");
if (nbttagcompound2 == null) {
return false;
} else {
nbttagcompound2.setIntArray("FadeColors", aint1);
return true;
}
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
public ItemStack a(InventoryCrafting inventorycrafting) {
return this.a.cloneItemStack();
}
public int a() {
return 10;
}
public ItemStack b() {
return this.a;
}
}

View File

@ -1,15 +1,9 @@
package net.minecraft.server;
// CraftBukkit start
import java.util.List;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
// CraftBukkit end
public class RecipesMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
// CraftBukkit start - delegate to new parent class
public RecipesMapClone() {
public RecipeMapClone() {
super(new ItemStack(Item.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Item.MAP_EMPTY, 0, 0)));
}
// CraftBukkit end

View File

@ -12,6 +12,7 @@ public class ShapedRecipes implements IRecipe {
private ItemStack[] items;
private ItemStack result;
public final int a;
private boolean f = false;
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
this.a = itemstack.id;
@ -134,10 +135,27 @@ public class ShapedRecipes implements IRecipe {
}
public ItemStack a(InventoryCrafting inventorycrafting) {
return this.b().cloneItemStack();
ItemStack itemstack = this.b().cloneItemStack();
if (this.f) {
for (int i = 0; i < inventorycrafting.getSize(); ++i) {
ItemStack itemstack1 = inventorycrafting.getItem(i);
if (itemstack1 != null && itemstack1.hasTag()) {
itemstack.setTag((NBTTagCompound) itemstack1.tag.clone());
}
}
}
return itemstack;
}
public int a() {
return this.width * this.height;
}
public ShapedRecipes c() {
this.f = true;
return this;
}
}

View File

@ -15,40 +15,40 @@ import org.bukkit.event.player.PlayerPreLoginEvent;
class ThreadLoginVerifier extends Thread {
final NetLoginHandler netLoginHandler;
final PendingConnection pendingConnection;
// CraftBukkit start
CraftServer server;
ThreadLoginVerifier(NetLoginHandler netloginhandler, CraftServer server) {
ThreadLoginVerifier(PendingConnection pendingconnection, CraftServer server) {
this.server = server;
// CraftBukkit end
this.netLoginHandler = netloginhandler;
this.pendingConnection = pendingconnection;
}
public void run() {
try {
String s = (new BigInteger(MinecraftEncryption.a(NetLoginHandler.a(this.netLoginHandler), NetLoginHandler.b(this.netLoginHandler).F().getPublic(), NetLoginHandler.c(this.netLoginHandler)))).toString(16);
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(NetLoginHandler.d(this.netLoginHandler), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).F().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16);
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
String s1 = bufferedreader.readLine();
bufferedreader.close();
if (!"YES".equals(s1)) {
this.netLoginHandler.disconnect("Failed to verify username!");
this.pendingConnection.disconnect("Failed to verify username!");
return;
}
// CraftBukkit start
if (this.netLoginHandler.getSocket() == null) {
if (this.pendingConnection.getSocket() == null) {
return;
}
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(NetLoginHandler.d(this.netLoginHandler), this.netLoginHandler.getSocket().getInetAddress());
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress());
this.server.getPluginManager().callEvent(asyncEvent);
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(NetLoginHandler.d(this.netLoginHandler), this.netLoginHandler.getSocket().getInetAddress());
final PlayerPreLoginEvent event = new PlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress());
if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
}
@ -59,26 +59,26 @@ class ThreadLoginVerifier extends Thread {
return event.getResult();
}};
NetLoginHandler.b(this.netLoginHandler).processQueue.add(waitable);
PendingConnection.b(this.pendingConnection).processQueue.add(waitable);
if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
this.netLoginHandler.disconnect(event.getKickMessage());
this.pendingConnection.disconnect(event.getKickMessage());
return;
}
} else {
if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
this.netLoginHandler.disconnect(asyncEvent.getKickMessage());
this.pendingConnection.disconnect(asyncEvent.getKickMessage());
return;
}
}
// CraftBukkit end
NetLoginHandler.a(this.netLoginHandler, true);
PendingConnection.a(this.pendingConnection, true);
// CraftBukkit start
} catch (java.io.IOException exception) {
this.netLoginHandler.disconnect("Failed to verify username, session authentication server unavailable!");
this.pendingConnection.disconnect("Failed to verify username, session authentication server unavailable!");
} catch (Exception exception) {
this.netLoginHandler.disconnect("Failed to verify username!");
server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + NetLoginHandler.d(this.netLoginHandler), exception);
this.pendingConnection.disconnect("Failed to verify username!");
server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + PendingConnection.d(this.pendingConnection), exception);
// CraftBukkit end
}
}

View File

@ -1,17 +1,22 @@
package net.minecraft.server;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
public class TileEntityMobSpawner extends TileEntity {
public int spawnDelay = -1;
public String mobName = "Pig"; // CraftBukkit - private -> public
private NBTTagCompound spawnData = null;
private List mobs = null;
private TileEntityMobSpawnerData spawnData = null;
public double b;
public double c = 0.0D;
private int minSpawnDelay = 200;
private int maxSpawnDelay = 800;
private int spawnCount = 4;
private Entity j;
private int maxNearbyEntities = 6;
private int requiredPlayerRange = 16;
private int spawnRange = 4;
@ -20,6 +25,10 @@ public class TileEntityMobSpawner extends TileEntity {
this.spawnDelay = 20;
}
public String getMobName() {
return this.spawnData == null ? this.mobName : this.spawnData.c;
}
public void a(String s) {
this.mobName = s;
}
@ -30,13 +39,15 @@ public class TileEntityMobSpawner extends TileEntity {
public void g() {
if (this.b()) {
if (this.world.isStatic) {
double d0 = (double) ((float) this.x + this.world.random.nextFloat());
double d1 = (double) ((float) this.y + this.world.random.nextFloat());
double d2 = (double) ((float) this.z + this.world.random.nextFloat());
double d0;
this.world.addParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
this.world.addParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
if (this.world.isStatic) {
double d1 = (double) ((float) this.x + this.world.random.nextFloat());
double d2 = (double) ((float) this.y + this.world.random.nextFloat());
d0 = (double) ((float) this.z + this.world.random.nextFloat());
this.world.addParticle("smoke", d1, d2, d0, 0.0D, 0.0D, 0.0D);
this.world.addParticle("flame", d1, d2, d0, 0.0D, 0.0D, 0.0D);
if (this.spawnDelay > 0) {
--this.spawnDelay;
}
@ -53,8 +64,10 @@ public class TileEntityMobSpawner extends TileEntity {
return;
}
boolean flag = false;
for (int i = 0; i < this.spawnCount; ++i) {
Entity entity = EntityTypes.createEntityByName(this.mobName, this.world);
Entity entity = EntityTypes.createEntityByName(this.getMobName(), this.world);
if (entity == null) {
return;
@ -68,12 +81,12 @@ public class TileEntityMobSpawner extends TileEntity {
}
if (entity != null) {
double d3 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * (double) this.spawnRange;
double d4 = (double) (this.y + this.world.random.nextInt(3) - 1);
double d5 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * (double) this.spawnRange;
d0 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * (double) this.spawnRange;
double d3 = (double) (this.y + this.world.random.nextInt(3) - 1);
double d4 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * (double) this.spawnRange;
EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
entity.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
entity.setPositionRotation(d0, d3, d4, this.world.random.nextFloat() * 360.0F, 0.0F);
if (entityliving == null || entityliving.canSpawn()) {
this.a(entity);
this.world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
@ -82,10 +95,14 @@ public class TileEntityMobSpawner extends TileEntity {
entityliving.aR();
}
this.e();
flag = true;
}
}
}
if (flag) {
this.e();
}
}
super.g();
@ -97,7 +114,7 @@ public class TileEntityMobSpawner extends TileEntity {
NBTTagCompound nbttagcompound = new NBTTagCompound();
entity.c(nbttagcompound);
Iterator iterator = this.spawnData.c().iterator();
Iterator iterator = this.spawnData.b.c().iterator();
while (iterator.hasNext()) {
NBTBase nbtbase = (NBTBase) iterator.next();
@ -118,6 +135,11 @@ public class TileEntityMobSpawner extends TileEntity {
this.spawnDelay = this.minSpawnDelay + this.world.random.nextInt(this.maxSpawnDelay - this.minSpawnDelay);
}
if (this.mobs != null && this.mobs.size() > 0) {
this.spawnData = (TileEntityMobSpawnerData) WeightedRandom.a(this.world.random, (Collection) this.mobs);
this.world.notify(this.x, this.y, this.z);
}
this.world.playNote(this.x, this.y, this.z, this.q().id, 1, 0);
}
@ -125,8 +147,19 @@ public class TileEntityMobSpawner extends TileEntity {
super.a(nbttagcompound);
this.mobName = nbttagcompound.getString("EntityId");
this.spawnDelay = nbttagcompound.getShort("Delay");
if (nbttagcompound.hasKey("SpawnPotentials")) {
this.mobs = new ArrayList();
NBTTagList nbttaglist = nbttagcompound.getList("SpawnPotentials");
for (int i = 0; i < nbttaglist.size(); ++i) {
this.mobs.add(new TileEntityMobSpawnerData(this, (NBTTagCompound) nbttaglist.get(i)));
}
} else {
this.mobs = null;
}
if (nbttagcompound.hasKey("SpawnData")) {
this.spawnData = nbttagcompound.getCompound("SpawnData");
this.spawnData = new TileEntityMobSpawnerData(this, nbttagcompound.getCompound("SpawnData"), this.mobName);
} else {
this.spawnData = null;
}
@ -145,11 +178,15 @@ public class TileEntityMobSpawner extends TileEntity {
if (nbttagcompound.hasKey("SpawnRange")) {
this.spawnRange = nbttagcompound.getShort("SpawnRange");
}
if (this.world != null && this.world.isStatic) {
this.j = null;
}
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setString("EntityId", this.mobName);
nbttagcompound.setString("EntityId", this.getMobName());
nbttagcompound.setShort("Delay", (short) this.spawnDelay);
nbttagcompound.setShort("MinSpawnDelay", (short) this.minSpawnDelay);
nbttagcompound.setShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
@ -158,7 +195,25 @@ public class TileEntityMobSpawner extends TileEntity {
nbttagcompound.setShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
nbttagcompound.setShort("SpawnRange", (short) this.spawnRange);
if (this.spawnData != null) {
nbttagcompound.setCompound("SpawnData", this.spawnData);
nbttagcompound.setCompound("SpawnData", (NBTTagCompound) this.spawnData.b.clone());
}
if (this.spawnData != null || this.mobs != null && this.mobs.size() > 0) {
NBTTagList nbttaglist = new NBTTagList();
if (this.mobs != null && this.mobs.size() > 0) {
Iterator iterator = this.mobs.iterator();
while (iterator.hasNext()) {
TileEntityMobSpawnerData tileentitymobspawnerdata = (TileEntityMobSpawnerData) iterator.next();
nbttaglist.add(tileentitymobspawnerdata.a());
}
} else {
nbttaglist.add(this.spawnData.a());
}
nbttagcompound.set("SpawnPotentials", nbttaglist);
}
}
@ -166,6 +221,7 @@ public class TileEntityMobSpawner extends TileEntity {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.b(nbttagcompound);
nbttagcompound.o("SpawnPotentials");
return new Packet132TileEntityData(this.x, this.y, this.z, 1, nbttagcompound);
}

View File

@ -43,13 +43,12 @@ public abstract class World implements IBlockAccess {
protected float n;
protected float o;
protected float p;
protected int q = 0;
public int r = 0;
public int q = 0;
public boolean suppressPhysics = false;
public int difficulty;
public Random random = new Random();
public WorldProvider worldProvider; // CraftBukkit - remove final
protected List w = new ArrayList();
protected List v = new ArrayList();
public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
protected final IDataManager dataManager;
public WorldData worldData; // CraftBukkit - protected -> public
@ -58,10 +57,10 @@ public abstract class World implements IBlockAccess {
public final VillageCollection villages;
protected final VillageSiege siegeManager = new VillageSiege(this);
public final MethodProfiler methodProfiler;
private final Vec3DPool K = new Vec3DPool(300, 2000);
private final Calendar L = Calendar.getInstance();
private UnsafeList M = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
private boolean N;
private final Vec3DPool J = new Vec3DPool(300, 2000);
private final Calendar K = Calendar.getInstance();
private UnsafeList L = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
private boolean M;
// CraftBukkit start - public, longhashset
public boolean allowMonsters = true;
public boolean allowAnimals = true;
@ -69,9 +68,9 @@ public abstract class World implements IBlockAccess {
public long ticksPerAnimalSpawns;
public long ticksPerMonsterSpawns;
// CraftBukkit end
private int O;
int[] I;
private List P;
private int N;
int[] H;
private List O;
public boolean isStatic;
public BiomeBase getBiome(int i, int j) {
@ -116,9 +115,9 @@ public abstract class World implements IBlockAccess {
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
this.O = this.random.nextInt(12000);
this.I = new int['\u8000'];
this.P = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
this.N = this.random.nextInt(12000);
this.H = new int['\u8000'];
this.O = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
this.isStatic = false;
this.dataManager = idatamanager;
this.methodProfiler = methodprofiler;
@ -416,8 +415,8 @@ public abstract class World implements IBlockAccess {
}
public void notify(int i, int j, int k) {
for (int l = 0; l < this.w.size(); ++l) {
((IWorldAccess) this.w.get(l)).a(i, j, k);
for (int l = 0; l < this.v.size(); ++l) {
((IWorldAccess) this.v.get(l)).a(i, j, k);
}
}
@ -444,14 +443,14 @@ public abstract class World implements IBlockAccess {
}
public void j(int i, int j, int k) {
for (int l = 0; l < this.w.size(); ++l) {
((IWorldAccess) this.w.get(l)).a(i, j, k, i, j, k);
for (int l = 0; l < this.v.size(); ++l) {
((IWorldAccess) this.v.get(l)).a(i, j, k, i, j, k);
}
}
public void e(int i, int j, int k, int l, int i1, int j1) {
for (int k1 = 0; k1 < this.w.size(); ++k1) {
((IWorldAccess) this.w.get(k1)).a(i, j, k, l, i1, j1);
for (int k1 = 0; k1 < this.v.size(); ++k1) {
((IWorldAccess) this.v.get(k1)).a(i, j, k, l, i1, j1);
}
}
@ -636,8 +635,8 @@ public abstract class World implements IBlockAccess {
chunk.a(enumskyblock, i & 15, j, k & 15, l);
for (int i1 = 0; i1 < this.w.size(); ++i1) {
((IWorldAccess) this.w.get(i1)).b(i, j, k);
for (int i1 = 0; i1 < this.v.size(); ++i1) {
((IWorldAccess) this.v.get(i1)).b(i, j, k);
}
}
}
@ -646,8 +645,8 @@ public abstract class World implements IBlockAccess {
}
public void o(int i, int j, int k) {
for (int l = 0; l < this.w.size(); ++l) {
((IWorldAccess) this.w.get(l)).b(i, j, k);
for (int l = 0; l < this.v.size(); ++l) {
((IWorldAccess) this.v.get(l)).b(i, j, k);
}
}
@ -830,39 +829,39 @@ public abstract class World implements IBlockAccess {
public void makeSound(Entity entity, String s, float f, float f1) {
if (entity != null && s != null) {
for (int i = 0; i < this.w.size(); ++i) {
((IWorldAccess) this.w.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
}
}
}
public void a(EntityHuman entityhuman, String s, float f, float f1) {
if (entityhuman != null && s != null) {
for (int i = 0; i < this.w.size(); ++i) {
((IWorldAccess) this.w.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
}
}
}
public void makeSound(double d0, double d1, double d2, String s, float f, float f1) {
if (s != null) {
for (int i = 0; i < this.w.size(); ++i) {
((IWorldAccess) this.w.get(i)).a(s, d0, d1, d2, f, f1);
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).a(s, d0, d1, d2, f, f1);
}
}
}
public void b(double d0, double d1, double d2, String s, float f, float f1) {}
public void a(double d0, double d1, double d2, String s, float f, float f1, boolean flag) {}
public void a(String s, int i, int j, int k) {
for (int l = 0; l < this.w.size(); ++l) {
((IWorldAccess) this.w.get(l)).a(s, i, j, k);
for (int l = 0; l < this.v.size(); ++l) {
((IWorldAccess) this.v.get(l)).a(s, i, j, k);
}
}
public void addParticle(String s, double d0, double d1, double d2, double d3, double d4, double d5) {
for (int i = 0; i < this.w.size(); ++i) {
((IWorldAccess) this.w.get(i)).a(s, d0, d1, d2, d3, d4, d5);
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).a(s, d0, d1, d2, d3, d4, d5);
}
}
@ -934,16 +933,16 @@ public abstract class World implements IBlockAccess {
}
protected void a(Entity entity) {
for (int i = 0; i < this.w.size(); ++i) {
((IWorldAccess) this.w.get(i)).a(entity);
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).a(entity);
}
entity.valid = true; // CraftBukkit
}
protected void b(Entity entity) {
for (int i = 0; i < this.w.size(); ++i) {
((IWorldAccess) this.w.get(i)).b(entity);
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).b(entity);
}
entity.valid = false; // CraftBukkit
@ -984,11 +983,11 @@ public abstract class World implements IBlockAccess {
}
public void addIWorldAccess(IWorldAccess iworldaccess) {
this.w.add(iworldaccess);
this.v.add(iworldaccess);
}
public List getCubes(Entity entity, AxisAlignedBB axisalignedbb) {
this.M.clear();
this.L.clear();
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@ -1003,7 +1002,7 @@ public abstract class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, i2, l1)];
if (block != null) {
block.a(this, k1, i2, l1, axisalignedbb, this.M, entity);
block.a(this, k1, i2, l1, axisalignedbb, this.L, entity);
}
}
}
@ -1017,20 +1016,20 @@ public abstract class World implements IBlockAccess {
AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).E();
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
this.M.add(axisalignedbb1);
this.L.add(axisalignedbb1);
}
axisalignedbb1 = entity.g((Entity) list.get(j2));
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
this.M.add(axisalignedbb1);
this.L.add(axisalignedbb1);
}
}
return this.M;
return this.L;
}
public List a(AxisAlignedBB axisalignedbb) {
this.M.clear();
this.L.clear();
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@ -1045,14 +1044,14 @@ public abstract class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, i2, l1)];
if (block != null) {
block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null);
block.a(this, k1, i2, l1, axisalignedbb, this.L, (Entity) null);
}
}
}
}
}
return this.M;
return this.L;
}
public int a(float f) {
@ -1128,6 +1127,7 @@ public abstract class World implements IBlockAccess {
// CraftBukkit end
try {
++entity.ticksLived;
entity.j_();
} catch (Throwable throwable) {
crashreport = CrashReport.a(throwable, "Ticking entity");
@ -1221,7 +1221,7 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.c("tileEntities");
this.N = true;
this.M = true;
Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
@ -1261,7 +1261,7 @@ public abstract class World implements IBlockAccess {
}
}
this.N = false;
this.M = false;
if (!this.b.isEmpty()) {
this.tileEntityList.removeAll(this.b);
this.b.clear();
@ -1304,7 +1304,7 @@ public abstract class World implements IBlockAccess {
}
public void a(Collection collection) {
if (this.N) {
if (this.M) {
this.a.addAll(collection);
} else {
this.tileEntityList.addAll(collection);
@ -1330,6 +1330,7 @@ public abstract class World implements IBlockAccess {
if (entity.vehicle != null) {
entity.U();
} else {
++entity.ticksLived;
entity.j_();
}
}
@ -1517,7 +1518,7 @@ public abstract class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, l1, i2)];
if (block != null && block.material == material) {
double d0 = (double) ((float) (l1 + 1) - BlockFluids.d(this.getData(k1, l1, i2)));
double d0 = (double) ((float) (l1 + 1) - BlockFluids.e(this.getData(k1, l1, i2)));
if ((double) l >= d0) {
flag = true;
@ -1702,7 +1703,7 @@ public abstract class World implements IBlockAccess {
public void setTileEntity(int i, int j, int k, TileEntity tileentity) {
if (tileentity != null && !tileentity.r()) {
if (this.N) {
if (this.M) {
tileentity.x = i;
tileentity.y = j;
tileentity.z = k;
@ -1721,7 +1722,7 @@ public abstract class World implements IBlockAccess {
public void r(int i, int j, int k) {
TileEntity tileentity = this.getTileEntity(i, j, k);
if (tileentity != null && this.N) {
if (tileentity != null && this.M) {
tileentity.w_();
this.a.remove(tileentity);
} else {
@ -1814,10 +1815,6 @@ public abstract class World implements IBlockAccess {
protected void n() {
if (!this.worldProvider.f) {
if (this.q > 0) {
--this.q;
}
int i = this.worldData.getThunderDuration();
if (i <= 0) {
@ -1929,8 +1926,8 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.b();
if (this.O > 0) {
--this.O;
if (this.N > 0) {
--this.N;
}
this.methodProfiler.a("playerCheckLight");
@ -1949,7 +1946,7 @@ public abstract class World implements IBlockAccess {
protected void a(int i, int j, Chunk chunk) {
this.methodProfiler.c("moodSound");
if (this.O == 0 && !this.isStatic) {
if (this.N == 0 && !this.isStatic) {
this.k = this.k * 3 + 1013904223;
int k = this.k >> 2;
int l = k & 15;
@ -1964,7 +1961,7 @@ public abstract class World implements IBlockAccess {
if (entityhuman != null && entityhuman.e((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D) > 4.0D) {
this.makeSound((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F);
this.O = this.random.nextInt(12000) + 6000;
this.N = this.random.nextInt(12000) + 6000;
}
}
}
@ -2171,16 +2168,16 @@ public abstract class World implements IBlockAccess {
int i4;
if (i2 > j1) {
this.I[i1++] = 133152;
this.H[i1++] = 133152;
} else if (i2 < j1) {
if (enumskyblock != EnumSkyBlock.BLOCK) {
;
}
this.I[i1++] = 133152 + (j1 << 18);
this.H[i1++] = 133152 + (j1 << 18);
while (l < i1) {
k1 = this.I[l++];
k1 = this.H[l++];
l1 = (k1 & 63) - 32 + i;
i2 = (k1 >> 6 & 63) - 32 + j;
j2 = (k1 >> 12 & 63) - 32 + k;
@ -2218,8 +2215,8 @@ public abstract class World implements IBlockAccess {
i5 = 1;
}
if (l2 == k2 - i5 && i1 < this.I.length) {
this.I[i1++] = j4 - i + 32 + (k4 - j + 32 << 6) + (l4 - k + 32 << 12) + (k2 - i5 << 18);
if (l2 == k2 - i5 && i1 < this.H.length) {
this.H[i1++] = j4 - i + 32 + (k4 - j + 32 << 6) + (l4 - k + 32 << 12) + (k2 - i5 << 18);
}
}
}
@ -2234,7 +2231,7 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("checkedPosition < toCheckCount");
while (l < i1) {
k1 = this.I[l++];
k1 = this.H[l++];
l1 = (k1 & 63) - 32 + i;
i2 = (k1 >> 6 & 63) - 32 + j;
j2 = (k1 >> 12 & 63) - 32 + k;
@ -2271,29 +2268,29 @@ public abstract class World implements IBlockAccess {
l3 = -l3;
}
if (j3 + i4 + l3 < 17 && i1 < this.I.length - 6) {
if (j3 + i4 + l3 < 17 && i1 < this.H.length - 6) {
if (this.b(enumskyblock, l1 - 1, i2, j2) < k3) {
this.I[i1++] = l1 - 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
this.H[i1++] = l1 - 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
}
if (this.b(enumskyblock, l1 + 1, i2, j2) < k3) {
this.I[i1++] = l1 + 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
this.H[i1++] = l1 + 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
}
if (this.b(enumskyblock, l1, i2 - 1, j2) < k3) {
this.I[i1++] = l1 - i + 32 + (i2 - 1 - j + 32 << 6) + (j2 - k + 32 << 12);
this.H[i1++] = l1 - i + 32 + (i2 - 1 - j + 32 << 6) + (j2 - k + 32 << 12);
}
if (this.b(enumskyblock, l1, i2 + 1, j2) < k3) {
this.I[i1++] = l1 - i + 32 + (i2 + 1 - j + 32 << 6) + (j2 - k + 32 << 12);
this.H[i1++] = l1 - i + 32 + (i2 + 1 - j + 32 << 6) + (j2 - k + 32 << 12);
}
if (this.b(enumskyblock, l1, i2, j2 - 1) < k3) {
this.I[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 - 1 - k + 32 << 12);
this.H[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 - 1 - k + 32 << 12);
}
if (this.b(enumskyblock, l1, i2, j2 + 1) < k3) {
this.I[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 + 1 - k + 32 << 12);
this.H[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 + 1 - k + 32 << 12);
}
}
}
@ -2313,7 +2310,7 @@ public abstract class World implements IBlockAccess {
}
public List getEntities(Entity entity, AxisAlignedBB axisalignedbb) {
this.P.clear();
this.O.clear();
int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D);
int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
@ -2322,12 +2319,12 @@ public abstract class World implements IBlockAccess {
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
if (this.isChunkLoaded(i1, j1)) {
this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.P);
this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.O);
}
}
}
return this.P;
return this.O;
}
public List a(Class oclass, AxisAlignedBB axisalignedbb) {
@ -2548,7 +2545,7 @@ public abstract class World implements IBlockAccess {
}
// CraftBukkit end
if (!entityhuman1.abilities.isInvulnerable) {
if (!entityhuman1.abilities.isInvulnerable && entityhuman1.isAlive()) {
double d5 = entityhuman1.e(d0, d1, d2);
double d6 = d3;
@ -2557,7 +2554,7 @@ public abstract class World implements IBlockAccess {
}
if (entityhuman1.isInvisible()) {
float f = entityhuman1.bS();
float f = entityhuman1.bR();
if (f < 0.1F) {
f = 0.1F;
@ -2699,8 +2696,8 @@ public abstract class World implements IBlockAccess {
}
public void e(int i, int j, int k, int l, int i1) {
for (int j1 = 0; j1 < this.w.size(); ++j1) {
((IWorldAccess) this.w.get(j1)).a(i, j, k, l, i1);
for (int j1 = 0; j1 < this.v.size(); ++j1) {
((IWorldAccess) this.v.get(j1)).a(i, j, k, l, i1);
}
}
@ -2709,8 +2706,19 @@ public abstract class World implements IBlockAccess {
}
public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) {
for (int j1 = 0; j1 < this.w.size(); ++j1) {
((IWorldAccess) this.w.get(j1)).a(entityhuman, i, j, k, l, i1);
try {
for (int j1 = 0; j1 < this.v.size(); ++j1) {
((IWorldAccess) this.v.get(j1)).a(entityhuman, i, j, k, l, i1);
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Playing level event");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Level event being played");
crashreportsystemdetails.a("Block coordinates", CrashReportSystemDetails.a(j, k, l));
crashreportsystemdetails.a("Event source", entityhuman);
crashreportsystemdetails.a("Event type", Integer.valueOf(i));
crashreportsystemdetails.a("Event data", Integer.valueOf(i1));
throw new ReportedException(crashreport);
}
}
@ -2754,22 +2762,22 @@ public abstract class World implements IBlockAccess {
}
public void g(int i, int j, int k, int l, int i1) {
for (int j1 = 0; j1 < this.w.size(); ++j1) {
IWorldAccess iworldaccess = (IWorldAccess) this.w.get(j1);
for (int j1 = 0; j1 < this.v.size(); ++j1) {
IWorldAccess iworldaccess = (IWorldAccess) this.v.get(j1);
iworldaccess.b(i, j, k, l, i1);
}
}
public Vec3DPool getVec3DPool() {
return this.K;
return this.J;
}
public Calendar T() {
if (this.getTime() % 600L == 0L) {
this.L.setTimeInMillis(System.currentTimeMillis());
this.K.setTimeInMillis(System.currentTimeMillis());
}
return this.L;
return this.K;
}
}

View File

@ -24,18 +24,18 @@ public class WorldManager implements IWorldAccess {
public void a(String s, double d0, double d1, double d2, float f, float f1) {
// CraftBukkit - this.world.dimension
this.server.getServerConfigurationManager().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
this.server.getPlayerList().sendPacketNearby(d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
}
public void a(EntityHuman entityhuman, String s, double d0, double d1, double d2, float f, float f1) {
// CraftBukkit - this.world.dimension
this.server.getServerConfigurationManager().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
this.server.getPlayerList().sendPacketNearby(entityhuman, d0, d1, d2, f > 1.0F ? (double) (16.0F * f) : 16.0D, this.world.dimension, new Packet62NamedSoundEffect(s, d0, d1, d2, f, f1));
}
public void a(int i, int j, int k, int l, int i1, int j1) {}
public void a(int i, int j, int k) {
this.world.getPlayerManager().flagDirty(i, j, k);
this.world.getPlayerChunkMap().flagDirty(i, j, k);
}
public void b(int i, int j, int k) {}
@ -44,15 +44,15 @@ public class WorldManager implements IWorldAccess {
public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) {
// CraftBukkit - this.world.dimension
this.server.getServerConfigurationManager().sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new Packet61WorldEvent(i, j, k, l, i1, false));
this.server.getPlayerList().sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new Packet61WorldEvent(i, j, k, l, i1, false));
}
public void a(int i, int j, int k, int l, int i1) {
this.server.getServerConfigurationManager().sendAll(new Packet61WorldEvent(i, j, k, l, i1, true));
this.server.getPlayerList().sendAll(new Packet61WorldEvent(i, j, k, l, i1, true));
}
public void b(int i, int j, int k, int l, int i1) {
Iterator iterator = this.server.getServerConfigurationManager().players.iterator();
Iterator iterator = this.server.getPlayerList().players.iterator();
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -63,7 +63,7 @@ public class WorldManager implements IWorldAccess {
double d2 = (double) l - entityplayer.locZ;
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.netServerHandler.sendPacket(new Packet55BlockBreakAnimation(i, j, k, l, i1));
entityplayer.playerConnection.sendPacket(new Packet55BlockBreakAnimation(i, j, k, l, i1));
}
}
}

View File

@ -23,17 +23,17 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
private final MinecraftServer server;
public EntityTracker tracker; // CraftBukkit - private final -> public
private final PlayerManager manager;
private Set M;
private TreeSet N;
private final PlayerChunkMap manager;
private Set L;
private TreeSet M;
public ChunkProviderServer chunkProviderServer;
public boolean savingDisabled;
private boolean O;
private boolean N;
private int emptyTime = 0;
private final PortalTravelAgent Q;
private NoteDataList[] R = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
private int S = 0;
private static final StructurePieceTreasure[] T = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)};
private final PortalTravelAgent P;
private NoteDataList[] Q = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
private int R = 0;
private static final StructurePieceTreasure[] S = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)};
private IntHashMap entitiesById;
// CraftBukkit start
@ -46,20 +46,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
this.server = minecraftserver;
this.tracker = new EntityTracker(this);
this.manager = new PlayerManager(this, minecraftserver.getServerConfigurationManager().o());
this.manager = new PlayerChunkMap(this, minecraftserver.getPlayerList().o());
if (this.entitiesById == null) {
this.entitiesById = new IntHashMap();
}
if (this.L == null) {
this.L = new HashSet();
}
if (this.M == null) {
this.M = new HashSet();
this.M = new TreeSet();
}
if (this.N == null) {
this.N = new TreeSet();
}
this.Q = new PortalTravelAgent(this);
this.P = new PortalTravelAgent(this);
}
// CraftBukkit start
@ -178,7 +178,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.villages.tick();
this.siegeManager.a();
this.methodProfiler.c("portalForcer");
this.Q.a(this.getTime());
this.P.a(this.getTime());
this.methodProfiler.b();
this.V();
}
@ -190,21 +190,21 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public void everyoneSleeping() {
this.O = !this.players.isEmpty();
this.N = !this.players.isEmpty();
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (!entityhuman.isSleeping() && !entityhuman.fauxSleeping) { // CraftBukkit
this.O = false;
this.N = false;
break;
}
}
}
protected void d() {
this.O = false;
this.N = false;
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
@ -237,7 +237,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public boolean everyoneDeeplySleeping() {
if (this.O && !this.isStatic) {
if (this.N && !this.isStatic) {
Iterator iterator = this.players.iterator();
// CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers
@ -299,7 +299,6 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
l1 = this.h(j1, k1);
if (this.D(j1, l1, k1)) {
this.strikeLightning(new EntityLightning(this, (double) j1, (double) l1, (double) k1));
this.q = 2;
}
}
@ -412,9 +411,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
nextticklistentry.a(j1);
}
if (!this.M.contains(nextticklistentry)) {
if (!this.L.contains(nextticklistentry)) {
this.L.add(nextticklistentry);
this.M.add(nextticklistentry);
this.N.add(nextticklistentry);
}
}
}
@ -426,9 +425,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
nextticklistentry.a((long) i1 + this.worldData.getTime());
}
if (!this.M.contains(nextticklistentry)) {
if (!this.L.contains(nextticklistentry)) {
this.L.add(nextticklistentry);
this.M.add(nextticklistentry);
this.N.add(nextticklistentry);
}
}
@ -449,9 +448,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public boolean a(boolean flag) {
int i = this.N.size();
int i = this.M.size();
if (i != this.M.size()) {
if (i != this.L.size()) {
throw new IllegalStateException("TickNextTick list out of synch");
} else {
if (i > 1000) {
@ -465,14 +464,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
for (int j = 0; j < i; ++j) {
NextTickListEntry nextticklistentry = (NextTickListEntry) this.N.first();
NextTickListEntry nextticklistentry = (NextTickListEntry) this.M.first();
if (!flag && nextticklistentry.e > this.worldData.getTime()) {
break;
}
this.N.remove(nextticklistentry);
this.M.remove(nextticklistentry);
this.L.remove(nextticklistentry);
byte b0 = 8;
if (this.d(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
@ -495,11 +494,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
CrashReportSystemDetails.a(crashreportsystemdetails, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, k, l);
throw new ReportedException(crashreport);
} }
}
}
}
}
return !this.N.isEmpty();
return !this.M.isEmpty();
}
}
@ -510,14 +510,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
int j = i + 16;
int k = chunkcoordintpair.z << 4;
int l = k + 16;
Iterator iterator = this.N.iterator();
Iterator iterator = this.M.iterator();
while (iterator.hasNext()) {
NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next();
if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) {
if (flag) {
this.M.remove(nextticklistentry);
this.L.remove(nextticklistentry);
iterator.remove();
}
@ -599,7 +599,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
// CraftBukkit - Configurable spawn protection
return i1 > this.getServer().getSpawnRadius() || this.server.getServerConfigurationManager().isOp(entityhuman.name) || this.server.I();
return i1 > this.getServer().getSpawnRadius() || this.server.getPlayerList().isOp(entityhuman.name) || this.server.I();
}
protected void a(WorldSettings worldsettings) {
@ -607,12 +607,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.entitiesById = new IntHashMap();
}
if (this.M == null) {
this.M = new HashSet();
if (this.L == null) {
this.L = new HashSet();
}
if (this.N == null) {
this.N = new TreeSet();
if (this.M == null) {
this.M = new TreeSet();
}
this.b(worldsettings);
@ -676,7 +676,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void k() {
WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(T, 10);
WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(S, 10);
for (int i = 0; i < 10; ++i) {
int j = this.worldData.c() + this.random.nextInt(6) - this.random.nextInt(6);
@ -710,7 +710,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws
this.D();
this.dataManager.saveWorldData(this.worldData, this.server.getServerConfigurationManager().q());
this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().q());
this.worldMaps.a();
}
@ -752,7 +752,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
if (super.strikeLightning(entity)) {
this.server.getServerConfigurationManager().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new Packet71Weather(entity));
this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new Packet71Weather(entity));
// CraftBukkit end
return true;
} else {
@ -792,7 +792,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (entityhuman.e(d0, d1, d2) < 4096.0D) {
((EntityPlayer) entityhuman).netServerHandler.sendPacket(new Packet60Explosion(d0, d1, d2, f, explosion.blocks, (Vec3D) explosion.b().get(entityhuman)));
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet60Explosion(d0, d1, d2, f, explosion.blocks, (Vec3D) explosion.b().get(entityhuman)));
}
}
@ -801,13 +801,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public void playNote(int i, int j, int k, int l, int i1, int j1) {
NoteBlockData noteblockdata = new NoteBlockData(i, j, k, l, i1, j1);
Iterator iterator = this.R[this.S].iterator();
Iterator iterator = this.Q[this.R].iterator();
NoteBlockData noteblockdata1;
do {
if (!iterator.hasNext()) {
this.R[this.S].add(noteblockdata);
this.Q[this.R].add(noteblockdata);
return;
}
@ -817,22 +817,22 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
private void V() {
while (!this.R[this.S].isEmpty()) {
int i = this.S;
while (!this.Q[this.R].isEmpty()) {
int i = this.R;
this.S ^= 1;
Iterator iterator = this.R[i].iterator();
this.R ^= 1;
Iterator iterator = this.Q[i].iterator();
while (iterator.hasNext()) {
NoteBlockData noteblockdata = (NoteBlockData) iterator.next();
if (this.a(noteblockdata)) {
// CraftBukkit - this.worldProvider.dimension -> this.dimension
this.server.getServerConfigurationManager().sendPacketNearby((double) noteblockdata.a(), (double) noteblockdata.b(), (double) noteblockdata.c(), 64.0D, this.dimension, new Packet54PlayNoteBlock(noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.f(), noteblockdata.d(), noteblockdata.e()));
this.server.getPlayerList().sendPacketNearby((double) noteblockdata.a(), (double) noteblockdata.b(), (double) noteblockdata.c(), 64.0D, this.dimension, new Packet54PlayNoteBlock(noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.f(), noteblockdata.d(), noteblockdata.e()));
}
}
this.R[i].clear();
this.Q[i].clear();
}
}
@ -859,7 +859,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit start - only sending weather packets to those affected
for (int i = 0; i < this.players.size(); ++i) {
if (((EntityPlayer) this.players.get(i)).world == this) {
((EntityPlayer) this.players.get(i)).netServerHandler.sendPacket(new Packet70Bed(flag ? 2 : 1, 0));
((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(new Packet70Bed(flag ? 2 : 1, 0));
}
}
// CraftBukkit end
@ -874,11 +874,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
return this.tracker;
}
public PlayerManager getPlayerManager() {
public PlayerChunkMap getPlayerChunkMap() {
return this.manager;
}
public PortalTravelAgent s() {
return this.Q;
return this.P;
}
}

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