mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-09 06:50:32 +08:00
Massive renaming update in nms. If you bypassed Bukkit, you will likely break.
Also minimized all the nms diffs and generic cleanups all around.
This commit is contained in:
parent
9e5dba8306
commit
a98c7ba2c7
2
pom.xml
2
pom.xml
@ -39,7 +39,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.6.6</version>
|
||||
<version>1.6.6_01</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -1,10 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockBloodStone extends Block {
|
||||
|
||||
@ -15,13 +11,11 @@ public class BlockBloodStone extends Block {
|
||||
// CraftBukkit start
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int power = block.getBlockPower();
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, power, power);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockButton extends Block {
|
||||
|
||||
@ -139,14 +134,13 @@ public class BlockButton extends Block {
|
||||
return true;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||
return true;
|
||||
}
|
||||
@ -222,12 +216,10 @@ public class BlockButton extends Block {
|
||||
|
||||
if ((l & 8) != 0) {
|
||||
// CraftBukkit start
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
if (eventRedstone.getNewCurrent() > 0) return;
|
||||
// CraftBukkit end
|
||||
|
@ -1,10 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
// CraftBukkit end
|
||||
|
||||
import java.util.Random;
|
||||
@ -85,14 +83,11 @@ public class BlockCactus extends Block {
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
|
||||
if (entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block damager = world.getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT;
|
||||
int damageDone = 1;
|
||||
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.CONTACT, 1);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
entity.damageEntity((Entity) null, event.getDamage());
|
||||
@ -100,6 +95,7 @@ public class BlockCactus extends Block {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entity.damageEntity((Entity) null, 1);
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockDispenseEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
// CraftBukkit end
|
||||
@ -123,19 +117,18 @@ public class BlockDispenser extends BlockContainer {
|
||||
motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.inventory.ItemStack bukkitItem = (new CraftItemStack(itemstack)).clone();
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
|
||||
server.getPluginManager().callEvent(event);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Actually remove the item
|
||||
tileentitydispenser.a(dispenseSlot, 1);
|
||||
tileentitydispenser.splitStack(dispenseSlot, 1);
|
||||
|
||||
motX = event.getVelocity().getX();
|
||||
motY = event.getVelocity().getY();
|
||||
@ -148,7 +141,7 @@ public class BlockDispenser extends BlockContainer {
|
||||
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
|
||||
|
||||
entityarrow.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
||||
entityarrow.a = true;
|
||||
entityarrow.fromPlayer = true;
|
||||
world.addEntity(entityarrow);
|
||||
world.e(1002, i, j, k, 0);
|
||||
} else if (itemstack.id == Item.EGG.id) {
|
||||
@ -167,7 +160,6 @@ public class BlockDispenser extends BlockContainer {
|
||||
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||
// CraftBukkit start
|
||||
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
|
||||
|
||||
entityitem.motX = motX;
|
||||
entityitem.motY = motY;
|
||||
entityitem.motZ = motZ;
|
||||
|
@ -2,11 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
@ -170,16 +166,16 @@ public class BlockDoor extends Block {
|
||||
boolean flag1 = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block blockTop = craftWorld.getBlockAt(i, j + 1, k);
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block blockTop = bworld.getBlockAt(i, j + 1, k);
|
||||
|
||||
int power = block.getBlockPower();
|
||||
int powerTop = blockTop.getBlockPower();
|
||||
if (powerTop > power) power = powerTop;
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15 : 0, power);
|
||||
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15 : 0, power);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
// CraftBukkit end
|
||||
|
@ -3,11 +3,8 @@ package net.minecraft.server;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -90,11 +87,10 @@ public class BlockFire extends Block {
|
||||
this.a(world, i, j, k + 1, 300, random, l);
|
||||
|
||||
// CraftBukkit start - Call to stop spread of fire.
|
||||
Server server = ((WorldServer) world).getServer();
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
org.bukkit.Server server = world.getServer();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||
Player thePlayer = null;
|
||||
// CraftBukkit
|
||||
|
||||
for (int i1 = i - 1; i1 <= i + 1; ++i1) {
|
||||
@ -119,11 +115,12 @@ public class BlockFire extends Block {
|
||||
k2 = 15;
|
||||
}
|
||||
// CraftBukkit start - Call to stop spread of fire.
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i1, k1, j1);
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i1, k1, j1);
|
||||
|
||||
if (theBlock.getTypeId() != Block.FIRE.id) {
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||
if (block.getTypeId() != Block.FIRE.id) {
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(block, igniteCause, null);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
@ -147,11 +144,11 @@ public class BlockFire extends Block {
|
||||
if (random.nextInt(l) < j1) {
|
||||
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
||||
// CraftBukkit start
|
||||
Server server = ((WorldServer) world).getServer();
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
BlockBurnEvent event = new BlockBurnEvent(theBlock);
|
||||
server.getPluginManager().callEvent(event);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -4,9 +4,6 @@ import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -30,9 +27,9 @@ public class BlockFlowing extends BlockFluids {
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
// CraftBukkit start
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftBlock source = cworld == null ? null : (CraftBlock) cworld.getBlockAt(i, j, k);
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.Server server = world.getServer();
|
||||
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
|
||||
// CraftBukkit end
|
||||
|
||||
int l = this.g(world, i, j, k);
|
||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockFadeEvent; // CraftBukkit
|
||||
|
||||
public class BlockIce extends BlockBreakable {
|
||||
|
||||
@ -32,13 +27,12 @@ public class BlockIce extends BlockBreakable {
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.q[this.id]) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = world.getServer();
|
||||
CraftWorld cworld = world.getWorld();
|
||||
BlockState blockState = cworld.getBlockAt(i, j, k).getState();
|
||||
org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(i, j, k).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
|
||||
BlockFadeEvent event = new BlockFadeEvent(cworld.getBlockAt(i, j, k), blockState);
|
||||
server.getPluginManager().callEvent(event);
|
||||
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -2,11 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
|
||||
|
||||
public class BlockLeaves extends BlockLeavesBase {
|
||||
|
||||
@ -124,10 +120,8 @@ public class BlockLeaves extends BlockLeavesBase {
|
||||
|
||||
private void g(World world, int i, int j, int k) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
LeavesDecayEvent event = new LeavesDecayEvent(cworld.getBlockAt(i, j, k));
|
||||
server.getPluginManager().callEvent(event);
|
||||
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) return;
|
||||
// CraftBukkit end
|
||||
|
@ -1,11 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockLever extends Block {
|
||||
|
||||
@ -144,14 +139,12 @@ public class BlockLever extends Block {
|
||||
int j1 = 8 - (l & 8);
|
||||
|
||||
// CraftBukkit start - Interact Lever
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int old = (j1 != 8) ? 1 : 0;
|
||||
int current = (j1 == 8) ? 1 : 0;
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||
return true;
|
||||
|
@ -3,16 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
|
||||
@ -69,12 +60,10 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||
|
||||
// CraftBukkit start
|
||||
if (flag != flag1) {
|
||||
CraftServer server = world.getServer();
|
||||
CraftWorld craftWorld = world.getWorld();
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
}
|
||||
|
@ -2,13 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockSpreadEvent; // CraftBukkit
|
||||
|
||||
public class BlockMushroom extends BlockFlower {
|
||||
|
||||
@ -32,14 +26,12 @@ public class BlockMushroom extends BlockFlower {
|
||||
k1 = k + (random.nextInt(3) - 1);
|
||||
if (world.isEmpty(l, i1, j1) && this.f(world, l, i1, j1)) {
|
||||
// CraftBukkit start
|
||||
Server server = world.getServer();
|
||||
CraftWorld craftworld = world.getWorld();
|
||||
BlockState blockState = craftworld.getBlockAt(l, i1, j1).getState();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(l, i1, j1).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(craftworld.getBlockAt(l, i1, j1), craftworld.getBlockAt(i, j, k), blockState);
|
||||
|
||||
server.getPluginManager().callEvent(event);
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
blockState.update(true);
|
||||
|
@ -3,10 +3,6 @@ package net.minecraft.server;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
import org.bukkit.event.world.PortalCreateEvent;
|
||||
// CraftBukkit end
|
||||
@ -60,8 +56,8 @@ public class BlockPortal extends BlockBreakable {
|
||||
return false;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
java.util.ArrayList<org.bukkit.block.Block> blocks = new ArrayList<org.bukkit.block.Block>();
|
||||
CraftWorld craftWorld = world.getWorld();
|
||||
java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
// CraftBukkit end
|
||||
|
||||
if (world.getTypeId(i - b0, j, k - b1) == 0) {
|
||||
@ -83,12 +79,7 @@ public class BlockPortal extends BlockBreakable {
|
||||
if (j1 != Block.OBSIDIAN.id) {
|
||||
return false;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i + b0 * l, j + i1, k + b1 * l);
|
||||
if (!blocks.contains(b)) {
|
||||
blocks.add(b);
|
||||
}
|
||||
// CraftBukkit end
|
||||
blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); // CraftBukkit
|
||||
}
|
||||
} else if (j1 != 0 && j1 != Block.FIRE.id) {
|
||||
return false;
|
||||
@ -100,21 +91,19 @@ public class BlockPortal extends BlockBreakable {
|
||||
// CraftBukkit start
|
||||
for (l = 0; l < 2; ++l) {
|
||||
for (i1 = 0; i1 < 3; ++i1) {
|
||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i + b0 * l, j + i1, k + b1 * l);
|
||||
if (!blocks.contains(b)) {
|
||||
blocks.add(b);
|
||||
}
|
||||
blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l));
|
||||
}
|
||||
}
|
||||
|
||||
PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
PortalCreateEvent event = new PortalCreateEvent(blocks, bworld);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.o = true;
|
||||
world.suppressPhysics = true;
|
||||
|
||||
for (l = 0; l < 2; ++l) {
|
||||
for (i1 = 0; i1 < 3; ++i1) {
|
||||
@ -122,7 +111,7 @@ public class BlockPortal extends BlockBreakable {
|
||||
}
|
||||
}
|
||||
|
||||
world.o = false;
|
||||
world.suppressPhysics = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -173,9 +162,8 @@ public class BlockPortal extends BlockBreakable {
|
||||
public void a(World world, int i, int j, int k, Entity entity) {
|
||||
if (entity.vehicle == null && entity.passenger == null) {
|
||||
// CraftBukkit start - Entity in portal
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(craftWorld, i, j, k));
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), i, j, k));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
entity.O();
|
||||
|
@ -4,16 +4,9 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockPressurePlate extends Block {
|
||||
@ -103,17 +96,20 @@ public class BlockPressurePlate extends Block {
|
||||
}
|
||||
|
||||
// CraftBukkit start - Interact Pressure Plate
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
|
||||
if (flag != flag1) {
|
||||
if (flag1) {
|
||||
for (Object object: list) {
|
||||
if (object != null) {
|
||||
Cancellable cancellable;
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
|
||||
if (object instanceof EntityHuman) {
|
||||
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, Action.PHYSICAL, i, j, k, -1, null);
|
||||
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||
} else if (object instanceof Entity) {
|
||||
cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
|
||||
((CraftServer) Bukkit.getServer()).getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), bworld.getBlockAt(i, j, k));
|
||||
manager.callEvent((EntityInteractEvent) cancellable);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@ -124,12 +120,8 @@ public class BlockPressurePlate extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), flag ? 1 : 0, flag1 ? 1 : 0);
|
||||
manager.callEvent(eventRedstone);
|
||||
|
||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockPumpkin extends Block {
|
||||
|
||||
@ -56,13 +52,11 @@ public class BlockPumpkin extends Block {
|
||||
// CraftBukkit start
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int power = block.getBlockPower();
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -4,11 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
@ -100,9 +96,10 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
PluginManager man = ((WorldServer) world).getServer().getPluginManager();
|
||||
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int oldCurrent = this.isOn ? 15 : 0;
|
||||
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||
// CraftBukkit end
|
||||
|
||||
@ -111,7 +108,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
// CraftBukkit start
|
||||
if (oldCurrent != 0) {
|
||||
event.setNewCurrent(0);
|
||||
man.callEvent(event);
|
||||
manager.callEvent(event);
|
||||
if (event.getNewCurrent() != 0) {
|
||||
return;
|
||||
}
|
||||
@ -135,7 +132,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
// CraftBukkit start
|
||||
if (oldCurrent != 15) {
|
||||
event.setNewCurrent(15);
|
||||
man.callEvent(event);
|
||||
manager.callEvent(event);
|
||||
if (event.getNewCurrent() != 15) {
|
||||
return;
|
||||
}
|
||||
|
@ -5,10 +5,7 @@ import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
@ -109,18 +106,18 @@ public class BlockRedstoneWire extends Block {
|
||||
|
||||
// CraftBukkit start
|
||||
if (k1 != l1) {
|
||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, k1, l1);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(i, j, k), k1, l1);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
l1 = event.getNewCurrent();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (k1 != l1) {
|
||||
world.o = true;
|
||||
world.suppressPhysics = true;
|
||||
world.setData(i, j, k, l1);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.o = false;
|
||||
world.suppressPhysics = false;
|
||||
|
||||
for (i2 = 0; i2 < 4; ++i2) {
|
||||
j2 = i;
|
||||
|
@ -71,15 +71,15 @@ public class BlockSapling extends BlockFlower {
|
||||
BlockChangeWithNotify(World world) { this.world = world; }
|
||||
|
||||
public boolean setRawTypeId(int x, int y, int z, int type) {
|
||||
return world.setTypeId(x, y, z, type);
|
||||
return this.world.setTypeId(x, y, z, type);
|
||||
}
|
||||
|
||||
public boolean setRawTypeIdAndData(int x, int y, int z, int type, int data) {
|
||||
return world.setTypeIdAndData(x, y, z, type, data);
|
||||
return this.world.setTypeIdAndData(x, y, z, type, data);
|
||||
}
|
||||
|
||||
public int getTypeId(int x, int y, int z) {
|
||||
return world.getTypeId(x, y, z);
|
||||
return this.world.getTypeId(x, y, z);
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockSign extends BlockContainer {
|
||||
|
||||
@ -114,13 +109,11 @@ public class BlockSign extends BlockContainer {
|
||||
|
||||
// CraftBukkit start
|
||||
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Block block = craftWorld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
int power = block.getBlockPower();
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
||||
server.getPluginManager().callEvent(eventRedstone);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockFadeEvent; // CraftBukkit
|
||||
|
||||
public class BlockSnow extends Block {
|
||||
|
||||
@ -83,13 +78,12 @@ public class BlockSnow extends Block {
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = world.getServer();
|
||||
CraftWorld cworld = world.getWorld();
|
||||
BlockState blockState = cworld.getBlockAt(i, j, k).getState();
|
||||
org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(i, j, k).getState();
|
||||
blockState.setTypeId(this.id);
|
||||
|
||||
BlockFadeEvent event = new BlockFadeEvent(cworld.getBlockAt(i, j, k), blockState);
|
||||
server.getPluginManager().callEvent(event);
|
||||
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -3,11 +3,7 @@ package net.minecraft.server;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -56,12 +52,12 @@ public class BlockSoil extends Block {
|
||||
public void b(World world, int i, int j, int k, Entity entity) {
|
||||
if (world.random.nextInt(4) == 0) {
|
||||
// CraftBukkit start - Interact Soil
|
||||
Cancellable cancellable;
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
if (entity instanceof EntityHuman) {
|
||||
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, Action.PHYSICAL, i, j, k, -1, null);
|
||||
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
|
||||
} else {
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
|
||||
((CraftServer) Bukkit.getServer()).getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
|
||||
world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
}
|
||||
|
||||
if (cancellable.isCancelled()) {
|
||||
|
@ -2,13 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.block.BlockIgniteEvent; // CraftBukkit
|
||||
|
||||
public class BlockStationary extends BlockFluids {
|
||||
|
||||
@ -30,11 +24,11 @@ public class BlockStationary extends BlockFluids {
|
||||
private void i(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.o = true;
|
||||
world.suppressPhysics = true;
|
||||
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.c(i, j, k, this.id - 1, this.c());
|
||||
world.o = false;
|
||||
world.suppressPhysics = false;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
@ -42,11 +36,8 @@ public class BlockStationary extends BlockFluids {
|
||||
int l = random.nextInt(3);
|
||||
|
||||
// CraftBukkit start - prevent lava putting something on fire.
|
||||
Server server = ((WorldServer) world).getServer();
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||
Player thePlayer = null;
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||
// CraftBukkit end
|
||||
|
||||
for (int i1 = 0; i1 < l; ++i1) {
|
||||
@ -58,11 +49,12 @@ public class BlockStationary extends BlockFluids {
|
||||
if (j1 == 0) {
|
||||
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
||||
// CraftBukkit start - prevent lava putting something on fire.
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
|
||||
|
||||
if (block.getTypeId() != Block.FIRE.id) {
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(block, igniteCause, null);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (theBlock.getTypeId() != Block.FIRE.id) {
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -6,12 +6,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.Iterator;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
// CraftBukkit end
|
||||
|
||||
public class Chunk {
|
||||
|
||||
public static boolean a;
|
||||
@ -21,7 +15,7 @@ public class Chunk {
|
||||
public NibbleArray e;
|
||||
public NibbleArray f;
|
||||
public NibbleArray g;
|
||||
public byte[] h;
|
||||
public byte[] heightMap;
|
||||
public int i;
|
||||
public final int x;
|
||||
public final int z;
|
||||
@ -43,17 +37,17 @@ public class Chunk {
|
||||
this.world = world;
|
||||
this.x = i;
|
||||
this.z = j;
|
||||
this.h = new byte[256];
|
||||
this.heightMap = new byte[256];
|
||||
|
||||
for (int k = 0; k < this.entitySlices.length; ++k) {
|
||||
this.entitySlices[k] = new ArrayList();
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
CraftWorld cw = ((WorldServer) world).getWorld();
|
||||
bukkitChunk = (cw == null) ? null : cw.popPreservedChunk(i, j);
|
||||
if (bukkitChunk == null) {
|
||||
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
org.bukkit.craftbukkit.CraftWorld cworld = this.world.getWorld();
|
||||
this.bukkitChunk = (cworld == null) ? null : cworld.popPreservedChunk(i, j);
|
||||
if (this.bukkitChunk == null) {
|
||||
this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,12 +67,12 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public int b(int i, int j) {
|
||||
return this.h[j << 4 | i] & 255;
|
||||
return this.heightMap[j << 4 | i] & 255;
|
||||
}
|
||||
|
||||
public void a() {}
|
||||
|
||||
public void b() {
|
||||
public void initLighting() {
|
||||
int i = 127;
|
||||
|
||||
int j;
|
||||
@ -94,7 +88,7 @@ public class Chunk {
|
||||
;
|
||||
}
|
||||
|
||||
this.h[k << 4 | j] = (byte) l;
|
||||
this.heightMap[k << 4 | j] = (byte) l;
|
||||
if (l < i) {
|
||||
i = l;
|
||||
}
|
||||
@ -152,7 +146,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
private void g(int i, int j, int k) {
|
||||
int l = this.h[k << 4 | i] & 255;
|
||||
int l = this.heightMap[k << 4 | i] & 255;
|
||||
int i1 = l;
|
||||
|
||||
if (j > l) {
|
||||
@ -165,7 +159,7 @@ public class Chunk {
|
||||
|
||||
if (i1 != l) {
|
||||
this.world.g(i, k, i1, l);
|
||||
this.h[k << 4 | i] = (byte) i1;
|
||||
this.heightMap[k << 4 | i] = (byte) i1;
|
||||
int k1;
|
||||
int l1;
|
||||
int i2;
|
||||
@ -177,8 +171,8 @@ public class Chunk {
|
||||
|
||||
for (l1 = 0; l1 < 16; ++l1) {
|
||||
for (i2 = 0; i2 < 16; ++i2) {
|
||||
if ((this.h[i2 << 4 | l1] & 255) < k1) {
|
||||
k1 = this.h[i2 << 4 | l1] & 255;
|
||||
if ((this.heightMap[i2 << 4 | l1] & 255) < k1) {
|
||||
k1 = this.heightMap[i2 << 4 | l1] & 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,7 +230,7 @@ public class Chunk {
|
||||
|
||||
public boolean a(int i, int j, int k, int l, int i1) {
|
||||
byte b0 = (byte) l;
|
||||
int j1 = this.h[k << 4 | i] & 255;
|
||||
int j1 = this.heightMap[k << 4 | i] & 255;
|
||||
int k1 = this.b[i << 11 | k << 7 | j] & 255;
|
||||
|
||||
if (k1 == l && this.e.a(i, j, k) == i1) {
|
||||
@ -277,7 +271,7 @@ public class Chunk {
|
||||
|
||||
public boolean a(int i, int j, int k, int l) {
|
||||
byte b0 = (byte) l;
|
||||
int i1 = this.h[k << 4 | i] & 255;
|
||||
int i1 = this.heightMap[k << 4 | i] & 255;
|
||||
int j1 = this.b[i << 11 | k << 7 | j] & 255;
|
||||
|
||||
if (j1 == l) {
|
||||
@ -401,7 +395,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public boolean c(int i, int j, int k) {
|
||||
return j >= (this.h[k << 4 | i] & 255);
|
||||
return j >= (this.heightMap[k << 4 | i] & 255);
|
||||
}
|
||||
|
||||
public TileEntity d(int i, int j, int k) {
|
||||
@ -425,9 +419,9 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public void a(TileEntity tileentity) {
|
||||
int i = tileentity.e - this.x * 16;
|
||||
int j = tileentity.f;
|
||||
int k = tileentity.g - this.z * 16;
|
||||
int i = tileentity.x - this.x * 16;
|
||||
int j = tileentity.y;
|
||||
int k = tileentity.z - this.z * 16;
|
||||
|
||||
this.a(i, j, k, tileentity);
|
||||
}
|
||||
@ -436,9 +430,9 @@ public class Chunk {
|
||||
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||
|
||||
tileentity.world = this.world;
|
||||
tileentity.e = this.x * 16 + i;
|
||||
tileentity.f = j;
|
||||
tileentity.g = this.z * 16 + k;
|
||||
tileentity.x = this.x * 16 + i;
|
||||
tileentity.y = j;
|
||||
tileentity.z = this.z * 16 + k;
|
||||
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
|
||||
if (this.c) {
|
||||
if (this.tileEntities.get(chunkposition) != null) {
|
||||
@ -477,11 +471,11 @@ public class Chunk {
|
||||
|
||||
for (int i = 0; i < this.entitySlices.length; ++i) {
|
||||
// CraftBukkit start
|
||||
Iterator<Object> iter = this.entitySlices[i].iterator();
|
||||
java.util.Iterator<Object> iter = this.entitySlices[i].iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entity entity = (Entity) iter.next();
|
||||
int cx = Location.locToBlock(entity.locX) >> 4;
|
||||
int cz = Location.locToBlock(entity.locZ) >> 4;
|
||||
int cx = org.bukkit.Location.locToBlock(entity.locX) >> 4;
|
||||
int cz = org.bukkit.Location.locToBlock(entity.locZ) >> 4;
|
||||
|
||||
// Do not pass along players, as doing so can get them stuck outside of time.
|
||||
// (which for example disables inventory icon updates and prevents block breaking)
|
||||
@ -565,7 +559,7 @@ public class Chunk {
|
||||
}
|
||||
}
|
||||
|
||||
public int a(byte[] abyte, int i, int j, int k, int l, int i1, int j1, int k1) {
|
||||
public int getData(byte[] abyte, int i, int j, int k, int l, int i1, int j1, int k1) {
|
||||
int l1 = l - i;
|
||||
int i2 = i1 - j;
|
||||
int j2 = j1 - k;
|
||||
@ -630,7 +624,7 @@ public class Chunk {
|
||||
return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i);
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,7 @@ import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.Random;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.util.LongHashset;
|
||||
import org.bukkit.craftbukkit.util.LongHashtable;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
@ -30,7 +26,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public Chunk emptyChunk;
|
||||
public IChunkProvider chunkProvider; // CraftBukkit
|
||||
private IChunkLoader e;
|
||||
public boolean a = false;
|
||||
public boolean forceChunkLoad = false;
|
||||
public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
|
||||
public List chunkList = new ArrayList();
|
||||
public WorldServer world;
|
||||
@ -73,7 +69,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
} else {
|
||||
chunk = this.chunkProvider.getOrCreateChunk(i, j);
|
||||
}
|
||||
newChunk = true; // Craftbukkit
|
||||
newChunk = true; // CraftBukkit
|
||||
}
|
||||
|
||||
this.chunks.put(i, j, chunk); // CraftBukkit
|
||||
@ -84,7 +80,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
if (server != null) {
|
||||
/*
|
||||
* If it's a new world, the first few chunks are generated inside
|
||||
@ -119,7 +115,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
// CraftBukkit start
|
||||
Chunk chunk = (Chunk) this.chunks.get(i, j);
|
||||
|
||||
chunk = chunk == null ? (!this.world.isLoading && !this.a ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
|
||||
if (chunk == this.emptyChunk) return chunk;
|
||||
if (i != chunk.x || j != chunk.z) {
|
||||
MinecraftServer.log.info("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ")");
|
||||
@ -181,20 +177,21 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
|
||||
|
||||
// CraftBukkit start
|
||||
BlockSand.a = true;
|
||||
BlockSand.instaFall = true;
|
||||
Random random = new Random();
|
||||
random.setSeed(world.getSeed());
|
||||
long xRand = random.nextLong() / 2L * 2L + 1L;
|
||||
long zRand = random.nextLong() / 2L * 2L + 1L;
|
||||
random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed());
|
||||
CraftWorld world = (CraftWorld)this.world.getWorld();
|
||||
|
||||
org.bukkit.World world = this.world.getWorld();
|
||||
if (world != null) {
|
||||
for (BlockPopulator populator : world.getPopulators()) {
|
||||
populator.populate(world, random, chunk.bukkitChunk);
|
||||
}
|
||||
}
|
||||
BlockSand.a = false;
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
|
||||
BlockSand.instaFall = false;
|
||||
this.world.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
|
||||
// CraftBukkit end
|
||||
|
||||
chunk.f();
|
||||
@ -234,9 +231,9 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
}
|
||||
|
||||
public boolean unloadChunks() {
|
||||
if (!this.world.E) {
|
||||
if (!this.world.canSave) {
|
||||
// CraftBukkit start
|
||||
Server server = this.world.getServer();
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
for (int i = 0; i < 50 && !this.unloadQueue.isEmpty(); i++) {
|
||||
long chunkcoordinates = this.unloadQueue.popFirst();
|
||||
Chunk chunk = this.chunks.get(chunkcoordinates);
|
||||
@ -265,7 +262,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
return this.chunkProvider.unloadChunks();
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return !this.world.E;
|
||||
public boolean canSave() {
|
||||
return !this.world.canSave;
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,8 @@ import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.List;
|
||||
import org.bukkit.craftbukkit.command.ServerCommandListener;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ConsoleCommandHandler {
|
||||
@ -25,7 +23,7 @@ public class ConsoleCommandHandler {
|
||||
String s = servercommand.command;
|
||||
ICommandListener icommandlistener = servercommand.b;
|
||||
String s1 = icommandlistener.getName();
|
||||
listener = icommandlistener; // CraftBukkit
|
||||
this.listener = icommandlistener; // CraftBukkit
|
||||
ServerConfigurationManager serverconfigurationmanager = this.server.serverConfigurationManager;
|
||||
|
||||
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
|
||||
@ -47,10 +45,10 @@ public class ConsoleCommandHandler {
|
||||
// CraftBukkit start
|
||||
for (i = 0; i < this.server.worlds.size(); ++i) {
|
||||
worldserver = this.server.worlds.get(i);
|
||||
boolean save = worldserver.E;
|
||||
worldserver.E = false;
|
||||
boolean save = worldserver.canSave;
|
||||
worldserver.canSave = false;
|
||||
worldserver.save(true, (IProgressUpdate) null);
|
||||
worldserver.E = save;
|
||||
worldserver.canSave = save;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -60,14 +58,14 @@ public class ConsoleCommandHandler {
|
||||
|
||||
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
|
||||
worldserver = this.server.worlds.get(i); // CraftBukkit
|
||||
worldserver.E = true;
|
||||
worldserver.canSave = true;
|
||||
}
|
||||
} else if (s.toLowerCase().startsWith("save-on")) {
|
||||
this.print(s1, "Enabling level saving..");
|
||||
|
||||
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
|
||||
worldserver = this.server.worlds.get(i); // CraftBukkit
|
||||
worldserver.E = false;
|
||||
worldserver.canSave = false;
|
||||
}
|
||||
} else {
|
||||
String s2;
|
||||
@ -261,7 +259,7 @@ public class ConsoleCommandHandler {
|
||||
|
||||
private void a(String s, String s1, ICommandListener icommandlistener) {
|
||||
String[] astring = s1.split(" ");
|
||||
listener = icommandlistener; // CraftBukkit
|
||||
this.listener = icommandlistener; // CraftBukkit
|
||||
|
||||
if (astring.length >= 2) {
|
||||
String s2 = astring[1].toLowerCase();
|
||||
@ -330,9 +328,9 @@ public class ConsoleCommandHandler {
|
||||
String s2 = s + ": " + s1;
|
||||
|
||||
// CraftBukkit start
|
||||
listener.sendMessage(s1);
|
||||
informOps("\u00A77(" + s2 + ")");
|
||||
if (listener instanceof MinecraftServer) {
|
||||
this.listener.sendMessage(s1);
|
||||
this.informOps("\u00A77(" + s2 + ")");
|
||||
if (this.listener instanceof MinecraftServer) {
|
||||
return; // Already logged so don't call a.info()
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -343,16 +341,16 @@ public class ConsoleCommandHandler {
|
||||
private void informOps(String msg) {
|
||||
Packet3Chat packet3chat = new Packet3Chat(msg);
|
||||
EntityPlayer sender = null;
|
||||
if (listener instanceof ServerCommandListener) {
|
||||
CommandSender commandSender = ((ServerCommandListener) listener).getSender();
|
||||
if (this.listener instanceof ServerCommandListener) {
|
||||
org.bukkit.command.CommandSender commandSender = ((ServerCommandListener) this.listener).getSender();
|
||||
if (commandSender instanceof CraftPlayer) {
|
||||
sender = ((CraftPlayer) commandSender).getHandle();
|
||||
}
|
||||
}
|
||||
List<EntityPlayer> players = server.serverConfigurationManager.players;
|
||||
java.util.List<EntityPlayer> players = this.server.serverConfigurationManager.players;
|
||||
for (int i = 0; i < players.size(); ++i) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) players.get(i);
|
||||
if (sender != entityPlayer && server.serverConfigurationManager.isOp(entityPlayer.name)) {
|
||||
if (sender != entityPlayer && this.server.serverConfigurationManager.isOp(entityPlayer.name)) {
|
||||
entityPlayer.netServerHandler.sendPacket(packet3chat);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.logging.Handler;
|
||||
import org.bukkit.craftbukkit.util.ShortConsoleLogFormatter;
|
||||
import org.bukkit.craftbukkit.util.TerminalConsoleHandler;
|
||||
|
@ -1,12 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ContainerPlayer extends Container {
|
||||
|
||||
public InventoryCrafting a;
|
||||
public IInventory b;
|
||||
public InventoryCrafting craftInventory;
|
||||
public IInventory resultInventory;
|
||||
public boolean c;
|
||||
|
||||
public ContainerPlayer(InventoryPlayer inventoryplayer) {
|
||||
@ -14,18 +11,18 @@ public class ContainerPlayer extends Container {
|
||||
}
|
||||
|
||||
public ContainerPlayer(InventoryPlayer inventoryplayer, boolean flag) {
|
||||
this.a = new InventoryCrafting(this, 2, 2);
|
||||
this.b = new InventoryCraftResult();
|
||||
this.craftInventory = new InventoryCrafting(this, 2, 2);
|
||||
this.resultInventory = new InventoryCraftResult();
|
||||
this.c = false;
|
||||
this.c = flag;
|
||||
this.a((Slot) (new SlotResult(inventoryplayer.d, this.a, this.b, 0, 144, 36)));
|
||||
this.a((Slot) (new SlotResult(inventoryplayer.d, this.craftInventory, this.resultInventory, 0, 144, 36)));
|
||||
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (j = 0; j < 2; ++j) {
|
||||
this.a(new Slot(this.a, j + i * 2, 88 + j * 18, 26 + i * 18));
|
||||
this.a(new Slot(this.craftInventory, j + i * 2, 88 + j * 18, 26 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,19 +40,19 @@ public class ContainerPlayer extends Container {
|
||||
this.a(new Slot(inventoryplayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
|
||||
this.a((IInventory) this.a);
|
||||
this.a((IInventory) this.craftInventory);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
// CraftBukkit start
|
||||
ItemStack craftResult = CraftingManager.a().a(this.a);
|
||||
this.b.setItem(0, craftResult);
|
||||
if (super.g.size() < 1) {
|
||||
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory);
|
||||
this.resultInventory.setItem(0, craftResult);
|
||||
if (super.listeners.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
||||
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||
player.netServerHandler.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
@ -63,11 +60,11 @@ public class ContainerPlayer extends Container {
|
||||
super.a(entityhuman);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
ItemStack itemstack = this.a.getItem(i);
|
||||
ItemStack itemstack = this.craftInventory.getItem(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
entityhuman.b(itemstack);
|
||||
this.a.setItem(i, (ItemStack) null);
|
||||
this.craftInventory.setItem(i, (ItemStack) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,7 +80,7 @@ public class ContainerPlayer extends Container {
|
||||
if (slot != null && slot.b()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.j();
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
if (i == 0) {
|
||||
this.a(itemstack1, 9, 45, true);
|
||||
} else if (i >= 9 && i < 36) {
|
||||
|
@ -1,12 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ContainerWorkbench extends Container {
|
||||
|
||||
public InventoryCrafting a = new InventoryCrafting(this, 3, 3);
|
||||
public IInventory b = new InventoryCraftResult();
|
||||
public InventoryCrafting craftInventory = new InventoryCrafting(this, 3, 3);
|
||||
public IInventory resultInventory = new InventoryCraftResult();
|
||||
private World c;
|
||||
private int h;
|
||||
private int i;
|
||||
@ -17,14 +14,14 @@ public class ContainerWorkbench extends Container {
|
||||
this.h = i;
|
||||
this.i = j;
|
||||
this.j = k;
|
||||
this.a((Slot) (new SlotResult(inventoryplayer.d, this.a, this.b, 0, 124, 35)));
|
||||
this.a((Slot) (new SlotResult(inventoryplayer.d, this.craftInventory, this.resultInventory, 0, 124, 35)));
|
||||
|
||||
int l;
|
||||
int i1;
|
||||
|
||||
for (l = 0; l < 3; ++l) {
|
||||
for (i1 = 0; i1 < 3; ++i1) {
|
||||
this.a(new Slot(this.a, i1 + l * 3, 30 + i1 * 18, 17 + l * 18));
|
||||
this.a(new Slot(this.craftInventory, i1 + l * 3, 30 + i1 * 18, 17 + l * 18));
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,19 +35,19 @@ public class ContainerWorkbench extends Container {
|
||||
this.a(new Slot(inventoryplayer, l, 8 + l * 18, 142));
|
||||
}
|
||||
|
||||
this.a((IInventory) this.a);
|
||||
this.a((IInventory) this.craftInventory);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
// CraftBukkit start
|
||||
ItemStack craftResult = CraftingManager.a().a(this.a);
|
||||
this.b.setItem(0, craftResult);
|
||||
if (super.g.size() < 1) {
|
||||
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory);
|
||||
this.resultInventory.setItem(0, craftResult);
|
||||
if (super.listeners.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
||||
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||
player.netServerHandler.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
@ -58,7 +55,7 @@ public class ContainerWorkbench extends Container {
|
||||
super.a(entityhuman);
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
ItemStack itemstack = this.a.getItem(i);
|
||||
ItemStack itemstack = this.craftInventory.getItem(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
entityhuman.b(itemstack);
|
||||
@ -77,7 +74,7 @@ public class ContainerWorkbench extends Container {
|
||||
if (slot != null && slot.b()) {
|
||||
ItemStack itemstack1 = slot.getItem();
|
||||
|
||||
itemstack = itemstack1.j();
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
if (i == 0) {
|
||||
this.a(itemstack1, 10, 46, true);
|
||||
} else if (i >= 10 && i < 37) {
|
||||
|
@ -10,7 +10,7 @@ public class CraftingManager {
|
||||
private static final CraftingManager a = new CraftingManager();
|
||||
private List b = new ArrayList();
|
||||
|
||||
public static final CraftingManager a() {
|
||||
public static final CraftingManager getInstance() {
|
||||
return a;
|
||||
}
|
||||
|
||||
@ -22,66 +22,66 @@ public class CraftingManager {
|
||||
(new RecipesCrafting()).a(this);
|
||||
(new RecipesArmor()).a(this);
|
||||
(new RecipesDyes()).a(this);
|
||||
this.a(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
|
||||
this.a(new ItemStack(Item.BOOK, 1), new Object[] { "#", "#", "#", Character.valueOf('#'), Item.PAPER});
|
||||
this.a(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
|
||||
this.a(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
|
||||
this.a(new ItemStack(Block.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.a(new ItemStack(Block.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.BOOK});
|
||||
this.a(new ItemStack(Block.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.SNOW_BALL});
|
||||
this.a(new ItemStack(Block.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BALL});
|
||||
this.a(new ItemStack(Block.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BRICK});
|
||||
this.a(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.GLOWSTONE_DUST});
|
||||
this.a(new ItemStack(Block.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.STRING});
|
||||
this.a(new ItemStack(Block.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Item.SULPHUR, Character.valueOf('#'), Block.SAND});
|
||||
this.a(new ItemStack(Block.STEP, 3, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
|
||||
this.a(new ItemStack(Block.STEP, 3, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});
|
||||
this.a(new ItemStack(Block.STEP, 3, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
|
||||
this.a(new ItemStack(Block.STEP, 3, 2), new Object[] { "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Block.LADDER, 2), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
|
||||
this.a(new ItemStack(Item.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Block.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Item.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.a(new ItemStack(Item.SIGN, 1), new Object[] { "###", "###", " X ", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.STICK});
|
||||
this.a(new ItemStack(Item.CAKE, 1), new Object[] { "AAA", "BEB", "CCC", Character.valueOf('A'), Item.MILK_BUCKET, Character.valueOf('B'), Item.SUGAR, Character.valueOf('C'), Item.WHEAT, Character.valueOf('E'), Item.EGG});
|
||||
this.a(new ItemStack(Item.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Item.SUGAR_CANE});
|
||||
this.a(new ItemStack(Block.WOOD, 4), new Object[] { "#", Character.valueOf('#'), Block.LOG});
|
||||
this.a(new ItemStack(Item.STICK, 4), new Object[] { "#", "#", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), Item.COAL, Character.valueOf('#'), Item.STICK});
|
||||
this.a(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), new ItemStack(Item.COAL, 1, 1), Character.valueOf('#'), Item.STICK});
|
||||
this.a(new ItemStack(Item.BOWL, 4), new Object[] { "# #", " # ", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Block.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Item.STICK});
|
||||
this.a(new ItemStack(Block.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.GOLD_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Item.STICK});
|
||||
this.a(new ItemStack(Block.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Block.STONE_PLATE});
|
||||
this.a(new ItemStack(Item.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.a(new ItemStack(Block.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.PUMPKIN, Character.valueOf('B'), Block.TORCH});
|
||||
this.a(new ItemStack(Item.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.CHEST, Character.valueOf('B'), Item.MINECART});
|
||||
this.a(new ItemStack(Item.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
|
||||
this.a(new ItemStack(Item.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.a(new ItemStack(Item.FLINT_AND_STEEL, 1), new Object[] { "A ", " B", Character.valueOf('A'), Item.IRON_INGOT, Character.valueOf('B'), Item.FLINT});
|
||||
this.a(new ItemStack(Item.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Item.WHEAT});
|
||||
this.a(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
|
||||
this.a(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE});
|
||||
this.a(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
|
||||
this.a(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
|
||||
this.a(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
|
||||
this.a(new ItemStack(Block.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.a(new ItemStack(Item.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.REDSTONE, Character.valueOf('I'), Block.STONE});
|
||||
this.a(new ItemStack(Item.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.a(new ItemStack(Item.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.IRON_INGOT, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.a(new ItemStack(Item.MAP, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.PAPER, Character.valueOf('X'), Item.COMPASS});
|
||||
this.a(new ItemStack(Block.STONE_BUTTON, 1), new Object[] { "#", "#", Character.valueOf('#'), Block.STONE});
|
||||
this.a(new ItemStack(Block.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.STONE});
|
||||
this.a(new ItemStack(Block.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.WOOD});
|
||||
this.a(new ItemStack(Block.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.BOW, Character.valueOf('R'), Item.REDSTONE});
|
||||
this.a(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BOOK, 1), new Object[] { "#", "#", "#", Character.valueOf('#'), Item.PAPER});
|
||||
this.registerShapedRecipe(new ItemStack(Block.FENCE, 2), new Object[] { "###", "###", Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
|
||||
this.registerShapedRecipe(new ItemStack(Block.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.BOOK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.SNOW_BALL});
|
||||
this.registerShapedRecipe(new ItemStack(Block.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BALL});
|
||||
this.registerShapedRecipe(new ItemStack(Block.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BRICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.GLOWSTONE_DUST});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.STRING});
|
||||
this.registerShapedRecipe(new ItemStack(Block.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Item.SULPHUR, Character.valueOf('#'), Block.SAND});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 0), new Object[] { "###", Character.valueOf('#'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 1), new Object[] { "###", Character.valueOf('#'), Block.SANDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STEP, 3, 2), new Object[] { "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.LADDER, 2), new Object[] { "# #", "###", "# #", Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.WOOD_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.TRAP_DOOR, 2), new Object[] { "###", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Item.IRON_DOOR, 1), new Object[] { "##", "##", "##", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.SIGN, 1), new Object[] { "###", "###", " X ", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.CAKE, 1), new Object[] { "AAA", "BEB", "CCC", Character.valueOf('A'), Item.MILK_BUCKET, Character.valueOf('B'), Item.SUGAR, Character.valueOf('C'), Item.WHEAT, Character.valueOf('E'), Item.EGG});
|
||||
this.registerShapedRecipe(new ItemStack(Item.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Item.SUGAR_CANE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD, 4), new Object[] { "#", Character.valueOf('#'), Block.LOG});
|
||||
this.registerShapedRecipe(new ItemStack(Item.STICK, 4), new Object[] { "#", "#", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), Item.COAL, Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.TORCH, 4), new Object[] { "X", "#", Character.valueOf('X'), new ItemStack(Item.COAL, 1, 1), Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BOWL, 4), new Object[] { "# #", " # ", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.GOLD_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Block.STONE_PLATE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Block.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.PUMPKIN, Character.valueOf('B'), Block.TORCH});
|
||||
this.registerShapedRecipe(new ItemStack(Item.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.CHEST, Character.valueOf('B'), Item.MINECART});
|
||||
this.registerShapedRecipe(new ItemStack(Item.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.FLINT_AND_STEEL, 1), new Object[] { "A ", " B", Character.valueOf('A'), Item.IRON_INGOT, Character.valueOf('B'), Item.FLINT});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BREAD, 1), new Object[] { "###", Character.valueOf('#'), Item.WHEAT});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Item.FISHING_ROD, 1), new Object[] { " #", " #X", "# X", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.STRING});
|
||||
this.registerShapedRecipe(new ItemStack(Block.COBBLESTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.COBBLESTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
|
||||
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
|
||||
this.registerShapedRecipe(new ItemStack(Block.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.REDSTONE, Character.valueOf('I'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.IRON_INGOT, Character.valueOf('X'), Item.REDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.MAP, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.PAPER, Character.valueOf('X'), Item.COMPASS});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STONE_BUTTON, 1), new Object[] { "#", "#", Character.valueOf('#'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.STONE});
|
||||
this.registerShapedRecipe(new ItemStack(Block.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.WOOD});
|
||||
this.registerShapedRecipe(new ItemStack(Block.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.BOW, Character.valueOf('R'), Item.REDSTONE});
|
||||
this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
|
||||
Collections.sort(this.b, new RecipeSorter(this));
|
||||
System.out.println(this.b.size() + " recipes");
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
|
||||
public void registerShapedRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
|
||||
String s = "";
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
@ -130,7 +130,7 @@ public class CraftingManager {
|
||||
char c0 = s.charAt(i1);
|
||||
|
||||
if (hashmap.containsKey(Character.valueOf(c0))) {
|
||||
aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).j();
|
||||
aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
|
||||
} else {
|
||||
aitemstack[i1] = null;
|
||||
}
|
||||
@ -139,7 +139,7 @@ public class CraftingManager {
|
||||
this.b.add(new ShapedRecipes(j, k, aitemstack, itemstack));
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
|
||||
public void registerShapelessRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Object[] aobject1 = aobject;
|
||||
int i = aobject.length;
|
||||
@ -148,7 +148,7 @@ public class CraftingManager {
|
||||
Object object = aobject1[j];
|
||||
|
||||
if (object instanceof ItemStack) {
|
||||
arraylist.add(((ItemStack) object).j());
|
||||
arraylist.add(((ItemStack) object).cloneItemStack());
|
||||
} else if (object instanceof Item) {
|
||||
arraylist.add(new ItemStack((Item) object));
|
||||
} else {
|
||||
@ -163,7 +163,7 @@ public class CraftingManager {
|
||||
this.b.add(new ShapelessRecipes(itemstack, arraylist));
|
||||
}
|
||||
|
||||
public ItemStack a(InventoryCrafting inventorycrafting) {
|
||||
public ItemStack craft(InventoryCrafting inventorycrafting) {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(i);
|
||||
|
||||
|
@ -5,23 +5,18 @@ import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.entity.CraftVehicle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -79,7 +74,7 @@ public abstract class Entity {
|
||||
public int noDamageTicks;
|
||||
public int airTicks;
|
||||
private boolean justCreated;
|
||||
protected boolean bD;
|
||||
protected boolean fireProof;
|
||||
protected DataWatcher datawatcher;
|
||||
private double d;
|
||||
private double e;
|
||||
@ -120,7 +115,7 @@ public abstract class Entity {
|
||||
this.noDamageTicks = 0;
|
||||
this.airTicks = 300;
|
||||
this.justCreated = true;
|
||||
this.bD = false;
|
||||
this.fireProof = false;
|
||||
this.datawatcher = new DataWatcher();
|
||||
this.bF = false;
|
||||
this.world = world;
|
||||
@ -147,8 +142,7 @@ public abstract class Entity {
|
||||
// CraftBukkit start
|
||||
if (this.getBukkitEntity() instanceof Projectile && !(this instanceof EntityFish)) {
|
||||
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.dead = true;
|
||||
@ -255,23 +249,17 @@ public abstract class Entity {
|
||||
if (this.world.isStatic) {
|
||||
this.fireTicks = 0;
|
||||
} else if (this.fireTicks > 0) {
|
||||
if (this.bD) {
|
||||
if (this.fireProof) {
|
||||
this.fireTicks -= 4;
|
||||
if (this.fireTicks < 0) {
|
||||
this.fireTicks = 0;
|
||||
}
|
||||
} else {
|
||||
if (this.fireTicks % 20 == 0) {
|
||||
// CraftBukkit start
|
||||
// TODO: this event spams!
|
||||
// CraftBukkit start - TODO: this event spams!
|
||||
if (this instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE_TICK;
|
||||
int damageDone = 1;
|
||||
|
||||
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, 1);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.damageEntity((Entity) null, event.getDamage());
|
||||
@ -303,17 +291,16 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
protected void aa() {
|
||||
if (!this.bD) {
|
||||
if (!this.fireProof) {
|
||||
// CraftBukkit start - TODO: this event spams!
|
||||
if (this instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
|
||||
// TODO: shouldn't be sending null for the block.
|
||||
org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
|
||||
int damageDone = 4;
|
||||
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.LAVA, 4);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
@ -324,6 +311,7 @@ public abstract class Entity {
|
||||
// not on fire yet
|
||||
EntityCombustEvent combustEvent = new EntityCombustEvent(damagee);
|
||||
server.getPluginManager().callEvent(combustEvent);
|
||||
|
||||
if (!combustEvent.isCancelled()) {
|
||||
this.fireTicks = 600;
|
||||
}
|
||||
@ -546,10 +534,9 @@ public abstract class Entity {
|
||||
int j1;
|
||||
|
||||
// CraftBukkit start
|
||||
if ((this.positionChanged) && (getBukkitEntity() instanceof Vehicle)) {
|
||||
Vehicle vehicle = (Vehicle) getBukkitEntity();
|
||||
org.bukkit.World wrld = ((WorldServer) world).getWorld();
|
||||
org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.floor(locX), MathHelper.floor(locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(locZ));
|
||||
if ((this.positionChanged) && (this.getBukkitEntity() instanceof Vehicle)) {
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
|
||||
|
||||
if (d5 > d0) {
|
||||
block = block.getFace(BlockFace.SOUTH);
|
||||
@ -562,7 +549,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -615,17 +602,13 @@ public abstract class Entity {
|
||||
boolean flag2 = this.ab();
|
||||
|
||||
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
|
||||
this.a(1);
|
||||
this.burn(1);
|
||||
if (!flag2) {
|
||||
++this.fireTicks;
|
||||
// CraftBukkit start
|
||||
// CraftBukkit start - not on fire yet
|
||||
if (this.fireTicks <= 0) {
|
||||
// not on fire yet
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
|
||||
EntityCombustEvent event = new EntityCombustEvent(damagee);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.fireTicks = 300;
|
||||
@ -665,17 +648,12 @@ public abstract class Entity {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void a(int i) {
|
||||
if (!this.bD) {
|
||||
protected void burn(int i) {
|
||||
if (!this.fireProof) {
|
||||
// CraftBukkit start
|
||||
if (this instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE;
|
||||
int damageDone = i;
|
||||
|
||||
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -759,15 +737,15 @@ public abstract class Entity {
|
||||
return this.world.a(MathHelper.floor(this.boundingBox.a), MathHelper.floor(this.boundingBox.b), MathHelper.floor(this.boundingBox.c), MathHelper.floor(this.boundingBox.d), MathHelper.floor(this.boundingBox.e), MathHelper.floor(this.boundingBox.f)) ? this.world.m(i, j, k) : 0.0F;
|
||||
}
|
||||
|
||||
public void a(World world) {
|
||||
public void spawnIn(World world) {
|
||||
// CraftBukkit start
|
||||
if (world == null) {
|
||||
this.die();
|
||||
this.world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
||||
} else {
|
||||
this.world = world;
|
||||
this.world = ((org.bukkit.craftbukkit.CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public void setLocation(double d0, double d1, double d2, float f, float f1) {
|
||||
@ -920,9 +898,9 @@ public abstract class Entity {
|
||||
nbttagcompound.a("Air", (short) this.airTicks);
|
||||
nbttagcompound.a("OnGround", this.onGround);
|
||||
// CraftBukkit start
|
||||
nbttagcompound.setString("World", world.worldData.name);
|
||||
nbttagcompound.a("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
||||
nbttagcompound.a("UUIDMost", this.uniqueId.getMostSignificantBits());
|
||||
nbttagcompound.setString("World", this.world.worldData.name);
|
||||
nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
||||
nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
|
||||
// CraftBukkit end
|
||||
this.b(nbttagcompound);
|
||||
}
|
||||
@ -961,8 +939,8 @@ public abstract class Entity {
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
|
||||
// CraftBukkit start
|
||||
long least = nbttagcompound.f("UUIDLeast");
|
||||
long most = nbttagcompound.f("UUIDMost");
|
||||
long least = nbttagcompound.getLong("UUIDLeast");
|
||||
long most = nbttagcompound.getLong("UUIDMost");
|
||||
|
||||
if (least != 0L && most != 0L) {
|
||||
this.uniqueId = new UUID(most, least);
|
||||
@ -973,7 +951,7 @@ public abstract class Entity {
|
||||
this.a(nbttagcompound);
|
||||
|
||||
// CraftBukkit start - Exempt Vehicles from notch's sanity check
|
||||
if (!(this.getBukkitEntity() instanceof CraftVehicle)) {
|
||||
if (!(this.getBukkitEntity() instanceof Vehicle)) {
|
||||
if (Math.abs(this.motX) > 10.0D) {
|
||||
this.motX = 0.0D;
|
||||
}
|
||||
@ -988,22 +966,25 @@ public abstract class Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
// CraftBukkit Start - reset world
|
||||
CraftWorld world = null;
|
||||
// CraftBukkit start - reset world
|
||||
org.bukkit.Server server = Bukkit.getServer();
|
||||
org.bukkit.World bworld = null;
|
||||
|
||||
if (this instanceof EntityPlayer) {
|
||||
EntityPlayer entityPlayer = (EntityPlayer) this;
|
||||
String worldName = nbttagcompound.getString("World");
|
||||
|
||||
if (worldName == "") {
|
||||
world = ((CraftServer) Bukkit.getServer()).getServer().a(entityPlayer.dimension).getWorld();
|
||||
bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
|
||||
} else {
|
||||
world = (CraftWorld) Bukkit.getServer().getWorld(worldName);
|
||||
bworld = server.getWorld(worldName);
|
||||
}
|
||||
} else {
|
||||
world = (CraftWorld) Bukkit.getServer().getWorld(nbttagcompound.getString("World"));
|
||||
bworld = server.getWorld(nbttagcompound.getString("World"));
|
||||
}
|
||||
|
||||
a(world == null ? null : world.getHandle());
|
||||
// CraftBukkit End
|
||||
this.spawnIn(bworld == null ? null : ((org.bukkit.craftbukkit.CraftWorld) bworld).getHandle());
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
protected final String af() {
|
||||
@ -1157,16 +1138,16 @@ public abstract class Entity {
|
||||
|
||||
public void mount(Entity entity) {
|
||||
// CraftBukkit start
|
||||
setPassengerOf(entity);
|
||||
this.setPassengerOf(entity);
|
||||
}
|
||||
|
||||
protected org.bukkit.entity.Entity bukkitEntity;
|
||||
|
||||
public org.bukkit.entity.Entity getBukkitEntity() {
|
||||
if (bukkitEntity == null) {
|
||||
bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(((WorldServer) this.world).getServer(), this);
|
||||
if (this.bukkitEntity == null) {
|
||||
this.bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this);
|
||||
}
|
||||
return bukkitEntity;
|
||||
return this.bukkitEntity;
|
||||
}
|
||||
|
||||
public void setPassengerOf(Entity entity) {
|
||||
@ -1179,12 +1160,9 @@ public abstract class Entity {
|
||||
if (entity == null) {
|
||||
if (this.vehicle != null) {
|
||||
// CraftBukkit start
|
||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
|
||||
CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
|
||||
LivingEntity living = (LivingEntity) getBukkitEntity();
|
||||
|
||||
VehicleExitEvent event = new VehicleExitEvent(cvehicle, living);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -1195,12 +1173,9 @@ public abstract class Entity {
|
||||
this.vehicle = null;
|
||||
} else if (this.vehicle == entity) {
|
||||
// CraftBukkit start
|
||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
|
||||
CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
|
||||
LivingEntity living = (LivingEntity) getBukkitEntity();
|
||||
|
||||
VehicleExitEvent event = new VehicleExitEvent(cvehicle, living);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -1247,24 +1222,22 @@ public abstract class Entity {
|
||||
byte b0 = this.datawatcher.a(0);
|
||||
|
||||
if (flag) {
|
||||
this.datawatcher.b(0, Byte.valueOf((byte) (b0 | 1 << i)));
|
||||
this.datawatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << i)));
|
||||
} else {
|
||||
this.datawatcher.b(0, Byte.valueOf((byte) (b0 & ~(1 << i))));
|
||||
this.datawatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << i))));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(EntityWeatherStorm entityweatherstorm) {
|
||||
// CraftBukkit start
|
||||
int damage = 5;
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), getBukkitEntity(), DamageCause.LIGHTNING, damage);
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.LIGHTNING, 5);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
damage = event.getDamage();
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.a(damage);
|
||||
this.burn(event.getDamage());
|
||||
// CraftBukkit end
|
||||
|
||||
++this.fireTicks;
|
||||
|
@ -3,12 +3,10 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -19,9 +17,9 @@ public class EntityArrow extends Entity {
|
||||
private int f = -1;
|
||||
private int g = 0;
|
||||
private int h = 0;
|
||||
private boolean i = false;
|
||||
public boolean a = false;
|
||||
public int b = 0;
|
||||
private boolean inGround = false;
|
||||
public boolean fromPlayer = false;
|
||||
public int shake = 0;
|
||||
public EntityLiving shooter;
|
||||
private int j;
|
||||
private int k = 0;
|
||||
@ -41,7 +39,7 @@ public class EntityArrow extends Entity {
|
||||
public EntityArrow(World world, EntityLiving entityliving) {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
this.a = entityliving instanceof EntityHuman;
|
||||
this.fromPlayer = entityliving instanceof EntityHuman;
|
||||
this.b(0.5F, 0.5F);
|
||||
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.s(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
||||
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
|
||||
@ -95,15 +93,15 @@ public class EntityArrow extends Entity {
|
||||
AxisAlignedBB axisalignedbb = Block.byId[i].d(this.world, this.d, this.e, this.f);
|
||||
|
||||
if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) {
|
||||
this.i = true;
|
||||
this.inGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.b > 0) {
|
||||
--this.b;
|
||||
if (this.shake > 0) {
|
||||
--this.shake;
|
||||
}
|
||||
|
||||
if (this.i) {
|
||||
if (this.inGround) {
|
||||
i = this.world.getTypeId(this.d, this.e, this.f);
|
||||
int j = this.world.getData(this.d, this.e, this.f);
|
||||
|
||||
@ -113,7 +111,7 @@ public class EntityArrow extends Entity {
|
||||
this.die();
|
||||
}
|
||||
} else {
|
||||
this.i = false;
|
||||
this.inGround = false;
|
||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
|
||||
@ -168,17 +166,15 @@ public class EntityArrow extends Entity {
|
||||
// CraftBukkit start
|
||||
boolean stick;
|
||||
if (entity instanceof EntityLiving) {
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
|
||||
// TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
|
||||
// or leave as DamageCause.ENTITY_ATTACK
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
// TODO deal with arrows being fired from a non-entity
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 4;
|
||||
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 4);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||
|
||||
@ -217,8 +213,8 @@ public class EntityArrow extends Entity {
|
||||
this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
|
||||
this.locZ -= this.motZ / (double) f2 * 0.05000000074505806D;
|
||||
this.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
this.i = true;
|
||||
this.b = 7;
|
||||
this.inGround = true;
|
||||
this.shake = 7;
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,9 +269,9 @@ public class EntityArrow extends Entity {
|
||||
nbttagcompound.a("zTile", (short) this.f);
|
||||
nbttagcompound.a("inTile", (byte) this.g);
|
||||
nbttagcompound.a("inData", (byte) this.h);
|
||||
nbttagcompound.a("shake", (byte) this.b);
|
||||
nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0));
|
||||
nbttagcompound.a("player", this.a);
|
||||
nbttagcompound.a("shake", (byte) this.shake);
|
||||
nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0));
|
||||
nbttagcompound.a("player", this.fromPlayer);
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@ -284,16 +280,16 @@ public class EntityArrow extends Entity {
|
||||
this.f = nbttagcompound.d("zTile");
|
||||
this.g = nbttagcompound.c("inTile") & 255;
|
||||
this.h = nbttagcompound.c("inData") & 255;
|
||||
this.b = nbttagcompound.c("shake") & 255;
|
||||
this.i = nbttagcompound.c("inGround") == 1;
|
||||
this.a = nbttagcompound.m("player");
|
||||
this.shake = nbttagcompound.c("shake") & 255;
|
||||
this.inGround = nbttagcompound.c("inGround") == 1;
|
||||
this.fromPlayer = nbttagcompound.m("player");
|
||||
}
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack = new ItemStack(Item.ARROW, 1);
|
||||
if (this.i && this.a && this.b <= 0 && entityhuman.inventory.canPickup(itemstack) > 0) {
|
||||
if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.canHold(itemstack) > 0) {
|
||||
net.minecraft.server.EntityItem item = new net.minecraft.server.EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
||||
|
||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), item));
|
||||
@ -303,9 +299,9 @@ public class EntityArrow extends Entity {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// CraftBukkt end
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.i && this.a && this.b <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) {
|
||||
if (this.inGround && this.fromPlayer && this.shake <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.receive(this, 1);
|
||||
this.die();
|
||||
|
@ -4,8 +4,6 @@ import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
@ -33,12 +31,10 @@ public class EntityBoat extends Entity {
|
||||
|
||||
@Override
|
||||
public void collide(Entity entity) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
|
||||
|
||||
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent(vehicle, hitEntity);
|
||||
server.getPluginManager().callEvent(event);
|
||||
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), hitEntity);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -86,12 +82,7 @@ public class EntityBoat extends Entity {
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
VehicleCreateEvent event = new VehicleCreateEvent(vehicle);
|
||||
server.getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
|
||||
}
|
||||
|
||||
public double m() {
|
||||
@ -103,14 +94,14 @@ public class EntityBoat extends Entity {
|
||||
// CraftBukkit start
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity attacker = (entity == null) ? null : entity.getBukkitEntity();
|
||||
int damage = i;
|
||||
|
||||
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, damage);
|
||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
|
||||
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
// i = event.getDamage(); // TODO Why don't we do this?
|
||||
// CraftBukkit end
|
||||
|
||||
this.c = -this.c;
|
||||
@ -121,7 +112,7 @@ public class EntityBoat extends Entity {
|
||||
|
||||
// CraftBukkit start
|
||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
|
||||
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
|
||||
if (destroyEvent.isCancelled()) {
|
||||
this.damage = 40; // Maximize damage so this doesn't get triggered again right away
|
||||
@ -345,10 +336,11 @@ public class EntityBoat extends Entity {
|
||||
this.c(this.yaw, this.pitch);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
CraftWorld world = ((WorldServer) this.world).getWorld();
|
||||
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
|
||||
Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
|
||||
server.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
|
||||
@ -408,12 +400,8 @@ public class EntityBoat extends Entity {
|
||||
} else {
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity player = entityhuman.getBukkitEntity();
|
||||
|
||||
VehicleEnterEvent event = new VehicleEnterEvent(vehicle, player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) this.getBukkitEntity(), entityhuman.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
|
@ -1,11 +1,9 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.TrigMath;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityCreature extends EntityLiving {
|
||||
@ -30,9 +28,8 @@ public class EntityCreature extends EntityLiving {
|
||||
// CraftBukkit start
|
||||
Entity target = this.findTarget();
|
||||
if (target != null) {
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
@ -49,9 +46,8 @@ public class EntityCreature extends EntityLiving {
|
||||
}
|
||||
} else if (!this.target.S()) {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
@ -202,7 +198,7 @@ public class EntityCreature extends EntityLiving {
|
||||
return this.pathEntity != null;
|
||||
}
|
||||
|
||||
public void a(PathEntity pathentity) {
|
||||
public void setPathEntity(PathEntity pathentity) {
|
||||
this.pathEntity = pathentity;
|
||||
}
|
||||
|
||||
@ -210,7 +206,7 @@ public class EntityCreature extends EntityLiving {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
public void c(Entity entity) {
|
||||
public void setTarget(Entity entity) {
|
||||
this.target = entity;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.CreeperPowerEvent;
|
||||
@ -32,7 +31,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.datawatcher.b(17, Byte.valueOf((byte) (nbttagcompound.m("powered") ? 1 : 0)));
|
||||
this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.m("powered") ? 1 : 0)));
|
||||
}
|
||||
|
||||
protected void b(Entity entity, float f) {
|
||||
@ -84,8 +83,8 @@ public class EntityCreeper extends EntityMonster {
|
||||
return "mob.creeperdeath";
|
||||
}
|
||||
|
||||
public void a(Entity entity) {
|
||||
super.a(entity);
|
||||
public void die(Entity entity) {
|
||||
super.die(entity);
|
||||
if (entity instanceof EntitySkeleton) {
|
||||
this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
|
||||
}
|
||||
@ -110,11 +109,10 @@ public class EntityCreeper extends EntityMonster {
|
||||
++this.fuseTicks;
|
||||
if (this.fuseTicks >= 30) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
float radius = this.isPowered() ? 6.0F : 3.0F;
|
||||
|
||||
float radius = this.t() ? 6.0F : 3.0F;
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), radius, false);
|
||||
server.getPluginManager().callEvent(event);
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(this.world.getServer(), this), radius, false);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
@ -130,7 +128,7 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean t() {
|
||||
public boolean isPowered() {
|
||||
return this.datawatcher.a(17) == 1;
|
||||
}
|
||||
|
||||
@ -143,24 +141,28 @@ public class EntityCreeper extends EntityMonster {
|
||||
}
|
||||
|
||||
private void e(int i) {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) i));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) i));
|
||||
}
|
||||
|
||||
public void a(EntityWeatherStorm entityweatherstorm) {
|
||||
super.a(entityweatherstorm);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
|
||||
CreeperPowerEvent event = new CreeperPowerEvent(entity, entityweatherstorm.getBukkitEntity(), CreeperPowerEvent.PowerCause.LIGHTNING);
|
||||
server.getPluginManager().callEvent(event);
|
||||
CreeperPowerEvent event = new CreeperPowerEvent(this.getBukkitEntity(), entityweatherstorm.getBukkitEntity(), CreeperPowerEvent.PowerCause.LIGHTNING);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.datawatcher.b(17, Byte.valueOf((byte) 1));
|
||||
this.setPowered(true);
|
||||
}
|
||||
|
||||
public void setPowered(boolean powered) {
|
||||
if (!powered) {
|
||||
this.datawatcher.watch(17, Byte.valueOf((byte) 0));
|
||||
} else
|
||||
// CraftBukkit end
|
||||
this.datawatcher.watch(17, Byte.valueOf((byte) 1));
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,10 @@ import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -23,7 +19,7 @@ public class EntityEgg extends Entity {
|
||||
private int e = 0;
|
||||
private boolean f = false;
|
||||
public int a = 0;
|
||||
public EntityLiving thrower; // CraftBukkit private -> public
|
||||
public EntityLiving thrower; // CraftBukkit - private -> public
|
||||
private int h;
|
||||
private int i = 0;
|
||||
|
||||
@ -157,15 +153,12 @@ public class EntityEgg extends Entity {
|
||||
if (movingobjectposition.entity != null) {
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
stick = !event.getBounce();
|
||||
@ -191,11 +184,10 @@ public class EntityEgg extends Entity {
|
||||
CreatureType hatchingType = CreatureType.CHICKEN;
|
||||
|
||||
if (this.thrower instanceof EntityPlayer) {
|
||||
CraftServer server = this.world.getServer();
|
||||
Player player = (this.thrower == null) ? null : (Player) this.thrower.getBukkitEntity();
|
||||
org.bukkit.entity.Player player = (this.thrower == null) ? null : (org.bukkit.entity.Player) this.thrower.getBukkitEntity();
|
||||
|
||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
|
||||
server.getPluginManager().callEvent(event);
|
||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
hatching = event.isHatching();
|
||||
numHatching = event.getNumHatches();
|
||||
@ -337,7 +329,7 @@ public class EntityEgg extends Entity {
|
||||
}
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (this.f && this.thrower == entityhuman && this.a <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) {
|
||||
if (this.f && this.thrower == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.receive(this, 1);
|
||||
this.die();
|
||||
|
@ -3,14 +3,12 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.entity.Explosive;
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Explosive;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -48,7 +46,7 @@ public class EntityFireball extends Entity {
|
||||
this.height = 0.0F;
|
||||
this.motX = this.motY = this.motZ = 0.0D;
|
||||
// CraftBukkit start (added setDirection method)
|
||||
setDirection(d0, d1, d2);
|
||||
this.setDirection(d0, d1, d2);
|
||||
}
|
||||
|
||||
public void setDirection(double d0, double d1, double d2) {
|
||||
@ -134,15 +132,12 @@ public class EntityFireball extends Entity {
|
||||
if (movingobjectposition.entity != null) {
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||
|
||||
@ -160,11 +155,9 @@ public class EntityFireball extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
CraftServer server = this.world.getServer();
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(this.world.getServer(), this));
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this));
|
||||
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
// give 'this' instead of (Entity) null so we know what causes the damage
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
||||
|
@ -3,11 +3,9 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityFish extends Entity {
|
||||
@ -194,15 +192,12 @@ public class EntityFish extends Entity {
|
||||
// TODO add EntityDamagedByProjectileEvent : fishing hook?
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
stick = !event.getBounce();
|
||||
|
@ -1,10 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
//CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityGhast extends EntityFlying implements IMonster {
|
||||
@ -13,7 +11,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
public double b;
|
||||
public double c;
|
||||
public double d;
|
||||
private Entity g = null;
|
||||
private Entity target = null;
|
||||
private int h = 0;
|
||||
public int e = 0;
|
||||
public int f = 0;
|
||||
@ -22,7 +20,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
super(world);
|
||||
this.texture = "/mob/ghast.png";
|
||||
this.b(4.0F, 4.0F);
|
||||
this.bD = true;
|
||||
this.fireProof = true;
|
||||
}
|
||||
|
||||
protected void b() {
|
||||
@ -68,53 +66,51 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.g != null && this.g.dead) {
|
||||
if (this.target != null && this.target.dead) {
|
||||
// CraftBukkit start
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
|
||||
CraftServer server = this.world.getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.g = null;
|
||||
this.target = null;
|
||||
} else {
|
||||
this.g = ((CraftEntity) event.getTarget()).getHandle();
|
||||
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.g == null || this.h-- <= 0) {
|
||||
if (this.target == null || this.h-- <= 0) {
|
||||
// CraftBukkit start
|
||||
Entity target = this.world.a(this, 100.0D);
|
||||
Entity target = this.world.findNearbyPlayer(this, 100.0D);
|
||||
if (target != null) {
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
|
||||
CraftServer server = this.world.getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.g = null;
|
||||
this.target = null;
|
||||
} else {
|
||||
this.g = ((CraftEntity) event.getTarget()).getHandle();
|
||||
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.g != null) {
|
||||
if (this.target != null) {
|
||||
this.h = 20;
|
||||
}
|
||||
}
|
||||
|
||||
double d4 = 64.0D;
|
||||
|
||||
if (this.g != null && this.g.g(this) < d4 * d4) {
|
||||
double d5 = this.g.locX - this.locX;
|
||||
double d6 = this.g.boundingBox.b + (double) (this.g.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
|
||||
double d7 = this.g.locZ - this.locZ;
|
||||
if (this.target != null && this.target.g(this) < d4 * d4) {
|
||||
double d5 = this.target.locX - this.locX;
|
||||
double d6 = this.target.boundingBox.b + (double) (this.target.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
|
||||
double d7 = this.target.locZ - this.locZ;
|
||||
|
||||
this.K = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
||||
if (this.e(this.g)) {
|
||||
if (this.e(this.target)) {
|
||||
if (this.f == 10) {
|
||||
this.world.makeSound(this, "mob.ghast.charge", this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
@ -147,7 +143,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
byte b1 = (byte) (this.f > 10 ? 1 : 0);
|
||||
|
||||
if (b0 != b1) {
|
||||
this.datawatcher.b(16, Byte.valueOf(b1));
|
||||
this.datawatcher.watch(16, Byte.valueOf(b1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,15 +4,12 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
||||
import org.bukkit.craftbukkit.TrigMath;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -221,8 +218,8 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
entity.b(this);
|
||||
}
|
||||
|
||||
public void a(Entity entity) {
|
||||
super.a(entity);
|
||||
public void die(Entity entity) {
|
||||
super.die(entity);
|
||||
this.b(0.2F, 0.2F);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.motY = 0.10000000149011612D;
|
||||
@ -252,7 +249,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
|
||||
public void E() {
|
||||
this.a(this.inventory.a(this.inventory.itemInHandIndex, 1), false);
|
||||
this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
@ -289,11 +286,10 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
// CraftBukkit start
|
||||
Player player = (Player) this.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftItem drop = new CraftItem(server, entityitem);
|
||||
CraftItem drop = new CraftItem(this.world.getServer(), entityitem);
|
||||
|
||||
PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
org.bukkit.inventory.ItemStack stack = drop.getItemStack();
|
||||
@ -344,13 +340,12 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.a(true, true, false);
|
||||
}
|
||||
|
||||
// CraftBukkit - Start
|
||||
// CraftBukkit start
|
||||
this.spawnWorld = nbttagcompound.getString("SpawnWorld");
|
||||
if (this.spawnWorld == "") {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
this.spawnWorld = server.getWorlds().get(0).getName();
|
||||
this.spawnWorld = this.world.getServer().getWorlds().get(0).getName();
|
||||
}
|
||||
// CraftBukkit - End
|
||||
// CraftBukkit end
|
||||
|
||||
if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
|
||||
this.b = new ChunkCoordinates(nbttagcompound.e("SpawnX"), nbttagcompound.e("SpawnY"), nbttagcompound.e("SpawnZ"));
|
||||
@ -420,12 +415,11 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
if (object instanceof EntityLiving) {
|
||||
// CraftBukkit start - this is here instead of EntityMonster because EntityLiving(s) that aren't monsters
|
||||
// also damage the player in this way. For example, EntitySlime.
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damager = ((Entity) object).getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, i);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || event.getDamage() == 0) {
|
||||
return false;
|
||||
@ -452,7 +446,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
if (entityliving instanceof EntityWolf) {
|
||||
EntityWolf entitywolf = (EntityWolf) entityliving;
|
||||
|
||||
if (entitywolf.A() && this.name.equals(entitywolf.x())) {
|
||||
if (entitywolf.isTamed() && this.name.equals(entitywolf.getOwnerName())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -465,26 +459,25 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
EntityWolf entitywolf1 = (EntityWolf) entity;
|
||||
|
||||
if (entitywolf1.A() && entitywolf1.E() == null && this.name.equals(entitywolf1.x()) && (!flag || !entitywolf1.isSitting())) {
|
||||
if (entitywolf1.isTamed() && entitywolf1.E() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
bukkitTarget = entityliving.getBukkitEntity();
|
||||
}
|
||||
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entityliving.getBukkitEntity();
|
||||
|
||||
EntityTargetEvent event;
|
||||
if (flag) {
|
||||
event = new EntityTargetEvent(entitywolf1.getBukkitEntity(), bukkitTarget, TargetReason.OWNER_ATTACKED_TARGET);
|
||||
event = new EntityTargetEvent(entitywolf1.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET);
|
||||
} else {
|
||||
event = new EntityTargetEvent(entitywolf1.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_OWNER);
|
||||
event = new EntityTargetEvent(entitywolf1.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER);
|
||||
}
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
entitywolf1.setSitting(false);
|
||||
entitywolf1.c(entityliving);
|
||||
if (event.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entitywolf1.setSitting(false);
|
||||
entitywolf1.setTarget(entityliving);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,13 +542,11 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
// CraftBukkit start - Don't call the event when the entity is human since it will be called with damageEntity
|
||||
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, i);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || event.getDamage() == 0) {
|
||||
return;
|
||||
@ -628,11 +619,10 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
// CraftBukkit start
|
||||
if (this.getBukkitEntity() instanceof Player) {
|
||||
Player player = (Player) this.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.block.Block bed = this.world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return EnumBedError.OTHER_PROBLEM;
|
||||
@ -727,17 +717,16 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
// CraftBukkit start
|
||||
if (this.getBukkitEntity() instanceof Player) {
|
||||
Player player = (Player) this.getBukkitEntity();
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
|
||||
org.bukkit.block.Block bed;
|
||||
if (chunkcoordinates != null) {
|
||||
bed = ((WorldServer) world).getWorld().getBlockAt(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
|
||||
bed = this.world.getWorld().getBlockAt(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
|
||||
} else {
|
||||
bed = ((WorldServer) world).getWorld().getBlockAt(player.getLocation());
|
||||
bed = this.world.getWorld().getBlockAt(player.getLocation());
|
||||
}
|
||||
|
||||
PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -782,14 +771,14 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
public void a(String s) {}
|
||||
|
||||
public ChunkCoordinates M() {
|
||||
public ChunkCoordinates getBed() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void a(ChunkCoordinates chunkcoordinates) {
|
||||
if (chunkcoordinates != null) {
|
||||
this.b = new ChunkCoordinates(chunkcoordinates);
|
||||
this.spawnWorld = world.worldData.name; // CraftBukkit
|
||||
this.spawnWorld = this.world.worldData.name; // CraftBukkit
|
||||
} else {
|
||||
this.b = null;
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
|
||||
|
||||
public class EntityItem extends Entity {
|
||||
|
||||
@ -94,7 +91,7 @@ public class EntityItem extends Entity {
|
||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||
}
|
||||
|
||||
protected void a(int i) {
|
||||
protected void burn(int i) {
|
||||
this.damageEntity((Entity) null, i);
|
||||
}
|
||||
|
||||
@ -127,7 +124,7 @@ public class EntityItem extends Entity {
|
||||
int i = this.itemStack.count;
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.pickupDelay <= 0 && entityhuman.inventory.canPickup(this.itemStack) > 0) {
|
||||
if (this.pickupDelay <= 0 && entityhuman.inventory.canHold(this.itemStack) > 0) {
|
||||
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -140,7 +137,7 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.pickupDelay == 0 && entityhuman.inventory.canHold(this.itemStack)) {
|
||||
if (this.pickupDelay == 0 && entityhuman.inventory.pickup(this.itemStack)) {
|
||||
if (this.itemStack.id == Block.LOG.id) {
|
||||
entityhuman.a((Statistic) AchievementList.g);
|
||||
}
|
||||
|
@ -3,15 +3,10 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.TrigMath;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
// CraftBukkit end
|
||||
@ -122,13 +117,8 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
if (this.S() && this.J()) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity victim = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.SUFFOCATION;
|
||||
int damage = 1;
|
||||
|
||||
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.SUFFOCATION, 1);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.damageEntity((Entity) null, event.getDamage());
|
||||
@ -136,7 +126,7 @@ public abstract class EntityLiving extends Entity {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
if (this.bD || this.world.isStatic) {
|
||||
if (this.fireProof || this.world.isStatic) {
|
||||
this.fireTicks = 0;
|
||||
}
|
||||
|
||||
@ -156,15 +146,10 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.DROWNING;
|
||||
int damageDone = 2;
|
||||
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.DROWNING, 2);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (!event.isCancelled() && event.getDamage() != 0) {
|
||||
this.damageEntity((Entity) null, event.getDamage());
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -331,10 +316,8 @@ public abstract class EntityLiving extends Entity {
|
||||
public void b(int i) {
|
||||
// CraftBukkit start - Added event
|
||||
if (this.health > 0) {
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
EntityRegainHealthEvent event = new EntityRegainHealthEvent(entity, i);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.health += event.getAmount();
|
||||
@ -400,7 +383,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.world.makeSound(this, this.i(), this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
|
||||
this.a(entity);
|
||||
this.die(entity);
|
||||
} else if (flag) {
|
||||
this.world.makeSound(this, this.h(), this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
@ -445,7 +428,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Entity entity) {
|
||||
public void die(Entity entity) {
|
||||
if (this.W >= 0 && entity != null) {
|
||||
entity.c(this, this.W);
|
||||
}
|
||||
@ -466,21 +449,20 @@ public abstract class EntityLiving extends Entity {
|
||||
int i = this.j();
|
||||
|
||||
// CraftBukkit start - whole method
|
||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
int count = random.nextInt(3);
|
||||
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
int count = this.random.nextInt(3);
|
||||
|
||||
if ((i > 0) && (count > 0)) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(i, count));
|
||||
}
|
||||
|
||||
CraftEntity entity = (CraftEntity) getBukkitEntity();
|
||||
CraftEntity entity = (CraftEntity) this.getBukkitEntity();
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
Server server = ((WorldServer) world).getServer();
|
||||
server.getPluginManager().callEvent(event);
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
||||
cworld.dropItemNaturally(entity.getLocation(), stack);
|
||||
bworld.dropItemNaturally(entity.getLocation(), stack);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -495,12 +477,8 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
if (i > 0) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity victim = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.FALL;
|
||||
|
||||
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, i);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FALL, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled() && event.getDamage() != 0) {
|
||||
this.damageEntity((Entity) null, event.getDamage());
|
||||
@ -745,7 +723,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
protected void T() {
|
||||
EntityHuman entityhuman = this.world.a(this, -1.0D);
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||
|
||||
if (this.l_() && entityhuman != null) {
|
||||
double d0 = entityhuman.locX - this.locX;
|
||||
@ -769,7 +747,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
protected void c_() {
|
||||
++this.ay;
|
||||
EntityHuman entityhuman = this.world.a(this, -1.0D);
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||
|
||||
this.T();
|
||||
this.az = 0.0F;
|
||||
@ -777,7 +755,7 @@ public abstract class EntityLiving extends Entity {
|
||||
float f = 8.0F;
|
||||
|
||||
if (this.random.nextFloat() < 0.02F) {
|
||||
entityhuman = this.world.a(this, (double) f);
|
||||
entityhuman = this.world.findNearbyPlayer(this, (double) f);
|
||||
if (entityhuman != null) {
|
||||
this.b = entityhuman;
|
||||
this.aF = 10 + this.random.nextInt(20);
|
||||
@ -871,20 +849,14 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
protected void X() {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.VOID;
|
||||
org.bukkit.block.Block damager = null;
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
int damageDone = 4;
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.VOID, 4);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || event.getDamage() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
damageDone = event.getDamage();
|
||||
this.damageEntity((Entity) null, damageDone);
|
||||
this.damageEntity((Entity) null, event.getDamage());
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,14 @@ import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.vehicle.*;
|
||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
import org.bukkit.event.vehicle.VehicleUpdateEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityMinecart extends Entity implements IInventory {
|
||||
@ -85,13 +89,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.lastZ = d2;
|
||||
this.type = i;
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
|
||||
VehicleCreateEvent event = new VehicleCreateEvent(vehicle);
|
||||
server.getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
|
||||
}
|
||||
|
||||
public double m() {
|
||||
@ -103,10 +101,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
// CraftBukkit start
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity passenger = (entity == null) ? null : entity.getBukkitEntity();
|
||||
int damage = i;
|
||||
|
||||
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, damage);
|
||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
|
||||
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
@ -126,7 +123,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
|
||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
|
||||
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
|
||||
if (destroyEvent.isCancelled()) {
|
||||
this.damage = 40; // Maximize damage so this doesn't get triggered again right away
|
||||
@ -401,7 +398,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
// CraftBukkit
|
||||
if (this.passenger != null || !slowWhenEmpty) {
|
||||
if (this.passenger != null || !this.slowWhenEmpty) {
|
||||
this.motX *= 0.996999979019165D;
|
||||
this.motY *= 0.0D;
|
||||
this.motZ *= 0.996999979019165D;
|
||||
@ -520,9 +517,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.move(this.motX, this.motY, this.motZ);
|
||||
if (!this.onGround) {
|
||||
// CraftBukkit start
|
||||
this.motX *= flyingX;
|
||||
this.motY *= flyingY;
|
||||
this.motZ *= flyingZ;
|
||||
this.motX *= this.flyingX;
|
||||
this.motY *= this.flyingY;
|
||||
this.motZ *= this.flyingZ;
|
||||
// CraftBukkit start
|
||||
}
|
||||
}
|
||||
@ -556,17 +553,15 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
this.c(this.yaw, this.pitch);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
CraftWorld world = ((WorldServer) this.world).getWorld();
|
||||
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
|
||||
server.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
|
||||
this.world.getServer().getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
|
||||
|
||||
if (!from.equals(to)) {
|
||||
VehicleMoveEvent event = new VehicleMoveEvent(vehicle, from, to);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(new VehicleMoveEvent(vehicle, from, to));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -713,12 +708,11 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
if (!this.world.isStatic) {
|
||||
if (entity != this.passenger) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
|
||||
|
||||
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, hitEntity);
|
||||
server.getPluginManager().callEvent(collisionEvent);
|
||||
this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
||||
|
||||
if (collisionEvent.isCancelled()) {
|
||||
return;
|
||||
@ -726,9 +720,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && this.type == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
|
||||
if (!collisionEvent.isPickupCancelled()) {
|
||||
|
||||
VehicleEnterEvent enterEvent = new VehicleEnterEvent(vehicle, hitEntity);
|
||||
server.getPluginManager().callEvent(enterEvent);
|
||||
this.world.getServer().getPluginManager().callEvent(enterEvent);
|
||||
|
||||
if (!enterEvent.isCancelled()) {
|
||||
entity.mount(this);
|
||||
@ -812,7 +805,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
return this.items[i];
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
@ -858,12 +851,10 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity player = (entityhuman == null) ? null : entityhuman.getBukkitEntity();
|
||||
|
||||
VehicleEnterEvent event = new VehicleEnterEvent(vehicle, player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) this.getBukkitEntity(), player);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
|
@ -1,14 +1,10 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityMonster extends EntityCreature implements IMonster {
|
||||
@ -38,7 +34,7 @@ public class EntityMonster extends EntityCreature implements IMonster {
|
||||
}
|
||||
|
||||
protected Entity findTarget() {
|
||||
EntityHuman entityhuman = this.world.a(this, 16.0D);
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, 16.0D);
|
||||
|
||||
return entityhuman != null && this.e(entityhuman) ? entityhuman : null;
|
||||
}
|
||||
@ -48,14 +44,10 @@ public class EntityMonster extends EntityCreature implements IMonster {
|
||||
if (this.passenger != entity && this.vehicle != entity) {
|
||||
if (entity != this) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
@ -83,13 +75,10 @@ public class EntityMonster extends EntityCreature implements IMonster {
|
||||
// to damage another EntityMonster, and we want to catch those events.
|
||||
// This does not fire events for slime attacks, av they're not lastDamage EntityMonster.
|
||||
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, this.damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
entity.damageEntity(this, event.getDamage());
|
||||
|
@ -4,10 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||
import org.bukkit.event.painting.PaintingBreakByWorldEvent;
|
||||
import org.bukkit.entity.Painting;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityPainting extends Entity {
|
||||
@ -124,9 +122,8 @@ public class EntityPainting extends Entity {
|
||||
this.f = 0;
|
||||
if (!this.h()) {
|
||||
// CraftBukkit start
|
||||
Painting painting = (Painting) getBukkitEntity();
|
||||
PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent(painting);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent((org.bukkit.entity.Painting) this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -204,9 +201,8 @@ public class EntityPainting extends Entity {
|
||||
public boolean damageEntity(Entity entity, int i) {
|
||||
if (!this.dead && !this.world.isStatic) {
|
||||
// CraftBukkit start
|
||||
Painting painting = (Painting) getBukkitEntity();
|
||||
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent(painting, entity == null ? null : entity.getBukkitEntity());
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent((org.bukkit.entity.Painting) this.getBukkitEntity(), entity == null ? null : entity.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.entity.PigZapEvent;
|
||||
// CraftBukkit end
|
||||
@ -20,12 +19,12 @@ public class EntityPig extends EntityAnimal {
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.a("Saddle", this.x());
|
||||
nbttagcompound.a("Saddle", this.hasSaddle());
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
this.a(nbttagcompound.m("Saddle"));
|
||||
this.setSaddle(nbttagcompound.m("Saddle"));
|
||||
}
|
||||
|
||||
protected String g() {
|
||||
@ -41,7 +40,7 @@ public class EntityPig extends EntityAnimal {
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
if (this.x() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
|
||||
if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
|
||||
entityhuman.mount(this);
|
||||
return true;
|
||||
} else {
|
||||
@ -53,15 +52,15 @@ public class EntityPig extends EntityAnimal {
|
||||
return this.fireTicks > 0 ? Item.GRILLED_PORK.id : Item.PORK.id;
|
||||
}
|
||||
|
||||
public boolean x() {
|
||||
public boolean hasSaddle() {
|
||||
return (this.datawatcher.a(16) & 1) != 0;
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
public void setSaddle(boolean flag) {
|
||||
if (flag) {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) 1));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) 1));
|
||||
} else {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) 0));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,11 +69,8 @@ public class EntityPig extends EntityAnimal {
|
||||
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
|
||||
PigZapEvent event = new PigZapEvent(entity, entityweatherstorm.getBukkitEntity(), entitypigzombie.getBukkitEntity());
|
||||
server.getPluginManager().callEvent(event);
|
||||
PigZapEvent event = new PigZapEvent(this.getBukkitEntity(), entityweatherstorm.getBukkitEntity(), entitypigzombie.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
|
@ -3,10 +3,8 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityPigZombie extends EntityZombie {
|
||||
@ -20,7 +18,7 @@ public class EntityPigZombie extends EntityZombie {
|
||||
this.texture = "/mob/pigzombie.png";
|
||||
this.aE = 0.5F;
|
||||
this.damage = 5;
|
||||
this.bD = true;
|
||||
this.fireProof = true;
|
||||
}
|
||||
|
||||
public void o_() {
|
||||
@ -76,14 +74,10 @@ public class EntityPigZombie extends EntityZombie {
|
||||
|
||||
private void d(Entity entity) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.PIG_ZOMBIE_TARGET);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
|
@ -6,13 +6,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
// CraftBukkit end
|
||||
@ -24,8 +19,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public ItemInWorldManager itemInWorldManager;
|
||||
public double d;
|
||||
public double e;
|
||||
public List f = new LinkedList();
|
||||
public Set g = new HashSet();
|
||||
public List chunkCoordIntPairQueue = new LinkedList();
|
||||
public Set playerChunkCoordIntPairs = new HashSet();
|
||||
private int bK = -99999999;
|
||||
private int bL = 60;
|
||||
private ItemStack[] bM = new ItemStack[] { null, null, null, null, null};
|
||||
@ -58,20 +53,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
public String displayName;
|
||||
public Location compassTarget;
|
||||
public org.bukkit.Location compassTarget;
|
||||
// CraftBukkit end
|
||||
|
||||
public void a(World world) {
|
||||
super.a(world);
|
||||
public void spawnIn(World world) {
|
||||
super.spawnIn(world);
|
||||
// CraftBukkit - world fallback code, either respawn location or global spawn
|
||||
if (world == null) {
|
||||
dead = false;
|
||||
this.dead = false;
|
||||
ChunkCoordinates position = null;
|
||||
if (spawnWorld != null && !spawnWorld.equals("")) {
|
||||
CraftWorld cw = (CraftWorld) Bukkit.getServer().getWorld(spawnWorld);
|
||||
if (cw != null && M() != null) {
|
||||
world = cw.getHandle();
|
||||
position = EntityHuman.getBed(cw.getHandle(), M());
|
||||
if (this.spawnWorld != null && !this.spawnWorld.equals("")) {
|
||||
CraftWorld cworld = (CraftWorld) Bukkit.getServer().getWorld(this.spawnWorld);
|
||||
if (cworld != null && this.getBed() != null) {
|
||||
world = cworld.getHandle();
|
||||
position = EntityHuman.getBed(cworld.getHandle(), this.getBed());
|
||||
}
|
||||
}
|
||||
if (world == null || position == null) {
|
||||
@ -79,7 +74,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
position = world.getSpawn();
|
||||
}
|
||||
this.world = world;
|
||||
setPosition(position.x + 0.5, position.y, position.z + 0.5);
|
||||
this.setPosition(position.x + 0.5, position.y, position.z + 0.5);
|
||||
}
|
||||
this.dimension = ((WorldServer) this.world).dimension;
|
||||
// CraftBukkit end
|
||||
@ -112,7 +107,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
ItemStack itemstack = this.b_(i);
|
||||
|
||||
if (itemstack != this.bM[i]) {
|
||||
this.b.b(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
|
||||
this.b.getTracker(this.dimension).a(this, new Packet5EntityEquipment(this.id, i, itemstack));
|
||||
this.bM[i] = itemstack;
|
||||
}
|
||||
}
|
||||
@ -122,40 +117,39 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
|
||||
}
|
||||
|
||||
public void a(Entity entity) {
|
||||
public void die(Entity entity) {
|
||||
// CraftBukkit start
|
||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
for (int i = 0; i < inventory.items.length; ++i) {
|
||||
if (inventory.items[i] != null) {
|
||||
loot.add(new CraftItemStack(inventory.items[i]));
|
||||
for (int i = 0; i < this.inventory.items.length; ++i) {
|
||||
if (this.inventory.items[i] != null) {
|
||||
loot.add(new CraftItemStack(this.inventory.items[i]));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.armor.length; ++i) {
|
||||
if (inventory.armor[i] != null) {
|
||||
loot.add(new CraftItemStack(inventory.armor[i]));
|
||||
for (int i = 0; i < this.inventory.armor.length; ++i) {
|
||||
if (this.inventory.armor[i] != null) {
|
||||
loot.add(new CraftItemStack(this.inventory.armor[i]));
|
||||
}
|
||||
}
|
||||
|
||||
CraftEntity craftEntity = (CraftEntity) getBukkitEntity();
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
Server server = ((WorldServer) world).getServer();
|
||||
org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity();
|
||||
CraftWorld bworld = this.world.getWorld();
|
||||
|
||||
EntityDeathEvent event = new EntityDeathEvent(craftEntity, loot);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDeathEvent event = new EntityDeathEvent(bukkitEntity, loot);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
// CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
||||
for (int i = 0; i < inventory.items.length; ++i) {
|
||||
inventory.items[i] = null;
|
||||
for (int i = 0; i < this.inventory.items.length; ++i) {
|
||||
this.inventory.items[i] = null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < inventory.armor.length; ++i) {
|
||||
inventory.armor[i] = null;
|
||||
for (int i = 0; i < this.inventory.armor.length; ++i) {
|
||||
this.inventory.armor[i] = null;
|
||||
}
|
||||
|
||||
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
||||
cworld.dropItemNaturally(craftEntity.getLocation(), stack);
|
||||
bworld.dropItemNaturally(bukkitEntity.getLocation(), stack);
|
||||
}
|
||||
|
||||
this.x();
|
||||
@ -208,8 +202,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
}
|
||||
|
||||
if (flag && !this.f.isEmpty()) {
|
||||
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.f.get(0);
|
||||
if (flag && !this.chunkCoordIntPairQueue.isEmpty()) {
|
||||
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(0);
|
||||
|
||||
if (chunkcoordintpair != null) {
|
||||
boolean flag1 = false;
|
||||
@ -219,9 +213,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
WorldServer worldserver = this.b.a(this.dimension);
|
||||
WorldServer worldserver = this.b.getWorldServer(this.dimension);
|
||||
|
||||
this.f.remove(chunkcoordintpair);
|
||||
this.chunkCoordIntPairQueue.remove(chunkcoordintpair);
|
||||
this.netServerHandler.sendPacket(new Packet51MapChunk(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, 16, 128, 16, worldserver));
|
||||
List list = worldserver.getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 128, chunkcoordintpair.z * 16 + 16);
|
||||
|
||||
@ -283,7 +277,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public void receive(Entity entity, int i) {
|
||||
if (!entity.dead) {
|
||||
EntityTracker entitytracker = this.b.b(this.dimension);
|
||||
EntityTracker entitytracker = this.b.getTracker(this.dimension);
|
||||
|
||||
if (entity instanceof EntityItem) {
|
||||
entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
|
||||
@ -302,7 +296,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
if (!this.p) {
|
||||
this.q = -1;
|
||||
this.p = true;
|
||||
EntityTracker entitytracker = this.b.b(this.dimension);
|
||||
EntityTracker entitytracker = this.b.getTracker(this.dimension);
|
||||
|
||||
entitytracker.a(this, new Packet18ArmAnimation(this, 1));
|
||||
}
|
||||
@ -314,7 +308,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
EnumBedError enumbederror = super.a(i, j, k);
|
||||
|
||||
if (enumbederror == EnumBedError.OK) {
|
||||
EntityTracker entitytracker = this.b.b(this.dimension);
|
||||
EntityTracker entitytracker = this.b.getTracker(this.dimension);
|
||||
Packet17 packet17 = new Packet17(this, 0, i, j, k);
|
||||
|
||||
entitytracker.a(this, packet17);
|
||||
@ -327,9 +321,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public void a(boolean flag, boolean flag1, boolean flag2) {
|
||||
if (this.isSleeping()) {
|
||||
EntityTracker entitytracker = this.b.b(this.dimension);
|
||||
EntityTracker entitytracker = this.b.getTracker(this.dimension);
|
||||
|
||||
entitytracker.b(this, new Packet18ArmAnimation(this, 3));
|
||||
entitytracker.sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
|
||||
}
|
||||
|
||||
super.a(flag, flag1, flag2);
|
||||
@ -340,7 +334,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public void mount(Entity entity) {
|
||||
// CraftBukkit start
|
||||
setPassengerOf(entity);
|
||||
this.setPassengerOf(entity);
|
||||
}
|
||||
|
||||
public void setPassengerOf(Entity entity) {
|
||||
@ -368,7 +362,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.ah();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 1, "Crafting", 9));
|
||||
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
|
||||
this.activeContainer.f = this.bN;
|
||||
this.activeContainer.windowId = this.bN;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
@ -376,7 +370,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.ah();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 0, iinventory.getName(), iinventory.getSize()));
|
||||
this.activeContainer = new ContainerChest(this.inventory, iinventory);
|
||||
this.activeContainer.f = this.bN;
|
||||
this.activeContainer.windowId = this.bN;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
@ -384,7 +378,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.ah();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
|
||||
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
|
||||
this.activeContainer.f = this.bN;
|
||||
this.activeContainer.windowId = this.bN;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
@ -392,35 +386,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.ah();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
|
||||
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
|
||||
this.activeContainer.f = this.bN;
|
||||
this.activeContainer.windowId = this.bN;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
}
|
||||
|
||||
public void a(Container container, int i, ItemStack itemstack) {
|
||||
if (!(container.b(i) instanceof SlotResult)) {
|
||||
if (!this.h) {
|
||||
this.netServerHandler.sendPacket(new Packet103SetSlot(container.f, i, itemstack));
|
||||
this.netServerHandler.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Container container) {
|
||||
public void updateInventory(Container container) {
|
||||
this.a(container, container.b());
|
||||
}
|
||||
|
||||
public void a(Container container, List list) {
|
||||
this.netServerHandler.sendPacket(new Packet104WindowItems(container.f, list));
|
||||
this.netServerHandler.sendPacket(new Packet104WindowItems(container.windowId, list));
|
||||
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.j()));
|
||||
}
|
||||
|
||||
public void a(Container container, int i, int j) {
|
||||
this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.f, i, j));
|
||||
this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j));
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
|
||||
public void x() {
|
||||
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.f));
|
||||
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
|
||||
this.z();
|
||||
}
|
||||
|
||||
@ -487,18 +481,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public boolean relativeTime = true;
|
||||
|
||||
public long getPlayerTime() {
|
||||
if (relativeTime) {
|
||||
if (this.relativeTime) {
|
||||
// Adds timeOffset to the current server time.
|
||||
return world.getTime() + timeOffset;
|
||||
return this.world.getTime() + this.timeOffset;
|
||||
} else {
|
||||
// Adds timeOffset to the beginning of this day.
|
||||
return world.getTime() - (world.getTime() % 24000) + timeOffset;
|
||||
return this.world.getTime() - (this.world.getTime() % 24000) + this.timeOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "(" + name + " at " + locX + "," + locY + "," + locZ + ")";
|
||||
return super.toString() + "(" + this.name + " at " + this.locX + "," + this.locY + "," + this.locZ + ")";
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -1,12 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
// CraftBukkit end
|
||||
@ -38,11 +32,8 @@ public class EntitySkeleton extends EntityMonster {
|
||||
|
||||
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
|
||||
EntityCombustEvent event = new EntityCombustEvent(entity);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.fireTicks = 300;
|
||||
@ -91,7 +82,7 @@ public class EntitySkeleton extends EntityMonster {
|
||||
|
||||
protected void r() {
|
||||
// CraftBukkit start - whole method
|
||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
int count = this.random.nextInt(3);
|
||||
if (count > 0) {
|
||||
@ -103,15 +94,14 @@ public class EntitySkeleton extends EntityMonster {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.BONE, count));
|
||||
}
|
||||
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
Server server = ((WorldServer) world).getServer();
|
||||
CraftEntity entity = (CraftEntity) getBukkitEntity();
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
||||
cworld.dropItemNaturally(entity.getLocation(), stack);
|
||||
bworld.dropItemNaturally(entity.getLocation(), stack);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -3,12 +3,10 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntitySnowball extends Entity {
|
||||
@ -19,7 +17,7 @@ public class EntitySnowball extends Entity {
|
||||
private int e = 0;
|
||||
private boolean f = false;
|
||||
public int a = 0;
|
||||
public EntityLiving shooter; // CraftBukkit private -> public
|
||||
public EntityLiving shooter; // CraftBukkit - private -> public
|
||||
private int h;
|
||||
private int i = 0;
|
||||
|
||||
@ -153,15 +151,12 @@ public class EntitySnowball extends Entity {
|
||||
if (movingobjectposition.entity != null) {
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
int damage = 0;
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@ -250,7 +245,7 @@ public class EntitySnowball extends Entity {
|
||||
}
|
||||
|
||||
public void b(EntityHuman entityhuman) {
|
||||
if (this.f && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.canHold(new ItemStack(Item.ARROW, 1))) {
|
||||
if (this.f && this.shooter == entityhuman && this.a <= 0 && entityhuman.inventory.pickup(new ItemStack(Item.ARROW, 1))) {
|
||||
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||
entityhuman.receive(this, 1);
|
||||
this.die();
|
||||
|
@ -1,10 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntitySpider extends EntityMonster {
|
||||
@ -30,7 +28,7 @@ public class EntitySpider extends EntityMonster {
|
||||
if (f < 0.5F) {
|
||||
double d0 = 16.0D;
|
||||
|
||||
return this.world.a(this, d0);
|
||||
return this.world.findNearbyPlayer(this, d0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -53,9 +51,8 @@ public class EntitySpider extends EntityMonster {
|
||||
|
||||
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
|
@ -1,14 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.entity.EntityDeathEvent; // CraftBukkit
|
||||
|
||||
public class EntitySquid extends EntityWaterAnimal {
|
||||
|
||||
@ -64,22 +56,21 @@ public class EntitySquid extends EntityWaterAnimal {
|
||||
|
||||
protected void r() {
|
||||
// CraftBukkit start - whole method
|
||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
int count = this.random.nextInt(3) + 1;
|
||||
if (count > 0) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.INK_SACK, count));
|
||||
}
|
||||
|
||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
||||
Server server = ((WorldServer) world).getServer();
|
||||
CraftEntity entity = (CraftEntity) getBukkitEntity();
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||
cworld.dropItemNaturally(entity.getLocation(), stack);
|
||||
bworld.dropItemNaturally(entity.getLocation(), stack);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
|
||||
public class EntityTNTPrimed extends Entity {
|
||||
|
||||
public int a;
|
||||
public int fuseTicks;
|
||||
public float yield = 4; // CraftBukkit
|
||||
public boolean isIncendiary = false; // CraftBukkit
|
||||
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
this.a = 0;
|
||||
this.fuseTicks = 0;
|
||||
this.aI = true;
|
||||
this.b(0.98F, 0.98F);
|
||||
this.height = this.width / 2.0F;
|
||||
@ -29,7 +29,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.motX = (double) (-MathHelper.sin(f * 3.1415927F / 180.0F) * 0.02F);
|
||||
this.motY = 0.20000000298023224D;
|
||||
this.motZ = (double) (-MathHelper.cos(f * 3.1415927F / 180.0F) * 0.02F);
|
||||
this.a = 80;
|
||||
this.fuseTicks = 80;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
@ -60,7 +60,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.motY *= -0.5D;
|
||||
}
|
||||
|
||||
if (this.a-- <= 0) {
|
||||
if (this.fuseTicks-- <= 0) {
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event.
|
||||
this.explode();
|
||||
@ -78,7 +78,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
// CraftBukkit start
|
||||
// float f = 4.0F;
|
||||
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
CraftServer server = this.world.getServer();
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this));
|
||||
server.getPluginManager().callEvent(event);
|
||||
@ -91,10 +91,10 @@ public class EntityTNTPrimed extends Entity {
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.a("Fuse", (byte) this.a);
|
||||
nbttagcompound.a("Fuse", (byte) this.fuseTicks);
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.a = nbttagcompound.c("Fuse");
|
||||
this.fuseTicks = nbttagcompound.c("Fuse");
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class EntityTracker {
|
||||
}
|
||||
|
||||
// CraftBukkit - synchronized
|
||||
public synchronized void a(Entity entity) {
|
||||
public synchronized void track(Entity entity) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
this.a(entity, 512, 2);
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
@ -80,7 +80,7 @@ public class EntityTracker {
|
||||
|
||||
this.a.add(entitytrackerentry);
|
||||
this.b.a(entity.id, entitytrackerentry);
|
||||
entitytrackerentry.scanPlayers(this.c.a(this.e).players);
|
||||
entitytrackerentry.scanPlayers(this.c.getWorldServer(this.e).players);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,14 +106,14 @@ public class EntityTracker {
|
||||
}
|
||||
|
||||
// CraftBukkit - synchronized
|
||||
public synchronized void a() {
|
||||
public synchronized void updatePlayers() {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Iterator iterator = this.a.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
|
||||
|
||||
entitytrackerentry.track(this.c.a(this.e).players);
|
||||
entitytrackerentry.track(this.c.getWorldServer(this.e).players);
|
||||
if (entitytrackerentry.m && entitytrackerentry.tracker instanceof EntityPlayer) {
|
||||
arraylist.add((EntityPlayer) entitytrackerentry.tracker);
|
||||
}
|
||||
@ -143,7 +143,7 @@ public class EntityTracker {
|
||||
}
|
||||
|
||||
// CraftBukkit - synchronized
|
||||
public synchronized void b(Entity entity, Packet packet) {
|
||||
public synchronized void sendPacketToEntity(Entity entity, Packet packet) {
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id);
|
||||
|
||||
if (entitytrackerentry != null) {
|
||||
@ -152,7 +152,7 @@ public class EntityTracker {
|
||||
}
|
||||
|
||||
// CraftBukkit - synchronized
|
||||
public synchronized void trackPlayer(EntityPlayer entityplayer) {
|
||||
public synchronized void untrackPlayer(EntityPlayer entityplayer) {
|
||||
Iterator iterator = this.a.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -249,14 +249,8 @@ public class EntityTrackerEntry {
|
||||
} else if (this.tracker instanceof EntityFireball) {
|
||||
EntityFireball entityfireball = (EntityFireball) this.tracker;
|
||||
// CraftBukkit start - added check for null shooter
|
||||
// Packet23VehicleSpawn packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
|
||||
|
||||
Packet23VehicleSpawn packet23vehiclespawn;
|
||||
if (((EntityFireball) this.tracker).shooter != null) {
|
||||
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
|
||||
} else {
|
||||
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, 1);
|
||||
}
|
||||
int shooter = ((EntityFireball) this.tracker).shooter != null ? ((EntityFireball) this.tracker).shooter.id : 1;
|
||||
Packet23VehicleSpawn packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, shooter);
|
||||
// CraftBukkit end
|
||||
|
||||
packet23vehiclespawn.e = (int) (entityfireball.c * 8000.0D);
|
||||
|
@ -3,7 +3,6 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
@ -11,13 +10,12 @@ import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
|
||||
public class EntityWeatherStorm extends EntityWeather {
|
||||
|
||||
private int b;
|
||||
private int lifeTicks;
|
||||
public long a = 0L;
|
||||
private int c;
|
||||
|
||||
// CraftBukkit start
|
||||
private CraftWorld cworld;
|
||||
private CraftServer server;
|
||||
public boolean isEffect = false;
|
||||
|
||||
public EntityWeatherStorm(World world, double d0, double d1, double d2) {
|
||||
@ -31,25 +29,23 @@ public class EntityWeatherStorm extends EntityWeather {
|
||||
|
||||
// CraftBukkit start
|
||||
this.isEffect = isEffect;
|
||||
cworld = ((WorldServer) world).getWorld();
|
||||
server = ((WorldServer) world).getServer();
|
||||
this.cworld = world.getWorld();
|
||||
// CraftBukkit end
|
||||
|
||||
this.setPositionRotation(d0, d1, d2, 0.0F, 0.0F);
|
||||
this.b = 2;
|
||||
this.lifeTicks = 2;
|
||||
this.a = this.random.nextLong();
|
||||
this.c = this.random.nextInt(3) + 1;
|
||||
// CraftBukkit
|
||||
if (!isEffect && world.spawnMonsters >= 2 && world.a(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
|
||||
if (!isEffect && world.spawnMonsters >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
|
||||
int i = MathHelper.floor(d0);
|
||||
int j = MathHelper.floor(d1);
|
||||
int k = MathHelper.floor(d2);
|
||||
|
||||
if (world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(world, i, j, k)) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(i, j, k), IgniteCause.LIGHTNING, null);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
world.setTypeId(i, j, k, Block.FIRE.id);
|
||||
@ -64,9 +60,9 @@ public class EntityWeatherStorm extends EntityWeather {
|
||||
|
||||
if (world.getTypeId(j, k, l) == 0 && Block.FIRE.canPlace(world, j, k, l)) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(j, k, l);
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(j, k, l), IgniteCause.LIGHTNING, null);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
world.setTypeId(j, k, l, Block.FIRE.id);
|
||||
}
|
||||
@ -78,30 +74,30 @@ public class EntityWeatherStorm extends EntityWeather {
|
||||
|
||||
public void o_() {
|
||||
super.o_();
|
||||
if (this.b == 2) {
|
||||
if (this.lifeTicks == 2) {
|
||||
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
||||
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
--this.b;
|
||||
if (this.b < 0) {
|
||||
--this.lifeTicks;
|
||||
if (this.lifeTicks < 0) {
|
||||
if (this.c == 0) {
|
||||
this.die();
|
||||
} else if (this.b < -this.random.nextInt(10)) {
|
||||
} else if (this.lifeTicks < -this.random.nextInt(10)) {
|
||||
--this.c;
|
||||
this.b = 1;
|
||||
this.lifeTicks = 1;
|
||||
this.a = this.random.nextLong();
|
||||
// CraftBukkit
|
||||
if (!isEffect && this.world.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) {
|
||||
if (!this.isEffect && this.world.areChunksLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) {
|
||||
int i = MathHelper.floor(this.locX);
|
||||
int j = MathHelper.floor(this.locY);
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
|
||||
if (this.world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(this.world, i, j, k)) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(i, j, k), IgniteCause.LIGHTNING, null);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.world.setTypeId(i, j, k, Block.FIRE.id);
|
||||
}
|
||||
@ -111,7 +107,7 @@ public class EntityWeatherStorm extends EntityWeather {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.b >= 0 && !isEffect) { // CraftBukkit
|
||||
if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit
|
||||
double d0 = 3.0D;
|
||||
List list = this.world.b((Entity) this, AxisAlignedBB.b(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + 6.0D + d0, this.locZ + d0));
|
||||
|
||||
|
@ -4,15 +4,11 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityWolf extends EntityAnimal {
|
||||
@ -48,10 +44,10 @@ public class EntityWolf extends EntityAnimal {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.a("Angry", this.isAngry());
|
||||
nbttagcompound.a("Sitting", this.isSitting());
|
||||
if (this.x() == null) {
|
||||
if (this.getOwnerName() == null) {
|
||||
nbttagcompound.setString("Owner", "");
|
||||
} else {
|
||||
nbttagcompound.setString("Owner", this.x());
|
||||
nbttagcompound.setString("Owner", this.getOwnerName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,17 +58,17 @@ public class EntityWolf extends EntityAnimal {
|
||||
String s = nbttagcompound.getString("Owner");
|
||||
|
||||
if (s.length() > 0) {
|
||||
this.a(s);
|
||||
this.d(true);
|
||||
this.setOwnerName(s);
|
||||
this.setTamed(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean l_() {
|
||||
return !this.A();
|
||||
return !this.isTamed();
|
||||
}
|
||||
|
||||
protected String g() {
|
||||
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.A() && this.datawatcher.b(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
|
||||
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.b(18) < 10 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
|
||||
}
|
||||
|
||||
protected String h() {
|
||||
@ -93,8 +89,8 @@ public class EntityWolf extends EntityAnimal {
|
||||
|
||||
protected void c_() {
|
||||
super.c_();
|
||||
if (!this.e && !this.B() && this.A() && this.vehicle == null) {
|
||||
EntityHuman entityhuman = this.world.a(this.x());
|
||||
if (!this.e && !this.B() && this.isTamed() && this.vehicle == null) {
|
||||
EntityHuman entityhuman = this.world.a(this.getOwnerName());
|
||||
|
||||
if (entityhuman != null) {
|
||||
float f = entityhuman.f(this);
|
||||
@ -105,24 +101,19 @@ public class EntityWolf extends EntityAnimal {
|
||||
} else if (!this.ac()) {
|
||||
this.setSitting(true);
|
||||
}
|
||||
} else if (this.target == null && !this.B() && !this.A() && this.world.random.nextInt(100) == 0) {
|
||||
} else if (this.target == null && !this.B() && !this.isTamed() && this.world.random.nextInt(100) == 0) {
|
||||
List list = this.world.a(EntitySheep.class, AxisAlignedBB.b(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).b(16.0D, 4.0D, 16.0D));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
// CraftBukkit start
|
||||
Entity entity = (Entity) list.get(this.world.random.nextInt(list.size()));
|
||||
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.RANDOM_TARGET);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled() || event.getTarget() != null ) {
|
||||
this.c(entity);
|
||||
this.setTarget(entity);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -133,7 +124,7 @@ public class EntityWolf extends EntityAnimal {
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
this.datawatcher.b(18, Integer.valueOf(this.health));
|
||||
this.datawatcher.watch(18, Integer.valueOf(this.health));
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,9 +139,9 @@ public class EntityWolf extends EntityAnimal {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (itemstack != null) {
|
||||
if (!this.A() && itemstack.id == Item.BONE.id) {
|
||||
if (!this.isTamed() && itemstack.id == Item.BONE.id) {
|
||||
this.a = true;
|
||||
} else if (this.A() && Item.byId[itemstack.id] instanceof ItemFood) {
|
||||
} else if (this.isTamed() && Item.byId[itemstack.id] instanceof ItemFood) {
|
||||
this.a = ((ItemFood) Item.byId[itemstack.id]).l();
|
||||
}
|
||||
}
|
||||
@ -236,7 +227,7 @@ public class EntityWolf extends EntityAnimal {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.a(pathentity);
|
||||
this.setPathEntity(pathentity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,17 +244,13 @@ public class EntityWolf extends EntityAnimal {
|
||||
if (!super.damageEntity((Entity) entity, i)) {
|
||||
return false;
|
||||
} else {
|
||||
if (!this.A() && !this.isAngry()) {
|
||||
if (!this.isTamed() && !this.isAngry()) {
|
||||
if (entity instanceof EntityHuman) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
@ -288,16 +275,12 @@ public class EntityWolf extends EntityAnimal {
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
EntityWolf entitywolf = (EntityWolf) entity1;
|
||||
|
||||
if (!entitywolf.A() && entitywolf.target == null) {
|
||||
if (!entitywolf.isTamed() && entitywolf.target == null) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity bukkitTarget = null;
|
||||
if (entity != null) {
|
||||
bukkitTarget = entity.getBukkitEntity();
|
||||
}
|
||||
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
@ -314,7 +297,7 @@ public class EntityWolf extends EntityAnimal {
|
||||
}
|
||||
}
|
||||
} else if (entity != this && entity != null) {
|
||||
if (this.A() && entity instanceof EntityHuman && ((EntityHuman) entity).name.equalsIgnoreCase(this.x())) {
|
||||
if (this.isTamed() && entity instanceof EntityHuman && ((EntityHuman) entity).name.equalsIgnoreCase(this.getOwnerName())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -326,7 +309,7 @@ public class EntityWolf extends EntityAnimal {
|
||||
}
|
||||
|
||||
protected Entity findTarget() {
|
||||
return this.isAngry() ? this.world.a(this, 16.0D) : null;
|
||||
return this.isAngry() ? this.world.findNearbyPlayer(this, 16.0D) : null;
|
||||
}
|
||||
|
||||
protected void a(Entity entity, float f) {
|
||||
@ -344,29 +327,29 @@ public class EntityWolf extends EntityAnimal {
|
||||
this.attackTicks = 20;
|
||||
byte b0 = 2;
|
||||
|
||||
if (this.A()) {
|
||||
if (this.isTamed()) {
|
||||
b0 = 4;
|
||||
}
|
||||
// CraftBukkit start
|
||||
CraftServer server = this.world.getServer();
|
||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
||||
org.bukkit.entity.Entity damagee = entity == null ? null : entity.getBukkitEntity();
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageCause, b0);
|
||||
server.getPluginManager().callEvent(event);
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, b0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
entity.damageEntity(this, b0);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
entity.damageEntity(this, b0);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
||||
if (!this.A()) {
|
||||
if (!this.isTamed()) {
|
||||
if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
|
||||
--itemstack.count;
|
||||
if (itemstack.count <= 0) {
|
||||
@ -376,11 +359,12 @@ public class EntityWolf extends EntityAnimal {
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit - added event call and isCancelled check.
|
||||
if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.d(true);
|
||||
this.a((PathEntity) null);
|
||||
// CraftBukkit end
|
||||
this.setTamed(true);
|
||||
this.setPathEntity((PathEntity) null);
|
||||
this.setSitting(true);
|
||||
this.health = 20;
|
||||
this.a(entityhuman.name);
|
||||
this.setOwnerName(entityhuman.name);
|
||||
this.a(true);
|
||||
this.world.a(this, (byte) 7);
|
||||
} else {
|
||||
@ -406,11 +390,11 @@ public class EntityWolf extends EntityAnimal {
|
||||
}
|
||||
}
|
||||
|
||||
if (entityhuman.name.equalsIgnoreCase(this.x())) {
|
||||
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName())) {
|
||||
if (!this.world.isStatic) {
|
||||
this.setSitting(!this.isSitting());
|
||||
this.aC = false;
|
||||
this.a((PathEntity) null);
|
||||
this.setPathEntity((PathEntity) null);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -440,12 +424,12 @@ public class EntityWolf extends EntityAnimal {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public String x() {
|
||||
public String getOwnerName() {
|
||||
return this.datawatcher.c(17);
|
||||
}
|
||||
|
||||
public void a(String s) {
|
||||
this.datawatcher.b(17, s);
|
||||
public void setOwnerName(String s) {
|
||||
this.datawatcher.watch(17, s);
|
||||
}
|
||||
|
||||
public boolean isSitting() {
|
||||
@ -456,9 +440,9 @@ public class EntityWolf extends EntityAnimal {
|
||||
byte b0 = this.datawatcher.a(16);
|
||||
|
||||
if (flag) {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 1)));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
|
||||
} else {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -2)));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -470,23 +454,23 @@ public class EntityWolf extends EntityAnimal {
|
||||
byte b0 = this.datawatcher.a(16);
|
||||
|
||||
if (flag) {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 2)));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 2)));
|
||||
} else {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -3)));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -3)));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean A() {
|
||||
public boolean isTamed() {
|
||||
return (this.datawatcher.a(16) & 4) != 0;
|
||||
}
|
||||
|
||||
public void d(boolean flag) {
|
||||
public void setTamed(boolean flag) {
|
||||
byte b0 = this.datawatcher.a(16);
|
||||
|
||||
if (flag) {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 4)));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 4)));
|
||||
} else {
|
||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -5)));
|
||||
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -5)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
// CraftBukkit end
|
||||
import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
|
||||
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
@ -20,9 +17,8 @@ public class EntityZombie extends EntityMonster {
|
||||
|
||||
if (f > 0.5F && this.world.isChunkLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
this.fireTicks = 300;
|
||||
|
@ -7,13 +7,10 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.Location;
|
||||
// CraftBukkit end
|
||||
@ -28,7 +25,7 @@ public class Explosion {
|
||||
public double posZ;
|
||||
public Entity source;
|
||||
public float size;
|
||||
public Set g = new HashSet();
|
||||
public Set blocks = new HashSet();
|
||||
|
||||
public boolean wasCanceled = false; // CraftBukkit
|
||||
|
||||
@ -81,7 +78,7 @@ public class Explosion {
|
||||
}
|
||||
|
||||
if (f1 > 0.0F) {
|
||||
this.g.add(new ChunkPosition(l, i1, j1));
|
||||
this.blocks.add(new ChunkPosition(l, i1, j1));
|
||||
}
|
||||
|
||||
d0 += d3 * (double) f2;
|
||||
@ -120,9 +117,8 @@ public class Explosion {
|
||||
double d10 = (1.0D - d7) * d9;
|
||||
|
||||
// CraftBukkit start - explosion damage hook
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
||||
DamageCause damageType;
|
||||
int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D);
|
||||
|
||||
if (damagee == null) {
|
||||
@ -130,9 +126,7 @@ public class Explosion {
|
||||
} else if (this.source == null) { // Block explosion
|
||||
// TODO: get the x/y/z of the tnt block?
|
||||
// does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever
|
||||
damageType = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
|
||||
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
|
||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
@ -142,10 +136,7 @@ public class Explosion {
|
||||
entity.motZ += d2 * d10;
|
||||
}
|
||||
} else {
|
||||
org.bukkit.entity.Entity damager = this.source.getBukkitEntity();
|
||||
damageType = EntityDamageEvent.DamageCause.ENTITY_EXPLOSION;
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.source.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damageDone);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
@ -163,7 +154,7 @@ public class Explosion {
|
||||
this.size = f;
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
arraylist.addAll(this.g);
|
||||
arraylist.addAll(this.blocks);
|
||||
if (this.a) {
|
||||
for (int l2 = arraylist.size() - 1; l2 >= 0; --l2) {
|
||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(l2);
|
||||
@ -184,28 +175,27 @@ public class Explosion {
|
||||
this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
arraylist.addAll(this.g);
|
||||
arraylist.addAll(this.blocks);
|
||||
|
||||
// CraftBukkit start
|
||||
Server server = ((WorldServer) this.world).getServer();
|
||||
CraftWorld world = ((WorldServer) this.world).getWorld();
|
||||
org.bukkit.entity.Entity explode = (this.source == null) ? null : this.source.getBukkitEntity();
|
||||
Location location = new Location(world, this.posX, this.posY, this.posZ);
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity();
|
||||
Location location = new Location(bworld, this.posX, this.posY, this.posZ);
|
||||
|
||||
List<org.bukkit.block.Block> blockList = new ArrayList<org.bukkit.block.Block>();
|
||||
for (int j = arraylist.size() - 1; j >= 0; j--) {
|
||||
ChunkPosition cpos = (ChunkPosition) arraylist.get(j);
|
||||
org.bukkit.block.Block block = world.getBlockAt(cpos.x, cpos.y, cpos.z);
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(cpos.x, cpos.y, cpos.z);
|
||||
if (block.getType() != org.bukkit.Material.AIR) {
|
||||
blockList.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
wasCanceled = true;
|
||||
this.wasCanceled = true;
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -6,7 +6,7 @@ public interface IInventory {
|
||||
|
||||
ItemStack getItem(int i);
|
||||
|
||||
ItemStack a(int i, int j);
|
||||
ItemStack splitStack(int i, int j);
|
||||
|
||||
void setItem(int i, ItemStack itemstack);
|
||||
|
||||
|
@ -6,7 +6,7 @@ public class InventoryCraftResult implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -24,7 +24,7 @@ public class InventoryCraftResult implements IInventory {
|
||||
return "Result";
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack = this.items[i];
|
||||
|
||||
|
@ -8,7 +8,7 @@ public class InventoryCrafting implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -42,7 +42,7 @@ public class InventoryCrafting implements IInventory {
|
||||
return "Crafting";
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
|
@ -8,9 +8,9 @@ public class InventoryLargeChest implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
ItemStack[] result = new ItemStack[getSize()];
|
||||
ItemStack[] result = new ItemStack[this.getSize()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = getItem(i);
|
||||
result[i] = this.getItem(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -34,8 +34,8 @@ public class InventoryLargeChest implements IInventory {
|
||||
return i >= this.b.getSize() ? this.c.getItem(i - this.b.getSize()) : this.b.getItem(i);
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
return i >= this.b.getSize() ? this.c.a(i - this.b.getSize(), j) : this.b.a(i, j);
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
return i >= this.b.getSize() ? this.c.splitStack(i - this.b.getSize(), j) : this.b.splitStack(i, j);
|
||||
}
|
||||
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
|
@ -11,11 +11,11 @@ public class InventoryPlayer implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public ItemStack[] getArmorContents() {
|
||||
return armor;
|
||||
return this.armor;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -41,9 +41,9 @@ public class InventoryPlayer implements IInventory {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int d(ItemStack itemstack) {
|
||||
private int firstPartial(ItemStack itemstack) {
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].c() && this.items[i].count < this.items[i].b() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].e() || this.items[i].getData() == itemstack.getData())) {
|
||||
if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -52,14 +52,14 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
|
||||
// CraftBukkit start - watch method above! :D
|
||||
public int canPickup(ItemStack itemstack) {
|
||||
public int canHold(ItemStack itemstack) {
|
||||
int remains = itemstack.count;
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
if (this.items[i] == null) return itemstack.count;
|
||||
|
||||
// Taken from d(ItemStack)I
|
||||
if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].c() && this.items[i].count < this.items[i].b() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].e() || this.items[i].getData() == itemstack.getData())) {
|
||||
remains -= (this.items[i].b() < this.getMaxStackSize() ? this.items[i].b() : this.getMaxStackSize()) - this.items[i].count;
|
||||
// Taken from firstPartial(ItemStack)
|
||||
if (this.items[i] != null && this.items[i].id == itemstack.id && this.items[i].isStackable() && this.items[i].count < this.items[i].getMaxStackSize() && this.items[i].count < this.getMaxStackSize() && (!this.items[i].usesData() || this.items[i].getData() == itemstack.getData())) {
|
||||
remains -= (this.items[i].getMaxStackSize() < this.getMaxStackSize() ? this.items[i].getMaxStackSize() : this.getMaxStackSize()) - this.items[i].count;
|
||||
}
|
||||
if (remains <= 0) return itemstack.count;
|
||||
}
|
||||
@ -77,10 +77,11 @@ public class InventoryPlayer implements IInventory {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
private int e(ItemStack itemstack) {
|
||||
int i = itemstack.id;
|
||||
int j = itemstack.count;
|
||||
int k = this.d(itemstack);
|
||||
int k = this.firstPartial(itemstack);
|
||||
|
||||
if (k < 0) {
|
||||
k = this.k();
|
||||
@ -95,8 +96,8 @@ public class InventoryPlayer implements IInventory {
|
||||
|
||||
int l = j;
|
||||
|
||||
if (j > this.items[k].b() - this.items[k].count) {
|
||||
l = this.items[k].b() - this.items[k].count;
|
||||
if (j > this.items[k].getMaxStackSize() - this.items[k].count) {
|
||||
l = this.items[k].getMaxStackSize() - this.items[k].count;
|
||||
}
|
||||
|
||||
if (l > this.getMaxStackSize() - this.items[k].count) {
|
||||
@ -136,7 +137,7 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canHold(ItemStack itemstack) {
|
||||
public boolean pickup(ItemStack itemstack) {
|
||||
int i;
|
||||
|
||||
if (itemstack.f()) {
|
||||
@ -159,7 +160,7 @@ public class InventoryPlayer implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
ItemStack[] aitemstack = this.items;
|
||||
|
||||
if (i >= this.items.length) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -42,7 +41,7 @@ public class ItemBed extends Item {
|
||||
}
|
||||
|
||||
if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.d(i, j - 1, k) && world.d(i + b0, j - 1, k + b1)) {
|
||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
|
||||
world.setTypeIdAndData(i, j, k, blockbed.id, i1);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -56,13 +55,13 @@ public class ItemBlock extends Item {
|
||||
Block block = Block.byId[this.id];
|
||||
|
||||
// CraftBukkit start - This executes the placement of the block
|
||||
BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||
|
||||
// There are like 30 combinations you can mix and match steps and double steps
|
||||
// of different materials, so there are a lot of different cases of what
|
||||
// would happen if you place x step onto another y step, so let's just keep
|
||||
// track of the entire state
|
||||
BlockState blockStateBelow = null;
|
||||
CraftBlockState blockStateBelow = null;
|
||||
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id)
|
||||
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
|
||||
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -72,13 +71,13 @@ public class ItemDoor extends Item {
|
||||
i1 += 4;
|
||||
}
|
||||
|
||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
|
||||
world.o = true;
|
||||
world.suppressPhysics = true;
|
||||
world.setTypeIdAndData(i, j, k, block.id, i1);
|
||||
|
||||
// CraftBukkit start - bed
|
||||
world.o = false;
|
||||
world.suppressPhysics = false;
|
||||
world.applyPhysics(i, j, k, block.id);
|
||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, block);
|
||||
|
||||
@ -87,11 +86,11 @@ public class ItemDoor extends Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
world.o = true;
|
||||
world.suppressPhysics = true;
|
||||
// CraftBukkit end
|
||||
world.setTypeIdAndData(i, j + 1, k, block.id, i1 + 8);
|
||||
world.o = false;
|
||||
// world.applyPhysics(i, j, k, block.id); // CraftBukkit -- moved up
|
||||
world.suppressPhysics = false;
|
||||
// world.applyPhysics(i, j, k, block.id); // CraftBukkit - moved up
|
||||
world.applyPhysics(i, j + 1, k, block.id);
|
||||
--itemstack.count;
|
||||
return true;
|
||||
|
@ -1,15 +1,11 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ItemFlintAndSteel extends Item {
|
||||
@ -51,23 +47,18 @@ public class ItemFlintAndSteel extends Item {
|
||||
|
||||
if (i1 == 0) {
|
||||
// CraftBukkit start - store the clicked block
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
|
||||
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
|
||||
Player thePlayer = (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL;
|
||||
BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, igniteCause, thePlayer);
|
||||
craftServer.getPluginManager().callEvent(eventIgnite);
|
||||
boolean preventFire = eventIgnite.isCancelled();
|
||||
BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, thePlayer);
|
||||
world.getServer().getPluginManager().callEvent(eventIgnite);
|
||||
|
||||
if (preventFire) {
|
||||
if (eventIgnite.isCancelled()) {
|
||||
itemstack.damage(1, entityhuman);
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||
// CraftBukkit end
|
||||
|
||||
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -28,7 +27,7 @@ public class ItemHoe extends Item {
|
||||
if (world.isStatic) {
|
||||
return true;
|
||||
} else {
|
||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
|
||||
world.setTypeId(i, j, k, block.id);
|
||||
|
||||
|
@ -3,7 +3,6 @@ package net.minecraft.server;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.block.Action;
|
||||
@ -15,7 +14,7 @@ public class ItemInWorldManager {
|
||||
private WorldServer world;
|
||||
public EntityHuman player;
|
||||
private float c = 0.0F;
|
||||
private int d;
|
||||
private int lastDigTick;
|
||||
private int e;
|
||||
private int f;
|
||||
private int g;
|
||||
@ -51,8 +50,8 @@ public class ItemInWorldManager {
|
||||
}
|
||||
|
||||
public void dig(int i, int j, int k, int l) {
|
||||
// this.world.a((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
|
||||
this.d = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
// this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
|
||||
this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
int i1 = this.world.getTypeId(i, j, k);
|
||||
|
||||
// CraftBukkit start
|
||||
@ -76,7 +75,7 @@ public class ItemInWorldManager {
|
||||
} else {
|
||||
Block.byId[i1].b(this.world, i, j, k, this.player);
|
||||
// Allow fire punching to be blocked
|
||||
this.world.a((EntityHuman) null, i, j, k, l);
|
||||
this.world.douseFire((EntityHuman) null, i, j, k, l);
|
||||
}
|
||||
|
||||
// Handle hitting a block
|
||||
@ -111,7 +110,7 @@ public class ItemInWorldManager {
|
||||
public void a(int i, int j, int k) {
|
||||
if (i == this.e && j == this.f && k == this.g) {
|
||||
this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
int l = this.currentTick - this.d;
|
||||
int l = this.currentTick - this.lastDigTick;
|
||||
int i1 = this.world.getTypeId(i, j, k);
|
||||
|
||||
if (i1 != 0) {
|
||||
@ -125,7 +124,7 @@ public class ItemInWorldManager {
|
||||
this.j = i;
|
||||
this.k = j;
|
||||
this.l = k;
|
||||
this.m = this.d;
|
||||
this.m = this.lastDigTick;
|
||||
}
|
||||
}
|
||||
// CraftBukkit start - force blockreset to client
|
||||
@ -152,12 +151,10 @@ public class ItemInWorldManager {
|
||||
public boolean c(int i, int j, int k) {
|
||||
// CraftBukkit start
|
||||
if (this.player instanceof EntityPlayer) {
|
||||
CraftServer server = ((WorldServer) this.world).getServer();
|
||||
org.bukkit.block.Block block = ((WorldServer) this.world).getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.player.getBukkitEntity();
|
||||
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(i, j, k);
|
||||
|
||||
BlockBreakEvent event = new BlockBreakEvent(block, player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
BlockBreakEvent event = new BlockBreakEvent(block, (org.bukkit.entity.Player) this.player.getBukkitEntity());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
|
@ -1,15 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.painting.PaintingPlaceEvent;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -44,15 +37,13 @@ public class ItemPainting extends Item {
|
||||
if (entitypainting.h()) {
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
Painting painting = (Painting) entitypainting.getBukkitEntity();
|
||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||
|
||||
Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||
BlockFace blockFace = CraftBlock.notchToBlockFace(l);
|
||||
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.block.BlockFace blockFace = CraftBlock.notchToBlockFace(l);
|
||||
|
||||
PaintingPlaceEvent event = new PaintingPlaceEvent(painting, who, blockClicked, blockFace);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
PaintingPlaceEvent event = new PaintingPlaceEvent((org.bukkit.entity.Painting) entitypainting.getBukkitEntity(), who, blockClicked, blockFace);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -47,7 +46,7 @@ public class ItemRedstone extends Item {
|
||||
}
|
||||
|
||||
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
|
||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
|
||||
world.setRawTypeId(i, j, k, Block.REDSTONE_WIRE.id); // CraftBukkit - We update after the event
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -54,7 +53,7 @@ public class ItemReed extends Item {
|
||||
Block block = Block.byId[this.id];
|
||||
|
||||
// CraftBukkit start - This executes the placement of the block
|
||||
BlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
CraftBlockState replacedBlockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
/**
|
||||
* @see net.minecraft.server.World#setTypeId(int i, int j, int k, int l)
|
||||
*
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -23,12 +22,13 @@ public class ItemSeeds extends Item {
|
||||
int i1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (i1 == Block.SOIL.id && world.isEmpty(i, j + 1, k)) {
|
||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j + 1, k); // CraftBukkit
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j + 1, k); // CraftBukkit
|
||||
|
||||
world.setTypeId(i, j + 1, k, this.id);
|
||||
|
||||
// CraftBukkit start - seeds
|
||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, this.id);
|
||||
|
||||
if (event.isCancelled() || !event.canBuild()) {
|
||||
event.getBlockPlaced().setTypeId(0);
|
||||
return false;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
@ -45,7 +44,7 @@ public class ItemSign extends Item {
|
||||
if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
|
||||
return false;
|
||||
} else {
|
||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||
|
||||
if (l == 1) {
|
||||
world.setTypeIdAndData(i, j, k, Block.SIGN_POST.id, MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15);
|
||||
|
@ -83,19 +83,19 @@ public final class ItemStack {
|
||||
this.damage = nbttagcompound.d("Damage");
|
||||
}
|
||||
|
||||
public int b() {
|
||||
public int getMaxStackSize() {
|
||||
return this.getItem().getMaxStackSize();
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return this.b() > 1 && (!this.d() || !this.f());
|
||||
public boolean isStackable() {
|
||||
return this.getMaxStackSize() > 1 && (!this.d() || !this.f());
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return Item.byId[this.id].e() > 0;
|
||||
}
|
||||
|
||||
public boolean e() {
|
||||
public boolean usesData() {
|
||||
return Item.byId[this.id].d();
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public final class ItemStack {
|
||||
Item.byId[this.id].a(this, entityliving);
|
||||
}
|
||||
|
||||
public ItemStack j() {
|
||||
public ItemStack cloneItemStack() {
|
||||
return new ItemStack(this.id, this.count, this.damage);
|
||||
}
|
||||
|
||||
@ -179,12 +179,12 @@ public final class ItemStack {
|
||||
return this.count != itemstack.count ? false : (this.id != itemstack.id ? false : this.damage == itemstack.damage);
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
public boolean doMaterialsMatch(ItemStack itemstack) {
|
||||
return this.id == itemstack.id && this.damage == itemstack.damage;
|
||||
}
|
||||
|
||||
public static ItemStack b(ItemStack itemstack) {
|
||||
return itemstack == null ? null : itemstack.j();
|
||||
return itemstack == null ? null : itemstack.cloneItemStack();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -19,7 +19,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
||||
worldmap.b = world.q().c();
|
||||
worldmap.c = world.q().e();
|
||||
worldmap.e = 3;
|
||||
worldmap.d = (byte) ((WorldServer) world).dimension; // CraftBukkit
|
||||
worldmap.map = (byte) world.worldProvider.dimension;
|
||||
worldmap.a();
|
||||
world.a(s, (WorldMapBase) worldmap);
|
||||
}
|
||||
@ -28,7 +28,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
||||
}
|
||||
|
||||
public void a(World world, Entity entity, WorldMap worldmap) {
|
||||
if (((WorldServer) world).dimension == worldmap.d) { // CraftBukkit
|
||||
if (((WorldServer) world).dimension == worldmap.map) { // CraftBukkit
|
||||
short short1 = 128;
|
||||
short short2 = 128;
|
||||
int i = 1 << worldmap.e;
|
||||
@ -61,7 +61,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
||||
byte b1 = 0;
|
||||
byte b2 = 0;
|
||||
int[] aint = new int[256];
|
||||
Chunk chunk = world.b(i3, j3);
|
||||
Chunk chunk = world.getChunkAtWorldCoords(i3, j3);
|
||||
int k3 = i3 & 15;
|
||||
int l3 = j3 & 15;
|
||||
int i4 = 0;
|
||||
@ -222,7 +222,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
||||
worldmap.b = MathHelper.floor(entityhuman.locX);
|
||||
worldmap.c = MathHelper.floor(entityhuman.locZ);
|
||||
worldmap.e = 3;
|
||||
worldmap.d = (byte) ((WorldServer) world).dimension; // CraftBukkit
|
||||
worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit
|
||||
worldmap.a();
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import org.bukkit.plugin.PluginLoadOrder;
|
||||
public class MinecraftServer implements Runnable, ICommandListener {
|
||||
|
||||
public static Logger log = Logger.getLogger("Minecraft");
|
||||
public static HashMap b = new HashMap();
|
||||
public static HashMap trackerList = new HashMap();
|
||||
public NetworkListenThread networkListenThread;
|
||||
public PropertyManager propertyManager;
|
||||
// public WorldServer[] worldServer; // CraftBukkit - removed!
|
||||
@ -51,7 +51,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
public boolean onlineMode;
|
||||
public boolean spawnAnimals;
|
||||
public boolean pvpMode;
|
||||
public boolean o;
|
||||
public boolean allowFlight;
|
||||
|
||||
// CraftBukkit start
|
||||
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||
@ -96,13 +96,13 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
}
|
||||
|
||||
log.info("Loading properties");
|
||||
this.propertyManager = new PropertyManager(options); // CraftBukkit - CLI argument support
|
||||
this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
|
||||
String s = this.propertyManager.getString("server-ip", "");
|
||||
|
||||
this.onlineMode = this.propertyManager.getBoolean("online-mode", true);
|
||||
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
|
||||
this.pvpMode = this.propertyManager.getBoolean("pvp", true);
|
||||
this.o = this.propertyManager.getBoolean("allow-flight", false);
|
||||
this.allowFlight = this.propertyManager.getBoolean("allow-flight", false);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
if (s.length() > 0) {
|
||||
@ -154,9 +154,9 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
|
||||
if (this.propertyManager.properties.containsKey("spawn-protection")) {
|
||||
log.info("'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you.");
|
||||
server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16));
|
||||
this.server.setSpawnRadius(this.propertyManager.getInt("spawn-protection", 16));
|
||||
this.propertyManager.properties.remove("spawn-protection");
|
||||
this.propertyManager.b();
|
||||
this.propertyManager.savePropertiesFile();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -174,7 +174,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
String worldType = Environment.getEnvironment(dimension).toString().toLowerCase();
|
||||
String name = (dimension == 0) ? s : s + "_" + worldType;
|
||||
|
||||
ChunkGenerator gen = server.getGenerator(name);
|
||||
ChunkGenerator gen = this.server.getGenerator(name);
|
||||
|
||||
if (j == 0) {
|
||||
world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, dimension, i, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
|
||||
@ -207,21 +207,21 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
}
|
||||
}
|
||||
|
||||
world = new SecondaryWorldServer(this, new ServerNBTManager(new File("."), name, true), name, dimension, i, worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
|
||||
world = new SecondaryWorldServer(this, new ServerNBTManager(new File("."), name, true), name, dimension, i, this.worlds.get(0), org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
|
||||
}
|
||||
|
||||
if (gen != null) {
|
||||
world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld()));
|
||||
}
|
||||
|
||||
server.getPluginManager().callEvent(new WorldInitEvent(world.getWorld()));
|
||||
this.server.getPluginManager().callEvent(new WorldInitEvent(world.getWorld()));
|
||||
|
||||
world.tracker = new EntityTracker(this, dimension);
|
||||
world.addIWorldAccess(new WorldManager(this, world));
|
||||
world.spawnMonsters = this.propertyManager.getBoolean("spawn-monsters", true) ? 1 : 0;
|
||||
world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
|
||||
worlds.add(world);
|
||||
this.serverConfigurationManager.setPlayerFileData(worlds.toArray(new WorldServer[0]));
|
||||
this.worlds.add(world);
|
||||
this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0]));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -262,11 +262,11 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
// } // CraftBukkit
|
||||
}
|
||||
|
||||
// Craftbukkit start
|
||||
for (World world : worlds) {
|
||||
server.getPluginManager().callEvent(new WorldLoadEvent(world.getWorld()));
|
||||
// CraftBukkit start
|
||||
for (World world : this.worlds) {
|
||||
this.server.getPluginManager().callEvent(new WorldLoadEvent(world.getWorld()));
|
||||
}
|
||||
// Craftbukkit end
|
||||
// CraftBukkit end
|
||||
|
||||
this.e();
|
||||
}
|
||||
@ -281,7 +281,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
this.i = null;
|
||||
this.j = 0;
|
||||
|
||||
server.enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
this.server.enablePlugins(PluginLoadOrder.POSTWORLD); // CraftBukkit
|
||||
}
|
||||
|
||||
void saveChunks() { // CraftBukkit - private -> default
|
||||
@ -295,11 +295,11 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
worldserver.saveLevel();
|
||||
|
||||
WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld());
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
WorldServer world = this.worlds.get(0);
|
||||
if (!world.E) {
|
||||
if (!world.canSave) {
|
||||
this.serverConfigurationManager.savePlayers();
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -308,8 +308,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
public void stop() { // CraftBukkit - private -> public
|
||||
log.info("Stopping server");
|
||||
// CraftBukkit start
|
||||
if (server != null) {
|
||||
server.disablePlugins();
|
||||
if (this.server != null) {
|
||||
this.server.disablePlugins();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -400,14 +400,14 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
|
||||
private void h() {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
Iterator iterator = b.keySet().iterator();
|
||||
Iterator iterator = trackerList.keySet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
int i = ((Integer) b.get(s)).intValue();
|
||||
int i = ((Integer) trackerList.get(s)).intValue();
|
||||
|
||||
if (i > 0) {
|
||||
b.put(s, Integer.valueOf(i - 1));
|
||||
trackerList.put(s, Integer.valueOf(i - 1));
|
||||
} else {
|
||||
arraylist.add(s);
|
||||
}
|
||||
@ -416,7 +416,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
int j;
|
||||
|
||||
for (j = 0; j < arraylist.size(); ++j) {
|
||||
b.remove(arraylist.get(j));
|
||||
trackerList.remove(arraylist.get(j));
|
||||
}
|
||||
|
||||
AxisAlignedBB.a();
|
||||
@ -435,7 +435,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
}
|
||||
}
|
||||
|
||||
((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.ticks);
|
||||
((CraftScheduler) this.server.getScheduler()).mainThreadHeartbeat(this.ticks);
|
||||
// CraftBukkit end
|
||||
|
||||
worldserver.doTick();
|
||||
@ -453,7 +453,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
|
||||
// CraftBukkit start
|
||||
for (j = 0; j < this.worlds.size(); ++j) {
|
||||
this.worlds.get(j).tracker.a();
|
||||
this.worlds.get(j).tracker.updatePlayers();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -477,7 +477,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
ServerCommand servercommand = (ServerCommand) this.s.remove(0);
|
||||
|
||||
// this.consoleCommandHandler.handle(servercommand); // CraftBukkit - Removed its now called in server.displatchCommand
|
||||
server.dispatchCommand(console, servercommand); // CraftBukkit
|
||||
this.server.dispatchCommand(this.console, servercommand); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,20 +515,20 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
||||
return "CONSOLE";
|
||||
}
|
||||
|
||||
public WorldServer a(int i) {
|
||||
public WorldServer getWorldServer(int i) {
|
||||
// CraftBukkit start
|
||||
for (WorldServer world : worlds) {
|
||||
for (WorldServer world : this.worlds) {
|
||||
if (world.dimension == i) {
|
||||
return world;
|
||||
}
|
||||
}
|
||||
|
||||
return worlds.get(0);
|
||||
return this.worlds.get(0);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public EntityTracker b(int i) {
|
||||
return a(i).tracker; // CraftBukkit
|
||||
public EntityTracker getTracker(int i) {
|
||||
return this.getWorldServer(i).tracker; // CraftBukkit
|
||||
}
|
||||
|
||||
public static boolean isRunning(MinecraftServer minecraftserver) {
|
||||
|
@ -24,7 +24,7 @@ public class NetLoginHandler extends NetHandler {
|
||||
|
||||
// CraftBukkit start
|
||||
public Socket getSocket() {
|
||||
return networkManager.socket;
|
||||
return this.networkManager.socket;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -44,7 +44,7 @@ public class NetLoginHandler extends NetHandler {
|
||||
public void disconnect(String s) {
|
||||
try {
|
||||
a.info("Disconnecting " + this.b() + ": " + s);
|
||||
this.networkManager.a((Packet) (new Packet255KickDisconnect(s)));
|
||||
this.networkManager.queue(new Packet255KickDisconnect(s));
|
||||
this.networkManager.d();
|
||||
this.c = true;
|
||||
} catch (Exception exception) {
|
||||
@ -55,9 +55,9 @@ public class NetLoginHandler extends NetHandler {
|
||||
public void a(Packet2Handshake packet2handshake) {
|
||||
if (this.server.onlineMode) {
|
||||
this.i = Long.toHexString(d.nextLong());
|
||||
this.networkManager.a((Packet) (new Packet2Handshake(this.i)));
|
||||
this.networkManager.queue(new Packet2Handshake(this.i));
|
||||
} else {
|
||||
this.networkManager.a((Packet) (new Packet2Handshake("-")));
|
||||
this.networkManager.queue(new Packet2Handshake("-"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandException;
|
||||
@ -17,8 +16,18 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.TextWrapper;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
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.PlayerToggleSneakEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
@ -35,7 +44,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
private boolean m = true;
|
||||
private boolean checkMovement = true;
|
||||
private Map n = new HashMap();
|
||||
|
||||
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||
@ -46,7 +55,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
entityplayer.netServerHandler = this;
|
||||
|
||||
// CraftBukkit start
|
||||
server = minecraftserver.server;
|
||||
this.server = minecraftserver.server;
|
||||
}
|
||||
private final CraftServer server;
|
||||
private int lastTick = MinecraftServer.currentTick;
|
||||
@ -65,8 +74,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// Store the last block right clicked and what type it was
|
||||
private int lastMaterial;
|
||||
|
||||
public Player getPlayer() {
|
||||
return (this.player == null) ? null : (CraftPlayer) player.getBukkitEntity();
|
||||
public CraftPlayer getPlayer() {
|
||||
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -81,8 +90,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
public void disconnect(String s) {
|
||||
// CraftBukkit start
|
||||
String leaveMessage = "\u00A7e" + this.player.name + " left the game.";
|
||||
PlayerKickEvent event = new PlayerKickEvent(server.getPlayer(this.player), s, leaveMessage);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
// Do not kick the player
|
||||
return;
|
||||
@ -111,33 +122,32 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet10Flying packet10flying) {
|
||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
|
||||
this.i = true;
|
||||
double d0;
|
||||
|
||||
if (!this.m) {
|
||||
if (!this.checkMovement) {
|
||||
d0 = packet10flying.y - this.y;
|
||||
if (packet10flying.x == this.x && d0 * d0 < 0.01D && packet10flying.z == this.z) {
|
||||
this.m = true;
|
||||
this.checkMovement = true;
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
Player player = getPlayer();
|
||||
Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch);
|
||||
Player player = this.getPlayer();
|
||||
Location from = new Location(player.getWorld(), this.lastPosX, this.lastPosY, this.lastPosZ, this.lastYaw, this.lastPitch);
|
||||
Location to = player.getLocation();
|
||||
|
||||
// Prevent 40 event-calls for less than b single pixel of movement >.>
|
||||
// Prevent 40 event-calls for less than a single pixel of movement >.>
|
||||
double delta = Math.pow(this.lastPosX - this.x, 2) + Math.pow(this.lastPosY - this.y, 2) + Math.pow(this.lastPosZ - this.z, 2);
|
||||
float deltaAngle = Math.abs(this.lastYaw - this.player.yaw) + Math.abs(this.lastPitch - this.player.pitch);
|
||||
|
||||
if (delta > 1f / 256 || deltaAngle > 10f) {
|
||||
// Skip the first time we do this
|
||||
if (lastPosX != Double.MAX_VALUE) {
|
||||
if (this.lastPosX != Double.MAX_VALUE) {
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
// If the event is cancelled we move the player back to their old location.
|
||||
if (event.isCancelled()) {
|
||||
@ -202,7 +212,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.m && !this.player.dead) {
|
||||
if (this.checkMovement && !this.player.dead) {
|
||||
// CraftBukkit end
|
||||
double d1;
|
||||
double d2;
|
||||
@ -298,7 +308,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.player.a(true);
|
||||
this.player.br = 0.0F;
|
||||
this.player.setLocation(this.x, this.y, this.z, f2, f3);
|
||||
if (!this.m) {
|
||||
if (!this.checkMovement) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -311,7 +321,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
||||
|
||||
// Added this.m condition to solve this check being triggered by teleports
|
||||
if (d8 > 100.0D * (elapsedTicks <= 0 ? 1 : elapsedTicks) && this.m) {
|
||||
if (d8 > 100.0D * (elapsedTicks <= 0 ? 1 : elapsedTicks) && this.checkMovement) {
|
||||
a.warning(this.player.name + " moved too quickly! Elapsed ticks: " + (elapsedTicks == 0 ? 1 : elapsedTicks) + ", Distance change: " + d8);
|
||||
this.disconnect("You moved too quickly :( (Hacking?)");
|
||||
return;
|
||||
@ -350,7 +360,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().b((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D);
|
||||
|
||||
if (!this.minecraftServer.o && !worldserver.b(axisalignedbb)) {
|
||||
if (!this.minecraftServer.allowFlight && !worldserver.b(axisalignedbb)) {
|
||||
if (d6 >= -0.03125D) {
|
||||
++this.h;
|
||||
if (this.h > 80) {
|
||||
@ -371,16 +381,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
// CraftBukkit start - Delegate to teleport(Location)
|
||||
Player player = getPlayer();
|
||||
Player player = this.getPlayer();
|
||||
Location from = player.getLocation();
|
||||
Location to = new Location(getPlayer().getWorld(), d0, d1, d2, f, f1);
|
||||
Location to = new Location(this.getPlayer().getWorld(), d0, d1, d2, f, f1);
|
||||
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
from = event.getFrom();
|
||||
to = event.isCancelled() ? from : event.getTo();
|
||||
|
||||
teleport(to);
|
||||
this.teleport(to);
|
||||
}
|
||||
|
||||
public void teleport(Location dest) {
|
||||
@ -403,7 +413,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.m = false;
|
||||
this.checkMovement = false;
|
||||
this.x = d0;
|
||||
this.y = d1;
|
||||
this.z = d2;
|
||||
@ -412,13 +422,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet14BlockDig packet14blockdig) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
|
||||
if (packet14blockdig.e == 4) {
|
||||
this.player.E();
|
||||
@ -459,7 +465,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
if (packet14blockdig.e == 0) {
|
||||
// CraftBukkit
|
||||
if (i1 < server.getSpawnRadius() && !flag) {
|
||||
if (i1 < this.server.getSpawnRadius() && !flag) {
|
||||
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
|
||||
} else {
|
||||
// CraftBukkit - add face argument
|
||||
@ -486,15 +492,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet15Place packet15place) {
|
||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
if (this.player.dead) return;
|
||||
|
||||
// This is b horrible hack needed because the client sends 2 packets on 'right mouse click'
|
||||
// aimed at b block. We shouldn't need to get the second packet if the data is handled
|
||||
// This is a horrible hack needed because the client sends 2 packets on 'right mouse click'
|
||||
// aimed at a block. We shouldn't need to get the second packet if the data is handled
|
||||
// but we cannot know what the client will do, so we might still get it
|
||||
//
|
||||
// If the time between packets is small enough, and the 'signature' similar, we discard the
|
||||
@ -502,18 +506,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// -- Grum
|
||||
|
||||
if (packet15place.face == 255) {
|
||||
if (packet15place.itemstack != null && packet15place.itemstack.id == lastMaterial && lastPacket != null && packet15place.timestamp - lastPacket < 100) {
|
||||
lastPacket = null;
|
||||
if (packet15place.itemstack != null && packet15place.itemstack.id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) {
|
||||
this.lastPacket = null;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
lastMaterial = packet15place.itemstack == null ? -1 : packet15place.itemstack.id;
|
||||
lastPacket = packet15place.timestamp;
|
||||
this.lastMaterial = packet15place.itemstack == null ? -1 : packet15place.itemstack.id;
|
||||
this.lastPacket = packet15place.timestamp;
|
||||
}
|
||||
|
||||
// CraftBukkit - if rightclick decremented the item, always send the update packet.
|
||||
// this is not here for CraftBukkit's own functionality; rather it is to fix
|
||||
// b notch bug where the item doesn't update correctly.
|
||||
// a notch bug where the item doesn't update correctly.
|
||||
boolean always = false;
|
||||
|
||||
// CraftBukkit end
|
||||
@ -534,7 +538,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
// CraftBukkit - notch decrements the counter by 1 in the above method with food,
|
||||
// snowballs and so forth, but he does it in b place that doesn't cause the
|
||||
// snowballs and so forth, but he does it in a place that doesn't cause the
|
||||
// inventory update packet to get sent
|
||||
always = (itemstack.count != itemstackAmount);
|
||||
// CraftBukkit end
|
||||
@ -552,7 +556,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
// CraftBukkit start - Check if we can actually do something over this large a distance
|
||||
Location eyeLoc = getPlayer().getEyeLocation();
|
||||
Location eyeLoc = this.getPlayer().getEyeLocation();
|
||||
if (Math.pow(eyeLoc.getX() - i, 2) + Math.pow(eyeLoc.getY() - j, 2) + Math.pow(eyeLoc.getZ() - k, 2) > PLACE_DISTANCE_SQUARED) {
|
||||
return;
|
||||
}
|
||||
@ -604,14 +608,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.player.h = false;
|
||||
// CraftBukkit
|
||||
if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
|
||||
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.f, slot.a, this.player.inventory.getItemInHand()));
|
||||
this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.a, this.player.inventory.getItemInHand()));
|
||||
}
|
||||
|
||||
worldserver.weirdIsOpCache = false;
|
||||
}
|
||||
|
||||
public void a(String s, Object[] aobject) {
|
||||
if (this.disconnected) return; // CraftBukkit - rarely it would send b disconnect line twice
|
||||
if (this.disconnected) return; // CraftBukkit - rarely it would send a disconnect line twice
|
||||
|
||||
a.info(this.player.name + " lost connection: " + s);
|
||||
// CraftBukkit start - we need to handle custom quit messages
|
||||
@ -632,31 +636,27 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit start
|
||||
if (packet instanceof Packet6SpawnPosition) {
|
||||
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
|
||||
this.player.compassTarget = new Location(getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
|
||||
this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
|
||||
} else if (packet instanceof Packet3Chat) {
|
||||
String message = ((Packet3Chat) packet).a;
|
||||
String message = ((Packet3Chat) packet).message;
|
||||
for (final String line: TextWrapper.wrapText(message)) {
|
||||
this.networkManager.a(new Packet3Chat(line));
|
||||
this.networkManager.queue(new Packet3Chat(line));
|
||||
}
|
||||
packet = null;
|
||||
}
|
||||
if (packet != null) this.networkManager.a(packet);
|
||||
if (packet != null) this.networkManager.queue(packet);
|
||||
// CraftBukkit end
|
||||
|
||||
this.g = this.f;
|
||||
}
|
||||
|
||||
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex <= InventoryPlayer.e()) {
|
||||
// CraftBukkit start
|
||||
PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
|
||||
server.getPluginManager().callEvent(event);
|
||||
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
|
||||
@ -666,7 +666,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet3Chat packet3chat) {
|
||||
String s = packet3chat.a;
|
||||
String s = packet3chat.message;
|
||||
|
||||
if (s.length() > 100) {
|
||||
this.disconnect("Chat message too long");
|
||||
@ -674,14 +674,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
s = s.trim();
|
||||
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
if (FontAllowedCharacters.a.indexOf(s.charAt(i)) < 0) {
|
||||
if (FontAllowedCharacters.allowedCharacters.indexOf(s.charAt(i)) < 0) {
|
||||
this.disconnect("Illegal characters in chat");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
chat(s);
|
||||
this.chat(s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -691,9 +691,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.handleCommand(s);
|
||||
return true;
|
||||
} else {
|
||||
Player player = getPlayer();
|
||||
Player player = this.getPlayer();
|
||||
PlayerChatEvent event = new PlayerChatEvent(player, s);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
@ -713,21 +713,22 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
private void handleCommand(String s) {
|
||||
// CraftBukkit start
|
||||
CraftPlayer player = (CraftPlayer) getPlayer();
|
||||
CraftPlayer player = this.getPlayer();
|
||||
|
||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (server.dispatchCommand(player, s.substring(1))) {
|
||||
if (this.server.dispatchCommand(player, s.substring(1))) {
|
||||
return;
|
||||
}
|
||||
} catch (CommandException ex) {
|
||||
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
|
||||
Logger.getLogger(NetServerHandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger(NetServerHandler.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -768,11 +769,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet18ArmAnimation packet18armanimation) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
if (packet18armanimation.b == 1) {
|
||||
// CraftBukkit start - raytrace to look for 'rogue armswings'
|
||||
@ -799,9 +796,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
// Arm swing animation
|
||||
Player player = getPlayer();
|
||||
PlayerAnimationEvent event = new PlayerAnimationEvent(player);
|
||||
server.getPluginManager().callEvent(event);
|
||||
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer());
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
|
||||
this.player.k_();
|
||||
@ -810,14 +806,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
public void a(Packet19EntityAction packet19entityaction) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
if (this.player.dead) return;
|
||||
|
||||
if (packet19entityaction.animation == 1 || packet19entityaction.animation == 2) {
|
||||
Player player = getPlayer();
|
||||
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(player, packet19entityaction.animation == 1);
|
||||
server.getPluginManager().callEvent(event);
|
||||
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packet19entityaction.animation == 1);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
@ -830,7 +824,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.player.setSneak(false);
|
||||
} else if (packet19entityaction.animation == 3) {
|
||||
this.player.a(false, true, true);
|
||||
this.m = false;
|
||||
this.checkMovement = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -851,36 +845,33 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet7UseEntity packet7useentity) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
Entity entity = worldserver.getEntity(packet7useentity.target);
|
||||
ItemStack itemInHand = this.player.inventory.getItemInHand();
|
||||
|
||||
if (entity != null && this.player.e(entity) && this.player.g(entity) < 36.0D) {
|
||||
if (packet7useentity.c == 0) {
|
||||
// CraftBukkit start
|
||||
PlayerInteractEntityEvent piee = new PlayerInteractEntityEvent((Player) getPlayer(), entity.getBukkitEntity());
|
||||
server.getPluginManager().callEvent(piee);
|
||||
if (piee.isCancelled()) {
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity());
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.player.c(entity);
|
||||
// CraftBukkit start - update the client if the item is an infinite one
|
||||
if (itemInHand != null && itemInHand.count <= -1) {
|
||||
this.player.a(this.player.activeContainer);
|
||||
this.player.updateInventory(this.player.activeContainer);
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else if (packet7useentity.c == 1) {
|
||||
this.player.d(entity);
|
||||
// CraftBukkit start - update the client if the item is an infinite one
|
||||
if (itemInHand != null && itemInHand.count <= -1) {
|
||||
this.player.a(this.player.activeContainer);
|
||||
this.player.updateInventory(this.player.activeContainer);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -889,33 +880,22 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
public void a(Packet9Respawn packet9respawn) {
|
||||
if (this.player.health <= 0) {
|
||||
this.player = this.minecraftServer.serverConfigurationManager.a(this.player, 0);
|
||||
this.player = this.minecraftServer.serverConfigurationManager.moveToWorld(this.player, 0);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftPlayer player = (CraftPlayer) getPlayer();
|
||||
player.setHandle(this.player);
|
||||
// CraftBukkit end
|
||||
this.getPlayer().setHandle(this.player); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet101CloseWindow packet101closewindow) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
this.player.z();
|
||||
}
|
||||
|
||||
public void a(Packet102WindowClick packet102windowclick) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
if (this.player.activeContainer.f == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
|
||||
if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
|
||||
ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, packet102windowclick.f, this.player);
|
||||
|
||||
if (ItemStack.equals(packet102windowclick.e, itemstack)) {
|
||||
@ -925,7 +905,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.player.y();
|
||||
this.player.h = false;
|
||||
} else {
|
||||
this.n.put(Integer.valueOf(this.player.activeContainer.f), Short.valueOf(packet102windowclick.d));
|
||||
this.n.put(Integer.valueOf(this.player.activeContainer.windowId), Short.valueOf(packet102windowclick.d));
|
||||
this.player.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
|
||||
this.player.activeContainer.a(this.player, false);
|
||||
ArrayList arraylist = new ArrayList();
|
||||
@ -940,27 +920,19 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
public void a(Packet106Transaction packet106transaction) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
Short oshort = (Short) this.n.get(Integer.valueOf(this.player.activeContainer.f));
|
||||
Short oshort = (Short) this.n.get(Integer.valueOf(this.player.activeContainer.windowId));
|
||||
|
||||
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.f == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
|
||||
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
|
||||
this.player.activeContainer.a(this.player, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet130UpdateSign packet130updatesign) {
|
||||
// CraftBukkit start
|
||||
if (this.player.dead) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
//
|
||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
|
||||
if (worldserver.isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) {
|
||||
TileEntity tileentity = worldserver.getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z);
|
||||
@ -986,7 +958,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
flag = false;
|
||||
} else {
|
||||
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
|
||||
if (FontAllowedCharacters.a.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) {
|
||||
if (FontAllowedCharacters.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
@ -1005,9 +977,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
TileEntitySign tileentitysign1 = (TileEntitySign) tileentity;
|
||||
|
||||
// CraftBukkit start
|
||||
Player player = server.getPlayer(this.player);
|
||||
SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), server.getPlayer(this.player), packet130updatesign.lines);
|
||||
server.getPluginManager().callEvent(event);
|
||||
Player player = this.server.getPlayer(this.player);
|
||||
SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), this.server.getPlayer(this.player), packet130updatesign.lines);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
|
@ -9,7 +9,6 @@ import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.io.IOException; // CraftBukkit
|
||||
|
||||
public class NetworkManager {
|
||||
|
||||
@ -23,8 +22,8 @@ public class NetworkManager {
|
||||
private DataOutputStream output;
|
||||
private boolean l = true;
|
||||
private List m = Collections.synchronizedList(new ArrayList());
|
||||
private List n = Collections.synchronizedList(new ArrayList());
|
||||
private List o = Collections.synchronizedList(new ArrayList());
|
||||
private List highPriorityQueue = Collections.synchronizedList(new ArrayList());
|
||||
private List lowPriorityQueue = Collections.synchronizedList(new ArrayList());
|
||||
private NetHandler p;
|
||||
private boolean q = false;
|
||||
private Thread r;
|
||||
@ -37,7 +36,7 @@ public class NetworkManager {
|
||||
public static int[] d = new int[256];
|
||||
public static int[] e = new int[256];
|
||||
public int f = 0;
|
||||
private int y = 50;
|
||||
private int lowPriorityQueueDelay = 50;
|
||||
|
||||
public NetworkManager(Socket socket, String s, NetHandler nethandler) {
|
||||
this.socket = socket;
|
||||
@ -55,11 +54,15 @@ public class NetworkManager {
|
||||
socket.setSoTimeout(30000);
|
||||
this.input = new DataInputStream(socket.getInputStream());
|
||||
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
|
||||
} catch (java.io.IOException socketexception) {
|
||||
// CraftBukkit end
|
||||
} catch (IOException socketexception) {
|
||||
System.err.println(socketexception.getMessage());
|
||||
}
|
||||
|
||||
/* CraftBukkit start - moved up
|
||||
this.input = new DataInputStream(socket.getInputStream());
|
||||
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
|
||||
// CraftBukkit end */
|
||||
this.s = new NetworkReaderThread(this, s + " read thread");
|
||||
this.r = new NetworkWriterThread(this, s + " write thread");
|
||||
this.s.start();
|
||||
@ -70,16 +73,16 @@ public class NetworkManager {
|
||||
this.p = nethandler;
|
||||
}
|
||||
|
||||
public void a(Packet packet) {
|
||||
public void queue(Packet packet) {
|
||||
if (!this.q) {
|
||||
Object object = this.g;
|
||||
|
||||
synchronized (this.g) {
|
||||
this.x += packet.a() + 1;
|
||||
if (packet.k) {
|
||||
this.o.add(packet);
|
||||
this.lowPriorityQueue.add(packet);
|
||||
} else {
|
||||
this.n.add(packet);
|
||||
this.highPriorityQueue.add(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,10 +97,10 @@ public class NetworkManager {
|
||||
int i;
|
||||
int[] aint;
|
||||
|
||||
if (!this.n.isEmpty() && (this.f == 0 || System.currentTimeMillis() - ((Packet) this.n.get(0)).timestamp >= (long) this.f)) {
|
||||
if (!this.highPriorityQueue.isEmpty() && (this.f == 0 || System.currentTimeMillis() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.f)) {
|
||||
object = this.g;
|
||||
synchronized (this.g) {
|
||||
packet = (Packet) this.n.remove(0);
|
||||
packet = (Packet) this.highPriorityQueue.remove(0);
|
||||
this.x -= packet.a() + 1;
|
||||
}
|
||||
|
||||
@ -109,10 +112,10 @@ public class NetworkManager {
|
||||
}
|
||||
|
||||
// CraftBukkit - don't allow low priority packet to be sent unless it was placed in the queue before the first packet on the high priority queue
|
||||
if ((flag || this.y-- <= 0) && !this.o.isEmpty() && (this.n.isEmpty() || ((Packet) this.n.get(0)).timestamp > ((Packet) this.o.get(0)).timestamp)) {
|
||||
if ((flag || this.lowPriorityQueueDelay-- <= 0) && !this.lowPriorityQueue.isEmpty() && (this.highPriorityQueue.isEmpty() || ((Packet) this.highPriorityQueue.get(0)).timestamp > ((Packet) this.lowPriorityQueue.get(0)).timestamp)) {
|
||||
object = this.g;
|
||||
synchronized (this.g) {
|
||||
packet = (Packet) this.o.remove(0);
|
||||
packet = (Packet) this.lowPriorityQueue.remove(0);
|
||||
this.x -= packet.a() + 1;
|
||||
}
|
||||
|
||||
@ -120,7 +123,7 @@ public class NetworkManager {
|
||||
aint = e;
|
||||
i = packet.b();
|
||||
aint[i] += packet.a() + 1;
|
||||
this.y = 0;
|
||||
this.lowPriorityQueueDelay = 0;
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@ -241,7 +244,7 @@ public class NetworkManager {
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.o.size();
|
||||
return this.lowPriorityQueue.size();
|
||||
}
|
||||
|
||||
static boolean a(NetworkManager networkmanager) {
|
||||
|
@ -9,11 +9,6 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class Packet {
|
||||
|
||||
private static Map a = new HashMap();
|
||||
@ -90,10 +85,10 @@ public abstract class Packet {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
catch (SocketTimeoutException exception) {
|
||||
catch (java.net.SocketTimeoutException exception) {
|
||||
System.out.println("Read timed out");
|
||||
return null;
|
||||
} catch (SocketException exception) {
|
||||
} catch (java.net.SocketException exception) {
|
||||
System.out.println("Connection reset");
|
||||
return null;
|
||||
}
|
||||
|
@ -2,11 +2,12 @@ package net.minecraft.server;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import java.io.IOException; // CraftBukkit
|
||||
|
||||
public class Packet3Chat extends Packet {
|
||||
|
||||
public String a;
|
||||
public String message;
|
||||
|
||||
public Packet3Chat() {}
|
||||
|
||||
@ -17,15 +18,15 @@ public class Packet3Chat extends Packet {
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
this.a = s;
|
||||
this.message = s;
|
||||
}
|
||||
|
||||
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
|
||||
this.a = a(datainputstream, 119);
|
||||
this.message = a(datainputstream, 119);
|
||||
}
|
||||
|
||||
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
|
||||
a(this.a, dataoutputstream);
|
||||
a(this.message, dataoutputstream);
|
||||
}
|
||||
|
||||
public void a(NetHandler nethandler) {
|
||||
@ -33,6 +34,6 @@ public class Packet3Chat extends Packet {
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.a.length();
|
||||
return this.message.length();
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,13 @@ public class Packet51MapChunk extends Packet {
|
||||
this.k = true;
|
||||
}
|
||||
|
||||
// CraftBukkit - start
|
||||
// CraftBukkit start
|
||||
public Packet51MapChunk(int i, int j, int k, int l, int i1, int j1, World world) {
|
||||
this(i, j, k, l, i1, j1, world.c(i, j, k, l, i1, j1));
|
||||
this(i, j, k, l, i1, j1, world.getMultiChunkData(i, j, k, l, i1, j1));
|
||||
}
|
||||
|
||||
public Packet51MapChunk(int i, int j, int k, int l, int i1, int j1, byte[] data) {
|
||||
// CraftBukkit - end
|
||||
// CraftBukkit end
|
||||
this.k = true;
|
||||
this.a = i;
|
||||
this.b = j;
|
||||
|
@ -8,7 +8,7 @@ class PlayerInstance {
|
||||
private List b;
|
||||
private int chunkX;
|
||||
private int chunkZ;
|
||||
private ChunkCoordIntPair e;
|
||||
private ChunkCoordIntPair location;
|
||||
private short[] dirtyBlocks;
|
||||
private int dirtyCount;
|
||||
private int h;
|
||||
@ -27,7 +27,7 @@ class PlayerInstance {
|
||||
this.dirtyCount = 0;
|
||||
this.chunkX = i;
|
||||
this.chunkZ = j;
|
||||
this.e = new ChunkCoordIntPair(i, j);
|
||||
this.location = new ChunkCoordIntPair(i, j);
|
||||
playermanager.a().chunkProviderServer.getChunkAt(i, j);
|
||||
}
|
||||
|
||||
@ -36,13 +36,13 @@ class PlayerInstance {
|
||||
throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.chunkX + ", " + this.chunkZ);
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
if (entityplayer.g.add(this.e)) {
|
||||
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.e.x, this.e.z, true));
|
||||
if (entityplayer.playerChunkCoordIntPairs.add(this.location)) {
|
||||
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.location.x, this.location.z, true));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b.add(entityplayer);
|
||||
entityplayer.f.add(this.e);
|
||||
entityplayer.chunkCoordIntPairQueue.add(this.location);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,9 +60,9 @@ class PlayerInstance {
|
||||
this.playerManager.a().chunkProviderServer.queueUnload(this.chunkX, this.chunkZ);
|
||||
}
|
||||
|
||||
entityplayer.f.remove(this.e);
|
||||
entityplayer.chunkCoordIntPairQueue.remove(this.location);
|
||||
// CraftBukkit - contains -> remove -- TODO VERIFY!!!!
|
||||
if (entityplayer.g.remove(this.e)) {
|
||||
if (entityplayer.playerChunkCoordIntPairs.remove(this.location)) {
|
||||
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.chunkX, this.chunkZ, false));
|
||||
}
|
||||
}
|
||||
@ -117,7 +117,7 @@ class PlayerInstance {
|
||||
for (int i = 0; i < this.b.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||
|
||||
if (entityplayer.g.contains(this.e)) {
|
||||
if (entityplayer.playerChunkCoordIntPairs.contains(this.location)) {
|
||||
entityplayer.netServerHandler.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,9 @@ package net.minecraft.server;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
// CraftBukkit end
|
||||
|
||||
public class PlayerManager {
|
||||
|
||||
public List a = new ArrayList();
|
||||
public List managedPlayers = new ArrayList();
|
||||
private PlayerList b = new PlayerList();
|
||||
private List c = new ArrayList();
|
||||
private MinecraftServer server;
|
||||
@ -31,7 +26,7 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public WorldServer a() {
|
||||
return this.server.a(this.e);
|
||||
return this.server.getWorldServer(this.e);
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
@ -99,7 +94,7 @@ public class PlayerManager {
|
||||
this.a(i + i1, j + j1, true).a(entityplayer);
|
||||
}
|
||||
|
||||
this.a.add(entityplayer);
|
||||
this.managedPlayers.add(entityplayer);
|
||||
}
|
||||
|
||||
public void removePlayer(EntityPlayer entityplayer) {
|
||||
@ -116,7 +111,7 @@ public class PlayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
this.a.remove(entityplayer);
|
||||
this.managedPlayers.remove(entityplayer);
|
||||
}
|
||||
|
||||
private boolean a(int i, int j, int k, int l) {
|
||||
@ -163,8 +158,9 @@ public class PlayerManager {
|
||||
if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) {
|
||||
final int x = i;
|
||||
final int z = j;
|
||||
List<ChunkCoordIntPair> chunksToSend = entityplayer.f;
|
||||
Collections.sort(chunksToSend, new Comparator<ChunkCoordIntPair>() {
|
||||
List<ChunkCoordIntPair> chunksToSend = entityplayer.chunkCoordIntPairQueue;
|
||||
|
||||
java.util.Collections.sort(chunksToSend, new java.util.Comparator<ChunkCoordIntPair>() {
|
||||
public int compare(ChunkCoordIntPair a, ChunkCoordIntPair b) {
|
||||
return Math.max(Math.abs(a.x - x), Math.abs(a.z - z)) - Math.max(Math.abs(b.x - x), Math.abs(b.z - z));
|
||||
}
|
||||
@ -175,7 +171,7 @@ public class PlayerManager {
|
||||
}
|
||||
}
|
||||
|
||||
public int c() {
|
||||
public int getFurthestViewableBlock() {
|
||||
return this.f * 16 - 16;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.event.world.PortalCreateEvent;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.Bukkit;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -225,9 +224,9 @@ public class PortalTravelAgent {
|
||||
boolean flag;
|
||||
|
||||
// CraftBukkit start - portal create event
|
||||
java.util.ArrayList<org.bukkit.block.Block> blocks = new java.util.ArrayList<org.bukkit.block.Block>();
|
||||
java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>();
|
||||
// Find out what blocks the portal is going to modify, duplicated from below
|
||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
|
||||
if (d0 < 0.0D) {
|
||||
if (i1 < 70) {
|
||||
@ -246,10 +245,7 @@ public class PortalTravelAgent {
|
||||
i3 = i5 + (k2 - 1) * k5 + l2 * l5;
|
||||
l3 = j5 + j3;
|
||||
k3 = j2 + (k2 - 1) * l5 - l2 * k5;
|
||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i3, l3, k3);
|
||||
if (!blocks.contains(b)) {
|
||||
blocks.add(b);
|
||||
}
|
||||
blocks.add(bworld.getBlockAt(i3, l3, k3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,16 +257,14 @@ public class PortalTravelAgent {
|
||||
i3 = i5 + (k2 - 1) * k5;
|
||||
l3 = j5 + j3;
|
||||
k3 = j2 + (k2 - 1) * l5;
|
||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i3, l3, k3);
|
||||
if (!blocks.contains(b)) {
|
||||
blocks.add(b);
|
||||
}
|
||||
blocks.add(bworld.getBlockAt(i3, l3, k3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld);
|
||||
PortalCreateEvent event = new PortalCreateEvent(blocks, bworld);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return true;
|
||||
}
|
||||
@ -301,7 +295,7 @@ public class PortalTravelAgent {
|
||||
}
|
||||
|
||||
for (l2 = 0; l2 < 4; ++l2) {
|
||||
world.o = true;
|
||||
world.suppressPhysics = true;
|
||||
|
||||
for (k2 = 0; k2 < 4; ++k2) {
|
||||
for (j3 = -1; j3 < 4; ++j3) {
|
||||
@ -313,7 +307,7 @@ public class PortalTravelAgent {
|
||||
}
|
||||
}
|
||||
|
||||
world.o = false;
|
||||
world.suppressPhysics = false;
|
||||
|
||||
for (k2 = 0; k2 < 4; ++k2) {
|
||||
for (j3 = -1; j3 < 4; ++j3) {
|
||||
|
@ -7,12 +7,10 @@ import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import joptsimple.OptionSet; // CraftBukkit
|
||||
|
||||
public class PropertyManager {
|
||||
|
||||
public static Logger a = Logger.getLogger("Minecraft");
|
||||
public Properties properties = new Properties(); // Craftbukkit - priv to pub
|
||||
public Properties properties = new Properties(); // CraftBukkit - priv to pub
|
||||
private File c;
|
||||
|
||||
public PropertyManager(File file1) {
|
||||
@ -31,17 +29,17 @@ public class PropertyManager {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
private OptionSet options = null;
|
||||
private joptsimple.OptionSet options = null;
|
||||
|
||||
public PropertyManager(final OptionSet options) {
|
||||
public PropertyManager(final joptsimple.OptionSet options) {
|
||||
this((File) options.valueOf("config"));
|
||||
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
private <T> T getOverride(String name, T value) {
|
||||
if ((options != null) && (options.has(name))) {
|
||||
return (T) options.valueOf(name);
|
||||
if ((this.options != null) && (this.options.has(name))) {
|
||||
return (T) this.options.valueOf(name);
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -50,10 +48,10 @@ public class PropertyManager {
|
||||
|
||||
public void a() {
|
||||
a.log(Level.INFO, "Generating new properties file");
|
||||
this.b();
|
||||
this.savePropertiesFile();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
public void savePropertiesFile() {
|
||||
try {
|
||||
this.properties.store(new FileOutputStream(this.c), "Minecraft server properties");
|
||||
} catch (Exception exception) {
|
||||
@ -64,19 +62,19 @@ public class PropertyManager {
|
||||
|
||||
public String getString(String s, String s1) {
|
||||
if (!this.properties.containsKey(s)) {
|
||||
s1 = getOverride(s, s1); // CraftBukkit
|
||||
s1 = this.getOverride(s, s1); // CraftBukkit
|
||||
this.properties.setProperty(s, s1);
|
||||
this.b();
|
||||
this.savePropertiesFile();
|
||||
}
|
||||
|
||||
return getOverride(s, this.properties.getProperty(s, s1)); // CraftBukkit
|
||||
return this.getOverride(s, this.properties.getProperty(s, s1)); // CraftBukkit
|
||||
}
|
||||
|
||||
public int getInt(String s, int i) {
|
||||
try {
|
||||
return getOverride(s, Integer.parseInt(this.getString(s, "" + i))); // CraftBukkit
|
||||
return this.getOverride(s, Integer.parseInt(this.getString(s, "" + i))); // CraftBukkit
|
||||
} catch (Exception exception) {
|
||||
i = getOverride(s, i); // CraftBukkit
|
||||
i = this.getOverride(s, i); // CraftBukkit
|
||||
this.properties.setProperty(s, "" + i);
|
||||
return i;
|
||||
}
|
||||
@ -84,17 +82,17 @@ public class PropertyManager {
|
||||
|
||||
public boolean getBoolean(String s, boolean flag) {
|
||||
try {
|
||||
return getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); // CraftBukkit
|
||||
return this.getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); // CraftBukkit
|
||||
} catch (Exception exception) {
|
||||
flag = getOverride(s, flag); // CraftBukkit
|
||||
flag = this.getOverride(s, flag); // CraftBukkit
|
||||
this.properties.setProperty(s, "" + flag);
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(String s, boolean flag) {
|
||||
flag = getOverride(s, flag); // CraftBukkit
|
||||
flag = this.getOverride(s, flag); // CraftBukkit
|
||||
this.properties.setProperty(s, "" + flag);
|
||||
this.b();
|
||||
this.savePropertiesFile();
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ public class SecondaryWorldServer extends WorldServer {
|
||||
public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, long j, WorldServer worldserver, org.bukkit.World.Environment env, ChunkGenerator gen) {
|
||||
super(minecraftserver, idatamanager, s, i, j, env, gen);
|
||||
// CraftBukkit end
|
||||
this.z = worldserver.z;
|
||||
this.worldMaps = worldserver.worldMaps;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerPortalEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -51,7 +50,7 @@ public class ServerConfigurationManager {
|
||||
public ServerConfigurationManager(MinecraftServer minecraftserver) {
|
||||
minecraftserver.server = new CraftServer(minecraftserver, this);
|
||||
minecraftserver.console = new ColouredConsoleSender(minecraftserver.server);
|
||||
cserver = minecraftserver.server;
|
||||
this.cserver = minecraftserver.server;
|
||||
// CraftBukkit end
|
||||
|
||||
this.server = minecraftserver;
|
||||
@ -82,13 +81,13 @@ public class ServerConfigurationManager {
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
// CraftBukkit - removed playermanagers
|
||||
for (WorldServer world : this.server.worlds) {
|
||||
if (world.manager.a.contains(entityplayer)) {
|
||||
if (world.manager.managedPlayers.contains(entityplayer)) {
|
||||
world.manager.removePlayer(entityplayer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.a(entityplayer.dimension).addPlayer(entityplayer);
|
||||
WorldServer worldserver = this.server.a(entityplayer.dimension);
|
||||
this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
|
||||
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
|
||||
|
||||
worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||
}
|
||||
@ -97,14 +96,13 @@ public class ServerConfigurationManager {
|
||||
// CraftBukkit start
|
||||
if (this.server.worlds.size() == 0) {
|
||||
return this.server.propertyManager.getInt("view-distance", 10) * 16 - 16;
|
||||
} else {
|
||||
return this.server.worlds.get(0).manager.c();
|
||||
}
|
||||
return this.server.worlds.get(0).manager.getFurthestViewableBlock();
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
private PlayerManager a(int i) {
|
||||
return server.a(i).manager; // CraftBukkit
|
||||
private PlayerManager getPlayerManager(int i) {
|
||||
return this.server.getWorldServer(i).manager; // CraftBukkit
|
||||
}
|
||||
|
||||
public void b(EntityPlayer entityplayer) {
|
||||
@ -113,7 +111,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
public void c(EntityPlayer entityplayer) {
|
||||
this.players.add(entityplayer);
|
||||
WorldServer worldserver = this.server.a(entityplayer.dimension);
|
||||
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
|
||||
|
||||
worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||
|
||||
@ -122,8 +120,8 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
|
||||
cserver.getPluginManager().callEvent(playerJoinEvent);
|
||||
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
|
||||
this.cserver.getPluginManager().callEvent(playerJoinEvent);
|
||||
|
||||
String joinMessage = playerJoinEvent.getJoinMessage();
|
||||
|
||||
@ -133,25 +131,25 @@ public class ServerConfigurationManager {
|
||||
// CraftBukkit end
|
||||
|
||||
worldserver.addEntity(entityplayer);
|
||||
this.a(entityplayer.dimension).addPlayer(entityplayer);
|
||||
this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
|
||||
}
|
||||
|
||||
public void d(EntityPlayer entityplayer) {
|
||||
this.a(entityplayer.dimension).movePlayer(entityplayer);
|
||||
this.getPlayerManager(entityplayer.dimension).movePlayer(entityplayer);
|
||||
}
|
||||
|
||||
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - changed return type
|
||||
// CraftBukkit start
|
||||
// Quitting must be before we do final save of data, in case plugins need to modify it
|
||||
this.a(entityplayer.dimension).removePlayer(entityplayer);
|
||||
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
|
||||
cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
|
||||
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
|
||||
this.cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||
// CraftBukkit end
|
||||
|
||||
this.playerFileData.a(entityplayer);
|
||||
this.server.a(entityplayer.dimension).kill(entityplayer);
|
||||
this.server.getWorldServer(entityplayer.dimension).kill(entityplayer);
|
||||
this.players.remove(entityplayer);
|
||||
this.a(entityplayer.dimension).removePlayer(entityplayer);
|
||||
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
|
||||
|
||||
return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
||||
}
|
||||
@ -161,7 +159,7 @@ public class ServerConfigurationManager {
|
||||
// Instead of kicking then returning, we need to store the kick reason
|
||||
// in the event, check with plugins to see if it's ok, and THEN kick
|
||||
// depending on the outcome. Also change any reference to this.e.c to entity.world
|
||||
EntityPlayer entity = new EntityPlayer(this.server, this.server.a(0), s, new ItemInWorldManager(this.server.a(0)));
|
||||
EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, new ItemInWorldManager(this.server.getWorldServer(0)));
|
||||
Player player = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||
PlayerLoginEvent event = new PlayerLoginEvent(player);
|
||||
|
||||
@ -183,7 +181,7 @@ public class ServerConfigurationManager {
|
||||
event.disallow(PlayerLoginEvent.Result.ALLOWED, s1);
|
||||
}
|
||||
|
||||
cserver.getPluginManager().callEvent(event);
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
||||
netloginhandler.disconnect(event.getKickMessage());
|
||||
return null;
|
||||
@ -202,49 +200,50 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public EntityPlayer a(EntityPlayer entityplayer, int i) {
|
||||
return a(entityplayer, i, null);
|
||||
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i) {
|
||||
return this.moveToWorld(entityplayer, i, null);
|
||||
}
|
||||
|
||||
public EntityPlayer a(EntityPlayer entityplayer, int i, Location location) {
|
||||
this.server.b(entityplayer.dimension).trackPlayer(entityplayer);
|
||||
this.a(entityplayer.dimension).removePlayer(entityplayer);
|
||||
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, Location location) {
|
||||
this.server.getTracker(entityplayer.dimension).untrackPlayer(entityplayer);
|
||||
// this.server.getTracker(entityplayer.dimension).untrackEntity(entityplayer); // CraftBukkit
|
||||
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
|
||||
this.players.remove(entityplayer);
|
||||
this.server.a(entityplayer.dimension).removeEntity(entityplayer);
|
||||
ChunkCoordinates chunkcoordinates = entityplayer.M();
|
||||
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
|
||||
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
|
||||
|
||||
// CraftBukkit start
|
||||
EntityPlayer entityplayer1 = entityplayer;
|
||||
|
||||
if (location == null) {
|
||||
boolean isBedSpawn = false;
|
||||
CraftWorld cw = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
||||
if (cw != null && chunkcoordinates != null) {
|
||||
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cw.getHandle(), chunkcoordinates);
|
||||
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
||||
if (cworld != null && chunkcoordinates != null) {
|
||||
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates);
|
||||
if (chunkcoordinates1 != null) {
|
||||
isBedSpawn = true;
|
||||
location = new Location(cw, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
|
||||
location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5);
|
||||
} else {
|
||||
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0));
|
||||
}
|
||||
}
|
||||
|
||||
if (location == null) {
|
||||
cw = (CraftWorld) this.server.server.getWorlds().get(0);
|
||||
chunkcoordinates = cw.getHandle().getSpawn();
|
||||
location = new Location(cw, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
|
||||
cworld = (CraftWorld) this.server.server.getWorlds().get(0);
|
||||
chunkcoordinates = cworld.getHandle().getSpawn();
|
||||
location = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
|
||||
}
|
||||
|
||||
Player respawnPlayer = cserver.getPlayer(entityplayer);
|
||||
Player respawnPlayer = this.cserver.getPlayer(entityplayer);
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
|
||||
cserver.getPluginManager().callEvent(respawnEvent);
|
||||
this.cserver.getPluginManager().callEvent(respawnEvent);
|
||||
|
||||
location = respawnEvent.getRespawnLocation();
|
||||
entityplayer.health = 20;
|
||||
entityplayer.fireTicks = 0;
|
||||
entityplayer.fallDistance = 0;
|
||||
} else {
|
||||
location.setWorld(this.server.a(i).getWorld());
|
||||
location.setWorld(this.server.getWorldServer(i).getWorld());
|
||||
}
|
||||
WorldServer worldserver = ((CraftWorld) location.getWorld()).getHandle();
|
||||
entityplayer1.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
@ -260,15 +259,15 @@ public class ServerConfigurationManager {
|
||||
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
|
||||
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0)));
|
||||
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension));
|
||||
entityplayer1.a(worldserver);
|
||||
entityplayer1.spawnIn(worldserver);
|
||||
entityplayer1.dead = false;
|
||||
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
|
||||
// CraftBukkit end
|
||||
this.a(entityplayer1, worldserver);
|
||||
this.a(entityplayer1.dimension).addPlayer(entityplayer1);
|
||||
this.getPlayerManager(entityplayer1.dimension).addPlayer(entityplayer1);
|
||||
worldserver.addEntity(entityplayer1);
|
||||
this.players.add(entityplayer1);
|
||||
this.g(entityplayer1); // CraftBukkit
|
||||
this.updateClient(entityplayer1); // CraftBukkit
|
||||
entityplayer1.w();
|
||||
return entityplayer1;
|
||||
}
|
||||
@ -276,8 +275,8 @@ public class ServerConfigurationManager {
|
||||
public void f(EntityPlayer entityplayer) {
|
||||
// CraftBukkit start -- Replaced the standard handling of portals with a more customised method.
|
||||
int dimension = entityplayer.dimension;
|
||||
WorldServer fromWorld = this.server.a(dimension);
|
||||
WorldServer toWorld = this.server.a(dimension == -1 ? 0 : -1);
|
||||
WorldServer fromWorld = this.server.getWorldServer(dimension);
|
||||
WorldServer toWorld = this.server.getWorldServer(dimension == -1 ? 0 : -1);
|
||||
double blockRatio = dimension == -1 ? 8 : 0.125;
|
||||
|
||||
Location fromLocation = new Location(fromWorld.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
||||
@ -289,12 +288,13 @@ public class ServerConfigurationManager {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location finalLocation = event.getTo();
|
||||
if(event.useTravelAgent()){
|
||||
if (event.useTravelAgent()) {
|
||||
finalLocation = pta.findOrCreate(finalLocation);
|
||||
}
|
||||
toWorld = ((CraftWorld) finalLocation.getWorld()).getHandle();
|
||||
this.a(entityplayer, toWorld.dimension, finalLocation);
|
||||
this.moveToWorld(entityplayer, toWorld.dimension, finalLocation);
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
@ -307,7 +307,7 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
|
||||
public void flagDirty(int i, int j, int k, int l) {
|
||||
this.a(l).flagDirty(i, j, k);
|
||||
this.getPlayerManager(l).flagDirty(i, j, k);
|
||||
}
|
||||
|
||||
public void sendAll(Packet packet) {
|
||||
@ -535,11 +535,11 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(double d0, double d1, double d2, double d3, int i, Packet packet) {
|
||||
this.a((EntityHuman) null, d0, d1, d2, d3, i, packet);
|
||||
public void sendPacketNearby(double d0, double d1, double d2, double d3, int i, Packet packet) {
|
||||
this.sendPacketNearby((EntityHuman) null, d0, d1, d2, d3, i, packet);
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) {
|
||||
public void sendPacketNearby(EntityHuman entityhuman, double d0, double d1, double d2, double d3, int i, Packet packet) {
|
||||
for (int j = 0; j < this.players.size(); ++j) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
|
||||
|
||||
@ -611,8 +611,8 @@ public class ServerConfigurationManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void g(EntityPlayer entityplayer) {
|
||||
entityplayer.a(entityplayer.defaultContainer);
|
||||
public void updateClient(EntityPlayer entityplayer) {
|
||||
entityplayer.updateInventory(entityplayer.defaultContainer);
|
||||
entityplayer.B();
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class Slot {
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
return this.inventory.a(this.index, i);
|
||||
return this.inventory.splitStack(this.index, i);
|
||||
}
|
||||
|
||||
public boolean a(IInventory iinventory, int i) {
|
||||
|
@ -4,13 +4,6 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import jline.ConsoleReader;
|
||||
import org.bukkit.craftbukkit.Main;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ThreadCommandReader extends Thread {
|
||||
|
||||
final MinecraftServer server;
|
||||
@ -20,27 +13,25 @@ public class ThreadCommandReader extends Thread {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
// CraftBukkit start
|
||||
ConsoleReader bufferedreader = this.server.reader;
|
||||
jline.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
|
||||
String s = null;
|
||||
// CraftBukkit end
|
||||
|
||||
try {
|
||||
// CraftBukkit start - JLine disabling compatibility
|
||||
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
|
||||
if (Main.useJline) {
|
||||
if (org.bukkit.craftbukkit.Main.useJline) {
|
||||
s = bufferedreader.readLine(">", null);
|
||||
} else {
|
||||
s = bufferedreader.readLine();
|
||||
}
|
||||
if (s != null) {
|
||||
// CraftBukkit end
|
||||
this.server.issueCommand(s, this.server);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
} catch (IOException ioexception) {
|
||||
// CraftBukkit
|
||||
Logger.getLogger(ThreadCommandReader.class.getName()).log(Level.SEVERE, null, ioexception);
|
||||
java.util.logging.Logger.getLogger(ThreadCommandReader.class.getName()).log(java.util.logging.Level.SEVERE, null, ioexception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class ThreadLoginVerifier extends Thread {
|
||||
}
|
||||
|
||||
PlayerPreLoginEvent event = new PlayerPreLoginEvent(this.loginPacket.name, this.netLoginHandler.getSocket().getInetAddress());
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
|
||||
this.netLoginHandler.disconnect(event.getKickMessage());
|
||||
|
@ -6,7 +6,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -20,7 +20,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
return this.items[i];
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
@ -94,6 +94,6 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.world.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.d((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
public ItemStack[] getContents() {
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -23,7 +23,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
return this.items[i];
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
@ -63,11 +63,11 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public ItemStack b() {
|
||||
int i = findDispenseSlot();
|
||||
int i = this.findDispenseSlot();
|
||||
// CraftBukkit end
|
||||
|
||||
if (i >= 0) {
|
||||
return this.a(i, 1);
|
||||
return this.splitStack(i, 1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@ -124,6 +124,6 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.world.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.d((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||
@ -12,13 +10,13 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
|
||||
private ItemStack[] items = new ItemStack[3];
|
||||
public int burnTime = 0;
|
||||
public int b = 0;
|
||||
public int ticksForCurrentFuel = 0;
|
||||
public int cookTime = 0;
|
||||
|
||||
// CraftBukkit start
|
||||
private int lastTick = (int) (System.currentTimeMillis() / 50);
|
||||
public ItemStack[] getContents() {
|
||||
return items;
|
||||
return this.items;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -32,7 +30,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
return this.items[i];
|
||||
}
|
||||
|
||||
public ItemStack a(int i, int j) {
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
@ -81,7 +79,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
|
||||
this.burnTime = nbttagcompound.d("BurnTime");
|
||||
this.cookTime = nbttagcompound.d("CookTime");
|
||||
this.b = this.a(this.items[1]);
|
||||
this.ticksForCurrentFuel = this.fuelTime(this.items[1]);
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
@ -107,7 +105,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
public boolean isBurning() {
|
||||
return this.burnTime > 0;
|
||||
}
|
||||
|
||||
@ -119,41 +117,38 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
int currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
int elapsedTicks = currentTick - this.lastTick;
|
||||
this.lastTick = currentTick;
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.f() && this.h()) {
|
||||
// CraftBukkit start -- handle multiple elapsed ticks
|
||||
// CraftBukkit - moved from below
|
||||
if (this.isBurning() && this.canBurn()) {
|
||||
this.cookTime += elapsedTicks;
|
||||
if (this.cookTime >= 200) {
|
||||
this.cookTime %= 200;
|
||||
// CraftBukkit end
|
||||
this.g();
|
||||
this.burn();
|
||||
flag1 = true;
|
||||
}
|
||||
} else {
|
||||
this.cookTime = 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.burnTime > 0) {
|
||||
this.burnTime -= elapsedTicks; // CraftBukkit
|
||||
}
|
||||
|
||||
if (!this.world.isStatic) {
|
||||
// CraftBukkit start -- handle multiple elapsed ticks
|
||||
if (this.burnTime <= 0 && this.h() && this.items[1] != null) { // CraftBukkit == to <=
|
||||
CraftServer cserver = this.world.getServer();
|
||||
CraftWorld cworld = this.world.getWorld();
|
||||
// CraftBukkit start - handle multiple elapsed ticks
|
||||
if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <=
|
||||
CraftItemStack fuel = new CraftItemStack(this.items[1]);
|
||||
|
||||
FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(cworld.getBlockAt(this.e, this.f, this.g), fuel, this.a(this.items[1]));
|
||||
cserver.getPluginManager().callEvent(furnaceBurnEvent);
|
||||
FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, this.fuelTime(this.items[1]));
|
||||
this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);
|
||||
|
||||
if (furnaceBurnEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.b = this.a(this.items[1]);
|
||||
this.burnTime += this.b;
|
||||
this.ticksForCurrentFuel = this.fuelTime(this.items[1]);
|
||||
this.burnTime += this.ticksForCurrentFuel;
|
||||
// CraftBukkit end
|
||||
if (this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
@ -166,9 +161,22 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
/* CraftBukkit start - moved up
|
||||
if (this.f() && this.process()) {
|
||||
++this.cookTime;
|
||||
if (this.cookTime == 200) {
|
||||
this.cookTime = 0;
|
||||
this.burn();
|
||||
flag1 = true;
|
||||
}
|
||||
} else {
|
||||
this.cookTime = 0;
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
if (flag != this.burnTime > 0) {
|
||||
flag1 = true;
|
||||
BlockFurnace.a(this.burnTime > 0, this.world, this.e, this.f, this.g);
|
||||
BlockFurnace.a(this.burnTime > 0, this.world, this.x, this.y, this.z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,29 +185,27 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean h() {
|
||||
private boolean canBurn() {
|
||||
if (this.items[0] == null) {
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(this.items[0].getItem().id);
|
||||
ItemStack itemstack = FurnaceRecipes.getInstance().a(this.items[0].getItem().id);
|
||||
|
||||
// CraftBukkit - consider resultant count instead of current count
|
||||
return itemstack == null ? false : (this.items[2] == null ? true : (!this.items[2].a(itemstack) ? false : (this.items[2].count + itemstack.count <= this.getMaxStackSize() && this.items[2].count < this.items[2].b() ? true : this.items[2].count + itemstack.count <= itemstack.b())));
|
||||
return itemstack == null ? false : (this.items[2] == null ? true : (!this.items[2].doMaterialsMatch(itemstack) ? false : (this.items[2].count + itemstack.count <= this.getMaxStackSize() && this.items[2].count < this.items[2].getMaxStackSize() ? true : this.items[2].count + itemstack.count <= itemstack.getMaxStackSize())));
|
||||
}
|
||||
}
|
||||
|
||||
public void g() {
|
||||
if (this.h()) {
|
||||
ItemStack itemstack = FurnaceRecipes.a().a(this.items[0].getItem().id);
|
||||
public void burn() {
|
||||
if (this.canBurn()) {
|
||||
ItemStack itemstack = FurnaceRecipes.getInstance().a(this.items[0].getItem().id);
|
||||
|
||||
// CraftBukkit start
|
||||
CraftServer cserver = this.world.getServer();
|
||||
CraftWorld cworld = this.world.getWorld();
|
||||
CraftItemStack source = new CraftItemStack(this.items[0]);
|
||||
CraftItemStack result = new CraftItemStack(itemstack.j());
|
||||
CraftItemStack result = new CraftItemStack(itemstack.cloneItemStack());
|
||||
|
||||
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(cworld.getBlockAt(this.e, this.f, this.g), source, result);
|
||||
cserver.getPluginManager().callEvent(furnaceSmeltEvent);
|
||||
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), source, result);
|
||||
this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
|
||||
|
||||
if (furnaceSmeltEvent.isCancelled()) {
|
||||
return;
|
||||
@ -208,11 +214,11 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
org.bukkit.inventory.ItemStack oldResult = furnaceSmeltEvent.getResult();
|
||||
ItemStack newResult = new ItemStack(oldResult.getTypeId(), oldResult.getAmount(), oldResult.getDurability());
|
||||
itemstack = newResult;
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.items[2] == null) {
|
||||
this.items[2] = itemstack;
|
||||
this.items[2] = itemstack.cloneItemStack();
|
||||
} else if (this.items[2].id == itemstack.id) {
|
||||
// CraftBukkit start - compare damage too
|
||||
// CraftBukkit - compare damage too
|
||||
if (this.items[2].damage == itemstack.damage) {
|
||||
this.items[2].count += itemstack.count;
|
||||
}
|
||||
@ -226,7 +232,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
}
|
||||
|
||||
private int a(ItemStack itemstack) {
|
||||
private int fuelTime(ItemStack itemstack) {
|
||||
if (itemstack == null) {
|
||||
return 0;
|
||||
} else {
|
||||
@ -237,6 +243,6 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public boolean a_(EntityHuman entityhuman) {
|
||||
return this.world.getTileEntity(this.e, this.f, this.g) != this ? false : entityhuman.d((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D) <= 64.0D;
|
||||
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.d((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit
|
||||
|
||||
public class TileEntityMobSpawner extends TileEntity {
|
||||
|
||||
@ -19,15 +18,15 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.world.a((double) this.e + 0.5D, (double) this.f + 0.5D, (double) this.g + 0.5D, 16.0D) != null;
|
||||
return this.world.a((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, 16.0D) != null;
|
||||
}
|
||||
|
||||
public void g_() {
|
||||
this.c = this.b;
|
||||
if (this.a()) {
|
||||
double d0 = (double) ((float) this.e + this.world.random.nextFloat());
|
||||
double d1 = (double) ((float) this.f + this.world.random.nextFloat());
|
||||
double d2 = (double) ((float) this.g + this.world.random.nextFloat());
|
||||
double d0 = (double) ((float) this.x + this.world.random.nextFloat());
|
||||
double d1 = (double) ((float) this.y + this.world.random.nextFloat());
|
||||
double d2 = (double) ((float) this.z + this.world.random.nextFloat());
|
||||
|
||||
this.world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
@ -59,7 +58,7 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.e, (double) this.f, (double) this.g, (double) (this.e + 1), (double) (this.f + 1), (double) (this.g + 1)).b(8.0D, 4.0D, 8.0D)).size();
|
||||
int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).b(8.0D, 4.0D, 8.0D)).size();
|
||||
|
||||
if (j >= 6) {
|
||||
this.c();
|
||||
@ -67,9 +66,9 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
}
|
||||
|
||||
if (entityliving != null) {
|
||||
double d3 = (double) this.e + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
||||
double d4 = (double) (this.f + this.world.random.nextInt(3) - 1);
|
||||
double d5 = (double) this.g + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
||||
double d3 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
||||
double d4 = (double) (this.y + this.world.random.nextInt(3) - 1);
|
||||
double d5 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
||||
|
||||
entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
|
||||
if (entityliving.d()) {
|
||||
@ -77,9 +76,9 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
this.world.addEntity(entityliving, SpawnReason.SPAWNER);
|
||||
|
||||
for (int k = 0; k < 20; ++k) {
|
||||
d0 = (double) this.e + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||
d1 = (double) this.f + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||
d2 = (double) this.g + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||
d0 = (double) this.x + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||
d1 = (double) this.y + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||
d2 = (double) this.z + 0.5D + ((double) this.world.random.nextFloat() - 0.5D) * 2.0D;
|
||||
this.world.a("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
this.world.a("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ public class TileEntitySign extends TileEntity {
|
||||
|
||||
public String[] lines = new String[] { "", "", "", ""};
|
||||
public int b = -1;
|
||||
private boolean c = true;
|
||||
private boolean isEditable = true;
|
||||
|
||||
public TileEntitySign() {}
|
||||
|
||||
@ -17,7 +17,7 @@ public class TileEntitySign extends TileEntity {
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.c = false;
|
||||
this.isEditable = false;
|
||||
super.a(nbttagcompound);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
@ -41,16 +41,16 @@ public class TileEntitySign extends TileEntity {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
return new Packet130UpdateSign(this.e, this.f, this.g, astring);
|
||||
return new Packet130UpdateSign(this.x, this.y, this.z, astring);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.c;
|
||||
return this.isEditable;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public void setEditable(boolean editable) {
|
||||
this.c = editable;
|
||||
this.isEditable = editable;
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import java.util.TreeSet;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
@ -26,7 +25,6 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
import org.bukkit.event.weather.ThunderChangeEvent;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
// CraftBukkit end
|
||||
|
||||
public class World implements IBlockAccess {
|
||||
@ -50,7 +48,7 @@ public class World implements IBlockAccess {
|
||||
protected float l;
|
||||
protected int m = 0;
|
||||
public int n = 0;
|
||||
public boolean o = false;
|
||||
public boolean suppressPhysics = false;
|
||||
private long H = System.currentTimeMillis();
|
||||
protected int p = 40;
|
||||
public int spawnMonsters;
|
||||
@ -63,7 +61,7 @@ public class World implements IBlockAccess {
|
||||
public WorldData worldData; // CraftBukkit - protected -> public
|
||||
public boolean isLoading;
|
||||
private boolean I;
|
||||
public WorldMapCollection z;
|
||||
public WorldMapCollection worldMaps;
|
||||
private ArrayList J = new ArrayList();
|
||||
private int K = 0;
|
||||
public boolean allowMonsters = true; // CraftBukkit - private -> public
|
||||
@ -88,40 +86,40 @@ public class World implements IBlockAccess {
|
||||
final Object chunkLock = new Object();
|
||||
|
||||
private boolean canSpawn(int x, int z) {
|
||||
if (generator != null) {
|
||||
return this.generator.canSpawn(((WorldServer) this).getWorld(), x, z);
|
||||
if (this.generator != null) {
|
||||
return this.generator.canSpawn(this.getWorld(), x, z);
|
||||
} else {
|
||||
return this.worldProvider.a(x, z);
|
||||
return this.worldProvider.canSpawn(x, z);
|
||||
}
|
||||
}
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
return world;
|
||||
return this.world;
|
||||
}
|
||||
|
||||
public CraftServer getServer() {
|
||||
return (CraftServer)Bukkit.getServer();
|
||||
return (CraftServer) Bukkit.getServer();
|
||||
}
|
||||
|
||||
// CraftBukkit - changed signature
|
||||
public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider, ChunkGenerator gen, Environment env) {
|
||||
public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider, ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||
this.generator = gen;
|
||||
this.world = new CraftWorld((WorldServer)this, gen, env);
|
||||
this.world = new CraftWorld((WorldServer) this, gen, env);
|
||||
// CraftBukkit end
|
||||
|
||||
this.O = this.random.nextInt(12000);
|
||||
this.P = new ArrayList();
|
||||
this.isStatic = false;
|
||||
this.w = idatamanager;
|
||||
this.z = new WorldMapCollection(idatamanager);
|
||||
this.worldMaps = new WorldMapCollection(idatamanager);
|
||||
this.worldData = idatamanager.c();
|
||||
this.s = this.worldData == null;
|
||||
if (worldprovider != null) {
|
||||
this.worldProvider = worldprovider;
|
||||
} else if (this.worldData != null && this.worldData.h() == -1) {
|
||||
this.worldProvider = WorldProvider.a(-1);
|
||||
this.worldProvider = WorldProvider.byDimension(-1);
|
||||
} else {
|
||||
this.worldProvider = WorldProvider.a(0);
|
||||
this.worldProvider = WorldProvider.byDimension(0);
|
||||
}
|
||||
|
||||
boolean flag = false;
|
||||
@ -142,13 +140,13 @@ public class World implements IBlockAccess {
|
||||
this.g();
|
||||
this.x();
|
||||
|
||||
getServer().addWorld(world);// Craftbukkit
|
||||
this.getServer().addWorld(this.world); // CraftBukkit
|
||||
}
|
||||
|
||||
protected IChunkProvider b() {
|
||||
IChunkLoader ichunkloader = this.w.a(this.worldProvider);
|
||||
|
||||
return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.worldProvider.b());
|
||||
return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.worldProvider.getChunkProvider());
|
||||
}
|
||||
|
||||
protected void c() {
|
||||
@ -159,22 +157,22 @@ public class World implements IBlockAccess {
|
||||
int j;
|
||||
|
||||
// CraftBukkit start
|
||||
if (generator != null) {
|
||||
Random rand = new Random(getSeed());
|
||||
Location spawn = generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
|
||||
if (this.generator != null) {
|
||||
Random rand = new Random(this.getSeed());
|
||||
Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
|
||||
|
||||
if (spawn != null) {
|
||||
if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
|
||||
throw new IllegalStateException("Cannot set spawn point for " + worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
|
||||
throw new IllegalStateException("Cannot set spawn point for " + this.worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
|
||||
} else {
|
||||
worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
|
||||
isLoading = false;
|
||||
this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
|
||||
this.isLoading = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; !canSpawn(i, j); j += this.random.nextInt(64) - this.random.nextInt(64)) {
|
||||
for (j = 0; !this.canSpawn(i, j); j += this.random.nextInt(64) - this.random.nextInt(64)) {
|
||||
i += this.random.nextInt(64) - this.random.nextInt(64);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -194,7 +192,7 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void save(boolean flag, IProgressUpdate iprogressupdate) {
|
||||
if (this.chunkProvider.b()) {
|
||||
if (this.chunkProvider.canSave()) {
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.a("Saving level");
|
||||
}
|
||||
@ -211,7 +209,7 @@ public class World implements IBlockAccess {
|
||||
private void w() {
|
||||
this.k();
|
||||
this.w.a(this.worldData, this.players);
|
||||
this.z.a();
|
||||
this.worldMaps.a();
|
||||
}
|
||||
|
||||
public int getTypeId(int i, int j, int k) {
|
||||
@ -226,7 +224,7 @@ public class World implements IBlockAccess {
|
||||
return j >= 0 && j < 128 ? this.isChunkLoaded(i >> 4, k >> 4) : false;
|
||||
}
|
||||
|
||||
public boolean a(int i, int j, int k, int l) {
|
||||
public boolean areChunksLoaded(int i, int j, int k, int l) {
|
||||
return this.a(i - l, j - l, k - l, i + l, j + l, k + l);
|
||||
}
|
||||
|
||||
@ -257,20 +255,20 @@ public class World implements IBlockAccess {
|
||||
return this.chunkProvider.isChunkLoaded(i, j);
|
||||
}
|
||||
|
||||
public Chunk b(int i, int j) {
|
||||
public Chunk getChunkAtWorldCoords(int i, int j) {
|
||||
return this.getChunkAt(i >> 4, j >> 4);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public Chunk getChunkAt(int i, int j) {
|
||||
Chunk result = null;
|
||||
synchronized (chunkLock) {
|
||||
if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
|
||||
lastXAccessed = i;
|
||||
lastZAccessed = j;
|
||||
lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j);
|
||||
synchronized (this.chunkLock) {
|
||||
if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) {
|
||||
this.lastXAccessed = i;
|
||||
this.lastZAccessed = j;
|
||||
this.lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j);
|
||||
}
|
||||
result = lastChunkAccessed;
|
||||
result = this.lastChunkAccessed;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -431,7 +429,7 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
private void k(int i, int j, int k, int l) {
|
||||
if (!this.o && !this.isStatic) {
|
||||
if (!this.suppressPhysics && !this.isStatic) {
|
||||
Block block = Block.byId[this.getTypeId(i, j, k)];
|
||||
|
||||
if (block != null) {
|
||||
@ -439,7 +437,7 @@ public class World implements IBlockAccess {
|
||||
CraftWorld world = ((WorldServer) this).getWorld();
|
||||
if (world != null) {
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
|
||||
getServer().getPluginManager().callEvent(event);
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -820,14 +818,14 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean a(Entity entity) {
|
||||
public boolean strikeLightning(Entity entity) {
|
||||
this.e.add(entity);
|
||||
return true;
|
||||
}
|
||||
|
||||
// CraftBukkit start - used for entities other than creatures
|
||||
public boolean addEntity(Entity entity) {
|
||||
return addEntity(entity, SpawnReason.CUSTOM); // Set reason as Custom by default
|
||||
return this.addEntity(entity, SpawnReason.CUSTOM); // Set reason as Custom by default
|
||||
}
|
||||
|
||||
|
||||
@ -989,7 +987,7 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public int e(int i, int j) {
|
||||
Chunk chunk = this.b(i, j);
|
||||
Chunk chunk = this.getChunkAtWorldCoords(i, j);
|
||||
int k = 127;
|
||||
|
||||
i &= 15;
|
||||
@ -1007,7 +1005,7 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public int f(int i, int j) {
|
||||
Chunk chunk = this.b(i, j);
|
||||
Chunk chunk = this.getChunkAtWorldCoords(i, j);
|
||||
int k = 127;
|
||||
|
||||
i &= 15;
|
||||
@ -1438,7 +1436,7 @@ public class World implements IBlockAccess {
|
||||
return (float) i / (float) j;
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
public void douseFire(EntityHuman entityhuman, int i, int j, int k, int l) {
|
||||
if (l == 0) {
|
||||
--j;
|
||||
}
|
||||
@ -1553,7 +1551,7 @@ public class World implements IBlockAccess {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.b(k1, l1).g()) {
|
||||
if (this.getChunkAtWorldCoords(k1, l1).isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1619,7 +1617,7 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
|
||||
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && getServer().getHandle().players.size() > 0)) {
|
||||
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
|
||||
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -1646,9 +1644,9 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
private void x() {
|
||||
if (this.worldData.l()) {
|
||||
if (this.worldData.hasStorm()) {
|
||||
this.j = 1.0F;
|
||||
if (this.worldData.j()) {
|
||||
if (this.worldData.isThundering()) {
|
||||
this.l = 1.0F;
|
||||
}
|
||||
}
|
||||
@ -1660,56 +1658,53 @@ public class World implements IBlockAccess {
|
||||
--this.m;
|
||||
}
|
||||
|
||||
int i = this.worldData.k();
|
||||
int i = this.worldData.getThunderDuration();
|
||||
|
||||
if (i <= 0) {
|
||||
if (this.worldData.j()) {
|
||||
this.worldData.b(this.random.nextInt(12000) + 3600);
|
||||
if (this.worldData.isThundering()) {
|
||||
this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
|
||||
} else {
|
||||
this.worldData.b(this.random.nextInt(168000) + 12000);
|
||||
this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
|
||||
}
|
||||
} else {
|
||||
--i;
|
||||
this.worldData.b(i);
|
||||
this.worldData.setThunderDuration(i);
|
||||
if (i <= 0) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = getServer();
|
||||
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent(((WorldServer) this).getWorld(), !this.worldData.j());
|
||||
server.getPluginManager().callEvent(thunder);
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
|
||||
this.getServer().getPluginManager().callEvent(thunder);
|
||||
if (!thunder.isCancelled()) {
|
||||
this.worldData.a(!this.worldData.j());
|
||||
this.worldData.setThundering(!this.worldData.isThundering());
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
int j = this.worldData.m();
|
||||
int j = this.worldData.getWeatherDuration();
|
||||
|
||||
if (j <= 0) {
|
||||
if (this.worldData.l()) {
|
||||
this.worldData.c(this.random.nextInt(12000) + 12000);
|
||||
if (this.worldData.hasStorm()) {
|
||||
this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
|
||||
} else {
|
||||
this.worldData.c(this.random.nextInt(168000) + 12000);
|
||||
this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
|
||||
}
|
||||
} else {
|
||||
--j;
|
||||
this.worldData.c(j);
|
||||
this.worldData.setWeatherDuration(j);
|
||||
if (j <= 0) {
|
||||
// CraftBukkit start
|
||||
CraftServer server = getServer();
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm());
|
||||
this.getServer().getPluginManager().callEvent(weather);
|
||||
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent(((WorldServer) this).getWorld(), !this.worldData.l());
|
||||
server.getPluginManager().callEvent(weather);
|
||||
if (!weather.isCancelled()) {
|
||||
this.worldData.b(!this.worldData.l());
|
||||
this.worldData.setStorm(!this.worldData.hasStorm());
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
this.i = this.j;
|
||||
if (this.worldData.l()) {
|
||||
if (this.worldData.hasStorm()) {
|
||||
this.j = (float) ((double) this.j + 0.01D);
|
||||
} else {
|
||||
this.j = (float) ((double) this.j - 0.01D);
|
||||
@ -1724,7 +1719,7 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
this.k = this.l;
|
||||
if (this.worldData.j()) {
|
||||
if (this.worldData.isThundering()) {
|
||||
this.l = (float) ((double) this.l + 0.01D);
|
||||
} else {
|
||||
this.l = (float) ((double) this.l - 0.01D);
|
||||
@ -1742,20 +1737,18 @@ public class World implements IBlockAccess {
|
||||
|
||||
private void y() {
|
||||
// CraftBukkit start
|
||||
CraftServer server = getServer();
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
|
||||
this.getServer().getPluginManager().callEvent(weather);
|
||||
|
||||
WeatherChangeEvent weather = new WeatherChangeEvent(((WorldServer) this).getWorld(), false);
|
||||
server.getPluginManager().callEvent(weather);
|
||||
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent(((WorldServer) this).getWorld(), false);
|
||||
server.getPluginManager().callEvent(thunder);
|
||||
ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
|
||||
this.getServer().getPluginManager().callEvent(thunder);
|
||||
if (!weather.isCancelled()) {
|
||||
this.worldData.c(0);
|
||||
this.worldData.b(false);
|
||||
this.worldData.setWeatherDuration(0);
|
||||
this.worldData.setStorm(false);
|
||||
}
|
||||
if (!thunder.isCancelled()) {
|
||||
this.worldData.b(0);
|
||||
this.worldData.a(false);
|
||||
this.worldData.setThunderDuration(0);
|
||||
this.worldData.setThundering(false);
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@ -1824,7 +1817,7 @@ public class World implements IBlockAccess {
|
||||
j1 = j + (k >> 8 & 15);
|
||||
k1 = this.e(l, j1);
|
||||
if (this.s(l, k1, j1)) {
|
||||
this.a((Entity) (new EntityWeatherStorm(this, (double) l, (double) k1, (double) j1)));
|
||||
this.strikeLightning(new EntityWeatherStorm(this, (double) l, (double) k1, (double) j1));
|
||||
this.m = 2;
|
||||
}
|
||||
}
|
||||
@ -1844,7 +1837,7 @@ public class World implements IBlockAccess {
|
||||
// CraftBukkit start
|
||||
SnowFormEvent snow = new SnowFormEvent(this.getWorld().getBlockAt(l + i, k1, j1 + j));
|
||||
|
||||
getServer().getPluginManager().callEvent(snow);
|
||||
this.getServer().getPluginManager().callEvent(snow);
|
||||
if (!snow.isCancelled()) {
|
||||
this.setTypeId(l + i, k1, j1 + j, snow.getMaterial().getId());
|
||||
this.setData(l + i, k1, j1 + j, snow.getData());
|
||||
@ -1857,7 +1850,7 @@ public class World implements IBlockAccess {
|
||||
BlockState blockState = this.getWorld().getBlockAt(l + i, k1 - 1, j1 + j).getState();
|
||||
blockState.setTypeId(Block.ICE.id);
|
||||
|
||||
BlockFormEvent iceBlockForm = new BlockFormEvent(this.getWorld().getBlockAt(l + i, k1 - 1, j1 + j), blockState);
|
||||
BlockFormEvent iceBlockForm = new BlockFormEvent(blockState.getBlock(), blockState);
|
||||
this.getServer().getPluginManager().callEvent(iceBlockForm);
|
||||
if (!iceBlockForm.isCancelled()) {
|
||||
blockState.update(true);
|
||||
@ -1953,7 +1946,7 @@ public class World implements IBlockAccess {
|
||||
|
||||
public void b(int i, int j, int k, TileEntity tileentity) {
|
||||
if (this.isLoaded(i, j, k)) {
|
||||
this.b(i, k).f();
|
||||
this.getChunkAtWorldCoords(i, k).f();
|
||||
}
|
||||
|
||||
for (int l = 0; l < this.u.size(); ++l) {
|
||||
@ -2018,8 +2011,8 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(((WorldServer) this).getWorld().getBlockAt(j, k, l), i, defaultReturn);
|
||||
getServer().getPluginManager().callEvent(event);
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(this.getWorld().getBlockAt(j, k, l), i, defaultReturn);
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
return event.isBuildable();
|
||||
// CraftBukkit end
|
||||
@ -2081,7 +2074,7 @@ public class World implements IBlockAccess {
|
||||
return this.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (this.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (this.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (this.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (this.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : this.isBlockFaceIndirectlyPowered(i + 1, j, k, 5)))));
|
||||
}
|
||||
|
||||
public EntityHuman a(Entity entity, double d0) {
|
||||
public EntityHuman findNearbyPlayer(Entity entity, double d0) {
|
||||
return this.a(entity.locX, entity.locY, entity.locZ, d0);
|
||||
}
|
||||
|
||||
@ -2117,7 +2110,7 @@ public class World implements IBlockAccess {
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte[] c(int i, int j, int k, int l, int i1, int j1) {
|
||||
public byte[] getMultiChunkData(int i, int j, int k, int l, int i1, int j1) {
|
||||
byte[] abyte = new byte[l * i1 * j1 * 5 / 2];
|
||||
int k1 = i >> 4;
|
||||
int l1 = k >> 4;
|
||||
@ -2159,7 +2152,7 @@ public class World implements IBlockAccess {
|
||||
k4 = 16;
|
||||
}
|
||||
|
||||
k2 = this.getChunkAt(j3, i4).a(abyte, k3, l2, j4, l3, i3, k4, k2);
|
||||
k2 = this.getChunkAt(j3, i4).getData(abyte, k3, l2, j4, l3, i3, k4, k2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2175,7 +2168,7 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
return this.worldData.b();
|
||||
return this.worldData.getSeed();
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
@ -2196,7 +2189,7 @@ public class World implements IBlockAccess {
|
||||
return this.chunkProvider;
|
||||
}
|
||||
|
||||
public void d(int i, int j, int k, int l, int i1) {
|
||||
public void playNote(int i, int j, int k, int l, int i1) {
|
||||
int j1 = this.getTypeId(i, j, k);
|
||||
|
||||
if (j1 > 0) {
|
||||
@ -2231,8 +2224,8 @@ public class World implements IBlockAccess {
|
||||
// Calls the method that checks to see if players are sleeping
|
||||
// Called by CraftPlayer.setPermanentSleeping()
|
||||
public void checkSleepStatus() {
|
||||
if (!isStatic) {
|
||||
everyoneSleeping();
|
||||
if (!this.isStatic) {
|
||||
this.everyoneSleeping();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -2312,15 +2305,15 @@ public class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void a(String s, WorldMapBase worldmapbase) {
|
||||
this.z.a(s, worldmapbase);
|
||||
this.worldMaps.a(s, worldmapbase);
|
||||
}
|
||||
|
||||
public WorldMapBase a(Class oclass, String s) {
|
||||
return this.z.a(oclass, s);
|
||||
return this.worldMaps.a(oclass, s);
|
||||
}
|
||||
|
||||
public int b(String s) {
|
||||
return this.z.a(s);
|
||||
return this.worldMaps.a(s);
|
||||
}
|
||||
|
||||
public void e(int i, int j, int k, int l, int i1) {
|
||||
|
@ -21,13 +21,13 @@ public class WorldData {
|
||||
private int o;
|
||||
|
||||
public WorldData(NBTTagCompound nbttagcompound) {
|
||||
this.a = nbttagcompound.f("RandomSeed");
|
||||
this.a = nbttagcompound.getLong("RandomSeed");
|
||||
this.b = nbttagcompound.e("SpawnX");
|
||||
this.c = nbttagcompound.e("SpawnY");
|
||||
this.d = nbttagcompound.e("SpawnZ");
|
||||
this.e = nbttagcompound.f("Time");
|
||||
this.f = nbttagcompound.f("LastPlayed");
|
||||
this.g = nbttagcompound.f("SizeOnDisk");
|
||||
this.e = nbttagcompound.getLong("Time");
|
||||
this.f = nbttagcompound.getLong("LastPlayed");
|
||||
this.g = nbttagcompound.getLong("SizeOnDisk");
|
||||
this.name = nbttagcompound.getString("LevelName");
|
||||
this.k = nbttagcompound.e("version");
|
||||
this.m = nbttagcompound.e("rainTime");
|
||||
@ -89,13 +89,13 @@ public class WorldData {
|
||||
}
|
||||
|
||||
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
|
||||
nbttagcompound.a("RandomSeed", this.a);
|
||||
nbttagcompound.setLong("RandomSeed", this.a);
|
||||
nbttagcompound.a("SpawnX", this.b);
|
||||
nbttagcompound.a("SpawnY", this.c);
|
||||
nbttagcompound.a("SpawnZ", this.d);
|
||||
nbttagcompound.a("Time", this.e);
|
||||
nbttagcompound.a("SizeOnDisk", this.g);
|
||||
nbttagcompound.a("LastPlayed", System.currentTimeMillis());
|
||||
nbttagcompound.setLong("Time", this.e);
|
||||
nbttagcompound.setLong("SizeOnDisk", this.g);
|
||||
nbttagcompound.setLong("LastPlayed", System.currentTimeMillis());
|
||||
nbttagcompound.setString("LevelName", this.name);
|
||||
nbttagcompound.a("version", this.k);
|
||||
nbttagcompound.a("rainTime", this.m);
|
||||
@ -107,7 +107,7 @@ public class WorldData {
|
||||
}
|
||||
}
|
||||
|
||||
public long b() {
|
||||
public long getSeed() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@ -161,35 +161,35 @@ public class WorldData {
|
||||
this.k = i;
|
||||
}
|
||||
|
||||
public boolean j() {
|
||||
public boolean isThundering() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
public void setThundering(boolean flag) {
|
||||
this.n = flag;
|
||||
}
|
||||
|
||||
public int k() {
|
||||
public int getThunderDuration() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
public void setThunderDuration(int i) {
|
||||
this.o = i;
|
||||
}
|
||||
|
||||
public boolean l() {
|
||||
public boolean hasStorm() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public void b(boolean flag) {
|
||||
public void setStorm(boolean flag) {
|
||||
this.l = flag;
|
||||
}
|
||||
|
||||
public int m() {
|
||||
public int getWeatherDuration() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
public void setWeatherDuration(int i) {
|
||||
this.m = i;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user