13
0
geforkt von Mirrors/Paper

Cleanup comments, formatting, etc

Dieser Commit ist enthalten in:
Travis Watkins 2013-03-24 23:22:32 -05:00
Ursprung 7c40a073d8
Commit 5f089137ee
148 geänderte Dateien mit 420 neuen und 470 gelöschten Zeilen

Datei anzeigen

@ -39,7 +39,7 @@ public class AABBPool {
this.largestSize = this.d; this.largestSize = this.d;
} }
// CraftBukkit start - intelligent cache // CraftBukkit start - Intelligent cache
if ((this.resizeTime++ & 0xff) == 0) { if ((this.resizeTime++ & 0xff) == 0) {
int newSize = this.pool.size() - (this.pool.size() >> 3); int newSize = this.pool.size() - (this.pool.size() >> 3);
// newSize will be 87.5%, but if we were not in that range, we clear some of the cache // newSize will be 87.5%, but if we were not in that range, we clear some of the cache

Datei anzeigen

@ -3,7 +3,6 @@ package net.minecraft.server;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.inventory.Inventory;
// CraftBukkit end // CraftBukkit end
public class BlockDropper extends BlockDispenser { public class BlockDropper extends BlockDispenser {
@ -38,10 +37,10 @@ public class BlockDropper extends BlockDispenser {
ItemStack itemstack1; ItemStack itemstack1;
if (iinventory != null) { if (iinventory != null) {
// CraftBukkit start - fire event when pushing items into other inventories // CraftBukkit start - Fire event when pushing items into other inventories
CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().a(1)); CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().a(1));
Inventory destinationInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null; org.bukkit.inventory.Inventory destinationInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null;
InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true); InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
world.getServer().getPluginManager().callEvent(event); world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {

Datei anzeigen

@ -134,7 +134,7 @@ public class BlockFire extends Block {
k2 = 15; k2 = 15;
} }
// CraftBukkit start - call to stop spread of fire // CraftBukkit start - Call to stop spread of fire
if (world.getTypeId(i1, k1, j1) != Block.FIRE.id) { if (world.getTypeId(i1, k1, j1) != Block.FIRE.id) {
if (CraftEventFactory.callBlockIgniteEvent(world, i1, k1, j1, i, j, k).isCancelled()) { if (CraftEventFactory.callBlockIgniteEvent(world, i1, k1, j1, i, j, k).isCancelled()) {
continue; continue;
@ -261,7 +261,7 @@ public class BlockFire extends Block {
// CraftBukkit start // CraftBukkit start
private void fireExtinguished(World world, int x, int y, int z) { private void fireExtinguished(World world, int x, int y, int z) {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled() == false) { if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled()) {
world.setAir(x, y, z); world.setAir(x, y, z);
} }
} }

Datei anzeigen

@ -100,7 +100,7 @@ public class BlockFlowing extends BlockFluids {
} }
if (this.o(world, i, j - 1, k)) { if (this.o(world, i, j - 1, k)) {
// CraftBukkit start - send "down" to the server // CraftBukkit start - Send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN); BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
if (server != null) { if (server != null) {
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
@ -132,7 +132,7 @@ public class BlockFlowing extends BlockFluids {
return; return;
} }
// CraftBukkit start - all four cardinal directions. Do not change the order! // CraftBukkit start - All four cardinal directions. Do not change the order!
BlockFace[] faces = new BlockFace[] { BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH }; BlockFace[] faces = new BlockFace[] { BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH };
int index = 0; int index = 0;

Datei anzeigen

@ -22,7 +22,7 @@ public class BlockMobSpawner extends BlockContainer {
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
super.dropNaturally(world, i, j, k, l, f, i1); super.dropNaturally(world, i, j, k, l, f, i1);
/* CraftBukkit start - delegate to getExpDrop /* CraftBukkit start - Delegate to getExpDrop
int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15); int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15);
this.j(world, i, j, k, j1);*/ this.j(world, i, j, k, j1);*/

Datei anzeigen

@ -33,7 +33,7 @@ public class BlockOre extends Block {
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
super.dropNaturally(world, i, j, k, l, f, i1); super.dropNaturally(world, i, j, k, l, f, i1);
/* CraftBukkit start - delegated getExpDrop /* CraftBukkit start - Delegated to getExpDrop
if (this.getDropType(l, world.random, i1) != this.id) { if (this.getDropType(l, world.random, i1) != this.id) {
int j1 = 0; int j1 = 0;

Datei anzeigen

@ -21,7 +21,7 @@ public class BlockPumpkin extends BlockDirectional {
super.onPlace(world, i, j, k); super.onPlace(world, i, j, k);
if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) { if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
if (!world.isStatic) { if (!world.isStatic) {
// CraftBukkit start - use BlockStateListPopulator // CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
blockList.setTypeId(i, j, k, 0); blockList.setTypeId(i, j, k, 0);
@ -45,7 +45,7 @@ public class BlockPumpkin extends BlockDirectional {
boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id; boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id;
if (flag || flag1) { if (flag || flag1) {
// CraftBukkit start - use BlockStateListPopulator // CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
blockList.setTypeId(i, j, k, 0); blockList.setTypeId(i, j, k, 0);

Datei anzeigen

@ -77,7 +77,7 @@ public class BlockRedstoneOre extends Block {
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
super.dropNaturally(world, i, j, k, l, f, i1); super.dropNaturally(world, i, j, k, l, f, i1);
/* CraftBukkit start - delegate to getExpDrop /* CraftBukkit start - Delegated to getExpDrop
if (this.getDropType(l, world.random, i1) != this.id) { if (this.getDropType(l, world.random, i1) != this.id) {
int j1 = 1 + world.random.nextInt(5); int j1 = 1 + world.random.nextInt(5);

Datei anzeigen

@ -6,6 +6,7 @@ import java.util.Random;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.TreeType; import org.bukkit.TreeType;
import org.bukkit.craftbukkit.util.StructureGrowDelegate; import org.bukkit.craftbukkit.util.StructureGrowDelegate;
import org.bukkit.entity.Player;
import org.bukkit.event.world.StructureGrowEvent; import org.bukkit.event.world.StructureGrowEvent;
// CraftBukkit end // CraftBukkit end
@ -32,7 +33,7 @@ public class BlockSapling extends BlockFlower {
} }
// CraftBukkit - added bonemeal, player and itemstack // CraftBukkit - added bonemeal, player and itemstack
public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) { public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if ((l & 8) == 0) { if ((l & 8) == 0) {
@ -42,14 +43,14 @@ public class BlockSapling extends BlockFlower {
} }
} }
// CraftBukkit - added bonemeal, player and itemstack // CraftBukkit - Added bonemeal, player and itemstack
public void d(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) { public void d(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) {
int l = world.getData(i, j, k) & 3; int l = world.getData(i, j, k) & 3;
Object object = null; Object object = null;
int i1 = 0; int i1 = 0;
int j1 = 0; int j1 = 0;
boolean flag = false; boolean flag = false;
// CraftBukkit start - records tree generation and calls StructureGrowEvent // CraftBukkit start - Records tree generation and calls StructureGrowEvent
StructureGrowDelegate delegate = new StructureGrowDelegate(world); StructureGrowDelegate delegate = new StructureGrowDelegate(world);
TreeType treeType = null; TreeType treeType = null;
TreeGenerator gen = null; TreeGenerator gen = null;

Datei anzeigen

@ -77,7 +77,7 @@ public class BlockSkull extends BlockContainer {
return i; return i;
} }
// CraftBukkit start - special case dropping so we can get info from the tile entity // CraftBukkit start - Special case dropping so we can get info from the tile entity
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (world.random.nextFloat() < f) { if (world.random.nextFloat() < f) {
ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k)); ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k));
@ -104,7 +104,7 @@ public class BlockSkull extends BlockContainer {
public void remove(World world, int i, int j, int k, int l, int i1) { public void remove(World world, int i, int j, int k, int l, int i1) {
if (!world.isStatic) { if (!world.isStatic) {
/* CraftBukkit start - drop item in code above, not here /* CraftBukkit start - Drop item in code above, not here
if ((i1 & 8) == 0) { if ((i1 & 8) == 0) {
ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k)); ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k));
TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k); TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k);
@ -136,7 +136,7 @@ public class BlockSkull extends BlockContainer {
for (i1 = -2; i1 <= 0; ++i1) { for (i1 = -2; i1 <= 0; ++i1) {
if (world.getTypeId(i, j - 1, k + i1) == l && world.getTypeId(i, j - 1, k + i1 + 1) == l && world.getTypeId(i, j - 2, k + i1 + 1) == l && world.getTypeId(i, j - 1, k + i1 + 2) == l && this.d(world, i, j, k + i1, 1) && this.d(world, i, j, k + i1 + 1, 1) && this.d(world, i, j, k + i1 + 2, 1)) { if (world.getTypeId(i, j - 1, k + i1) == l && world.getTypeId(i, j - 1, k + i1 + 1) == l && world.getTypeId(i, j - 2, k + i1 + 1) == l && world.getTypeId(i, j - 1, k + i1 + 2) == l && this.d(world, i, j, k + i1, 1) && this.d(world, i, j, k + i1 + 1, 1) && this.d(world, i, j, k + i1 + 2, 1)) {
// CraftBukkit start - use BlockStateListPopulator // CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
world.setData(i, j, k + i1, 8, 2); world.setData(i, j, k + i1, 8, 2);
@ -173,7 +173,7 @@ public class BlockSkull extends BlockContainer {
for (i1 = -2; i1 <= 0; ++i1) { for (i1 = -2; i1 <= 0; ++i1) {
if (world.getTypeId(i + i1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 2, k) == l && world.getTypeId(i + i1 + 2, j - 1, k) == l && this.d(world, i + i1, j, k, 1) && this.d(world, i + i1 + 1, j, k, 1) && this.d(world, i + i1 + 2, j, k, 1)) { if (world.getTypeId(i + i1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 2, k) == l && world.getTypeId(i + i1 + 2, j - 1, k) == l && this.d(world, i + i1, j, k, 1) && this.d(world, i + i1 + 1, j, k, 1) && this.d(world, i + i1 + 2, j, k, 1)) {
// CraftBukkit start - use BlockStateListPopulator // CraftBukkit start - Use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
world.setData(i + i1, j, k, 8, 2); world.setData(i + i1, j, k, 8, 2);

Datei anzeigen

@ -55,7 +55,7 @@ public class BlockSoil extends Block {
return; return;
} }
// CraftBukkit start - interact soil // CraftBukkit start - Interact soil
org.bukkit.event.Cancellable cancellable; org.bukkit.event.Cancellable cancellable;
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null); cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);

Datei anzeigen

@ -39,7 +39,7 @@ public class BlockStationary extends BlockFluids {
int i1; int i1;
int j1; int j1;
// CraftBukkit start - prevent lava putting something on fire, remember igniter block coords // CraftBukkit start - Prevent lava putting something on fire, remember igniter block coords
int x = i; int x = i;
int y = j; int y = j;
int z = k; int z = k;
@ -52,7 +52,7 @@ public class BlockStationary extends BlockFluids {
j1 = world.getTypeId(i, j, k); j1 = world.getTypeId(i, j, k);
if (j1 == 0) { if (j1 == 0) {
if (this.m(world, i - 1, j, k) || this.m(world, i + 1, j, k) || this.m(world, i, j, k - 1) || this.m(world, i, j, k + 1) || this.m(world, i, j - 1, k) || this.m(world, i, j + 1, k)) { if (this.m(world, i - 1, j, k) || this.m(world, i + 1, j, k) || this.m(world, i, j, k - 1) || this.m(world, i, j, k + 1) || this.m(world, i, j - 1, k) || this.m(world, i, j + 1, k)) {
// CraftBukkit start - prevent lava putting something on fire // CraftBukkit start - Prevent lava putting something on fire
if (world.getTypeId(i, j, k) != Block.FIRE.id) { if (world.getTypeId(i, j, k) != Block.FIRE.id) {
if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, x, y, z).isCancelled()) { if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, x, y, z).isCancelled()) {
continue; continue;
@ -76,7 +76,7 @@ public class BlockStationary extends BlockFluids {
i = i1 + random.nextInt(3) - 1; i = i1 + random.nextInt(3) - 1;
k = j1 + random.nextInt(3) - 1; k = j1 + random.nextInt(3) - 1;
if (world.isEmpty(i, j + 1, k) && this.m(world, i, j, k)) { if (world.isEmpty(i, j + 1, k) && this.m(world, i, j, k)) {
// CraftBukkit start - prevent lava putting something on fire // CraftBukkit start - Prevent lava putting something on fire
if (world.getTypeId(i, j + 1, k) != Block.FIRE.id) { if (world.getTypeId(i, j + 1, k) != Block.FIRE.id) {
if (CraftEventFactory.callBlockIgniteEvent(world, i, j + 1, k, x, y, z).isCancelled()) { if (CraftEventFactory.callBlockIgniteEvent(world, i, j + 1, k, x, y, z).isCancelled()) {
continue; continue;

Datei anzeigen

@ -203,7 +203,7 @@ public class BlockVine extends Block {
} }
if (l1 > 0) { if (l1 > 0) {
// CraftBukkit start - fire BlockSpreadEvent // CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j + 1, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j + 1, k);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1); CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1);
@ -227,7 +227,7 @@ public class BlockVine extends Block {
i2 = k1 + 1 & 3; i2 = k1 + 1 & 3;
j2 = k1 + 3 & 3; j2 = k1 + 3 & 3;
// CraftBukkit start - fire BlockSpreadEvent // CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]); org.bukkit.block.Block block = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]);
if ((i1 & 1 << i2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) { if ((i1 & 1 << i2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) {
@ -250,7 +250,7 @@ public class BlockVine extends Block {
if (l1 == 0) { if (l1 == 0) {
i2 = world.random.nextInt(16) & i1; i2 = world.random.nextInt(16) & i1;
if (i2 > 0) { if (i2 > 0) {
// CraftBukkit start - fire BlockSpreadEvent // CraftBukkit start - Call BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j - 1, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j - 1, k);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2); CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2);

Datei anzeigen

@ -8,10 +8,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
// CraftBukkit start import org.bukkit.Bukkit; // CraftBukkit
import org.bukkit.Bukkit;
import org.bukkit.Location;
// CraftBukkit end
public class Chunk { public class Chunk {
@ -430,7 +427,7 @@ public class Chunk {
} }
if (Block.byId[l] instanceof IContainer) { if (Block.byId[l] instanceof IContainer) {
// CraftBukkit start - don't create tile entity if placement failed // CraftBukkit start - Don't create tile entity if placement failed
if (this.getTypeId(i, j, k) != l) { if (this.getTypeId(i, j, k) != l) {
return false; return false;
} }

Datei anzeigen

@ -11,7 +11,6 @@ import java.util.Set;
import java.util.Random; import java.util.Random;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
import org.bukkit.craftbukkit.util.LongHash; import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.craftbukkit.util.LongHashSet; import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.craftbukkit.util.LongObjectHashMap; import org.bukkit.craftbukkit.util.LongObjectHashMap;
@ -80,7 +79,7 @@ public class ChunkProviderServer implements IChunkProvider {
} }
} }
// CraftBukkit start - add async variant, provide compatibility // CraftBukkit start - Add async variant, provide compatibility
public Chunk getChunkAt(int i, int j) { public Chunk getChunkAt(int i, int j) {
return getChunkAt(i, j, null); return getChunkAt(i, j, null);
} }
@ -97,7 +96,7 @@ public class ChunkProviderServer implements IChunkProvider {
// If the chunk exists but isn't loaded do it async // If the chunk exists but isn't loaded do it async
if (chunk == null && runnable != null && loader != null && loader.chunkExists(this.world, i, j)) { if (chunk == null && runnable != null && loader != null && loader.chunkExists(this.world, i, j)) {
ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable); org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable);
return null; return null;
} }
// CraftBukkit end // CraftBukkit end
@ -115,7 +114,7 @@ public class ChunkProviderServer implements IChunkProvider {
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated");
crashreportsystemdetails.a("Location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); crashreportsystemdetails.a("Location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)}));
crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j))); crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j))); // CraftBukkit - Use LongHash
crashreportsystemdetails.a("Generator", this.chunkProvider.getName()); crashreportsystemdetails.a("Generator", this.chunkProvider.getName());
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
@ -208,7 +207,7 @@ public class ChunkProviderServer implements IChunkProvider {
this.e.a(this.world, chunk); this.e.a(this.world, chunk);
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
ioexception.printStackTrace(); ioexception.printStackTrace();
// CraftBukkit start - remove extra exception // CraftBukkit start - Remove extra exception
} }
// } catch (ExceptionWorldConflict exceptionworldconflict) { // } catch (ExceptionWorldConflict exceptionworldconflict) {
// exceptionworldconflict.printStackTrace(); // exceptionworldconflict.printStackTrace();

Datei anzeigen

@ -40,7 +40,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
} }
// CraftBukkit end // CraftBukkit end
// CraftBukkit start - add async variant, provide compatibility // CraftBukkit start - Add async variant, provide compatibility
public Chunk a(World world, int i, int j) { public Chunk a(World world, int i, int j) {
Object[] data = this.loadChunk(world, i, j); Object[] data = this.loadChunk(world, i, j);
if (data != null) { if (data != null) {
@ -319,7 +319,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
chunk.a(nbttagcompound.getByteArray("Biomes")); chunk.a(nbttagcompound.getByteArray("Biomes"));
} }
// CraftBukkit start - end this method here and split off entity loading to another method // CraftBukkit start - End this method here and split off entity loading to another method
return chunk; return chunk;
} }

Datei anzeigen

@ -115,7 +115,7 @@ public class ChunkSection {
} }
public void recalcBlockCounts() { public void recalcBlockCounts() {
// CraftBukkit start - optimize for speed // CraftBukkit start - Optimize for speed
byte[] blkIds = this.blockIds; byte[] blkIds = this.blockIds;
int cntNonEmpty = 0; int cntNonEmpty = 0;
int cntTicking = 0; int cntTicking = 0;
@ -223,7 +223,7 @@ public class ChunkSection {
} }
public void a(NibbleArray nibblearray) { public void a(NibbleArray nibblearray) {
// CraftBukkit start - don't hang on to an empty nibble array // CraftBukkit start - Don't hang on to an empty nibble array
boolean empty = true; boolean empty = true;
for (int i = 0; i < nibblearray.a.length; i++) { for (int i = 0; i < nibblearray.a.length; i++) {
if (nibblearray.a[i] != 0) { if (nibblearray.a[i] != 0) {

Datei anzeigen

@ -14,7 +14,7 @@ class ConsoleLogFormatter extends Formatter {
private SimpleDateFormat b; private SimpleDateFormat b;
final ConsoleLogManager a; final ConsoleLogManager a;
// CraftBukkit start - add color stripping // CraftBukkit start - Add color stripping
private Pattern pattern = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]"); private Pattern pattern = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]");
private boolean strip = false; private boolean strip = false;
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -189,7 +189,7 @@ public abstract class Container {
} }
if (j == 1) { if (j == 1) {
// CraftBukkit start - store a reference // CraftBukkit start - Store a reference
ItemStack itemstack4 = playerinventory.getCarried(); ItemStack itemstack4 = playerinventory.getCarried();
if (itemstack4.count > 0) { if (itemstack4.count > 0) {
entityhuman.drop(itemstack4.a(1)); entityhuman.drop(itemstack4.a(1));

Datei anzeigen

@ -3,11 +3,7 @@ package net.minecraft.server;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
// CraftBukkit start import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryAnvil;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
// CraftBukkit end
public class ContainerAnvil extends Container { public class ContainerAnvil extends Container {
@ -380,7 +376,7 @@ public class ContainerAnvil extends Container {
return bukkitEntity; return bukkitEntity;
} }
CraftInventory inventory = new CraftInventoryAnvil(this.g); org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.g);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity; return bukkitEntity;
} }

Datei anzeigen

@ -1,10 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
// CraftBukkit end
public class ContainerBeacon extends Container { public class ContainerBeacon extends Container {
@ -114,7 +110,7 @@ public class ContainerBeacon extends Container {
return bukkitEntity; return bukkitEntity;
} }
CraftInventory inventory = new CraftInventoryBeacon(this.a); org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon(this.a);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity; return bukkitEntity;
} }

Datei anzeigen

@ -37,7 +37,7 @@ public class ContainerChest extends Container {
this.f = iinventory1.getSize() / 9; this.f = iinventory1.getSize() / 9;
iinventory1.startOpen(); iinventory1.startOpen();
int i = (this.f - 4) * 18; int i = (this.f - 4) * 18;
// CraftBukkit start - save player // CraftBukkit start - Save player
// TODO: Should we check to make sure it really is an InventoryPlayer? // TODO: Should we check to make sure it really is an InventoryPlayer?
this.player = (PlayerInventory)iinventory; this.player = (PlayerInventory)iinventory;
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -15,7 +15,7 @@ public class ContainerDispenser extends Container {
public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) { public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) {
this.items = tileentitydispenser; this.items = tileentitydispenser;
// CraftBukkit start - save player // CraftBukkit start - Save player
// TODO: Should we check to make sure it really is an InventoryPlayer? // TODO: Should we check to make sure it really is an InventoryPlayer?
this.player = (PlayerInventory)iinventory; this.player = (PlayerInventory)iinventory;
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -19,7 +19,7 @@ public class ContainerWorkbench extends Container {
// CraftBukkit end // CraftBukkit end
public ContainerWorkbench(PlayerInventory playerinventory, World world, int i, int j, int k) { public ContainerWorkbench(PlayerInventory playerinventory, World world, int i, int j, int k) {
// CraftBukkit start - switched order of IInventory construction and stored player // CraftBukkit start - Switched order of IInventory construction and stored player
this.resultInventory = new InventoryCraftResult(); this.resultInventory = new InventoryCraftResult();
this.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player this.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player
this.craftInventory.resultInventory = this.resultInventory; this.craftInventory.resultInventory = this.resultInventory;

Datei anzeigen

@ -271,7 +271,7 @@ public class CraftingManager {
j1 = 0; j1 = 0;
} }
// CraftBukkit start - construct a dummy repair recipe // CraftBukkit start - Construct a dummy repair recipe
ItemStack result = new ItemStack(itemstack.id, 1, j1); ItemStack result = new ItemStack(itemstack.id, 1, j1);
List<ItemStack> ingredients = new ArrayList<ItemStack>(); List<ItemStack> ingredients = new ArrayList<ItemStack>();
ingredients.add(itemstack.cloneItemStack()); ingredients.add(itemstack.cloneItemStack());

Datei anzeigen

@ -58,7 +58,7 @@ public class DedicatedServerConnectionThread extends Thread {
try { try {
Socket socket = this.d.accept(); Socket socket = this.d.accept();
// CraftBukkit start - connection throttle // CraftBukkit start - Connection throttle
InetAddress address = socket.getInetAddress(); InetAddress address = socket.getInetAddress();
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();

Datei anzeigen

@ -51,7 +51,7 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
// CraftBukkit end // CraftBukkit end
if (itembucket.a(isourceblock.k(), (double) i, (double) j, (double) k, i + enumfacing.c(), j + enumfacing.d(), k + enumfacing.e())) { if (itembucket.a(isourceblock.k(), (double) i, (double) j, (double) k, i + enumfacing.c(), j + enumfacing.d(), k + enumfacing.e())) {
// CraftBukkit start - handle stacked buckets // CraftBukkit start - Handle stacked buckets
Item item = Item.BUCKET; Item item = Item.BUCKET;
if (--itemstack.count == 0) { if (--itemstack.count == 0) {
itemstack.id = item.id; itemstack.id = item.id;

Datei anzeigen

@ -1,7 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent; import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end // CraftBukkit end
@ -44,8 +43,8 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
// CraftBukkit end // CraftBukkit end
if (world.isEmpty(i, j, k)) { if (world.isEmpty(i, j, k)) {
// CraftBukkit - ignition by dispensing flint and steel // CraftBukkit start - Ignition by dispensing flint and steel
if (!CraftEventFactory.callBlockIgniteEvent(world, i, j, k, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()).isCancelled()) { if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()).isCancelled()) {
world.setTypeIdUpdate(i, j, k, Block.FIRE.id); world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
if (itemstack.isDamaged(1, world.random)) { if (itemstack.isDamaged(1, world.random)) {
itemstack.count = 0; itemstack.count = 0;

Datei anzeigen

@ -368,7 +368,7 @@ public abstract class Entity {
protected void z() { protected void z() {
if (!this.fireProof) { if (!this.fireProof) {
// CraftBukkit start - fallen in lava TODO: this event spams! // CraftBukkit start - Fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) { if (this instanceof EntityLiving) {
Server server = this.world.getServer(); Server server = this.world.getServer();
@ -705,8 +705,8 @@ public abstract class Entity {
this.burn(1); this.burn(1);
if (!flag2) { if (!flag2) {
++this.fireTicks; ++this.fireTicks;
// CraftBukkit start - not on fire yet // CraftBukkit start - Not on fire yet
if (this.fireTicks <= 0) { // only throw events on the first combust, otherwise it spams if (this.fireTicks <= 0) { // Only throw events on the first combust, otherwise it spams
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8); EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -1087,7 +1087,7 @@ public abstract class Entity {
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.X, this.locZ})); nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.X, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero
// TODO: make sure this is the best way to address this. // TODO: make sure this is the best way to address this.
if (Float.isNaN(this.yaw)) { if (Float.isNaN(this.yaw)) {
this.yaw = 0; this.yaw = 0;
@ -1139,7 +1139,7 @@ public abstract class Entity {
this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data; this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data;
this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data; this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data;
this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data; this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
/* CraftBukkit start - moved section down /* CraftBukkit start - Moved section down
if (Math.abs(this.motX) > 10.0D) { if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D; this.motX = 0.0D;
} }
@ -1188,7 +1188,7 @@ public abstract class Entity {
} }
// CraftBukkit end // CraftBukkit end
// CraftBukkit start - exempt Vehicles from notch's sanity check // CraftBukkit start - Exempt Vehicles from notch's sanity check
if (!(this.getBukkitEntity() instanceof Vehicle)) { if (!(this.getBukkitEntity() instanceof Vehicle)) {
if (Math.abs(this.motX) > 10.0D) { if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D; this.motX = 0.0D;
@ -1204,7 +1204,7 @@ public abstract class Entity {
} }
// CraftBukkit end // CraftBukkit end
// CraftBukkit start - reset world // CraftBukkit start - Reset world
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
Server server = Bukkit.getServer(); Server server = Bukkit.getServer();
org.bukkit.World bworld = null; org.bukkit.World bworld = null;
@ -1402,7 +1402,7 @@ public abstract class Entity {
public CraftEntity getBukkitEntity() { public CraftEntity getBukkitEntity() {
if (this.bukkitEntity == null) { if (this.bukkitEntity == null) {
this.bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this); this.bukkitEntity = CraftEntity.getEntity(this.world.getServer(), this);
} }
return this.bukkitEntity; return this.bukkitEntity;
} }
@ -1607,7 +1607,7 @@ public abstract class Entity {
++this.fireTicks; ++this.fireTicks;
if (this.fireTicks == 0) { if (this.fireTicks == 0) {
// CraftBukkit start - raise a combust event when lightning strikes // CraftBukkit start - Call a combust event when lightning strikes
EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8); EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
pluginManager.callEvent(entityCombustEvent); pluginManager.callEvent(entityCombustEvent);
if (!entityCombustEvent.isCancelled()) { if (!entityCombustEvent.isCancelled()) {
@ -1755,11 +1755,11 @@ public abstract class Entity {
if (!this.world.isStatic && !this.dead) { if (!this.world.isStatic && !this.dead) {
this.world.methodProfiler.a("changeDimension"); this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer(); MinecraftServer minecraftserver = MinecraftServer.getServer();
// CraftBukkit start - move logic into new function "teleportToLocation" // CraftBukkit start - Move logic into new function "teleportToLocation"
// int j = this.dimension; // int j = this.dimension;
WorldServer exitWorld = null; WorldServer exitWorld = null;
if (this.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds if (this.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // Plugins must specify exit from custom Bukkit worlds
// only target existing worlds (compensate for allow-nether/allow-end as false) // Only target existing worlds (compensate for allow-nether/allow-end as false)
for (WorldServer world : minecraftserver.worlds) { for (WorldServer world : minecraftserver.worlds) {
if (world.dimension == i) { if (world.dimension == i) {
exitWorld = world; exitWorld = world;
@ -1771,7 +1771,7 @@ public abstract class Entity {
Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null; Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null;
boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END
TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent); EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent);
event.useTravelAgent(useTravelAgent); event.useTravelAgent(useTravelAgent);
event.getEntity().getServer().getPluginManager().callEvent(event); event.getEntity().getServer().getPluginManager().callEvent(event);
@ -1794,7 +1794,7 @@ public abstract class Entity {
this.world.kill(this); this.world.kill(this);
this.dead = false; this.dead = false;
this.world.methodProfiler.a("reposition"); this.world.methodProfiler.a("reposition");
// CraftBukkit start - ensure chunks are loaded in case TravelAgent is not used which would initially cause chunks to load during find/create // CraftBukkit start - Ensure chunks are loaded in case TravelAgent is not used which would initially cause chunks to load during find/create
// minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1); // minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1);
boolean before = worldserver1.chunkProviderServer.forceChunkLoad; boolean before = worldserver1.chunkProviderServer.forceChunkLoad;
worldserver1.chunkProviderServer.forceChunkLoad = true; worldserver1.chunkProviderServer.forceChunkLoad = true;
@ -1807,7 +1807,7 @@ public abstract class Entity {
if (entity != null) { if (entity != null) {
entity.a(this, true); entity.a(this, true);
worldserver1.addEntity(entity); worldserver1.addEntity(entity);
// CraftBukkit start - forward the CraftEntity to the new entity // CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity); this.getBukkitEntity().setHandle(entity);
entity.bukkitEntity = this.getBukkitEntity(); entity.bukkitEntity = this.getBukkitEntity();
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -231,7 +231,7 @@ public class EntityArrow extends Entity implements IProjectile {
damagesource = DamageSource.arrow(this, this.shooter); damagesource = DamageSource.arrow(this, this.shooter);
} }
// CraftBukkit start - moved damage call // CraftBukkit start - Moved damage call
if (movingobjectposition.entity.damageEntity(damagesource, i1)) { if (movingobjectposition.entity.damageEntity(damagesource, i1)) {
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 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); EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);

Datei anzeigen

@ -251,7 +251,7 @@ public class EntityBoat extends Entity {
this.motX += this.passenger.motX * this.b; this.motX += this.passenger.motX * this.b;
this.motZ += this.passenger.motZ * this.b; this.motZ += this.passenger.motZ * this.b;
} }
// CraftBukkit start - block not in vanilla // CraftBukkit start - Support unoccupied deceleration
else if (unoccupiedDeceleration >= 0) { else if (unoccupiedDeceleration >= 0) {
this.motX *= unoccupiedDeceleration; this.motX *= unoccupiedDeceleration;
this.motZ *= unoccupiedDeceleration; this.motZ *= unoccupiedDeceleration;

Datei anzeigen

@ -88,7 +88,7 @@ public class EntityChicken extends EntityAnimal {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(3) + this.random.nextInt(1 + i); int j = this.random.nextInt(3) + this.random.nextInt(1 + i);

Datei anzeigen

@ -55,7 +55,7 @@ public class EntityCow extends EntityAnimal {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(3) + this.random.nextInt(1 + i); int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
@ -79,7 +79,7 @@ public class EntityCow extends EntityAnimal {
ItemStack itemstack = entityhuman.inventory.getItemInHand(); ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) { if (itemstack != null && itemstack.id == Item.BUCKET.id) {
// CraftBukkit start - got milk? // CraftBukkit start - Got milk?
org.bukkit.Location loc = this.getBukkitEntity().getLocation(); org.bukkit.Location loc = this.getBukkitEntity().getLocation();
org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET); org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);

Datei anzeigen

@ -121,7 +121,7 @@ public class EntityCreeper extends EntityMonster {
} }
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
// CraftBukkit start - rearranged the method (super call to end, drop to dropDeathLoot) // CraftBukkit start - Rearranged the method (super call to end, drop to dropDeathLoot)
if (damagesource.getEntity() instanceof EntitySkeleton) { if (damagesource.getEntity() instanceof EntitySkeleton) {
int i = Item.RECORD_1.id + this.random.nextInt(Item.RECORD_12.id - Item.RECORD_1.id + 1); int i = Item.RECORD_1.id + this.random.nextInt(Item.RECORD_12.id - Item.RECORD_1.id + 1);
@ -133,7 +133,7 @@ public class EntityCreeper extends EntityMonster {
// CraftBukkit end // CraftBukkit end
} }
// CraftBukkit start - whole method // CraftBukkit start - Whole method
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
int j = this.getLootId(); int j = this.getLootId();

Datei anzeigen

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityEnderCrystal extends Entity { public class EntityEnderCrystal extends Entity {
public int a = 0; public int a = 0;
@ -34,7 +36,7 @@ public class EntityEnderCrystal extends Entity {
if (this.world.getTypeId(i, j, k) != Block.FIRE.id) { if (this.world.getTypeId(i, j, k) != Block.FIRE.id) {
// CraftBukkit start // CraftBukkit start
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) { if (!CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id); this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
} }
// CraftBukkit end // CraftBukkit end
@ -55,7 +57,7 @@ public class EntityEnderCrystal extends Entity {
} else { } else {
if (!this.dead && !this.world.isStatic) { if (!this.dead && !this.world.isStatic) {
// CraftBukkit start - All non-living entities need this // CraftBukkit start - All non-living entities need this
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) { if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) {
return false; return false;
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -363,7 +363,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
Entity entity = (Entity) list.get(i); Entity entity = (Entity) list.get(i);
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
// CraftBukkit start - throw damage events when the dragon attacks // CraftBukkit start - Throw damage events when the dragon attacks
// The EntityHuman case is handled in EntityHuman, so don't throw it here // The EntityHuman case is handled in EntityHuman, so don't throw it here
if (!(entity instanceof EntityHuman)) { if (!(entity instanceof EntityHuman)) {
EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_ATTACK, 10); EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_ATTACK, 10);
@ -419,7 +419,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
boolean flag = false; boolean flag = false;
boolean flag1 = false; boolean flag1 = false;
// CraftBukkit start - create a list to hold all the destroyed blocks // CraftBukkit start - Create a list to hold all the destroyed blocks
List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>(); List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld(); org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld();
// CraftBukkit end // CraftBukkit end
@ -431,7 +431,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
if (j2 != 0) { if (j2 != 0) {
if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id && this.world.getGameRules().getBoolean("mobGriefing")) { if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id && this.world.getGameRules().getBoolean("mobGriefing")) {
// CraftBukkit start - add blocks to list rather than destroying them // CraftBukkit start - Add blocks to list rather than destroying them
// flag1 = this.world.setAir(k1, l1, i2) || flag1; // flag1 = this.world.setAir(k1, l1, i2) || flag1;
flag1 = true; flag1 = true;
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2)); destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
@ -445,12 +445,12 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
} }
if (flag1) { if (flag1) {
// CraftBukkit start - set off an EntityExplodeEvent for the dragon exploding all these blocks // CraftBukkit start - Set off an EntityExplodeEvent for the dragon exploding all these blocks
org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity(); org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity();
EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F); EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
// this flag literally means 'Dragon hit something hard' (Obsidian, White Stone or Bedrock) and will cause the dragon to slow down. // This flag literally means 'Dragon hit something hard' (Obsidian, White Stone or Bedrock) and will cause the dragon to slow down.
// We should consider adding an event extension for it, or perhaps returning true if the event is cancelled. // We should consider adding an event extension for it, or perhaps returning true if the event is cancelled.
return flag; return flag;
} else { } else {

Datei anzeigen

@ -102,7 +102,7 @@ public class EntityEnderman extends EntityMonster {
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D); k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
l = this.world.getTypeId(i, j, k); l = this.world.getTypeId(i, j, k);
if (d[l]) { if (d[l]) {
// CraftBukkit start - pickup event // CraftBukkit start - Pickup event
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) { if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
this.setCarriedId(this.world.getTypeId(i, j, k)); this.setCarriedId(this.world.getTypeId(i, j, k));
this.setCarriedData(this.world.getData(i, j, k)); this.setCarriedData(this.world.getData(i, j, k));
@ -119,7 +119,7 @@ public class EntityEnderman extends EntityMonster {
int i1 = this.world.getTypeId(i, j - 1, k); int i1 = this.world.getTypeId(i, j - 1, k);
if (l == 0 && i1 > 0 && Block.byId[i1].b()) { if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
// CraftBukkit start - place event // CraftBukkit start - Place event
if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarriedId(), this.getCarriedData()).isCancelled()) { if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarriedId(), this.getCarriedData()).isCancelled()) {
this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3); this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3);
this.setCarriedId(0); this.setCarriedId(0);
@ -224,7 +224,7 @@ public class EntityEnderman extends EntityMonster {
} }
if (flag1) { if (flag1) {
// CraftBukkit start - teleport event // CraftBukkit start - Teleport event
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ)); EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ));
this.world.getServer().getPluginManager().callEvent(teleport); this.world.getServer().getPluginManager().callEvent(teleport);
if (teleport.isCancelled()) { if (teleport.isCancelled()) {
@ -285,7 +285,7 @@ public class EntityEnderman extends EntityMonster {
int j = this.getLootId(); int j = this.getLootId();
if (j > 0) { if (j > 0) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(2 + i); int count = this.random.nextInt(2 + i);

Datei anzeigen

@ -3,7 +3,7 @@ package net.minecraft.server;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
//CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
// CraftBukkit end // CraftBukkit end
@ -228,7 +228,7 @@ public class EntityFallingBlock extends Entity {
this.tileEntityData = nbttagcompound.getCompound("TileEntityData"); this.tileEntityData = nbttagcompound.getCompound("TileEntityData");
} }
// CraftBukkit start - backward compatibility, remove in 1.6 // CraftBukkit start - Backward compatibility, remove in 1.6
if (nbttagcompound.hasKey("Bukkit.tileData")) { if (nbttagcompound.hasKey("Bukkit.tileData")) {
this.tileEntityData = (NBTTagCompound) nbttagcompound.getCompound("Bukkit.tileData").clone(); this.tileEntityData = (NBTTagCompound) nbttagcompound.getCompound("Bukkit.tileData").clone();
} }

Datei anzeigen

@ -47,7 +47,7 @@ public abstract class EntityFireball extends Entity {
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
this.height = 0.0F; this.height = 0.0F;
this.motX = this.motY = this.motZ = 0.0D; this.motX = this.motY = this.motZ = 0.0D;
// CraftBukkit start - (added setDirection method) // CraftBukkit start - Added setDirection method
this.setDirection(d0, d1, d2); this.setDirection(d0, d1, d2);
} }
@ -209,7 +209,7 @@ public abstract class EntityFireball extends Entity {
this.g = nbttagcompound.getShort("zTile"); this.g = nbttagcompound.getShort("zTile");
this.h = nbttagcompound.getByte("inTile") & 255; this.h = nbttagcompound.getByte("inTile") & 255;
this.i = nbttagcompound.getByte("inGround") == 1; this.i = nbttagcompound.getByte("inGround") == 1;
// CraftBukkit - direction -> power // CraftBukkit start - direction -> power
if (nbttagcompound.hasKey("power")) { if (nbttagcompound.hasKey("power")) {
NBTTagList nbttaglist = nbttagcompound.getList("power"); NBTTagList nbttaglist = nbttagcompound.getList("power");

Datei anzeigen

@ -6,7 +6,6 @@ import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.entity.Hanging; import org.bukkit.entity.Hanging;
import org.bukkit.entity.Painting; import org.bukkit.entity.Painting;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.painting.PaintingBreakEvent; import org.bukkit.event.painting.PaintingBreakEvent;
// CraftBukkit end // CraftBukkit end
@ -216,7 +215,7 @@ public abstract class EntityHanging extends Entity {
HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT); HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
PaintingBreakEvent paintingEvent = null; PaintingBreakEvent paintingEvent = null;
if (damagesource.getEntity() != null) { if (damagesource.getEntity() != null) {
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity()); event = new org.bukkit.event.hanging.HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
if (this instanceof EntityPainting) { if (this instanceof EntityPainting) {
// Fire old painting event until it can be removed // Fire old painting event until it can be removed

Datei anzeigen

@ -914,7 +914,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(StatisticList.w, i); this.a(StatisticList.w, i);
if (l > 0 && flag2) { if (l > 0 && flag2) {
// CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4); EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4);
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
@ -1414,7 +1414,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return super.getCustomNameVisible(); return super.getCustomNameVisible();
} }
/* CraftBukkit start - we use canPickUpLoot on players, can't have this /* CraftBukkit start - We use canPickUpLoot on players, can't have this
public boolean bS() { public boolean bS() {
return false; return false;
} }

Datei anzeigen

@ -366,7 +366,7 @@ public abstract class EntityLiving extends Entity {
this.extinguish(); this.extinguish();
} else { } else {
// CraftBukkit start - only set if needed to work around a datawatcher inefficiency // CraftBukkit start - Only set if needed to work around a DataWatcher inefficiency
if (this.getAirTicks() != 300) { if (this.getAirTicks() != 300) {
this.setAirTicks(maxAirTicks); this.setAirTicks(maxAirTicks);
} }
@ -422,7 +422,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit start // CraftBukkit start
public int getExpReward() { public int getExpReward() {
int exp = this.getExpValue(this.killer); int exp = this.getExpValue(this.killer);
if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) { if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) {
return exp; return exp;
} else { } else {
@ -444,7 +444,7 @@ public abstract class EntityLiving extends Entity {
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
int i; int i;
// CraftBukkit start - update getExpReward() above if the removed if() changes! // CraftBukkit start - Update getExpReward() above if the removed if() changes!
i = this.expToDrop; i = this.expToDrop;
while (i > 0) { while (i > 0) {
int j = EntityExperienceOrb.getOrbValue(i); int j = EntityExperienceOrb.getOrbValue(i);
@ -632,7 +632,7 @@ public abstract class EntityLiving extends Entity {
this.aE += f2; this.aE += f2;
} }
// CraftBukkit start - delegate so we can handle providing a reason for health being regained // CraftBukkit start - Delegate so we can handle providing a reason for health being regained
public void heal(int i) { public void heal(int i) {
heal(i, EntityRegainHealthEvent.RegainReason.CUSTOM); heal(i, EntityRegainHealthEvent.RegainReason.CUSTOM);
} }
@ -923,14 +923,14 @@ public abstract class EntityLiving extends Entity {
this.world.broadcastEntityEffect(this, (byte) 3); this.world.broadcastEntityEffect(this, (byte) 3);
} }
// CraftBukkit start - change return type to ItemStack // CraftBukkit start - Change return type to ItemStack
protected ItemStack l(int i) { protected ItemStack l(int i) {
return null; return null;
} }
// CraftBukkit end // CraftBukkit end
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.getLootId(); int j = this.getLootId();
@ -1192,6 +1192,7 @@ public abstract class EntityLiving extends Entity {
if (nbttagcompound.hasKey("Bukkit.MaxHealth")) { if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
this.maxHealth = nbttagcompound.getInt("Bukkit.MaxHealth"); this.maxHealth = nbttagcompound.getInt("Bukkit.MaxHealth");
} }
// CraftBukkit end
if (!nbttagcompound.hasKey("Health")) { if (!nbttagcompound.hasKey("Health")) {
this.health = this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth this.health = this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
@ -1200,7 +1201,8 @@ public abstract class EntityLiving extends Entity {
this.hurtTicks = nbttagcompound.getShort("HurtTime"); this.hurtTicks = nbttagcompound.getShort("HurtTime");
this.deathTicks = nbttagcompound.getShort("DeathTime"); this.deathTicks = nbttagcompound.getShort("DeathTime");
this.attackTicks = nbttagcompound.getShort("AttackTime"); this.attackTicks = nbttagcompound.getShort("AttackTime");
// CraftBukkit start - if looting or persistence is false only use it if it was set after we started using it
// CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
boolean data = nbttagcompound.getBoolean("CanPickUpLoot"); boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
if (isLevelAtLeast(nbttagcompound, 1) || data) { if (isLevelAtLeast(nbttagcompound, 1) || data) {
this.canPickUpLoot = data; this.canPickUpLoot = data;
@ -1884,7 +1886,7 @@ public abstract class EntityLiving extends Entity {
if (this.getGoalTarget() == null) { if (this.getGoalTarget() == null) {
return 3; return 3;
} else { } else {
int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // this.getMaxHealth() -> this.maxHealth int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // CraftBukkit - this.getMaxHealth() -> this.maxHealth
i -= (3 - this.world.difficulty) * 4; i -= (3 - this.world.difficulty) * 4;
if (i < 0) { if (i < 0) {

Datei anzeigen

@ -34,7 +34,7 @@ public class EntityMagmaCube extends EntitySlime {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.getLootId(); int j = this.getLootId();

Datei anzeigen

@ -4,13 +4,11 @@ import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
// CraftBukkit end // CraftBukkit end
public abstract class EntityMinecartAbstract extends Entity { public abstract class EntityMinecartAbstract extends Entity {
@ -864,7 +862,7 @@ public abstract class EntityMinecartAbstract extends Entity {
return this.c; return this.c;
} }
// CraftBukkit start - methods for getting and setting flying and derailed velocity modifiers // CraftBukkit start - Methods for getting and setting flying and derailed velocity modifiers
public Vector getFlyingVelocityMod() { public Vector getFlyingVelocityMod() {
return new Vector(flyingX, flyingY, flyingZ); return new Vector(flyingX, flyingY, flyingZ);
} }

Datei anzeigen

@ -149,6 +149,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
} }
public void c(int i) { public void c(int i) {
// CraftBukkit start
for (HumanEntity human : transaction) {
((org.bukkit.craftbukkit.entity.CraftHumanEntity) human).getHandle().closeInventory();
}
// CraftBukkit end
this.b = false; this.b = false;
super.c(i); super.c(i);
} }

Datei anzeigen

@ -41,7 +41,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
if (this.passenger != entity && this.vehicle != entity) { if (this.passenger != entity && this.vehicle != entity) {
if (entity != this) { if (entity != this) {
// CraftBukkit start - we still need to call events for entities without goals // CraftBukkit start - We still need to call events for entities without goals
if (entity != this.target && (this instanceof EntityBlaze || this instanceof EntityEnderman || this instanceof EntitySpider || this instanceof EntityGiantZombie || this instanceof EntitySilverfish)) { if (entity != this.target && (this instanceof EntityBlaze || this instanceof EntityEnderman || this instanceof EntitySpider || this instanceof EntityGiantZombie || this instanceof EntitySilverfish)) {
EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this, entity, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY); EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this, entity, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);

Datei anzeigen

@ -146,10 +146,11 @@ public class EntityPigZombie extends EntityZombie {
return false; return false;
} }
// CraftBukkit start - return rare dropped item instead of dropping it // CraftBukkit start - Return rare dropped item instead of dropping it
protected ItemStack l(int i) { protected ItemStack l(int i) {
return new ItemStack(Item.GOLD_INGOT.id, 1, 0); return new ItemStack(Item.GOLD_INGOT.id, 1, 0);
} }
// CraftBukkit end
protected int getLootId() { protected int getLootId() {
return Item.ROTTEN_FLESH.id; return Item.ROTTEN_FLESH.id;

Datei anzeigen

@ -102,7 +102,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
} }
// CraftBukkit start - world fallback code, either respawn location or global spawn // CraftBukkit start - World fallback code, either respawn location or global spawn
public void spawnIn(World world) { public void spawnIn(World world) {
super.spawnIn(world); super.spawnIn(world);
if (world == null) { if (world == null) {
@ -366,7 +366,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} else { } else {
if (this.dimension == 1 && i == 0) { if (this.dimension == 1 && i == 0) {
this.a((Statistic) AchievementList.B); this.a((Statistic) AchievementList.B);
// CraftBukkit start - rely on custom portal management // CraftBukkit start - Rely on custom portal management
/* /*
ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn(); ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();
@ -461,7 +461,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void startCrafting(int i, int j, int k) { public void startCrafting(int i, int j, int k) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -474,7 +474,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void startEnchanting(int i, int j, int k, String s) { public void startEnchanting(int i, int j, int k, String s) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -487,7 +487,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openAnvil(int i, int j, int k) { public void openAnvil(int i, int j, int k) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -504,7 +504,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.closeInventory(); this.closeInventory();
} }
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -517,7 +517,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openHopper(TileEntityHopper tileentityhopper) { public void openHopper(TileEntityHopper tileentityhopper) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -530,7 +530,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) { public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -543,7 +543,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openFurnace(TileEntityFurnace tileentityfurnace) { public void openFurnace(TileEntityFurnace tileentityfurnace) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -556,7 +556,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openDispenser(TileEntityDispenser tileentitydispenser) { public void openDispenser(TileEntityDispenser tileentitydispenser) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -569,7 +569,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) { public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -582,7 +582,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openBeacon(TileEntityBeacon tileentitybeacon) { public void openBeacon(TileEntityBeacon tileentitybeacon) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -595,7 +595,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void openTrade(IMerchant imerchant, String s) { public void openTrade(IMerchant imerchant, String s) {
// CraftBukkit start - inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
@ -638,7 +638,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Container container, List list) { public void a(Container container, List list) {
this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list)); this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list));
this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried())); this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
// CraftBukkit start - send a Set Slot to update the crafting result slot // 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())) { if (java.util.EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) {
this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem())); this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem()));
} }
@ -835,7 +835,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public WeatherType getPlayerWeather() { public WeatherType getPlayerWeather() {
return this.weather; return this.weather;
} }
public void setPlayerWeather(WeatherType type, boolean plugin) { public void setPlayerWeather(WeatherType type, boolean plugin) {
if (!plugin && this.weather != null) { if (!plugin && this.weather != null) {
return; return;
@ -847,7 +847,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0)); this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0));
} }
public void resetPlayerWeather() { public void resetPlayerWeather() {
this.weather = null; this.weather = null;
this.setPlayerWeather(this.o().getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false); this.setPlayerWeather(this.o().getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);

Datei anzeigen

@ -107,7 +107,7 @@ public class EntityPotion extends EntityProjectile {
MobEffect mobeffect = (MobEffect) iterator1.next(); MobEffect mobeffect = (MobEffect) iterator1.next();
int i = mobeffect.getEffectId(); int i = mobeffect.getEffectId();
// CraftBukkit start - abide by PVP settings - for players only! // CraftBukkit start - Abide by PVP settings - for players only!
if (!this.world.pvpMode && this.getShooter() instanceof EntityPlayer && entityliving instanceof EntityPlayer && entityliving != this.getShooter()) { if (!this.world.pvpMode && this.getShooter() instanceof EntityPlayer && entityliving instanceof EntityPlayer && entityliving != this.getShooter()) {
// Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions // Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions
if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) continue; if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) continue;
@ -115,7 +115,7 @@ public class EntityPotion extends EntityProjectile {
// CraftBukkit end // CraftBukkit end
if (MobEffectList.byId[i].isInstant()) { if (MobEffectList.byId[i].isInstant()) {
// CraftBukkit - added 'this' // CraftBukkit - Added 'this'
MobEffectList.byId[i].applyInstantEffect(this.getShooter(), entityliving, mobeffect.getAmplifier(), d1, this); MobEffectList.byId[i].applyInstantEffect(this.getShooter(), entityliving, mobeffect.getAmplifier(), d1, this);
} else { } else {
int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D); int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);

Datei anzeigen

@ -62,7 +62,7 @@ public class EntitySheep extends EntityAnimal {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
if (!this.isSheared()) { if (!this.isSheared()) {

Datei anzeigen

@ -144,7 +144,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
if (this.getSkeletonType() == 1) { if (this.getSkeletonType() == 1) {

Datei anzeigen

@ -1,9 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityCombustByEntityEvent;
// CraftBukkit end
public class EntitySmallFireball extends EntityFireball { public class EntitySmallFireball extends EntityFireball {
@ -26,7 +23,7 @@ public class EntitySmallFireball extends EntityFireball {
if (!this.world.isStatic) { if (!this.world.isStatic) {
if (movingobjectposition.entity != null) { if (movingobjectposition.entity != null) {
if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5)) { if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5)) {
// CraftBukkit start - entity damage by entity event + combust event // CraftBukkit start - Entity damage by entity event + combust event
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5); EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event); movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);
@ -67,7 +64,7 @@ public class EntitySmallFireball extends EntityFireball {
if (this.world.isEmpty(i, j, k)) { if (this.world.isEmpty(i, j, k)) {
// CraftBukkit start // CraftBukkit start
if (!CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) { if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id); this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -98,7 +98,7 @@ public class EntitySpider extends EntityMonster {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method; adapted from super.dropDeathLoot. // CraftBukkit start - Whole method; adapted from super.dropDeathLoot.
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int k = this.random.nextInt(3); int k = this.random.nextInt(3);

Datei anzeigen

@ -51,7 +51,7 @@ public class EntitySquid extends EntityWaterAnimal {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(3 + i) + 1; int count = this.random.nextInt(3 + i) + 1;

Datei anzeigen

@ -73,13 +73,13 @@ public class EntityTrackerEntry {
this.broadcast(new Packet39AttachEntity(this.tracker, this.tracker.vehicle)); this.broadcast(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
} }
if (this.tracker instanceof EntityItemFrame && this.m % 10 == 0) { if (this.tracker instanceof EntityItemFrame /*&& this.m % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block
EntityItemFrame i4 = (EntityItemFrame) this.tracker; EntityItemFrame i4 = (EntityItemFrame) this.tracker;
ItemStack i5 = i4.i(); ItemStack i5 = i4.i();
if (i5 != null && i5.getItem() instanceof ItemWorldMap) { if (this.m % 10 == 0 && i5 != null && i5.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks
WorldMap i7 = Item.MAP.getSavedMap(i5, this.tracker.world); WorldMap i7 = Item.MAP.getSavedMap(i5, this.tracker.world);
Iterator j0 = list.iterator(); Iterator j0 = this.trackedPlayers.iterator(); // CraftBukkit
while (j0.hasNext()) { while (j0.hasNext()) {
EntityHuman j1 = (EntityHuman) j0.next(); EntityHuman j1 = (EntityHuman) j0.next();
@ -119,7 +119,7 @@ public class EntityTrackerEntry {
boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0; boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0;
boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4; boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4;
// CraftBukkit start - code moved from below // CraftBukkit start - Code moved from below
if (flag) { if (flag) {
this.xLoc = i; this.xLoc = i;
this.yLoc = j; this.yLoc = j;
@ -143,7 +143,7 @@ public class EntityTrackerEntry {
} }
} else { } else {
this.u = 0; this.u = 0;
// CraftBukkit start - refresh list of who can see a player before sending teleport packet // CraftBukkit start - Refresh list of who can see a player before sending teleport packet
if (this.tracker instanceof EntityPlayer) { if (this.tracker instanceof EntityPlayer) {
this.scanPlayers(new java.util.ArrayList(this.trackedPlayers)); this.scanPlayers(new java.util.ArrayList(this.trackedPlayers));
} }
@ -177,7 +177,7 @@ public class EntityTrackerEntry {
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher1, false)); this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher1, false));
} }
/* CraftBukkit start - code moved up /* CraftBukkit start - Code moved up
if (flag) { if (flag) {
this.xLoc = i; this.xLoc = i;
this.yLoc = j; this.yLoc = j;
@ -225,7 +225,7 @@ public class EntityTrackerEntry {
++this.m; ++this.m;
if (this.tracker.velocityChanged) { if (this.tracker.velocityChanged) {
// CraftBukkit start - create PlayerVelocity event // CraftBukkit start - Create PlayerVelocity event
boolean cancelled = false; boolean cancelled = false;
if (this.tracker instanceof EntityPlayer) { if (this.tracker instanceof EntityPlayer) {
@ -375,7 +375,7 @@ public class EntityTrackerEntry {
private Packet b() { private Packet b() {
if (this.tracker.dead) { if (this.tracker.dead) {
// CraftBukkit start - remove useless error spam, just return // CraftBukkit start - Remove useless error spam, just return
// this.tracker.world.getLogger().warning("Fetching addPacket for removed entity"); // this.tracker.world.getLogger().warning("Fetching addPacket for removed entity");
return null; return null;
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -3,7 +3,7 @@ package net.minecraft.server;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
// CraftBukkit end // CraftBukkit end
@ -183,7 +183,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.t(i); this.t(i);
if (this.ticksLived % 10 == 0) { if (this.ticksLived % 10 == 0) {
this.heal(10, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit this.heal(10, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
} }
} else { } else {
super.bo(); super.bo();
@ -268,7 +268,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (i3 > 0 && i3 != Block.BEDROCK.id && i3 != Block.ENDER_PORTAL.id && i3 != Block.ENDER_PORTAL_FRAME.id) { if (i3 > 0 && i3 != Block.BEDROCK.id && i3 != Block.ENDER_PORTAL.id && i3 != Block.ENDER_PORTAL_FRAME.id) {
// CraftBukkit start // CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, 0, 0).isCancelled()) { if (CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, 0, 0).isCancelled()) {
continue; continue;
} }
// CraftBukkit end // CraftBukkit end
@ -408,7 +408,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit start // CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
loot.add(new org.bukkit.inventory.ItemStack(Item.NETHER_STAR.id, 1)); loot.add(new org.bukkit.inventory.ItemStack(Item.NETHER_STAR.id, 1));
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot); CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end // CraftBukkit end
} }

Datei anzeigen

@ -1,9 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
// CraftBukkit end
public class EntityWitherSkull extends EntityFireball { public class EntityWitherSkull extends EntityFireball {
@ -40,7 +37,7 @@ public class EntityWitherSkull extends EntityFireball {
if (movingobjectposition.entity != null) { if (movingobjectposition.entity != null) {
if (this.shooter != null) { if (this.shooter != null) {
if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8) && !movingobjectposition.entity.isAlive()) { if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8) && !movingobjectposition.entity.isAlive()) {
this.shooter.heal(5, EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit this.shooter.heal(5, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
} }
} else { } else {
movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5); movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5);

Datei anzeigen

@ -171,7 +171,7 @@ public class EntityZombie extends EntityMonster {
return EnumMonsterType.UNDEAD; return EnumMonsterType.UNDEAD;
} }
// CraftBukkit start - return rare dropped item instead of dropping it // CraftBukkit start - Return rare dropped item instead of dropping it
protected ItemStack l(int i) { protected ItemStack l(int i) {
switch (this.random.nextInt(3)) { switch (this.random.nextInt(3)) {
case 0: case 0:

Datei anzeigen

@ -131,7 +131,7 @@ public class Explosion {
double d9 = (double) this.world.a(vec3d, entity.boundingBox); double d9 = (double) this.world.a(vec3d, entity.boundingBox);
double d10 = (1.0D - d7) * d9; double d10 = (1.0D - d7) * d9;
// CraftBukkit start - explosion damage hook // CraftBukkit start - Explosion damage hook
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D); int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D);
@ -290,10 +290,11 @@ public class Explosion {
int i1 = this.world.getTypeId(i, j - 1, k); int i1 = this.world.getTypeId(i, j - 1, k);
if (l == 0 && Block.s[i1] && this.j.nextInt(3) == 0) { if (l == 0 && Block.s[i1] && this.j.nextInt(3) == 0) {
// CraftBukkit start - ignition by explosion. // CraftBukkit start - Ignition by explosion
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) { if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id); this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
} // CraftBukkit end }
// CraftBukkit end
} }
} }
} }

Datei anzeigen

@ -4,7 +4,7 @@ import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit
public class FoodMetaData { public class FoodMetaData {
// CraftBukkit start - all made public // CraftBukkit start - All made public
public int foodLevel = 20; public int foodLevel = 20;
public float saturationLevel = 5.0F; public float saturationLevel = 5.0F;
public float exhaustionLevel; public float exhaustionLevel;

Datei anzeigen

@ -56,7 +56,7 @@ public class ItemBlock extends Item {
int j1 = this.filterData(itemstack.getData()); int j1 = this.filterData(itemstack.getData());
int k1 = Block.byId[this.id].getPlacedData(world, i, j, k, l, f, f1, f2, j1); int k1 = Block.byId[this.id].getPlacedData(world, i, j, k, l, f, f1, f2, j1);
// CraftBukkit start - redirect to common function handler // CraftBukkit start - Redirect to common function handler
/* /*
if (world.setTypeIdAndData(i, j, k, this.id, k1, 3)) { if (world.setTypeIdAndData(i, j, k, this.id, k1, 3)) {
if (world.getTypeId(i, j, k) == this.id) { if (world.getTypeId(i, j, k) == this.id) {
@ -75,7 +75,7 @@ public class ItemBlock extends Item {
} }
} }
// CraftBukkit start - add method to process block placement // CraftBukkit start - Add method to process block placement
static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data, final int clickedX, final int clickedY, final int clickedZ) { static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data, final int clickedX, final int clickedY, final int clickedZ) {
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z); org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);

Datei anzeigen

@ -189,7 +189,7 @@ public class ItemDye extends Item {
} else { } else {
if (!world.isStatic) { if (!world.isStatic) {
if ((double) world.random.nextFloat() < 0.4D) { if ((double) world.random.nextFloat() < 0.4D) {
// CraftBukkit start - validate // CraftBukkit start - Validate
Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null; Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
((BlockMushroom) Block.byId[l]).grow(world, i, j, k, world.random, true, player, itemstack); ((BlockMushroom) Block.byId[l]).grow(world, i, j, k, world.random, true, player, itemstack);
} }

Datei anzeigen

@ -1,9 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.entity.Fish;
// CraftBukkit end
public class ItemFishingRod extends Item { public class ItemFishingRod extends Item {
@ -23,7 +20,7 @@ public class ItemFishingRod extends Item {
} else { } else {
// CraftBukkit start // CraftBukkit start
EntityFishingHook hook = new EntityFishingHook(world, entityhuman); EntityFishingHook hook = new EntityFishingHook(world, entityhuman);
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING); PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING);
world.getServer().getPluginManager().callEvent(playerFishEvent); world.getServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) { if (playerFishEvent.isCancelled()) {

Datei anzeigen

@ -1,6 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit // CraftBukkit start
import org.bukkit.craftbukkit.block.CraftBlockState;
import org.bukkit.craftbukkit.event.CraftEventFactory;
// CraftBukkit end
public class ItemFlintAndSteel extends Item { public class ItemFlintAndSteel extends Item {
@ -44,8 +47,8 @@ public class ItemFlintAndSteel extends Item {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
if (i1 == 0) { if (i1 == 0) {
// CraftBukkit start - store the clicked block // CraftBukkit start - Store the clicked block
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) { if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
itemstack.damage(1, entityhuman); itemstack.damage(1, entityhuman);
return false; return false;
} }
@ -57,7 +60,7 @@ public class ItemFlintAndSteel extends Item {
world.setTypeIdUpdate(i, j, k, Block.FIRE.id); world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
// CraftBukkit start // CraftBukkit start
org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ); org.bukkit.event.block.BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ);
if (placeEvent.isCancelled() || !placeEvent.canBuild()) { if (placeEvent.isCancelled() || !placeEvent.canBuild()) {
placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false); placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);

Datei anzeigen

@ -50,7 +50,7 @@ public class ItemReed extends Item {
Block block = Block.byId[this.id]; Block block = Block.byId[this.id];
int j1 = block.getPlacedData(world, i, j, k, l, f, f1, f2, 0); int j1 = block.getPlacedData(world, i, j, k, l, f, f1, f2, 0);
// CraftBukkit start - redirect to common handler // CraftBukkit start - Redirect to common handler
ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, j1, clickedX, clickedY, clickedZ); ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, j1, clickedX, clickedY, clickedZ);
/* /*
if (world.setTypeIdAndData(i, j, k, this.id, j1, 3)) { if (world.setTypeIdAndData(i, j, k, this.id, j1, 3)) {

Datei anzeigen

@ -20,7 +20,7 @@ public class ItemSeeds extends Item {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
if (i1 == this.b && world.isEmpty(i, j + 1, k)) { if (i1 == this.b && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start - seeds // CraftBukkit start - Seeds
// world.setTypeIdUpdate(i, j + 1, k, this.id); // world.setTypeIdUpdate(i, j + 1, k, this.id);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.id, 0, clickedX, clickedY, clickedZ)) { if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.id, 0, clickedX, clickedY, clickedZ)) {
return false; return false;

Datei anzeigen

@ -44,7 +44,7 @@ public class ItemSkull extends Item {
} else if (!Block.SKULL.canPlace(world, i, j, k)) { } else if (!Block.SKULL.canPlace(world, i, j, k)) {
return false; return false;
} else { } else {
// CraftBukkit start - handle in ItemBlock // CraftBukkit start - Handle in ItemBlock
// world.setTypeIdAndData(i, j, k, Block.SKULL.id, l, 2); // world.setTypeIdAndData(i, j, k, Block.SKULL.id, l, 2);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Block.SKULL.id, l, clickedX, clickedY, clickedZ)) { if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Block.SKULL.id, l, clickedX, clickedY, clickedZ)) {
return false; return false;

Datei anzeigen

@ -20,7 +20,7 @@ public class ItemSnow extends ItemBlockWithAuxData {
int j1 = world.getData(i, j, k); int j1 = world.getData(i, j, k);
int k1 = j1 & 7; int k1 = j1 & 7;
// CraftBukkit start - redirect to common handler // CraftBukkit start - Redirect to common handler
if (k1 <= 6 && world.b(block.b(world, i, j, k)) && ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, Block.SNOW.id, k1 + 1 | j1 & -8, clickedX, clickedY, clickedZ)) { if (k1 <= 6 && world.b(block.b(world, i, j, k)) && ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, Block.SNOW.id, k1 + 1 | j1 & -8, clickedX, clickedY, clickedZ)) {
return true; return true;
} }

Datei anzeigen

@ -40,7 +40,7 @@ public final class ItemStack {
this.f = null; this.f = null;
this.id = i; this.id = i;
this.count = j; this.count = j;
// CraftBukkit start - pass to setData to do filtering // CraftBukkit start - Pass to setData to do filtering
this.setData(k); this.setData(k);
//if (this.damage < 0) { //if (this.damage < 0) {
// this.damage = 0; // this.damage = 0;
@ -151,7 +151,7 @@ public final class ItemStack {
} }
public void setData(int i) { public void setData(int i) {
// CraftBukkit start - filter out data for items that shouldn't have it // CraftBukkit start - Filter out data for items that shouldn't have it
// The crafting system uses this value for a special purpose so we have to allow it // The crafting system uses this value for a special purpose so we have to allow it
if (i == 32767) { if (i == 32767) {
this.damage = i; this.damage = i;

Datei anzeigen

@ -27,7 +27,7 @@ public class ItemWaterLily extends ItemWithAuxData {
} }
if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) { if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start - waterlily // CraftBukkit start
// world.setTypeIdUpdate(i, j + 1, k, Block.WATER_LILY.id); // world.setTypeIdUpdate(i, j + 1, k, Block.WATER_LILY.id);
if (!processBlockPlace(world, entityhuman, null, i, j + 1, k, Block.WATER_LILY.id, 0, clickedX, clickedY, clickedZ)) { if (!processBlockPlace(world, entityhuman, null, i, j + 1, k, Block.WATER_LILY.id, 0, clickedX, clickedY, clickedZ)) {
return itemstack; return itemstack;

Datei anzeigen

@ -7,7 +7,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
// CraftBukkit start - strip down to empty // CraftBukkit start - Strip down to empty methods, performance cost
public class MethodProfiler { public class MethodProfiler {
public boolean a = false; public boolean a = false;

Datei anzeigen

@ -13,10 +13,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
// CraftBukkit start // CraftBukkit start
import java.util.concurrent.ExecutionException;
import java.io.IOException; import java.io.IOException;
import com.google.common.io.Files;
import jline.console.ConsoleReader; import jline.console.ConsoleReader;
import joptsimple.OptionSet; import joptsimple.OptionSet;
@ -106,7 +104,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
org.bukkit.craftbukkit.Main.useJline = false; org.bukkit.craftbukkit.Main.useJline = false;
this.reader = new ConsoleReader(System.in, System.out); this.reader = new ConsoleReader(System.in, System.out);
this.reader.setExpandEvents(false); this.reader.setExpandEvents(false);
} catch (java.io.IOException ex) { } catch (IOException ex) {
Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex);
} }
} }
@ -140,10 +138,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.b(s); this.b(s);
this.c("menu.loadingLevel"); this.c("menu.loadingLevel");
this.worldServer = new WorldServer[3]; this.worldServer = new WorldServer[3];
// CraftBukkit - removed ticktime arrays // CraftBukkit - Removed ticktime arrays
IDataManager idatamanager = this.convertable.a(s, true); IDataManager idatamanager = this.convertable.a(s, true);
WorldData worlddata = idatamanager.getWorldData(); WorldData worlddata = idatamanager.getWorldData();
// CraftBukkit start - removed worldsettings // CraftBukkit start - Removed worldsettings
int worldCount = 3; int worldCount = 3;
for (int j = 0; j < worldCount; ++j) { for (int j = 0; j < worldCount; ++j) {
@ -202,7 +200,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
log.info("Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld); log.info("Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld);
// Migrate world data too. // Migrate world data too.
try { try {
Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat")); com.google.common.io.Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat"));
} catch (IOException exception) { } catch (IOException exception) {
log.severe("Unable to migrate world data."); log.severe("Unable to migrate world data.");
} }
@ -347,7 +345,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.getLogger().info("Saving worlds"); this.getLogger().info("Saving worlds");
this.saveChunks(false); this.saveChunks(false);
/* CraftBukkit start - handled in saveChunks /* CraftBukkit start - Handled in saveChunks
for (int i = 0; i < this.worldServer.length; ++i) { for (int i = 0; i < this.worldServer.length; ++i) {
WorldServer worldserver = this.worldServer[i]; WorldServer worldserver = this.worldServer[i];
@ -442,7 +440,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
throwable1.printStackTrace(); throwable1.printStackTrace();
} finally { } finally {
// CraftBukkit start - restore terminal to original settings // CraftBukkit start - Restore terminal to original settings
try { try {
this.reader.getTerminal().restore(); this.reader.getTerminal().restore();
} catch (Exception e) { } catch (Exception e) {
@ -508,7 +506,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public void r() { public void r() {
this.methodProfiler.a("levels"); this.methodProfiler.a("levels");
// CraftBukkit start - only send timeupdates to the people in that world // CraftBukkit start
this.server.getScheduler().mainThreadHeartbeat(this.ticks); this.server.getScheduler().mainThreadHeartbeat(this.ticks);
// Run tasks that are waiting on processing // Run tasks that are waiting on processing
@ -518,7 +516,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.tick(); org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.tick();
// Send timeupdates to everyone, it will get the right time from the world the player is in. // Send time updates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) { if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i); EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
@ -602,7 +600,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
IConsoleLogManager iconsolelogmanager = null; IConsoleLogManager iconsolelogmanager = null;
try { try {
/* CraftBukkit start - replace everything /* CraftBukkit start - Replace everything
boolean flag = false; boolean flag = false;
String s = null; String s = null;
String s1 = "."; String s1 = ".";
@ -762,7 +760,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
} }
public String getPlugins() { public String getPlugins() {
// CraftBukkit start - whole method // CraftBukkit start - Whole method
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins(); org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins();
@ -806,7 +804,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
processQueue.add(waitable); processQueue.add(waitable);
try { try {
return waitable.get(); return waitable.get();
} catch (ExecutionException e) { } catch (java.util.concurrent.ExecutionException e) {
throw new RuntimeException("Exception processing rcon command " + s, e.getCause()); throw new RuntimeException("Exception processing rcon command " + s, e.getCause());
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); // Maintain interrupted state Thread.currentThread().interrupt(); // Maintain interrupted state

Datei anzeigen

@ -114,7 +114,7 @@ public class MobEffectList {
} }
public void applyInstantEffect(EntityLiving entityliving, EntityLiving entityliving1, int i, double d0) { public void applyInstantEffect(EntityLiving entityliving, EntityLiving entityliving1, int i, double d0) {
// CraftBukkit start - delegate; we need EntityPotion // CraftBukkit start - Delegate; we need EntityPotion
applyInstantEffect(entityliving, entityliving1, i, d0, null); applyInstantEffect(entityliving, entityliving1, i, d0, null);
} }

Datei anzeigen

@ -23,7 +23,7 @@ public abstract class Packet {
public static long q; public static long q;
public static long r; public static long r;
public boolean lowPriority = false; public boolean lowPriority = false;
// CraftBukkit start - calculate packet ID once - used a bunch of times // CraftBukkit start - Calculate packet ID once - used a bunch of times
private int packetID; private int packetID;
public Packet() { public Packet() {

Datei anzeigen

@ -24,7 +24,7 @@ public class Packet20NamedEntitySpawn extends Packet {
public Packet20NamedEntitySpawn(EntityHuman entityhuman) { public Packet20NamedEntitySpawn(EntityHuman entityhuman) {
this.a = entityhuman.id; this.a = entityhuman.id;
// CraftBukkit start - limit name length to 16 characters // CraftBukkit start - Limit name length to 16 characters
if (entityhuman.name.length() > 16) { if (entityhuman.name.length() > 16) {
this.b = entityhuman.name.substring(0, 16); this.b = entityhuman.name.substring(0, 16);
} else { } else {

Datei anzeigen

@ -22,7 +22,7 @@ public class Packet3Chat extends Packet {
public Packet3Chat(String s, boolean flag) { public Packet3Chat(String s, boolean flag) {
this.c = true; this.c = true;
/* CraftBukkit start - handle this later /* CraftBukkit start - Handle this later
if (s.length() > b) { if (s.length() > b) {
s = s.substring(0, b); s = s.substring(0, b);
} }

Datei anzeigen

@ -62,7 +62,7 @@ public class Packet56MapChunkBulk extends Packet {
this.inflatedBuffers[k] = chunkmap.a; this.inflatedBuffers[k] = chunkmap.a;
} }
/* CraftBukkit start - moved to compress() /* CraftBukkit start - Moved to compress()
Deflater deflater = new Deflater(-1); Deflater deflater = new Deflater(-1);
try { try {

Datei anzeigen

@ -1,6 +1,9 @@
package net.minecraft.server; package net.minecraft.server;
import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit // CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.EntityTargetEvent;
// CraftBukkit end
public abstract class PathfinderGoalTarget extends PathfinderGoal { public abstract class PathfinderGoalTarget extends PathfinderGoal {
@ -99,7 +102,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
} }
} }
// CraftBukkit start - check all the different target goals for the reason, default to RANDOM_TARGET // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET
EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET; EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET;
if (this instanceof PathfinderGoalDefendVillage) { if (this instanceof PathfinderGoalDefendVillage) {
@ -121,10 +124,10 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
this.d.setGoalTarget(null); this.d.setGoalTarget(null);
return false; return false;
} else if (entityliving.getBukkitEntity() != event.getTarget()) { } else if (entityliving.getBukkitEntity() != event.getTarget()) {
this.d.setGoalTarget((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle()); this.d.setGoalTarget((EntityLiving) ((CraftEntity) event.getTarget()).getHandle());
} }
if (this.d instanceof EntityCreature) { if (this.d instanceof EntityCreature) {
((EntityCreature) this.d).target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); ((EntityCreature) this.d).target = ((CraftEntity) event.getTarget()).getHandle();
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -147,7 +147,7 @@ public class PendingConnection extends Connection {
org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.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) { if (packet254getinfo.a == 1) {
// CraftBukkit start - fix decompile issues, don't create a list from an array // CraftBukkit start - Fix decompile issues, don't create a list from an array
Object[] list = new Object[] { 1, 60, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() }; Object[] list = new Object[] { 1, 60, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() };
for (Object object : list) { for (Object object : list) {

Datei anzeigen

@ -26,6 +26,7 @@ class PlayerChunk {
PlayerChunk.this.loaded = true; PlayerChunk.this.loaded = true;
} }
}); });
// CraftBukkit end
} }
public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument

Datei anzeigen

@ -6,7 +6,6 @@ import java.util.List;
// CraftBukkit start // CraftBukkit start
import java.util.Collections; import java.util.Collections;
import java.util.Queue; import java.util.Queue;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
// CraftBukkit end // CraftBukkit end
@ -36,8 +35,8 @@ public class PlayerChunkMap {
} }
public void flush() { public void flush() {
// CraftBukkit start - use iterator // CraftBukkit start - Use iterator
Iterator iterator = this.d.iterator(); java.util.Iterator iterator = this.d.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
PlayerChunk playerinstance = (PlayerChunk) iterator.next(); PlayerChunk playerinstance = (PlayerChunk) iterator.next();
@ -46,9 +45,9 @@ public class PlayerChunkMap {
} }
// CraftBukkit end // CraftBukkit end
// this.d.clear(); // CraftBukkit - removals are already covered // this.d.clear(); // CraftBukkit - Removals are already covered
if (this.managedPlayers.isEmpty()) { if (this.managedPlayers.isEmpty()) {
if (!wasNotEmpty) return; // CraftBukkit - only do unload when we go from non-empty to empty if (!wasNotEmpty) return; // CraftBukkit - Only do unload when we go from non-empty to empty
WorldProvider worldprovider = this.world.worldProvider; WorldProvider worldprovider = this.world.worldProvider;
if (!worldprovider.e()) { if (!worldprovider.e()) {
@ -100,7 +99,7 @@ public class PlayerChunkMap {
entityplayer.d = entityplayer.locX; entityplayer.d = entityplayer.locX;
entityplayer.e = entityplayer.locZ; entityplayer.e = entityplayer.locZ;
// CraftBukkit start - load nearby chunks first // CraftBukkit start - Load nearby chunks first
List<ChunkCoordIntPair> chunkList = new LinkedList<ChunkCoordIntPair>(); List<ChunkCoordIntPair> chunkList = new LinkedList<ChunkCoordIntPair>();
for (int k = i - this.e; k <= i + this.e; ++k) { for (int k = i - this.e; k <= i + this.e; ++k) {
for (int l = j - this.e; l <= j + this.e; ++l) { for (int l = j - this.e; l <= j + this.e; ++l) {
@ -258,7 +257,7 @@ public class PlayerChunkMap {
return playermanager.d; return playermanager.d;
} }
// CraftBukkit start - sorter to load nearby chunks first // CraftBukkit start - Sorter to load nearby chunks first
private static class ChunkCoordComparator implements java.util.Comparator<ChunkCoordIntPair> { private static class ChunkCoordComparator implements java.util.Comparator<ChunkCoordIntPair> {
private int x; private int x;
private int z; private int z;

Datei anzeigen

@ -12,22 +12,23 @@ import java.util.concurrent.Callable;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.logging.Level;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.craftbukkit.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.LazyPlayerSet; import org.bukkit.craftbukkit.util.LazyPlayerSet;
import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerAnimationEvent; import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
@ -37,13 +38,9 @@ import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.event.inventory.*;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
// CraftBukkit end // CraftBukkit end
@ -688,10 +685,10 @@ public class PlayerConnection extends Connection {
} }
public void a(String s, Object[] aobject) { public void a(String s, Object[] aobject) {
if (this.disconnected) return; // CraftBukkit - rarely it would send a disconnect line twice if (this.disconnected) return; // CraftBukkit - Rarely it would send a disconnect line twice
this.minecraftServer.getLogger().info(this.player.name + " lost connection: " + s); this.minecraftServer.getLogger().info(this.player.name + " lost connection: " + s);
// CraftBukkit start - we need to handle custom quit messages // CraftBukkit start - We need to handle custom quit messages
String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player);
if ((quitMessage != null) && (quitMessage.length() > 0)) { if ((quitMessage != null) && (quitMessage.length() > 0)) {
this.minecraftServer.getPlayerList().sendAll(new Packet3Chat(quitMessage)); this.minecraftServer.getPlayerList().sendAll(new Packet3Chat(quitMessage));
@ -845,7 +842,6 @@ public class PlayerConnection extends Connection {
// This section stays because it is only applicable to packets // This section stays because it is only applicable to packets
if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().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_()) { if (packet3chat.a_()) {
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
@ -867,7 +863,6 @@ public class PlayerConnection extends Connection {
} else { } else {
this.disconnect("disconnect.spam"); this.disconnect("disconnect.spam");
} }
// CraftBukkit end
} }
} }
} }
@ -900,7 +895,7 @@ public class PlayerConnection extends Connection {
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
protected Object evaluate() { protected Object evaluate() {
Bukkit.getPluginManager().callEvent(queueEvent); org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent);
if (queueEvent.isCancelled()) { if (queueEvent.isCancelled()) {
return null; return null;
@ -973,7 +968,7 @@ public class PlayerConnection extends Connection {
} }
} catch (org.bukkit.command.CommandException ex) { } catch (org.bukkit.command.CommandException ex) {
player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -987,7 +982,7 @@ public class PlayerConnection extends Connection {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
if (packet18armanimation.b == 1) { if (packet18armanimation.b == 1) {
// CraftBukkit start - raytrace to look for 'rogue armswings' // CraftBukkit start - Raytrace to look for 'rogue armswings'
float f = 1.0F; float f = 1.0F;
float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f; float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f; float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f;
@ -1092,7 +1087,7 @@ public class PlayerConnection extends Connection {
} }
// CraftBukkit end // CraftBukkit end
this.player.p(entity); this.player.p(entity);
// CraftBukkit start - update the client if the item is an infinite one // CraftBukkit start - Update the client if the item is an infinite one
if (itemInHand != null && itemInHand.count <= -1) { if (itemInHand != null && itemInHand.count <= -1) {
this.player.updateInventory(this.player.activeContainer); this.player.updateInventory(this.player.activeContainer);
} }
@ -1118,7 +1113,7 @@ public class PlayerConnection extends Connection {
public void a(Packet205ClientCommand packet205clientcommand) { public void a(Packet205ClientCommand packet205clientcommand) {
if (packet205clientcommand.a == 1) { if (packet205clientcommand.a == 1) {
if (this.player.viewingCredits) { if (this.player.viewingCredits) {
this.minecraftServer.getPlayerList().changeDimension(this.player, 0, TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management
} else if (this.player.o().getWorldData().isHardcore()) { } else if (this.player.o().getWorldData().isHardcore()) {
if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) { if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) {
this.player.playerConnection.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!");
@ -1149,7 +1144,7 @@ public class PlayerConnection extends Connection {
public void handleContainerClose(Packet101CloseWindow packet101closewindow) { public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
// CraftBukkit start - INVENTORY_CLOSE hook // CraftBukkit start
InventoryCloseEvent event = new InventoryCloseEvent(this.player.activeContainer.getBukkitView()); InventoryCloseEvent event = new InventoryCloseEvent(this.player.activeContainer.getBukkitView());
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
this.player.activeContainer.transferTo(this.player.defaultContainer, getPlayer()); this.player.activeContainer.transferTo(this.player.defaultContainer, getPlayer());
@ -1162,7 +1157,7 @@ public class PlayerConnection extends Connection {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) { if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
// CraftBukkit start - fire InventoryClickEvent // CraftBukkit start - Call InventoryClickEvent
if (packet102windowclick.slot == -1) { if (packet102windowclick.slot == -1) {
// Vanilla doesn't do anything with this, neither should we // Vanilla doesn't do anything with this, neither should we
return; return;
@ -1176,7 +1171,7 @@ public class PlayerConnection extends Connection {
if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) { if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) {
org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe(); org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe();
if (recipe != null) { if (recipe != null) {
event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1); event = new org.bukkit.event.inventory.CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1);
} }
} }
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
@ -1231,7 +1226,7 @@ public class PlayerConnection extends Connection {
this.player.a(this.player.activeContainer, arraylist); this.player.a(this.player.activeContainer, arraylist);
// CraftBukkit start - send a Set Slot to update the crafting result slot // CraftBukkit start - Send a Set Slot to update the crafting result slot
if (type == SlotType.RESULT && itemstack != null) { if (type == SlotType.RESULT && itemstack != null) {
this.player.playerConnection.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack))); this.player.playerConnection.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack)));
} }
@ -1256,7 +1251,7 @@ public class PlayerConnection extends Connection {
boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id); boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id);
boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;
// CraftBukkit start - Fire INVENTORY_CLICK event // CraftBukkit start - Call click event
org.bukkit.entity.HumanEntity player = this.player.getBukkitEntity(); org.bukkit.entity.HumanEntity player = this.player.getBukkitEntity();
InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer); InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer);
SlotType slot = SlotType.QUICKBAR; SlotType slot = SlotType.QUICKBAR;
@ -1441,7 +1436,7 @@ public class PlayerConnection extends Connection {
ItemStack itemstack; ItemStack itemstack;
ItemStack itemstack1; ItemStack itemstack1;
// CraftBukkit start - ignore empty payloads // CraftBukkit start - Ignore empty payloads
if (packet250custompayload.length <= 0) { if (packet250custompayload.length <= 0) {
return; return;
} }

Datei anzeigen

@ -32,12 +32,6 @@ public class PlayerInteractManager {
this.world = world; this.world = world;
} }
// CraftBukkit start - keep this for backwards compatibility
public PlayerInteractManager(WorldServer world) {
this((World) world);
}
// CraftBukkit end
public void setGameMode(EnumGamemode enumgamemode) { public void setGameMode(EnumGamemode enumgamemode) {
this.gamemode = enumgamemode; this.gamemode = enumgamemode;
enumgamemode.a(this.player.abilities); enumgamemode.a(this.player.abilities);
@ -216,9 +210,9 @@ public class PlayerInteractManager {
this.n = this.lastDigTick; this.n = this.lastDigTick;
} }
} }
// CraftBukkit start - force blockreset to client // CraftBukkit start - Force block reset to client
} else { } else {
((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world)); this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
// CraftBukkit end // CraftBukkit end
} }
} }
@ -298,10 +292,10 @@ public class PlayerInteractManager {
return false; return false;
} else { } else {
int l = this.world.getTypeId(i, j, k); int l = this.world.getTypeId(i, j, k);
if (Block.byId[l] == null) return false; // CraftBukkit - a plugin set block to air without cancelling if (Block.byId[l] == null) return false; // CraftBukkit - A plugin set block to air without cancelling
int i1 = this.world.getData(i, j, k); int i1 = this.world.getData(i, j, k);
// CraftBukkit start - special case skulls, their item data comes from a tile entity // CraftBukkit start - Special case skulls, their item data comes from a tile entity
if (l == Block.SKULL.id && !this.isCreative()) { if (l == Block.SKULL.id && !this.isCreative()) {
Block.SKULL.dropNaturally(world, i, j, k, i1, 1.0F, 0); Block.SKULL.dropNaturally(world, i, j, k, i1, 1.0F, 0);
return this.d(i, j, k); return this.d(i, j, k);
@ -329,7 +323,7 @@ public class PlayerInteractManager {
} }
} }
// CraftBukkit start - drop event experience // CraftBukkit start - Drop event experience
if (flag && event != null) { if (flag && event != null) {
Block.byId[l].j(this.world, i, j, k, event.getExpToDrop()); Block.byId[l].j(this.world, i, j, k, event.getExpToDrop());
} }

Datei anzeigen

@ -83,7 +83,7 @@ public class PlayerInventory implements IInventory {
return -1; return -1;
} }
// CraftBukkit start - watch method above! :D // CraftBukkit start - Watch method above! :D
public int canHold(ItemStack itemstack) { public int canHold(ItemStack itemstack) {
int remains = itemstack.count; int remains = itemstack.count;
for (int i = 0; i < this.items.length; ++i) { for (int i = 0; i < this.items.length; ++i) {

Datei anzeigen

@ -13,23 +13,22 @@ import java.util.Set;
import java.util.Map.Entry; import java.util.Map.Entry;
// CraftBukkit start // CraftBukkit start
import org.bukkit.Location;
import org.bukkit.TravelAgent;
import org.bukkit.WeatherType;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor; import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.TravelAgent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import org.bukkit.Bukkit;
// CraftBukkit end // CraftBukkit end
public abstract class PlayerList { public abstract class PlayerList {
@ -214,7 +213,7 @@ public abstract class PlayerList {
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); ChunkIOExecutor.adjustPoolSize(this.getPlayerCount());
// CraftBukkit end // CraftBukkit end
// CraftBukkit start - only add if the player wasn't moved in the event // CraftBukkit start - Only add if the player wasn't moved in the event
if (entityplayer.world == worldserver && !worldserver.players.contains(entityplayer)) { if (entityplayer.world == worldserver && !worldserver.players.contains(entityplayer)) {
worldserver.addEntity(entityplayer); worldserver.addEntity(entityplayer);
this.a(entityplayer, (WorldServer) null); this.a(entityplayer, (WorldServer) null);
@ -250,7 +249,7 @@ public abstract class PlayerList {
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
if (entityplayer.playerConnection.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 // 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."); PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
this.cserver.getPluginManager().callEvent(playerQuitEvent); this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
@ -450,7 +449,7 @@ public abstract class PlayerList {
worldserver.getPlayerChunkMap().addPlayer(entityplayer1); worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
worldserver.addEntity(entityplayer1); worldserver.addEntity(entityplayer1);
this.players.add(entityplayer1); this.players.add(entityplayer1);
// CraftBukkit start - added from changeDimension // CraftBukkit start - Added from changeDimension
this.updateClient(entityplayer1); // CraftBukkit this.updateClient(entityplayer1); // CraftBukkit
entityplayer1.updateAbilities(); entityplayer1.updateAbilities();
Iterator iterator = entityplayer1.getEffects().iterator(); Iterator iterator = entityplayer1.getEffects().iterator();
@ -464,7 +463,7 @@ public abstract class PlayerList {
// CraftBukkit end // CraftBukkit end
entityplayer1.setHealth(entityplayer1.getHealth()); entityplayer1.setHealth(entityplayer1.getHealth());
// CraftBukkit start - don't fire on respawn // CraftBukkit start - Don't fire on respawn
if (fromWorld != location.getWorld()) { if (fromWorld != location.getWorld()) {
PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld); PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
@ -492,7 +491,7 @@ public abstract class PlayerList {
if (exitWorld != null) { if (exitWorld != null) {
if ((cause == TeleportCause.END_PORTAL) && (i == 0)) { if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
// THE_END -> NORMAL; use bed if available, otherwise default spawn // THE_END -> NORMAL; use bed if available, otherwise default spawn
exit = ((CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation();
if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) { if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) {
exit = exitWorld.getWorld().getSpawnLocation(); exit = exitWorld.getWorld().getSpawnLocation();
} }
@ -531,12 +530,12 @@ public abstract class PlayerList {
} }
public void a(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) { public void a(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) {
// CraftBukkit start - split into modular functions // CraftBukkit start - Split into modular functions
Location exit = this.calculateTarget(entity.getBukkitEntity().getLocation(), worldserver1); Location exit = this.calculateTarget(entity.getBukkitEntity().getLocation(), worldserver1);
this.repositionEntity(entity, exit, true); this.repositionEntity(entity, exit, true);
} }
// copy of original a(Entity, int, WorldServer, WorldServer) method with only location calculation logic // Copy of original a(Entity, int, WorldServer, WorldServer) method with only location calculation logic
public Location calculateTarget(Location enter, World target) { public Location calculateTarget(Location enter, World target) {
WorldServer worldserver = ((CraftWorld) enter.getWorld()).getHandle(); WorldServer worldserver = ((CraftWorld) enter.getWorld()).getHandle();
WorldServer worldserver1 = ((CraftWorld) target.getWorld()).getHandle(); WorldServer worldserver1 = ((CraftWorld) target.getWorld()).getHandle();
@ -707,7 +706,7 @@ public abstract class PlayerList {
this.n = 0; this.n = 0;
} }
/* CraftBukkit start - remove updating of lag to players -- it spams way to much on big servers. /* CraftBukkit start - Remove updating of lag to players -- it spams way to much on big servers.
if (this.n < this.players.size()) { if (this.n < this.players.size()) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n); EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n);
@ -976,7 +975,7 @@ public abstract class PlayerList {
public void b(EntityPlayer entityplayer, WorldServer worldserver) { public void b(EntityPlayer entityplayer, WorldServer worldserver) {
entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime())); entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
if (worldserver.O()) { if (worldserver.O()) {
entityplayer.setPlayerWeather(WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather
} }
} }

Datei anzeigen

@ -30,14 +30,14 @@ public class PortalTravelAgent {
this.b(entity, d0, d1, d2, f); this.b(entity, d0, d1, d2, f);
} }
} else { } else {
// CraftBukkit start - modularize end portal creation // CraftBukkit start - Modularize end portal creation
ChunkCoordinates created = this.createEndPortal(d0, d1, d2); ChunkCoordinates created = this.createEndPortal(d0, d1, d2);
entity.setPositionRotation((double) created.x, (double) created.y, (double) created.z, entity.yaw, 0.0F); entity.setPositionRotation((double) created.x, (double) created.y, (double) created.z, entity.yaw, 0.0F);
entity.motX = entity.motY = entity.motZ = 0.0D; entity.motX = entity.motY = entity.motZ = 0.0D;
} }
} }
// split out from original a(Entity, double, double, double, float) method in order to enable being called from createPortal // Split out from original a(Entity, double, double, double, float) method in order to enable being called from createPortal
private ChunkCoordinates createEndPortal(double x, double y, double z) { private ChunkCoordinates createEndPortal(double x, double y, double z) {
int i = MathHelper.floor(x); int i = MathHelper.floor(x);
int j = MathHelper.floor(y) - 1; int j = MathHelper.floor(y) - 1;
@ -90,7 +90,7 @@ public class PortalTravelAgent {
// CraftBukkit end // CraftBukkit end
public boolean b(Entity entity, double d0, double d1, double d2, float f) { public boolean b(Entity entity, double d0, double d1, double d2, float f) {
// CraftBukkit start - modularize portal search process and entity teleportation // CraftBukkit start - Modularize portal search process and entity teleportation
ChunkCoordinates found = this.findPortal(entity.locX, entity.locY, entity.locZ, 128); ChunkCoordinates found = this.findPortal(entity.locX, entity.locY, entity.locZ, 128);
if (found == null) { if (found == null) {
return false; return false;
@ -166,13 +166,13 @@ public class PortalTravelAgent {
this.c.put(j1, new ChunkCoordinatesPortal(this, i, j, k, this.a.getTime())); this.c.put(j1, new ChunkCoordinatesPortal(this, i, j, k, this.a.getTime()));
this.d.add(Long.valueOf(j1)); this.d.add(Long.valueOf(j1));
} }
// CraftBukkit start - moved entity teleportation logic into exit // CraftBukkit start - Moved entity teleportation logic into exit
return new ChunkCoordinates(i, j, k); return new ChunkCoordinates(i, j, k);
} else { } else {
return null; return null;
} }
} }
// entity repositioning logic split out from original b method and combined with repositioning logic for The End from original a method // Entity repositioning logic split out from original b method and combined with repositioning logic for The End from original a method
public void adjustExit(Entity entity, Location position, Vector velocity) { public void adjustExit(Entity entity, Location position, Vector velocity) {
Location from = position.clone(); Location from = position.clone();
Vector before = velocity.clone(); Vector before = velocity.clone();
@ -279,7 +279,7 @@ public class PortalTravelAgent {
double d11 = velocity.getZ(); double d11 = velocity.getZ();
// CraftBukkit end // CraftBukkit end
// CraftBukkit start - adjust position and velocity instances instead of entity // CraftBukkit start - Adjust position and velocity instances instead of entity
velocity.setX(d10 * (double) f3 + d11 * (double) f6); velocity.setX(d10 * (double) f3 + d11 * (double) f6);
velocity.setZ(d10 * (double) f5 + d11 * (double) f4); velocity.setZ(d10 * (double) f5 + d11 * (double) f4);
f = f - (float) (k2 * 90) + (float) (j2 * 90); f = f - (float) (k2 * 90) + (float) (j2 * 90);
@ -319,7 +319,7 @@ public class PortalTravelAgent {
} }
public boolean a(Entity entity) { public boolean a(Entity entity) {
// CraftBukkit start - allow for portal creation to be based on coordinates instead of entity // CraftBukkit start - Allow for portal creation to be based on coordinates instead of entity
return this.createPortal(entity.locX, entity.locY, entity.locZ, 16); return this.createPortal(entity.locX, entity.locY, entity.locZ, 16);
} }

Datei anzeigen

@ -4,7 +4,7 @@ import java.util.ArrayList;
public class RecipeArmorDye 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 // CraftBukkit start - Delegate to new parent class with bogus info
public RecipeArmorDye() { public RecipeArmorDye() {
super(new ItemStack(Item.LEATHER_HELMET, 0, 0), java.util.Arrays.asList(new ItemStack(Item.INK_SACK, 0, 5))); super(new ItemStack(Item.LEATHER_HELMET, 0, 0), java.util.Arrays.asList(new ItemStack(Item.INK_SACK, 0, 5)));
} }

Datei anzeigen

@ -6,7 +6,7 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
private ItemStack a; private ItemStack a;
// CraftBukkit start - delegate to new parent class with bogus info // CraftBukkit start - Delegate to new parent class with bogus info
public RecipeFireworks() { public RecipeFireworks() {
super(new ItemStack(Item.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Item.SULPHUR, 0, 5))); super(new ItemStack(Item.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Item.SULPHUR, 0, 5)));
} }

Datei anzeigen

@ -2,7 +2,7 @@ package net.minecraft.server;
public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
// CraftBukkit start - delegate to new parent class // CraftBukkit start - Delegate to new parent class
public RecipeMapClone() { public RecipeMapClone() {
super(new ItemStack(Item.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Item.MAP_EMPTY, 0, 0))); super(new ItemStack(Item.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Item.MAP_EMPTY, 0, 0)));
} }

Datei anzeigen

@ -87,7 +87,7 @@ public class RegionFile {
} }
} }
// CraftBukkit start - this is a copy (sort of) of the method below it, make sure they stay in sync // CraftBukkit start - This is a copy (sort of) of the method below it, make sure they stay in sync
public synchronized boolean chunkExists(int i, int j) { public synchronized boolean chunkExists(int i, int j) {
if (this.d(i, j)) { if (this.d(i, j)) {
return false; return false;

Datei anzeigen

@ -68,7 +68,7 @@ public final class SpawnerCreature {
for (int j1 = 0; j1 < j; ++j1) { for (int j1 = 0; j1 < j; ++j1) {
EnumCreatureType enumcreaturetype = aenumcreaturetype[j1]; EnumCreatureType enumcreaturetype = aenumcreaturetype[j1];
// CraftBukkit start - use per-world spawn limits // CraftBukkit start - Use per-world spawn limits
int limit = enumcreaturetype.b(); int limit = enumcreaturetype.b();
switch (enumcreaturetype) { switch (enumcreaturetype) {
case MONSTER: case MONSTER:
@ -154,7 +154,7 @@ public final class SpawnerCreature {
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F); entityliving.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F);
if (entityliving.canSpawn()) { if (entityliving.canSpawn()) {
++j2; ++j2;
// CraftBukkit start - added a reason for spawning this creature, moved a(entityliving, world...) up // CraftBukkit start - Added a reason for spawning this creature, moved a(entityliving, world...) up
a(entityliving, worldserver, f, f1, f2); a(entityliving, worldserver, f, f1, f2);
worldserver.addEntity(entityliving, SpawnReason.NATURAL); worldserver.addEntity(entityliving, SpawnReason.NATURAL);
// CraftBukkit end // CraftBukkit end
@ -236,7 +236,7 @@ public final class SpawnerCreature {
} }
entityliving.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F); entityliving.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F);
// CraftBukkit start - added a reason for spawning this creature, moved a(entity, world...) up // CraftBukkit start - Added a reason for spawning this creature, moved a(entity, world...) up
a(entityliving, world, f, f1, f2); a(entityliving, world, f, f1, f2);
world.addEntity(entityliving, SpawnReason.CHUNK_GEN); world.addEntity(entityliving, SpawnReason.CHUNK_GEN);
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -133,11 +133,11 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
if (this.l()) { if (this.l()) {
ItemStack itemstack = this.items[3]; ItemStack itemstack = this.items[3];
// CraftBukkit start - fire BREW event // CraftBukkit start
if (getOwner() != null) { if (getOwner() != null) {
BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(x, y, z), (org.bukkit.inventory.BrewerInventory) this.getOwner().getInventory()); BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(x, y, z), (org.bukkit.inventory.BrewerInventory) this.getOwner().getInventory());
org.bukkit.Bukkit.getPluginManager().callEvent(event); org.bukkit.Bukkit.getPluginManager().callEvent(event);
if(event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
} }

Datei anzeigen

@ -2,7 +2,6 @@ package net.minecraft.server;
// CraftBukkit start // CraftBukkit start
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
// CraftBukkit end // CraftBukkit end
@ -31,7 +30,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
MinecraftServer minecraftserver = MinecraftServer.getServer(); MinecraftServer minecraftserver = MinecraftServer.getServer();
if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) { if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) {
// CraftBukkit start - handle command block commands using Bukkit dispatcher // CraftBukkit start - Handle command block commands using Bukkit dispatcher
org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap(); org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
Joiner joiner = Joiner.on(" "); Joiner joiner = Joiner.on(" ");
String command = this.b; String command = this.b;
@ -41,19 +40,19 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
String[] args = command.split(" "); String[] args = command.split(" ");
ArrayList<String[]> commands = new ArrayList<String[]>(); ArrayList<String[]> commands = new ArrayList<String[]>();
// block disallowed commands // Block disallowed commands
if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") || if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") ||
args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") || args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") ||
args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) { args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) {
return 0; return 0;
} }
// make sure this is a valid command // Make sure this is a valid command
if (commandMap.getCommand(args[0]) == null) { if (commandMap.getCommand(args[0]) == null) {
return 0; return 0;
} }
// if the world has no players don't run // If the world has no players don't run
if (this.world.players.isEmpty()) { if (this.world.players.isEmpty()) {
return 0; return 0;
} }
@ -80,7 +79,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
commands.add(args); commands.add(args);
// find positions of command block syntax, if any // Find positions of command block syntax, if any
ArrayList<String[]> newCommands = new ArrayList<String[]>(); ArrayList<String[]> newCommands = new ArrayList<String[]>();
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if (PlayerSelector.isPattern(args[i])) { if (PlayerSelector.isPattern(args[i])) {
@ -96,10 +95,10 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
int completed = 0; int completed = 0;
// now dispatch all of the commands we ended up with // Now dispatch all of the commands we ended up with
for (int i = 0; i < commands.size(); i++) { for (int i = 0; i < commands.size(); i++) {
try { try {
if (commandMap.dispatch(sender, joiner.join(Arrays.asList(commands.get(i))))) { if (commandMap.dispatch(sender, joiner.join(java.util.Arrays.asList(commands.get(i))))) {
completed++; completed++;
} }
} catch (Throwable exception) { } catch (Throwable exception) {

Datei anzeigen

@ -188,7 +188,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
} }
if (!this.world.isStatic) { if (!this.world.isStatic) {
// CraftBukkit start - handle multiple elapsed ticks // CraftBukkit start - Handle multiple elapsed ticks
if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <= if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <=
CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]); CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]);
@ -215,7 +215,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
} }
} }
/* CraftBukkit start - moved up /* CraftBukkit start - Moved up
if (this.isBurning() && this.canBurn()) { if (this.isBurning() && this.canBurn()) {
++this.cookTime; ++this.cookTime;
if (this.cookTime == 200) { if (this.cookTime == 200) {

Datei anzeigen

@ -202,7 +202,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
for (int i = 0; i < this.getSize(); ++i) { for (int i = 0; i < this.getSize(); ++i) {
if (this.getItem(i) != null) { if (this.getItem(i) != null) {
ItemStack itemstack = this.getItem(i).cloneItemStack(); ItemStack itemstack = this.getItem(i).cloneItemStack();
// CraftBukkit start - fire event when pushing items into other inventories // CraftBukkit start - Call event when pushing items into other inventories
CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1)); CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1));
Inventory destinationInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null; Inventory destinationInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null;
@ -210,7 +210,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
this.getWorld().getServer().getPluginManager().callEvent(event); this.getWorld().getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
this.setItem(i, itemstack); this.setItem(i, itemstack);
this.c(8); // delay hopper checks this.c(8); // Delay hopper checks
return false; return false;
} }
ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.c(this.p())]); ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.c(this.p())]);
@ -273,7 +273,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) { if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) {
ItemStack itemstack1 = itemstack.cloneItemStack(); ItemStack itemstack1 = itemstack.cloneItemStack();
// CraftBukkit start - fire event on collection of items from inventories into the hopper // CraftBukkit start - Call event on collection of items from inventories into the hopper
CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1)); CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1));
Inventory sourceInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null; Inventory sourceInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null;
@ -284,9 +284,9 @@ public class TileEntityHopper extends TileEntity implements IHopper {
iinventory.setItem(i, itemstack1); iinventory.setItem(i, itemstack1);
if (ihopper instanceof TileEntityHopper) { if (ihopper instanceof TileEntityHopper) {
((TileEntityHopper) ihopper).c(8); // delay hopper checks ((TileEntityHopper) ihopper).c(8); // Delay hopper checks
} else if (ihopper instanceof EntityMinecartHopper) { } else if (ihopper instanceof EntityMinecartHopper) {
((EntityMinecartHopper) ihopper).n(4); // delay hopper minecart checks ((EntityMinecartHopper) ihopper).n(4); // Delay hopper minecart checks
} }
return false; return false;

Datei anzeigen

@ -4,7 +4,7 @@ public class TileEntitySign extends TileEntity {
public String[] lines = new String[] { "", "", "", ""}; public String[] lines = new String[] { "", "", "", ""};
public int b = -1; public int b = -1;
public boolean isEditable = true; // CraftBukkit - privite -> public public boolean isEditable = true; // CraftBukkit - private -> public
public TileEntitySign() {} public TileEntitySign() {}
@ -31,7 +31,7 @@ public class TileEntitySign extends TileEntity {
public Packet getUpdatePacket() { public Packet getUpdatePacket() {
String[] astring = new String[4]; String[] astring = new String[4];
// CraftBukkit start - limit sign text to 15 chars per line // CraftBukkit start - Limit sign text to 15 chars per line
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
astring[i] = this.lines[i]; astring[i] = this.lines[i];

Datei anzeigen

@ -24,8 +24,8 @@ public class Vec3DPool {
this.b = j; this.b = j;
} }
public final Vec3D create(double d0, double d1, double d2) { // CraftBukkit - add final public final Vec3D create(double d0, double d1, double d2) { // CraftBukkit - Add final
if (this.resizeTime == 0) return Vec3D.a(d0, d1, d2); // CraftBukkit - don't pool objects indefinitely if thread doesn't adhere to contract if (this.resizeTime == 0) return Vec3D.a(d0, d1, d2); // CraftBukkit - Don't pool objects indefinitely if thread doesn't adhere to contract
Vec3D vec3d; Vec3D vec3d;
if (this.freelist == null) { // CraftBukkit if (this.freelist == null) { // CraftBukkit
@ -43,14 +43,14 @@ public class Vec3DPool {
if (this.alloclist == null) { if (this.alloclist == null) {
this.alloclisthead = vec3d; this.alloclisthead = vec3d;
} }
vec3d.next = this.alloclist; // add to allocated list vec3d.next = this.alloclist; // Add to allocated list
this.alloclist = vec3d; this.alloclist = vec3d;
// CraftBukkit end // CraftBukkit end
++this.position; ++this.position;
return vec3d; return vec3d;
} }
// CraftBukkit start - offer back vector (can save LOTS of unneeded bloat) - works about 90% of the time // CraftBukkit start - Offer back vector (can save LOTS of unneeded bloat) - works about 90% of the time
public void release(Vec3D v) { public void release(Vec3D v) {
if (this.alloclist == v) { if (this.alloclist == v) {
this.alloclist = v.next; // Pop off alloc list this.alloclist = v.next; // Pop off alloc list
@ -68,7 +68,7 @@ public class Vec3DPool {
this.largestSize = this.position; this.largestSize = this.position;
} }
// CraftBukkit start - intelligent cache // CraftBukkit start - Intelligent cache
// Take any allocated blocks and put them on free list // Take any allocated blocks and put them on free list
if (this.alloclist != null) { if (this.alloclist != null) {
if (this.freelist == null) { if (this.freelist == null) {

Datei anzeigen

@ -892,7 +892,7 @@ public abstract class World implements IBlockAccess {
return true; return true;
} }
// CraftBukkit start - used for entities other than creatures // CraftBukkit start - Used for entities other than creatures
public boolean addEntity(Entity entity) { public boolean addEntity(Entity entity) {
return this.addEntity(entity, SpawnReason.DEFAULT); // Set reason as DEFAULT return this.addEntity(entity, SpawnReason.DEFAULT); // Set reason as DEFAULT
} }
@ -1147,7 +1147,7 @@ public abstract class World implements IBlockAccess {
for (i = 0; i < this.i.size(); ++i) { for (i = 0; i < this.i.size(); ++i) {
entity = (Entity) this.i.get(i); entity = (Entity) this.i.get(i);
// CraftBukkit start - fixed an NPE, don't process entities in chunks queued for unload // CraftBukkit start - Fixed an NPE, don't process entities in chunks queued for unload
if (entity == null) { if (entity == null) {
continue; continue;
} }
@ -1203,7 +1203,7 @@ public abstract class World implements IBlockAccess {
for (i = 0; i < this.entityList.size(); ++i) { for (i = 0; i < this.entityList.size(); ++i) {
entity = (Entity) this.entityList.get(i); entity = (Entity) this.entityList.get(i);
// CraftBukkit start - don't tick entities in chunks queued for unload // CraftBukkit start - Don't tick entities in chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer; ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer;
if (chunkProviderServer.unloadQueue.contains(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4)) { if (chunkProviderServer.unloadQueue.contains(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4)) {
continue; continue;
@ -1253,7 +1253,7 @@ public abstract class World implements IBlockAccess {
while (iterator.hasNext()) { while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next(); TileEntity tileentity = (TileEntity) iterator.next();
// CraftBukkit start - don't tick entities in chunks queued for unload // CraftBukkit start - Don't tick entities in chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer; ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer;
if (chunkProviderServer.unloadQueue.contains(tileentity.x >> 4, tileentity.z >> 4)) { if (chunkProviderServer.unloadQueue.contains(tileentity.x >> 4, tileentity.z >> 4)) {
continue; continue;
@ -1295,7 +1295,7 @@ public abstract class World implements IBlockAccess {
TileEntity tileentity1 = (TileEntity) this.a.get(l); TileEntity tileentity1 = (TileEntity) this.a.get(l);
if (!tileentity1.r()) { if (!tileentity1.r()) {
/* CraftBukkit start - order matters, moved down /* CraftBukkit start - Order matters, moved down
if (!this.tileEntityList.contains(tileentity1)) { if (!this.tileEntityList.contains(tileentity1)) {
this.tileEntityList.add(tileentity1); this.tileEntityList.add(tileentity1);
} }
@ -1306,7 +1306,7 @@ public abstract class World implements IBlockAccess {
if (chunk1 != null) { if (chunk1 != null) {
chunk1.a(tileentity1.x & 15, tileentity1.y, tileentity1.z & 15, tileentity1); chunk1.a(tileentity1.x & 15, tileentity1.y, tileentity1.z & 15, tileentity1);
// CraftBukkit start - moved down from above // CraftBukkit start - Moved down from above
if (!this.tileEntityList.contains(tileentity1)) { if (!this.tileEntityList.contains(tileentity1)) {
this.tileEntityList.add(tileentity1); this.tileEntityList.add(tileentity1);
} }
@ -1963,7 +1963,7 @@ public abstract class World implements IBlockAccess {
for (int l = -b0; l <= b0; ++l) { for (int l = -b0; l <= b0; ++l) {
for (int i1 = -b0; i1 <= b0; ++i1) { for (int i1 = -b0; i1 <= b0; ++i1) {
// CraftBukkit start - don't tick chunks queued for unload // CraftBukkit start - Don't tick chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) entityhuman.world).chunkProviderServer; ChunkProviderServer chunkProviderServer = ((WorldServer) entityhuman.world).chunkProviderServer;
if (chunkProviderServer.unloadQueue.contains(l + j, i1 + k)) { if (chunkProviderServer.unloadQueue.contains(l + j, i1 + k)) {
continue; continue;
@ -2517,7 +2517,7 @@ public abstract class World implements IBlockAccess {
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
// CraftBukkit start - fixed an NPE // CraftBukkit start - Fixed an NPE
if (entityhuman1 == null || entityhuman1.dead) { if (entityhuman1 == null || entityhuman1.dead) {
continue; continue;
} }
@ -2543,7 +2543,7 @@ public abstract class World implements IBlockAccess {
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
// CraftBukkit start - fixed an NPE // CraftBukkit start - Fixed an NPE
if (entityhuman1 == null || entityhuman1.dead) { if (entityhuman1 == null || entityhuman1.dead) {
continue; continue;
} }

Datei anzeigen

@ -350,7 +350,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
} }
public boolean a(World world, Random random, int i, int j, int k) { public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - moved to generate // CraftBukkit start - Moved to generate
// sk: The idea is to have (our) WorldServer implement // sk: The idea is to have (our) WorldServer implement
// BlockChangeDelegate and then we can implicitly cast World to // BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This // WorldServer (a safe cast, AFAIK) and no code will be broken. This

Datei anzeigen

@ -11,7 +11,7 @@ public class WorldGenForest extends WorldGenerator implements BlockSapling.TreeG
} }
public boolean a(World world, Random random, int i, int j, int k) { public boolean a(World world, Random random, int i, int j, int k) {
// CraftBukkit start - moved to generate // CraftBukkit start - Moved to generate
return this.generate((BlockChangeDelegate) world, random, i, j, k); return this.generate((BlockChangeDelegate) world, random, i, j, k);
} }

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