mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 13:06:02 +01:00
Cleanup comments, formatting, etc
This commit is contained in:
parent
7c40a073d8
commit
5f089137ee
@ -39,7 +39,7 @@ public class AABBPool {
|
||||
this.largestSize = this.d;
|
||||
}
|
||||
|
||||
// CraftBukkit start - intelligent cache
|
||||
// CraftBukkit start - Intelligent cache
|
||||
if ((this.resizeTime++ & 0xff) == 0) {
|
||||
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
|
||||
|
@ -3,7 +3,6 @@ package net.minecraft.server;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockDropper extends BlockDispenser {
|
||||
@ -38,10 +37,10 @@ public class BlockDropper extends BlockDispenser {
|
||||
ItemStack itemstack1;
|
||||
|
||||
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));
|
||||
|
||||
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);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
|
@ -134,7 +134,7 @@ public class BlockFire extends Block {
|
||||
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 (CraftEventFactory.callBlockIgniteEvent(world, i1, k1, j1, i, j, k).isCancelled()) {
|
||||
continue;
|
||||
@ -261,7 +261,7 @@ public class BlockFire extends Block {
|
||||
|
||||
// CraftBukkit start
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
}
|
||||
|
||||
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);
|
||||
if (server != null) {
|
||||
server.getPluginManager().callEvent(event);
|
||||
@ -132,7 +132,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
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 };
|
||||
int index = 0;
|
||||
|
||||
|
@ -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) {
|
||||
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);
|
||||
|
||||
this.j(world, i, j, k, j1);*/
|
||||
|
@ -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) {
|
||||
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) {
|
||||
int j1 = 0;
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class BlockPumpkin extends BlockDirectional {
|
||||
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.isStatic) {
|
||||
// CraftBukkit start - use BlockStateListPopulator
|
||||
// CraftBukkit start - Use BlockStateListPopulator
|
||||
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
|
||||
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;
|
||||
|
||||
if (flag || flag1) {
|
||||
// CraftBukkit start - use BlockStateListPopulator
|
||||
// CraftBukkit start - Use BlockStateListPopulator
|
||||
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
|
||||
blockList.setTypeId(i, j, k, 0);
|
||||
|
@ -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) {
|
||||
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) {
|
||||
int j1 = 1 + world.random.nextInt(5);
|
||||
|
||||
|
@ -6,6 +6,7 @@ import java.util.Random;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.craftbukkit.util.StructureGrowDelegate;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -32,7 +33,7 @@ public class BlockSapling extends BlockFlower {
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if ((l & 8) == 0) {
|
||||
@ -42,14 +43,14 @@ public class BlockSapling extends BlockFlower {
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// CraftBukkit - Added bonemeal, player and 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;
|
||||
Object object = null;
|
||||
int i1 = 0;
|
||||
int j1 = 0;
|
||||
boolean flag = false;
|
||||
// CraftBukkit start - records tree generation and calls StructureGrowEvent
|
||||
// CraftBukkit start - Records tree generation and calls StructureGrowEvent
|
||||
StructureGrowDelegate delegate = new StructureGrowDelegate(world);
|
||||
TreeType treeType = null;
|
||||
TreeGenerator gen = null;
|
||||
|
@ -77,7 +77,7 @@ public class BlockSkull extends BlockContainer {
|
||||
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) {
|
||||
if (world.random.nextFloat() < f) {
|
||||
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) {
|
||||
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) {
|
||||
ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, 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) {
|
||||
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());
|
||||
|
||||
world.setData(i, j, k + i1, 8, 2);
|
||||
@ -173,7 +173,7 @@ public class BlockSkull extends BlockContainer {
|
||||
|
||||
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)) {
|
||||
// CraftBukkit start - use BlockStateListPopulator
|
||||
// CraftBukkit start - Use BlockStateListPopulator
|
||||
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
|
||||
|
||||
world.setData(i + i1, j, k, 8, 2);
|
||||
|
@ -55,7 +55,7 @@ public class BlockSoil extends Block {
|
||||
return;
|
||||
}
|
||||
|
||||
// CraftBukkit start - interact soil
|
||||
// CraftBukkit start - Interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
if (entity instanceof EntityHuman) {
|
||||
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||
|
@ -39,7 +39,7 @@ public class BlockStationary extends BlockFluids {
|
||||
int i1;
|
||||
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 y = j;
|
||||
int z = k;
|
||||
@ -52,7 +52,7 @@ public class BlockStationary extends BlockFluids {
|
||||
j1 = world.getTypeId(i, j, k);
|
||||
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)) {
|
||||
// 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 (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, x, y, z).isCancelled()) {
|
||||
continue;
|
||||
@ -76,7 +76,7 @@ public class BlockStationary extends BlockFluids {
|
||||
i = i1 + random.nextInt(3) - 1;
|
||||
k = j1 + random.nextInt(3) - 1;
|
||||
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 (CraftEventFactory.callBlockIgniteEvent(world, i, j + 1, k, x, y, z).isCancelled()) {
|
||||
continue;
|
||||
|
@ -203,7 +203,7 @@ public class BlockVine extends Block {
|
||||
}
|
||||
|
||||
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 block = world.getWorld().getBlockAt(i, j + 1, k);
|
||||
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1);
|
||||
@ -227,7 +227,7 @@ public class BlockVine extends Block {
|
||||
i2 = k1 + 1 & 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 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]))) {
|
||||
@ -250,7 +250,7 @@ public class BlockVine extends Block {
|
||||
if (l1 == 0) {
|
||||
i2 = world.random.nextInt(16) & i1;
|
||||
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 block = world.getWorld().getBlockAt(i, j - 1, k);
|
||||
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2);
|
||||
|
@ -8,10 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.Bukkit; // CraftBukkit
|
||||
|
||||
public class Chunk {
|
||||
|
||||
@ -430,7 +427,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import java.util.Set;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
|
||||
import org.bukkit.craftbukkit.util.LongHash;
|
||||
import org.bukkit.craftbukkit.util.LongHashSet;
|
||||
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) {
|
||||
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 (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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -115,7 +114,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
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("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());
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
@ -208,7 +207,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
this.e.a(this.world, chunk);
|
||||
} catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
ioexception.printStackTrace();
|
||||
// CraftBukkit start - remove extra exception
|
||||
// CraftBukkit start - Remove extra exception
|
||||
}
|
||||
// } catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
// exceptionworldconflict.printStackTrace();
|
||||
|
@ -40,7 +40,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
|
||||
}
|
||||
// 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) {
|
||||
Object[] data = this.loadChunk(world, i, j);
|
||||
if (data != null) {
|
||||
@ -319,7 +319,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class ChunkSection {
|
||||
}
|
||||
|
||||
public void recalcBlockCounts() {
|
||||
// CraftBukkit start - optimize for speed
|
||||
// CraftBukkit start - Optimize for speed
|
||||
byte[] blkIds = this.blockIds;
|
||||
int cntNonEmpty = 0;
|
||||
int cntTicking = 0;
|
||||
@ -223,7 +223,7 @@ public class ChunkSection {
|
||||
}
|
||||
|
||||
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;
|
||||
for (int i = 0; i < nibblearray.a.length; i++) {
|
||||
if (nibblearray.a[i] != 0) {
|
||||
|
@ -14,7 +14,7 @@ class ConsoleLogFormatter extends Formatter {
|
||||
private SimpleDateFormat b;
|
||||
|
||||
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 boolean strip = false;
|
||||
// CraftBukkit end
|
||||
|
@ -189,7 +189,7 @@ public abstract class Container {
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
// CraftBukkit start - store a reference
|
||||
// CraftBukkit start - Store a reference
|
||||
ItemStack itemstack4 = playerinventory.getCarried();
|
||||
if (itemstack4.count > 0) {
|
||||
entityhuman.drop(itemstack4.a(1));
|
||||
|
@ -3,11 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryAnvil;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
|
||||
|
||||
public class ContainerAnvil extends Container {
|
||||
|
||||
@ -380,7 +376,7 @@ public class ContainerAnvil extends Container {
|
||||
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);
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
|
||||
|
||||
public class ContainerBeacon extends Container {
|
||||
|
||||
@ -114,7 +110,7 @@ public class ContainerBeacon extends Container {
|
||||
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);
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class ContainerChest extends Container {
|
||||
this.f = iinventory1.getSize() / 9;
|
||||
iinventory1.startOpen();
|
||||
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?
|
||||
this.player = (PlayerInventory)iinventory;
|
||||
// CraftBukkit end
|
||||
|
@ -15,7 +15,7 @@ public class ContainerDispenser extends Container {
|
||||
|
||||
public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) {
|
||||
this.items = tileentitydispenser;
|
||||
// CraftBukkit start - save player
|
||||
// CraftBukkit start - Save player
|
||||
// TODO: Should we check to make sure it really is an InventoryPlayer?
|
||||
this.player = (PlayerInventory)iinventory;
|
||||
// CraftBukkit end
|
||||
|
@ -19,7 +19,7 @@ public class ContainerWorkbench extends Container {
|
||||
// CraftBukkit end
|
||||
|
||||
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.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player
|
||||
this.craftInventory.resultInventory = this.resultInventory;
|
||||
|
@ -271,7 +271,7 @@ public class CraftingManager {
|
||||
j1 = 0;
|
||||
}
|
||||
|
||||
// CraftBukkit start - construct a dummy repair recipe
|
||||
// CraftBukkit start - Construct a dummy repair recipe
|
||||
ItemStack result = new ItemStack(itemstack.id, 1, j1);
|
||||
List<ItemStack> ingredients = new ArrayList<ItemStack>();
|
||||
ingredients.add(itemstack.cloneItemStack());
|
||||
|
@ -58,7 +58,7 @@ public class DedicatedServerConnectionThread extends Thread {
|
||||
try {
|
||||
Socket socket = this.d.accept();
|
||||
|
||||
// CraftBukkit start - connection throttle
|
||||
// CraftBukkit start - Connection throttle
|
||||
InetAddress address = socket.getInetAddress();
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
|
@ -51,7 +51,7 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
|
||||
// CraftBukkit end
|
||||
|
||||
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;
|
||||
if (--itemstack.count == 0) {
|
||||
itemstack.id = item.id;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
// CraftBukkit end
|
||||
@ -44,8 +43,8 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.isEmpty(i, j, k)) {
|
||||
// CraftBukkit - ignition by dispensing flint and steel
|
||||
if (!CraftEventFactory.callBlockIgniteEvent(world, i, j, k, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()).isCancelled()) {
|
||||
// CraftBukkit start - Ignition by dispensing flint and steel
|
||||
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);
|
||||
if (itemstack.isDamaged(1, world.random)) {
|
||||
itemstack.count = 0;
|
||||
|
@ -368,7 +368,7 @@ public abstract class Entity {
|
||||
|
||||
protected void z() {
|
||||
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) {
|
||||
Server server = this.world.getServer();
|
||||
|
||||
@ -705,8 +705,8 @@ public abstract class Entity {
|
||||
this.burn(1);
|
||||
if (!flag2) {
|
||||
++this.fireTicks;
|
||||
// CraftBukkit start - not on fire yet
|
||||
if (this.fireTicks <= 0) { // only throw events on the first combust, otherwise it spams
|
||||
// CraftBukkit start - Not on fire yet
|
||||
if (this.fireTicks <= 0) { // Only throw events on the first combust, otherwise it spams
|
||||
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
|
||||
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("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.
|
||||
if (Float.isNaN(this.yaw)) {
|
||||
this.yaw = 0;
|
||||
@ -1139,7 +1139,7 @@ public abstract class Entity {
|
||||
this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data;
|
||||
this.motY = ((NBTTagDouble) nbttaglist1.get(1)).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) {
|
||||
this.motX = 0.0D;
|
||||
}
|
||||
@ -1188,7 +1188,7 @@ public abstract class Entity {
|
||||
}
|
||||
// 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 (Math.abs(this.motX) > 10.0D) {
|
||||
this.motX = 0.0D;
|
||||
@ -1204,7 +1204,7 @@ public abstract class Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
// CraftBukkit start - reset world
|
||||
// CraftBukkit start - Reset world
|
||||
if (this instanceof EntityPlayer) {
|
||||
Server server = Bukkit.getServer();
|
||||
org.bukkit.World bworld = null;
|
||||
@ -1402,7 +1402,7 @@ public abstract class Entity {
|
||||
|
||||
public CraftEntity getBukkitEntity() {
|
||||
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;
|
||||
}
|
||||
@ -1607,7 +1607,7 @@ public abstract class Entity {
|
||||
|
||||
++this.fireTicks;
|
||||
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);
|
||||
pluginManager.callEvent(entityCombustEvent);
|
||||
if (!entityCombustEvent.isCancelled()) {
|
||||
@ -1755,11 +1755,11 @@ public abstract class Entity {
|
||||
if (!this.world.isStatic && !this.dead) {
|
||||
this.world.methodProfiler.a("changeDimension");
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
// CraftBukkit start - move logic into new function "teleportToLocation"
|
||||
// CraftBukkit start - Move logic into new function "teleportToLocation"
|
||||
// int j = this.dimension;
|
||||
WorldServer exitWorld = null;
|
||||
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)
|
||||
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)
|
||||
for (WorldServer world : minecraftserver.worlds) {
|
||||
if (world.dimension == i) {
|
||||
exitWorld = world;
|
||||
@ -1771,7 +1771,7 @@ public abstract class Entity {
|
||||
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
|
||||
|
||||
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);
|
||||
event.useTravelAgent(useTravelAgent);
|
||||
event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
@ -1794,7 +1794,7 @@ public abstract class Entity {
|
||||
this.world.kill(this);
|
||||
this.dead = false;
|
||||
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);
|
||||
boolean before = worldserver1.chunkProviderServer.forceChunkLoad;
|
||||
worldserver1.chunkProviderServer.forceChunkLoad = true;
|
||||
@ -1807,7 +1807,7 @@ public abstract class Entity {
|
||||
if (entity != null) {
|
||||
entity.a(this, true);
|
||||
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);
|
||||
entity.bukkitEntity = this.getBukkitEntity();
|
||||
// CraftBukkit end
|
||||
|
@ -231,7 +231,7 @@ public class EntityArrow extends Entity implements IProjectile {
|
||||
damagesource = DamageSource.arrow(this, this.shooter);
|
||||
}
|
||||
|
||||
// CraftBukkit start - moved damage call
|
||||
// CraftBukkit start - Moved damage call
|
||||
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
|
||||
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
|
@ -251,7 +251,7 @@ public class EntityBoat extends Entity {
|
||||
this.motX += this.passenger.motX * this.b;
|
||||
this.motZ += this.passenger.motZ * this.b;
|
||||
}
|
||||
// CraftBukkit start - block not in vanilla
|
||||
// CraftBukkit start - Support unoccupied deceleration
|
||||
else if (unoccupiedDeceleration >= 0) {
|
||||
this.motX *= unoccupiedDeceleration;
|
||||
this.motZ *= unoccupiedDeceleration;
|
||||
|
@ -88,7 +88,7 @@ public class EntityChicken extends EntityAnimal {
|
||||
}
|
||||
|
||||
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>();
|
||||
int j = this.random.nextInt(3) + this.random.nextInt(1 + i);
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class EntityCow extends EntityAnimal {
|
||||
}
|
||||
|
||||
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>();
|
||||
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();
|
||||
|
||||
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.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
|
||||
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) {
|
||||
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 start - whole method
|
||||
// CraftBukkit start - Whole method
|
||||
protected void dropDeathLoot(boolean flag, int i) {
|
||||
int j = this.getLootId();
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
|
||||
public class EntityEnderCrystal extends Entity {
|
||||
|
||||
public int a = 0;
|
||||
@ -34,7 +36,7 @@ public class EntityEnderCrystal extends Entity {
|
||||
|
||||
if (this.world.getTypeId(i, j, k) != Block.FIRE.id) {
|
||||
// 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);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -55,7 +57,7 @@ public class EntityEnderCrystal extends Entity {
|
||||
} else {
|
||||
if (!this.dead && !this.world.isStatic) {
|
||||
// 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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -363,7 +363,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
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
|
||||
if (!(entity instanceof EntityHuman)) {
|
||||
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 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>();
|
||||
org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld();
|
||||
// CraftBukkit end
|
||||
@ -431,7 +431,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
|
||||
|
||||
if (j2 != 0) {
|
||||
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 = true;
|
||||
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
|
||||
@ -445,12 +445,12 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
|
||||
}
|
||||
|
||||
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();
|
||||
EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
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.
|
||||
return flag;
|
||||
} else {
|
||||
|
@ -102,7 +102,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
|
||||
l = this.world.getTypeId(i, j, k);
|
||||
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()) {
|
||||
this.setCarriedId(this.world.getTypeId(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);
|
||||
|
||||
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()) {
|
||||
this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3);
|
||||
this.setCarriedId(0);
|
||||
@ -224,7 +224,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
}
|
||||
|
||||
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));
|
||||
this.world.getServer().getPluginManager().callEvent(teleport);
|
||||
if (teleport.isCancelled()) {
|
||||
@ -285,7 +285,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
int j = this.getLootId();
|
||||
|
||||
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>();
|
||||
int count = this.random.nextInt(2 + i);
|
||||
|
||||
|
@ -3,7 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
//CraftBukkit start
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
// CraftBukkit end
|
||||
@ -228,7 +228,7 @@ public class EntityFallingBlock extends Entity {
|
||||
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")) {
|
||||
this.tileEntityData = (NBTTagCompound) nbttagcompound.getCompound("Bukkit.tileData").clone();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public abstract class EntityFireball extends Entity {
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.height = 0.0F;
|
||||
this.motX = this.motY = this.motZ = 0.0D;
|
||||
// CraftBukkit start - (added setDirection method)
|
||||
// CraftBukkit start - Added setDirection method
|
||||
this.setDirection(d0, d1, d2);
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ public abstract class EntityFireball extends Entity {
|
||||
this.g = nbttagcompound.getShort("zTile");
|
||||
this.h = nbttagcompound.getByte("inTile") & 255;
|
||||
this.i = nbttagcompound.getByte("inGround") == 1;
|
||||
// CraftBukkit - direction -> power
|
||||
// CraftBukkit start - direction -> power
|
||||
if (nbttagcompound.hasKey("power")) {
|
||||
NBTTagList nbttaglist = nbttagcompound.getList("power");
|
||||
|
||||
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.painting.PaintingBreakEvent;
|
||||
// CraftBukkit end
|
||||
@ -216,7 +215,7 @@ public abstract class EntityHanging extends Entity {
|
||||
HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
|
||||
PaintingBreakEvent paintingEvent = 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) {
|
||||
// Fire old painting event until it can be removed
|
||||
|
@ -914,7 +914,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
|
||||
this.a(StatisticList.w, i);
|
||||
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);
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
|
||||
@ -1414,7 +1414,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
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() {
|
||||
return false;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
this.extinguish();
|
||||
} 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) {
|
||||
this.setAirTicks(maxAirTicks);
|
||||
}
|
||||
@ -422,7 +422,7 @@ public abstract class EntityLiving extends Entity {
|
||||
// CraftBukkit start
|
||||
public int getExpReward() {
|
||||
int exp = this.getExpValue(this.killer);
|
||||
|
||||
|
||||
if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) {
|
||||
return exp;
|
||||
} 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)
|
||||
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;
|
||||
while (i > 0) {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
@ -632,7 +632,7 @@ public abstract class EntityLiving extends Entity {
|
||||
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) {
|
||||
heal(i, EntityRegainHealthEvent.RegainReason.CUSTOM);
|
||||
}
|
||||
@ -923,14 +923,14 @@ public abstract class EntityLiving extends Entity {
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
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>();
|
||||
int j = this.getLootId();
|
||||
|
||||
@ -1192,6 +1192,7 @@ public abstract class EntityLiving extends Entity {
|
||||
if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
|
||||
this.maxHealth = nbttagcompound.getInt("Bukkit.MaxHealth");
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (!nbttagcompound.hasKey("Health")) {
|
||||
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.deathTicks = nbttagcompound.getShort("DeathTime");
|
||||
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");
|
||||
if (isLevelAtLeast(nbttagcompound, 1) || data) {
|
||||
this.canPickUpLoot = data;
|
||||
@ -1884,7 +1886,7 @@ public abstract class EntityLiving extends Entity {
|
||||
if (this.getGoalTarget() == null) {
|
||||
return 3;
|
||||
} 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;
|
||||
if (i < 0) {
|
||||
|
@ -34,7 +34,7 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
}
|
||||
|
||||
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>();
|
||||
int j = this.getLootId();
|
||||
|
||||
|
@ -4,13 +4,11 @@ import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class EntityMinecartAbstract extends Entity {
|
||||
@ -864,7 +862,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
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() {
|
||||
return new Vector(flyingX, flyingY, flyingZ);
|
||||
}
|
||||
|
@ -149,6 +149,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
// CraftBukkit start
|
||||
for (HumanEntity human : transaction) {
|
||||
((org.bukkit.craftbukkit.entity.CraftHumanEntity) human).getHandle().closeInventory();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b = false;
|
||||
super.c(i);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
|
||||
|
||||
if (this.passenger != entity && this.vehicle != entity) {
|
||||
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)) {
|
||||
EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this, entity, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
|
||||
|
@ -146,10 +146,11 @@ public class EntityPigZombie extends EntityZombie {
|
||||
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) {
|
||||
return new ItemStack(Item.GOLD_INGOT.id, 1, 0);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
protected int getLootId() {
|
||||
return Item.ROTTEN_FLESH.id;
|
||||
|
@ -102,7 +102,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
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) {
|
||||
super.spawnIn(world);
|
||||
if (world == null) {
|
||||
@ -366,7 +366,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
} else {
|
||||
if (this.dimension == 1 && i == 0) {
|
||||
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();
|
||||
|
||||
@ -461,7 +461,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -474,7 +474,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -487,7 +487,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -504,7 +504,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.closeInventory();
|
||||
}
|
||||
|
||||
// CraftBukkit start - inventory open hook
|
||||
// CraftBukkit start - Inventory open hook
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -517,7 +517,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -530,7 +530,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -543,7 +543,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -556,7 +556,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -569,7 +569,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -582,7 +582,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -595,7 +595,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
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));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
@ -638,7 +638,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public void a(Container container, List list) {
|
||||
this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list));
|
||||
this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
|
||||
// CraftBukkit start - send a Set Slot to update the crafting result slot
|
||||
// CraftBukkit start - Send a Set Slot to update the crafting result slot
|
||||
if (java.util.EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) {
|
||||
this.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() {
|
||||
return this.weather;
|
||||
}
|
||||
|
||||
|
||||
public void setPlayerWeather(WeatherType type, boolean plugin) {
|
||||
if (!plugin && this.weather != null) {
|
||||
return;
|
||||
@ -847,7 +847,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0));
|
||||
}
|
||||
|
||||
|
||||
public void resetPlayerWeather() {
|
||||
this.weather = null;
|
||||
this.setPlayerWeather(this.o().getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
|
||||
|
@ -107,7 +107,7 @@ public class EntityPotion extends EntityProjectile {
|
||||
MobEffect mobeffect = (MobEffect) iterator1.next();
|
||||
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()) {
|
||||
// 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;
|
||||
@ -115,7 +115,7 @@ public class EntityPotion extends EntityProjectile {
|
||||
// CraftBukkit end
|
||||
|
||||
if (MobEffectList.byId[i].isInstant()) {
|
||||
// CraftBukkit - added 'this'
|
||||
// CraftBukkit - Added 'this'
|
||||
MobEffectList.byId[i].applyInstantEffect(this.getShooter(), entityliving, mobeffect.getAmplifier(), d1, this);
|
||||
} else {
|
||||
int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
|
||||
|
@ -62,7 +62,7 @@ public class EntitySheep extends EntityAnimal {
|
||||
}
|
||||
|
||||
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>();
|
||||
|
||||
if (!this.isSheared()) {
|
||||
|
@ -144,7 +144,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
|
||||
}
|
||||
|
||||
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>();
|
||||
|
||||
if (this.getSkeletonType() == 1) {
|
||||
|
@ -1,9 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
|
||||
|
||||
public class EntitySmallFireball extends EntityFireball {
|
||||
|
||||
@ -26,7 +23,7 @@ public class EntitySmallFireball extends EntityFireball {
|
||||
if (!this.world.isStatic) {
|
||||
if (movingobjectposition.entity != null) {
|
||||
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);
|
||||
movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -67,7 +64,7 @@ public class EntitySmallFireball extends EntityFireball {
|
||||
|
||||
if (this.world.isEmpty(i, j, k)) {
|
||||
// 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);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -98,7 +98,7 @@ public class EntitySpider extends EntityMonster {
|
||||
}
|
||||
|
||||
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>();
|
||||
|
||||
int k = this.random.nextInt(3);
|
||||
|
@ -51,7 +51,7 @@ public class EntitySquid extends EntityWaterAnimal {
|
||||
}
|
||||
|
||||
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>();
|
||||
|
||||
int count = this.random.nextInt(3 + i) + 1;
|
||||
|
@ -73,13 +73,13 @@ public class EntityTrackerEntry {
|
||||
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;
|
||||
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);
|
||||
Iterator j0 = list.iterator();
|
||||
Iterator j0 = this.trackedPlayers.iterator(); // CraftBukkit
|
||||
|
||||
while (j0.hasNext()) {
|
||||
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 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) {
|
||||
this.xLoc = i;
|
||||
this.yLoc = j;
|
||||
@ -143,7 +143,7 @@ public class EntityTrackerEntry {
|
||||
}
|
||||
} else {
|
||||
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) {
|
||||
this.scanPlayers(new java.util.ArrayList(this.trackedPlayers));
|
||||
}
|
||||
@ -177,7 +177,7 @@ public class EntityTrackerEntry {
|
||||
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher1, false));
|
||||
}
|
||||
|
||||
/* CraftBukkit start - code moved up
|
||||
/* CraftBukkit start - Code moved up
|
||||
if (flag) {
|
||||
this.xLoc = i;
|
||||
this.yLoc = j;
|
||||
@ -225,7 +225,7 @@ public class EntityTrackerEntry {
|
||||
|
||||
++this.m;
|
||||
if (this.tracker.velocityChanged) {
|
||||
// CraftBukkit start - create PlayerVelocity event
|
||||
// CraftBukkit start - Create PlayerVelocity event
|
||||
boolean cancelled = false;
|
||||
|
||||
if (this.tracker instanceof EntityPlayer) {
|
||||
@ -375,7 +375,7 @@ public class EntityTrackerEntry {
|
||||
|
||||
private Packet b() {
|
||||
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");
|
||||
return null;
|
||||
// CraftBukkit end
|
||||
|
@ -3,7 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -183,7 +183,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
|
||||
this.t(i);
|
||||
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 {
|
||||
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) {
|
||||
// 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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -408,7 +408,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
// CraftBukkit start
|
||||
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));
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
CraftEventFactory.callEntityDeathEvent(this, loot);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
|
||||
public class EntityWitherSkull extends EntityFireball {
|
||||
|
||||
@ -40,7 +37,7 @@ public class EntityWitherSkull extends EntityFireball {
|
||||
if (movingobjectposition.entity != null) {
|
||||
if (this.shooter != null) {
|
||||
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 {
|
||||
movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5);
|
||||
|
@ -171,7 +171,7 @@ public class EntityZombie extends EntityMonster {
|
||||
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) {
|
||||
switch (this.random.nextInt(3)) {
|
||||
case 0:
|
||||
|
@ -131,7 +131,7 @@ public class Explosion {
|
||||
double d9 = (double) this.world.a(vec3d, entity.boundingBox);
|
||||
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();
|
||||
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);
|
||||
|
||||
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()) {
|
||||
this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
|
||||
} // CraftBukkit end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit
|
||||
|
||||
public class FoodMetaData {
|
||||
|
||||
// CraftBukkit start - all made public
|
||||
// CraftBukkit start - All made public
|
||||
public int foodLevel = 20;
|
||||
public float saturationLevel = 5.0F;
|
||||
public float exhaustionLevel;
|
||||
|
@ -56,7 +56,7 @@ public class ItemBlock extends Item {
|
||||
int j1 = this.filterData(itemstack.getData());
|
||||
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.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) {
|
||||
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class ItemDye extends Item {
|
||||
} else {
|
||||
if (!world.isStatic) {
|
||||
if ((double) world.random.nextFloat() < 0.4D) {
|
||||
// CraftBukkit start - validate
|
||||
// CraftBukkit start - Validate
|
||||
Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
|
||||
((BlockMushroom) Block.byId[l]).grow(world, i, j, k, world.random, true, player, itemstack);
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.entity.Fish;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
|
||||
|
||||
public class ItemFishingRod extends Item {
|
||||
|
||||
@ -23,7 +20,7 @@ public class ItemFishingRod extends Item {
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
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);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
|
@ -1,6 +1,9 @@
|
||||
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 {
|
||||
|
||||
@ -44,8 +47,8 @@ public class ItemFlintAndSteel extends Item {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == 0) {
|
||||
// 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()) {
|
||||
// CraftBukkit start - Store the clicked block
|
||||
if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
|
||||
itemstack.damage(1, entityhuman);
|
||||
return false;
|
||||
}
|
||||
@ -57,7 +60,7 @@ public class ItemFlintAndSteel extends Item {
|
||||
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
|
||||
|
||||
// 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()) {
|
||||
placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false);
|
||||
|
@ -50,7 +50,7 @@ public class ItemReed extends Item {
|
||||
Block block = Block.byId[this.id];
|
||||
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);
|
||||
/*
|
||||
if (world.setTypeIdAndData(i, j, k, this.id, j1, 3)) {
|
||||
|
@ -20,7 +20,7 @@ public class ItemSeeds extends Item {
|
||||
int i1 = world.getTypeId(i, j, 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);
|
||||
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.id, 0, clickedX, clickedY, clickedZ)) {
|
||||
return false;
|
||||
|
@ -44,7 +44,7 @@ public class ItemSkull extends Item {
|
||||
} else if (!Block.SKULL.canPlace(world, i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
// CraftBukkit start - handle in ItemBlock
|
||||
// CraftBukkit start - Handle in ItemBlock
|
||||
// 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)) {
|
||||
return false;
|
||||
|
@ -20,7 +20,7 @@ public class ItemSnow extends ItemBlockWithAuxData {
|
||||
int j1 = world.getData(i, j, k);
|
||||
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)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public final class ItemStack {
|
||||
this.f = null;
|
||||
this.id = i;
|
||||
this.count = j;
|
||||
// CraftBukkit start - pass to setData to do filtering
|
||||
// CraftBukkit start - Pass to setData to do filtering
|
||||
this.setData(k);
|
||||
//if (this.damage < 0) {
|
||||
// this.damage = 0;
|
||||
@ -151,7 +151,7 @@ public final class ItemStack {
|
||||
}
|
||||
|
||||
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
|
||||
if (i == 32767) {
|
||||
this.damage = i;
|
||||
|
@ -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)) {
|
||||
// CraftBukkit start - waterlily
|
||||
// CraftBukkit start
|
||||
// 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)) {
|
||||
return itemstack;
|
||||
|
@ -7,7 +7,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
// CraftBukkit start - strip down to empty
|
||||
// CraftBukkit start - Strip down to empty methods, performance cost
|
||||
public class MethodProfiler {
|
||||
public boolean a = false;
|
||||
|
||||
|
@ -13,10 +13,8 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import jline.console.ConsoleReader;
|
||||
import joptsimple.OptionSet;
|
||||
|
||||
@ -106,7 +104,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
org.bukkit.craftbukkit.Main.useJline = false;
|
||||
this.reader = new ConsoleReader(System.in, System.out);
|
||||
this.reader.setExpandEvents(false);
|
||||
} catch (java.io.IOException ex) {
|
||||
} catch (IOException 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.c("menu.loadingLevel");
|
||||
this.worldServer = new WorldServer[3];
|
||||
// CraftBukkit - removed ticktime arrays
|
||||
// CraftBukkit - Removed ticktime arrays
|
||||
IDataManager idatamanager = this.convertable.a(s, true);
|
||||
WorldData worlddata = idatamanager.getWorldData();
|
||||
// CraftBukkit start - removed worldsettings
|
||||
// CraftBukkit start - Removed worldsettings
|
||||
int worldCount = 3;
|
||||
|
||||
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);
|
||||
// Migrate world data too.
|
||||
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) {
|
||||
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.saveChunks(false);
|
||||
|
||||
/* CraftBukkit start - handled in saveChunks
|
||||
/* CraftBukkit start - Handled in saveChunks
|
||||
for (int i = 0; i < this.worldServer.length; ++i) {
|
||||
WorldServer worldserver = this.worldServer[i];
|
||||
|
||||
@ -442,7 +440,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
} catch (Throwable throwable1) {
|
||||
throwable1.printStackTrace();
|
||||
} finally {
|
||||
// CraftBukkit start - restore terminal to original settings
|
||||
// CraftBukkit start - Restore terminal to original settings
|
||||
try {
|
||||
this.reader.getTerminal().restore();
|
||||
} catch (Exception e) {
|
||||
@ -508,7 +506,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
public void r() {
|
||||
this.methodProfiler.a("levels");
|
||||
|
||||
// CraftBukkit start - only send timeupdates to the people in that world
|
||||
// CraftBukkit start
|
||||
this.server.getScheduler().mainThreadHeartbeat(this.ticks);
|
||||
|
||||
// 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();
|
||||
|
||||
// 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) {
|
||||
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
||||
@ -602,7 +600,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
IConsoleLogManager iconsolelogmanager = null;
|
||||
|
||||
try {
|
||||
/* CraftBukkit start - replace everything
|
||||
/* CraftBukkit start - Replace everything
|
||||
boolean flag = false;
|
||||
String s = null;
|
||||
String s1 = ".";
|
||||
@ -762,7 +760,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
public String getPlugins() {
|
||||
// CraftBukkit start - whole method
|
||||
// CraftBukkit start - Whole method
|
||||
StringBuilder result = new StringBuilder();
|
||||
org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins();
|
||||
|
||||
@ -806,7 +804,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
processQueue.add(waitable);
|
||||
try {
|
||||
return waitable.get();
|
||||
} catch (ExecutionException e) {
|
||||
} catch (java.util.concurrent.ExecutionException e) {
|
||||
throw new RuntimeException("Exception processing rcon command " + s, e.getCause());
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt(); // Maintain interrupted state
|
||||
|
@ -114,7 +114,7 @@ public class MobEffectList {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public abstract class Packet {
|
||||
public static long q;
|
||||
public static long r;
|
||||
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;
|
||||
|
||||
public Packet() {
|
||||
|
@ -24,7 +24,7 @@ public class Packet20NamedEntitySpawn extends Packet {
|
||||
public Packet20NamedEntitySpawn(EntityHuman entityhuman) {
|
||||
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) {
|
||||
this.b = entityhuman.name.substring(0, 16);
|
||||
} else {
|
||||
|
@ -22,7 +22,7 @@ public class Packet3Chat extends Packet {
|
||||
public Packet3Chat(String s, boolean flag) {
|
||||
this.c = true;
|
||||
|
||||
/* CraftBukkit start - handle this later
|
||||
/* CraftBukkit start - Handle this later
|
||||
if (s.length() > b) {
|
||||
s = s.substring(0, b);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class Packet56MapChunkBulk extends Packet {
|
||||
this.inflatedBuffers[k] = chunkmap.a;
|
||||
}
|
||||
|
||||
/* CraftBukkit start - moved to compress()
|
||||
/* CraftBukkit start - Moved to compress()
|
||||
Deflater deflater = new Deflater(-1);
|
||||
|
||||
try {
|
||||
|
@ -1,6 +1,9 @@
|
||||
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 {
|
||||
|
||||
@ -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;
|
||||
|
||||
if (this instanceof PathfinderGoalDefendVillage) {
|
||||
@ -121,10 +124,10 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
|
||||
this.d.setGoalTarget(null);
|
||||
return false;
|
||||
} 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) {
|
||||
((EntityCreature) this.d).target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
((EntityCreature) this.d).target = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -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());
|
||||
|
||||
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() };
|
||||
|
||||
for (Object object : list) {
|
||||
|
@ -26,6 +26,7 @@ class PlayerChunk {
|
||||
PlayerChunk.this.loaded = true;
|
||||
}
|
||||
});
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument
|
||||
|
@ -6,7 +6,6 @@ import java.util.List;
|
||||
// CraftBukkit start
|
||||
import java.util.Collections;
|
||||
import java.util.Queue;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -36,8 +35,8 @@ public class PlayerChunkMap {
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
// CraftBukkit start - use iterator
|
||||
Iterator iterator = this.d.iterator();
|
||||
// CraftBukkit start - Use iterator
|
||||
java.util.Iterator iterator = this.d.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
PlayerChunk playerinstance = (PlayerChunk) iterator.next();
|
||||
@ -46,9 +45,9 @@ public class PlayerChunkMap {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
// this.d.clear(); // CraftBukkit - removals are already covered
|
||||
// this.d.clear(); // CraftBukkit - Removals are already covered
|
||||
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;
|
||||
|
||||
if (!worldprovider.e()) {
|
||||
@ -100,7 +99,7 @@ public class PlayerChunkMap {
|
||||
entityplayer.d = entityplayer.locX;
|
||||
entityplayer.e = entityplayer.locZ;
|
||||
|
||||
// CraftBukkit start - load nearby chunks first
|
||||
// CraftBukkit start - Load nearby chunks first
|
||||
List<ChunkCoordIntPair> chunkList = new LinkedList<ChunkCoordIntPair>();
|
||||
for (int k = i - this.e; k <= i + this.e; ++k) {
|
||||
for (int l = j - this.e; l <= j + this.e; ++l) {
|
||||
@ -258,7 +257,7 @@ public class PlayerChunkMap {
|
||||
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 int x;
|
||||
private int z;
|
||||
|
@ -12,22 +12,23 @@ import java.util.concurrent.Callable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
import java.util.logging.Level;
|
||||
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.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.block.Action;
|
||||
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.PlayerAnimationEvent;
|
||||
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.PlayerMoveEvent;
|
||||
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.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.InventoryView;
|
||||
// CraftBukkit end
|
||||
@ -688,10 +685,10 @@ public class PlayerConnection extends Connection {
|
||||
}
|
||||
|
||||
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);
|
||||
// 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);
|
||||
if ((quitMessage != null) && (quitMessage.length() > 0)) {
|
||||
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
|
||||
if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
|
||||
// CraftBukkit start
|
||||
if (packet3chat.a_()) {
|
||||
Waitable waitable = new Waitable() {
|
||||
@Override
|
||||
@ -867,7 +863,6 @@ public class PlayerConnection extends Connection {
|
||||
} else {
|
||||
this.disconnect("disconnect.spam");
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -900,7 +895,7 @@ public class PlayerConnection extends Connection {
|
||||
Waitable waitable = new Waitable() {
|
||||
@Override
|
||||
protected Object evaluate() {
|
||||
Bukkit.getPluginManager().callEvent(queueEvent);
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent);
|
||||
|
||||
if (queueEvent.isCancelled()) {
|
||||
return null;
|
||||
@ -973,7 +968,7 @@ public class PlayerConnection extends Connection {
|
||||
}
|
||||
} catch (org.bukkit.command.CommandException ex) {
|
||||
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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -987,7 +982,7 @@ public class PlayerConnection extends Connection {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
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 f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f;
|
||||
float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f;
|
||||
@ -1092,7 +1087,7 @@ public class PlayerConnection extends Connection {
|
||||
}
|
||||
// CraftBukkit end
|
||||
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) {
|
||||
this.player.updateInventory(this.player.activeContainer);
|
||||
}
|
||||
@ -1118,7 +1113,7 @@ public class PlayerConnection extends Connection {
|
||||
public void a(Packet205ClientCommand packet205clientcommand) {
|
||||
if (packet205clientcommand.a == 1) {
|
||||
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()) {
|
||||
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!");
|
||||
@ -1149,7 +1144,7 @@ public class PlayerConnection extends Connection {
|
||||
public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
// CraftBukkit start - INVENTORY_CLOSE hook
|
||||
// CraftBukkit start
|
||||
InventoryCloseEvent event = new InventoryCloseEvent(this.player.activeContainer.getBukkitView());
|
||||
server.getPluginManager().callEvent(event);
|
||||
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.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
|
||||
// CraftBukkit start - fire InventoryClickEvent
|
||||
// CraftBukkit start - Call InventoryClickEvent
|
||||
if (packet102windowclick.slot == -1) {
|
||||
// Vanilla doesn't do anything with this, neither should we
|
||||
return;
|
||||
@ -1176,7 +1171,7 @@ public class PlayerConnection extends Connection {
|
||||
if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) {
|
||||
org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe();
|
||||
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);
|
||||
@ -1231,7 +1226,7 @@ public class PlayerConnection extends Connection {
|
||||
|
||||
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) {
|
||||
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 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();
|
||||
InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer);
|
||||
SlotType slot = SlotType.QUICKBAR;
|
||||
@ -1441,7 +1436,7 @@ public class PlayerConnection extends Connection {
|
||||
ItemStack itemstack;
|
||||
ItemStack itemstack1;
|
||||
|
||||
// CraftBukkit start - ignore empty payloads
|
||||
// CraftBukkit start - Ignore empty payloads
|
||||
if (packet250custompayload.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -32,12 +32,6 @@ public class PlayerInteractManager {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
// CraftBukkit start - keep this for backwards compatibility
|
||||
public PlayerInteractManager(WorldServer world) {
|
||||
this((World) world);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public void setGameMode(EnumGamemode enumgamemode) {
|
||||
this.gamemode = enumgamemode;
|
||||
enumgamemode.a(this.player.abilities);
|
||||
@ -216,9 +210,9 @@ public class PlayerInteractManager {
|
||||
this.n = this.lastDigTick;
|
||||
}
|
||||
}
|
||||
// CraftBukkit start - force blockreset to client
|
||||
// CraftBukkit start - Force block reset to client
|
||||
} 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
|
||||
}
|
||||
}
|
||||
@ -298,10 +292,10 @@ public class PlayerInteractManager {
|
||||
return false;
|
||||
} else {
|
||||
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);
|
||||
|
||||
// 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()) {
|
||||
Block.SKULL.dropNaturally(world, i, j, k, i1, 1.0F, 0);
|
||||
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) {
|
||||
Block.byId[l].j(this.world, i, j, k, event.getExpToDrop());
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class PlayerInventory implements IInventory {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// CraftBukkit start - watch method above! :D
|
||||
// CraftBukkit start - Watch method above! :D
|
||||
public int canHold(ItemStack itemstack) {
|
||||
int remains = itemstack.count;
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
|
@ -13,23 +13,22 @@ import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.TravelAgent;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
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.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerPortalEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.bukkit.Bukkit;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class PlayerList {
|
||||
@ -214,7 +213,7 @@ public abstract class PlayerList {
|
||||
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount());
|
||||
// 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)) {
|
||||
worldserver.addEntity(entityplayer);
|
||||
this.a(entityplayer, (WorldServer) null);
|
||||
@ -250,7 +249,7 @@ public abstract class PlayerList {
|
||||
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
|
||||
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.");
|
||||
this.cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
||||
@ -450,7 +449,7 @@ public abstract class PlayerList {
|
||||
worldserver.getPlayerChunkMap().addPlayer(entityplayer1);
|
||||
worldserver.addEntity(entityplayer1);
|
||||
this.players.add(entityplayer1);
|
||||
// CraftBukkit start - added from changeDimension
|
||||
// CraftBukkit start - Added from changeDimension
|
||||
this.updateClient(entityplayer1); // CraftBukkit
|
||||
entityplayer1.updateAbilities();
|
||||
Iterator iterator = entityplayer1.getEffects().iterator();
|
||||
@ -464,7 +463,7 @@ public abstract class PlayerList {
|
||||
// CraftBukkit end
|
||||
entityplayer1.setHealth(entityplayer1.getHealth());
|
||||
|
||||
// CraftBukkit start - don't fire on respawn
|
||||
// CraftBukkit start - Don't fire on respawn
|
||||
if (fromWorld != location.getWorld()) {
|
||||
PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
@ -492,7 +491,7 @@ public abstract class PlayerList {
|
||||
if (exitWorld != null) {
|
||||
if ((cause == TeleportCause.END_PORTAL) && (i == 0)) {
|
||||
// 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) {
|
||||
exit = exitWorld.getWorld().getSpawnLocation();
|
||||
}
|
||||
@ -531,12 +530,12 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
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);
|
||||
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) {
|
||||
WorldServer worldserver = ((CraftWorld) enter.getWorld()).getHandle();
|
||||
WorldServer worldserver1 = ((CraftWorld) target.getWorld()).getHandle();
|
||||
@ -707,7 +706,7 @@ public abstract class PlayerList {
|
||||
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()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n);
|
||||
|
||||
@ -976,7 +975,7 @@ public abstract class PlayerList {
|
||||
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,14 +30,14 @@ public class PortalTravelAgent {
|
||||
this.b(entity, d0, d1, d2, f);
|
||||
}
|
||||
} else {
|
||||
// CraftBukkit start - modularize end portal creation
|
||||
// CraftBukkit start - Modularize end portal creation
|
||||
ChunkCoordinates created = this.createEndPortal(d0, d1, d2);
|
||||
entity.setPositionRotation((double) created.x, (double) created.y, (double) created.z, entity.yaw, 0.0F);
|
||||
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) {
|
||||
int i = MathHelper.floor(x);
|
||||
int j = MathHelper.floor(y) - 1;
|
||||
@ -90,7 +90,7 @@ public class PortalTravelAgent {
|
||||
// CraftBukkit end
|
||||
|
||||
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);
|
||||
if (found == null) {
|
||||
return false;
|
||||
@ -166,13 +166,13 @@ public class PortalTravelAgent {
|
||||
this.c.put(j1, new ChunkCoordinatesPortal(this, i, j, k, this.a.getTime()));
|
||||
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);
|
||||
} else {
|
||||
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) {
|
||||
Location from = position.clone();
|
||||
Vector before = velocity.clone();
|
||||
@ -279,7 +279,7 @@ public class PortalTravelAgent {
|
||||
double d11 = velocity.getZ();
|
||||
// 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.setZ(d10 * (double) f5 + d11 * (double) f4);
|
||||
f = f - (float) (k2 * 90) + (float) (j2 * 90);
|
||||
@ -319,7 +319,7 @@ public class PortalTravelAgent {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
|
||||
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() {
|
||||
super(new ItemStack(Item.LEATHER_HELMET, 0, 0), java.util.Arrays.asList(new ItemStack(Item.INK_SACK, 0, 5)));
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
|
||||
|
||||
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() {
|
||||
super(new ItemStack(Item.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Item.SULPHUR, 0, 5)));
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
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() {
|
||||
super(new ItemStack(Item.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Item.MAP_EMPTY, 0, 0)));
|
||||
}
|
||||
|
@ -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) {
|
||||
if (this.d(i, j)) {
|
||||
return false;
|
||||
|
@ -68,7 +68,7 @@ public final class SpawnerCreature {
|
||||
for (int j1 = 0; j1 < j; ++j1) {
|
||||
EnumCreatureType enumcreaturetype = aenumcreaturetype[j1];
|
||||
|
||||
// CraftBukkit start - use per-world spawn limits
|
||||
// CraftBukkit start - Use per-world spawn limits
|
||||
int limit = enumcreaturetype.b();
|
||||
switch (enumcreaturetype) {
|
||||
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);
|
||||
if (entityliving.canSpawn()) {
|
||||
++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);
|
||||
worldserver.addEntity(entityliving, SpawnReason.NATURAL);
|
||||
// CraftBukkit end
|
||||
@ -236,7 +236,7 @@ public final class SpawnerCreature {
|
||||
}
|
||||
|
||||
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);
|
||||
world.addEntity(entityliving, SpawnReason.CHUNK_GEN);
|
||||
// CraftBukkit end
|
||||
|
@ -133,11 +133,11 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
|
||||
if (this.l()) {
|
||||
ItemStack itemstack = this.items[3];
|
||||
|
||||
// CraftBukkit start - fire BREW event
|
||||
// CraftBukkit start
|
||||
if (getOwner() != null) {
|
||||
BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(x, y, z), (org.bukkit.inventory.BrewerInventory) this.getOwner().getInventory());
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
if(event.isCancelled()) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import com.google.common.base.Joiner;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -31,7 +30,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
|
||||
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();
|
||||
Joiner joiner = Joiner.on(" ");
|
||||
String command = this.b;
|
||||
@ -41,19 +40,19 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
String[] args = command.split(" ");
|
||||
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") ||
|
||||
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")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// make sure this is a valid command
|
||||
// Make sure this is a valid command
|
||||
if (commandMap.getCommand(args[0]) == null) {
|
||||
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()) {
|
||||
return 0;
|
||||
}
|
||||
@ -80,7 +79,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
|
||||
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[]>();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (PlayerSelector.isPattern(args[i])) {
|
||||
@ -96,10 +95,10 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
|
||||
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++) {
|
||||
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++;
|
||||
}
|
||||
} catch (Throwable exception) {
|
||||
|
@ -188,7 +188,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
|
||||
}
|
||||
|
||||
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 <=
|
||||
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()) {
|
||||
++this.cookTime;
|
||||
if (this.cookTime == 200) {
|
||||
|
@ -202,7 +202,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
for (int i = 0; i < this.getSize(); ++i) {
|
||||
if (this.getItem(i) != null) {
|
||||
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));
|
||||
|
||||
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);
|
||||
if (event.isCancelled()) {
|
||||
this.setItem(i, itemstack);
|
||||
this.c(8); // delay hopper checks
|
||||
this.c(8); // Delay hopper checks
|
||||
return false;
|
||||
}
|
||||
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)) {
|
||||
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));
|
||||
|
||||
Inventory sourceInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null;
|
||||
@ -284,9 +284,9 @@ public class TileEntityHopper extends TileEntity implements IHopper {
|
||||
iinventory.setItem(i, itemstack1);
|
||||
|
||||
if (ihopper instanceof TileEntityHopper) {
|
||||
((TileEntityHopper) ihopper).c(8); // delay hopper checks
|
||||
((TileEntityHopper) ihopper).c(8); // Delay hopper checks
|
||||
} else if (ihopper instanceof EntityMinecartHopper) {
|
||||
((EntityMinecartHopper) ihopper).n(4); // delay hopper minecart checks
|
||||
((EntityMinecartHopper) ihopper).n(4); // Delay hopper minecart checks
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -4,7 +4,7 @@ public class TileEntitySign extends TileEntity {
|
||||
|
||||
public String[] lines = new String[] { "", "", "", ""};
|
||||
public int b = -1;
|
||||
public boolean isEditable = true; // CraftBukkit - privite -> public
|
||||
public boolean isEditable = true; // CraftBukkit - private -> public
|
||||
|
||||
public TileEntitySign() {}
|
||||
|
||||
@ -31,7 +31,7 @@ public class TileEntitySign extends TileEntity {
|
||||
public Packet getUpdatePacket() {
|
||||
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) {
|
||||
astring[i] = this.lines[i];
|
||||
|
||||
|
@ -24,8 +24,8 @@ public class Vec3DPool {
|
||||
this.b = j;
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
Vec3D vec3d;
|
||||
|
||||
if (this.freelist == null) { // CraftBukkit
|
||||
@ -43,14 +43,14 @@ public class Vec3DPool {
|
||||
if (this.alloclist == null) {
|
||||
this.alloclisthead = vec3d;
|
||||
}
|
||||
vec3d.next = this.alloclist; // add to allocated list
|
||||
vec3d.next = this.alloclist; // Add to allocated list
|
||||
this.alloclist = vec3d;
|
||||
// CraftBukkit end
|
||||
++this.position;
|
||||
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) {
|
||||
if (this.alloclist == v) {
|
||||
this.alloclist = v.next; // Pop off alloc list
|
||||
@ -68,7 +68,7 @@ public class Vec3DPool {
|
||||
this.largestSize = this.position;
|
||||
}
|
||||
|
||||
// CraftBukkit start - intelligent cache
|
||||
// CraftBukkit start - Intelligent cache
|
||||
// Take any allocated blocks and put them on free list
|
||||
if (this.alloclist != null) {
|
||||
if (this.freelist == null) {
|
||||
|
@ -892,7 +892,7 @@ public abstract class World implements IBlockAccess {
|
||||
return true;
|
||||
}
|
||||
|
||||
// CraftBukkit start - used for entities other than creatures
|
||||
// CraftBukkit start - Used for entities other than creatures
|
||||
public boolean addEntity(Entity entity) {
|
||||
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) {
|
||||
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) {
|
||||
continue;
|
||||
}
|
||||
@ -1203,7 +1203,7 @@ public abstract class World implements IBlockAccess {
|
||||
for (i = 0; i < this.entityList.size(); ++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;
|
||||
if (chunkProviderServer.unloadQueue.contains(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4)) {
|
||||
continue;
|
||||
@ -1253,7 +1253,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
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;
|
||||
if (chunkProviderServer.unloadQueue.contains(tileentity.x >> 4, tileentity.z >> 4)) {
|
||||
continue;
|
||||
@ -1295,7 +1295,7 @@ public abstract class World implements IBlockAccess {
|
||||
TileEntity tileentity1 = (TileEntity) this.a.get(l);
|
||||
|
||||
if (!tileentity1.r()) {
|
||||
/* CraftBukkit start - order matters, moved down
|
||||
/* CraftBukkit start - Order matters, moved down
|
||||
if (!this.tileEntityList.contains(tileentity1)) {
|
||||
this.tileEntityList.add(tileentity1);
|
||||
}
|
||||
@ -1306,7 +1306,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
if (chunk1 != null) {
|
||||
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)) {
|
||||
this.tileEntityList.add(tileentity1);
|
||||
}
|
||||
@ -1963,7 +1963,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
for (int l = -b0; l <= b0; ++l) {
|
||||
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;
|
||||
if (chunkProviderServer.unloadQueue.contains(l + j, i1 + k)) {
|
||||
continue;
|
||||
@ -2517,7 +2517,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
|
||||
// CraftBukkit start - fixed an NPE
|
||||
// CraftBukkit start - Fixed an NPE
|
||||
if (entityhuman1 == null || entityhuman1.dead) {
|
||||
continue;
|
||||
}
|
||||
@ -2543,7 +2543,7 @@ public abstract class World implements IBlockAccess {
|
||||
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
|
||||
// CraftBukkit start - fixed an NPE
|
||||
// CraftBukkit start - Fixed an NPE
|
||||
if (entityhuman1 == null || entityhuman1.dead) {
|
||||
continue;
|
||||
}
|
||||
|
@ -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) {
|
||||
// CraftBukkit start - moved to generate
|
||||
// CraftBukkit start - Moved to generate
|
||||
// sk: The idea is to have (our) WorldServer implement
|
||||
// BlockChangeDelegate and then we can implicitly cast World to
|
||||
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
|
||||
|
@ -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) {
|
||||
// CraftBukkit start - moved to generate
|
||||
// CraftBukkit start - Moved to generate
|
||||
return this.generate((BlockChangeDelegate) world, random, i, j, k);
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user